@scalar/agent-chat 0.2.1 → 0.2.3

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 (256) hide show
  1. package/dist/App.vue.d.ts +6 -1
  2. package/dist/App.vue.d.ts.map +1 -1
  3. package/dist/Chat.vue.d.ts.map +1 -1
  4. package/dist/Tooltip-Cm82QgNj.js +575 -0
  5. package/dist/__vite-optional-peer-dep_stream-markdown_markstream-vue_false-sdjmOmXd.js +5 -0
  6. package/dist/__vite-optional-peer-dep_stream-monaco_markstream-vue_false-HdL4xm5U.js +5 -0
  7. package/dist/__vite-optional-peer-dep_vue-i18n_markstream-vue_false-B9Pwe5kz.js +5 -0
  8. package/dist/_basePickBy-hHD8tMGb.js +151 -0
  9. package/dist/_baseUniq-DTF1wuF6.js +614 -0
  10. package/dist/arc-Dw2RQerU.js +83 -0
  11. package/dist/architecture-U656AL7Q-B00Z9eXr.js +36 -0
  12. package/dist/architectureDiagram-VXUJARFQ-BtOffFaM.js +4662 -0
  13. package/dist/blockDiagram-VD42YOAC-BUqFMMQe.js +2261 -0
  14. package/dist/c4Diagram-YG6GDRKO-NrM1YcpG.js +1579 -0
  15. package/dist/channel-105myCGU.js +5 -0
  16. package/dist/chunk-4BX2VUAB-TAxJli7C.js +8 -0
  17. package/dist/chunk-55IACEB6-VXFJ4bz5.js +8 -0
  18. package/dist/chunk-B4BG7PRW-CZDQpfj5.js +1375 -0
  19. package/dist/chunk-DI55MBZ5-D3l7TA-E.js +1370 -0
  20. package/dist/chunk-FMBD7UC4-BMXFm8I3.js +19 -0
  21. package/dist/chunk-QN33PNHL-BOUpbpWp.js +19 -0
  22. package/dist/chunk-QZHKN3VN-C-TEEx05.js +15 -0
  23. package/dist/chunk-TZMSLE5B-BUiROKNR.js +64 -0
  24. package/dist/classDiagram-2ON5EDUG-HQET4ybK.js +16 -0
  25. package/dist/classDiagram-v2-WZHVMYZB-HQET4ybK.js +16 -0
  26. package/dist/clone-CIIO71O9.js +8 -0
  27. package/dist/components/ApprovalSection.vue.d.ts.map +1 -1
  28. package/dist/components/PaymentSection.vue.d.ts +9 -0
  29. package/dist/components/PaymentSection.vue.d.ts.map +1 -0
  30. package/dist/components/RequestPreview.vue.d.ts.map +1 -1
  31. package/dist/components/ResponseBody/ResponseBody.vue.d.ts +1 -1
  32. package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts +1 -1
  33. package/dist/cose-bilkent-S5V4N54A-CMsF4n-5.js +2609 -0
  34. package/dist/cytoscape.esm-DfdJODL8.js +18735 -0
  35. package/dist/dagre-6UL2VRFP-DqzdQ6Qg.js +444 -0
  36. package/dist/defaultLocale-BEa-49Qz.js +171 -0
  37. package/dist/diagram-PSM6KHXK-1xyGntw2.js +531 -0
  38. package/dist/diagram-QEK2KX5R-DdZdlAm1.js +217 -0
  39. package/dist/diagram-S2PKOQOG-C80Eo2jp.js +142 -0
  40. package/dist/erDiagram-Q2GNP2WA-DFVRrMXT.js +841 -0
  41. package/dist/flowDiagram-NV44I4VS-D9QK_qqB.js +1620 -0
  42. package/dist/ganttDiagram-LVOFAZNH-Bo1NTkeQ.js +2506 -0
  43. package/dist/gitGraph-F6HP7TQM-C5hdgcgO.js +27 -0
  44. package/dist/gitGraphDiagram-NY62KEGX-BZqnqZh6.js +699 -0
  45. package/dist/graph-Dth4IhEK.js +247 -0
  46. package/dist/helpers.d.ts +1 -1
  47. package/dist/hooks/useSearch.d.ts.map +1 -1
  48. package/dist/index-BOvT43H8.js +111780 -0
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.js +2 -3
  51. package/dist/index2-B36B-gt0.js +69 -0
  52. package/dist/index3-CtIyYUnG.js +70 -0
  53. package/dist/index4-Dzz91Ao2.js +537 -0
  54. package/dist/index5-Bmz0gMSP.js +590 -0
  55. package/dist/index6-DMB3qTSV.js +196 -0
  56. package/dist/info-NVLQJR56-azt5obk5.js +27 -0
  57. package/dist/infoDiagram-ER5ION4S-DD4Jtctm.js +24 -0
  58. package/dist/infographic_markstream-vue_false-BfsmcXxk.js +5 -0
  59. package/dist/init-DjUOC4st.js +16 -0
  60. package/dist/journeyDiagram-XKPGCS4Q-CXL6UO0r.js +834 -0
  61. package/dist/kanban-definition-3W4ZIXB7-B57do5Wg.js +719 -0
  62. package/dist/katex-SsTUIUTC.js +11688 -0
  63. package/dist/layout-7TCY8eA2.js +1332 -0
  64. package/dist/linear-DSm5i91N.js +625 -0
  65. package/dist/mermaid-parser.core-CUQWpAMM.js +12746 -0
  66. package/dist/mermaid.core-QjuzH7xx.js +14164 -0
  67. package/dist/mhchem-XHl7cef5.js +2306 -0
  68. package/dist/mindmap-definition-VGOIOE7T-DAQyGNAM.js +784 -0
  69. package/dist/ordinal-DfAQgscy.js +61 -0
  70. package/dist/package.json +2 -2
  71. package/dist/packet-BFZMPI3H-CixuxAEA.js +27 -0
  72. package/dist/pie-7BOR55EZ-D3cgnzR1.js +32 -0
  73. package/dist/pieDiagram-ADFJNKIX-BqxgYwrL.js +161 -0
  74. package/dist/quadrantDiagram-AYHSOK5B-CQ4v-9Hh.js +1022 -0
  75. package/dist/radar-NHE76QYJ-DhV0Od_M.js +27 -0
  76. package/dist/registry/add-documents-to-store.d.ts +3 -2
  77. package/dist/registry/add-documents-to-store.d.ts.map +1 -1
  78. package/dist/requirementDiagram-UZGBJVZJ-ncWNAgFi.js +850 -0
  79. package/dist/safeRaf-I3a3-dyJ.js +10 -0
  80. package/dist/sankeyDiagram-TZEHDZUN-yCR2_cH5.js +810 -0
  81. package/dist/sequenceDiagram-WL72ISMW-DZ7wqFyd.js +2511 -0
  82. package/dist/state/state.d.ts +7 -3
  83. package/dist/state/state.d.ts.map +1 -1
  84. package/dist/stateDiagram-FKZM4ZOC-Dra68Tzi.js +263 -0
  85. package/dist/stateDiagram-v2-4FDKWEC3-CARbPECD.js +16 -0
  86. package/dist/style.css +1 -12713
  87. package/dist/timeline-definition-IT6M3QCI-DEbG9QIM.js +795 -0
  88. package/dist/treemap-KMMF4GRG-CQbPsyWe.js +81 -0
  89. package/dist/views/Chat/Chat.vue.d.ts.map +1 -1
  90. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +1 -1
  91. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts.map +1 -1
  92. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts +1 -1
  93. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts +1 -1
  94. package/dist/views/PromptForm.vue.d.ts.map +1 -1
  95. package/dist/views/Start.vue.d.ts.map +1 -1
  96. package/dist/xychartDiagram-PRI3JC2R-C94Pu8hL.js +1340 -0
  97. package/package.json +1 -1
  98. package/dist/App.vue.js +0 -29
  99. package/dist/App.vue.js.map +0 -1
  100. package/dist/App.vue2.js +0 -5
  101. package/dist/App.vue2.js.map +0 -1
  102. package/dist/Chat.vue.js +0 -55
  103. package/dist/Chat.vue.js.map +0 -1
  104. package/dist/Chat.vue2.js +0 -5
  105. package/dist/Chat.vue2.js.map +0 -1
  106. package/dist/_virtual/_plugin-vue_export-helper.js +0 -11
  107. package/dist/_virtual/_plugin-vue_export-helper.js.map +0 -1
  108. package/dist/components/ApprovalSection.vue.js +0 -8
  109. package/dist/components/ApprovalSection.vue.js.map +0 -1
  110. package/dist/components/ApprovalSection.vue2.js +0 -47
  111. package/dist/components/ApprovalSection.vue2.js.map +0 -1
  112. package/dist/components/AutosendPaused.vue.js +0 -15
  113. package/dist/components/AutosendPaused.vue.js.map +0 -1
  114. package/dist/components/ContextItem.vue.js +0 -8
  115. package/dist/components/ContextItem.vue.js.map +0 -1
  116. package/dist/components/ContextItem.vue2.js +0 -22
  117. package/dist/components/ContextItem.vue2.js.map +0 -1
  118. package/dist/components/Endpoint.vue.js +0 -8
  119. package/dist/components/Endpoint.vue.js.map +0 -1
  120. package/dist/components/Endpoint.vue2.js +0 -98
  121. package/dist/components/Endpoint.vue2.js.map +0 -1
  122. package/dist/components/ErrorMessage.vue.js +0 -8
  123. package/dist/components/ErrorMessage.vue.js.map +0 -1
  124. package/dist/components/ErrorMessage.vue2.js +0 -28
  125. package/dist/components/ErrorMessage.vue2.js.map +0 -1
  126. package/dist/components/LoadingMiniOpenAPIDoc.vue.js +0 -16
  127. package/dist/components/LoadingMiniOpenAPIDoc.vue.js.map +0 -1
  128. package/dist/components/LoadingOpenAPISpecsSummary.vue.js +0 -16
  129. package/dist/components/LoadingOpenAPISpecsSummary.vue.js.map +0 -1
  130. package/dist/components/Logo.vue.js +0 -25
  131. package/dist/components/Logo.vue.js.map +0 -1
  132. package/dist/components/RequestApproved.vue.js +0 -15
  133. package/dist/components/RequestApproved.vue.js.map +0 -1
  134. package/dist/components/RequestFailed.vue.js +0 -26
  135. package/dist/components/RequestFailed.vue.js.map +0 -1
  136. package/dist/components/RequestPreview.vue.js +0 -9
  137. package/dist/components/RequestPreview.vue.js.map +0 -1
  138. package/dist/components/RequestPreview.vue2.js +0 -150
  139. package/dist/components/RequestPreview.vue2.js.map +0 -1
  140. package/dist/components/RequestRejected.vue.js +0 -24
  141. package/dist/components/RequestRejected.vue.js.map +0 -1
  142. package/dist/components/RequestSuccess.vue.js +0 -15
  143. package/dist/components/RequestSuccess.vue.js.map +0 -1
  144. package/dist/components/ResponseBody/ResponseBody.vue.js +0 -45
  145. package/dist/components/ResponseBody/ResponseBody.vue.js.map +0 -1
  146. package/dist/components/ResponseBody/ResponseBody.vue2.js +0 -5
  147. package/dist/components/ResponseBody/ResponseBody.vue2.js.map +0 -1
  148. package/dist/components/ResponseBody/ResponseBodyInfo.vue.js +0 -17
  149. package/dist/components/ResponseBody/ResponseBodyInfo.vue.js.map +0 -1
  150. package/dist/components/ResponseBody/ResponseBodyPreview.vue.js +0 -8
  151. package/dist/components/ResponseBody/ResponseBodyPreview.vue.js.map +0 -1
  152. package/dist/components/ResponseBody/ResponseBodyPreview.vue2.js +0 -73
  153. package/dist/components/ResponseBody/ResponseBodyPreview.vue2.js.map +0 -1
  154. package/dist/components/ResponseBody/ResponseBodyRaw.vue.js +0 -23
  155. package/dist/components/ResponseBody/ResponseBodyRaw.vue.js.map +0 -1
  156. package/dist/components/ResponseBody/ResponseBodyRaw.vue2.js +0 -5
  157. package/dist/components/ResponseBody/ResponseBodyRaw.vue2.js.map +0 -1
  158. package/dist/components/ResponseBody/ResponseBodyToggle.vue.js +0 -30
  159. package/dist/components/ResponseBody/ResponseBodyToggle.vue.js.map +0 -1
  160. package/dist/components/ResponseBody/ResponseBodyToggle.vue2.js +0 -5
  161. package/dist/components/ResponseBody/ResponseBodyToggle.vue2.js.map +0 -1
  162. package/dist/components/ResponseBody/helpers/media-types.js +0 -134
  163. package/dist/components/ResponseBody/helpers/media-types.js.map +0 -1
  164. package/dist/components/ResponseBody/helpers/process-response-body.js +0 -63
  165. package/dist/components/ResponseBody/helpers/process-response-body.js.map +0 -1
  166. package/dist/components/SearchPopover.vue.js +0 -8
  167. package/dist/components/SearchPopover.vue.js.map +0 -1
  168. package/dist/components/SearchPopover.vue2.js +0 -78
  169. package/dist/components/SearchPopover.vue2.js.map +0 -1
  170. package/dist/components/SendingRequest.vue.js +0 -26
  171. package/dist/components/SendingRequest.vue.js.map +0 -1
  172. package/dist/components/Suggestion.vue.js +0 -8
  173. package/dist/components/Suggestion.vue.js.map +0 -1
  174. package/dist/components/Suggestion.vue2.js +0 -28
  175. package/dist/components/Suggestion.vue2.js.map +0 -1
  176. package/dist/components/TestRequestButton.vue.js +0 -8
  177. package/dist/components/TestRequestButton.vue.js.map +0 -1
  178. package/dist/components/TestRequestButton.vue2.js +0 -37
  179. package/dist/components/TestRequestButton.vue2.js.map +0 -1
  180. package/dist/helpers.js +0 -201
  181. package/dist/helpers.js.map +0 -1
  182. package/dist/hooks/useChatApprovals.js +0 -25
  183. package/dist/hooks/useChatApprovals.js.map +0 -1
  184. package/dist/hooks/useChatOperationBlocks.js +0 -29
  185. package/dist/hooks/useChatOperationBlocks.js.map +0 -1
  186. package/dist/hooks/useChatScroll.js +0 -22
  187. package/dist/hooks/useChatScroll.js.map +0 -1
  188. package/dist/hooks/useSearch.js +0 -36
  189. package/dist/hooks/useSearch.js.map +0 -1
  190. package/dist/index.js.map +0 -1
  191. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js +0 -12
  192. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js.map +0 -1
  193. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js +0 -67
  194. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js.map +0 -1
  195. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/errors.js +0 -25
  196. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/errors.js.map +0 -1
  197. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/parse.js +0 -64
  198. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/parse.js.map +0 -1
  199. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/regexes.js +0 -8
  200. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/regexes.js.map +0 -1
  201. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js +0 -181
  202. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js.map +0 -1
  203. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js +0 -85
  204. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js.map +0 -1
  205. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/versions.js +0 -9
  206. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/versions.js.map +0 -1
  207. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/mini/schemas.js +0 -61
  208. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/mini/schemas.js.map +0 -1
  209. package/dist/registry/add-documents-to-store.js +0 -42
  210. package/dist/registry/add-documents-to-store.js.map +0 -1
  211. package/dist/state/state.js +0 -112
  212. package/dist/state/state.js.map +0 -1
  213. package/dist/views/Chat/Chat.vue.js +0 -8
  214. package/dist/views/Chat/Chat.vue.js.map +0 -1
  215. package/dist/views/Chat/Chat.vue2.js +0 -84
  216. package/dist/views/Chat/Chat.vue2.js.map +0 -1
  217. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +0 -8
  218. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js.map +0 -1
  219. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +0 -39
  220. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js.map +0 -1
  221. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js +0 -8
  222. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js.map +0 -1
  223. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js +0 -65
  224. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js.map +0 -1
  225. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js +0 -32
  226. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js.map +0 -1
  227. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue2.js +0 -5
  228. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue2.js.map +0 -1
  229. package/dist/views/Chat/Messages/Text.vue.js +0 -21
  230. package/dist/views/Chat/Messages/Text.vue.js.map +0 -1
  231. package/dist/views/Chat/Messages/Text.vue2.js +0 -5
  232. package/dist/views/Chat/Messages/Text.vue2.js.map +0 -1
  233. package/dist/views/Layout.vue.js +0 -8
  234. package/dist/views/Layout.vue.js.map +0 -1
  235. package/dist/views/Layout.vue2.js +0 -28
  236. package/dist/views/Layout.vue2.js.map +0 -1
  237. package/dist/views/PromptForm.vue.js +0 -8
  238. package/dist/views/PromptForm.vue.js.map +0 -1
  239. package/dist/views/PromptForm.vue2.js +0 -182
  240. package/dist/views/PromptForm.vue2.js.map +0 -1
  241. package/dist/views/Settings/Auth.vue.js +0 -66
  242. package/dist/views/Settings/Auth.vue.js.map +0 -1
  243. package/dist/views/Settings/Auth.vue2.js +0 -5
  244. package/dist/views/Settings/Auth.vue2.js.map +0 -1
  245. package/dist/views/Settings/DocSettings.vue.js +0 -8
  246. package/dist/views/Settings/DocSettings.vue.js.map +0 -1
  247. package/dist/views/Settings/DocSettings.vue2.js +0 -50
  248. package/dist/views/Settings/DocSettings.vue2.js.map +0 -1
  249. package/dist/views/Settings/Settings.vue.js +0 -9
  250. package/dist/views/Settings/Settings.vue.js.map +0 -1
  251. package/dist/views/Settings/Settings.vue2.js +0 -78
  252. package/dist/views/Settings/Settings.vue2.js.map +0 -1
  253. package/dist/views/Start.vue.js +0 -8
  254. package/dist/views/Start.vue.js.map +0 -1
  255. package/dist/views/Start.vue2.js +0 -56
  256. package/dist/views/Start.vue2.js.map +0 -1
