@hienlh/ppm 0.9.83 → 0.9.85

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 (189) hide show
  1. package/260413-1354-new-file-editor-tab/reports/code-reviewer-260413-1420-new-file-tab-review.md +210 -0
  2. package/CHANGELOG.md +20 -0
  3. package/bun.lock +259 -9
  4. package/dist/web/assets/{_basePickBy-5PGDJbfF.js → _basePickBy-D-bUmjma.js} +1 -1
  5. package/dist/web/assets/{_baseUniq-BT4Ow4Kk.js → _baseUniq-BnXXIfRB.js} +1 -1
  6. package/dist/web/assets/ai-settings-section-D6d-RmR6.js +1 -0
  7. package/dist/web/assets/{api-settings-Bn-bIxD1.js → api-settings-Qi2xRiHa.js} +1 -1
  8. package/dist/web/assets/{arc-BAOivWpI.js → arc-DB9vXGzd.js} +1 -1
  9. package/dist/web/assets/architecture-PBZL5I3N-DpVzOETR.js +1 -0
  10. package/dist/web/assets/{architectureDiagram-2XIMDMQ5-Z-4eN4za.js → architectureDiagram-2XIMDMQ5-BBV25747.js} +1 -1
  11. package/dist/web/assets/{blockDiagram-WCTKOSBZ-BCLqzhuZ.js → blockDiagram-WCTKOSBZ-BOTnY2Lq.js} +1 -1
  12. package/dist/web/assets/{c4Diagram-IC4MRINW-0Vp0Jeas.js → c4Diagram-IC4MRINW-D7QAUdHD.js} +1 -1
  13. package/dist/web/assets/channel-Cgy1thYT.js +1 -0
  14. package/dist/web/assets/chat-tab-DXBb9Y3U.js +10 -0
  15. package/dist/web/assets/check-ePA3ZvK4.js +1 -0
  16. package/dist/web/assets/chevron-down-EQA06nR-.js +1 -0
  17. package/dist/web/assets/{chunk-4BX2VUAB-D4tOov49.js → chunk-4BX2VUAB-BnOVw77D.js} +1 -1
  18. package/dist/web/assets/{chunk-55IACEB6-DJ6BynZ4.js → chunk-55IACEB6-BftA8DxR.js} +1 -1
  19. package/dist/web/assets/{chunk-7E7YKBS2-CiyUJxNI.js → chunk-7E7YKBS2-B0vnP8v3.js} +1 -1
  20. package/dist/web/assets/{chunk-7R4GIKGN-Dv-4cAYn.js → chunk-7R4GIKGN-Czlaj26D.js} +2 -2
  21. package/dist/web/assets/{chunk-C72U2L5F-D21mS_6G.js → chunk-C72U2L5F-DpEbDtMo.js} +1 -1
  22. package/dist/web/assets/{chunk-EGIJ26TM-DzqmU2Z7.js → chunk-EGIJ26TM-BWXe6lkx.js} +1 -1
  23. package/dist/web/assets/{chunk-FMBD7UC4-DXncblvW.js → chunk-FMBD7UC4-DspqhPfk.js} +1 -1
  24. package/dist/web/assets/{chunk-GEFDOKGD-D-pKjlVd.js → chunk-GEFDOKGD-D6HHRbYk.js} +1 -1
  25. package/dist/web/assets/chunk-GLR3WWYH-CxUl1sdz.js +2 -0
  26. package/dist/web/assets/chunk-HHEYEP7N-DN7ebS2Y.js +1 -0
  27. package/dist/web/assets/{chunk-JSJVCQXG-99JzIdPr.js → chunk-JSJVCQXG-BC8wnMwf.js} +1 -1
  28. package/dist/web/assets/{chunk-KX2RTZJC-CRq1OBZv.js → chunk-KX2RTZJC-D3VDtyvX.js} +1 -1
  29. package/dist/web/assets/{chunk-KYZI473N-Bb0MCaIO.js → chunk-KYZI473N-Z-NBw_HS.js} +1 -1
  30. package/dist/web/assets/{chunk-L3YUKLVL-C7qGJrfV.js → chunk-L3YUKLVL--RGkEh__.js} +1 -1
  31. package/dist/web/assets/{chunk-MX3YWQON-BpS_PtKp.js → chunk-MX3YWQON-2B76t_Kx.js} +1 -1
  32. package/dist/web/assets/{chunk-NQ4KR5QH-z_blpjxi.js → chunk-NQ4KR5QH-BekY3tEi.js} +1 -1
  33. package/dist/web/assets/{chunk-O4XLMI2P-nDhi_cVu.js → chunk-O4XLMI2P-2CJLfx_1.js} +1 -1
  34. package/dist/web/assets/{chunk-OZEHJAEY-BXhYx3nO.js → chunk-OZEHJAEY-sug_L09P.js} +1 -1
  35. package/dist/web/assets/{chunk-PQ6SQG4A-TF58UVMU.js → chunk-PQ6SQG4A-_fwPRLQy.js} +1 -1
  36. package/dist/web/assets/{chunk-PU5JKC2W-ek7k4QVB.js → chunk-PU5JKC2W-BUaTFJVQ.js} +1 -1
  37. package/dist/web/assets/chunk-QZHKN3VN-C4La7oLj.js +1 -0
  38. package/dist/web/assets/{chunk-R5LLSJPH-CFwSJijQ.js → chunk-R5LLSJPH-C37xW0vj.js} +1 -1
  39. package/dist/web/assets/{chunk-WL4C6EOR-ByUrSRin.js → chunk-WL4C6EOR-CCkt_MT6.js} +1 -1
  40. package/dist/web/assets/{chunk-XIRO2GV7-Djlmrely.js → chunk-XIRO2GV7-Dz2LBq7Y.js} +1 -1
  41. package/dist/web/assets/{chunk-XPW4576I-BPQQBakK.js → chunk-XPW4576I-DenTbBuj.js} +1 -1
  42. package/dist/web/assets/{chunk-XZSTWKYB-DxAOx4hG.js → chunk-XZSTWKYB-Dbp1nUSQ.js} +1 -1
  43. package/dist/web/assets/{chunk-YBOYWFTD-rQG3QH5s.js → chunk-YBOYWFTD-3OTKowjE.js} +1 -1
  44. package/dist/web/assets/classDiagram-VBA2DB6C-C3IyfqG-.js +1 -0
  45. package/dist/web/assets/classDiagram-v2-RAHNMMFH-Dcvhz2pb.js +1 -0
  46. package/dist/web/assets/clone--C7Tby8z.js +1 -0
  47. package/dist/web/assets/code-editor-Cr7JrBKC.js +8 -0
  48. package/dist/web/assets/{cose-bilkent-S5V4N54A-B_AWZsOP.js → cose-bilkent-S5V4N54A-MbmGZnt0.js} +1 -1
  49. package/dist/web/assets/{csv-preview-D2pJJj3K.js → csv-preview-uZ_7b8I7.js} +1 -1
  50. package/dist/web/assets/{dagre-DHq9bhnd.js → dagre-CPhI6v-K.js} +1 -1
  51. package/dist/web/assets/{dagre-KLK3FWXG-BdJr7Byp.js → dagre-KLK3FWXG-CmSE-oNj.js} +1 -1
  52. package/dist/web/assets/database-D1ToEV9d.js +1 -0
  53. package/dist/web/assets/{database-viewer-0P_zRC9w.js → database-viewer-5xljX0JI.js} +2 -2
  54. package/dist/web/assets/{diagram-E7M64L7V-_db4pBVA.js → diagram-E7M64L7V-B5XG3ZT7.js} +1 -1
  55. package/dist/web/assets/{diagram-IFDJBPK2-xKoeuiJx.js → diagram-IFDJBPK2-BsP248aX.js} +1 -1
  56. package/dist/web/assets/{diagram-P4PSJMXO-C8tjJsev.js → diagram-P4PSJMXO-Cna3408N.js} +1 -1
  57. package/dist/web/assets/diff-viewer-BBr6e_gb.js +4 -0
  58. package/dist/web/assets/dist-KUoHa6tg.js +1 -0
  59. package/dist/web/assets/{erDiagram-INFDFZHY-BSh2z9Df.js → erDiagram-INFDFZHY-B7SgktiR.js} +1 -1
  60. package/dist/web/assets/{extension-webview-Cx0GpRyC.js → extension-webview-B0klBip8.js} +1 -1
  61. package/dist/web/assets/eye-CNcBU6Tx.js +1 -0
  62. package/dist/web/assets/{flowDiagram-PKNHOUZH-oYaovqyp.js → flowDiagram-PKNHOUZH-FOYZZ1OB.js} +1 -1
  63. package/dist/web/assets/{ganttDiagram-A5KZAMGK-DmL26q2P.js → ganttDiagram-A5KZAMGK-CnHVYh9v.js} +1 -1
  64. package/dist/web/assets/git-graph-CDiwGa0g.js +1 -0
  65. package/dist/web/assets/gitGraph-HDMCJU4V-DcPyMEIJ.js +1 -0
  66. package/dist/web/assets/{gitGraphDiagram-K3NZZRJ6-CMoukSrY.js → gitGraphDiagram-K3NZZRJ6-0G9XxZay.js} +1 -1
  67. package/dist/web/assets/{graphlib-BcsNnGcW.js → graphlib-CNiBwlg_.js} +1 -1
  68. package/dist/web/assets/index-CkaCzNgO.css +2 -0
  69. package/dist/web/assets/index-Ic5uTu20.js +26 -0
  70. package/dist/web/assets/info-3K5VOQVL-Dw4O15cw.js +1 -0
  71. package/dist/web/assets/infoDiagram-LFFYTUFH-DFhmsucr.js +2 -0
  72. package/dist/web/assets/input-CcbTF6ih.js +45 -0
  73. package/dist/web/assets/{isEmpty-bnrF3Qbc.js → isEmpty-CcCb5n2-.js} +1 -1
  74. package/dist/web/assets/{ishikawaDiagram-PHBUUO56-D05_LyL7.js → ishikawaDiagram-PHBUUO56-D4QCzh5J.js} +1 -1
  75. package/dist/web/assets/{journeyDiagram-4ABVD52K-B_L20qMe.js → journeyDiagram-4ABVD52K-CnHYNfKW.js} +1 -1
  76. package/dist/web/assets/{kanban-definition-K7BYSVSG-CZ535BbZ.js → kanban-definition-K7BYSVSG-Bh_g3EVu.js} +1 -1
  77. package/dist/web/assets/keybindings-store-CxE6BlG2.js +1 -0
  78. package/dist/web/assets/{line-CVvo3dRu.js → line-6d3eBADm.js} +1 -1
  79. package/dist/web/assets/{linear-DP4mkX3m.js → linear-cA_2lQy7.js} +1 -1
  80. package/dist/web/assets/markdown-renderer-CZ07F7T6.js +306 -0
  81. package/dist/web/assets/{mermaid-parser.core-C7UwoIh6.js → mermaid-parser.core-C3kd7JXM.js} +2 -2
  82. package/dist/web/assets/{mindmap-definition-YRQLILUH-x0MTutJp.js → mindmap-definition-YRQLILUH-CYiUwhr_.js} +1 -1
  83. package/dist/web/assets/{ordinal-_K3x1fkz.js → ordinal-XHK5vIzZ.js} +1 -1
  84. package/dist/web/assets/packet-RMMSAZCW-o3LmdL8H.js +1 -0
  85. package/dist/web/assets/pie-UPGHQEXC-BjNP0M3B.js +1 -0
  86. package/dist/web/assets/{pieDiagram-SKSYHLDU-C1Gjrtzy.js → pieDiagram-SKSYHLDU-D0S7jeZA.js} +1 -1
  87. package/dist/web/assets/plus-Iso5r9vD.js +1 -0
  88. package/dist/web/assets/port-forwarding-tab-BPuSc6pI.js +1 -0
  89. package/dist/web/assets/{postgres-viewer-DlCLiEGU.js → postgres-viewer-RldlAO_m.js} +3 -3
  90. package/dist/web/assets/{quadrantDiagram-337W2JSQ-C8bzJCjQ.js → quadrantDiagram-337W2JSQ-0hNP63hW.js} +1 -1
  91. package/dist/web/assets/radar-KQ55EAFF-gDgOiaME.js +1 -0
  92. package/dist/web/assets/refresh-cw-BgQzFNaG.js +1 -0
  93. package/dist/web/assets/{requirementDiagram-Z7DCOOCP-pQyah6WB.js → requirementDiagram-Z7DCOOCP-BVnmqFbL.js} +1 -1
  94. package/dist/web/assets/{sankeyDiagram-WA2Y5GQK-T6RgG-N8.js → sankeyDiagram-WA2Y5GQK-DVkYdCJb.js} +1 -1
  95. package/dist/web/assets/scroll-area-i4EZlOl_.js +1 -0
  96. package/dist/web/assets/{sequenceDiagram-2WXFIKYE-BQDJ4CVs.js → sequenceDiagram-2WXFIKYE-B80s7sOg.js} +1 -1
  97. package/dist/web/assets/settings-tab-BzSSN2BQ.js +1 -0
  98. package/dist/web/assets/{sql-query-editor-Dxx-QZaI.js → sql-query-editor-CjZ7Z6XL.js} +1 -1
  99. package/dist/web/assets/sqlite-viewer-CoyZOM_Y.js +1 -0
  100. package/dist/web/assets/{stateDiagram-RAJIS63D-66vhiIuk.js → stateDiagram-RAJIS63D-BPLXgXRR.js} +1 -1
  101. package/dist/web/assets/stateDiagram-v2-FVOUBMTO-DksQJ7es.js +1 -0
  102. package/dist/web/assets/{terminal-tab-yfmxGQ5e.js → terminal-tab-DjzD8GLn.js} +2 -2
  103. package/dist/web/assets/{timeline-definition-YZTLITO2-DwZqB3nn.js → timeline-definition-YZTLITO2-fa_51u1X.js} +1 -1
  104. package/dist/web/assets/trash-2-DYCa06CV.js +1 -0
  105. package/dist/web/assets/treemap-KZPCXAKY-DwFqAvnj.js +1 -0
  106. package/dist/web/assets/{use-monaco-theme-7qyyJae5.js → use-monaco-theme-D9XFxQuU.js} +1 -1
  107. package/dist/web/assets/{vennDiagram-LZ73GAT5-s9Z71fz-.js → vennDiagram-LZ73GAT5-kX4jJn6W.js} +1 -1
  108. package/dist/web/assets/x-BXecj-16.js +1 -0
  109. package/dist/web/assets/{xychartDiagram-JWTSCODW-DRa_TH4B.js → xychartDiagram-JWTSCODW-Bzm5lZBs.js} +1 -1
  110. package/dist/web/index.html +22 -12
  111. package/dist/web/sw.js +1 -1
  112. package/package.json +9 -3
  113. package/src/server/index.ts +1 -1
  114. package/src/server/routes/settings.ts +6 -3
  115. package/src/services/cloud.service.ts +35 -4
  116. package/src/web/components/editor/code-editor.tsx +67 -4
  117. package/src/web/components/editor/save-as-dialog.tsx +75 -0
  118. package/src/web/components/git/git-status-panel.tsx +7 -1
  119. package/src/web/components/layout/command-palette.tsx +2 -0
  120. package/src/web/components/layout/draggable-tab.tsx +120 -67
  121. package/src/web/components/layout/mobile-nav.tsx +69 -2
  122. package/src/web/components/layout/sidebar.tsx +11 -1
  123. package/src/web/components/layout/tab-bar.tsx +74 -1
  124. package/src/web/components/layout/upgrade-banner.tsx +3 -0
  125. package/src/web/components/shared/markdown-code-block.tsx +142 -0
  126. package/src/web/components/shared/markdown-context.ts +20 -0
  127. package/src/web/components/shared/markdown-renderer.tsx +113 -288
  128. package/src/web/hooks/use-global-keybindings.ts +7 -0
  129. package/src/web/main.tsx +1 -0
  130. package/src/web/stores/git-status-store.ts +55 -0
  131. package/src/web/stores/keybindings-store.ts +1 -0
  132. package/src/web/stores/panel-utils.ts +13 -0
  133. package/src/web/stores/tab-store.ts +16 -0
  134. package/src/web/styles/globals.css +6 -0
  135. package/dist/web/assets/architecture-PBZL5I3N-DEO2f3VD.js +0 -1
  136. package/dist/web/assets/channel-By7bn0Yq.js +0 -1
  137. package/dist/web/assets/chat-tab-DBJJz0Dm.js +0 -10
  138. package/dist/web/assets/chunk-GLR3WWYH-DKikpoJM.js +0 -2
  139. package/dist/web/assets/chunk-HHEYEP7N-C7vxA5i9.js +0 -1
  140. package/dist/web/assets/chunk-QZHKN3VN-CYaTbeZf.js +0 -1
  141. package/dist/web/assets/classDiagram-VBA2DB6C-BA8Nj-_C.js +0 -1
  142. package/dist/web/assets/classDiagram-v2-RAHNMMFH-DjYu-6mn.js +0 -1
  143. package/dist/web/assets/clone-LRxlvnMj.js +0 -1
  144. package/dist/web/assets/code-editor-BvSFsrGo.js +0 -8
  145. package/dist/web/assets/diff-viewer-BmBJq4gO.js +0 -4
  146. package/dist/web/assets/dist-DIV6WgAG.js +0 -41
  147. package/dist/web/assets/git-graph-BAlhf058.js +0 -1
  148. package/dist/web/assets/gitGraph-HDMCJU4V-Bwna3and.js +0 -1
  149. package/dist/web/assets/index-BDAqXmpQ.js +0 -30
  150. package/dist/web/assets/index-BYXjCNlK.css +0 -2
  151. package/dist/web/assets/info-3K5VOQVL-_vRxVNUm.js +0 -1
  152. package/dist/web/assets/infoDiagram-LFFYTUFH-DWwumDkq.js +0 -2
  153. package/dist/web/assets/keybindings-store-L7UlPjK0.js +0 -1
  154. package/dist/web/assets/markdown-renderer-CYs_lrjt.js +0 -326
  155. package/dist/web/assets/packet-RMMSAZCW-DY5PNnZU.js +0 -1
  156. package/dist/web/assets/pie-UPGHQEXC-BHncZutv.js +0 -1
  157. package/dist/web/assets/port-forwarding-tab-CSHJ7gxM.js +0 -1
  158. package/dist/web/assets/radar-KQ55EAFF-DH0AOkUy.js +0 -1
  159. package/dist/web/assets/settings-tab-Dcr7lDcJ.js +0 -1
  160. package/dist/web/assets/sqlite-viewer-B0052fC-.js +0 -1
  161. package/dist/web/assets/stateDiagram-v2-FVOUBMTO-BGVqj_g9.js +0 -1
  162. package/dist/web/assets/treemap-KZPCXAKY-B2Xkyv-K.js +0 -1
  163. package/dist/web/assets/x-D2_KzIET.js +0 -1
  164. /package/dist/web/assets/{api-client-BfBM3I7n.js → api-client-wQbeUyeh.js} +0 -0
  165. /package/dist/web/assets/{array-B9UHiPd-.js → array-X0JlPOfd.js} +0 -0
  166. /package/dist/web/assets/{arrow-up-BYhx9ckd.js → arrow-up-BigIMx-e.js} +0 -0
  167. /package/dist/web/assets/{chevron-right-4zq1jPv6.js → chevron-right-CXzzT44u.js} +0 -0
  168. /package/dist/web/assets/{columns-2-BoZAN-iw.js → columns-2-BZ9uqssV.js} +0 -0
  169. /package/dist/web/assets/{csv-parser-CNNw2RVA.js → csv-parser-CElqio6o.js} +0 -0
  170. /package/dist/web/assets/{cytoscape.esm-BW-DbntU.js → cytoscape.esm-BfIOPvwt.js} +0 -0
  171. /package/dist/web/assets/{defaultLocale-5eAKkKJC.js → defaultLocale-B6RGN4id.js} +0 -0
  172. /package/dist/web/assets/{dist-CSJdAyA9.js → dist-CK1enexV.js} +0 -0
  173. /package/dist/web/assets/{init-DlZdxViB.js → init-BmUWJJHz.js} +0 -0
  174. /package/dist/web/assets/{isArrayLikeObject-B_v2FtYn.js → isArrayLikeObject-BrCM-iA1.js} +0 -0
  175. /package/dist/web/assets/{jsx-runtime-kMwlnEGE.js → jsx-runtime-R_NjdZtX.js} +0 -0
  176. /package/dist/web/assets/{katex-Bqvo_ZG0.js → katex-xQS_6bNb.js} +0 -0
  177. /package/dist/web/assets/{lib-DurwGtQO.js → lib-CfWBrYll.js} +0 -0
  178. /package/dist/web/assets/{math-069Z4SuC.js → math-CpLFzrfV.js} +0 -0
  179. /package/dist/web/assets/{path-6uRLdFF7.js → path-CoPyR7c2.js} +0 -0
  180. /package/dist/web/assets/{preload-helper-Bf_JiD2A.js → preload-helper-CH6UZRzu.js} +0 -0
  181. /package/dist/web/assets/{react-SKk5z-bm.js → react-j5zqhEum.js} +0 -0
  182. /package/dist/web/assets/{rough.esm-JX0wREDd.js → rough.esm-D5NinLFK.js} +0 -0
  183. /package/dist/web/assets/{sql-completion-provider-DM9Qov6L.js → sql-completion-provider-D0xutVaK.js} +0 -0
  184. /package/dist/web/assets/{square-oPKIkJiw.js → square-pfn_LYYy.js} +0 -0
  185. /package/dist/web/assets/{src-BqX54PbV.js → src-j04igtQ5.js} +0 -0
  186. /package/dist/web/assets/{table-DFevCOMd.js → table-CHv2x_qg.js} +0 -0
  187. /package/dist/web/assets/{tag-CXMT0QB6.js → tag-Bb_UFXt0.js} +0 -0
  188. /package/dist/web/assets/{text-wrap-BWNOVswA.js → text-wrap-D8BbQYTx.js} +0 -0
  189. /package/dist/web/assets/{utils-BNytJOb1.js → utils-CSCvNZxE.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{r as e}from"./_baseUniq-BT4Ow4Kk.js";import{s as t}from"./_basePickBy-5PGDJbfF.js";import{t as n}from"./dagre-DHq9bhnd.js";import"./chunk-GEFDOKGD-D-pKjlVd.js";import{t as r}from"./clone-LRxlvnMj.js";import{t as i}from"./graphlib-BcsNnGcW.js";import{g as a,h as o}from"./src-BqX54PbV.js";import{b as s}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import"./dist-CSJdAyA9.js";import"./chunk-PU5JKC2W-ek7k4QVB.js";import"./chunk-MX3YWQON-BpS_PtKp.js";import{n as c}from"./chunk-YBOYWFTD-rQG3QH5s.js";import"./chunk-PQ6SQG4A-TF58UVMU.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./chunk-KYZI473N-Bb0MCaIO.js";import{a as g,i as _,n as v,r as y,t as b}from"./chunk-O4XLMI2P-nDhi_cVu.js";function x(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:S(t),edges:C(t)};return e(t.graph())||(n.value=r(t.graph())),n}function S(n){return t(n.nodes(),function(t){var r=n.node(t),i=n.parent(t),a={v:t};return e(r)||(a.value=r),e(i)||(a.parent=i),a})}function C(n){return t(n.edges(),function(t){var r=n.edge(t),i={v:t.v,w:t.w};return e(t.name)||(i.name=t.name),e(r)||(i.value=r),i})}var w=new Map,T=new Map,E=new Map,D=o(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=o((e,t)=>{let n=T.get(t)||[];return a.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),k=o((e,t)=>{let n=T.get(t)||[];return a.info(`Descendants of `,t,` is `,n),a.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(a.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=o((e,t,n,r)=>{a.warn(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),a.warn(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)A(i,t,n,r);else{let o=t.node(i);a.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,o),r!==t.parent(i)&&(a.warn(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(a.debug(`Setting parent`,i,e),n.setParent(i,e)):(a.info(`In copy `,e,`root`,r,`data`,t.node(e),r),a.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let s=t.edges(i);a.debug(`Copying Edges`,s),s.forEach(i=>{a.info(`Edge`,i);let o=t.edge(i.v,i.w,i.name);a.info(`Edge data`,o,r);try{k(i,r)?(a.info(`Copying as `,i.v,i.w,o,i.name),n.setEdge(i.v,i.w,o,i.name),a.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):a.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){a.error(e)}})}a.debug(`Removing node`,i),t.removeNode(i)})},`copy`),j=o((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=o((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=o((e,t,n)=>{let r=t.children(e);if(a.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=N(e,t,n),a=M(t,n,r);if(r)if(a.length>0)i=r;else return r}return i},`findNonClusterChild`),P=o(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=o((e,t)=>{if(!e||t>10){a.debug(`Opting out, no graph `);return}else a.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(a.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(a.debug(`Cluster identified`,t,T),r.forEach(e=>{O(e.v,t)^O(e.w,t)&&(a.warn(`Edge: `,e,` leaves cluster `,t),a.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):a.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(a.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(a.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=P(t.v),i=P(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);w.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);w.get(r).externalConnections=!0,n.toCluster=t.w}a.warn(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),a.warn(`Adjusted Graph`,x(e)),I(e,0),a.trace(w)},`adjustClustersAndEdges`),I=o((e,t)=>{if(a.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){a.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){a.debug(`Done, no node has children`,e.nodes());return}a.debug(`Nodes = `,n,t);for(let r of n)if(a.debug(`Extracting node`,r,w,w.has(r)&&!w.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!w.has(r))a.debug(`Not a cluster`,r,t);else if(!w.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){a.warn(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(r)?.clusterData?.dir&&(n=w.get(r).clusterData.dir,a.warn(`Fixing dir`,w.get(r).clusterData.dir,n));let o=new i({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});a.warn(`Old graph before copy`,x(e)),A(r,e,o,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:w.get(r).clusterData,label:w.get(r).label,graph:o}),a.warn(`New graph after copy node: (`,r,`)`,x(o)),a.debug(`Old graph after copy`,x(e))}else a.warn(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!w.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),a.debug(w);n=e.nodes(),a.warn(`New list of nodes`,n);for(let r of n){let n=e.node(r);a.warn(` Now next level`,r,n),n?.clusterNode&&I(n.graph,t+1)}},`extractor`),L=o((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=o(e=>L(e,e.children()),`sortNodesByHierarchy`),z=o(async(e,t,r,i,s,p)=>{a.warn(`Graph in recursive render:XAX`,x(t),s);let m=t.graph().rankdir;a.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);t.nodes()?a.info(`Recursive render XXX`,t.nodes()):a.info(`No nodes found for`,t),t.edges().length>0&&a.info(`Recursive edges`,t.edge(t.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(t.nodes().map(async function(e){let n=t.node(e);if(s!==void 0){let n=JSON.parse(JSON.stringify(s.clusterData));a.trace(`Setting data for parent cluster XXX
1
+ import{r as e}from"./_baseUniq-BnXXIfRB.js";import{s as t}from"./_basePickBy-D-bUmjma.js";import{t as n}from"./dagre-CPhI6v-K.js";import"./chunk-GEFDOKGD-D6HHRbYk.js";import{t as r}from"./clone--C7Tby8z.js";import{t as i}from"./graphlib-CNiBwlg_.js";import{g as a,h as o}from"./src-j04igtQ5.js";import{b as s}from"./chunk-7R4GIKGN-Czlaj26D.js";import"./dist-CK1enexV.js";import"./chunk-PU5JKC2W-BUaTFJVQ.js";import"./chunk-MX3YWQON-2B76t_Kx.js";import{n as c}from"./chunk-YBOYWFTD-3OTKowjE.js";import"./chunk-PQ6SQG4A-_fwPRLQy.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./chunk-KYZI473N-Z-NBw_HS.js";import{a as g,i as _,n as v,r as y,t as b}from"./chunk-O4XLMI2P-2CJLfx_1.js";function x(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:S(t),edges:C(t)};return e(t.graph())||(n.value=r(t.graph())),n}function S(n){return t(n.nodes(),function(t){var r=n.node(t),i=n.parent(t),a={v:t};return e(r)||(a.value=r),e(i)||(a.parent=i),a})}function C(n){return t(n.edges(),function(t){var r=n.edge(t),i={v:t.v,w:t.w};return e(t.name)||(i.name=t.name),e(r)||(i.value=r),i})}var w=new Map,T=new Map,E=new Map,D=o(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=o((e,t)=>{let n=T.get(t)||[];return a.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),k=o((e,t)=>{let n=T.get(t)||[];return a.info(`Descendants of `,t,` is `,n),a.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(a.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=o((e,t,n,r)=>{a.warn(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),a.warn(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)A(i,t,n,r);else{let o=t.node(i);a.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,o),r!==t.parent(i)&&(a.warn(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(a.debug(`Setting parent`,i,e),n.setParent(i,e)):(a.info(`In copy `,e,`root`,r,`data`,t.node(e),r),a.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let s=t.edges(i);a.debug(`Copying Edges`,s),s.forEach(i=>{a.info(`Edge`,i);let o=t.edge(i.v,i.w,i.name);a.info(`Edge data`,o,r);try{k(i,r)?(a.info(`Copying as `,i.v,i.w,o,i.name),n.setEdge(i.v,i.w,o,i.name),a.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):a.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){a.error(e)}})}a.debug(`Removing node`,i),t.removeNode(i)})},`copy`),j=o((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=o((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=o((e,t,n)=>{let r=t.children(e);if(a.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=N(e,t,n),a=M(t,n,r);if(r)if(a.length>0)i=r;else return r}return i},`findNonClusterChild`),P=o(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=o((e,t)=>{if(!e||t>10){a.debug(`Opting out, no graph `);return}else a.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(a.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(a.debug(`Cluster identified`,t,T),r.forEach(e=>{O(e.v,t)^O(e.w,t)&&(a.warn(`Edge: `,e,` leaves cluster `,t),a.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):a.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),a.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(a.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(a.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=P(t.v),i=P(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);w.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);w.get(r).externalConnections=!0,n.toCluster=t.w}a.warn(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),a.warn(`Adjusted Graph`,x(e)),I(e,0),a.trace(w)},`adjustClustersAndEdges`),I=o((e,t)=>{if(a.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){a.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){a.debug(`Done, no node has children`,e.nodes());return}a.debug(`Nodes = `,n,t);for(let r of n)if(a.debug(`Extracting node`,r,w,w.has(r)&&!w.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!w.has(r))a.debug(`Not a cluster`,r,t);else if(!w.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){a.warn(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(r)?.clusterData?.dir&&(n=w.get(r).clusterData.dir,a.warn(`Fixing dir`,w.get(r).clusterData.dir,n));let o=new i({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});a.warn(`Old graph before copy`,x(e)),A(r,e,o,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:w.get(r).clusterData,label:w.get(r).label,graph:o}),a.warn(`New graph after copy node: (`,r,`)`,x(o)),a.debug(`Old graph after copy`,x(e))}else a.warn(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!w.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),a.debug(w);n=e.nodes(),a.warn(`New list of nodes`,n);for(let r of n){let n=e.node(r);a.warn(` Now next level`,r,n),n?.clusterNode&&I(n.graph,t+1)}},`extractor`),L=o((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=o(e=>L(e,e.children()),`sortNodesByHierarchy`),z=o(async(e,t,r,i,s,p)=>{a.warn(`Graph in recursive render:XAX`,x(t),s);let m=t.graph().rankdir;a.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);t.nodes()?a.info(`Recursive render XXX`,t.nodes()):a.info(`No nodes found for`,t),t.edges().length>0&&a.info(`Recursive edges`,t.edge(t.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(t.nodes().map(async function(e){let n=t.node(e);if(s!==void 0){let n=JSON.parse(JSON.stringify(s.clusterData));a.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,e,`
3
3
  data=`,n.height,`
4
4
  Parent cluster`,s.height),t.setNode(s.id,n),t.parent(e)||(a.trace(`Setting parent`,e,s.id),t.setParent(e,s.id,n))}if(a.info(`(Insert) Node XXX`+e+`: `+JSON.stringify(t.node(e))),n?.clusterNode){a.info(`Cluster identified XBX`,e,n.width,t.node(e));let{ranksep:o,nodesep:s}=t.graph();n.graph.setGraph({...n.graph.graph(),ranksep:o+25,nodesep:s});let c=await z(T,n.graph,r,i,t.node(e),p),l=c.elem;h(n,l),n.diff=c.diff||0,a.info(`New compound node after recursive render XAX`,e,`width`,n.width,`height`,n.height),f(l,n)}else t.children(e).length>0?(a.trace(`Cluster - the non recursive path XBX`,e,n.id,n,n.width,`Graph:`,t),a.trace(N(n.id,t)),w.set(n.id,{id:N(n.id,t),node:n})):(a.trace(`Node - the non recursive path XAX`,e,T,t.node(e),m),await l(T,t.node(e),{config:p,dir:m}))})),await o(async()=>{let e=t.edges().map(async function(e){let n=t.edge(e.v,e.w,e.name);a.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(e)),a.info(`Edge `+e.v+` -> `+e.w+`: `,e,` `,JSON.stringify(t.edge(e))),a.info(`Fix`,w,`ids:`,e.v,e.w,`Translating: `,w.get(e.v),w.get(e.w)),await y(C,n)});await Promise.all(e)},`processEdges`)(),a.info(`Graph before layout:`,JSON.stringify(x(t))),a.info(`############################################# XXX`),a.info(`### Layout ### XXX`),a.info(`############################################# XXX`),n(t),a.info(`Graph after layout:`,JSON.stringify(x(t)));let E=0,{subGraphTitleTotalMargin:D}=c(p);return await Promise.all(R(t).map(async function(e){let n=t.node(e);if(a.info(`Position XBX => `+e+`: (`+n.x,`,`+n.y,`) width: `,n.width,` height: `,n.height),n?.clusterNode)n.y+=D,a.info(`A tainted cluster node XBX1`,e,n.id,n.width,n.height,n.x,n.y,t.parent(e)),w.get(n.id).node=n,u(n);else if(t.children(e).length>0){a.info(`A pure cluster node XBX1`,e,n.id,n.x,n.y,n.width,n.height,t.parent(e)),n.height+=D,t.node(n.parentId);let r=n?.padding/2||0,i=n?.labelBBox?.height||0,o=i-r||0;a.debug(`OffsetY`,o,`labelHeight`,i,`halfPadding`,r),await d(b,n),w.get(n.id).node=n}else{let e=t.node(n.parentId);n.y+=D/2,a.info(`A regular node XBX1 - using the padding`,n.id,`parent`,n.parentId,n.width,n.height,n.x,n.y,`offsetY`,n.offsetY,`parent`,e,e?.offsetY,n),u(n)}})),t.edges().forEach(function(e){let n=t.edge(e);a.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(n),n),n.points.forEach(e=>e.y+=D/2),g(n,v(S,n,w,r,t.node(e.v),t.node(e.w),i))}),t.nodes().forEach(function(e){let n=t.node(e);a.info(e,n.type,n.diff),n.isGroup&&(E=n.diff)}),a.warn(`Returning from recursive render XAX`,_,E),{elem:_,diff:E}},`recursiveRender`),B=o(async(e,t)=>{let n=new i({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),r=t.select(`g`);_(r,e.markers,e.type,e.diagramId),p(),b(),m(),D(),e.nodes.forEach(e=>{n.setNode(e.id,{...e}),e.parentId&&n.setParent(e.id,e.parentId)}),a.debug(`Edges:`,e.edges),e.edges.forEach(e=>{if(e.start===e.end){let t=e.start,r=t+`---`+t+`---1`,i=t+`---`+t+`---2`,a=n.node(t);n.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:``,label:``,padding:0,shape:`labelRect`,style:``,width:10,height:10}),n.setParent(r,a.parentId),n.setNode(i,{domId:i,id:i,parentId:a.parentId,labelStyle:``,padding:0,shape:`labelRect`,label:``,style:``,width:10,height:10}),n.setParent(i,a.parentId);let o=structuredClone(e),s=structuredClone(e),c=structuredClone(e);o.label=``,o.arrowTypeEnd=`none`,o.id=t+`-cyclic-special-1`,s.arrowTypeStart=`none`,s.arrowTypeEnd=`none`,s.id=t+`-cyclic-special-mid`,c.label=``,a.isGroup&&(o.fromCluster=t,c.toCluster=t),c.id=t+`-cyclic-special-2`,c.arrowTypeStart=`none`,n.setEdge(t,r,o,t+`-cyclic-special-0`),n.setEdge(r,i,s,t+`-cyclic-special-1`),n.setEdge(i,t,c,t+`-cyc<lic-special-2`)}else n.setEdge(e.start,e.end,{...e},e.id)}),a.warn(`Graph at first:`,JSON.stringify(x(n))),F(n),a.warn(`Graph after XAX:`,JSON.stringify(x(n)));let o=s();await z(r,n,e.type,e.diagramId,void 0,o)},`render`);export{B as render};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-PuMiQgHl.js";var t=e(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]);export{t};
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{n as r,t as i}from"./x-D2_KzIET.js";import{t as a}from"./chevron-right-4zq1jPv6.js";import{t as o}from"./jsx-runtime-kMwlnEGE.js";import{t as s}from"./api-client-BfBM3I7n.js";import{Ct as c,Et as l,K as u,Mt as d,Nt as f,Q as p,Tt as m,it as h,mt as g,ot as _,pt as v,rt as y,st as b,tt as x}from"./index-BDAqXmpQ.js";import"./use-monaco-theme-7qyyJae5.js";import{t as S}from"./sql-query-editor-Dxx-QZaI.js";import{n as C}from"./csv-parser-CNNw2RVA.js";var w=n(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),T=n(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),E=e(t(),1);function D(e,t,n,r){return`ppm-db-${e}-${n}.${t}-p${r}`}function O(e,t,n,r){try{let i=sessionStorage.getItem(D(e,t,n,r));return i?JSON.parse(i):null}catch{return null}}function ee(e,t,n,r,i,a){try{sessionStorage.setItem(D(e,t,n,r),JSON.stringify({data:i,cols:a}))}catch{}}function k(e){let t=`/api/db/connections/${e}`,[n,r]=(0,E.useState)(null),[i,a]=(0,E.useState)(`public`),[o,c]=(0,E.useState)(null),[l,u]=(0,E.useState)([]),[d,f]=(0,E.useState)(!1),[p,m]=(0,E.useState)(null),[h,g]=(0,E.useState)(1),[_,v]=(0,E.useState)(null),[y,b]=(0,E.useState)(null),[x,S]=(0,E.useState)(!1),[C,w]=(0,E.useState)(null),[T,D]=(0,E.useState)(`ASC`),k=(0,E.useCallback)(async(r,a,o,l,d)=>{let p=r??n,g=a??i;if(!p)return;f(!0);let _=l===void 0?C:l,v=d??T;try{let n=_?`&orderBy=${encodeURIComponent(_)}&orderDir=${v}`:``,[r,i]=await Promise.all([s.get(`${t}/data?table=${encodeURIComponent(p)}&schema=${g}&page=${o??h}&limit=100${n}`),s.get(`${t}/schema?table=${encodeURIComponent(p)}&schema=${g}`)]);c(r),u(i),ee(e,p,g,o??h,r,i)}catch(e){m(e.message)}finally{f(!1)}},[t,e,n,i,h,C,T]),A=(0,E.useCallback)((t,n=`public`)=>{r(t),a(n),g(1),v(null);let i=O(e,t,n,1);i?(c(i.data),u(i.cols),f(!1),k(t,n,1)):k(t,n,1)},[e,k]),j=(0,E.useCallback)(e=>{g(e),k(void 0,void 0,e)},[k]),te=(0,E.useCallback)(async e=>{S(!0),b(null);try{let r=await s.post(`${t}/query`,{sql:e});v(r),r.changeType===`modify`&&k(n??void 0,i)}catch(e){b(e.message)}finally{S(!1)}},[t,n,i,k]),M=(0,E.useCallback)(async(e,r,a,o)=>{if(!n)return;let c=n,l=i;try{await s.put(`${t}/cell`,{table:c,schema:l,pkColumn:e,pkValue:r,column:a,value:o}),k(c,l)}catch(e){m(e.message)}},[t,n,i,k]),N=(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.del(`${t}/row`,{table:a,schema:o,pkColumn:e,pkValue:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]);return{selectedTable:n,selectedSchema:i,selectTable:A,tableData:o,schema:l,loading:d,error:p,page:h,setPage:j,orderBy:C,orderDir:T,toggleSort:(0,E.useCallback)(e=>{let t,n=`ASC`;C===e?T===`ASC`?(t=e,n=`DESC`):(t=null,n=`ASC`):(t=e,n=`ASC`),w(t),D(n),g(1),k(void 0,void 0,1,t,n)},[C,T,k]),queryResult:_,queryError:y,queryLoading:x,executeQuery:te,updateCell:M,deleteRow:N,bulkDelete:(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.post(`${t}/rows/delete`,{table:a,schema:o,pkColumn:e,pkValues:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]),insertRow:(0,E.useCallback)(async e=>{if(!n)return;let r=n,a=i;try{await s.post(`${t}/row`,{table:r,schema:a,values:e}),k(r,a)}catch(e){throw m(e.message),e}},[t,n,i,k]),refreshData:k,queryAsTable:(0,E.useCallback)(async e=>{f(!0);try{let n=await s.post(`${t}/query`,{sql:e});n.changeType===`select`&&c({columns:n.columns,rows:n.rows,total:n.rows.length,page:1,limit:n.rows.length})}catch(e){m(e.message)}finally{f(!1)}},[t])}}var A=o();function j(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function te({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,E.useState)(!1),[o,s]=(0,E.useState)(!1),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(!i)return;let e=e=>{c.current&&!c.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let l=()=>{let r=C(e,t.map(t=>e.map(e=>String(t[e]??``))));j(`${n}.csv`,r,`text/csv`),a(!1)},u=()=>{let e=JSON.stringify(t,null,2);j(`${n}.json`,e,`application/json`),a(!1)},d=async e=>{if(r){s(!0);try{let t=await(await fetch(`${r}&format=${e}&limit=10000`)).text(),i=e===`csv`?`text/csv`:`application/json`;j(`${n}-all.${e}`,t,i)}catch{}s(!1),a(!1)}};return e.length===0||t.length===0?null:(0,A.jsxs)(`div`,{className:`relative`,ref:c,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,title:`Export`,children:(0,A.jsx)(m,{className:`size-3.5`})}),i&&(0,A.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md py-1 min-w-[160px] text-xs`,children:[(0,A.jsx)(`button`,{onClick:l,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (CSV)`}),(0,A.jsx)(`button`,{onClick:u,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (JSON)`}),r&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`border-t border-border my-1`}),(0,A.jsx)(`button`,{onClick:()=>d(`csv`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (CSV)`}),(0,A.jsx)(`button`,{onClick:()=>d(`json`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (JSON)`})]})]})]})}function M({tableData:e,schema:t,loading:n,page:o,onPageChange:s,onCellUpdate:c,onRowDelete:l,orderBy:m,orderDir:g,onToggleSort:y,onBulkDelete:S,onInsertRow:C,connectionId:D,selectedTable:O,selectedSchema:ee,connectionName:k,columnFilters:j={},onColumnFilter:M}){let[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(null),[z,ae]=(0,E.useState)(``),[B,V]=(0,E.useState)(new Set),[oe,se]=(0,E.useState)(!1),[ce,le]=(0,E.useState)({}),[ue,de]=(0,E.useState)(null),[fe,pe]=(0,E.useState)(!1),{openTab:H}=u(),me=(0,E.useCallback)(e=>{H({type:`editor`,title:e.col,projectId:null,closable:!0,metadata:{inlineContent:e.value,inlineLanguage:ne(e.value)}})},[H]),[U,he]=(0,E.useState)(new Set),[ge,_e]=(0,E.useState)(new Set),[ve,ye]=(0,E.useState)(null),[be,W]=(0,E.useState)(!1),xe=(0,E.useRef)(null),G=(0,E.useMemo)(()=>t.find(e=>e.pk)?.name||(t.find(e=>e.name.toLowerCase()===`id`)?.name??null),[t]),Se=(0,E.useCallback)(e=>{let t=JSON.stringify(e,null,2),n=G?String(e[G]??``):``;H({type:`editor`,title:n?`Row ${n}`:`Row`,projectId:null,closable:!0,metadata:{inlineContent:t,inlineLanguage:`json`}})},[H,G]),Ce=(0,E.useRef)(N);Ce.current=N;let K=(0,E.useRef)(F);K.current=F;let we=(0,E.useRef)(B);we.current=B;let Te=(0,E.useRef)(L);Te.current=L;let Ee=(0,E.useCallback)((e,t,n)=>{P({rowIdx:e,col:t}),I(n==null?``:typeof n==`object`?JSON.stringify(n):String(n))},[]),De=(0,E.useCallback)(()=>{let t=Ce.current;if(!t||!e||!G)return;let n=e.rows[t.rowIdx];if(!n)return;let r=n[t.col];String(r??``)!==K.current&&c(G,n[G],t.col,K.current===``?null:K.current),P(null)},[e,G,c]),Oe=(0,E.useCallback)(()=>P(null),[]),ke=(0,E.useCallback)(t=>{if(!e||!G||!l)return;let n=e.rows[t];n&&(l(G,n[G]),R(null))},[e,G,l]),Ae=(0,E.useCallback)(e=>{he(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),je=(0,E.useCallback)(e=>{_e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Me=(0,E.useCallback)((e,t)=>{let n={...j};t?n[e]=t:delete n[e],M?.(n)},[j,M]),Ne=(0,E.useCallback)(e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Pe=(0,E.useCallback)(()=>{e&&V(t=>t.size===e.rows.length?new Set:new Set(e.rows.map((e,t)=>t)))},[e]),Fe=(0,E.useCallback)(()=>{!e||!G||!S||(S(G,Array.from(B).map(t=>e.rows[t]?.[G]).filter(e=>e!=null)),V(new Set),pe(!1))},[e,G,S,B]),Ie=(0,E.useCallback)(async()=>{if(C){de(null);try{let e={};for(let[t,n]of Object.entries(ce))n!==``&&(e[t]=n);await C(e),se(!1),le({})}catch(e){de(e.message)}}},[C,ce]),q=(0,E.useMemo)(()=>{if(!e||!z)return e?.rows??[];let t=z.toLowerCase();return e.rows.filter(n=>e.columns.some(e=>String(n[e]??``).toLowerCase().includes(t)))},[e,z]),Le=(0,E.useRef)(null);(0,E.useEffect)(()=>{let t=Le.current;if(!t)return;let n=t=>{if(t.key===`Escape`){W(!1);return}let n=t.target?.tagName;if(!(n===`INPUT`||n===`TEXTAREA`)){if(t.key===`/`){t.preventDefault(),W(!0);return}if(!(!(t.metaKey||t.ctrlKey)||!e)&&(t.key===`a`&&(t.preventDefault(),V(new Set(e.rows.map((e,t)=>t)))),t.key===`c`&&B.size>0)){t.preventDefault();let n=e.columns,r=n.join(` `),i=Array.from(B).sort((e,t)=>e-t).map(t=>n.map(n=>{let r=e.rows[t]?.[n];return r==null?``:typeof r==`object`?JSON.stringify(r):String(r)}).join(` `));navigator.clipboard.writeText([r,...i].join(`
2
- `))}}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[e,B]);let J=(0,E.useMemo)(()=>{if(!e)return[];let t=e.columns.filter(e=>U.has(e)),n=e.columns.filter(e=>!U.has(e));return[...t,...n]},[e?.columns,U]),Re=(0,E.useRef)(null),[Y,ze]=(0,E.useState)(0),[X,Be]=(0,E.useState)(new Map);(0,E.useEffect)(()=>{let e=Re.current;if(!e)return;let t=()=>{ze(e.offsetHeight);let t=new Map;e.querySelectorAll(`th[data-col]`).forEach(e=>{t.set(e.dataset.col,e.offsetWidth)});let n=e.querySelector(`th[data-col='_cb']`);n&&t.set(`_cb`,n.offsetWidth),Be(t)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e?.columns,U]);let Z=(0,E.useMemo)(()=>{let e=new Map,t=X.get(`_cb`)??(G?40:0);for(let n of J){if(!U.has(n))break;e.set(n,t),t+=X.get(n)??100}return e},[J,U,G,X]),Q=(0,E.useMemo)(()=>Array.from(ge).sort((e,t)=>e-t).map(e=>({idx:e,row:q[e]})).filter(e=>e.row),[ge,q]),Ve=(0,E.useRef)(new Map),[$,He]=(0,E.useState)(new Map),Ue=(0,E.useCallback)((e,t)=>{t?Ve.current.set(e,t):Ve.current.delete(e)},[]);(0,E.useEffect)(()=>{if(Q.length===0){$.size>0&&He(new Map);return}let e=requestAnimationFrame(()=>{let e=new Map;for(let{idx:t}of Q){let n=Ve.current.get(t);n&&e.set(t,n.offsetHeight)}He(e)});return()=>cancelAnimationFrame(e)},[Q,e]);let We=(0,E.useMemo)(()=>{let e=new Map,t=Y;for(let{idx:n}of Q)e.set(n,t),t+=$.get(n)??28;return e},[Y,Q,$]),Ge=(0,E.useCallback)(e=>{let t=xe.current,n=t?.querySelector(`th[data-col="${e}"]`);if(!t||!n)return;let r=0,i=t.querySelector(`th[data-col="_cb"]`);i&&(r+=i.offsetWidth);for(let[t,n]of Z)t!==e&&(r=Math.max(r,n+(X.get(t)??0)));let a=n.offsetLeft-r;t.scrollTo({left:a,behavior:`smooth`}),W(!1)},[Z,X]);if(!e)return(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,A.jsx)(v,{className:`size-4 animate-spin`}):`Select a table`});let Ke=Math.ceil(e.total/e.limit)||1,qe=B.size>0,Je=B.size===e.rows.length&&e.rows.length>0;return(0,A.jsxs)(`div`,{ref:Le,tabIndex:0,className:`flex flex-col h-full overflow-hidden outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 border-b border-border bg-background shrink-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1 flex-1`,children:[(0,A.jsx)(x,{className:`size-3 text-muted-foreground`}),(0,A.jsx)(`input`,{type:`text`,value:z,onChange:e=>ae(e.target.value),placeholder:`Search current page…`,className:`flex-1 text-xs bg-transparent outline-none text-foreground placeholder:text-muted-foreground`}),z&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>ae(``),className:`text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(i,{className:`size-3`})})]}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>W(!be),className:`p-0.5 rounded transition-colors ${be?`text-primary`:`text-muted-foreground hover:text-foreground`}`,title:`Jump to column ( / )`,children:(0,A.jsx)(w,{className:`size-3.5`})}),be&&(0,A.jsx)(re,{columns:e.columns,onSelect:Ge,onClose:()=>W(!1)})]}),qe&&(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[B.size,` selected`]}),S&&G&&(fe?(0,A.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:Fe,className:`text-destructive text-[10px] font-medium hover:underline`,children:[`Delete `,B.size,`?`]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>pe(!1),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,A.jsx)(`button`,{type:`button`,onClick:()=>pe(!0),className:`p-0.5 text-muted-foreground hover:text-destructive`,children:(0,A.jsx)(p,{className:`size-3`})})),(0,A.jsx)(te,{columns:e.columns,rows:Array.from(B).map(t=>e.rows[t]).filter(Boolean),filename:`${k??`db`}-selected`})]}),C&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>{se(!0),le({}),de(null)},className:`p-0.5 rounded text-muted-foreground hover:text-primary transition-colors`,title:`Insert row`,children:(0,A.jsx)(h,{className:`size-3.5`})})]}),oe&&(0,A.jsxs)(`div`,{className:`px-2 py-1.5 border-b border-border bg-muted/30 text-xs space-y-1`,children:[(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(e=>!e.pk).map(e=>(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(`label`,{className:`text-muted-foreground text-[10px] w-16 truncate`,title:e.name,children:e.name}),(0,A.jsx)(`input`,{value:ce[e.name]??``,onChange:t=>le(n=>({...n,[e.name]:t.target.value})),placeholder:e.defaultValue??(e.nullable?`NULL`:``),className:`h-5 w-24 text-[11px] px-1 rounded border border-border bg-background outline-none focus:border-primary`})]},e.name))}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:Ie,className:`text-[10px] px-2 py-0.5 rounded bg-primary text-primary-foreground hover:bg-primary/90`,children:`Save`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>se(!1),className:`text-[10px] text-muted-foreground hover:underline`,children:`Cancel`}),ue&&(0,A.jsx)(`span`,{className:`text-[10px] text-destructive`,children:ue})]})]}),(0,A.jsxs)(`div`,{ref:xe,className:`flex-1 overflow-auto relative`,children:[n&&(0,A.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-background/60`,children:(0,A.jsx)(v,{className:`size-5 animate-spin text-primary`})}),(0,A.jsxs)(`table`,{className:`w-full text-xs`,style:{borderCollapse:`separate`,borderSpacing:0},children:[(0,A.jsx)(`thead`,{ref:Re,className:`sticky top-0 z-20 bg-muted`,children:(0,A.jsxs)(`tr`,{children:[G&&(0,A.jsx)(`th`,{"data-col":`_cb`,className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border w-10 bg-muted`,style:{position:`sticky`,left:0,zIndex:30},children:(0,A.jsx)(`input`,{type:`checkbox`,checked:Je,onChange:Pe,className:`size-3 accent-primary`})}),J.map(e=>{let n=t.find(t=>t.name===e)?.pk,a=m===e,o=U.has(e),s=!!j[e],c=ve===e,l=Z.get(e);return(0,A.jsxs)(`th`,{"data-col":e,className:`group/th px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap bg-muted ${o?`border-r border-r-primary/20`:``}`,style:l==null?void 0:{position:`sticky`,left:l,zIndex:25},children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:()=>y(e),className:`flex items-center gap-0.5 ${n?`font-bold`:``} hover:text-foreground transition-colors`,children:[e,a&&g===`ASC`&&(0,A.jsx)(d,{className:`size-3`}),a&&g===`DESC`&&(0,A.jsx)(r,{className:`size-3`})]}),M&&(0,A.jsx)(`button`,{type:`button`,title:`Filter column`,onClick:()=>ye(c?null:e),className:`p-0.5 rounded transition-colors ${s||c?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:(0,A.jsx)(T,{className:`size-2.5`})}),(0,A.jsx)(`button`,{type:`button`,title:o?`Unpin column`:`Pin column`,onClick:()=>Ae(e),className:`p-0.5 rounded transition-colors ${o?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:o?(0,A.jsx)(b,{className:`size-2.5`}):(0,A.jsx)(_,{className:`size-2.5`})})]}),c&&(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,A.jsx)(`input`,{autoFocus:!0,type:`text`,value:j[e]??``,placeholder:`ILIKE filter…`,onChange:t=>Me(e,t.target.value),onKeyDown:e=>{e.key===`Escape`&&ye(null)},className:`w-full h-5 text-[10px] px-1 rounded border border-border bg-background outline-none focus:border-primary`}),s&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>Me(e,``),className:`text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(i,{className:`size-2.5`})})]})]},e)}),l&&G&&(0,A.jsx)(`th`,{className:`px-2 py-1.5 border-b border-border w-14 bg-muted`})]})}),(0,A.jsxs)(`tbody`,{children:[Q.map(({idx:e,row:t})=>(0,A.jsx)(ie,{row:t,rowIdx:e,columns:J,selected:B.has(e),onToggleSelect:Ne,pkCol:G,editingCell:N,editValue:F,onStartEdit:Ee,onCommitEdit:De,onCancelEdit:Oe,onSetEditValue:I,showDelete:!!l,confirmingDelete:L===e,onDelete:ke,onConfirmDelete:R,onViewCell:me,onViewRow:Se,pinned:!0,onTogglePin:je,pinnedCols:U,pinnedColOffsets:Z,stickyTop:We.get(e)??Y,trRef:t=>Ue(e,t)},`pin-${e}`)),q.map((e,t)=>ge.has(t)?null:(0,A.jsx)(ie,{row:e,rowIdx:t,columns:J,selected:B.has(t),onToggleSelect:Ne,pkCol:G,editingCell:N,editValue:F,onStartEdit:Ee,onCommitEdit:De,onCancelEdit:Oe,onSetEditValue:I,showDelete:!!l,confirmingDelete:L===t,onDelete:ke,onConfirmDelete:R,onViewCell:me,onViewRow:Se,pinned:!1,onTogglePin:je,pinnedCols:U,pinnedColOffsets:Z},t)),q.length===0&&(0,A.jsx)(`tr`,{children:(0,A.jsx)(`td`,{colSpan:J.length+2,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-t border-border bg-background shrink-0 text-xs text-muted-foreground`,children:[(0,A.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,A.jsxs)(`div`,{className:`hidden md:flex items-center gap-2 text-[10px] text-muted-foreground/50`,children:[(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:`/`}),` columns`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`A`]}),` select all`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`C`]}),` copy`]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,disabled:o<=1,onClick:()=>s(o-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,A.jsx)(f,{className:`size-3.5`})}),(0,A.jsxs)(`span`,{children:[o,` / `,Ke]}),(0,A.jsx)(`button`,{type:`button`,disabled:o>=Ke,onClick:()=>s(o+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,A.jsx)(a,{className:`size-3.5`})})]})]})]})}function N(e){return e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e)}var P=200;function F(e){if(e==null)return!1;if(typeof e==`object`)return!0;let t=String(e);if(t.length>=P)return!0;let n=t.trimStart();return!!((n[0]===`{`||n[0]===`[`)&&(n.endsWith(`}`)||n.endsWith(`]`))||n.startsWith(`<?xml`)||n.startsWith(`<`)&&n.endsWith(`>`))}function ne(e){let t=e.trimStart();if(t[0]===`{`||t[0]===`[`)try{return JSON.parse(t),`json`}catch{}return t.startsWith(`<?xml`)||t.startsWith(`<`)&&/<\/\w+>/.test(t)?`xml`:t.startsWith(`---`)||/^\w+:\s/m.test(t)?`yaml`:`plaintext`}function re({columns:e,onSelect:t,onClose:n}){let[r,i]=(0,E.useState)(``),[a,o]=(0,E.useState)(0),s=(0,E.useMemo)(()=>{if(!r)return e;let t=r.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,r]),c=(0,E.useRef)(null);return(0,E.useEffect)(()=>{c.current?.scrollIntoView({block:`nearest`})},[a]),(0,A.jsxs)(`div`,{className:`absolute top-full right-0 mt-1 z-50 w-52 max-h-56 bg-popover border border-border rounded-md shadow-lg overflow-hidden flex flex-col`,children:[(0,A.jsx)(`input`,{autoFocus:!0,type:`text`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`Escape`?n():e.key===`ArrowDown`?(e.preventDefault(),o(e=>Math.min(e+1,s.length-1))):e.key===`ArrowUp`?(e.preventDefault(),o(e=>Math.max(e-1,0))):e.key===`Enter`&&s[a]&&t(s[a])},placeholder:`Search columns…`,className:`px-2 py-1.5 text-xs bg-transparent outline-none border-b border-border text-foreground placeholder:text-muted-foreground`}),(0,A.jsx)(`div`,{className:`overflow-auto flex-1`,children:s.map((e,n)=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>t(e),ref:n===a?c:void 0,className:`w-full text-left px-2 py-1 text-xs truncate ${n===a?`bg-primary/10 text-primary`:`text-foreground hover:bg-muted`}`,children:e},e))})]})}var ie=(0,E.memo)(function({row:e,rowIdx:t,columns:n,selected:r,onToggleSelect:i,pkCol:a,editingCell:o,editValue:s,onStartEdit:l,onCommitEdit:u,onCancelEdit:d,onSetEditValue:f,showDelete:m,confirmingDelete:h,onDelete:g,onConfirmDelete:v,onViewCell:y,onViewRow:x,pinned:S,onTogglePin:C,pinnedCols:w,pinnedColOffsets:T,stickyTop:E,trRef:D}){let O=S?`bg-muted`:r?`bg-primary/5`:`bg-background`;return(0,A.jsxs)(`tr`,{ref:D,className:`group ${S?``:`hover:bg-muted/30`}`,style:S?{position:`sticky`,top:E,zIndex:15}:void 0,children:[a&&(0,A.jsx)(`td`,{className:`px-2 py-1 border-b border-border/50 ${O}`,style:{position:`sticky`,left:0,zIndex:12},children:(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>i(t),className:`size-3 accent-primary`}),(0,A.jsx)(`button`,{type:`button`,title:`View row as JSON`,onClick:()=>x(e),className:`p-0.5 rounded transition-colors text-muted-foreground/30 md:opacity-0 md:group-hover:opacity-100 hover:text-foreground`,children:(0,A.jsx)(c,{className:`size-2.5`})}),(0,A.jsx)(`button`,{type:`button`,title:S?`Unpin row`:`Pin row`,onClick:()=>C(t),className:`p-0.5 rounded transition-colors ${S?`text-primary`:`text-muted-foreground/30 md:opacity-0 md:group-hover:opacity-100 hover:text-foreground`}`,children:S?(0,A.jsx)(b,{className:`size-2.5`}):(0,A.jsx)(_,{className:`size-2.5`})})]})}),n.map(n=>{let r=o?.rowIdx===t&&o?.col===n,i=e[n],p=!r&&F(i),m=w.has(n),h=T.get(n);return(0,A.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] border-b border-border/50 ${m?`border-r border-r-primary/20`:``} ${m||S?O:``}`,style:h==null?void 0:{position:`sticky`,left:h,zIndex:10},children:r?(0,A.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:s,onChange:e=>f(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&u(),e.key===`Escape`&&d()}}):(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,A.jsx)(`span`,{className:`cursor-pointer truncate flex-1 ${i==null?`text-muted-foreground/40 italic`:``}`,onDoubleClick:()=>a&&l(t,n,i),title:N(i),children:N(i)}),p&&(0,A.jsx)(`button`,{type:`button`,title:`View full content`,onClick:()=>y({col:n,value:N(i)}),className:`shrink-0 p-0.5 rounded text-muted-foreground/50 hover:text-foreground transition-colors`,children:(0,A.jsx)(c,{className:`size-3`})})]})},n)}),m&&a&&(0,A.jsx)(`td`,{className:`px-2 py-1 border-b border-border/50 ${S?O:``}`,children:h?(0,A.jsxs)(`span`,{className:`flex items-center gap-1 whitespace-nowrap`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>g(t),className:`text-destructive text-[10px] font-medium hover:underline`,children:`Confirm`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>v(null),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,A.jsx)(`button`,{type:`button`,onClick:()=>v(t),className:`p-0.5 rounded md:opacity-0 md:group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive transition-opacity`,title:`Delete row`,children:(0,A.jsx)(p,{className:`size-3`})})})]})});function I(e){let t={},n=/"(\w+)"\s+ILIKE\s+'%([^']*?)%'/gi,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2].replace(/''/g,`'`);return t}function L({metadata:e}){let t=e?.connectionId,n=e?.connectionName,r=e?.tableName,i=e?.schemaName??`public`,a=e?.initialSql,o=k(t),[c,u]=(0,E.useState)([]),[d,f]=(0,E.useState)(180),p=(0,E.useRef)(null),[m,h]=(0,E.useState)({}),_=(0,E.useMemo)(()=>{if(a&&!o.selectedTable)return a;if(o.selectedTable){let e=`SELECT * FROM "${o.selectedTable}"`,t=Object.entries(m).filter(([,e])=>e.trim()).map(([e,t])=>`"${e}" ILIKE '%${t.replace(/'/g,`''`)}%'`);t.length>0&&(e+=` WHERE ${t.join(` AND `)}`),o.orderBy&&(e+=` ORDER BY "${o.orderBy}" ${o.orderDir}`);let n=(o.page-1)*100;return e+=` LIMIT 100`,n>0&&(e+=` OFFSET ${n}`),e}return`SELECT * FROM `},[a,o.selectedTable,o.orderBy,o.orderDir,o.page,m]),v=(0,E.useCallback)(e=>{h(e)},[]),b=(0,E.useRef)(void 0);(0,E.useEffect)(()=>{if(!(!o.selectedTable||Object.keys(m).length===0))return clearTimeout(b.current),b.current=setTimeout(()=>{o.queryAsTable(_)},500),()=>clearTimeout(b.current)},[m]);let x=(0,E.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=d,r=e=>{let r=e.clientY-t;f(Math.max(80,Math.min(n+r,(p.current?.clientHeight??600)-100)))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[d]);(0,E.useEffect)(()=>{s.get(`/api/db/connections/${t}/tables?cached=1`).then(e=>u(e.map(e=>({name:e.name,schema:e.schema})))).catch(()=>{})},[t]);let C=(0,E.useMemo)(()=>{if(c.length!==0)return{tables:c,getColumns:async(e,n)=>await s.get(`/api/db/connections/${t}/schema?table=${encodeURIComponent(e)}${n?`&schema=${encodeURIComponent(n)}`:``}`)}},[t,c]),w=(0,E.useRef)(!1);(0,E.useEffect)(()=>{w.current||(w.current=!0,a?o.executeQuery(a):r&&o.selectTable(r,i))},[r,i,a]);let[T,D]=(0,E.useState)(!!a),O=(0,E.useCallback)(e=>{let t=e.trim();if(o.selectedTable&&RegExp(`^SELECT\\s+\\*\\s+FROM\\s+"?${o.selectedTable.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}"?\\b`,`i`).test(t)){h(I(t)),o.queryAsTable(t);return}D(!0),o.executeQuery(e)},[o.executeQuery,o.queryAsTable,o.selectedTable]),ee=(0,E.useCallback)(e=>{D(!1),o.toggleSort(e)},[o.toggleSort]),j=(0,E.useCallback)(e=>{D(!1),o.setPage(e)},[o.setPage]),N=o.queryResult,P=T&&!!(N||o.queryError),F=o.selectedTable&&!P;return(0,A.jsx)(`div`,{ref:p,className:`flex h-full w-full overflow-hidden`,children:(0,A.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,A.jsx)(l,{className:`size-3.5 text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:n??`Database`}),o.selectedTable&&(0,A.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`/ `,o.selectedTable]}),(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[o.tableData&&(0,A.jsx)(te,{columns:o.tableData.columns,rows:o.tableData.rows,filename:n?`${n}-${o.selectedTable??`data`}`:o.selectedTable??`data`,exportAllUrl:o.selectedTable?`/api/db/connections/${t}/export?table=${encodeURIComponent(o.selectedTable)}&schema=${o.selectedSchema}`:void 0}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>o.refreshData(),title:`Reload data`,className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,children:(0,A.jsx)(y,{className:`size-3 ${o.loading?`animate-spin`:``}`})})]})]}),(0,A.jsx)(`div`,{className:`shrink-0 border-b border-border`,style:{height:d},children:(0,A.jsx)(S,{onExecute:O,loading:o.queryLoading,defaultValue:_,schemaInfo:C})}),(0,A.jsx)(`div`,{onMouseDown:x,className:`shrink-0 h-1.5 cursor-row-resize bg-border/50 hover:bg-primary/30 flex items-center justify-center transition-colors`,children:(0,A.jsx)(g,{className:`size-3 text-muted-foreground/50`})}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[F&&(0,A.jsx)(M,{tableData:o.tableData,schema:o.schema,loading:o.loading,page:o.page,onPageChange:j,onCellUpdate:o.updateCell,onRowDelete:o.deleteRow,orderBy:o.orderBy,orderDir:o.orderDir,onToggleSort:ee,onBulkDelete:o.bulkDelete,onInsertRow:o.insertRow,connectionId:t,selectedTable:o.selectedTable,selectedSchema:o.selectedSchema,connectionName:n,columnFilters:m,onColumnFilter:v}),P&&(0,A.jsx)(z,{result:N,error:o.queryError,loading:o.queryLoading,schema:o.schema,connectionName:n})]})]})})}var R=()=>{};function z({result:e,error:t,loading:n,schema:r,connectionName:i}){let a=(0,E.useMemo)(()=>e?.changeType===`select`&&e.rows.length>0?{columns:e.columns,rows:e.rows,total:e.rows.length,limit:e.rows.length}:null,[e]),o=(0,E.useMemo)(()=>r?.length?r:(e?.columns??[]).map(e=>({name:e,type:`text`,nullable:!0,pk:!1,defaultValue:null})),[r,e?.columns]);return(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden text-xs`,children:[t&&(0,A.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5 shrink-0`,children:t}),e?.changeType===`modify`&&(0,A.jsxs)(`div`,{className:`px-3 py-2 text-green-500 shrink-0`,children:[e.rowsAffected,` row(s) affected`,e.executionTimeMs!=null&&(0,A.jsxs)(`span`,{className:`text-muted-foreground ml-2`,children:[e.executionTimeMs,`ms`]})]}),a&&(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[(0,A.jsx)(M,{tableData:a,schema:o,loading:!!n,page:1,onPageChange:R,onCellUpdate:R,orderBy:null,orderDir:`ASC`,onToggleSort:R,connectionName:i}),e?.executionTimeMs!=null&&(0,A.jsxs)(`div`,{className:`px-3 py-0.5 border-t border-border text-[10px] text-muted-foreground shrink-0`,children:[e.rows.length,` rows · `,e.executionTimeMs,`ms`]})]}),e?.changeType===`select`&&e.rows.length===0&&(0,A.jsxs)(`div`,{className:`px-3 py-2 text-muted-foreground shrink-0`,children:[`No results`,e.executionTimeMs!=null&&(0,A.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[e.executionTimeMs,`ms`]})]}),!e&&!t&&(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:n?(0,A.jsx)(v,{className:`size-4 animate-spin`}):`Run a query to see results`})]})}export{L as DatabaseViewer};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./chevron-down-EQA06nR-.js";import{t as i}from"./chevron-right-CXzzT44u.js";import{n as a,t as o}from"./plus-Iso5r9vD.js";import{t as s}from"./database-D1ToEV9d.js";import{n as c,t as l}from"./x-BXecj-16.js";import{t as u}from"./eye-CNcBU6Tx.js";import{t as d}from"./refresh-cw-BgQzFNaG.js";import{t as f}from"./trash-2-DYCa06CV.js";import{t as p}from"./jsx-runtime-R_NjdZtX.js";import{t as m}from"./api-client-wQbeUyeh.js";import{B as h,G as g,K as _,L as v,V as y,k as b,ot as x}from"./index-Ic5uTu20.js";import"./use-monaco-theme-D9XFxQuU.js";import{t as S}from"./sql-query-editor-CjZ7Z6XL.js";import{n as C}from"./csv-parser-CElqio6o.js";var w=n(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),T=n(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),E=e(t(),1);function D(e,t,n,r){return`ppm-db-${e}-${n}.${t}-p${r}`}function O(e,t,n,r){try{let i=sessionStorage.getItem(D(e,t,n,r));return i?JSON.parse(i):null}catch{return null}}function ee(e,t,n,r,i,a){try{sessionStorage.setItem(D(e,t,n,r),JSON.stringify({data:i,cols:a}))}catch{}}function k(e){let t=`/api/db/connections/${e}`,[n,r]=(0,E.useState)(null),[i,a]=(0,E.useState)(`public`),[o,s]=(0,E.useState)(null),[c,l]=(0,E.useState)([]),[u,d]=(0,E.useState)(!1),[f,p]=(0,E.useState)(null),[h,g]=(0,E.useState)(1),[_,v]=(0,E.useState)(null),[y,b]=(0,E.useState)(null),[x,S]=(0,E.useState)(!1),[C,w]=(0,E.useState)(null),[T,D]=(0,E.useState)(`ASC`),k=(0,E.useCallback)(async(r,a,o,c,u)=>{let f=r??n,g=a??i;if(!f)return;d(!0);let _=c===void 0?C:c,v=u??T;try{let n=_?`&orderBy=${encodeURIComponent(_)}&orderDir=${v}`:``,[r,i]=await Promise.all([m.get(`${t}/data?table=${encodeURIComponent(f)}&schema=${g}&page=${o??h}&limit=100${n}`),m.get(`${t}/schema?table=${encodeURIComponent(f)}&schema=${g}`)]);s(r),l(i),ee(e,f,g,o??h,r,i)}catch(e){p(e.message)}finally{d(!1)}},[t,e,n,i,h,C,T]),A=(0,E.useCallback)((t,n=`public`)=>{r(t),a(n),g(1),v(null);let i=O(e,t,n,1);i?(s(i.data),l(i.cols),d(!1),k(t,n,1)):k(t,n,1)},[e,k]),j=(0,E.useCallback)(e=>{g(e),k(void 0,void 0,e)},[k]),te=(0,E.useCallback)(async e=>{S(!0),b(null);try{let r=await m.post(`${t}/query`,{sql:e});v(r),r.changeType===`modify`&&k(n??void 0,i)}catch(e){b(e.message)}finally{S(!1)}},[t,n,i,k]),M=(0,E.useCallback)(async(e,r,a,o)=>{if(!n)return;let s=n,c=i;try{await m.put(`${t}/cell`,{table:s,schema:c,pkColumn:e,pkValue:r,column:a,value:o}),k(s,c)}catch(e){p(e.message)}},[t,n,i,k]),N=(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await m.del(`${t}/row`,{table:a,schema:o,pkColumn:e,pkValue:r}),k(a,o)}catch(e){p(e.message)}},[t,n,i,k]);return{selectedTable:n,selectedSchema:i,selectTable:A,tableData:o,schema:c,loading:u,error:f,page:h,setPage:j,orderBy:C,orderDir:T,toggleSort:(0,E.useCallback)(e=>{let t,n=`ASC`;C===e?T===`ASC`?(t=e,n=`DESC`):(t=null,n=`ASC`):(t=e,n=`ASC`),w(t),D(n),g(1),k(void 0,void 0,1,t,n)},[C,T,k]),queryResult:_,queryError:y,queryLoading:x,executeQuery:te,updateCell:M,deleteRow:N,bulkDelete:(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await m.post(`${t}/rows/delete`,{table:a,schema:o,pkColumn:e,pkValues:r}),k(a,o)}catch(e){p(e.message)}},[t,n,i,k]),insertRow:(0,E.useCallback)(async e=>{if(!n)return;let r=n,a=i;try{await m.post(`${t}/row`,{table:r,schema:a,values:e}),k(r,a)}catch(e){throw p(e.message),e}},[t,n,i,k]),refreshData:k,queryAsTable:(0,E.useCallback)(async e=>{d(!0);try{let n=await m.post(`${t}/query`,{sql:e});n.changeType===`select`&&s({columns:n.columns,rows:n.rows,total:n.rows.length,page:1,limit:n.rows.length})}catch(e){p(e.message)}finally{d(!1)}},[t])}}var A=p();function j(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function te({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,E.useState)(!1),[o,s]=(0,E.useState)(!1),l=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(!i)return;let e=e=>{l.current&&!l.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let u=()=>{let r=C(e,t.map(t=>e.map(e=>String(t[e]??``))));j(`${n}.csv`,r,`text/csv`),a(!1)},d=()=>{let e=JSON.stringify(t,null,2);j(`${n}.json`,e,`application/json`),a(!1)},f=async e=>{if(r){s(!0);try{let t=await(await fetch(`${r}&format=${e}&limit=10000`)).text(),i=e===`csv`?`text/csv`:`application/json`;j(`${n}-all.${e}`,t,i)}catch{}s(!1),a(!1)}};return e.length===0||t.length===0?null:(0,A.jsxs)(`div`,{className:`relative`,ref:l,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,title:`Export`,children:(0,A.jsx)(c,{className:`size-3.5`})}),i&&(0,A.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md py-1 min-w-[160px] text-xs`,children:[(0,A.jsx)(`button`,{onClick:u,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (CSV)`}),(0,A.jsx)(`button`,{onClick:d,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (JSON)`}),r&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`border-t border-border my-1`}),(0,A.jsx)(`button`,{onClick:()=>f(`csv`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (CSV)`}),(0,A.jsx)(`button`,{onClick:()=>f(`json`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (JSON)`})]})]})]})}function M({tableData:e,schema:t,loading:n,page:s,onPageChange:c,onCellUpdate:u,onRowDelete:d,orderBy:p,orderDir:m,onToggleSort:_,onBulkDelete:S,onInsertRow:C,connectionId:D,selectedTable:O,selectedSchema:ee,connectionName:k,columnFilters:j={},onColumnFilter:M}){let[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(null),[z,ae]=(0,E.useState)(``),[B,V]=(0,E.useState)(new Set),[oe,se]=(0,E.useState)(!1),[ce,le]=(0,E.useState)({}),[ue,de]=(0,E.useState)(null),[fe,pe]=(0,E.useState)(!1),{openTab:H}=b(),me=(0,E.useCallback)(e=>{H({type:`editor`,title:e.col,projectId:null,closable:!0,metadata:{inlineContent:e.value,inlineLanguage:ne(e.value)}})},[H]),[U,he]=(0,E.useState)(new Set),[ge,_e]=(0,E.useState)(new Set),[ve,ye]=(0,E.useState)(null),[be,W]=(0,E.useState)(!1),xe=(0,E.useRef)(null),G=(0,E.useMemo)(()=>t.find(e=>e.pk)?.name||(t.find(e=>e.name.toLowerCase()===`id`)?.name??null),[t]),Se=(0,E.useCallback)(e=>{let t=JSON.stringify(e,null,2),n=G?String(e[G]??``):``;H({type:`editor`,title:n?`Row ${n}`:`Row`,projectId:null,closable:!0,metadata:{inlineContent:t,inlineLanguage:`json`}})},[H,G]),Ce=(0,E.useRef)(N);Ce.current=N;let K=(0,E.useRef)(F);K.current=F;let we=(0,E.useRef)(B);we.current=B;let Te=(0,E.useRef)(L);Te.current=L;let Ee=(0,E.useCallback)((e,t,n)=>{P({rowIdx:e,col:t}),I(n==null?``:typeof n==`object`?JSON.stringify(n):String(n))},[]),De=(0,E.useCallback)(()=>{let t=Ce.current;if(!t||!e||!G)return;let n=e.rows[t.rowIdx];if(!n)return;let r=n[t.col];String(r??``)!==K.current&&u(G,n[G],t.col,K.current===``?null:K.current),P(null)},[e,G,u]),Oe=(0,E.useCallback)(()=>P(null),[]),ke=(0,E.useCallback)(t=>{if(!e||!G||!d)return;let n=e.rows[t];n&&(d(G,n[G]),R(null))},[e,G,d]),Ae=(0,E.useCallback)(e=>{he(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),je=(0,E.useCallback)(e=>{_e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Me=(0,E.useCallback)((e,t)=>{let n={...j};t?n[e]=t:delete n[e],M?.(n)},[j,M]),Ne=(0,E.useCallback)(e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Pe=(0,E.useCallback)(()=>{e&&V(t=>t.size===e.rows.length?new Set:new Set(e.rows.map((e,t)=>t)))},[e]),Fe=(0,E.useCallback)(()=>{!e||!G||!S||(S(G,Array.from(B).map(t=>e.rows[t]?.[G]).filter(e=>e!=null)),V(new Set),pe(!1))},[e,G,S,B]),Ie=(0,E.useCallback)(async()=>{if(C){de(null);try{let e={};for(let[t,n]of Object.entries(ce))n!==``&&(e[t]=n);await C(e),se(!1),le({})}catch(e){de(e.message)}}},[C,ce]),q=(0,E.useMemo)(()=>{if(!e||!z)return e?.rows??[];let t=z.toLowerCase();return e.rows.filter(n=>e.columns.some(e=>String(n[e]??``).toLowerCase().includes(t)))},[e,z]),Le=(0,E.useRef)(null);(0,E.useEffect)(()=>{let t=Le.current;if(!t)return;let n=t=>{if(t.key===`Escape`){W(!1);return}let n=t.target?.tagName;if(!(n===`INPUT`||n===`TEXTAREA`)){if(t.key===`/`){t.preventDefault(),W(!0);return}if(!(!(t.metaKey||t.ctrlKey)||!e)&&(t.key===`a`&&(t.preventDefault(),V(new Set(e.rows.map((e,t)=>t)))),t.key===`c`&&B.size>0)){t.preventDefault();let n=e.columns,r=n.join(` `),i=Array.from(B).sort((e,t)=>e-t).map(t=>n.map(n=>{let r=e.rows[t]?.[n];return r==null?``:typeof r==`object`?JSON.stringify(r):String(r)}).join(` `));navigator.clipboard.writeText([r,...i].join(`
2
+ `))}}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[e,B]);let J=(0,E.useMemo)(()=>{if(!e)return[];let t=e.columns.filter(e=>U.has(e)),n=e.columns.filter(e=>!U.has(e));return[...t,...n]},[e?.columns,U]),Re=(0,E.useRef)(null),[Y,ze]=(0,E.useState)(0),[X,Be]=(0,E.useState)(new Map);(0,E.useEffect)(()=>{let e=Re.current;if(!e)return;let t=()=>{ze(e.offsetHeight);let t=new Map;e.querySelectorAll(`th[data-col]`).forEach(e=>{t.set(e.dataset.col,e.offsetWidth)});let n=e.querySelector(`th[data-col='_cb']`);n&&t.set(`_cb`,n.offsetWidth),Be(t)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e?.columns,U]);let Z=(0,E.useMemo)(()=>{let e=new Map,t=X.get(`_cb`)??(G?40:0);for(let n of J){if(!U.has(n))break;e.set(n,t),t+=X.get(n)??100}return e},[J,U,G,X]),Q=(0,E.useMemo)(()=>Array.from(ge).sort((e,t)=>e-t).map(e=>({idx:e,row:q[e]})).filter(e=>e.row),[ge,q]),Ve=(0,E.useRef)(new Map),[$,He]=(0,E.useState)(new Map),Ue=(0,E.useCallback)((e,t)=>{t?Ve.current.set(e,t):Ve.current.delete(e)},[]);(0,E.useEffect)(()=>{if(Q.length===0){$.size>0&&He(new Map);return}let e=requestAnimationFrame(()=>{let e=new Map;for(let{idx:t}of Q){let n=Ve.current.get(t);n&&e.set(t,n.offsetHeight)}He(e)});return()=>cancelAnimationFrame(e)},[Q,e]);let We=(0,E.useMemo)(()=>{let e=new Map,t=Y;for(let{idx:n}of Q)e.set(n,t),t+=$.get(n)??28;return e},[Y,Q,$]),Ge=(0,E.useCallback)(e=>{let t=xe.current,n=t?.querySelector(`th[data-col="${e}"]`);if(!t||!n)return;let r=0,i=t.querySelector(`th[data-col="_cb"]`);i&&(r+=i.offsetWidth);for(let[t,n]of Z)t!==e&&(r=Math.max(r,n+(X.get(t)??0)));let a=n.offsetLeft-r;t.scrollTo({left:a,behavior:`smooth`}),W(!1)},[Z,X]);if(!e)return(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,A.jsx)(g,{className:`size-4 animate-spin`}):`Select a table`});let Ke=Math.ceil(e.total/e.limit)||1,qe=B.size>0,Je=B.size===e.rows.length&&e.rows.length>0;return(0,A.jsxs)(`div`,{ref:Le,tabIndex:0,className:`flex flex-col h-full overflow-hidden outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 border-b border-border bg-background shrink-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1 flex-1`,children:[(0,A.jsx)(v,{className:`size-3 text-muted-foreground`}),(0,A.jsx)(`input`,{type:`text`,value:z,onChange:e=>ae(e.target.value),placeholder:`Search current page…`,className:`flex-1 text-xs bg-transparent outline-none text-foreground placeholder:text-muted-foreground`}),z&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>ae(``),className:`text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(l,{className:`size-3`})})]}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>W(!be),className:`p-0.5 rounded transition-colors ${be?`text-primary`:`text-muted-foreground hover:text-foreground`}`,title:`Jump to column ( / )`,children:(0,A.jsx)(w,{className:`size-3.5`})}),be&&(0,A.jsx)(re,{columns:e.columns,onSelect:Ge,onClose:()=>W(!1)})]}),qe&&(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[B.size,` selected`]}),S&&G&&(fe?(0,A.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:Fe,className:`text-destructive text-[10px] font-medium hover:underline`,children:[`Delete `,B.size,`?`]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>pe(!1),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,A.jsx)(`button`,{type:`button`,onClick:()=>pe(!0),className:`p-0.5 text-muted-foreground hover:text-destructive`,children:(0,A.jsx)(f,{className:`size-3`})})),(0,A.jsx)(te,{columns:e.columns,rows:Array.from(B).map(t=>e.rows[t]).filter(Boolean),filename:`${k??`db`}-selected`})]}),C&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>{se(!0),le({}),de(null)},className:`p-0.5 rounded text-muted-foreground hover:text-primary transition-colors`,title:`Insert row`,children:(0,A.jsx)(o,{className:`size-3.5`})})]}),oe&&(0,A.jsxs)(`div`,{className:`px-2 py-1.5 border-b border-border bg-muted/30 text-xs space-y-1`,children:[(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(e=>!e.pk).map(e=>(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(`label`,{className:`text-muted-foreground text-[10px] w-16 truncate`,title:e.name,children:e.name}),(0,A.jsx)(`input`,{value:ce[e.name]??``,onChange:t=>le(n=>({...n,[e.name]:t.target.value})),placeholder:e.defaultValue??(e.nullable?`NULL`:``),className:`h-5 w-24 text-[11px] px-1 rounded border border-border bg-background outline-none focus:border-primary`})]},e.name))}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:Ie,className:`text-[10px] px-2 py-0.5 rounded bg-primary text-primary-foreground hover:bg-primary/90`,children:`Save`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>se(!1),className:`text-[10px] text-muted-foreground hover:underline`,children:`Cancel`}),ue&&(0,A.jsx)(`span`,{className:`text-[10px] text-destructive`,children:ue})]})]}),(0,A.jsxs)(`div`,{ref:xe,className:`flex-1 overflow-auto relative`,children:[n&&(0,A.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-background/60`,children:(0,A.jsx)(g,{className:`size-5 animate-spin text-primary`})}),(0,A.jsxs)(`table`,{className:`w-full text-xs`,style:{borderCollapse:`separate`,borderSpacing:0},children:[(0,A.jsx)(`thead`,{ref:Re,className:`sticky top-0 z-20 bg-muted`,children:(0,A.jsxs)(`tr`,{children:[G&&(0,A.jsx)(`th`,{"data-col":`_cb`,className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border w-10 bg-muted`,style:{position:`sticky`,left:0,zIndex:30},children:(0,A.jsx)(`input`,{type:`checkbox`,checked:Je,onChange:Pe,className:`size-3 accent-primary`})}),J.map(e=>{let n=t.find(t=>t.name===e)?.pk,i=p===e,o=U.has(e),s=!!j[e],c=ve===e,u=Z.get(e);return(0,A.jsxs)(`th`,{"data-col":e,className:`group/th px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap bg-muted ${o?`border-r border-r-primary/20`:``}`,style:u==null?void 0:{position:`sticky`,left:u,zIndex:25},children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:()=>_(e),className:`flex items-center gap-0.5 ${n?`font-bold`:``} hover:text-foreground transition-colors`,children:[e,i&&m===`ASC`&&(0,A.jsx)(a,{className:`size-3`}),i&&m===`DESC`&&(0,A.jsx)(r,{className:`size-3`})]}),M&&(0,A.jsx)(`button`,{type:`button`,title:`Filter column`,onClick:()=>ye(c?null:e),className:`p-0.5 rounded transition-colors ${s||c?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:(0,A.jsx)(T,{className:`size-2.5`})}),(0,A.jsx)(`button`,{type:`button`,title:o?`Unpin column`:`Pin column`,onClick:()=>Ae(e),className:`p-0.5 rounded transition-colors ${o?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:o?(0,A.jsx)(y,{className:`size-2.5`}):(0,A.jsx)(h,{className:`size-2.5`})})]}),c&&(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,A.jsx)(`input`,{autoFocus:!0,type:`text`,value:j[e]??``,placeholder:`ILIKE filter…`,onChange:t=>Me(e,t.target.value),onKeyDown:e=>{e.key===`Escape`&&ye(null)},className:`w-full h-5 text-[10px] px-1 rounded border border-border bg-background outline-none focus:border-primary`}),s&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>Me(e,``),className:`text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(l,{className:`size-2.5`})})]})]},e)}),d&&G&&(0,A.jsx)(`th`,{className:`px-2 py-1.5 border-b border-border w-14 bg-muted`})]})}),(0,A.jsxs)(`tbody`,{children:[Q.map(({idx:e,row:t})=>(0,A.jsx)(ie,{row:t,rowIdx:e,columns:J,selected:B.has(e),onToggleSelect:Ne,pkCol:G,editingCell:N,editValue:F,onStartEdit:Ee,onCommitEdit:De,onCancelEdit:Oe,onSetEditValue:I,showDelete:!!d,confirmingDelete:L===e,onDelete:ke,onConfirmDelete:R,onViewCell:me,onViewRow:Se,pinned:!0,onTogglePin:je,pinnedCols:U,pinnedColOffsets:Z,stickyTop:We.get(e)??Y,trRef:t=>Ue(e,t)},`pin-${e}`)),q.map((e,t)=>ge.has(t)?null:(0,A.jsx)(ie,{row:e,rowIdx:t,columns:J,selected:B.has(t),onToggleSelect:Ne,pkCol:G,editingCell:N,editValue:F,onStartEdit:Ee,onCommitEdit:De,onCancelEdit:Oe,onSetEditValue:I,showDelete:!!d,confirmingDelete:L===t,onDelete:ke,onConfirmDelete:R,onViewCell:me,onViewRow:Se,pinned:!1,onTogglePin:je,pinnedCols:U,pinnedColOffsets:Z},t)),q.length===0&&(0,A.jsx)(`tr`,{children:(0,A.jsx)(`td`,{colSpan:J.length+2,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-t border-border bg-background shrink-0 text-xs text-muted-foreground`,children:[(0,A.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,A.jsxs)(`div`,{className:`hidden md:flex items-center gap-2 text-[10px] text-muted-foreground/50`,children:[(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:`/`}),` columns`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`A`]}),` select all`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`C`]}),` copy`]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,disabled:s<=1,onClick:()=>c(s-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,A.jsx)(x,{className:`size-3.5`})}),(0,A.jsxs)(`span`,{children:[s,` / `,Ke]}),(0,A.jsx)(`button`,{type:`button`,disabled:s>=Ke,onClick:()=>c(s+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,A.jsx)(i,{className:`size-3.5`})})]})]})]})}function N(e){return e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e)}var P=200;function F(e){if(e==null)return!1;if(typeof e==`object`)return!0;let t=String(e);if(t.length>=P)return!0;let n=t.trimStart();return!!((n[0]===`{`||n[0]===`[`)&&(n.endsWith(`}`)||n.endsWith(`]`))||n.startsWith(`<?xml`)||n.startsWith(`<`)&&n.endsWith(`>`))}function ne(e){let t=e.trimStart();if(t[0]===`{`||t[0]===`[`)try{return JSON.parse(t),`json`}catch{}return t.startsWith(`<?xml`)||t.startsWith(`<`)&&/<\/\w+>/.test(t)?`xml`:t.startsWith(`---`)||/^\w+:\s/m.test(t)?`yaml`:`plaintext`}function re({columns:e,onSelect:t,onClose:n}){let[r,i]=(0,E.useState)(``),[a,o]=(0,E.useState)(0),s=(0,E.useMemo)(()=>{if(!r)return e;let t=r.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,r]),c=(0,E.useRef)(null);return(0,E.useEffect)(()=>{c.current?.scrollIntoView({block:`nearest`})},[a]),(0,A.jsxs)(`div`,{className:`absolute top-full right-0 mt-1 z-50 w-52 max-h-56 bg-popover border border-border rounded-md shadow-lg overflow-hidden flex flex-col`,children:[(0,A.jsx)(`input`,{autoFocus:!0,type:`text`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`Escape`?n():e.key===`ArrowDown`?(e.preventDefault(),o(e=>Math.min(e+1,s.length-1))):e.key===`ArrowUp`?(e.preventDefault(),o(e=>Math.max(e-1,0))):e.key===`Enter`&&s[a]&&t(s[a])},placeholder:`Search columns…`,className:`px-2 py-1.5 text-xs bg-transparent outline-none border-b border-border text-foreground placeholder:text-muted-foreground`}),(0,A.jsx)(`div`,{className:`overflow-auto flex-1`,children:s.map((e,n)=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>t(e),ref:n===a?c:void 0,className:`w-full text-left px-2 py-1 text-xs truncate ${n===a?`bg-primary/10 text-primary`:`text-foreground hover:bg-muted`}`,children:e},e))})]})}var ie=(0,E.memo)(function({row:e,rowIdx:t,columns:n,selected:r,onToggleSelect:i,pkCol:a,editingCell:o,editValue:s,onStartEdit:c,onCommitEdit:l,onCancelEdit:d,onSetEditValue:p,showDelete:m,confirmingDelete:g,onDelete:_,onConfirmDelete:v,onViewCell:b,onViewRow:x,pinned:S,onTogglePin:C,pinnedCols:w,pinnedColOffsets:T,stickyTop:E,trRef:D}){let O=S?`bg-muted`:r?`bg-primary/5`:`bg-background`;return(0,A.jsxs)(`tr`,{ref:D,className:`group ${S?``:`hover:bg-muted/30`}`,style:S?{position:`sticky`,top:E,zIndex:15}:void 0,children:[a&&(0,A.jsx)(`td`,{className:`px-2 py-1 border-b border-border/50 ${O}`,style:{position:`sticky`,left:0,zIndex:12},children:(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>i(t),className:`size-3 accent-primary`}),(0,A.jsx)(`button`,{type:`button`,title:`View row as JSON`,onClick:()=>x(e),className:`p-0.5 rounded transition-colors text-muted-foreground/30 md:opacity-0 md:group-hover:opacity-100 hover:text-foreground`,children:(0,A.jsx)(u,{className:`size-2.5`})}),(0,A.jsx)(`button`,{type:`button`,title:S?`Unpin row`:`Pin row`,onClick:()=>C(t),className:`p-0.5 rounded transition-colors ${S?`text-primary`:`text-muted-foreground/30 md:opacity-0 md:group-hover:opacity-100 hover:text-foreground`}`,children:S?(0,A.jsx)(y,{className:`size-2.5`}):(0,A.jsx)(h,{className:`size-2.5`})})]})}),n.map(n=>{let r=o?.rowIdx===t&&o?.col===n,i=e[n],f=!r&&F(i),m=w.has(n),h=T.get(n);return(0,A.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] border-b border-border/50 ${m?`border-r border-r-primary/20`:``} ${m||S?O:``}`,style:h==null?void 0:{position:`sticky`,left:h,zIndex:10},children:r?(0,A.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:s,onChange:e=>p(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&l(),e.key===`Escape`&&d()}}):(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,A.jsx)(`span`,{className:`cursor-pointer truncate flex-1 ${i==null?`text-muted-foreground/40 italic`:``}`,onDoubleClick:()=>a&&c(t,n,i),title:N(i),children:N(i)}),f&&(0,A.jsx)(`button`,{type:`button`,title:`View full content`,onClick:()=>b({col:n,value:N(i)}),className:`shrink-0 p-0.5 rounded text-muted-foreground/50 hover:text-foreground transition-colors`,children:(0,A.jsx)(u,{className:`size-3`})})]})},n)}),m&&a&&(0,A.jsx)(`td`,{className:`px-2 py-1 border-b border-border/50 ${S?O:``}`,children:g?(0,A.jsxs)(`span`,{className:`flex items-center gap-1 whitespace-nowrap`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>_(t),className:`text-destructive text-[10px] font-medium hover:underline`,children:`Confirm`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>v(null),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,A.jsx)(`button`,{type:`button`,onClick:()=>v(t),className:`p-0.5 rounded md:opacity-0 md:group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive transition-opacity`,title:`Delete row`,children:(0,A.jsx)(f,{className:`size-3`})})})]})});function I(e){let t={},n=/"(\w+)"\s+ILIKE\s+'%([^']*?)%'/gi,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2].replace(/''/g,`'`);return t}function L({metadata:e}){let t=e?.connectionId,n=e?.connectionName,r=e?.tableName,i=e?.schemaName??`public`,a=e?.initialSql,o=k(t),[c,l]=(0,E.useState)([]),[u,f]=(0,E.useState)(180),p=(0,E.useRef)(null),[h,g]=(0,E.useState)({}),v=(0,E.useMemo)(()=>{if(a&&!o.selectedTable)return a;if(o.selectedTable){let e=`SELECT * FROM "${o.selectedTable}"`,t=Object.entries(h).filter(([,e])=>e.trim()).map(([e,t])=>`"${e}" ILIKE '%${t.replace(/'/g,`''`)}%'`);t.length>0&&(e+=` WHERE ${t.join(` AND `)}`),o.orderBy&&(e+=` ORDER BY "${o.orderBy}" ${o.orderDir}`);let n=(o.page-1)*100;return e+=` LIMIT 100`,n>0&&(e+=` OFFSET ${n}`),e}return`SELECT * FROM `},[a,o.selectedTable,o.orderBy,o.orderDir,o.page,h]),y=(0,E.useCallback)(e=>{g(e)},[]),b=(0,E.useRef)(void 0);(0,E.useEffect)(()=>{if(!(!o.selectedTable||Object.keys(h).length===0))return clearTimeout(b.current),b.current=setTimeout(()=>{o.queryAsTable(v)},500),()=>clearTimeout(b.current)},[h]);let x=(0,E.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=u,r=e=>{let r=e.clientY-t;f(Math.max(80,Math.min(n+r,(p.current?.clientHeight??600)-100)))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[u]);(0,E.useEffect)(()=>{m.get(`/api/db/connections/${t}/tables?cached=1`).then(e=>l(e.map(e=>({name:e.name,schema:e.schema})))).catch(()=>{})},[t]);let C=(0,E.useMemo)(()=>{if(c.length!==0)return{tables:c,getColumns:async(e,n)=>await m.get(`/api/db/connections/${t}/schema?table=${encodeURIComponent(e)}${n?`&schema=${encodeURIComponent(n)}`:``}`)}},[t,c]),w=(0,E.useRef)(!1);(0,E.useEffect)(()=>{w.current||(w.current=!0,a?o.executeQuery(a):r&&o.selectTable(r,i))},[r,i,a]);let[T,D]=(0,E.useState)(!!a),O=(0,E.useCallback)(e=>{let t=e.trim();if(o.selectedTable&&RegExp(`^SELECT\\s+\\*\\s+FROM\\s+"?${o.selectedTable.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}"?\\b`,`i`).test(t)){g(I(t)),o.queryAsTable(t);return}D(!0),o.executeQuery(e)},[o.executeQuery,o.queryAsTable,o.selectedTable]),ee=(0,E.useCallback)(e=>{D(!1),o.toggleSort(e)},[o.toggleSort]),j=(0,E.useCallback)(e=>{D(!1),o.setPage(e)},[o.setPage]),N=o.queryResult,P=T&&!!(N||o.queryError),F=o.selectedTable&&!P;return(0,A.jsx)(`div`,{ref:p,className:`flex h-full w-full overflow-hidden`,children:(0,A.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,A.jsx)(s,{className:`size-3.5 text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:n??`Database`}),o.selectedTable&&(0,A.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`/ `,o.selectedTable]}),(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[o.tableData&&(0,A.jsx)(te,{columns:o.tableData.columns,rows:o.tableData.rows,filename:n?`${n}-${o.selectedTable??`data`}`:o.selectedTable??`data`,exportAllUrl:o.selectedTable?`/api/db/connections/${t}/export?table=${encodeURIComponent(o.selectedTable)}&schema=${o.selectedSchema}`:void 0}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>o.refreshData(),title:`Reload data`,className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,children:(0,A.jsx)(d,{className:`size-3 ${o.loading?`animate-spin`:``}`})})]})]}),(0,A.jsx)(`div`,{className:`shrink-0 border-b border-border`,style:{height:u},children:(0,A.jsx)(S,{onExecute:O,loading:o.queryLoading,defaultValue:v,schemaInfo:C})}),(0,A.jsx)(`div`,{onMouseDown:x,className:`shrink-0 h-1.5 cursor-row-resize bg-border/50 hover:bg-primary/30 flex items-center justify-center transition-colors`,children:(0,A.jsx)(_,{className:`size-3 text-muted-foreground/50`})}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[F&&(0,A.jsx)(M,{tableData:o.tableData,schema:o.schema,loading:o.loading,page:o.page,onPageChange:j,onCellUpdate:o.updateCell,onRowDelete:o.deleteRow,orderBy:o.orderBy,orderDir:o.orderDir,onToggleSort:ee,onBulkDelete:o.bulkDelete,onInsertRow:o.insertRow,connectionId:t,selectedTable:o.selectedTable,selectedSchema:o.selectedSchema,connectionName:n,columnFilters:h,onColumnFilter:y}),P&&(0,A.jsx)(z,{result:N,error:o.queryError,loading:o.queryLoading,schema:o.schema,connectionName:n})]})]})})}var R=()=>{};function z({result:e,error:t,loading:n,schema:r,connectionName:i}){let a=(0,E.useMemo)(()=>e?.changeType===`select`&&e.rows.length>0?{columns:e.columns,rows:e.rows,total:e.rows.length,limit:e.rows.length}:null,[e]),o=(0,E.useMemo)(()=>r?.length?r:(e?.columns??[]).map(e=>({name:e,type:`text`,nullable:!0,pk:!1,defaultValue:null})),[r,e?.columns]);return(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden text-xs`,children:[t&&(0,A.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5 shrink-0`,children:t}),e?.changeType===`modify`&&(0,A.jsxs)(`div`,{className:`px-3 py-2 text-green-500 shrink-0`,children:[e.rowsAffected,` row(s) affected`,e.executionTimeMs!=null&&(0,A.jsxs)(`span`,{className:`text-muted-foreground ml-2`,children:[e.executionTimeMs,`ms`]})]}),a&&(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[(0,A.jsx)(M,{tableData:a,schema:o,loading:!!n,page:1,onPageChange:R,onCellUpdate:R,orderBy:null,orderDir:`ASC`,onToggleSort:R,connectionName:i}),e?.executionTimeMs!=null&&(0,A.jsxs)(`div`,{className:`px-3 py-0.5 border-t border-border text-[10px] text-muted-foreground shrink-0`,children:[e.rows.length,` rows · `,e.executionTimeMs,`ms`]})]}),e?.changeType===`select`&&e.rows.length===0&&(0,A.jsxs)(`div`,{className:`px-3 py-2 text-muted-foreground shrink-0`,children:[`No results`,e.executionTimeMs!=null&&(0,A.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[e.executionTimeMs,`ms`]})]}),!e&&!t&&(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:n?(0,A.jsx)(g,{className:`size-4 animate-spin`}):`Run a query to see results`})]})}export{L as DatabaseViewer};
@@ -1,4 +1,4 @@
1
- import"./chunk-XZSTWKYB-DxAOx4hG.js";import{r as e}from"./chunk-GEFDOKGD-D-pKjlVd.js";import"./chunk-R5LLSJPH-CFwSJijQ.js";import"./chunk-7E7YKBS2-CiyUJxNI.js";import"./chunk-EGIJ26TM-DzqmU2Z7.js";import"./chunk-C72U2L5F-D21mS_6G.js";import"./chunk-XIRO2GV7-Djlmrely.js";import"./chunk-L3YUKLVL-C7qGJrfV.js";import"./chunk-OZEHJAEY-BXhYx3nO.js";import{g as t,h as n,p as r}from"./src-BqX54PbV.js";import{B as i,C as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as m}from"./ordinal-_K3x1fkz.js";import{t as h}from"./defaultLocale-5eAKkKJC.js";import{t as g}from"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import{t as _}from"./chunk-4BX2VUAB-D4tOov49.js";import{t as v}from"./mermaid-parser.core-C7UwoIh6.js";import{t as y}from"./chunk-KX2RTZJC-CRq1OBZv.js";import{i as b,n as x}from"./chunk-PQ6SQG4A-TF58UVMU.js";function S(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function C(){return this.eachAfter(S)}function w(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function T(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function E(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function D(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function O(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function k(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function A(e){for(var t=this,n=j(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function j(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function M(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function N(){return Array.from(this)}function P(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function F(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*I(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function L(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=B)):t===void 0&&(t=z);for(var n=new U(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new U(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(H)}function R(){return L(this).eachBefore(V)}function z(e){return e.children}function B(e){return Array.isArray(e)?e[1]:null}function V(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function H(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=L.prototype={constructor:U,count:C,each:w,eachAfter:E,eachBefore:T,find:D,sum:O,sort:k,path:A,ancestors:M,descendants:N,leaves:P,links:F,copy:R,[Symbol.iterator]:I};function W(e){if(typeof e!=`function`)throw Error();return e}function G(){return 0}function K(e){return function(){return e}}function q(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function J(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var te=(1+Math.sqrt(5))/2;function ne(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?J(c,n,r,i,h?r+=m*g/h:a):ee(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var re=(function e(t){function n(e,n,r,i,a){ne(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(te);function ie(){var e=re,t=!1,n=1,r=1,i=[0],a=G,o=G,s=G,c=G,l=G;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(q),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=W(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:K(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:K(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:K(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:K(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:K(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o,this.getAccTitle=f,this.setDiagramTitle=s,this.getDiagramTitle=a,this.getAccDescription=c,this.setAccDescription=i}static{n(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let t=d,n=p();return e({...t.treemap,...n.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{x(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){l(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}n(X,`buildHierarchy`);var ae=n((e,t)=>{_(e,t);let r=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let n of e.TreemapRows??[]){let e=n.item;if(!e)continue;let i=n.indent?parseInt(n.indent):0,a=oe(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};r.push(c)}let i=X(r),a=n((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&a(r.children,n+1)},`addNodesRecursively`);a(i,0)},`populate`),oe=n(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:n(async e=>{try{let n=await v(`treemap`,e);t.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);ae(n,r)}catch(e){throw t.error(`Error parsing treemap:`,e),e}},`parse`)},se=10,Q=10,$=25,ce={draw:n((e,i,a,o)=>{let s=o.db,c=s.getConfig(),l=c.padding??se,d=s.getDiagramTitle(),f=s.getRoot(),{themeVariables:_}=p();if(!f)return;let v=d?30:0,x=g(i),S=c.nodeWidth?c.nodeWidth*Q:960,C=c.nodeHeight?c.nodeHeight*Q:500,w=S,T=C+v;x.attr(`viewBox`,`0 0 ${w} ${T}`),u(x,T,w,c.useMaxWidth);let E;try{let e=c.valueFormat||`,`;if(e===`$0,0`)E=n(e=>`$`+h(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let t=/\.\d+/.exec(e),r=t?t[0]:``;E=n(e=>`$`+h(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let t=e.substring(1);E=n(e=>`$`+h(t||``)(e),`valueFormat`)}else E=h(e)}catch(e){t.error(`Error creating format function:`,e),E=h(`,`)}let D=m().range([`transparent`,_.cScale0,_.cScale1,_.cScale2,_.cScale3,_.cScale4,_.cScale5,_.cScale6,_.cScale7,_.cScale8,_.cScale9,_.cScale10,_.cScale11]),O=m().range([`transparent`,_.cScalePeer0,_.cScalePeer1,_.cScalePeer2,_.cScalePeer3,_.cScalePeer4,_.cScalePeer5,_.cScalePeer6,_.cScalePeer7,_.cScalePeer8,_.cScalePeer9,_.cScalePeer10,_.cScalePeer11]),k=m().range([_.cScaleLabel0,_.cScaleLabel1,_.cScaleLabel2,_.cScaleLabel3,_.cScaleLabel4,_.cScaleLabel5,_.cScaleLabel6,_.cScaleLabel7,_.cScaleLabel8,_.cScaleLabel9,_.cScaleLabel10,_.cScaleLabel11]);d&&x.append(`text`).attr(`x`,w/2).attr(`y`,v/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(d);let A=x.append(`g`).attr(`transform`,`translate(0, ${v})`).attr(`class`,`treemapContainer`),j=L(f).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ie().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(l).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=b({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=c.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),c.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);I.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>b({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),I.append(`clipPath`).attr(`id`,(e,t)=>`clip-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),I.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-8,s=i-8;if(o<10||s<10){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>8;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(6,Math.min(28,Math.round(c*l))),d=c+2+u;for(;d>s&&c>8&&(c--,u=Math.max(6,Math.min(28,Math.round(c*l))),!(u<6&&c===8));)t.style(`font-size`,`${c}px`),d=c+2+u;t.style(`font-size`,`${c}px`),(a.getComputedTextLength()>o||c<8||s<c)&&t.style(`display`,`none`)}),c.showValues!==!1&&I.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(6,Math.min(28,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+2;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-8;t.node().getComputedTextLength()>u||s+o>l||o<6?t.style(`display`,`none`):t.style(`display`,null)}),y(x,c.diagramPadding??8,`flowchart`,c?.useMaxWidth||!1)},`draw`),getClasses:n(function(e,t){return t.db.getClasses()},`getClasses`)},le={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelColor:`black`,labelFontSize:`12px`,valueFontSize:`10px`,valueColor:`black`,titleColor:`black`,titleFontSize:`14px`},ue={parser:Z,get db(){return new Y},renderer:ce,styles:n(({treemap:t}={})=>{let n=e(le,t);return`
1
+ import"./chunk-XZSTWKYB-Dbp1nUSQ.js";import{r as e}from"./chunk-GEFDOKGD-D6HHRbYk.js";import"./chunk-R5LLSJPH-C37xW0vj.js";import"./chunk-7E7YKBS2-B0vnP8v3.js";import"./chunk-EGIJ26TM-BWXe6lkx.js";import"./chunk-C72U2L5F-DpEbDtMo.js";import"./chunk-XIRO2GV7-Dz2LBq7Y.js";import"./chunk-L3YUKLVL--RGkEh__.js";import"./chunk-OZEHJAEY-sug_L09P.js";import{g as t,h as n,p as r}from"./src-j04igtQ5.js";import{B as i,C as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Czlaj26D.js";import{t as m}from"./ordinal-XHK5vIzZ.js";import{t as h}from"./defaultLocale-B6RGN4id.js";import{t as g}from"./chunk-HHEYEP7N-DN7ebS2Y.js";import"./dist-CK1enexV.js";import{t as _}from"./chunk-4BX2VUAB-BnOVw77D.js";import{t as v}from"./mermaid-parser.core-C3kd7JXM.js";import{t as y}from"./chunk-KX2RTZJC-D3VDtyvX.js";import{i as b,n as x}from"./chunk-PQ6SQG4A-_fwPRLQy.js";function S(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function C(){return this.eachAfter(S)}function w(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function T(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function E(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function D(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function O(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function k(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function A(e){for(var t=this,n=j(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function j(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function M(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function N(){return Array.from(this)}function P(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function F(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*I(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function L(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=B)):t===void 0&&(t=z);for(var n=new U(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new U(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(H)}function R(){return L(this).eachBefore(V)}function z(e){return e.children}function B(e){return Array.isArray(e)?e[1]:null}function V(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function H(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=L.prototype={constructor:U,count:C,each:w,eachAfter:E,eachBefore:T,find:D,sum:O,sort:k,path:A,ancestors:M,descendants:N,leaves:P,links:F,copy:R,[Symbol.iterator]:I};function W(e){if(typeof e!=`function`)throw Error();return e}function G(){return 0}function K(e){return function(){return e}}function q(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function J(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var te=(1+Math.sqrt(5))/2;function ne(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?J(c,n,r,i,h?r+=m*g/h:a):ee(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var re=(function e(t){function n(e,n,r,i,a){ne(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(te);function ie(){var e=re,t=!1,n=1,r=1,i=[0],a=G,o=G,s=G,c=G,l=G;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(q),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=W(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:K(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:K(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:K(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:K(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:K(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o,this.getAccTitle=f,this.setDiagramTitle=s,this.getDiagramTitle=a,this.getAccDescription=c,this.setAccDescription=i}static{n(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let t=d,n=p();return e({...t.treemap,...n.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{x(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){l(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}n(X,`buildHierarchy`);var ae=n((e,t)=>{_(e,t);let r=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let n of e.TreemapRows??[]){let e=n.item;if(!e)continue;let i=n.indent?parseInt(n.indent):0,a=oe(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};r.push(c)}let i=X(r),a=n((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&a(r.children,n+1)},`addNodesRecursively`);a(i,0)},`populate`),oe=n(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:n(async e=>{try{let n=await v(`treemap`,e);t.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);ae(n,r)}catch(e){throw t.error(`Error parsing treemap:`,e),e}},`parse`)},se=10,Q=10,$=25,ce={draw:n((e,i,a,o)=>{let s=o.db,c=s.getConfig(),l=c.padding??se,d=s.getDiagramTitle(),f=s.getRoot(),{themeVariables:_}=p();if(!f)return;let v=d?30:0,x=g(i),S=c.nodeWidth?c.nodeWidth*Q:960,C=c.nodeHeight?c.nodeHeight*Q:500,w=S,T=C+v;x.attr(`viewBox`,`0 0 ${w} ${T}`),u(x,T,w,c.useMaxWidth);let E;try{let e=c.valueFormat||`,`;if(e===`$0,0`)E=n(e=>`$`+h(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let t=/\.\d+/.exec(e),r=t?t[0]:``;E=n(e=>`$`+h(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let t=e.substring(1);E=n(e=>`$`+h(t||``)(e),`valueFormat`)}else E=h(e)}catch(e){t.error(`Error creating format function:`,e),E=h(`,`)}let D=m().range([`transparent`,_.cScale0,_.cScale1,_.cScale2,_.cScale3,_.cScale4,_.cScale5,_.cScale6,_.cScale7,_.cScale8,_.cScale9,_.cScale10,_.cScale11]),O=m().range([`transparent`,_.cScalePeer0,_.cScalePeer1,_.cScalePeer2,_.cScalePeer3,_.cScalePeer4,_.cScalePeer5,_.cScalePeer6,_.cScalePeer7,_.cScalePeer8,_.cScalePeer9,_.cScalePeer10,_.cScalePeer11]),k=m().range([_.cScaleLabel0,_.cScaleLabel1,_.cScaleLabel2,_.cScaleLabel3,_.cScaleLabel4,_.cScaleLabel5,_.cScaleLabel6,_.cScaleLabel7,_.cScaleLabel8,_.cScaleLabel9,_.cScaleLabel10,_.cScaleLabel11]);d&&x.append(`text`).attr(`x`,w/2).attr(`y`,v/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(d);let A=x.append(`g`).attr(`transform`,`translate(0, ${v})`).attr(`class`,`treemapContainer`),j=L(f).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ie().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(l).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=b({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=c.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),c.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);I.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>b({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),I.append(`clipPath`).attr(`id`,(e,t)=>`clip-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),I.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-8,s=i-8;if(o<10||s<10){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>8;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(6,Math.min(28,Math.round(c*l))),d=c+2+u;for(;d>s&&c>8&&(c--,u=Math.max(6,Math.min(28,Math.round(c*l))),!(u<6&&c===8));)t.style(`font-size`,`${c}px`),d=c+2+u;t.style(`font-size`,`${c}px`),(a.getComputedTextLength()>o||c<8||s<c)&&t.style(`display`,`none`)}),c.showValues!==!1&&I.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:`+k(e.data.name)+`;`+b({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(6,Math.min(28,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+2;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-8;t.node().getComputedTextLength()>u||s+o>l||o<6?t.style(`display`,`none`):t.style(`display`,null)}),y(x,c.diagramPadding??8,`flowchart`,c?.useMaxWidth||!1)},`draw`),getClasses:n(function(e,t){return t.db.getClasses()},`getClasses`)},le={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelColor:`black`,labelFontSize:`12px`,valueFontSize:`10px`,valueColor:`black`,titleColor:`black`,titleFontSize:`14px`},ue={parser:Z,get db(){return new Y},renderer:ce,styles:n(({treemap:t}={})=>{let n=e(le,t);return`
2
2
  .treemapNode.section {
3
3
  stroke: ${n.sectionStrokeColor};
4
4
  stroke-width: ${n.sectionStrokeWidth};
@@ -1,4 +1,4 @@
1
- import"./chunk-XZSTWKYB-DxAOx4hG.js";import{r as e}from"./chunk-GEFDOKGD-D-pKjlVd.js";import"./chunk-R5LLSJPH-CFwSJijQ.js";import"./chunk-7E7YKBS2-CiyUJxNI.js";import"./chunk-EGIJ26TM-DzqmU2Z7.js";import"./chunk-C72U2L5F-D21mS_6G.js";import"./chunk-XIRO2GV7-Djlmrely.js";import"./chunk-L3YUKLVL-C7qGJrfV.js";import"./chunk-OZEHJAEY-BXhYx3nO.js";import{g as t,h as n}from"./src-BqX54PbV.js";import{B as r,C as i,E as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as m}from"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import{t as h}from"./chunk-4BX2VUAB-D4tOov49.js";import{t as g}from"./mermaid-parser.core-C7UwoIh6.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v={axes:[],curves:[],options:_},y=structuredClone(v),b=d.radar,x=n(()=>e({...b,...p().radar}),`getConfig`),S=n(()=>y.axes,`getAxes`),C=n(()=>y.curves,`getCurves`),w=n(()=>y.options,`getOptions`),T=n(e=>{y.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),E=n(e=>{y.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:D(e.entries)}))},`setCurves`),D=n(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=S();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),O={getAxes:S,getCurves:C,getOptions:w,setAxes:T,setCurves:E,setOptions:n(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});y.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule}},`setOptions`),getConfig:x,clear:n(()=>{l(),y=structuredClone(v)},`clear`),setAccTitle:o,getAccTitle:f,setDiagramTitle:s,getDiagramTitle:i,getAccDescription:c,setAccDescription:r},k=n(e=>{h(e,O);let{axes:t,curves:n,options:r}=e;O.setAxes(t),O.setCurves(n),O.setOptions(r)},`populate`),A={parse:n(async e=>{let n=await g(`radar`,e);t.debug(n),k(n)},`parse`)},j=n((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=M(m(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;N(u,a,p,s.ticks,s.graticule),P(u,a,p,c),F(u,a,o,f,d,s.graticule,c),R(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),M=n((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return u(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),N=n((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),P=n((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2;e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*Math.cos(s)).attr(`y2`,n*r.axisScaleFactor*Math.sin(s)).attr(`class`,`radarAxisLine`),e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*Math.cos(s)).attr(`y`,n*r.axisLabelFactor*Math.sin(s)).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function F(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=I(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,L(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}n(F,`drawCurves`);function I(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}n(I,`relativeRadius`);function L(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}n(L,`closedRoundCurve`);function R(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}n(R,`drawLegend`);var z={draw:j},B=n((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
1
+ import"./chunk-XZSTWKYB-Dbp1nUSQ.js";import{r as e}from"./chunk-GEFDOKGD-D6HHRbYk.js";import"./chunk-R5LLSJPH-C37xW0vj.js";import"./chunk-7E7YKBS2-B0vnP8v3.js";import"./chunk-EGIJ26TM-BWXe6lkx.js";import"./chunk-C72U2L5F-DpEbDtMo.js";import"./chunk-XIRO2GV7-Dz2LBq7Y.js";import"./chunk-L3YUKLVL--RGkEh__.js";import"./chunk-OZEHJAEY-sug_L09P.js";import{g as t,h as n}from"./src-j04igtQ5.js";import{B as r,C as i,E as a,V as o,W as s,_ as c,a as l,c as u,d,v as f,y as p}from"./chunk-7R4GIKGN-Czlaj26D.js";import{t as m}from"./chunk-HHEYEP7N-DN7ebS2Y.js";import"./dist-CK1enexV.js";import{t as h}from"./chunk-4BX2VUAB-BnOVw77D.js";import{t as g}from"./mermaid-parser.core-C3kd7JXM.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v={axes:[],curves:[],options:_},y=structuredClone(v),b=d.radar,x=n(()=>e({...b,...p().radar}),`getConfig`),S=n(()=>y.axes,`getAxes`),C=n(()=>y.curves,`getCurves`),w=n(()=>y.options,`getOptions`),T=n(e=>{y.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),E=n(e=>{y.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:D(e.entries)}))},`setCurves`),D=n(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=S();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),O={getAxes:S,getCurves:C,getOptions:w,setAxes:T,setCurves:E,setOptions:n(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});y.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule}},`setOptions`),getConfig:x,clear:n(()=>{l(),y=structuredClone(v)},`clear`),setAccTitle:o,getAccTitle:f,setDiagramTitle:s,getDiagramTitle:i,getAccDescription:c,setAccDescription:r},k=n(e=>{h(e,O);let{axes:t,curves:n,options:r}=e;O.setAxes(t),O.setCurves(n),O.setOptions(r)},`populate`),A={parse:n(async e=>{let n=await g(`radar`,e);t.debug(n),k(n)},`parse`)},j=n((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=M(m(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;N(u,a,p,s.ticks,s.graticule),P(u,a,p,c),F(u,a,o,f,d,s.graticule,c),R(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),M=n((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return u(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),N=n((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),P=n((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2;e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*Math.cos(s)).attr(`y2`,n*r.axisScaleFactor*Math.sin(s)).attr(`class`,`radarAxisLine`),e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*Math.cos(s)).attr(`y`,n*r.axisLabelFactor*Math.sin(s)).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function F(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=I(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,L(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}n(F,`drawCurves`);function I(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}n(I,`relativeRadius`);function L(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}n(L,`closedRoundCurve`);function R(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}n(R,`drawLegend`);var z={draw:j},B=n((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
2
2
  .radarCurve-${r} {
3
3
  color: ${i};
4
4
  fill: ${i};
@@ -1,4 +1,4 @@
1
- import"./chunk-XZSTWKYB-DxAOx4hG.js";import{r as e}from"./chunk-GEFDOKGD-D-pKjlVd.js";import"./chunk-R5LLSJPH-CFwSJijQ.js";import"./chunk-7E7YKBS2-CiyUJxNI.js";import"./chunk-EGIJ26TM-DzqmU2Z7.js";import"./chunk-C72U2L5F-D21mS_6G.js";import"./chunk-XIRO2GV7-Djlmrely.js";import"./chunk-L3YUKLVL-C7qGJrfV.js";import"./chunk-OZEHJAEY-BXhYx3nO.js";import{g as t,h as n}from"./src-BqX54PbV.js";import{B as r,C as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as p}from"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import{t as m}from"./chunk-4BX2VUAB-D4tOov49.js";import{t as h}from"./mermaid-parser.core-C7UwoIh6.js";var g=u.packet,_=class{constructor(){this.packet=[],this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=o,this.getDiagramTitle=i,this.getAccDescription=s,this.setAccDescription=r}static{n(this,`PacketDB`)}getConfig(){let t=e({...g,...f().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){c(),this.packet=[]}},v=1e4,y=n((e,n)=>{m(e,n);let r=-1,i=[],a=1,{bitsPerRow:o}=n.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,t.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&n.getPacket().length<v;){let[e,t]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(n.pushWord(i),i=[],a++),!t)break;({start:s,end:c,bits:l,label:u}=t)}}n.pushWord(i)},`populate`),b=n((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:n(async e=>{let n=await h(`packet`,e),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);t.debug(n),y(n,r)},`parse`)},S=n((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:s,bitWidth:c,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),m=o+s,h=m*(d.length+1)-(f?0:o),g=c*u+2,_=p(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),l(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=n((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:n(({packet:t}={})=>{let n=e(T,t);return`
1
+ import"./chunk-XZSTWKYB-Dbp1nUSQ.js";import{r as e}from"./chunk-GEFDOKGD-D6HHRbYk.js";import"./chunk-R5LLSJPH-C37xW0vj.js";import"./chunk-7E7YKBS2-B0vnP8v3.js";import"./chunk-EGIJ26TM-BWXe6lkx.js";import"./chunk-C72U2L5F-DpEbDtMo.js";import"./chunk-XIRO2GV7-Dz2LBq7Y.js";import"./chunk-L3YUKLVL--RGkEh__.js";import"./chunk-OZEHJAEY-sug_L09P.js";import{g as t,h as n}from"./src-j04igtQ5.js";import{B as r,C as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-7R4GIKGN-Czlaj26D.js";import{t as p}from"./chunk-HHEYEP7N-DN7ebS2Y.js";import"./dist-CK1enexV.js";import{t as m}from"./chunk-4BX2VUAB-BnOVw77D.js";import{t as h}from"./mermaid-parser.core-C3kd7JXM.js";var g=u.packet,_=class{constructor(){this.packet=[],this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=o,this.getDiagramTitle=i,this.getAccDescription=s,this.setAccDescription=r}static{n(this,`PacketDB`)}getConfig(){let t=e({...g,...f().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){c(),this.packet=[]}},v=1e4,y=n((e,n)=>{m(e,n);let r=-1,i=[],a=1,{bitsPerRow:o}=n.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,t.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&n.getPacket().length<v;){let[e,t]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(n.pushWord(i),i=[],a++),!t)break;({start:s,end:c,bits:l,label:u}=t)}}n.pushWord(i)},`populate`),b=n((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:n(async e=>{let n=await h(`packet`,e),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);t.debug(n),y(n,r)},`parse`)},S=n((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:s,bitWidth:c,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),m=o+s,h=m*(d.length+1)-(f?0:o),g=c*u+2,_=p(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),l(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=n((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:n(({packet:t}={})=>{let n=e(T,t);return`
2
2
  .packetByte {
3
3
  font-size: ${n.byteFontSize};
4
4
  }
@@ -0,0 +1,4 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./columns-2-BZ9uqssV.js";import{t as i}from"./text-wrap-D8BbQYTx.js";import{t as a}from"./jsx-runtime-R_NjdZtX.js";import{i as o,t as s}from"./api-client-wQbeUyeh.js";import{$ as c,G as l,H as u,M as d}from"./index-Ic5uTu20.js";import{r as f,t as p}from"./use-monaco-theme-D9XFxQuU.js";var m=n(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),h=e(t(),1),g=a();function _(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,a=e?.ref1,v=e?.ref2,b=e?.file1,x=e?.file2,S=e?.original,C=e?.modified,w=S!=null||C!=null,T=!!(b&&x),[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!w),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(`both`),{wordWrap:I,toggleWordWrap:L}=d(),R=p(),z=(0,h.useRef)(null),[B,V]=(0,h.useState)();(0,h.useEffect)(()=>{let e=z.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&V(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[A,M]),(0,h.useEffect)(()=>{if(w||!n)return;if(j(!0),N(null),b&&x){let e=new URLSearchParams({file1:b,file2:x});s.get(`${o(n)}/files/compare?${e}`).then(e=>{k(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to compare files`),j(!1)});return}let e;if(t){let r=new URLSearchParams({file:t});a&&r.set(`ref`,a),e=`${o(n)}/git/file-diff?${r}`}else if(a||v){let t=new URLSearchParams;a&&t.set(`ref1`,a),v&&t.set(`ref2`,v),e=`${o(n)}/git/diff?${t}`}else e=`${o(n)}/git/diff`;s.get(e).then(e=>{D(e.diff),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)})},[t,n,a,v,b,x,w]);let{original:H,modified:U}=(0,h.useMemo)(()=>w?{original:S??``,modified:C??``}:T&&O?O:E?y(E):{original:``,modified:``},[E,w,S,C,T,O]),W=(0,h.useMemo)(()=>{let e=t??x??b;return e?_(e):`plaintext`},[t,b,x]),G=typeof window<`u`&&window.innerWidth<768,K=!G&&P===`both`;return!n&&!w?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`}):A?(0,g.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(l,{className:`size-5 animate-spin`}),(0,g.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]}):M?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:M}):!w&&!T&&!H&&!U?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(c,{className:`size-8`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,g.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[!G&&(0,g.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`left`?`both`:`left`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`left`?`bg-muted text-foreground`:``}`,title:`Expand original`,children:(0,g.jsx)(u,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(`both`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`both`?`bg-muted text-foreground`:``}`,title:`Side by side`,children:(0,g.jsx)(r,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`right`?`both`:`right`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`right`?`bg-muted text-foreground`:``}`,title:`Expand modified`,children:(0,g.jsx)(m,{className:`size-3.5`})}),(0,g.jsx)(`div`,{className:`w-px h-3.5 bg-border mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:L,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${I?`bg-muted text-foreground`:``}`,children:(0,g.jsx)(i,{className:`size-3.5`})})]}),(0,g.jsx)(`div`,{ref:z,className:`flex-1 overflow-hidden`,children:B&&B>0?(0,g.jsx)(f,{height:B,language:W,original:H,modified:U,theme:R,options:{fontSize:G?11:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:G||I?`on`:`off`,renderSideBySide:K,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,g.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`})}):(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,g.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function y(e){let t=e.split(`
2
+ `),n=[],r=[],i=!1;for(let e of t)if(!(e.startsWith(`diff --git`)||e.startsWith(`diff --no-index`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`Binary files`)||e.startsWith(`\\ No newline`))){if(e.startsWith(`@@`)){i=!0;continue}if(i)if(e.startsWith(`-`))n.push(e.slice(1));else if(e.startsWith(`+`))r.push(e.slice(1));else{let t=e.startsWith(` `)?e.slice(1):e;n.push(t),r.push(t)}}return{original:n.join(`
3
+ `),modified:r.join(`
4
+ `)}}export{v as DiffViewer};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-PuMiQgHl.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]);function n(e,[t,n]){return Math.min(n,Math.max(t,e))}export{t as n,n as t};
@@ -1,4 +1,4 @@
1
- import{h as e,s as t}from"./chunk-GEFDOKGD-D-pKjlVd.js";import{g as n,h as r,m as i,p as a}from"./src-BqX54PbV.js";import{B as o,C as s,V as c,W as l,_ as u,a as d,b as f,nt as p,v as m}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as h}from"./channel-By7bn0Yq.js";import"./dist-CSJdAyA9.js";import"./chunk-PU5JKC2W-ek7k4QVB.js";import"./chunk-MX3YWQON-BpS_PtKp.js";import"./chunk-YBOYWFTD-rQG3QH5s.js";import{t as g}from"./chunk-55IACEB6-DJ6BynZ4.js";import{t as _}from"./chunk-KX2RTZJC-CRq1OBZv.js";import"./chunk-PQ6SQG4A-TF58UVMU.js";import"./chunk-KYZI473N-Bb0MCaIO.js";import"./chunk-O4XLMI2P-nDhi_cVu.js";import{r as v,t as y}from"./chunk-GLR3WWYH-DKikpoJM.js";var b=(function(){var e=r(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),t=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],n=[1,10],i=[1,11],a=[1,12],o=[1,13],s=[1,23],c=[1,24],l=[1,25],u=[1,26],d=[1,27],f=[1,19],p=[1,28],m=[1,29],h=[1,20],g=[1,18],_=[1,21],v=[1,22],y=[1,36],b=[1,37],x=[1,38],S=[1,39],C=[1,40],w=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,65,66,67,68,69],T=[1,45],E=[1,46],D=[1,55],O=[40,48,50,51,52,70,71],k=[1,66],A=[1,64],j=[1,61],M=[1,65],N=[1,67],P=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,65,66,67,68,69],F=[65,66,67,68,69],I=[1,84],L=[1,83],R=[1,81],z=[1,82],B=[6,10,42,47],V=[6,10,13,41,42,47,48,49],H=[1,92],U=[1,91],W=[1,90],G=[19,58],K=[1,101],q=[1,100],J=[19,58,60,62],Y={trace:r(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,attributeKeyType:59,",":60,ATTRIBUTE_KEY:61,COMMENT:62,cardinality:63,relType:64,ZERO_OR_ONE:65,ZERO_OR_MORE:66,ONE_OR_MORE:67,ONLY_ONE:68,MD_PARENT:69,NON_IDENTIFYING:70,IDENTIFYING:71,WORD:72,$accept:0,$end:1},terminals_:{2:`error`,4:`ER_DIAGRAM`,6:`EOF`,8:`SPACE`,10:`NEWLINE`,13:`COLON`,15:`STYLE_SEPARATOR`,17:`BLOCK_START`,19:`BLOCK_STOP`,20:`SQS`,21:`SQE`,22:`title`,23:`title_value`,24:`acc_title`,25:`acc_title_value`,26:`acc_descr`,27:`acc_descr_value`,28:`acc_descr_multiline_value`,33:`direction_tb`,34:`direction_bt`,35:`direction_rl`,36:`direction_lr`,37:`CLASSDEF`,40:`UNICODE_TEXT`,41:`STYLE_TEXT`,42:`COMMA`,43:`CLASS`,44:`STYLE`,47:`SEMI`,48:`NUM`,49:`BRKT`,50:`ENTITY_NAME`,51:`DECIMAL_NUM`,52:`ENTITY_ONE`,58:`ATTRIBUTE_WORD`,60:`,`,61:`ATTRIBUTE_KEY`,62:`COMMENT`,65:`ZERO_OR_ONE`,66:`ZERO_OR_MORE`,67:`ONE_OR_MORE`,68:`ONLY_ONE`,69:`MD_PARENT`,70:`NON_IDENTIFYING`,71:`IDENTIFYING`,72:`WORD`},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[55,1],[56,1],[56,3],[59,1],[57,1],[12,3],[63,1],[63,1],[63,1],[63,1],[63,1],[64,1],[64,1],[14,1],[14,1],[14,1]],performAction:r(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:break;case 2:this.$=[];break;case 3:a[s-1].push(a[s]),this.$=a[s-1];break;case 4:case 5:this.$=a[s];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(a[s-4]),r.addEntity(a[s-2]),r.addRelationship(a[s-4],a[s],a[s-2],a[s-3]);break;case 9:r.addEntity(a[s-8]),r.addEntity(a[s-4]),r.addRelationship(a[s-8],a[s],a[s-4],a[s-5]),r.setClass([a[s-8]],a[s-6]),r.setClass([a[s-4]],a[s-2]);break;case 10:r.addEntity(a[s-6]),r.addEntity(a[s-2]),r.addRelationship(a[s-6],a[s],a[s-2],a[s-3]),r.setClass([a[s-6]],a[s-4]);break;case 11:r.addEntity(a[s-6]),r.addEntity(a[s-4]),r.addRelationship(a[s-6],a[s],a[s-4],a[s-5]),r.setClass([a[s-4]],a[s-2]);break;case 12:r.addEntity(a[s-3]),r.addAttributes(a[s-3],a[s-1]);break;case 13:r.addEntity(a[s-5]),r.addAttributes(a[s-5],a[s-1]),r.setClass([a[s-5]],a[s-3]);break;case 14:r.addEntity(a[s-2]);break;case 15:r.addEntity(a[s-4]),r.setClass([a[s-4]],a[s-2]);break;case 16:r.addEntity(a[s]);break;case 17:r.addEntity(a[s-2]),r.setClass([a[s-2]],a[s]);break;case 18:r.addEntity(a[s-6],a[s-4]),r.addAttributes(a[s-6],a[s-1]);break;case 19:r.addEntity(a[s-8],a[s-6]),r.addAttributes(a[s-8],a[s-1]),r.setClass([a[s-8]],a[s-3]);break;case 20:r.addEntity(a[s-5],a[s-3]);break;case 21:r.addEntity(a[s-7],a[s-5]),r.setClass([a[s-7]],a[s-2]);break;case 22:r.addEntity(a[s-3],a[s-1]);break;case 23:r.addEntity(a[s-5],a[s-3]),r.setClass([a[s-5]],a[s]);break;case 24:case 25:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection(`TB`);break;case 33:r.setDirection(`BT`);break;case 34:r.setDirection(`RL`);break;case 35:r.setDirection(`LR`);break;case 36:this.$=a[s-3],r.addClass(a[s-2],a[s-1]);break;case 37:case 38:case 59:case 67:this.$=[a[s]];break;case 39:case 40:this.$=a[s-2].concat([a[s]]);break;case 41:this.$=a[s-2],r.setClass(a[s-1],a[s]);break;case 42:this.$=a[s-3],r.addCssStyles(a[s-2],a[s-1]);break;case 43:this.$=[a[s]];break;case 44:a[s-2].push(a[s]),this.$=a[s-2];break;case 46:this.$=a[s-1]+a[s];break;case 54:case 79:case 80:this.$=a[s].replace(/"/g,``);break;case 55:case 56:case 57:case 58:case 81:this.$=a[s];break;case 60:a[s].push(a[s-1]),this.$=a[s];break;case 61:this.$={type:a[s-1],name:a[s]};break;case 62:this.$={type:a[s-2],name:a[s-1],keys:a[s]};break;case 63:this.$={type:a[s-2],name:a[s-1],comment:a[s]};break;case 64:this.$={type:a[s-3],name:a[s-2],keys:a[s-1],comment:a[s]};break;case 65:case 66:case 69:this.$=a[s];break;case 68:a[s-2].push(a[s]),this.$=a[s-2];break;case 70:this.$=a[s].replace(/"/g,``);break;case 71:this.$={cardA:a[s],relType:a[s-1],cardB:a[s-2]};break;case 72:this.$=r.Cardinality.ZERO_OR_ONE;break;case 73:this.$=r.Cardinality.ZERO_OR_MORE;break;case 74:this.$=r.Cardinality.ONE_OR_MORE;break;case 75:this.$=r.Cardinality.ONLY_ONE;break;case 76:this.$=r.Cardinality.MD_PARENT;break;case 77:this.$=r.Identification.NON_IDENTIFYING;break;case 78:this.$=r.Identification.IDENTIFYING;break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:n,24:i,26:a,28:o,29:14,30:15,31:16,32:17,33:s,34:c,35:l,36:u,37:d,40:f,43:p,44:m,48:h,50:g,51:_,52:v},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:30,11:9,22:n,24:i,26:a,28:o,29:14,30:15,31:16,32:17,33:s,34:c,35:l,36:u,37:d,40:f,43:p,44:m,48:h,50:g,51:_,52:v},e(t,[2,5]),e(t,[2,6]),e(t,[2,16],{12:31,63:35,15:[1,32],17:[1,33],20:[1,34],65:y,66:b,67:x,68:S,69:C}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(t,[2,27]),e(t,[2,28]),e(t,[2,29]),e(t,[2,30]),e(t,[2,31]),e(w,[2,54]),e(w,[2,55]),e(w,[2,56]),e(w,[2,57]),e(w,[2,58]),e(t,[2,32]),e(t,[2,33]),e(t,[2,34]),e(t,[2,35]),{16:44,40:T,41:E},{16:47,40:T,41:E},{16:48,40:T,41:E},e(t,[2,4]),{11:49,40:f,48:h,50:g,51:_,52:v},{16:50,40:T,41:E},{18:51,19:[1,52],53:53,54:54,58:D},{11:56,40:f,48:h,50:g,51:_,52:v},{64:57,70:[1,58],71:[1,59]},e(O,[2,72]),e(O,[2,73]),e(O,[2,74]),e(O,[2,75]),e(O,[2,76]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),{13:k,38:60,41:A,42:j,45:62,46:63,48:M,49:N},e(P,[2,37]),e(P,[2,38]),{16:68,40:T,41:E,42:j},{13:k,38:69,41:A,42:j,45:62,46:63,48:M,49:N},{13:[1,70],15:[1,71]},e(t,[2,17],{63:35,12:72,17:[1,73],42:j,65:y,66:b,67:x,68:S,69:C}),{19:[1,74]},e(t,[2,14]),{18:75,19:[2,59],53:53,54:54,58:D},{55:76,58:[1,77]},{58:[2,65]},{21:[1,78]},{63:79,65:y,66:b,67:x,68:S,69:C},e(F,[2,77]),e(F,[2,78]),{6:I,10:L,39:80,42:R,47:z},{40:[1,85],41:[1,86]},e(B,[2,43],{46:87,13:k,41:A,48:M,49:N}),e(V,[2,45]),e(V,[2,50]),e(V,[2,51]),e(V,[2,52]),e(V,[2,53]),e(t,[2,41],{42:j}),{6:I,10:L,39:88,42:R,47:z},{14:89,40:H,50:U,72:W},{16:93,40:T,41:E},{11:94,40:f,48:h,50:g,51:_,52:v},{18:95,19:[1,96],53:53,54:54,58:D},e(t,[2,12]),{19:[2,60]},e(G,[2,61],{56:97,57:98,59:99,61:K,62:q}),e([19,58,61,62],[2,66]),e(t,[2,22],{15:[1,103],17:[1,102]}),e([40,48,50,51,52],[2,71]),e(t,[2,36]),{13:k,41:A,45:104,46:63,48:M,49:N},e(t,[2,47]),e(t,[2,48]),e(t,[2,49]),e(P,[2,39]),e(P,[2,40]),e(V,[2,46]),e(t,[2,42]),e(t,[2,8]),e(t,[2,79]),e(t,[2,80]),e(t,[2,81]),{13:[1,105],42:j},{13:[1,107],15:[1,106]},{19:[1,108]},e(t,[2,15]),e(G,[2,62],{57:109,60:[1,110],62:q}),e(G,[2,63]),e(J,[2,67]),e(G,[2,70]),e(J,[2,69]),{18:111,19:[1,112],53:53,54:54,58:D},{16:113,40:T,41:E},e(B,[2,44],{46:87,13:k,41:A,48:M,49:N}),{14:114,40:H,50:U,72:W},{16:115,40:T,41:E},{14:116,40:H,50:U,72:W},e(t,[2,13]),e(G,[2,64]),{59:117,61:K},{19:[1,118]},e(t,[2,20]),e(t,[2,23],{17:[1,119],42:j}),e(t,[2,11]),{13:[1,120],42:j},e(t,[2,10]),e(J,[2,68]),e(t,[2,18]),{18:121,19:[1,122],53:53,54:54,58:D},{14:123,40:H,50:U,72:W},{19:[1,124]},e(t,[2,21]),e(t,[2,9]),e(t,[2,19])],defaultActions:{55:[2,65],75:[2,60]},parseError:r(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:r(function(e){var t=this,n=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){n.length-=2*e,a.length-=e,o.length-=e}r(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=t.symbols_[e]||e),e}r(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=n[n.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{h as e,s as t}from"./chunk-GEFDOKGD-D6HHRbYk.js";import{g as n,h as r,m as i,p as a}from"./src-j04igtQ5.js";import{B as o,C as s,V as c,W as l,_ as u,a as d,b as f,nt as p,v as m}from"./chunk-7R4GIKGN-Czlaj26D.js";import{t as h}from"./channel-Cgy1thYT.js";import"./dist-CK1enexV.js";import"./chunk-PU5JKC2W-BUaTFJVQ.js";import"./chunk-MX3YWQON-2B76t_Kx.js";import"./chunk-YBOYWFTD-3OTKowjE.js";import{t as g}from"./chunk-55IACEB6-BftA8DxR.js";import{t as _}from"./chunk-KX2RTZJC-D3VDtyvX.js";import"./chunk-PQ6SQG4A-_fwPRLQy.js";import"./chunk-KYZI473N-Z-NBw_HS.js";import"./chunk-O4XLMI2P-2CJLfx_1.js";import{r as v,t as y}from"./chunk-GLR3WWYH-CxUl1sdz.js";var b=(function(){var e=r(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),t=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],n=[1,10],i=[1,11],a=[1,12],o=[1,13],s=[1,23],c=[1,24],l=[1,25],u=[1,26],d=[1,27],f=[1,19],p=[1,28],m=[1,29],h=[1,20],g=[1,18],_=[1,21],v=[1,22],y=[1,36],b=[1,37],x=[1,38],S=[1,39],C=[1,40],w=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,65,66,67,68,69],T=[1,45],E=[1,46],D=[1,55],O=[40,48,50,51,52,70,71],k=[1,66],A=[1,64],j=[1,61],M=[1,65],N=[1,67],P=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,65,66,67,68,69],F=[65,66,67,68,69],I=[1,84],L=[1,83],R=[1,81],z=[1,82],B=[6,10,42,47],V=[6,10,13,41,42,47,48,49],H=[1,92],U=[1,91],W=[1,90],G=[19,58],K=[1,101],q=[1,100],J=[19,58,60,62],Y={trace:r(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,attributeKeyType:59,",":60,ATTRIBUTE_KEY:61,COMMENT:62,cardinality:63,relType:64,ZERO_OR_ONE:65,ZERO_OR_MORE:66,ONE_OR_MORE:67,ONLY_ONE:68,MD_PARENT:69,NON_IDENTIFYING:70,IDENTIFYING:71,WORD:72,$accept:0,$end:1},terminals_:{2:`error`,4:`ER_DIAGRAM`,6:`EOF`,8:`SPACE`,10:`NEWLINE`,13:`COLON`,15:`STYLE_SEPARATOR`,17:`BLOCK_START`,19:`BLOCK_STOP`,20:`SQS`,21:`SQE`,22:`title`,23:`title_value`,24:`acc_title`,25:`acc_title_value`,26:`acc_descr`,27:`acc_descr_value`,28:`acc_descr_multiline_value`,33:`direction_tb`,34:`direction_bt`,35:`direction_rl`,36:`direction_lr`,37:`CLASSDEF`,40:`UNICODE_TEXT`,41:`STYLE_TEXT`,42:`COMMA`,43:`CLASS`,44:`STYLE`,47:`SEMI`,48:`NUM`,49:`BRKT`,50:`ENTITY_NAME`,51:`DECIMAL_NUM`,52:`ENTITY_ONE`,58:`ATTRIBUTE_WORD`,60:`,`,61:`ATTRIBUTE_KEY`,62:`COMMENT`,65:`ZERO_OR_ONE`,66:`ZERO_OR_MORE`,67:`ONE_OR_MORE`,68:`ONLY_ONE`,69:`MD_PARENT`,70:`NON_IDENTIFYING`,71:`IDENTIFYING`,72:`WORD`},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[55,1],[56,1],[56,3],[59,1],[57,1],[12,3],[63,1],[63,1],[63,1],[63,1],[63,1],[64,1],[64,1],[14,1],[14,1],[14,1]],performAction:r(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:break;case 2:this.$=[];break;case 3:a[s-1].push(a[s]),this.$=a[s-1];break;case 4:case 5:this.$=a[s];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(a[s-4]),r.addEntity(a[s-2]),r.addRelationship(a[s-4],a[s],a[s-2],a[s-3]);break;case 9:r.addEntity(a[s-8]),r.addEntity(a[s-4]),r.addRelationship(a[s-8],a[s],a[s-4],a[s-5]),r.setClass([a[s-8]],a[s-6]),r.setClass([a[s-4]],a[s-2]);break;case 10:r.addEntity(a[s-6]),r.addEntity(a[s-2]),r.addRelationship(a[s-6],a[s],a[s-2],a[s-3]),r.setClass([a[s-6]],a[s-4]);break;case 11:r.addEntity(a[s-6]),r.addEntity(a[s-4]),r.addRelationship(a[s-6],a[s],a[s-4],a[s-5]),r.setClass([a[s-4]],a[s-2]);break;case 12:r.addEntity(a[s-3]),r.addAttributes(a[s-3],a[s-1]);break;case 13:r.addEntity(a[s-5]),r.addAttributes(a[s-5],a[s-1]),r.setClass([a[s-5]],a[s-3]);break;case 14:r.addEntity(a[s-2]);break;case 15:r.addEntity(a[s-4]),r.setClass([a[s-4]],a[s-2]);break;case 16:r.addEntity(a[s]);break;case 17:r.addEntity(a[s-2]),r.setClass([a[s-2]],a[s]);break;case 18:r.addEntity(a[s-6],a[s-4]),r.addAttributes(a[s-6],a[s-1]);break;case 19:r.addEntity(a[s-8],a[s-6]),r.addAttributes(a[s-8],a[s-1]),r.setClass([a[s-8]],a[s-3]);break;case 20:r.addEntity(a[s-5],a[s-3]);break;case 21:r.addEntity(a[s-7],a[s-5]),r.setClass([a[s-7]],a[s-2]);break;case 22:r.addEntity(a[s-3],a[s-1]);break;case 23:r.addEntity(a[s-5],a[s-3]),r.setClass([a[s-5]],a[s]);break;case 24:case 25:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection(`TB`);break;case 33:r.setDirection(`BT`);break;case 34:r.setDirection(`RL`);break;case 35:r.setDirection(`LR`);break;case 36:this.$=a[s-3],r.addClass(a[s-2],a[s-1]);break;case 37:case 38:case 59:case 67:this.$=[a[s]];break;case 39:case 40:this.$=a[s-2].concat([a[s]]);break;case 41:this.$=a[s-2],r.setClass(a[s-1],a[s]);break;case 42:this.$=a[s-3],r.addCssStyles(a[s-2],a[s-1]);break;case 43:this.$=[a[s]];break;case 44:a[s-2].push(a[s]),this.$=a[s-2];break;case 46:this.$=a[s-1]+a[s];break;case 54:case 79:case 80:this.$=a[s].replace(/"/g,``);break;case 55:case 56:case 57:case 58:case 81:this.$=a[s];break;case 60:a[s].push(a[s-1]),this.$=a[s];break;case 61:this.$={type:a[s-1],name:a[s]};break;case 62:this.$={type:a[s-2],name:a[s-1],keys:a[s]};break;case 63:this.$={type:a[s-2],name:a[s-1],comment:a[s]};break;case 64:this.$={type:a[s-3],name:a[s-2],keys:a[s-1],comment:a[s]};break;case 65:case 66:case 69:this.$=a[s];break;case 68:a[s-2].push(a[s]),this.$=a[s-2];break;case 70:this.$=a[s].replace(/"/g,``);break;case 71:this.$={cardA:a[s],relType:a[s-1],cardB:a[s-2]};break;case 72:this.$=r.Cardinality.ZERO_OR_ONE;break;case 73:this.$=r.Cardinality.ZERO_OR_MORE;break;case 74:this.$=r.Cardinality.ONE_OR_MORE;break;case 75:this.$=r.Cardinality.ONLY_ONE;break;case 76:this.$=r.Cardinality.MD_PARENT;break;case 77:this.$=r.Identification.NON_IDENTIFYING;break;case 78:this.$=r.Identification.IDENTIFYING;break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:n,24:i,26:a,28:o,29:14,30:15,31:16,32:17,33:s,34:c,35:l,36:u,37:d,40:f,43:p,44:m,48:h,50:g,51:_,52:v},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:30,11:9,22:n,24:i,26:a,28:o,29:14,30:15,31:16,32:17,33:s,34:c,35:l,36:u,37:d,40:f,43:p,44:m,48:h,50:g,51:_,52:v},e(t,[2,5]),e(t,[2,6]),e(t,[2,16],{12:31,63:35,15:[1,32],17:[1,33],20:[1,34],65:y,66:b,67:x,68:S,69:C}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(t,[2,27]),e(t,[2,28]),e(t,[2,29]),e(t,[2,30]),e(t,[2,31]),e(w,[2,54]),e(w,[2,55]),e(w,[2,56]),e(w,[2,57]),e(w,[2,58]),e(t,[2,32]),e(t,[2,33]),e(t,[2,34]),e(t,[2,35]),{16:44,40:T,41:E},{16:47,40:T,41:E},{16:48,40:T,41:E},e(t,[2,4]),{11:49,40:f,48:h,50:g,51:_,52:v},{16:50,40:T,41:E},{18:51,19:[1,52],53:53,54:54,58:D},{11:56,40:f,48:h,50:g,51:_,52:v},{64:57,70:[1,58],71:[1,59]},e(O,[2,72]),e(O,[2,73]),e(O,[2,74]),e(O,[2,75]),e(O,[2,76]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),{13:k,38:60,41:A,42:j,45:62,46:63,48:M,49:N},e(P,[2,37]),e(P,[2,38]),{16:68,40:T,41:E,42:j},{13:k,38:69,41:A,42:j,45:62,46:63,48:M,49:N},{13:[1,70],15:[1,71]},e(t,[2,17],{63:35,12:72,17:[1,73],42:j,65:y,66:b,67:x,68:S,69:C}),{19:[1,74]},e(t,[2,14]),{18:75,19:[2,59],53:53,54:54,58:D},{55:76,58:[1,77]},{58:[2,65]},{21:[1,78]},{63:79,65:y,66:b,67:x,68:S,69:C},e(F,[2,77]),e(F,[2,78]),{6:I,10:L,39:80,42:R,47:z},{40:[1,85],41:[1,86]},e(B,[2,43],{46:87,13:k,41:A,48:M,49:N}),e(V,[2,45]),e(V,[2,50]),e(V,[2,51]),e(V,[2,52]),e(V,[2,53]),e(t,[2,41],{42:j}),{6:I,10:L,39:88,42:R,47:z},{14:89,40:H,50:U,72:W},{16:93,40:T,41:E},{11:94,40:f,48:h,50:g,51:_,52:v},{18:95,19:[1,96],53:53,54:54,58:D},e(t,[2,12]),{19:[2,60]},e(G,[2,61],{56:97,57:98,59:99,61:K,62:q}),e([19,58,61,62],[2,66]),e(t,[2,22],{15:[1,103],17:[1,102]}),e([40,48,50,51,52],[2,71]),e(t,[2,36]),{13:k,41:A,45:104,46:63,48:M,49:N},e(t,[2,47]),e(t,[2,48]),e(t,[2,49]),e(P,[2,39]),e(P,[2,40]),e(V,[2,46]),e(t,[2,42]),e(t,[2,8]),e(t,[2,79]),e(t,[2,80]),e(t,[2,81]),{13:[1,105],42:j},{13:[1,107],15:[1,106]},{19:[1,108]},e(t,[2,15]),e(G,[2,62],{57:109,60:[1,110],62:q}),e(G,[2,63]),e(J,[2,67]),e(G,[2,70]),e(J,[2,69]),{18:111,19:[1,112],53:53,54:54,58:D},{16:113,40:T,41:E},e(B,[2,44],{46:87,13:k,41:A,48:M,49:N}),{14:114,40:H,50:U,72:W},{16:115,40:T,41:E},{14:116,40:H,50:U,72:W},e(t,[2,13]),e(G,[2,64]),{59:117,61:K},{19:[1,118]},e(t,[2,20]),e(t,[2,23],{17:[1,119],42:j}),e(t,[2,11]),{13:[1,120],42:j},e(t,[2,10]),e(J,[2,68]),e(t,[2,18]),{18:121,19:[1,122],53:53,54:54,58:D},{14:123,40:H,50:U,72:W},{19:[1,124]},e(t,[2,21]),e(t,[2,9]),e(t,[2,19])],defaultActions:{55:[2,65],75:[2,60]},parseError:r(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:r(function(e){var t=this,n=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){n.length-=2*e,a.length-=e,o.length-=e}r(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=t.symbols_[e]||e),e}r(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=n[n.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:n.push(S),a.push(h.yytext),o.push(h.yylloc),n.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(n=n.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),n.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[n[n.length-2]][n[n.length-1]],n.push(A);break;case 3:return!0}}return!0},`parse`)};Y.lexer=(function(){return{EOF:1,parseError:r(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:r(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:r(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:r(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:r(function(){return this._more=!0,this},`more`),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:r(function(e){this.unput(this.match.slice(e))},`less`),pastInput:r(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:r(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:r(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./jsx-runtime-kMwlnEGE.js";import{z as r}from"./index-BDAqXmpQ.js";var i=e(t(),1),a=n(),o=`<script>
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./jsx-runtime-R_NjdZtX.js";import{h as r}from"./index-Ic5uTu20.js";var i=e(t(),1),a=n(),o=`<script>
2
2
  function acquireVsCodeApi(){return{postMessage:function(m){window.parent.postMessage(m,"*")},getState:function(){try{return JSON.parse(sessionStorage.getItem("vscode-state")||"null")}catch{return null}},setState:function(s){sessionStorage.setItem("vscode-state",JSON.stringify(s));return s}}}
3
3
  <\/script>`;function s(e){if(!e)return e;let t=e.indexOf(`<head>`);return t===-1?o+e:e.slice(0,t+6)+o+e.slice(t+6)}function c({metadata:e}){let t=e?.panelId,n=r(e=>t?e.webviewPanels[t]:void 0),o=(0,i.useRef)(null),c=s(n?.html??``);return(0,i.useEffect)(()=>{let e=e=>{o.current&&e.source===o.current.contentWindow&&window.dispatchEvent(new CustomEvent(`ext:webview:send`,{detail:{panelId:t,message:e.data}}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[t]),(0,i.useEffect)(()=>{let e=e=>{let{panelId:n,message:r}=e.detail;n===t&&o.current?.contentWindow?.postMessage(r,`*`)};return window.addEventListener(`ext:webview:message`,e),()=>window.removeEventListener(`ext:webview:message`,e)},[t]),n?(0,a.jsx)(`div`,{className:`h-full w-full relative`,children:(0,a.jsx)(`iframe`,{ref:o,srcDoc:c,sandbox:`allow-scripts`,className:`w-full h-full border-0 bg-white dark:bg-zinc-900`,title:n.title})}):(0,a.jsx)(`div`,{className:`flex items-center justify-center h-full text-sm text-text-subtle`,children:`Webview panel not found`})}export{c as ExtensionWebview};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-PuMiQgHl.js";var t=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t};
@@ -1,4 +1,4 @@
1
- import{h as e,s as t}from"./chunk-GEFDOKGD-D-pKjlVd.js";import{g as n,h as r,p as i}from"./src-BqX54PbV.js";import{B as a,C as o,U as s,V as c,W as l,Z as u,_ as d,a as f,b as p,nt as m,s as h,u as g,v as _}from"./chunk-7R4GIKGN-Dv-4cAYn.js";import{t as v}from"./channel-By7bn0Yq.js";import"./dist-CSJdAyA9.js";import"./chunk-PU5JKC2W-ek7k4QVB.js";import{t as ee}from"./chunk-FMBD7UC4-DXncblvW.js";import"./chunk-MX3YWQON-BpS_PtKp.js";import"./chunk-YBOYWFTD-rQG3QH5s.js";import{t as te}from"./chunk-JSJVCQXG-99JzIdPr.js";import{t as ne}from"./chunk-55IACEB6-DJ6BynZ4.js";import{t as y}from"./chunk-KX2RTZJC-CRq1OBZv.js";import"./chunk-PQ6SQG4A-TF58UVMU.js";import{o as b}from"./chunk-KYZI473N-Bb0MCaIO.js";import"./chunk-O4XLMI2P-nDhi_cVu.js";import{r as x,t as S}from"./chunk-GLR3WWYH-DKikpoJM.js";import{n as C,t as w}from"./chunk-XPW4576I-BPQQBakK.js";var T=`flowchart-`,E=class{constructor(){this.vertexCounter=0,this.config=p(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=c,this.setAccDescription=a,this.setDiagramTitle=l,this.getAccTitle=_,this.getAccDescription=d,this.getDiagramTitle=o,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen(`gen-2`)}static{r(this,`FlowDB`)}sanitizeText(e){return h.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case`markdown`:case`string`:case`text`:return e;default:return`markdown`}}lookUpDomId(e){for(let t of this.vertices.values())if(t.id===e)return t.domId;return e}addVertex(e,t,n,r,i,a,o={},s){if(!e||e.trim().length===0)return;let c;if(s!==void 0){let e;e=s.includes(`
1
+ import{h as e,s as t}from"./chunk-GEFDOKGD-D6HHRbYk.js";import{g as n,h as r,p as i}from"./src-j04igtQ5.js";import{B as a,C as o,U as s,V as c,W as l,Z as u,_ as d,a as f,b as p,nt as m,s as h,u as g,v as _}from"./chunk-7R4GIKGN-Czlaj26D.js";import{t as v}from"./channel-Cgy1thYT.js";import"./dist-CK1enexV.js";import"./chunk-PU5JKC2W-BUaTFJVQ.js";import{t as ee}from"./chunk-FMBD7UC4-DspqhPfk.js";import"./chunk-MX3YWQON-2B76t_Kx.js";import"./chunk-YBOYWFTD-3OTKowjE.js";import{t as te}from"./chunk-JSJVCQXG-BC8wnMwf.js";import{t as ne}from"./chunk-55IACEB6-BftA8DxR.js";import{t as y}from"./chunk-KX2RTZJC-D3VDtyvX.js";import"./chunk-PQ6SQG4A-_fwPRLQy.js";import{o as b}from"./chunk-KYZI473N-Z-NBw_HS.js";import"./chunk-O4XLMI2P-2CJLfx_1.js";import{r as x,t as S}from"./chunk-GLR3WWYH-CxUl1sdz.js";import{n as C,t as w}from"./chunk-XPW4576I-DenTbBuj.js";var T=`flowchart-`,E=class{constructor(){this.vertexCounter=0,this.config=p(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=c,this.setAccDescription=a,this.setDiagramTitle=l,this.getAccTitle=_,this.getAccDescription=d,this.getDiagramTitle=o,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen(`gen-2`)}static{r(this,`FlowDB`)}sanitizeText(e){return h.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case`markdown`:case`string`:case`text`:return e;default:return`markdown`}}lookUpDomId(e){for(let t of this.vertices.values())if(t.id===e)return t.domId;return e}addVertex(e,t,n,r,i,a,o={},s){if(!e||e.trim().length===0)return;let c;if(s!==void 0){let e;e=s.includes(`
2
2
  `)?s+`
3
3
  `:`{
4
4
  `+s+`