@@ -0,0 +1,590 @@
1
+ import { defineComponent as zt, ref as d, computed as K, watch as Y, onBeforeUnmount as Lt, onMounted as At, onUnmounted as Ft, createElementBlock as w, openBlock as g, normalizeClass as y, createCommentVNode as Q, withDirectives as Ht, renderSlot as Je, createElementVNode as n, unref as h, toDisplayString as xe, normalizeStyle as yt, createBlock as Rt, mergeProps as xt, toHandlers as kt, Teleport as Nt, createVNode as _t, Transition as Xt, withCtx as Yt, withModifiers as Vt, vShow as Zt, nextTick as A } from "vue";
2
+ import { J as qt, n as It, o as Ut, Y as bt, a as Wt, m as Gt, u as Jt, b as Kt } from "./index-BOvT43H8.js";
3
+ import { e as Qt } from "./safeRaf-I3a3-dyJ.js";
4
+ var el = Object.defineProperty, tl = Object.defineProperties, ll = Object.getOwnPropertyDescriptors, Mt = Object.getOwnPropertySymbols, rl = Object.prototype.hasOwnProperty, nl = Object.prototype.propertyIsEnumerable, Tt = (L, j, M) => j in L ? el(L, j, { enumerable: !0, configurable: !0, writable: !0, value: M }) : L[j] = M, Ke = (L, j) => {
5
+ for (var M in j || (j = {})) rl.call(j, M) && Tt(L, M, j[M]);
6
+ if (Mt) for (var M of Mt(j)) nl.call(j, M) && Tt(L, M, j[M]);
7
+ return L;
8
+ }, D = (L, j, M) => new Promise((ke, o) => {
9
+ var re = (F) => {
10
+ try {
11
+ P(M.next(F));
12
+ } catch (ne) {
13
+ o(ne);
14
+ }
15
+ }, be = (F) => {
16
+ try {
17
+ P(M.throw(F));
18
+ } catch (ne) {
19
+ o(ne);
20
+ }
21
+ }, P = (F) => F.done ? ke(F.value) : Promise.resolve(F.value).then(re, be);
22
+ P((M = M.apply(L, j)).next());
23
+ });
24
+ const ol = { key: 0 }, al = { key: 1, class: "flex items-center gap-x-2 overflow-hidden" }, il = ["src"], ul = { key: 2 }, sl = { class: "flex items-center gap-x-1" }, cl = { class: "flex items-center gap-x-1" }, dl = { key: 4 }, vl = { key: 5, class: "flex items-center gap-x-1" }, ml = ["aria-pressed"], fl = { key: 0, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, hl = { key: 1, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, gl = ["disabled"], pl = ["disabled"], wl = { key: 0, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "0.75rem", height: "0.75rem", viewBox: "0 0 24 24" }, yl = { key: 1, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "0.75rem", height: "0.75rem", viewBox: "0 0 24 24" }, xl = { key: 1, class: "relative" }, kl = { key: 0, class: "absolute top-2 right-2 z-10 rounded-lg" }, bl = { class: "flex items-center gap-2 backdrop-blur rounded-lg" }, Ml = { class: "markstream-vue" }, Tl = { class: "absolute top-6 right-6 z-50 flex items-center gap-2" }, Qe = /* @__PURE__ */ qt(/* @__PURE__ */ zt({ __name: "MermaidBlockNode", props: { node: {}, maxHeight: { default: "500px" }, loading: { type: Boolean, default: !0 }, isDark: { type: Boolean }, workerTimeoutMs: { default: 1400 }, parseTimeoutMs: { default: 1800 }, renderTimeoutMs: { default: 2500 }, fullRenderTimeoutMs: { default: 4e3 }, showHeader: { type: Boolean, default: !0 }, showModeToggle: { type: Boolean, default: !0 }, showCopyButton: { type: Boolean, default: !0 }, showExportButton: { type: Boolean, default: !0 }, showFullscreenButton: { type: Boolean, default: !0 }, showCollapseButton: { type: Boolean, default: !0 }, showZoomControls: { type: Boolean, default: !0 }, enableWheelZoom: { type: Boolean, default: !1 }, isStrict: { type: Boolean, default: !1 } }, emits: ["copy", "export", "openModal", "toggleMode"], setup(L, { emit: j }) {
25
+ var M, ke;
26
+ const o = L, re = j, be = { USE_PROFILES: { svg: !0 }, FORBID_TAGS: ["script"], FORBID_ATTR: [/^on/i], ADD_TAGS: ["style"], ADD_ATTR: ["style"], SAFE_FOR_TEMPLATES: !0 }, P = d(!1), F = K(() => o.isStrict ? "strict" : "loose"), ne = K(() => ({ startOnLoad: !1, securityLevel: F.value, dompurifyConfig: F.value === "strict" ? be : void 0, flowchart: F.value === "strict" ? { htmlLabels: !1 } : void 0 })), Ct = [/javascript:/i, /expression\s*\(/i, /url\s*\(\s*javascript:/i, /@import/i], Dt = /^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;
27
+ function Bt(t) {
28
+ if (!t) return "";
29
+ const e = t.trim();
30
+ return Dt.test(e) ? e : "";
31
+ }
32
+ function Me(t) {
33
+ if (t) try {
34
+ t.replaceChildren();
35
+ } catch {
36
+ t.innerHTML = "";
37
+ }
38
+ }
39
+ function oe(t, e) {
40
+ if (!t) return "";
41
+ if (F.value === "strict") return (function(l, r) {
42
+ if (!l) return "";
43
+ try {
44
+ l.replaceChildren();
45
+ } catch {
46
+ l.innerHTML = "";
47
+ }
48
+ const c = (function(a) {
49
+ if (typeof window > "u" || typeof DOMParser > "u" || !a) return null;
50
+ const s = a.replace(/["']\s*javascript:/gi, "#").replace(/\bjavascript:/gi, "#").replace(/["']\s*vbscript:/gi, "#").replace(/\bvbscript:/gi, "#").replace(/\bdata:text\/html/gi, "#"), i = new DOMParser().parseFromString(s, "image/svg+xml").documentElement;
51
+ if (!i || i.nodeName.toLowerCase() !== "svg") return null;
52
+ const m = i;
53
+ return (function(v) {
54
+ const p = /* @__PURE__ */ new Set(["script"]), z = [v, ...Array.from(v.querySelectorAll("*"))];
55
+ for (const C of z) {
56
+ if (p.has(C.tagName.toLowerCase())) {
57
+ C.remove();
58
+ continue;
59
+ }
60
+ const X = Array.from(C.attributes);
61
+ for (const N of X) {
62
+ const b = N.name;
63
+ if (/^on/i.test(b)) C.removeAttribute(b);
64
+ else {
65
+ if (b === "style" && N.value) {
66
+ const k = N.value;
67
+ if (Ct.some((Xe) => Xe.test(k))) {
68
+ C.removeAttribute(b);
69
+ continue;
70
+ }
71
+ }
72
+ if ((b === "href" || b === "xlink:href") && N.value) {
73
+ const k = Bt(N.value);
74
+ if (!k) {
75
+ C.removeAttribute(b);
76
+ continue;
77
+ }
78
+ k !== N.value && C.setAttribute(b, k);
79
+ }
80
+ }
81
+ }
82
+ }
83
+ })(m), m;
84
+ })(r);
85
+ return c ? (l.appendChild(c), l.innerHTML) : "";
86
+ })(t, e);
87
+ try {
88
+ t.replaceChildren();
89
+ } catch {
90
+ t.innerHTML = "";
91
+ }
92
+ if (e) try {
93
+ t.insertAdjacentHTML("afterbegin", e);
94
+ } catch {
95
+ t.innerHTML = e;
96
+ }
97
+ return t.innerHTML;
98
+ }
99
+ const { t: f } = It();
100
+ function Te() {
101
+ return D(this, null, function* () {
102
+ try {
103
+ const t = yield Kt();
104
+ return P.value = !!t, t;
105
+ } catch (t) {
106
+ throw P.value = !1, t;
107
+ }
108
+ });
109
+ }
110
+ typeof window < "u" && D(null, null, function* () {
111
+ var t;
112
+ try {
113
+ const e = yield Te();
114
+ if (!e) return;
115
+ (t = e?.initialize) == null || t.call(e, Ke({}, ne.value));
116
+ } catch (e) {
117
+ P.value = !1, console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.", e);
118
+ }
119
+ });
120
+ const Ce = d(!1), V = d(!1), Z = d(), u = d(), ae = d(), De = d(null), Et = Ut(), me = d(null), ie = d(typeof window > "u"), et = d(), R = K(() => o.node.code.replace(/\]::([^:])/g, "]:::$1").replace(/:::subgraphNode$/gm, "::subgraphNode")), x = d(1), O = d(0), $ = d(0), Be = d(!1), Ee = d({ x: 0, y: 0 }), E = d(!1), Se = d(!1), U = d(!1), je = d(null), Pe = d(0), Ye = d(!1);
121
+ let fe = null, he = null, ge = 0;
122
+ const tt = (M = globalThis.requestIdleCallback) != null ? M : (t, e) => setTimeout(() => t({ didTimeout: !0 }), 16), ue = /* @__PURE__ */ (function() {
123
+ let t = null;
124
+ return (...e) => {
125
+ t && clearTimeout(t), t = setTimeout(() => (() => {
126
+ tt(() => {
127
+ pt();
128
+ }, { timeout: 500 });
129
+ })(...e), 300);
130
+ };
131
+ })();
132
+ function pe() {
133
+ he != null && (globalThis.clearTimeout(he), he = null);
134
+ }
135
+ function lt(t = 600) {
136
+ if (typeof globalThis > "u") return;
137
+ const e = Math.max(0, t);
138
+ pe(), he = globalThis.setTimeout(() => {
139
+ he = null, o.loading || U.value || !ie.value ? lt(Math.min(1200, Math.max(300, 1.2 * e))) : ue();
140
+ }, e);
141
+ }
142
+ const W = d("360px");
143
+ let se = null;
144
+ const B = d(!1), ee = d(!1), G = d({}), rt = d(null), we = d(""), Ve = d(0);
145
+ let H = null;
146
+ const q = d(!1), te = d({ zoom: 1, translateX: 0, translateY: 0, containerHeight: "360px" }), nt = K(() => o.enableWheelZoom ? { wheel: jt } : {}), I = K(() => {
147
+ var t, e, l, r;
148
+ return { worker: (t = o.workerTimeoutMs) != null ? t : 1400, parse: (e = o.parseTimeoutMs) != null ? e : 1800, render: (l = o.renderTimeoutMs) != null ? l : 2500, fullRender: (r = o.fullRenderTimeoutMs) != null ? r : 4e3 };
149
+ }), St = (ke = globalThis.cancelIdleCallback) != null ? ke : (t) => clearTimeout(t);
150
+ let ce = null, Oe = null, de = !1, ye = 800, _ = null, $e = 0, Ze = !0;
151
+ function ze(t, e) {
152
+ const l = e?.timeoutMs, r = e?.signal;
153
+ if (r?.aborted) return Promise.reject(new DOMException("Aborted", "AbortError"));
154
+ let c = null, a = !1, s = null;
155
+ return new Promise((i, m) => {
156
+ const v = () => {
157
+ c != null && clearTimeout(c), s && r && r.removeEventListener("abort", s);
158
+ };
159
+ l && l > 0 && (c = globalThis.setTimeout(() => {
160
+ a || (a = !0, v(), m(new Error("Operation timed out")));
161
+ }, l)), r && (s = () => {
162
+ a || (a = !0, v(), m(new DOMException("Aborted", "AbortError")));
163
+ }, r.addEventListener("abort", s)), t().then((p) => {
164
+ a || (a = !0, v(), i(p));
165
+ }).catch((p) => {
166
+ a || (a = !0, v(), m(p));
167
+ });
168
+ });
169
+ }
170
+ function ot(t) {
171
+ if (typeof document > "u" || !u.value) return;
172
+ const e = document.createElement("div");
173
+ e.className = "text-red-500 p-4", e.textContent = "Failed to render diagram: ";
174
+ const l = document.createElement("span");
175
+ l.textContent = t instanceof Error ? t.message : "Unknown error", e.appendChild(l), Me(u.value), u.value.appendChild(e), W.value = "360px", q.value = !0, le();
176
+ }
177
+ function at(t) {
178
+ return !t || t.disabled;
179
+ }
180
+ function S(t, e, l = "top") {
181
+ if (at(t.currentTarget)) return;
182
+ const r = t, c = r?.clientX != null && r?.clientY != null ? { x: r.clientX, y: r.clientY } : void 0;
183
+ bt(t.currentTarget, e, l, !1, c, o.isDark);
184
+ }
185
+ function T() {
186
+ Wt();
187
+ }
188
+ function it(t) {
189
+ if (at(t.currentTarget)) return;
190
+ const e = Ce.value ? f("common.copied") || "Copied" : f("common.copy") || "Copy", l = t, r = l?.clientX != null && l?.clientY != null ? { x: l.clientX, y: l.clientY } : void 0;
191
+ bt(t.currentTarget, e, "top", !1, r, o.isDark);
192
+ }
193
+ function ut(t, e) {
194
+ const l = `%%{init: {"theme": "${e === "dark" ? "dark" : "default"}"}}%%
195
+ `;
196
+ return t.trimStart().startsWith("%%{") ? t : l + t;
197
+ }
198
+ function st() {
199
+ return Ze && !E.value && !B.value && !q.value;
200
+ }
201
+ function ct(t) {
202
+ const e = t.split(/\r?\n/);
203
+ for (; e.length > 0; ) {
204
+ const l = e[e.length - 1].trimEnd();
205
+ if (l !== "") {
206
+ if (!(/^[-=~>|<\s]+$/.test(l.trim()) || /(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(l) || /[-|><]$/.test(l) || /(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(l))) break;
207
+ e.pop();
208
+ } else e.pop();
209
+ }
210
+ return e.join(`
211
+ `);
212
+ }
213
+ function Le(t, e, l) {
214
+ return D(this, null, function* () {
215
+ var r;
216
+ try {
217
+ return yield Jt(t, e, (r = l?.timeoutMs) != null ? r : I.value.worker);
218
+ } catch {
219
+ return yield (function(a, s, i) {
220
+ return D(this, null, function* () {
221
+ var m, v;
222
+ const p = yield Te();
223
+ if (!p) return;
224
+ const z = p, C = ut(a, s);
225
+ if (typeof z.parse == "function") return yield ze(() => z.parse(C), { timeoutMs: (m = i?.timeoutMs) != null ? m : I.value.parse, signal: i?.signal }), !0;
226
+ const X = `mermaid-parse-${Math.random().toString(36).slice(2, 9)}`;
227
+ return yield ze(() => p.render(X, C), { timeoutMs: (v = i?.timeoutMs) != null ? v : I.value.render, signal: i?.signal }), !0;
228
+ });
229
+ })(t, e, l);
230
+ }
231
+ });
232
+ }
233
+ typeof window < "u" && Y(() => Z.value, (t) => {
234
+ var e;
235
+ if ((e = me.value) == null || e.destroy(), me.value = null, !t) return void (ie.value = !1);
236
+ const l = Et(t, { rootMargin: "400px" });
237
+ me.value = l, ie.value = l.isVisible.value, l.whenVisible.then(() => {
238
+ ie.value = !0;
239
+ });
240
+ }, { immediate: !0 }), Lt(() => {
241
+ var t;
242
+ (t = me.value) == null || t.destroy(), me.value = null;
243
+ });
244
+ const Ae = K(() => E.value || U.value || V.value);
245
+ function qe(t) {
246
+ if (!Z.value || !u.value) return;
247
+ const e = u.value.querySelector("svg");
248
+ if (!e) return;
249
+ let l = 0, r = 0;
250
+ const c = e.getAttribute("viewBox"), a = e.getAttribute("width"), s = e.getAttribute("height");
251
+ if (c) {
252
+ const i = c.split(" ");
253
+ i.length === 4 && (l = Number.parseFloat(i[2]), r = Number.parseFloat(i[3]));
254
+ }
255
+ if (l && r || a && s && (l = Number.parseFloat(a), r = Number.parseFloat(s)), Number.isNaN(l) || Number.isNaN(r) || l <= 0 || r <= 0) try {
256
+ const i = e.getBBox();
257
+ i && i.width > 0 && i.height > 0 && (l = i.width, r = i.height);
258
+ } catch (i) {
259
+ return void console.error("Failed to get SVG BBox:", i);
260
+ }
261
+ if (l > 0 && r > 0) {
262
+ const i = r / l;
263
+ let m = (t ?? Z.value.clientWidth) * i;
264
+ m > r && (m = r), W.value = `${m}px`;
265
+ }
266
+ }
267
+ const J = d(!1), Ie = K(() => ({ transform: `translate(${O.value}px, ${$.value}px) scale(${x.value})` }));
268
+ function dt(t) {
269
+ t.key === "Escape" && J.value && Ue();
270
+ }
271
+ function Ue() {
272
+ if (J.value = !1, ae.value && Me(ae.value), De.value = null, typeof document < "u") try {
273
+ document.body.style.overflow = "";
274
+ } catch {
275
+ }
276
+ if (typeof window < "u") try {
277
+ window.removeEventListener("keydown", dt);
278
+ } catch {
279
+ }
280
+ }
281
+ function vt() {
282
+ x.value < 3 && (x.value += 0.1);
283
+ }
284
+ function mt() {
285
+ x.value > 0.5 && (x.value -= 0.1);
286
+ }
287
+ function ft() {
288
+ x.value = 1, O.value = 0, $.value = 0;
289
+ }
290
+ function Fe(t) {
291
+ Be.value = !0, t instanceof MouseEvent ? Ee.value = { x: t.clientX - O.value, y: t.clientY - $.value } : Ee.value = { x: t.touches[0].clientX - O.value, y: t.touches[0].clientY - $.value };
292
+ }
293
+ function He(t) {
294
+ if (!Be.value) return;
295
+ let e, l;
296
+ t instanceof MouseEvent ? (e = t.clientX, l = t.clientY) : (e = t.touches[0].clientX, l = t.touches[0].clientY), O.value = e - Ee.value.x, $.value = l - Ee.value.y;
297
+ }
298
+ function ve() {
299
+ Be.value = !1;
300
+ }
301
+ function jt(t) {
302
+ if (o.enableWheelZoom && (t.ctrlKey || t.metaKey)) {
303
+ if (t.preventDefault(), !Z.value) return;
304
+ const e = Z.value.getBoundingClientRect(), l = t.clientX - e.left, r = t.clientY - e.top, c = l - e.width / 2, a = r - e.height / 2, s = (c - O.value) / x.value, i = (a - $.value) / x.value, m = 0.01, v = -t.deltaY * m, p = Math.min(Math.max(x.value + v, 0.5), 3);
305
+ p !== x.value && (O.value = c - s * p, $.value = a - i * p, x.value = p);
306
+ }
307
+ }
308
+ function Pt() {
309
+ return D(this, null, function* () {
310
+ try {
311
+ const t = R.value, e = { payload: { type: "copy", text: t }, defaultPrevented: !1, preventDefault() {
312
+ this.defaultPrevented = !0;
313
+ } };
314
+ if (re("copy", e), e.defaultPrevented) return;
315
+ typeof navigator < "u" && navigator.clipboard && typeof navigator.clipboard.writeText == "function" && (yield navigator.clipboard.writeText(t)), Ce.value = !0, setTimeout(() => {
316
+ Ce.value = !1;
317
+ }, 1e3);
318
+ } catch (t) {
319
+ console.error("Failed to copy:", t);
320
+ }
321
+ });
322
+ }
323
+ function Ot() {
324
+ var t;
325
+ const e = (t = u.value) == null ? void 0 : t.querySelector("svg");
326
+ if (!e) return void console.error("SVG element not found");
327
+ const l = new XMLSerializer().serializeToString(e), r = { payload: { type: "export" }, defaultPrevented: !1, preventDefault() {
328
+ this.defaultPrevented = !0;
329
+ }, svgElement: e, svgString: l };
330
+ re("export", r), r.defaultPrevented || (function(c, a = null) {
331
+ D(this, null, function* () {
332
+ try {
333
+ const s = a ?? new XMLSerializer().serializeToString(c), i = new Blob([s], { type: "image/svg+xml;charset=utf-8" }), m = URL.createObjectURL(i);
334
+ if (typeof document < "u") {
335
+ const v = document.createElement("a");
336
+ v.href = m, v.download = `mermaid-diagram-${Date.now()}.svg`;
337
+ try {
338
+ document.body.appendChild(v), v.click(), document.body.removeChild(v);
339
+ } catch {
340
+ }
341
+ URL.revokeObjectURL(m);
342
+ }
343
+ } catch (s) {
344
+ console.error("Failed to export SVG:", s);
345
+ }
346
+ });
347
+ })(e, l);
348
+ }
349
+ function $t() {
350
+ var t, e;
351
+ const l = (e = (t = u.value) == null ? void 0 : t.querySelector("svg")) != null ? e : null, r = l ? new XMLSerializer().serializeToString(l) : null, c = { payload: { type: "open-modal" }, defaultPrevented: !1, preventDefault() {
352
+ this.defaultPrevented = !0;
353
+ }, svgElement: l, svgString: r };
354
+ re("openModal", c), c.defaultPrevented || (function() {
355
+ if (J.value = !0, typeof document < "u") try {
356
+ document.body.style.overflow = "hidden";
357
+ } catch {
358
+ }
359
+ if (typeof window < "u") try {
360
+ window.addEventListener("keydown", dt);
361
+ } catch {
362
+ }
363
+ A(() => {
364
+ if (Z.value && ae.value) {
365
+ const a = Z.value.cloneNode(!0);
366
+ a.classList.add("fullscreen");
367
+ const s = a.querySelector("[data-mermaid-wrapper]");
368
+ s && (De.value = s, s.style.transform = Ie.value.transform), Me(ae.value), ae.value.appendChild(a);
369
+ }
370
+ });
371
+ })();
372
+ }
373
+ function ht(t) {
374
+ const e = { payload: { type: "toggle-mode", target: t }, defaultPrevented: !1, preventDefault() {
375
+ this.defaultPrevented = !0;
376
+ } };
377
+ re("toggleMode", t, e), e.defaultPrevented || gt(t);
378
+ }
379
+ function gt(t) {
380
+ return D(this, null, function* () {
381
+ const e = et.value;
382
+ if (!e) return Se.value = !0, void (E.value = t === "source");
383
+ const l = e.getBoundingClientRect().height;
384
+ e.style.height = `${l}px`, e.style.overflow = "hidden", Se.value = !0, E.value = t === "source", yield A();
385
+ const r = e.scrollHeight;
386
+ e.style.transition = "height 180ms ease", e.offsetHeight, e.style.height = `${r}px`;
387
+ const c = () => {
388
+ e.style.transition = "", e.style.height = "", e.style.overflow = "", e.removeEventListener("transitionend", a);
389
+ };
390
+ function a() {
391
+ c();
392
+ }
393
+ e.addEventListener("transitionend", a), setTimeout(() => c(), 220);
394
+ });
395
+ }
396
+ function Re() {
397
+ return D(this, null, function* () {
398
+ return U.value ? je.value : u.value || (yield A(), u.value) ? (U.value = !0, je.value = D(null, null, function* () {
399
+ var t, e, l;
400
+ u.value && (u.value.style.opacity = "0");
401
+ try {
402
+ const r = yield Te();
403
+ if (!r) return;
404
+ const c = `mermaid-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
405
+ B.value || ee.value || (t = r.initialize) == null || t.call(r, (e = Ke({}, ne.value), l = { dompurifyConfig: Ke({}, be) }, tl(e, ll(l))));
406
+ const a = (function(m, v = R.value) {
407
+ const p = v, z = `%%{init: {"theme": "${m === "dark" ? "dark" : "default"}"}}%%
408
+ `;
409
+ return p.trim().startsWith("%%{") ? p : z + p;
410
+ })(o.isDark ? "dark" : "light"), s = yield ze(() => r.render(c, a), { timeoutMs: I.value.fullRender }), i = s?.svg;
411
+ if (u.value) {
412
+ const m = oe(u.value, i);
413
+ B.value || ee.value || (qe(), B.value = !0, te.value = { zoom: x.value, translateX: O.value, translateY: $.value, containerHeight: W.value });
414
+ const v = o.isDark ? "dark" : "light";
415
+ m && (G.value[v] = m), ee.value && (ee.value = !1), q.value = !1, ge = 0, pe();
416
+ }
417
+ } catch (r) {
418
+ const c = (function(s) {
419
+ const i = typeof s == "string" ? s : typeof s?.message == "string" ? s.message : "";
420
+ return typeof i == "string" && /timed out/i.test(i);
421
+ })(r), a = ge + 1;
422
+ c && a <= 3 ? (ge = a, lt(Math.min(1200, 600 * a))) : (ge = 0, pe(), console.error("Failed to render mermaid diagram:", r), o.loading === !1 && ot(r));
423
+ } finally {
424
+ yield A(), u.value && (u.value.style.opacity = "1"), U.value = !1, je.value = null;
425
+ }
426
+ }), je.value) : void console.warn("Mermaid container not ready");
427
+ });
428
+ }
429
+ function pt() {
430
+ return D(this, null, function* () {
431
+ var t, e;
432
+ const l = Date.now(), r = ++Ve.value;
433
+ H && H.abort(), H = new AbortController();
434
+ const c = H.signal, a = o.isDark ? "dark" : "light", s = R.value, i = s.replace(/\s+/g, "");
435
+ if (!s.trim()) return u.value && Me(u.value), rt.value = null, we.value = "", void (q.value = !1);
436
+ if (i === we.value) return;
437
+ try {
438
+ const v = yield (function(z, C, X) {
439
+ return D(this, null, function* () {
440
+ var N;
441
+ try {
442
+ if (yield Le(z, C, X)) return { fullOk: !0, prefixOk: !1 };
443
+ } catch (k) {
444
+ if (k?.name === "AbortError") throw k;
445
+ }
446
+ let b = ct(z);
447
+ if (b && b.trim() && b !== z) try {
448
+ try {
449
+ const k = yield Gt(z, C, (N = X?.timeoutMs) != null ? N : I.value.worker);
450
+ k && k.trim() && (b = k);
451
+ } catch {
452
+ }
453
+ if (yield Le(b, C, X)) return { fullOk: !1, prefixOk: !0, prefix: b };
454
+ } catch (k) {
455
+ if (k?.name === "AbortError") throw k;
456
+ }
457
+ return { fullOk: !1, prefixOk: !1 };
458
+ });
459
+ })(s, a, { signal: c, timeoutMs: I.value.worker });
460
+ if (v.fullOk) return yield Re(), void (Ve.value === r && (rt.value = (e = (t = u.value) == null ? void 0 : t.innerHTML) != null ? e : null, we.value = i, q.value = !1));
461
+ const p = $e && l <= $e;
462
+ if (v.prefixOk && v.prefix && st() && !p) return void (yield (function(z) {
463
+ return D(this, null, function* () {
464
+ if (st() && (u.value || (yield A(), u.value)) && !U.value) {
465
+ U.value = !0;
466
+ try {
467
+ const C = yield Te();
468
+ if (!C) return;
469
+ const X = `mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, N = o.isDark ? "dark" : "light", b = ct(z), k = ut(b && b.trim() ? b : z, N);
470
+ u.value && (u.value.style.opacity = "0");
471
+ const Xe = yield ze(() => C.render(X, k), { timeoutMs: I.value.render }), wt = Xe?.svg;
472
+ u.value && wt && (oe(u.value, wt), qe());
473
+ } catch {
474
+ } finally {
475
+ yield A(), u.value && (u.value.style.opacity = "1"), U.value = !1;
476
+ }
477
+ }
478
+ });
479
+ })(v.prefix));
480
+ } catch (v) {
481
+ if (v?.name === "AbortError") return;
482
+ }
483
+ if (Ve.value !== r || q.value) return;
484
+ const m = G.value[a];
485
+ m && u.value && oe(u.value, m);
486
+ });
487
+ }
488
+ function le() {
489
+ de && (de = !1, ye = 800, Ze = !1, _ && (_.abort(), _ = null), ce && (globalThis.clearTimeout(ce), ce = null), Oe && (St(Oe), Oe = null), $e = Date.now());
490
+ }
491
+ function Ne() {
492
+ if (le(), H) {
493
+ try {
494
+ H.abort();
495
+ } catch {
496
+ }
497
+ H = null;
498
+ }
499
+ if (_) {
500
+ try {
501
+ _.abort();
502
+ } catch {
503
+ }
504
+ _ = null;
505
+ }
506
+ pe(), ge = 0;
507
+ }
508
+ function We(t = 800) {
509
+ de && (ce && globalThis.clearTimeout(ce), ce = globalThis.setTimeout(() => {
510
+ Oe = tt(() => D(null, null, function* () {
511
+ if (!de) return;
512
+ if (E.value || B.value) return void le();
513
+ const e = o.isDark ? "dark" : "light", l = R.value;
514
+ if (l.trim()) {
515
+ _ && _.abort(), _ = new AbortController();
516
+ try {
517
+ if ((yield Le(l, e, { signal: _.signal, timeoutMs: I.value.worker })) && (yield Re(), B.value)) return void le();
518
+ } catch {
519
+ }
520
+ ye = Math.min(Math.floor(1.5 * ye), 4e3), We(ye);
521
+ } else We(ye);
522
+ }), { timeout: 500 });
523
+ }, t));
524
+ }
525
+ function Ge() {
526
+ de || E.value || B.value || (de = !0, $e = 0, Ze = !0, We(500));
527
+ }
528
+ Y(Ie, (t) => {
529
+ J.value && De.value && (De.value.style.transform = t.transform);
530
+ }, { immediate: !0 }), Y(() => R.value, () => {
531
+ B.value = !1, G.value = {}, ue(), !E.value && P.value && Ge(), (function() {
532
+ if (!E.value || !P.value) return;
533
+ const t = R.value.length;
534
+ t !== Pe.value && (Ye.value = !0, Pe.value = t, fe && clearTimeout(fe), fe = setTimeout(() => {
535
+ Ye.value && E.value && R.value.trim() && (Ye.value = !1, gt("preview"));
536
+ }, 500));
537
+ })();
538
+ }), Y(() => o.isDark, () => D(null, null, function* () {
539
+ if (!B.value || q.value) return;
540
+ const t = o.isDark ? "dark" : "light", e = G.value[t];
541
+ if (e) return void (u.value && oe(u.value, e));
542
+ const l = { zoom: x.value, translateX: O.value, translateY: $.value, containerHeight: W.value }, r = x.value !== 1 || O.value !== 0 || $.value !== 0;
543
+ ee.value = !0, r && (x.value = 1, O.value = 0, $.value = 0, yield A()), yield Re(), r && (yield A(), x.value = l.zoom, O.value = l.translateX, $.value = l.translateY, W.value = l.containerHeight, te.value = l);
544
+ })), Y(() => E.value, (t) => D(null, null, function* () {
545
+ if (t) le(), B.value && (te.value = { zoom: x.value, translateX: O.value, translateY: $.value, containerHeight: W.value });
546
+ else {
547
+ if (q.value) return;
548
+ const e = o.isDark ? "dark" : "light";
549
+ if (B.value && G.value[e]) return yield A(), u.value && oe(u.value, G.value[e]), x.value = te.value.zoom, O.value = te.value.translateX, $.value = te.value.translateY, void (W.value = te.value.containerHeight);
550
+ if (yield A(), !P.value) return;
551
+ yield pt(), Ge();
552
+ }
553
+ })), Y(() => o.loading, (t, e) => D(null, null, function* () {
554
+ if (e === !0 && t === !1) {
555
+ const l = R.value.trim();
556
+ if (!l) return Ne();
557
+ const r = o.isDark ? "dark" : "light", c = l.replace(/\s+/g, "");
558
+ if (B.value && c === we.value) return yield A(), u.value && !u.value.querySelector("svg") && G.value[r] && oe(u.value, G.value[r]), void Ne();
559
+ try {
560
+ yield Le(l, r, { timeoutMs: I.value.worker }), yield Re(), we.value = c, q.value = !1, Ne();
561
+ } catch (a) {
562
+ Ne(), ot(a);
563
+ }
564
+ }
565
+ })), Y(Z, (t) => {
566
+ se && se.disconnect(), !t || B.value || ee.value || (se = new ResizeObserver((e) => {
567
+ e && e.length > 0 && !B.value && !ee.value && Qt(() => {
568
+ qe(e[0].contentRect.width);
569
+ });
570
+ }), se.observe(t));
571
+ }, { immediate: !0 }), At(() => D(null, null, function* () {
572
+ yield A(), Se.value || (E.value = !P.value), ie.value && (ue(), Pe.value = R.value.length);
573
+ })), Y(() => P.value, (t) => {
574
+ Se.value || (E.value = !t);
575
+ }), Y(() => ie.value, (t) => {
576
+ t && (B.value || (ue(), Pe.value = R.value.length), o.loading || B.value || ue());
577
+ }, { immediate: !1 }), Ft(() => {
578
+ fe && clearTimeout(fe), se && se.disconnect(), H && (H.abort(), H = null), le(), pe();
579
+ }), Y(() => V.value, (t) => D(null, null, function* () {
580
+ t ? (le(), H && H.abort()) : B.value || (yield A(), ue(), E.value || Ge());
581
+ }), { immediate: !1 });
582
+ const _e = K(() => o.isDark ? "mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200" : "mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700");
583
+ return (t, e) => (g(), w("div", { class: y(["my-4 rounded-lg border overflow-hidden shadow-sm", [o.isDark ? "border-gray-700/30" : "border-gray-200", { "is-rendering": o.loading }]]) }, [o.showHeader ? (g(), w("div", { key: 0, class: y(["mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b", o.isDark ? "bg-gray-800 border-gray-700/30" : "bg-gray-50 border-gray-200"]) }, [t.$slots["header-left"] ? (g(), w("div", ol, [Je(t.$slots, "header-left", {}, void 0, !0)])) : (g(), w("div", al, [n("img", { src: h("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20width='16'%20height='16'%3e%3cpath%20fill='none'%20stroke='%23ca9ee6'%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M1.5%202.5c0%206%202.25%205.75%204%207%20.83.67%201.17%202%201%204h3c-.17-2%20.17-3.33%201-4%201.75-1.25%204-1%204-7C12%202.5%2010%203%208%207%206%203%204%202.5%201.5%202.5'%20/%3e%3c/svg%3e"), class: "w-4 h-4 my-0", alt: "Mermaid" }, null, 8, il), n("span", { class: y(["text-sm font-medium font-mono truncate", o.isDark ? "text-gray-400" : "text-gray-600"]) }, "Mermaid", 2)])), t.$slots["header-center"] ? (g(), w("div", ul, [Je(t.$slots, "header-center", {}, void 0, !0)])) : o.showModeToggle && P.value ? (g(), w("div", { key: 3, class: y(["flex items-center gap-x-1 rounded-md p-0.5", o.isDark ? "bg-gray-700" : "bg-gray-100"]) }, [n("button", { class: y(["px-2.5 py-1 text-xs rounded transition-colors", [E.value ? o.isDark ? "text-gray-400 hover:text-gray-200" : "text-gray-500 hover:text-gray-700" : o.isDark ? "bg-gray-600 text-gray-200 shadow-sm" : "bg-white text-gray-700 shadow-sm"]]), onClick: e[0] || (e[0] = () => ht("preview")), onMouseenter: e[1] || (e[1] = (l) => S(l, h(f)("common.preview") || "Preview")), onFocus: e[2] || (e[2] = (l) => S(l, h(f)("common.preview") || "Preview")), onMouseleave: T, onBlur: T }, [n("div", sl, [e[21] || (e[21] = n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0" }), n("circle", { cx: "12", cy: "12", r: "3" })])], -1)), n("span", null, xe(h(f)("common.preview") || "Preview"), 1)])], 34), n("button", { class: y(["px-2.5 py-1 text-xs rounded transition-colors", [E.value ? o.isDark ? "bg-gray-600 text-gray-200 shadow-sm" : "bg-white text-gray-700 shadow-sm" : o.isDark ? "text-gray-400 hover:text-gray-200" : "text-gray-500 hover:text-gray-700"]]), onClick: e[3] || (e[3] = () => ht("source")), onMouseenter: e[4] || (e[4] = (l) => S(l, h(f)("common.source") || "Source")), onFocus: e[5] || (e[5] = (l) => S(l, h(f)("common.source") || "Source")), onMouseleave: T, onBlur: T }, [n("div", cl, [e[22] || (e[22] = n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m16 18l6-6l-6-6M8 6l-6 6l6 6" })], -1)), n("span", null, xe(h(f)("common.source") || "Source"), 1)])], 34)], 2)) : Q("", !0), t.$slots["header-right"] ? (g(), w("div", dl, [Je(t.$slots, "header-right", {}, void 0, !0)])) : (g(), w("div", vl, [o.showCollapseButton ? (g(), w("button", { key: 0, class: y(_e.value), "aria-pressed": V.value, onClick: e[6] || (e[6] = (l) => V.value = !V.value), onMouseenter: e[7] || (e[7] = (l) => S(l, V.value ? h(f)("common.expand") || "Expand" : h(f)("common.collapse") || "Collapse")), onFocus: e[8] || (e[8] = (l) => S(l, V.value ? h(f)("common.expand") || "Expand" : h(f)("common.collapse") || "Collapse")), onMouseleave: T, onBlur: T }, [(g(), w("svg", { style: yt({ rotate: V.value ? "0deg" : "90deg" }), xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [...e[23] || (e[23] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m9 18l6-6l-6-6" }, null, -1)])], 4))], 42, ml)) : Q("", !0), o.showCopyButton ? (g(), w("button", { key: 1, class: y(_e.value), onClick: Pt, onMouseenter: e[9] || (e[9] = (l) => it(l)), onFocus: e[10] || (e[10] = (l) => it(l)), onMouseleave: T, onBlur: T }, [Ce.value ? (g(), w("svg", hl, [...e[25] || (e[25] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M20 6L9 17l-5-5" }, null, -1)])])) : (g(), w("svg", fl, [...e[24] || (e[24] = [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }), n("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })], -1)])]))], 34)) : Q("", !0), o.showExportButton && P.value ? (g(), w("button", { key: 2, class: y(`${_e.value} ${Ae.value ? "opacity-50 cursor-not-allowed" : ""}`), disabled: Ae.value, onClick: Ot, onMouseenter: e[11] || (e[11] = (l) => S(l, h(f)("common.export") || "Export")), onFocus: e[12] || (e[12] = (l) => S(l, h(f)("common.export") || "Export")), onMouseleave: T, onBlur: T }, [...e[26] || (e[26] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("path", { d: "M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), n("path", { d: "m7 10l5 5l5-5" })])], -1)])], 42, gl)) : Q("", !0), o.showFullscreenButton && P.value ? (g(), w("button", { key: 3, class: y(`${_e.value} ${Ae.value ? "opacity-50 cursor-not-allowed" : ""}`), disabled: Ae.value, onClick: $t, onMouseenter: e[13] || (e[13] = (l) => S(l, J.value ? h(f)("common.minimize") || "Minimize" : h(f)("common.open") || "Open")), onFocus: e[14] || (e[14] = (l) => S(l, J.value ? h(f)("common.minimize") || "Minimize" : h(f)("common.open") || "Open")), onMouseleave: T, onBlur: T }, [J.value ? (g(), w("svg", yl, [...e[28] || (e[28] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" }, null, -1)])])) : (g(), w("svg", wl, [...e[27] || (e[27] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" }, null, -1)])]))], 42, pl)) : Q("", !0)]))], 2)) : Q("", !0), Ht(n("div", { ref_key: "modeContainerRef", ref: et }, [E.value ? (g(), w("div", { key: 0, class: y(["p-4", o.isDark ? "bg-gray-900" : "bg-gray-50"]) }, [n("pre", { class: y(["text-sm font-mono whitespace-pre-wrap", o.isDark ? "text-gray-300" : "text-gray-700"]) }, xe(R.value), 3)], 2)) : (g(), w("div", xl, [o.showZoomControls ? (g(), w("div", kl, [n("div", bl, [n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: vt, onMouseenter: e[15] || (e[15] = (l) => S(l, h(f)("common.zoomIn") || "Zoom in")), onFocus: e[16] || (e[16] = (l) => S(l, h(f)("common.zoomIn") || "Zoom in")), onMouseleave: T, onBlur: T }, [...e[29] || (e[29] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M11 8v6m-3-3h6" })])], -1)])], 34), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: mt, onMouseenter: e[17] || (e[17] = (l) => S(l, h(f)("common.zoomOut") || "Zoom out")), onFocus: e[18] || (e[18] = (l) => S(l, h(f)("common.zoomOut") || "Zoom out")), onMouseleave: T, onBlur: T }, [...e[30] || (e[30] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M8 11h6" })])], -1)])], 34), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: ft, onMouseenter: e[19] || (e[19] = (l) => S(l, h(f)("common.resetZoom") || "Reset zoom")), onFocus: e[20] || (e[20] = (l) => S(l, h(f)("common.resetZoom") || "Reset zoom")), onMouseleave: T, onBlur: T }, xe(Math.round(100 * x.value)) + "% ", 35)])])) : Q("", !0), n("div", xt({ ref_key: "mermaidContainer", ref: Z, class: ["min-h-[360px] relative transition-all duration-100 overflow-hidden block", o.isDark ? "bg-gray-900" : "bg-gray-50"], style: { height: W.value } }, kt(nt.value, !0), { onMousedown: Fe, onMousemove: He, onMouseup: ve, onMouseleave: ve, onTouchstartPassive: Fe, onTouchmovePassive: He, onTouchendPassive: ve }), [n("div", { "data-mermaid-wrapper": "", class: y(["absolute inset-0 cursor-grab", { "cursor-grabbing": Be.value }]), style: yt(Ie.value) }, [n("div", { ref_key: "mermaidContent", ref: u, class: "_mermaid w-full text-center flex items-center justify-center min-h-full" }, null, 512)], 6)], 16), (g(), Rt(Nt, { to: "body" }, [n("div", Ml, [_t(Xt, { name: "mermaid-dialog", appear: "" }, { default: Yt(() => [J.value ? (g(), w("div", { key: 0, class: "fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4", onClick: Vt(Ue, ["self"]) }, [n("div", { class: y(["dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden", o.isDark ? "bg-gray-900" : "bg-white"]) }, [n("div", Tl, [n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: vt }, [...e[31] || (e[31] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M11 8v6m-3-3h6" })])], -1)])], 2), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: mt }, [...e[32] || (e[32] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M8 11h6" })])], -1)])], 2), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: ft }, xe(Math.round(100 * x.value)) + "% ", 3), n("button", { class: y(["inline-flex items-center justify-center p-2 rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: Ue }, [...e[33] || (e[33] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M18 6L6 18M6 6l12 12" })], -1)])], 2)]), n("div", xt({ ref_key: "modalContent", ref: ae, class: "w-full h-full flex items-center justify-center p-4 overflow-hidden" }, kt(nt.value, !0), { onMousedown: Fe, onMousemove: He, onMouseup: ve, onMouseleave: ve, onTouchstartPassive: Fe, onTouchmovePassive: He, onTouchendPassive: ve }), null, 16)], 2)])) : Q("", !0)]), _: 1 })])]))]))], 512), [[Zt, !V.value]])], 2));
584
+ } }), [["__scopeId", "data-v-51607788"]]);
585
+ Qe.install = (L) => {
586
+ L.component(Qe.__name, Qe);
587
+ };
588
+ export {
589
+ Qe as default
590
+ };