erdbpro 3.4.7-rc.13 → 3.4.7-rc.14

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 (152) hide show
  1. package/dist/assets/{AdminRoute-gDOEk8yy.js → AdminRoute-CPHX-V4I.js} +2 -2
  2. package/dist/assets/{Combination-1O3P4ajp.js → Combination-cO6WDhz3.js} +1 -1
  3. package/dist/assets/{DataViewerModeToolbar-BERwUykX.js → DataViewerModeToolbar-C935ViAZ.js} +1 -1
  4. package/dist/assets/{DbClientEditorRoute-i_z2s1dZ.js → DbClientEditorRoute-DsyZFy2u.js} +1 -1
  5. package/dist/assets/{DiagramEditorRoute-Bfw-7ea4.js → DiagramEditorRoute-BdW3kBgD.js} +1 -1
  6. package/dist/assets/{DrawingEditorRoute-CCZVGvjN.js → DrawingEditorRoute-ARzbYOlh.js} +2 -2
  7. package/dist/assets/{DrawingsView-BvAZw1vT.js → DrawingsView-DNCKy14S.js} +1 -1
  8. package/dist/assets/{ExcalidrawEditor-BlXcT7Ae.js → ExcalidrawEditor-BBdVpt_F.js} +8 -8
  9. package/dist/assets/{FileCommentMarkers-Do8KNBq5.js → FileCommentMarkers-BQZxgTaW.js} +1 -1
  10. package/dist/assets/{FlowchartEditorRoute-P1Jzy5w7.js → FlowchartEditorRoute-wl-KooQs.js} +1 -1
  11. package/dist/assets/{FlowchartView-KKIj1Hq-.js → FlowchartView-CM1oQZqa.js} +1 -1
  12. package/dist/assets/{JumpToNode-YENX0D1W.js → JumpToNode-D5AzEEQu.js} +1 -1
  13. package/dist/assets/{NoteEditorRoute-BDfs3QN9.js → NoteEditorRoute-T1NBBQcR.js} +2 -2
  14. package/dist/assets/{NotesCompanionPane-fnnh-pKK.js → NotesCompanionPane-D4_YtqPe.js} +2 -2
  15. package/dist/assets/{NotesView-ByjZpc8a.js → NotesView-Czehzn2R.js} +3 -3
  16. package/dist/assets/{ProjectFileTabs-DZWlg8g5.js → ProjectFileTabs-BRybZZLH.js} +1 -1
  17. package/dist/assets/{TeamInventoryRoute-Kfj2OfHo.js → TeamInventoryRoute-f48FMaW5.js} +1 -1
  18. package/dist/assets/{TeamManagementRoute-Ce6VjmAT.js → TeamManagementRoute-CiiHo59X.js} +1 -1
  19. package/dist/assets/{TrashView-Dqa_2hcy.js → TrashView-D-HVBnxb.js} +1 -1
  20. package/dist/assets/{UserManagementRoute-C48VZ_KR.js → UserManagementRoute-DSDW-fFe.js} +1 -1
  21. package/dist/assets/{WorkspaceProvider-EYbBHADd.js → WorkspaceProvider-CGqNGa8d.js} +3 -3
  22. package/dist/assets/{abnfDiagram-N423BO3Z-QQB1rA1l.js → abnfDiagram-N423BO3Z-BXE9wbGg.js} +1 -1
  23. package/dist/assets/{ar-SA-G6X2FPQ2-DaSx7KIG.js → ar-SA-G6X2FPQ2-Blm5o_Ti.js} +1 -1
  24. package/dist/assets/{architectureDiagram-T3A2C74G-BlFel6lV.js → architectureDiagram-T3A2C74G-BrqBXWO0.js} +1 -1
  25. package/dist/assets/{az-AZ-76LH7QW2-DO9uvjni.js → az-AZ-76LH7QW2-DKWOr3SZ.js} +1 -1
  26. package/dist/assets/{bg-BG-XCXSNQG7-DDoAY2iD.js → bg-BG-XCXSNQG7-Dk7XnUr8.js} +1 -1
  27. package/dist/assets/{blockDiagram-VBNYF7ZC-DJhN2lry.js → blockDiagram-VBNYF7ZC-QZcXfCZD.js} +1 -1
  28. package/dist/assets/{bn-BD-2XOGV67Q-CclZf_c4.js → bn-BD-2XOGV67Q-VZGLFSx6.js} +1 -1
  29. package/dist/assets/{c4Diagram-5PPSVZJV-DZ1eakb6.js → c4Diagram-5PPSVZJV-DIOD2WiC.js} +1 -1
  30. package/dist/assets/{ca-ES-6MX7JW3Y-BUCZd9Xn.js → ca-ES-6MX7JW3Y-BZhrc1TD.js} +1 -1
  31. package/dist/assets/{calendar-CSJ0kfzv.js → calendar-BsdHFQpJ.js} +1 -1
  32. package/dist/assets/channel-QzpfDah2.js +1 -0
  33. package/dist/assets/{chunk-2GRJ4B5K-BY-ZzQVT.js → chunk-2GRJ4B5K-DWUzVQVf.js} +1 -1
  34. package/dist/assets/{chunk-4I5QYGJK-DM5_T8-j.js → chunk-4I5QYGJK-BMWuquhN.js} +1 -1
  35. package/dist/assets/{chunk-5RXB4S5H-BtY6Azfu.js → chunk-5RXB4S5H-DimFTkPx.js} +1 -1
  36. package/dist/assets/{chunk-6Q2QTUOP-B379eNzG.js → chunk-6Q2QTUOP-CPnu3Qfm.js} +1 -1
  37. package/dist/assets/{chunk-7Z6QIM7H-kSLYYRVb.js → chunk-7Z6QIM7H-CRncG8-S.js} +1 -1
  38. package/dist/assets/{chunk-EIO257PC-a766giU7.js → chunk-EIO257PC-KxAmfKLz.js} +1 -1
  39. package/dist/assets/{chunk-GF5L2VYU-DLdS-mKH.js → chunk-GF5L2VYU-CVx-5Dyo.js} +1 -1
  40. package/dist/assets/{chunk-I66GZJ75-CgT_fz4y.js → chunk-I66GZJ75-GDwlN0uX.js} +1 -1
  41. package/dist/assets/{chunk-JQJVKLGR-CwEYJVm6.js → chunk-JQJVKLGR-CpWVGT75.js} +1 -1
  42. package/dist/assets/{chunk-KBJHAD2P-BLX0BdA-.js → chunk-KBJHAD2P-DSeu4Znq.js} +1 -1
  43. package/dist/assets/{chunk-NSK5VX7P-DKODrRGZ.js → chunk-NSK5VX7P-DJtgxhQU.js} +1 -1
  44. package/dist/assets/{chunk-QR6OTTB3-CAhn2ZdJ.js → chunk-QR6OTTB3-D6atPHvD.js} +1 -1
  45. package/dist/assets/{chunk-UBXNYLIW-D6QbmKvf.js → chunk-UBXNYLIW-ChjyDnhv.js} +1 -1
  46. package/dist/assets/{chunk-W5SLKNZC-BQwPOO_u.js → chunk-W5SLKNZC-CHdyvhj0.js} +1 -1
  47. package/dist/assets/{chunk-WRU74C26-CTGb-Pv5.js → chunk-WRU74C26-T2Hlyfog.js} +1 -1
  48. package/dist/assets/classDiagram-JCYQIIEL-D0WIXGjv.js +1 -0
  49. package/dist/assets/classDiagram-v2-OCEON4UE-D0WIXGjv.js +1 -0
  50. package/dist/assets/{cs-CZ-2BRQDIVT-CogtCaXP.js → cs-CZ-2BRQDIVT-DuNOH3FE.js} +1 -1
  51. package/dist/assets/{cynefinDiagram-MW4NZA55-DVtyFCKO.js → cynefinDiagram-MW4NZA55-CG_zH5XI.js} +1 -1
  52. package/dist/assets/{da-DK-5WZEPLOC-DQLs-46W.js → da-DK-5WZEPLOC-Dv5Jw2EM.js} +1 -1
  53. package/dist/assets/{dagre-VZM6K2ZE-BIFOnVcL.js → dagre-VZM6K2ZE-Df2Rg9Ws.js} +1 -1
  54. package/dist/assets/{de-DE-XR44H4JA-pHRpsJi6.js → de-DE-XR44H4JA-BU7xgUBU.js} +1 -1
  55. package/dist/assets/{diagram-7IWD3JNH-BR9dRm3U.js → diagram-7IWD3JNH-BYQnFAWp.js} +1 -1
  56. package/dist/assets/{diagram-B4RE2ZJO-CjxPSOmE.js → diagram-B4RE2ZJO-VIen7alL.js} +1 -1
  57. package/dist/assets/{diagram-LBJQPF4R-Dmh0qJ7J.js → diagram-LBJQPF4R-BKYXJw_5.js} +1 -1
  58. package/dist/assets/{diagram-Q27KOJAE-D3et1RGZ.js → diagram-Q27KOJAE-EHL58L0O.js} +1 -1
  59. package/dist/assets/{diagram-UB23O5K3-B15C06jN.js → diagram-UB23O5K3-Dd4mIdWy.js} +1 -1
  60. package/dist/assets/{dist-BREvphdv.js → dist-ClJuGoIG.js} +4 -4
  61. package/dist/assets/{ebnfDiagram-BXEA7PRR-Dv99LKgV.js → ebnfDiagram-BXEA7PRR-C9eAmdRR.js} +1 -1
  62. package/dist/assets/{el-GR-BZB4AONW-DZNMVxxk.js → el-GR-BZB4AONW-CR-sTbft.js} +1 -1
  63. package/dist/assets/{en-B4ZKOASM-CMd7rWnx.js → en-B4ZKOASM-DpNjNsLk.js} +1 -1
  64. package/dist/assets/{erDiagram-JOGREHBK-CuaEMlaV.js → erDiagram-JOGREHBK-BpMWOXMl.js} +1 -1
  65. package/dist/assets/{erd-edge-style-C_Ktt10j.js → erd-edge-style-DqdBCPB9.js} +1 -1
  66. package/dist/assets/{es-ES-U4NZUMDT-BAmZUry5.js → es-ES-U4NZUMDT-CgzjDVP5.js} +1 -1
  67. package/dist/assets/{eu-ES-A7QVB2H4-D_495kzy.js → eu-ES-A7QVB2H4-ChHJNK_D.js} +1 -1
  68. package/dist/assets/{fa-IR-HGAKTJCU-DF7L_VWO.js → fa-IR-HGAKTJCU-BLqu2r6a.js} +1 -1
  69. package/dist/assets/{fi-FI-Z5N7JZ37-C49uNvWC.js → fi-FI-Z5N7JZ37-DvDOaS00.js} +1 -1
  70. package/dist/assets/flowDiagram-UKHOOZJN-YLHJDJsv.js +1 -0
  71. package/dist/assets/{fr-FR-RHASNOE6-Dfiy45Ws.js → fr-FR-RHASNOE6-Du5-zVJb.js} +1 -1
  72. package/dist/assets/{ganttDiagram-PKOTCBZU-BR6JrukT.js → ganttDiagram-PKOTCBZU-CaFRjqFl.js} +1 -1
  73. package/dist/assets/{gitGraphDiagram-DS77QQ5N-BRfyukT9.js → gitGraphDiagram-DS77QQ5N-C5n7WALX.js} +1 -1
  74. package/dist/assets/{gl-ES-HMX3MZ6V-Ojkg_PHq.js → gl-ES-HMX3MZ6V-56RYyf6W.js} +1 -1
  75. package/dist/assets/{he-IL-6SHJWFNN-aVXHmgSA.js → he-IL-6SHJWFNN-Xl1e6z7y.js} +1 -1
  76. package/dist/assets/{hi-IN-IWLTKZ5I-C6I-dcrt.js → hi-IN-IWLTKZ5I-JMy_e-10.js} +1 -1
  77. package/dist/assets/{hu-HU-A5ZG7DT2-V2Ijxsye.js → hu-HU-A5ZG7DT2-CfOpi88E.js} +1 -1
  78. package/dist/assets/{id-ID-SAP4L64H-aI57QXA0.js → id-ID-SAP4L64H-Cd-pfOeK.js} +1 -1
  79. package/dist/assets/image-GAAHSSAO-DIvyGjfz.js +1 -0
  80. package/dist/assets/{index-DCMwd7x8.js → index-CgOQgp37.js} +4 -4
  81. package/dist/assets/{infoDiagram-6WML65LV-CQx05-h3.js → infoDiagram-6WML65LV-B1baCpVr.js} +1 -1
  82. package/dist/assets/{ishikawaDiagram-WSZJBQD7-Bi71C7u2.js → ishikawaDiagram-WSZJBQD7-CCOy3ZIL.js} +1 -1
  83. package/dist/assets/{it-IT-JPQ66NNP-BwcMVI2s.js → it-IT-JPQ66NNP-CHFEAJo7.js} +1 -1
  84. package/dist/assets/{ja-JP-DBVTYXUO-DcCo1QuT.js → ja-JP-DBVTYXUO-D_3azNN7.js} +1 -1
  85. package/dist/assets/{journeyDiagram-NVQOT4AX-Dj_wQbo_.js → journeyDiagram-NVQOT4AX-AN4JsOME.js} +1 -1
  86. package/dist/assets/{kaa-6HZHGXH3-CgG3AqRg.js → kaa-6HZHGXH3-C8qzNS97.js} +1 -1
  87. package/dist/assets/{kab-KAB-ZGHBKWFO-IIJYLJDT.js → kab-KAB-ZGHBKWFO-C3Tf46CK.js} +1 -1
  88. package/dist/assets/{kanban-definition-27J2QSJJ-CvEHsfKv.js → kanban-definition-27J2QSJJ-BlT_Wf6O.js} +1 -1
  89. package/dist/assets/{kk-KZ-P5N5QNE5-14XbGfBK.js → kk-KZ-P5N5QNE5-ETGukPy2.js} +1 -1
  90. package/dist/assets/{km-KH-HSX4SM5Z-DvtktkbQ.js → km-KH-HSX4SM5Z-LGz-OV5q.js} +1 -1
  91. package/dist/assets/{ko-KR-MTYHY66A-E0g_sU-b.js → ko-KR-MTYHY66A-DS8BwpRQ.js} +1 -1
  92. package/dist/assets/{ku-TR-6OUDTVRD-DRdCmygu.js → ku-TR-6OUDTVRD-C3E67aqL.js} +1 -1
  93. package/dist/assets/{line-C4Nqd6-4.js → line-CiD203Xt.js} +1 -1
  94. package/dist/assets/{lt-LT-XHIRWOB4-CvEuKPj1.js → lt-LT-XHIRWOB4-CYgDEsnY.js} +1 -1
  95. package/dist/assets/{lv-LV-5QDEKY6T-B_UNkmzH.js → lv-LV-5QDEKY6T-f3T1ppxX.js} +1 -1
  96. package/dist/assets/{mindmap-definition-FAOFIHXS-DqaqBE7a.js → mindmap-definition-FAOFIHXS-CCd9Yqtz.js} +1 -1
  97. package/dist/assets/{mr-IN-CRQNXWMA-B5g-WyR8.js → mr-IN-CRQNXWMA-auGuO8l8.js} +1 -1
  98. package/dist/assets/{my-MM-5M5IBNSE-DTBX3Slo.js → my-MM-5M5IBNSE-DVwp1kei.js} +1 -1
  99. package/dist/assets/{nb-NO-T6EIAALU-B1I8zsJL.js → nb-NO-T6EIAALU-BbJ2EdCE.js} +1 -1
  100. package/dist/assets/{nl-NL-IS3SIHDZ-AtjUEgA1.js → nl-NL-IS3SIHDZ-pX0JpGsz.js} +1 -1
  101. package/dist/assets/{nn-NO-6E72VCQL-DY0bgWam.js → nn-NO-6E72VCQL-mTDQaZwa.js} +1 -1
  102. package/dist/assets/{note-importer-D-BIiDQE.js → note-importer-IEAF9Pc4.js} +2 -2
  103. package/dist/assets/{oc-FR-POXYY2M6-Cp3hSw7Y.js → oc-FR-POXYY2M6-CC8a8H01.js} +1 -1
  104. package/dist/assets/{pa-IN-N4M65BXN-BQDzCIRl.js → pa-IN-N4M65BXN-DdoK_NJY.js} +1 -1
  105. package/dist/assets/{pegDiagram-VL7TDLO6-PH0kaWC9.js → pegDiagram-VL7TDLO6-B7CQw9dH.js} +1 -1
  106. package/dist/assets/percentages-BXMCSKIN-CgRH_p-N.js +1 -0
  107. package/dist/assets/{pieDiagram-7S7Q4E2Y-CM8dxNWJ.js → pieDiagram-7S7Q4E2Y-g7yqyP3Y.js} +1 -1
  108. package/dist/assets/{pl-PL-T2D74RX3-DZPM8Kqk.js → pl-PL-T2D74RX3-DwAu_uuu.js} +1 -1
  109. package/dist/assets/{pt-BR-5N22H2LF-BkVzBjsT.js → pt-BR-5N22H2LF-DlG-XcWH.js} +1 -1
  110. package/dist/assets/{pt-PT-UZXXM6DQ-Kzh9i5gU.js → pt-PT-UZXXM6DQ-55WFwel1.js} +1 -1
  111. package/dist/assets/{quadrantDiagram-CIZ2JOQS-DeqLWBSS.js → quadrantDiagram-CIZ2JOQS-zAkqidgD.js} +1 -1
  112. package/dist/assets/{railroadDiagram-AXF67PYL-DR96F6O_.js → railroadDiagram-AXF67PYL-ByHiklGf.js} +1 -1
  113. package/dist/assets/{requirementDiagram-LRYGKXZP-D0p5haDz.js → requirementDiagram-LRYGKXZP-D6gZT7Vb.js} +1 -1
  114. package/dist/assets/{ro-RO-JPDTUUEW-RRCMID5j.js → ro-RO-JPDTUUEW-DuPrrrnU.js} +1 -1
  115. package/dist/assets/{ru-RU-B4JR7IUQ-C5VwX7PA.js → ru-RU-B4JR7IUQ-CiwwVdOo.js} +1 -1
  116. package/dist/assets/{sankeyDiagram-W5VNT64P-JgRMoeDt.js → sankeyDiagram-W5VNT64P-rvg1zfTe.js} +1 -1
  117. package/dist/assets/{sequenceDiagram-SI44F4Z6-DYfkHfM2.js → sequenceDiagram-SI44F4Z6-2vOh8fKU.js} +1 -1
  118. package/dist/assets/{si-LK-N5RQ5JYF-DxhEXPHN.js → si-LK-N5RQ5JYF-M2YugRbc.js} +1 -1
  119. package/dist/assets/{sk-SK-C5VTKIMK-BXyhcjsY.js → sk-SK-C5VTKIMK-B2QKPd1E.js} +1 -1
  120. package/dist/assets/{sl-SI-NN7IZMDC-BOzcBsgH.js → sl-SI-NN7IZMDC-BHm7-_cE.js} +1 -1
  121. package/dist/assets/{stateDiagram-OKZ733FA-M4omEZLi.js → stateDiagram-OKZ733FA-nGvrAXPO.js} +1 -1
  122. package/dist/assets/stateDiagram-v2-UEYNNEHI-Wb3qtKxf.js +1 -0
  123. package/dist/assets/subset-shared.chunk-CCbd1hn1.js +1 -0
  124. package/dist/assets/{subset-worker.chunk-BgvN4hBu.js → subset-worker.chunk-6YE_iHIU.js} +1 -1
  125. package/dist/assets/{sv-SE-XGPEYMSR-sZ5rly11.js → sv-SE-XGPEYMSR-C4edLJg3.js} +1 -1
  126. package/dist/assets/{swimlanes-SLNWSIFB-CmAnHrUm.js → swimlanes-SLNWSIFB-DGTGjdFY.js} +1 -1
  127. package/dist/assets/swimlanesDiagram-ULZ7WXOC-BzUGNxsx.js +8 -0
  128. package/dist/assets/{ta-IN-2NMHFXQM-DCQux1_U.js → ta-IN-2NMHFXQM-CayaO3yG.js} +1 -1
  129. package/dist/assets/{th-TH-HPSO5L25-DdyNi14O.js → th-TH-HPSO5L25-Cnnd72kA.js} +1 -1
  130. package/dist/assets/{timeline-definition-Z64GVDOM-K_v5mAZD.js → timeline-definition-Z64GVDOM-D9ZtZnOx.js} +1 -1
  131. package/dist/assets/{tr-TR-DEFEU3FU-DXbjzYFH.js → tr-TR-DEFEU3FU-CrnwAqdO.js} +1 -1
  132. package/dist/assets/{uk-UA-QMV73CPH-VUycwkKm.js → uk-UA-QMV73CPH-DC-WhQXV.js} +1 -1
  133. package/dist/assets/{vennDiagram-T6HMQDX7-B9WlEbd3.js → vennDiagram-T6HMQDX7-DRtB1j9c.js} +1 -1
  134. package/dist/assets/{vi-VN-M7AON7JQ-CraKtmCg.js → vi-VN-M7AON7JQ-BMPPxwJw.js} +1 -1
  135. package/dist/assets/{wardleyDiagram-T6FBY63Y-CEYOgfru.js → wardleyDiagram-T6FBY63Y-CtQbLiW-.js} +1 -1
  136. package/dist/assets/{xychartDiagram-ELKLHX3M-7uPk_GZE.js → xychartDiagram-ELKLHX3M-BD5TyYO3.js} +1 -1
  137. package/dist/assets/{zh-CN-LNUGB5OW-lQR0deYl.js → zh-CN-LNUGB5OW-BDvmDW48.js} +1 -1
  138. package/dist/assets/{zh-HK-E62DVLB3-Buzj7oBV.js → zh-HK-E62DVLB3-DqBxWnJI.js} +1 -1
  139. package/dist/assets/{zh-TW-RAJ6MFWO-DHN5QaMl.js → zh-TW-RAJ6MFWO-H592SoNs.js} +1 -1
  140. package/dist/index.html +3 -3
  141. package/dist-server/index.js +159 -159
  142. package/dist-server/mcp.js +74 -74
  143. package/package.json +1 -1
  144. package/dist/assets/channel-DDoiY3Qy.js +0 -1
  145. package/dist/assets/classDiagram-JCYQIIEL-o650ZObW.js +0 -1
  146. package/dist/assets/classDiagram-v2-OCEON4UE-o650ZObW.js +0 -1
  147. package/dist/assets/flowDiagram-UKHOOZJN-YPjGSXvd.js +0 -1
  148. package/dist/assets/image-GAAHSSAO-DDigG9x4.js +0 -1
  149. package/dist/assets/percentages-BXMCSKIN-Bvmf7A2F.js +0 -1
  150. package/dist/assets/stateDiagram-v2-UEYNNEHI-DJeq0yBK.js +0 -1
  151. package/dist/assets/subset-shared.chunk-YUlvemG7.js +0 -1
  152. package/dist/assets/swimlanesDiagram-ULZ7WXOC-DSStaDFa.js +0 -8
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./check-Uq0GkTkz.js";import{n as i}from"./api-D87lw-98.js";import{Ut as a}from"./index-DCMwd7x8.js";var o=e(t(),1),s=n(),c=(0,o.createContext)(null),l=e=>`${e.type}:${e.id}`;function u({config:e,children:t}){let[n,r]=(0,o.useState)(new Map),a=(0,o.useRef)(0),u=`/api/projects/`+encodeURIComponent(e.projectId)+`/comments`,d=`feature_type=`+e.featureType+`&file_id=`+encodeURIComponent(e.fileId),f=(0,o.useCallback)(async()=>{let e=++a.current;try{let t=await i(u+`/markers?`+d),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||`Could not load comment markers.`);let o=new Map;for(let e of n.markers||[]){let t={anchorType:e.anchorType??e.anchor_type,anchorId:String(e.anchorId??e.anchor_id),status:e.status===`resolved`?`resolved`:`open`,unreadCount:Number(e.unreadCount??e.unread_count??0)};o.set(l({type:t.anchorType,id:t.anchorId}),t)}e===a.current&&r(o)}catch{}},[u,d]);(0,o.useEffect)(()=>{r(new Map),f();let t=t=>{t.teamId&&t.teamId!==e.teamId||t.projectId&&String(t.projectId)!==e.projectId||f()},n=e=>t(e.detail||{}),i=e=>{let n=e.detail;n?.eventType===`cloud.workspace.sync`&&t(n)},o=e=>t(e.detail||{}),s=window.setInterval(()=>{document.visibilityState===`visible`&&f()},15e3);return window.addEventListener(`collaboration-updated`,n),window.addEventListener(`cloud-workspace-sync`,i),window.addEventListener(`cloud-live-sync-reconnected`,o),()=>{a.current++,window.clearInterval(s),window.removeEventListener(`collaboration-updated`,n),window.removeEventListener(`cloud-workspace-sync`,i),window.removeEventListener(`cloud-live-sync-reconnected`,o)}},[e,f]);let p=(0,o.useMemo)(()=>({config:e,markers:n}),[e,n]);return(0,s.jsx)(c.Provider,{value:p,children:t})}function d(){return(0,o.useContext)(c)}function f({anchor:e}){let t=d(),n=t?.markers.get(l(e));if(!t||!n)return null;let i=e.type===`shape`?`Flowchart shape`:`Drawing element`,o=n.status===`resolved`?`, resolved`:n.unreadCount?`, `+n.unreadCount+` unread`:``,c=n.status===`resolved`?`bg-foreground text-background`:`bg-sky-500 text-white dark:bg-sky-400 dark:text-slate-950`;return(0,s.jsx)(`button`,{type:`button`,className:`flex size-11 shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-sky-500`,"aria-label":i+` comments`+o,title:i+` comments`+o,onPointerDown:e=>e.stopPropagation(),onClick:n=>{n.stopPropagation(),window.dispatchEvent(new CustomEvent(`project-comment-open-request`,{detail:{featureType:t.config.featureType,fileId:t.config.fileId,type:e.type,id:e.id}}))},children:(0,s.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full px-1 text-[9px] font-bold leading-none shadow-sm `+c,children:n.status===`resolved`?(0,s.jsx)(r,{"aria-hidden":`true`,className:`size-2.5 stroke-[3]`}):n.unreadCount>0?n.unreadCount>3?`3+`:n.unreadCount:(0,s.jsx)(a,{"aria-hidden":`true`,className:`size-3`})})})}export{u as n,d as r,f as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./check-Uq0GkTkz.js";import{n as i}from"./api-D87lw-98.js";import{Ut as a}from"./index-CgOQgp37.js";var o=e(t(),1),s=n(),c=(0,o.createContext)(null),l=e=>`${e.type}:${e.id}`;function u({config:e,children:t}){let[n,r]=(0,o.useState)(new Map),a=(0,o.useRef)(0),u=`/api/projects/`+encodeURIComponent(e.projectId)+`/comments`,d=`feature_type=`+e.featureType+`&file_id=`+encodeURIComponent(e.fileId),f=(0,o.useCallback)(async()=>{let e=++a.current;try{let t=await i(u+`/markers?`+d),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||`Could not load comment markers.`);let o=new Map;for(let e of n.markers||[]){let t={anchorType:e.anchorType??e.anchor_type,anchorId:String(e.anchorId??e.anchor_id),status:e.status===`resolved`?`resolved`:`open`,unreadCount:Number(e.unreadCount??e.unread_count??0)};o.set(l({type:t.anchorType,id:t.anchorId}),t)}e===a.current&&r(o)}catch{}},[u,d]);(0,o.useEffect)(()=>{r(new Map),f();let t=t=>{t.teamId&&t.teamId!==e.teamId||t.projectId&&String(t.projectId)!==e.projectId||f()},n=e=>t(e.detail||{}),i=e=>{let n=e.detail;n?.eventType===`cloud.workspace.sync`&&t(n)},o=e=>t(e.detail||{}),s=window.setInterval(()=>{document.visibilityState===`visible`&&f()},15e3);return window.addEventListener(`collaboration-updated`,n),window.addEventListener(`cloud-workspace-sync`,i),window.addEventListener(`cloud-live-sync-reconnected`,o),()=>{a.current++,window.clearInterval(s),window.removeEventListener(`collaboration-updated`,n),window.removeEventListener(`cloud-workspace-sync`,i),window.removeEventListener(`cloud-live-sync-reconnected`,o)}},[e,f]);let p=(0,o.useMemo)(()=>({config:e,markers:n}),[e,n]);return(0,s.jsx)(c.Provider,{value:p,children:t})}function d(){return(0,o.useContext)(c)}function f({anchor:e}){let t=d(),n=t?.markers.get(l(e));if(!t||!n)return null;let i=e.type===`shape`?`Flowchart shape`:`Drawing element`,o=n.status===`resolved`?`, resolved`:n.unreadCount?`, `+n.unreadCount+` unread`:``,c=n.status===`resolved`?`bg-foreground text-background`:`bg-sky-500 text-white dark:bg-sky-400 dark:text-slate-950`;return(0,s.jsx)(`button`,{type:`button`,className:`flex size-11 shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-sky-500`,"aria-label":i+` comments`+o,title:i+` comments`+o,onPointerDown:e=>e.stopPropagation(),onClick:n=>{n.stopPropagation(),window.dispatchEvent(new CustomEvent(`project-comment-open-request`,{detail:{featureType:t.config.featureType,fileId:t.config.fileId,type:e.type,id:e.id}}))},children:(0,s.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full px-1 text-[9px] font-bold leading-none shadow-sm `+c,children:n.status===`resolved`?(0,s.jsx)(r,{"aria-hidden":`true`,className:`size-2.5 stroke-[3]`}):n.unreadCount>0?n.unreadCount>3?`3+`:n.unreadCount:(0,s.jsx)(a,{"aria-hidden":`true`,className:`size-3`})})})}export{u as n,d as r,f as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{l as r,u as i}from"./chunk-BV7QT456-CCzugQp2.js";import"./WorkspaceProvider-EYbBHADd.js";import{n as a}from"./WorkspaceContext-O7njKDwj.js";import{mn as o}from"./index-DCMwd7x8.js";import{n as s}from"./FileCommentMarkers-Do8KNBq5.js";import{FlowchartView as c}from"./FlowchartView-KKIj1Hq-.js";import{t as l}from"./ProjectFileTabs-DZWlg8g5.js";var u=e(t(),1),d=n();function f(){let e=a(),t=r(),{id:n}=i(),{activeFlowchart:f,activeFlowchartId:p,handleFlowchartChange:m,isPublicView:h,isLoading:g,isFlowchartItemLoading:_,handleFlowchartSelect:v,saveFlowchart:y,triggerDebouncedSync:b}=e,x=f?.project_id??f?.projectId,S=f?.uid??p,C=e.projects.find(e=>String(e.id)===String(x)),w=C?.team_id??C?.teamId,T=!!(!h&&!e.isGuest&&w&&t.activeTeamId&&String(w)===String(t.activeTeamId)),E=(0,u.useMemo)(()=>T&&x!=null&&w&&e.user?.id&&S!=null?{projectId:String(x),teamId:String(w),fileId:String(S),featureType:`flowchart`}:null,[T,e.user?.id,S,x,w]),D=(0,u.useRef)(!1);if((0,u.useEffect)(()=>{if(!(h||!n)&&!D.current){if(String(p)===n){D.current=!0;return}p||(D.current=!0,v(n))}},[n,p,h,v]),!h&&!p)return n&&!D.current?(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]}):(0,d.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a flowchart to view`})});if(!f&&!_)return(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(o,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Flowchart not found`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This flowchart may have been deleted or is no longer available.`})]});if(!f)return(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]});let O=(0,d.jsx)(c,{isLoading:_,activeFlowchartId:p,activeFlowchart:f,handleFlowchartChange:m,isReadOnly:h,commentsEnabled:T,saveFlowchart:y,triggerDebouncedSync:b});return(0,d.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,d.jsx)(l,{currentView:`flowchart`}),E?(0,d.jsx)(s,{config:E,children:O},[E.projectId,E.teamId,E.featureType,E.fileId].join(`:`)):O]})}export{f as FlowchartEditorRoute};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{l as r,u as i}from"./chunk-BV7QT456-CCzugQp2.js";import"./WorkspaceProvider-CGqNGa8d.js";import{n as a}from"./WorkspaceContext-O7njKDwj.js";import{mn as o}from"./index-CgOQgp37.js";import{n as s}from"./FileCommentMarkers-BQZxgTaW.js";import{FlowchartView as c}from"./FlowchartView-CM1oQZqa.js";import{t as l}from"./ProjectFileTabs-BRybZZLH.js";var u=e(t(),1),d=n();function f(){let e=a(),t=r(),{id:n}=i(),{activeFlowchart:f,activeFlowchartId:p,handleFlowchartChange:m,isPublicView:h,isLoading:g,isFlowchartItemLoading:_,handleFlowchartSelect:v,saveFlowchart:y,triggerDebouncedSync:b}=e,x=f?.project_id??f?.projectId,S=f?.uid??p,C=e.projects.find(e=>String(e.id)===String(x)),w=C?.team_id??C?.teamId,T=!!(!h&&!e.isGuest&&w&&t.activeTeamId&&String(w)===String(t.activeTeamId)),E=(0,u.useMemo)(()=>T&&x!=null&&w&&e.user?.id&&S!=null?{projectId:String(x),teamId:String(w),fileId:String(S),featureType:`flowchart`}:null,[T,e.user?.id,S,x,w]),D=(0,u.useRef)(!1);if((0,u.useEffect)(()=>{if(!(h||!n)&&!D.current){if(String(p)===n){D.current=!0;return}p||(D.current=!0,v(n))}},[n,p,h,v]),!h&&!p)return n&&!D.current?(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]}):(0,d.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a flowchart to view`})});if(!f&&!_)return(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(o,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Flowchart not found`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This flowchart may have been deleted or is no longer available.`})]});if(!f)return(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]});let O=(0,d.jsx)(c,{isLoading:_,activeFlowchartId:p,activeFlowchart:f,handleFlowchartChange:m,isReadOnly:h,commentsEnabled:T,saveFlowchart:y,triggerDebouncedSync:b});return(0,d.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,d.jsx)(l,{currentView:`flowchart`}),E?(0,d.jsx)(s,{config:E,children:O},[E.projectId,E.teamId,E.featureType,E.fileId].join(`:`)):O]})}export{f as FlowchartEditorRoute};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{a as r,c as i,h as a,i as o,l as s,m as c,n as l,p as u,r as d,s as f,t as p}from"./downloadSVG-DnlyCOTN.js";import{a as m,h as ee,r as te}from"./esm-B1WURL1q.js";import{n as h}from"./dist-Di9gTGEC.js";import{a as g,c as ne,d as _,i as v,l as y,n as b,o as x,s as S,t as C}from"./dialog-DdtHj1_i.js";import{t as w}from"./button-BGyQguBL.js";import{i as T,n as E,o as D,s as O,t as k}from"./select-iuD-eAM0.js";import{t as A}from"./check-Uq0GkTkz.js";import{S as j,a as M,b as re,n as N,r as ie,u as ae}from"./scroll-area-DJulbnDp.js";import{n as oe,t as se}from"./move-BzTcfKj2.js";import{n as ce,r as le,t as ue}from"./undo-2-BrIFXDrK.js";import{t as de}from"./plus-DfXp3YpY.js";import{t as fe}from"./trash-2-BmZK7fDJ.js";import{t as pe}from"./card-XtyXpgaS.js";import{t as P}from"./input-QHOTkdNi.js";import{n as me}from"./WorkspaceContext-O7njKDwj.js";import{t as F}from"./label-B06IPhlq.js";import{A as he,C as ge,D as _e,E as ve,M as I,N as ye,P as be,Qt as xe,T as Se,Ut as Ce,j as L,k as we,mn as Te,w as Ee}from"./index-DCMwd7x8.js";import{t as De}from"./FileCommentMarkers-Do8KNBq5.js";/* empty css */import{t as Oe}from"./JumpToNode-YENX0D1W.js";var R=e(t(),1),z=n(),ke=(0,R.memo)(({data:e,id:t,selected:n})=>{let[r,a]=(0,R.useState)(!1),o=`!w-1.5 !h-1.5 !bg-white !border-none opacity-0 group-hover:opacity-100 transition-opacity z-20 cursor-crosshair`,s=(0,R.useMemo)(()=>{switch(e.shape){case`diamond`:return`min-w-[130px] min-h-[130px] p-8`;case`circle`:return`min-w-[110px] min-h-[110px] p-4`;case`cloud`:return`min-w-[160px] max-w-[240px] min-h-[90px] px-10 py-6`;case`database`:return`min-w-[140px] max-w-[220px] min-h-[100px] px-6 pt-10 pb-6`;case`parallelogram`:return`min-w-[160px] max-w-[240px] min-h-[80px] px-12 py-4`;case`oval`:return`min-w-[140px] max-w-[240px] min-h-[80px] px-10 py-4`;case`document`:return`min-w-[140px] max-w-[220px] min-h-[90px] px-8 pt-4 pb-10`;default:return`min-w-[140px] max-w-[240px] min-h-[80px] px-8 py-4`}},[e.shape]),c=(0,R.useMemo)(()=>{switch(e.shape){case`diamond`:return{width:100,height:100};case`circle`:return{width:80,height:80};default:return{width:100,height:60}}},[e.shape]),l=(0,R.useMemo)(()=>{let t={background:`linear-gradient(135deg, ${e.color}40 0%, ${e.color}10 100%)`,borderColor:e.color,borderWidth:`2px`,borderStyle:`solid`,boxShadow:`none`,transition:`all 0.3s cubic-bezier(0.4, 0, 0.2, 1)`},n=`${e.color}20`,r=e.color,i={filter:`none`,transition:`all 0.3s`};switch(e.shape){case`diamond`:return(0,z.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,z.jsx)(`path`,{d:`M50,2 L98,50 L50,98 L2,50 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i})});case`parallelogram`:return(0,z.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,z.jsx)(`path`,{d:`M20,2 L98,2 L80,98 L2,98 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i})});case`oval`:return(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-[50px] pointer-events-none`,style:t});case`circle`:return(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-full pointer-events-none flex items-center justify-center`,style:{...t,background:`radial-gradient(circle at 30% 30%, ${e.color}40 0%, ${e.color}10 100%)`}});case`database`:return(0,z.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,z.jsx)(`path`,{d:`M2,15 L2,85 C2,95 98,95 98,85 L98,15`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i}),(0,z.jsx)(`path`,{d:`M2,15 C2,5 98,5 98,15 C98,25 2,25 2,15 Z`,fill:`${e.color}35`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),(0,z.jsx)(`path`,{d:`M2,50 C2,60 98,60 98,50`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,opacity:`0.3`})]});case`document`:return(0,z.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,z.jsx)(`path`,{d:`M2,2 L70,2 L98,30 L98,85 C98,93 90,98 85,98 L15,98 C7,98 2,93 2,85 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i}),(0,z.jsx)(`path`,{d:`M70,2 V30 H98`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`})]});case`cloud`:return(0,z.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,z.jsx)(`path`,{d:`M20,80 C5,80 5,60 15,50 C10,20 40,15 55,25 C65,5 95,10 95,40 C105,50 105,80 80,80 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,style:i})});default:return(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-md pointer-events-none`,style:t})}},[e.color,e.shape,n]),u=(0,z.jsxs)(`div`,{className:`relative group flex items-center justify-center cursor-pointer transition-all duration-300 hover:scale-[1.02] ${s}`,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{aspectRatio:e.shape===`circle`?`1 / 1`:`auto`},children:[(0,z.jsx)(i,{isVisible:n||r,keepAspectRatio:e.shape===`circle`,minWidth:c.width,minHeight:c.height,handleStyle:{width:8,height:8,borderRadius:0,backgroundColor:`#0f0f14`,border:`1.5px solid ${e.color}`,zIndex:50},lineStyle:{border:`1px dashed ${e.color}80`}}),l,e._commentsEnabled&&(0,z.jsx)(`div`,{className:`absolute -right-2 -top-2 z-30`,children:(0,z.jsx)(De,{anchor:{type:`shape`,id:t}})}),(0,z.jsx)(f,{id:`top`,type:`target`,position:m.Top,className:o}),(0,z.jsx)(f,{id:`top`,type:`source`,position:m.Top,className:o}),(0,z.jsx)(f,{id:`bottom`,type:`target`,position:m.Bottom,className:o}),(0,z.jsx)(f,{id:`bottom`,type:`source`,position:m.Bottom,className:o}),(0,z.jsx)(f,{id:`right`,type:`target`,position:m.Right,className:o}),(0,z.jsx)(f,{id:`right`,type:`source`,position:m.Right,className:o}),(0,z.jsx)(f,{id:`left`,type:`target`,position:m.Left,className:o}),(0,z.jsx)(f,{id:`left`,type:`source`,position:m.Left,className:o}),(0,z.jsx)(`div`,{className:`relative z-10 text-center text-sm font-semibold text-foreground wrap-break-word whitespace-pre-wrap max-w-full flex-1`,children:e.label}),e.section&&(0,z.jsx)(`div`,{className:`absolute -top-7 left-1/2 -translate-x-1/2 z-20 whitespace-nowrap text-[9px] font-medium text-muted-foreground/60 tracking-wider uppercase px-2 py-0.5 rounded-full bg-background/50 backdrop-blur-sm border border-border/30`,children:e.section})]});return e._commentsEnabled?(0,z.jsxs)(N,{children:[(0,z.jsx)(ae,{className:`contents`,children:u}),(0,z.jsx)(ie,{className:`min-w-36`,positionerClassName:`z-[210]`,children:(0,z.jsxs)(M,{onClick:()=>window.dispatchEvent(new CustomEvent(`project-comment-open-request`,{detail:{featureType:`flowchart`,type:`shape`,id:t}})),children:[(0,z.jsx)(Ce,{"aria-hidden":`true`}),`Comment`]})})]}):u}),Ae=e=>e.trim().toLowerCase().includes(`start`);function je({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=Ae(n.label);return(0,z.jsx)(C,{open:e,onOpenChange:t,children:(0,z.jsxs)(v,{className:`sm:max-w-sm`,children:[(0,z.jsxs)(S,{children:[(0,z.jsx)(y,{children:`Create New Symbol`}),(0,z.jsx)(g,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,z.jsxs)(b,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(P,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(P,{value:n.section||``,onChange:e=>r({...n,section:e.target.value||void 0}),placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(k,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select a shape`,children:n.shape?I[n.shape]:`Select a shape`})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`rectangle`,children:`Rectangle (Process)`}),(0,z.jsx)(T,{value:`oval`,children:`Oval (Start/End)`}),(0,z.jsx)(T,{value:`diamond`,children:`Diamond (Decision)`}),(0,z.jsx)(T,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,z.jsx)(T,{value:`database`,children:`Cylinder (Database)`}),(0,z.jsx)(T,{value:`document`,children:`Document`}),(0,z.jsx)(T,{value:`cloud`,children:`Cloud (External System)`}),(0,z.jsx)(T,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.color===e?`border-white scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({...n,color:e})},e))})]})]}),(0,z.jsxs)(x,{children:[(0,z.jsx)(w,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,z.jsx)(w,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function B(e){return e.data.label.trim().toLowerCase().includes(`start`)}function Me({selectedNodeId:e,onClose:t,selectedNode:n,onUpdateNodeData:r,onDeleteNode:i,onDeleteGroup:a,onValidateSection:o}){let s=n?B(n):!1,[c,l]=(0,R.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),u=e=>{l(e),r({code:e})};return(0,z.jsx)(C,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(v,{className:`sm:max-w-sm`,children:[(0,z.jsxs)(S,{children:[(0,z.jsx)(y,{children:`Symbol Properties`}),(0,z.jsx)(g,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,z.jsxs)(b,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(P,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>u(e.target.value),placeholder:n.data.shape===`diamond`?`e.g. return context.amount > 100 ? 'Yes' : 'No';`:`e.g. context.status = 'Approved'; context.tries += 1;`,className:`w-full h-24 bg-muted border border-border rounded-md p-2 text-xs font-mono text-foreground placeholder:text-muted-foreground/50 resize-none focus:outline-none focus:border-ring`}),(0,z.jsxs)(`p`,{className:`text-[9px] text-muted-foreground/50 leading-normal`,children:[`Attached sandbox logic. For Decision diamonds, return the matching branch label (case-sensitive). Process symbols can mutate variables in the `,(0,z.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(P,{value:n.data.section||``,onChange:e=>r({section:e.target.value||void 0}),onBlur:e=>{let t=e.target.value;t&&o&&!o(t)&&r({section:void 0})},placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted/50 border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(k,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select a shape`,children:n.data.shape?I[n.data.shape]:`Select a shape`})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`rectangle`,children:`Rectangle (Process)`}),(0,z.jsx)(T,{value:`oval`,children:`Oval (Start/End)`}),(0,z.jsx)(T,{value:`diamond`,children:`Diamond (Decision)`}),(0,z.jsx)(T,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,z.jsx)(T,{value:`database`,children:`Cylinder (Database)`}),(0,z.jsx)(T,{value:`document`,children:`Document`}),(0,z.jsx)(T,{value:`cloud`,children:`Cloud (External System)`}),(0,z.jsx)(T,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.data.color===e?`border-white scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({color:e})},e))})]}),(0,z.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,z.jsxs)(w,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,z.jsx)(fe,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,z.jsxs)(w,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,z.jsx)(fe,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Ne({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:i,onEdgeTypeChange:a,onArrowChange:o,onLabelChange:s,onDeleteEdge:c}){return(0,z.jsx)(C,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(v,{className:`sm:max-w-sm`,children:[(0,z.jsx)(S,{children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,z.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,z.jsx)(y,{children:`Connector Properties`}),(0,z.jsx)(g,{children:`Format the line style and arrows.`})]}),(0,z.jsx)(w,{variant:`ghost`,size:`icon`,onClick:c,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,children:(0,z.jsx)(fe,{className:`w-4 h-4`})})]})}),n&&(0,z.jsxs)(b,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Text Label`}),(0,z.jsx)(P,{value:typeof n.label==`string`?n.label:``,onChange:e=>s(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Line Style`}),(0,z.jsxs)(k,{value:r?`dashed`:`solid`,onValueChange:e=>a(e||``),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select line style`,children:L[r?`dashed`:`solid`]})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`solid`,children:`Solid Line`}),(0,z.jsx)(T,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Arrow Style`}),(0,z.jsxs)(k,{value:i,onValueChange:e=>o(e||``),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select arrow style`,children:we[i]})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`end`,children:`Arrow at End`}),(0,z.jsx)(T,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,z.jsx)(T,{value:`both`,children:`Arrows Both Ends`}),(0,z.jsx)(T,{value:`none`,children:`No Arrows (Line only)`})]})]})]})]})]})})}function Pe({nodes:e,edges:t,onConfirm:n,onCancel:r,confirmLabel:i=`Confirm Append`,canvasGroups:a=[],existingNodes:o=[],existingEdges:s=[]}){let[c,l]=(0,R.useState)(null),u=(0,R.useMemo)(()=>{if(!o.length||!e.length)return null;let n=new Map;for(let e of o)n.set((e.data.label||``).toLowerCase(),e);let r=new Map;for(let t of e)r.set((t.data.label||``).toLowerCase(),t);let i=[];for(let t of e){let e=t.data.label||`Untitled`,r=n.get(e.toLowerCase());if(!r)i.push({type:`header`,label:e,isNew:!0}),i.push({type:`add`,prefix:`+`,field:`shape`,newVal:t.data.shape}),i.push({type:`add`,prefix:`+`,field:`label`,newVal:e}),t.data.color&&i.push({type:`add`,prefix:`+`,field:`color`,newVal:t.data.color});else{let n=r.data.shape!==t.data.shape,a=r.data.color!==t.data.color,o=(r.data.label||``)!==e;(n||a||o)&&(i.push({type:`header`,label:e}),o&&i.push({type:`change`,prefix:`~`,field:`label`,oldVal:r.data.label,newVal:e}),n&&i.push({type:`change`,prefix:`~`,field:`shape`,oldVal:r.data.shape,newVal:t.data.shape}),a&&i.push({type:`change`,prefix:`~`,field:`color`,oldVal:r.data.color,newVal:t.data.color}))}}for(let e of o){let t=e.data.label||``;r.has(t.toLowerCase())||(i.push({type:`header`,label:t,isNew:!1}),i.push({type:`remove`,prefix:`-`,field:`shape`,oldVal:e.data.shape}),i.push({type:`remove`,prefix:`-`,field:`removed`,oldVal:`entire node`}))}let a=new Set(s.map(e=>{let t=o.find(t=>t.id===e.source)?.data.label||e.source,n=o.find(t=>t.id===e.target)?.data.label||e.target;return`${t.toLowerCase()}→${n.toLowerCase()}`})),c=new Set(t.map(t=>{let n=e.find(e=>e.id===t.source)?.data.label||t.source,r=e.find(e=>e.id===t.target)?.data.label||t.target;return`${n.toLowerCase()}→${r.toLowerCase()}`})),l=[...c].filter(e=>!a.has(e)),u=[...a].filter(e=>!c.has(e));if(l.length>0||u.length>0){i.push({type:`header`,label:`Connections`});for(let e of l)i.push({type:`add`,prefix:`+`,field:`connection`,newVal:e});for(let e of u)i.push({type:`remove`,prefix:`-`,field:`connection`,oldVal:e})}return i.length>0?i:null},[o,s,e,t]);return(0,z.jsxs)(C,{open:!0,onOpenChange:e=>{e||r()},children:[(0,z.jsx)(ne,{}),(0,z.jsxs)(v,{size:`2xl`,showCloseButton:!0,children:[(0,z.jsx)(S,{children:(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`div`,{className:`size-8 rounded-lg bg-indigo-500/10 flex items-center justify-center`,children:(0,z.jsx)(Te,{className:`size-4 text-indigo-400`})}),(0,z.jsx)(`div`,{children:(0,z.jsx)(y,{children:`Preview Changes`})})]})}),(0,z.jsx)(b,{children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.length>0&&(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`New Symbols (`,e.length,`)`]}),(0,z.jsx)(`div`,{className:`max-h-75 overflow-y-auto custom-scrollbar space-y-2`,children:e.map(e=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-2 border-b border-border/20 bg-muted/50`,children:[(0,z.jsx)(Te,{className:`size-3 text-indigo-400 shrink-0`}),(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.data.label}),(0,z.jsx)(`span`,{className:`text-[9px] text-muted-foreground ml-auto`,children:e.data.shape})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono`,children:[(0,z.jsx)(`span`,{className:`text-gray-500`,children:`Shape:`}),(0,z.jsx)(`span`,{className:`text-gray-300`,children:e.data.shape}),e.data.color&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-gray-500 ml-2`,children:`Color:`}),(0,z.jsx)(`span`,{className:`text-gray-300`,children:e.data.color})]})]})]},e.id))})]}),u&&(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Changes`}),(0,z.jsx)(`div`,{className:`rounded-lg border border-border/40 overflow-hidden max-h-75 overflow-y-auto custom-scrollbar text-[10px] font-mono leading-relaxed`,children:(0,z.jsx)(`div`,{className:`divide-y divide-border/10`,children:u.map((e,t)=>{if(e.type===`header`)return(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border/30`,children:[e.isNew&&(0,z.jsx)(`span`,{className:`text-[8px] font-semibold px-1 py-0.5 rounded bg-emerald-500/15 text-emerald-400 border border-emerald-500/30 shrink-0`,children:`NEW`}),(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.label})]},t);let n=e.type===`add`,r=e.type===`remove`,i=e.type===`change`,a=n?`bg-emerald-900/20`:r?`bg-red-900/20`:i?`bg-amber-900/20`:``,o=n?`text-emerald-400`:r?`text-red-400`:`text-amber-400`,s=n?`text-emerald-300`:r?`text-red-400`:`text-amber-300`,c=n?`text-emerald-400/60`:r?`text-red-400/60`:`text-amber-400/60`;return(0,z.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-0.5 ${a}`,children:[(0,z.jsx)(`span`,{className:`w-4 shrink-0 select-none ${o}`,children:e.prefix}),(0,z.jsx)(`span`,{className:`w-20 shrink-0 ${c}`,children:e.field}),e.oldVal&&(0,z.jsx)(`span`,{className:`text-red-400/70 line-through`,children:e.oldVal}),e.oldVal&&e.newVal&&(0,z.jsx)(`span`,{className:`text-gray-600`,children:`→`}),e.newVal&&(0,z.jsx)(`span`,{className:s,children:e.newVal})]},t)})})})]}),!u&&!e.length&&(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes detected.`})]})}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 pt-4 pb-6`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-3`,children:a.length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(oe,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,z.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Replace:`}),(0,z.jsxs)(k,{value:c??``,onValueChange:e=>l(e||null),children:[(0,z.jsx)(D,{className:`h-7 text-[12px]`,children:(0,z.jsx)(O,{placeholder:`All Symbols`})}),(0,z.jsxs)(E,{children:[(0,z.jsx)(T,{value:``,children:`All Symbols`}),a.map(e=>(0,z.jsx)(T,{value:e,children:e},e))]})]})]})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsxs)(w,{variant:`outline`,size:`sm`,onClick:r,className:`gap-2`,children:[(0,z.jsx)(_,{className:`size-4`}),`Cancel`]}),(0,z.jsxs)(w,{size:`sm`,onClick:()=>n(c||void 0),className:`gap-2`,children:[(0,z.jsx)(A,{className:`size-4`}),i]})]})]})]})]})}function V(e){return[{x:e.x+80,y:e.y},{x:e.x+80,y:e.y+70},{x:e.x,y:e.y+35},{x:e.x+160,y:e.y+35}]}function H(e,t){return V(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function Fe(e,t){let n=[`top`,`bottom`,`left`,`right`],r=V(e.position),i=V(t.position),a=1/0,o=0,s=0;for(let e=0;e<4;e++)for(let t=0;t<4;t++){let n=r[e].x-i[t].x,c=r[e].y-i[t].y,l=n*n+c*c;l<a&&(a=l,o=e,s=t)}return{sourceHandle:n[o],targetHandle:n[s]}}function Ie(e,t,n,r){if(t===`bottom`||t===`top`||r===`bottom`||r===`top`){let t=(e.y+n.y)/2;return`M${e.x},${e.y} L${e.x},${t} L${n.x},${t} L${n.x},${n.y}`}let i=(e.x+n.x)/2;return`M${e.x},${e.y} L${i},${e.y} L${i},${n.y} L${n.x},${n.y}`}function Le(e,t,n){switch(e){case`diamond`:return`<polygon points="80,2 158,35 80,68 2,35" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`parallelogram`:return`<polygon points="32,2 158,2 128,68 2,68" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`oval`:return`<ellipse cx="80" cy="35" rx="78" ry="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`circle`:return`<circle cx="80" cy="35" r="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`database`:return`<g>
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{a as r,c as i,h as a,i as o,l as s,m as c,n as l,p as u,r as d,s as f,t as p}from"./downloadSVG-DnlyCOTN.js";import{a as m,h as ee,r as te}from"./esm-B1WURL1q.js";import{n as h}from"./dist-Di9gTGEC.js";import{a as g,c as ne,d as _,i as v,l as y,n as b,o as x,s as S,t as C}from"./dialog-DdtHj1_i.js";import{t as w}from"./button-BGyQguBL.js";import{i as T,n as E,o as D,s as O,t as k}from"./select-iuD-eAM0.js";import{t as A}from"./check-Uq0GkTkz.js";import{S as j,a as M,b as re,n as N,r as ie,u as ae}from"./scroll-area-DJulbnDp.js";import{n as oe,t as se}from"./move-BzTcfKj2.js";import{n as ce,r as le,t as ue}from"./undo-2-BrIFXDrK.js";import{t as de}from"./plus-DfXp3YpY.js";import{t as fe}from"./trash-2-BmZK7fDJ.js";import{t as pe}from"./card-XtyXpgaS.js";import{t as P}from"./input-QHOTkdNi.js";import{n as me}from"./WorkspaceContext-O7njKDwj.js";import{t as F}from"./label-B06IPhlq.js";import{A as he,C as ge,D as _e,E as ve,M as I,N as ye,P as be,Qt as xe,T as Se,Ut as Ce,j as L,k as we,mn as Te,w as Ee}from"./index-CgOQgp37.js";import{t as De}from"./FileCommentMarkers-BQZxgTaW.js";/* empty css */import{t as Oe}from"./JumpToNode-D5AzEEQu.js";var R=e(t(),1),z=n(),ke=(0,R.memo)(({data:e,id:t,selected:n})=>{let[r,a]=(0,R.useState)(!1),o=`!w-1.5 !h-1.5 !bg-white !border-none opacity-0 group-hover:opacity-100 transition-opacity z-20 cursor-crosshair`,s=(0,R.useMemo)(()=>{switch(e.shape){case`diamond`:return`min-w-[130px] min-h-[130px] p-8`;case`circle`:return`min-w-[110px] min-h-[110px] p-4`;case`cloud`:return`min-w-[160px] max-w-[240px] min-h-[90px] px-10 py-6`;case`database`:return`min-w-[140px] max-w-[220px] min-h-[100px] px-6 pt-10 pb-6`;case`parallelogram`:return`min-w-[160px] max-w-[240px] min-h-[80px] px-12 py-4`;case`oval`:return`min-w-[140px] max-w-[240px] min-h-[80px] px-10 py-4`;case`document`:return`min-w-[140px] max-w-[220px] min-h-[90px] px-8 pt-4 pb-10`;default:return`min-w-[140px] max-w-[240px] min-h-[80px] px-8 py-4`}},[e.shape]),c=(0,R.useMemo)(()=>{switch(e.shape){case`diamond`:return{width:100,height:100};case`circle`:return{width:80,height:80};default:return{width:100,height:60}}},[e.shape]),l=(0,R.useMemo)(()=>{let t={background:`linear-gradient(135deg, ${e.color}40 0%, ${e.color}10 100%)`,borderColor:e.color,borderWidth:`2px`,borderStyle:`solid`,boxShadow:`none`,transition:`all 0.3s cubic-bezier(0.4, 0, 0.2, 1)`},n=`${e.color}20`,r=e.color,i={filter:`none`,transition:`all 0.3s`};switch(e.shape){case`diamond`:return(0,z.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,z.jsx)(`path`,{d:`M50,2 L98,50 L50,98 L2,50 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i})});case`parallelogram`:return(0,z.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,z.jsx)(`path`,{d:`M20,2 L98,2 L80,98 L2,98 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i})});case`oval`:return(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-[50px] pointer-events-none`,style:t});case`circle`:return(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-full pointer-events-none flex items-center justify-center`,style:{...t,background:`radial-gradient(circle at 30% 30%, ${e.color}40 0%, ${e.color}10 100%)`}});case`database`:return(0,z.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,z.jsx)(`path`,{d:`M2,15 L2,85 C2,95 98,95 98,85 L98,15`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i}),(0,z.jsx)(`path`,{d:`M2,15 C2,5 98,5 98,15 C98,25 2,25 2,15 Z`,fill:`${e.color}35`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),(0,z.jsx)(`path`,{d:`M2,50 C2,60 98,60 98,50`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,opacity:`0.3`})]});case`document`:return(0,z.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,z.jsx)(`path`,{d:`M2,2 L70,2 L98,30 L98,85 C98,93 90,98 85,98 L15,98 C7,98 2,93 2,85 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i}),(0,z.jsx)(`path`,{d:`M70,2 V30 H98`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`})]});case`cloud`:return(0,z.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,z.jsx)(`path`,{d:`M20,80 C5,80 5,60 15,50 C10,20 40,15 55,25 C65,5 95,10 95,40 C105,50 105,80 80,80 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,style:i})});default:return(0,z.jsx)(`div`,{className:`absolute inset-0 rounded-md pointer-events-none`,style:t})}},[e.color,e.shape,n]),u=(0,z.jsxs)(`div`,{className:`relative group flex items-center justify-center cursor-pointer transition-all duration-300 hover:scale-[1.02] ${s}`,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{aspectRatio:e.shape===`circle`?`1 / 1`:`auto`},children:[(0,z.jsx)(i,{isVisible:n||r,keepAspectRatio:e.shape===`circle`,minWidth:c.width,minHeight:c.height,handleStyle:{width:8,height:8,borderRadius:0,backgroundColor:`#0f0f14`,border:`1.5px solid ${e.color}`,zIndex:50},lineStyle:{border:`1px dashed ${e.color}80`}}),l,e._commentsEnabled&&(0,z.jsx)(`div`,{className:`absolute -right-2 -top-2 z-30`,children:(0,z.jsx)(De,{anchor:{type:`shape`,id:t}})}),(0,z.jsx)(f,{id:`top`,type:`target`,position:m.Top,className:o}),(0,z.jsx)(f,{id:`top`,type:`source`,position:m.Top,className:o}),(0,z.jsx)(f,{id:`bottom`,type:`target`,position:m.Bottom,className:o}),(0,z.jsx)(f,{id:`bottom`,type:`source`,position:m.Bottom,className:o}),(0,z.jsx)(f,{id:`right`,type:`target`,position:m.Right,className:o}),(0,z.jsx)(f,{id:`right`,type:`source`,position:m.Right,className:o}),(0,z.jsx)(f,{id:`left`,type:`target`,position:m.Left,className:o}),(0,z.jsx)(f,{id:`left`,type:`source`,position:m.Left,className:o}),(0,z.jsx)(`div`,{className:`relative z-10 text-center text-sm font-semibold text-foreground wrap-break-word whitespace-pre-wrap max-w-full flex-1`,children:e.label}),e.section&&(0,z.jsx)(`div`,{className:`absolute -top-7 left-1/2 -translate-x-1/2 z-20 whitespace-nowrap text-[9px] font-medium text-muted-foreground/60 tracking-wider uppercase px-2 py-0.5 rounded-full bg-background/50 backdrop-blur-sm border border-border/30`,children:e.section})]});return e._commentsEnabled?(0,z.jsxs)(N,{children:[(0,z.jsx)(ae,{className:`contents`,children:u}),(0,z.jsx)(ie,{className:`min-w-36`,positionerClassName:`z-[210]`,children:(0,z.jsxs)(M,{onClick:()=>window.dispatchEvent(new CustomEvent(`project-comment-open-request`,{detail:{featureType:`flowchart`,type:`shape`,id:t}})),children:[(0,z.jsx)(Ce,{"aria-hidden":`true`}),`Comment`]})})]}):u}),Ae=e=>e.trim().toLowerCase().includes(`start`);function je({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=Ae(n.label);return(0,z.jsx)(C,{open:e,onOpenChange:t,children:(0,z.jsxs)(v,{className:`sm:max-w-sm`,children:[(0,z.jsxs)(S,{children:[(0,z.jsx)(y,{children:`Create New Symbol`}),(0,z.jsx)(g,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,z.jsxs)(b,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(P,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(P,{value:n.section||``,onChange:e=>r({...n,section:e.target.value||void 0}),placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(k,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select a shape`,children:n.shape?I[n.shape]:`Select a shape`})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`rectangle`,children:`Rectangle (Process)`}),(0,z.jsx)(T,{value:`oval`,children:`Oval (Start/End)`}),(0,z.jsx)(T,{value:`diamond`,children:`Diamond (Decision)`}),(0,z.jsx)(T,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,z.jsx)(T,{value:`database`,children:`Cylinder (Database)`}),(0,z.jsx)(T,{value:`document`,children:`Document`}),(0,z.jsx)(T,{value:`cloud`,children:`Cloud (External System)`}),(0,z.jsx)(T,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.color===e?`border-white scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({...n,color:e})},e))})]})]}),(0,z.jsxs)(x,{children:[(0,z.jsx)(w,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,z.jsx)(w,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function B(e){return e.data.label.trim().toLowerCase().includes(`start`)}function Me({selectedNodeId:e,onClose:t,selectedNode:n,onUpdateNodeData:r,onDeleteNode:i,onDeleteGroup:a,onValidateSection:o}){let s=n?B(n):!1,[c,l]=(0,R.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),u=e=>{l(e),r({code:e})};return(0,z.jsx)(C,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(v,{className:`sm:max-w-sm`,children:[(0,z.jsxs)(S,{children:[(0,z.jsx)(y,{children:`Symbol Properties`}),(0,z.jsx)(g,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,z.jsxs)(b,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(P,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>u(e.target.value),placeholder:n.data.shape===`diamond`?`e.g. return context.amount > 100 ? 'Yes' : 'No';`:`e.g. context.status = 'Approved'; context.tries += 1;`,className:`w-full h-24 bg-muted border border-border rounded-md p-2 text-xs font-mono text-foreground placeholder:text-muted-foreground/50 resize-none focus:outline-none focus:border-ring`}),(0,z.jsxs)(`p`,{className:`text-[9px] text-muted-foreground/50 leading-normal`,children:[`Attached sandbox logic. For Decision diamonds, return the matching branch label (case-sensitive). Process symbols can mutate variables in the `,(0,z.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(P,{value:n.data.section||``,onChange:e=>r({section:e.target.value||void 0}),onBlur:e=>{let t=e.target.value;t&&o&&!o(t)&&r({section:void 0})},placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted/50 border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(k,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select a shape`,children:n.data.shape?I[n.data.shape]:`Select a shape`})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`rectangle`,children:`Rectangle (Process)`}),(0,z.jsx)(T,{value:`oval`,children:`Oval (Start/End)`}),(0,z.jsx)(T,{value:`diamond`,children:`Diamond (Decision)`}),(0,z.jsx)(T,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,z.jsx)(T,{value:`database`,children:`Cylinder (Database)`}),(0,z.jsx)(T,{value:`document`,children:`Document`}),(0,z.jsx)(T,{value:`cloud`,children:`Cloud (External System)`}),(0,z.jsx)(T,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.data.color===e?`border-white scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({color:e})},e))})]}),(0,z.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,z.jsxs)(w,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,z.jsx)(fe,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,z.jsxs)(w,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,z.jsx)(fe,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Ne({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:i,onEdgeTypeChange:a,onArrowChange:o,onLabelChange:s,onDeleteEdge:c}){return(0,z.jsx)(C,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(v,{className:`sm:max-w-sm`,children:[(0,z.jsx)(S,{children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,z.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,z.jsx)(y,{children:`Connector Properties`}),(0,z.jsx)(g,{children:`Format the line style and arrows.`})]}),(0,z.jsx)(w,{variant:`ghost`,size:`icon`,onClick:c,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,children:(0,z.jsx)(fe,{className:`w-4 h-4`})})]})}),n&&(0,z.jsxs)(b,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Text Label`}),(0,z.jsx)(P,{value:typeof n.label==`string`?n.label:``,onChange:e=>s(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Line Style`}),(0,z.jsxs)(k,{value:r?`dashed`:`solid`,onValueChange:e=>a(e||``),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select line style`,children:L[r?`dashed`:`solid`]})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`solid`,children:`Solid Line`}),(0,z.jsx)(T,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Arrow Style`}),(0,z.jsxs)(k,{value:i,onValueChange:e=>o(e||``),children:[(0,z.jsx)(D,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(O,{placeholder:`Select arrow style`,children:we[i]})}),(0,z.jsxs)(E,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(T,{value:`end`,children:`Arrow at End`}),(0,z.jsx)(T,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,z.jsx)(T,{value:`both`,children:`Arrows Both Ends`}),(0,z.jsx)(T,{value:`none`,children:`No Arrows (Line only)`})]})]})]})]})]})})}function Pe({nodes:e,edges:t,onConfirm:n,onCancel:r,confirmLabel:i=`Confirm Append`,canvasGroups:a=[],existingNodes:o=[],existingEdges:s=[]}){let[c,l]=(0,R.useState)(null),u=(0,R.useMemo)(()=>{if(!o.length||!e.length)return null;let n=new Map;for(let e of o)n.set((e.data.label||``).toLowerCase(),e);let r=new Map;for(let t of e)r.set((t.data.label||``).toLowerCase(),t);let i=[];for(let t of e){let e=t.data.label||`Untitled`,r=n.get(e.toLowerCase());if(!r)i.push({type:`header`,label:e,isNew:!0}),i.push({type:`add`,prefix:`+`,field:`shape`,newVal:t.data.shape}),i.push({type:`add`,prefix:`+`,field:`label`,newVal:e}),t.data.color&&i.push({type:`add`,prefix:`+`,field:`color`,newVal:t.data.color});else{let n=r.data.shape!==t.data.shape,a=r.data.color!==t.data.color,o=(r.data.label||``)!==e;(n||a||o)&&(i.push({type:`header`,label:e}),o&&i.push({type:`change`,prefix:`~`,field:`label`,oldVal:r.data.label,newVal:e}),n&&i.push({type:`change`,prefix:`~`,field:`shape`,oldVal:r.data.shape,newVal:t.data.shape}),a&&i.push({type:`change`,prefix:`~`,field:`color`,oldVal:r.data.color,newVal:t.data.color}))}}for(let e of o){let t=e.data.label||``;r.has(t.toLowerCase())||(i.push({type:`header`,label:t,isNew:!1}),i.push({type:`remove`,prefix:`-`,field:`shape`,oldVal:e.data.shape}),i.push({type:`remove`,prefix:`-`,field:`removed`,oldVal:`entire node`}))}let a=new Set(s.map(e=>{let t=o.find(t=>t.id===e.source)?.data.label||e.source,n=o.find(t=>t.id===e.target)?.data.label||e.target;return`${t.toLowerCase()}→${n.toLowerCase()}`})),c=new Set(t.map(t=>{let n=e.find(e=>e.id===t.source)?.data.label||t.source,r=e.find(e=>e.id===t.target)?.data.label||t.target;return`${n.toLowerCase()}→${r.toLowerCase()}`})),l=[...c].filter(e=>!a.has(e)),u=[...a].filter(e=>!c.has(e));if(l.length>0||u.length>0){i.push({type:`header`,label:`Connections`});for(let e of l)i.push({type:`add`,prefix:`+`,field:`connection`,newVal:e});for(let e of u)i.push({type:`remove`,prefix:`-`,field:`connection`,oldVal:e})}return i.length>0?i:null},[o,s,e,t]);return(0,z.jsxs)(C,{open:!0,onOpenChange:e=>{e||r()},children:[(0,z.jsx)(ne,{}),(0,z.jsxs)(v,{size:`2xl`,showCloseButton:!0,children:[(0,z.jsx)(S,{children:(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`div`,{className:`size-8 rounded-lg bg-indigo-500/10 flex items-center justify-center`,children:(0,z.jsx)(Te,{className:`size-4 text-indigo-400`})}),(0,z.jsx)(`div`,{children:(0,z.jsx)(y,{children:`Preview Changes`})})]})}),(0,z.jsx)(b,{children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.length>0&&(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`New Symbols (`,e.length,`)`]}),(0,z.jsx)(`div`,{className:`max-h-75 overflow-y-auto custom-scrollbar space-y-2`,children:e.map(e=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted overflow-hidden`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-2 border-b border-border/20 bg-muted/50`,children:[(0,z.jsx)(Te,{className:`size-3 text-indigo-400 shrink-0`}),(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.data.label}),(0,z.jsx)(`span`,{className:`text-[9px] text-muted-foreground ml-auto`,children:e.data.shape})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono`,children:[(0,z.jsx)(`span`,{className:`text-gray-500`,children:`Shape:`}),(0,z.jsx)(`span`,{className:`text-gray-300`,children:e.data.shape}),e.data.color&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-gray-500 ml-2`,children:`Color:`}),(0,z.jsx)(`span`,{className:`text-gray-300`,children:e.data.color})]})]})]},e.id))})]}),u&&(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Changes`}),(0,z.jsx)(`div`,{className:`rounded-lg border border-border/40 overflow-hidden max-h-75 overflow-y-auto custom-scrollbar text-[10px] font-mono leading-relaxed`,children:(0,z.jsx)(`div`,{className:`divide-y divide-border/10`,children:u.map((e,t)=>{if(e.type===`header`)return(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border/30`,children:[e.isNew&&(0,z.jsx)(`span`,{className:`text-[8px] font-semibold px-1 py-0.5 rounded bg-emerald-500/15 text-emerald-400 border border-emerald-500/30 shrink-0`,children:`NEW`}),(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.label})]},t);let n=e.type===`add`,r=e.type===`remove`,i=e.type===`change`,a=n?`bg-emerald-900/20`:r?`bg-red-900/20`:i?`bg-amber-900/20`:``,o=n?`text-emerald-400`:r?`text-red-400`:`text-amber-400`,s=n?`text-emerald-300`:r?`text-red-400`:`text-amber-300`,c=n?`text-emerald-400/60`:r?`text-red-400/60`:`text-amber-400/60`;return(0,z.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-0.5 ${a}`,children:[(0,z.jsx)(`span`,{className:`w-4 shrink-0 select-none ${o}`,children:e.prefix}),(0,z.jsx)(`span`,{className:`w-20 shrink-0 ${c}`,children:e.field}),e.oldVal&&(0,z.jsx)(`span`,{className:`text-red-400/70 line-through`,children:e.oldVal}),e.oldVal&&e.newVal&&(0,z.jsx)(`span`,{className:`text-gray-600`,children:`→`}),e.newVal&&(0,z.jsx)(`span`,{className:s,children:e.newVal})]},t)})})})]}),!u&&!e.length&&(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes detected.`})]})}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 pt-4 pb-6`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-3`,children:a.length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(oe,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,z.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Replace:`}),(0,z.jsxs)(k,{value:c??``,onValueChange:e=>l(e||null),children:[(0,z.jsx)(D,{className:`h-7 text-[12px]`,children:(0,z.jsx)(O,{placeholder:`All Symbols`})}),(0,z.jsxs)(E,{children:[(0,z.jsx)(T,{value:``,children:`All Symbols`}),a.map(e=>(0,z.jsx)(T,{value:e,children:e},e))]})]})]})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsxs)(w,{variant:`outline`,size:`sm`,onClick:r,className:`gap-2`,children:[(0,z.jsx)(_,{className:`size-4`}),`Cancel`]}),(0,z.jsxs)(w,{size:`sm`,onClick:()=>n(c||void 0),className:`gap-2`,children:[(0,z.jsx)(A,{className:`size-4`}),i]})]})]})]})]})}function V(e){return[{x:e.x+80,y:e.y},{x:e.x+80,y:e.y+70},{x:e.x,y:e.y+35},{x:e.x+160,y:e.y+35}]}function H(e,t){return V(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function Fe(e,t){let n=[`top`,`bottom`,`left`,`right`],r=V(e.position),i=V(t.position),a=1/0,o=0,s=0;for(let e=0;e<4;e++)for(let t=0;t<4;t++){let n=r[e].x-i[t].x,c=r[e].y-i[t].y,l=n*n+c*c;l<a&&(a=l,o=e,s=t)}return{sourceHandle:n[o],targetHandle:n[s]}}function Ie(e,t,n,r){if(t===`bottom`||t===`top`||r===`bottom`||r===`top`){let t=(e.y+n.y)/2;return`M${e.x},${e.y} L${e.x},${t} L${n.x},${t} L${n.x},${n.y}`}let i=(e.x+n.x)/2;return`M${e.x},${e.y} L${i},${e.y} L${i},${n.y} L${n.x},${n.y}`}function Le(e,t,n){switch(e){case`diamond`:return`<polygon points="80,2 158,35 80,68 2,35" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`parallelogram`:return`<polygon points="32,2 158,2 128,68 2,68" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`oval`:return`<ellipse cx="80" cy="35" rx="78" ry="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`circle`:return`<circle cx="80" cy="35" r="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`database`:return`<g>
2
2
  <path d="M2,14 L2,56 C2,68 158,68 158,56 L158,14" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />
3
3
  <ellipse cx="80" cy="14" rx="78" ry="10.5" fill="${t}30" stroke="${t}" stroke-width="2" filter="url(#shadow)" />
4
4
  <path d="M2,35 C2,45.5 158,45.5 158,35" fill="none" stroke="${t}" stroke-width="2" opacity="0.3" />
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{r}from"./utils-SlpklRSt.js";import{g as i}from"./downloadSVG-DnlyCOTN.js";import{f as a}from"./dialog-DdtHj1_i.js";import{t as o}from"./button-BGyQguBL.js";import{B as s,S as c,_ as l,f as u,g as d,h as f,m as p,v as m}from"./select-iuD-eAM0.js";import{t as h}from"./scroll-area-DJulbnDp.js";import{t as g}from"./input-QHOTkdNi.js";import{qt as _}from"./index-DCMwd7x8.js";var v=e(t(),1),y=n();function b({nodes:e,className:t,label:n=`Symbol`}){let{fitView:b}=i(),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(``),T=v.useRef(null);v.useEffect(()=>{x&&setTimeout(()=>T.current?.focus(),100)},[x]);let E=e=>{e.stopPropagation(),e.key===`Escape`&&S(!1)},D=(0,v.useMemo)(()=>{let t=C.trim().toLowerCase();return t?e.filter(e=>{let n=e.data;return(n.name||n.label||``).toLowerCase().includes(t)}):e},[e,C]),O=e=>{S(!1),w(``),e.position.x+(e.measured?.width??200)/2,e.position.y+(e.measured?.height??100)/2,setTimeout(()=>{b({nodes:[{id:e.id}],duration:0,padding:1.5,minZoom:1.2,maxZoom:1.2})},100)};return(0,y.jsxs)(u,{open:x,onOpenChange:S,children:[(0,y.jsx)(c,{render:(0,y.jsxs)(o,{variant:`outline`,size:`sm`,className:r(`h-9 px-3 text-xs font-bold border-border/50 bg-muted/20 hover:bg-muted text-muted-foreground transition-all`,t),children:[(0,y.jsx)(_,{className:`w-3.5 h-3.5 mr-2`}),(0,y.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Jump to `,n]}),(0,y.jsx)(`span`,{className:`sm:hidden`,children:`Jump`}),(0,y.jsx)(s,{className:`w-3 h-3 ml-2 opacity-50`})]})}),(0,y.jsxs)(p,{align:`start`,className:`w-[280px] p-0 shadow-2xl border-border/50 bg-background/95 backdrop-blur-xl`,children:[(0,y.jsx)(`div`,{className:`p-3 pb-2`,onPointerDown:e=>e.stopPropagation(),children:(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(a,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground`}),(0,y.jsx)(g,{ref:T,placeholder:`Search ${n.toLowerCase()}s...`,className:`h-8 pl-8 text-xs bg-muted/50 border-none focus-visible:ring-1 focus-visible:ring-primary/50`,value:C,onChange:e=>w(e.target.value),onKeyDown:E,autoComplete:`off`})]})}),(0,y.jsx)(m,{className:`bg-border/50`}),(0,y.jsxs)(f,{children:[(0,y.jsxs)(l,{className:`px-3 pt-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/70`,children:[`Showing `,D.length,` of `,e.length,` `,n.toLowerCase(),`s`]}),(0,y.jsx)(h,{className:`h-[250px] px-1 pb-1`,children:D.length===0?(0,y.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted-foreground italic`,children:`No matching items found`}):D.map(e=>{let t=e.data,n=t.name||t.label||`Unnamed component`;return(0,y.jsxs)(d,{onClick:()=>O(e),className:`flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors focus:bg-accent focus:text-accent-foreground rounded-lg mx-1`,children:[(0,y.jsx)(`div`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:e.data.color||`#8b5cf6`}}),(0,y.jsx)(`span`,{className:`text-[13px] font-medium truncate tracking-tight`,children:n})]},e.id)})})]})]})]})}export{b as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{r}from"./utils-SlpklRSt.js";import{g as i}from"./downloadSVG-DnlyCOTN.js";import{f as a}from"./dialog-DdtHj1_i.js";import{t as o}from"./button-BGyQguBL.js";import{B as s,S as c,_ as l,f as u,g as d,h as f,m as p,v as m}from"./select-iuD-eAM0.js";import{t as h}from"./scroll-area-DJulbnDp.js";import{t as g}from"./input-QHOTkdNi.js";import{qt as _}from"./index-CgOQgp37.js";var v=e(t(),1),y=n();function b({nodes:e,className:t,label:n=`Symbol`}){let{fitView:b}=i(),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(``),T=v.useRef(null);v.useEffect(()=>{x&&setTimeout(()=>T.current?.focus(),100)},[x]);let E=e=>{e.stopPropagation(),e.key===`Escape`&&S(!1)},D=(0,v.useMemo)(()=>{let t=C.trim().toLowerCase();return t?e.filter(e=>{let n=e.data;return(n.name||n.label||``).toLowerCase().includes(t)}):e},[e,C]),O=e=>{S(!1),w(``),e.position.x+(e.measured?.width??200)/2,e.position.y+(e.measured?.height??100)/2,setTimeout(()=>{b({nodes:[{id:e.id}],duration:0,padding:1.5,minZoom:1.2,maxZoom:1.2})},100)};return(0,y.jsxs)(u,{open:x,onOpenChange:S,children:[(0,y.jsx)(c,{render:(0,y.jsxs)(o,{variant:`outline`,size:`sm`,className:r(`h-9 px-3 text-xs font-bold border-border/50 bg-muted/20 hover:bg-muted text-muted-foreground transition-all`,t),children:[(0,y.jsx)(_,{className:`w-3.5 h-3.5 mr-2`}),(0,y.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Jump to `,n]}),(0,y.jsx)(`span`,{className:`sm:hidden`,children:`Jump`}),(0,y.jsx)(s,{className:`w-3 h-3 ml-2 opacity-50`})]})}),(0,y.jsxs)(p,{align:`start`,className:`w-[280px] p-0 shadow-2xl border-border/50 bg-background/95 backdrop-blur-xl`,children:[(0,y.jsx)(`div`,{className:`p-3 pb-2`,onPointerDown:e=>e.stopPropagation(),children:(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(a,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground`}),(0,y.jsx)(g,{ref:T,placeholder:`Search ${n.toLowerCase()}s...`,className:`h-8 pl-8 text-xs bg-muted/50 border-none focus-visible:ring-1 focus-visible:ring-primary/50`,value:C,onChange:e=>w(e.target.value),onKeyDown:E,autoComplete:`off`})]})}),(0,y.jsx)(m,{className:`bg-border/50`}),(0,y.jsxs)(f,{children:[(0,y.jsxs)(l,{className:`px-3 pt-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/70`,children:[`Showing `,D.length,` of `,e.length,` `,n.toLowerCase(),`s`]}),(0,y.jsx)(h,{className:`h-[250px] px-1 pb-1`,children:D.length===0?(0,y.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted-foreground italic`,children:`No matching items found`}):D.map(e=>{let t=e.data,n=t.name||t.label||`Unnamed component`;return(0,y.jsxs)(d,{onClick:()=>O(e),className:`flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors focus:bg-accent focus:text-accent-foreground rounded-lg mx-1`,children:[(0,y.jsx)(`div`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:e.data.color||`#8b5cf6`}}),(0,y.jsx)(`span`,{className:`text-[13px] font-medium truncate tracking-tight`,children:n})]},e.id)})})]})]})]})}export{b as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-ByjZpc8a.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/utils-SlpklRSt.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/dist-Di9gTGEC.js","assets/createLucideIcon-CyOWwA0s.js","assets/dialog-DdtHj1_i.js","assets/DialogTrigger-CMZ2bBUb.js","assets/composite-BPr5hlSp.js","assets/useBaseUiId-r-qiwcia.js","assets/button-BGyQguBL.js","assets/select-iuD-eAM0.js","assets/floating-ui.react-dom-R40qjF1b.js","assets/useCompositeItem-Bd6is6jf.js","assets/check-Uq0GkTkz.js","assets/input-QHOTkdNi.js","assets/useControlled-CwUHqyRq.js","assets/popover-CfQq7zeH.js","assets/link-2-C71ROdND.js","assets/arrow-left-Cfq6LFs7.js","assets/calendar-CSJ0kfzv.js","assets/scroll-area-DJulbnDp.js","assets/note-importer-D-BIiDQE.js","assets/api-D87lw-98.js","assets/image-compression-COYPhRs3.js","assets/index-DCMwd7x8.js","assets/downloadSVG-DnlyCOTN.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/vanilla--C5Lp_AM.js","assets/triangle-alert-8iwJw8fK.js","assets/wand-sparkles-DfkrzvIR.js","assets/copy-CIp5gOrB.js","assets/minus-gDNtJ5kA.js","assets/plus-DfXp3YpY.js","assets/trash-2-BmZK7fDJ.js","assets/card-XtyXpgaS.js","assets/checkbox-CdFXC_rx.js","assets/table-BX0J8-d-.js","assets/WorkspaceProvider-EYbBHADd.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/WorkspaceContext-O7njKDwj.js","assets/ConfirmModal-Cha1K-QX.js","assets/message-scroller-_TSj18yr.js","assets/extends-CvVTau-c.js","assets/label-B06IPhlq.js","assets/index-BRZOISFr.css","assets/image-rU2A9CMJ.js","assets/move-BzTcfKj2.js","assets/undo-2-BrIFXDrK.js","assets/refresh-ccw-otI6Z4JU.js","assets/users-BWMwdWqZ.js","assets/user-cog-DrTVVVeT.js","assets/Combination-1O3P4ajp.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{u as i}from"./chunk-BV7QT456-CCzugQp2.js";import{t as a}from"./createLucideIcon-CyOWwA0s.js";import"./WorkspaceProvider-EYbBHADd.js";import{n as o}from"./WorkspaceContext-O7njKDwj.js";import{t as s}from"./ProjectFileTabs-DZWlg8g5.js";var c=a(`file-question-mark`,[[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),l=e(t(),1),u=n(),d=l.lazy(()=>r(()=>import(`./NotesView-ByjZpc8a.js`).then(e=>({default:e.NotesView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58])));function f(){let e=o(),{id:t}=i(),{activeNote:n,activeNoteUid:r,saveNote:a,handleNoteChange:f,deleteNote:p,isPublicView:m,isLoading:h,isNoteItemLoading:g,handleNoteSelect:_}=e,v=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(!(m||!t)&&!v.current){if(r===t){v.current=!0;return}r||(v.current=!0,_(t))}},[t,r,m,_]),!m&&!r?t&&!v.current?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]}):(0,u.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a note to view`})}):!n&&!g?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(c,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Note not found`}),(0,u.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This note may have been deleted or is no longer available.`})]}):n?(0,u.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,u.jsx)(s,{currentView:`notes`}),(0,u.jsx)(l.Suspense,{fallback:(0,u.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,u.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`span`,{className:`text-xs text-muted-foreground/60 animate-pulse`,children:`Loading note...`})]})}),children:(0,u.jsx)(d,{isLoading:g,activeNoteUid:m?null:r,activeNote:n,saveNote:a,handleNoteChange:f,deleteNote:p,isReadOnly:m})})]}):(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]})}export{f as NoteEditorRoute,c as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-Czehzn2R.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/utils-SlpklRSt.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/dist-Di9gTGEC.js","assets/createLucideIcon-CyOWwA0s.js","assets/dialog-DdtHj1_i.js","assets/DialogTrigger-CMZ2bBUb.js","assets/composite-BPr5hlSp.js","assets/useBaseUiId-r-qiwcia.js","assets/button-BGyQguBL.js","assets/select-iuD-eAM0.js","assets/floating-ui.react-dom-R40qjF1b.js","assets/useCompositeItem-Bd6is6jf.js","assets/check-Uq0GkTkz.js","assets/input-QHOTkdNi.js","assets/useControlled-CwUHqyRq.js","assets/popover-CfQq7zeH.js","assets/link-2-C71ROdND.js","assets/arrow-left-Cfq6LFs7.js","assets/calendar-BsdHFQpJ.js","assets/scroll-area-DJulbnDp.js","assets/note-importer-IEAF9Pc4.js","assets/api-D87lw-98.js","assets/image-compression-COYPhRs3.js","assets/index-CgOQgp37.js","assets/downloadSVG-DnlyCOTN.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/vanilla--C5Lp_AM.js","assets/triangle-alert-8iwJw8fK.js","assets/wand-sparkles-DfkrzvIR.js","assets/copy-CIp5gOrB.js","assets/minus-gDNtJ5kA.js","assets/plus-DfXp3YpY.js","assets/trash-2-BmZK7fDJ.js","assets/card-XtyXpgaS.js","assets/checkbox-CdFXC_rx.js","assets/table-BX0J8-d-.js","assets/WorkspaceProvider-CGqNGa8d.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/WorkspaceContext-O7njKDwj.js","assets/ConfirmModal-Cha1K-QX.js","assets/message-scroller-_TSj18yr.js","assets/extends-CvVTau-c.js","assets/label-B06IPhlq.js","assets/index-BRZOISFr.css","assets/image-rU2A9CMJ.js","assets/move-BzTcfKj2.js","assets/undo-2-BrIFXDrK.js","assets/refresh-ccw-otI6Z4JU.js","assets/users-BWMwdWqZ.js","assets/user-cog-DrTVVVeT.js","assets/Combination-cO6WDhz3.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{u as i}from"./chunk-BV7QT456-CCzugQp2.js";import{t as a}from"./createLucideIcon-CyOWwA0s.js";import"./WorkspaceProvider-CGqNGa8d.js";import{n as o}from"./WorkspaceContext-O7njKDwj.js";import{t as s}from"./ProjectFileTabs-BRybZZLH.js";var c=a(`file-question-mark`,[[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),l=e(t(),1),u=n(),d=l.lazy(()=>r(()=>import(`./NotesView-Czehzn2R.js`).then(e=>({default:e.NotesView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58])));function f(){let e=o(),{id:t}=i(),{activeNote:n,activeNoteUid:r,saveNote:a,handleNoteChange:f,deleteNote:p,isPublicView:m,isLoading:h,isNoteItemLoading:g,handleNoteSelect:_}=e,v=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(!(m||!t)&&!v.current){if(r===t){v.current=!0;return}r||(v.current=!0,_(t))}},[t,r,m,_]),!m&&!r?t&&!v.current?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]}):(0,u.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a note to view`})}):!n&&!g?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(c,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Note not found`}),(0,u.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This note may have been deleted or is no longer available.`})]}):n?(0,u.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,u.jsx)(s,{currentView:`notes`}),(0,u.jsx)(l.Suspense,{fallback:(0,u.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,u.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`span`,{className:`text-xs text-muted-foreground/60 animate-pulse`,children:`Loading note...`})]})}),children:(0,u.jsx)(d,{isLoading:g,activeNoteUid:m?null:r,activeNote:n,saveNote:a,handleNoteChange:f,deleteNote:p,isReadOnly:m})})]}):(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]})}export{f as NoteEditorRoute,c as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-KKIj1Hq-.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/downloadSVG-DnlyCOTN.js","assets/utils-SlpklRSt.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/dist-Di9gTGEC.js","assets/vanilla--C5Lp_AM.js","assets/dialog-DdtHj1_i.js","assets/createLucideIcon-CyOWwA0s.js","assets/DialogTrigger-CMZ2bBUb.js","assets/composite-BPr5hlSp.js","assets/useBaseUiId-r-qiwcia.js","assets/button-BGyQguBL.js","assets/select-iuD-eAM0.js","assets/floating-ui.react-dom-R40qjF1b.js","assets/useCompositeItem-Bd6is6jf.js","assets/check-Uq0GkTkz.js","assets/input-QHOTkdNi.js","assets/useControlled-CwUHqyRq.js","assets/scroll-area-DJulbnDp.js","assets/move-BzTcfKj2.js","assets/undo-2-BrIFXDrK.js","assets/plus-DfXp3YpY.js","assets/trash-2-BmZK7fDJ.js","assets/card-XtyXpgaS.js","assets/WorkspaceContext-O7njKDwj.js","assets/label-B06IPhlq.js","assets/index-DCMwd7x8.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/popover-CfQq7zeH.js","assets/link-2-C71ROdND.js","assets/arrow-left-Cfq6LFs7.js","assets/triangle-alert-8iwJw8fK.js","assets/wand-sparkles-DfkrzvIR.js","assets/copy-CIp5gOrB.js","assets/minus-gDNtJ5kA.js","assets/api-D87lw-98.js","assets/checkbox-CdFXC_rx.js","assets/table-BX0J8-d-.js","assets/note-importer-D-BIiDQE.js","assets/image-compression-COYPhRs3.js","assets/WorkspaceProvider-EYbBHADd.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/ConfirmModal-Cha1K-QX.js","assets/message-scroller-_TSj18yr.js","assets/extends-CvVTau-c.js","assets/index-BRZOISFr.css","assets/FileCommentMarkers-Do8KNBq5.js","assets/JumpToNode-YENX0D1W.js","assets/style-CHpVij2M.css","assets/ExcalidrawEditor-BlXcT7Ae.js","assets/Combination-1O3P4ajp.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{a as i,d as a,f as o,i as s,l as c,p as l,r as u}from"./downloadSVG-DnlyCOTN.js";import{ct as d,h as ee,r as te,t as ne}from"./esm-B1WURL1q.js";import{n as f}from"./dist-Di9gTGEC.js";import{t as p}from"./button-BGyQguBL.js";import{n as re}from"./calendar-CSJ0kfzv.js";import{t as m}from"./triangle-alert-8iwJw8fK.js";import{r as h}from"./undo-2-BrIFXDrK.js";import{t as g}from"./plus-DfXp3YpY.js";import{n as _}from"./api-D87lw-98.js";import{E as v,a as y,k as b}from"./note-importer-D-BIiDQE.js";import{v as x}from"./WorkspaceProvider-EYbBHADd.js";import{n as S}from"./WorkspaceContext-O7njKDwj.js";import{Qt as C,R as ie,v as ae}from"./index-DCMwd7x8.js";/* empty css */import{a as oe,i as w,n as T,o as E,r as D,s as O,t as k}from"./erd-edge-style-C_Ktt10j.js";var A=e(t(),1);function j(e){if(!e)return null;try{return typeof e==`string`?JSON.parse(e):e}catch{return null}}function M(e){return{...e,id:String(e.id),is_pk:e.is_pk??e.isPk??!1,is_nullable:e.is_nullable??e.isNullable??!0,is_unique:e.is_unique??e.isUnique??!1,default_value:e.default_value??e.defaultValue??null,enum_values:e.enum_values??e.enumValues??``,max_length:e.max_length??e.maxLength??null,numeric_precision:e.numeric_precision??e.numericPrecision??null,numeric_scale:e.numeric_scale??e.numericScale??null,sort_order:e.sort_order??e.sortOrder??0}}function N(e){let t=e.data??e,n=String(e.id??t.id),r=e.position?.x??e.x??t.x??0,i=e.position?.y??e.y??t.y??0;return{id:n,type:`entity`,position:{x:r,y:i},data:{...t,_notesCompanion:!0,id:n,name:t.name??e.name??`Untitled`,x:r,y:i,color:t.color??e.color??`#6366f1`,columns:(t.columns??e.columns??[]).map(M)}}}function se(e){let t=j(e.data),n=Array.isArray(e.entities)&&e.entities.length?e.entities:Array.isArray(t?.nodes)?t.nodes:[],r=Array.isArray(e.relationships)&&e.relationships.length?e.relationships:Array.isArray(t?.edges)?t.edges:[],i=n.map(N),a=new Map(i.map(e=>[e.id,e]));return{nodes:i,edges:r.map(e=>{let t=String(e.source??e.source_entity_id??e.sourceEntityId??``),n=String(e.target??e.target_entity_id??e.targetEntityId??``),r=e.sourceHandle??e.source_handle??e.sourceColumnId??e.source_column_id,i=e.targetHandle??e.target_handle??e.targetColumnId??e.target_column_id,o=a.get(t),s=a.get(n),c=(o?.position.x??0)<(s?.position.x??0),l=String(r||``).startsWith(`col-`)?r:r?`col-${r}-${c?`source`:`source-l`}`:void 0,u=String(i||``).startsWith(`col-`)?i:i?`col-${i}-${c?`target`:`target-r`}`:void 0;return{...e,id:String(e.id),source:t,target:n,sourceHandle:l,targetHandle:u,label:e.label,type:e.type??`smoothstep`,data:{...e.data||{},on_delete:e.on_delete??e.onDelete,on_update:e.on_update??e.onUpdate,constraint_name:e.constraint_name??e.constraintName}}})}}function P(e,t){return k(e,t?[t]:[])}var F=n(),ce={entity:E},I=(0,A.lazy)(()=>r(()=>import(`./FlowchartView-KKIj1Hq-.js`).then(e=>({default:e.FlowchartView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55]))),L=(0,A.lazy)(()=>r(()=>import(`./ExcalidrawEditor-BlXcT7Ae.js`),__vite__mapDeps([56,1,2,4,31,8,9,15,11,17,40,44,28,51,30,32,3,5,6,7,12,13,14,10,16,18,19,20,21,33,34,35,36,37,38,22,39,25,26,27,41,42,43,45,46,47,48,49,50,29,52,57,53])));async function R(e,t,n){if(n){let n=e===`erd`?`erd`:e===`flowchart`?`flowchart`:`drawings`;return await b.getResource(t)||((await b.getAllResources(n)).find(e=>String(e.uid??e.id)===t)??null)}let r=await _(`/api/${e===`erd`?`diagrams`:e===`flowchart`?`flowcharts`:`drawings`}/${t}`);return r.ok?r.json():null}function z({document:e,previewSchema:t,previewKey:n}){let r=(0,A.useMemo)(()=>se(e),[e]),{isGuest:c,resolvedTheme:m}=S(),[C,E]=(0,A.useState)(r.nodes),[k,j]=(0,A.useState)(r.edges),[M,N]=(0,A.useState)(null),[I,L]=(0,A.useState)(null),[R,z]=(0,A.useState)(null),[B,V]=(0,A.useState)([]),[H,U]=(0,A.useState)(!1),W=(0,A.useRef)(C),G=(0,A.useRef)(k),K=(0,A.useRef)(null),q=(0,A.useMemo)(()=>x(e),[e]),J=q??{x:0,y:0,zoom:1},Y=(0,A.useRef)(J);W.current=C,G.current=k;let X=(0,A.useCallback)((t,n)=>{K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let r=t.map(e=>({...e.data,x:e.position.x,y:e.position.y})),i=n.map(v),a=y(t,n);try{if(c){let t=await b.getResource(e.uid??e.id);t&&await b.saveResource({...t,entities:r,relationships:i,data:null,dbml_source:a,viewport_x:Y.current.x,viewport_y:Y.current.y,viewport_zoom:Y.current.zoom,updated_at:new Date().toISOString()})}else if(!(await _(`/api/diagrams/save/${e.uid??e.id}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entities:r,relationships:i,viewport:Y.current,data:null,dbmlSource:a})})).ok)throw Error()}catch{f.error(`Could not save ERD changes`)}},350)},[e.id,e.uid,c]);(0,A.useEffect)(()=>{if(!(!t||!n))try{let e=re(W.current,G.current,`erd-generate-sql`,t);if(!e)throw Error();let n=w(W.current,G.current,e.nodes,e.edges);if(n.changes.length===0){z(null),f.success(`No schema changes found`);return}N(null),L(null),V(n.changes.map(e=>e.id)),U(!1),z({originalNodes:W.current,originalEdges:G.current,proposedNodes:e.nodes,proposedEdges:e.edges,result:n})}catch{f.error(`Could not parse the schema for diff`)}},[n,t]);let le=(0,A.useCallback)(()=>{if(!R)return;let e=D(R.originalNodes,R.originalEdges,R.proposedNodes,R.proposedEdges,R.result,B);E(e.nodes),j(e.edges),z(null),X(e.nodes,e.edges),f.success(`Schema changes merged successfully`)},[B,R,X]),ue=(0,A.useCallback)(e=>{let t=o(e,W.current);E(t),e.some(e=>e.type!==`select`&&e.type!==`dimensions`)&&X(t,G.current)},[X]),de=(0,A.useCallback)(e=>{let t=a(e,G.current);j(t),e.some(e=>e.type!==`select`)&&X(W.current,t)},[X]),fe=(0,A.useCallback)(e=>{let t=ee({...e,id:crypto.randomUUID(),type:`smoothstep`,label:`1:N`},G.current);j(t),X(W.current,t)},[X]),pe=(0,A.useCallback)((e,t)=>{let n=typeof t==`string`?{label:t}:t,r=G.current.map(t=>t.id===e?{...t,...n,data:{...t.data||{},...n.data||{}}}:t);j(r),X(W.current,r)},[X]),me=(0,A.useCallback)(e=>{let t=e=>e&&(e.endsWith(`-source`)?e.replace(/-source$/,`-source-l`):e.endsWith(`-source-l`)?e.replace(/-source-l$/,`-source`):e.endsWith(`-target`)?e.replace(/-target$/,`-target-r`):e.endsWith(`-target-r`)?e.replace(/-target-r$/,`-target`):e),n=G.current.map(n=>n.id===e?{...n,sourceHandle:t(n.sourceHandle),targetHandle:t(n.targetHandle)}:n);j(n),X(W.current,n)},[X]),he=(0,A.useCallback)(e=>{let t=G.current.filter(t=>t.id!==e);j(t),L(null),X(W.current,t)},[X]),ge=(0,A.useCallback)((e,t)=>{let n=e=>e?.replace(/^col-/,``).replace(/-(source|target)(-(l|r))?$/,``);if(!t.sourceHandle||!t.targetHandle)return;if(String(t.source)!==String(e.source)||String(t.target)!==String(e.target)||n(t.sourceHandle)!==n(e.sourceHandle)||n(t.targetHandle)!==n(e.targetHandle)){f.info(`Only the connector position can be changed`);return}let r=(e,t)=>{let r=n(t);return W.current.find(t=>String(t.id)===String(e))?.data.columns.find(e=>String(e.id)===String(r))},i=r(t.source,t.sourceHandle),a=r(t.target,t.targetHandle);if(i&&a&&i.type!==a.type){f.error(`Type Mismatch`,{description:`Cannot reconnect ${i.type} to ${a.type}`});return}let o=d(e,t,G.current);j(o),X(W.current,o)},[X]),_e=(0,A.useCallback)(e=>{let t=W.current.map(t=>t.id===e.id?{...t,data:e}:t);E(t),X(t,G.current)},[X]),ve=(0,A.useCallback)(e=>{let t=W.current.filter(t=>t.id!==e),n=G.current.filter(t=>t.source!==e&&t.target!==e);E(t),j(n),N(null),X(t,n)},[X]),ye=(0,A.useCallback)(()=>{let e=crypto.randomUUID(),t={id:e,name:`new_table`,x:80,y:80,color:`#6366f1`,columns:[]},n=[...W.current,{id:e,type:`entity`,position:{x:80,y:80},data:t}];E(n),N(e),X(n,G.current)},[X]),be=(0,A.useCallback)(()=>{if(W.current.length===0)return;let e=oe(W.current,G.current);E(e),X(e,G.current)},[X]),xe=(0,A.useCallback)((e,t)=>{Y.current=t},[]),Z=(0,A.useCallback)((e,t)=>{Y.current=t,e&&X(W.current,G.current)},[X]);(0,A.useEffect)(()=>{let e=e=>N(e.detail?.id??null);return window.addEventListener(O,e),()=>window.removeEventListener(O,e)},[]);let Q=C.find(e=>e.id===M)?.data??null,Se=k.find(e=>e.id===I)??null,Ce=m===`dark`?`#222`:`#ccc`,$=(0,A.useMemo)(()=>({type:`smoothstep`,animated:!1,reconnectable:!0,style:{stroke:`var(--edge-color)`,strokeWidth:2},markerEnd:{type:te.Arrow,color:`var(--edge-color)`,width:10,height:10}}),[]),we=(0,A.useMemo)(()=>C.map(e=>{let t=e.id===M;return!!e.selected===t?e:{...e,selected:t}}),[C,M]),Te=(0,A.useMemo)(()=>P(k,M),[k,M]),Ee=(0,A.useMemo)(()=>R?P(R.result.edges,null):[],[R]),De=(0,A.useMemo)(()=>R?.result.nodes.map(e=>({...e,data:{...e.data,isDiffMode:!0}}))??[],[R]);return(0,F.jsxs)(`div`,{className:`relative h-full min-h-0 overflow-hidden bg-background`,children:[(0,F.jsxs)(l,{nodes:R?De:we,edges:R?Ee:Te,nodeTypes:ce,onNodesChange:ue,onEdgesChange:de,onConnect:fe,onReconnect:ge,nodesDraggable:!R,nodesConnectable:!R,elementsSelectable:!R,edgesReconnectable:!R,defaultEdgeOptions:$,onNodeClick:(e,t)=>{L(null),N(t.id)},onNodeDoubleClick:(e,t)=>{L(null),N(t.id)},onEdgeClick:(e,t)=>{N(null),L(t.id)},onPaneClick:()=>{N(null),L(null)},onMove:xe,onMoveEnd:Z,colorMode:m,connectionLineType:ne.SmoothStep,connectionLineStyle:$.style,onlyRenderVisibleElements:!0,defaultViewport:J,fitView:!q,children:[(0,F.jsx)(u,{variant:s.Lines,gap:50,size:1,color:Ce}),(0,F.jsx)(i,{position:`bottom-left`,showInteractive:!1})]}),!R&&(0,F.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center`,children:(0,F.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-1 rounded-lg border bg-background/95 p-1 shadow-sm backdrop-blur`,children:[(0,F.jsxs)(p,{size:`sm`,onClick:ye,children:[(0,F.jsx)(g,{}),` Table`]}),(0,F.jsxs)(p,{variant:`outline`,size:`sm`,onClick:be,disabled:C.length===0,title:`Automatically arrange tables`,children:[(0,F.jsx)(h,{}),` Auto Layout`]})]})}),!R&&Q&&(0,F.jsx)(`aside`,{className:`absolute inset-y-0 right-0 z-20 w-[min(22rem,82%)] border-l bg-background shadow-xl`,children:(0,F.jsx)(ae,{selectedEntity:Q,onUpdateEntity:_e,onDeleteEntity:ve,onBackToTables:()=>N(null),propertiesOnly:!0})}),(0,F.jsx)(ie,{isOpen:!R&&!!I,onOpenChange:e=>{e||L(null)},selectedEdge:Se,nodes:C,handleEdgeUpdate:pe,handleEdgeFlip:me,deleteEdge:he}),R&&(0,F.jsx)(T,{diff:R.result,approvedIds:B,showChecklist:H,onApprovedIdsChange:V,onShowChecklistChange:U,onReject:()=>{z(null),f.info(`Schema update rejected`)},onMerge:le})]})}function B({pane:e,document:t}){let{saveFlowchart:n,saveDrawing:r,triggerDebouncedSync:i}=S();return e.type===`erd`?(0,F.jsx)(c,{children:(0,F.jsx)(z,{document:t,previewSchema:e.previewSchema,previewKey:e.previewKey},t.uid??t.id)}):e.type===`flowchart`?(0,F.jsx)(I,{companionMode:!0,activeFlowchartId:t.uid??t.id,activeFlowchart:t,handleFlowchartChange:(e,r)=>void n({...t,data:JSON.stringify({nodes:e,edges:r})}).then(()=>i()),saveFlowchart:n,triggerDebouncedSync:i}):(0,F.jsx)(L,{compact:!0,drawing:t,onSave:r,onChange:e=>void r({...t,data:e}).then(()=>i()),onDelete:()=>{}})}function V({pane:e}){let{isGuest:t}=S(),[n,r]=(0,A.useState)(),[i,a]=(0,A.useState)(`loading`);return(0,A.useEffect)(()=>{let n=!0;return a(`loading`),r(void 0),R(e.type,e.uid,t).then(e=>{n&&(r(e),a(e?`ready`:`missing`))}).catch(()=>{n&&a(`missing`)}),()=>{n=!1}},[t,e.type,e.uid]),i===`loading`?(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:(0,F.jsx)(C,{className:`size-4 animate-spin`})}):i===`missing`?(0,F.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,F.jsx)(m,{className:`size-5`}),`File unavailable`]}):(0,F.jsx)(B,{pane:e,document:n})}export{V as NotesCompanionPane};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-CM1oQZqa.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/downloadSVG-DnlyCOTN.js","assets/utils-SlpklRSt.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/dist-Di9gTGEC.js","assets/vanilla--C5Lp_AM.js","assets/dialog-DdtHj1_i.js","assets/createLucideIcon-CyOWwA0s.js","assets/DialogTrigger-CMZ2bBUb.js","assets/composite-BPr5hlSp.js","assets/useBaseUiId-r-qiwcia.js","assets/button-BGyQguBL.js","assets/select-iuD-eAM0.js","assets/floating-ui.react-dom-R40qjF1b.js","assets/useCompositeItem-Bd6is6jf.js","assets/check-Uq0GkTkz.js","assets/input-QHOTkdNi.js","assets/useControlled-CwUHqyRq.js","assets/scroll-area-DJulbnDp.js","assets/move-BzTcfKj2.js","assets/undo-2-BrIFXDrK.js","assets/plus-DfXp3YpY.js","assets/trash-2-BmZK7fDJ.js","assets/card-XtyXpgaS.js","assets/WorkspaceContext-O7njKDwj.js","assets/label-B06IPhlq.js","assets/index-CgOQgp37.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/popover-CfQq7zeH.js","assets/link-2-C71ROdND.js","assets/arrow-left-Cfq6LFs7.js","assets/triangle-alert-8iwJw8fK.js","assets/wand-sparkles-DfkrzvIR.js","assets/copy-CIp5gOrB.js","assets/minus-gDNtJ5kA.js","assets/api-D87lw-98.js","assets/checkbox-CdFXC_rx.js","assets/table-BX0J8-d-.js","assets/note-importer-IEAF9Pc4.js","assets/image-compression-COYPhRs3.js","assets/WorkspaceProvider-CGqNGa8d.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/ConfirmModal-Cha1K-QX.js","assets/message-scroller-_TSj18yr.js","assets/extends-CvVTau-c.js","assets/index-BRZOISFr.css","assets/FileCommentMarkers-BQZxgTaW.js","assets/JumpToNode-D5AzEEQu.js","assets/style-CHpVij2M.css","assets/ExcalidrawEditor-BBdVpt_F.js","assets/Combination-cO6WDhz3.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{a as i,d as a,f as o,i as s,l as c,p as l,r as u}from"./downloadSVG-DnlyCOTN.js";import{ct as d,h as ee,r as te,t as ne}from"./esm-B1WURL1q.js";import{n as f}from"./dist-Di9gTGEC.js";import{t as p}from"./button-BGyQguBL.js";import{n as re}from"./calendar-BsdHFQpJ.js";import{t as m}from"./triangle-alert-8iwJw8fK.js";import{r as h}from"./undo-2-BrIFXDrK.js";import{t as g}from"./plus-DfXp3YpY.js";import{n as _}from"./api-D87lw-98.js";import{E as v,a as y,k as b}from"./note-importer-IEAF9Pc4.js";import{v as x}from"./WorkspaceProvider-CGqNGa8d.js";import{n as S}from"./WorkspaceContext-O7njKDwj.js";import{Qt as C,R as ie,v as ae}from"./index-CgOQgp37.js";/* empty css */import{a as oe,i as w,n as T,o as E,r as D,s as O,t as k}from"./erd-edge-style-DqdBCPB9.js";var A=e(t(),1);function j(e){if(!e)return null;try{return typeof e==`string`?JSON.parse(e):e}catch{return null}}function M(e){return{...e,id:String(e.id),is_pk:e.is_pk??e.isPk??!1,is_nullable:e.is_nullable??e.isNullable??!0,is_unique:e.is_unique??e.isUnique??!1,default_value:e.default_value??e.defaultValue??null,enum_values:e.enum_values??e.enumValues??``,max_length:e.max_length??e.maxLength??null,numeric_precision:e.numeric_precision??e.numericPrecision??null,numeric_scale:e.numeric_scale??e.numericScale??null,sort_order:e.sort_order??e.sortOrder??0}}function N(e){let t=e.data??e,n=String(e.id??t.id),r=e.position?.x??e.x??t.x??0,i=e.position?.y??e.y??t.y??0;return{id:n,type:`entity`,position:{x:r,y:i},data:{...t,_notesCompanion:!0,id:n,name:t.name??e.name??`Untitled`,x:r,y:i,color:t.color??e.color??`#6366f1`,columns:(t.columns??e.columns??[]).map(M)}}}function se(e){let t=j(e.data),n=Array.isArray(e.entities)&&e.entities.length?e.entities:Array.isArray(t?.nodes)?t.nodes:[],r=Array.isArray(e.relationships)&&e.relationships.length?e.relationships:Array.isArray(t?.edges)?t.edges:[],i=n.map(N),a=new Map(i.map(e=>[e.id,e]));return{nodes:i,edges:r.map(e=>{let t=String(e.source??e.source_entity_id??e.sourceEntityId??``),n=String(e.target??e.target_entity_id??e.targetEntityId??``),r=e.sourceHandle??e.source_handle??e.sourceColumnId??e.source_column_id,i=e.targetHandle??e.target_handle??e.targetColumnId??e.target_column_id,o=a.get(t),s=a.get(n),c=(o?.position.x??0)<(s?.position.x??0),l=String(r||``).startsWith(`col-`)?r:r?`col-${r}-${c?`source`:`source-l`}`:void 0,u=String(i||``).startsWith(`col-`)?i:i?`col-${i}-${c?`target`:`target-r`}`:void 0;return{...e,id:String(e.id),source:t,target:n,sourceHandle:l,targetHandle:u,label:e.label,type:e.type??`smoothstep`,data:{...e.data||{},on_delete:e.on_delete??e.onDelete,on_update:e.on_update??e.onUpdate,constraint_name:e.constraint_name??e.constraintName}}})}}function P(e,t){return k(e,t?[t]:[])}var F=n(),ce={entity:E},I=(0,A.lazy)(()=>r(()=>import(`./FlowchartView-CM1oQZqa.js`).then(e=>({default:e.FlowchartView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55]))),L=(0,A.lazy)(()=>r(()=>import(`./ExcalidrawEditor-BBdVpt_F.js`),__vite__mapDeps([56,1,2,4,31,8,9,15,11,17,40,44,28,51,30,32,3,5,6,7,12,13,14,10,16,18,19,20,21,33,34,35,36,37,38,22,39,25,26,27,41,42,43,45,46,47,48,49,50,29,52,57,53])));async function R(e,t,n){if(n){let n=e===`erd`?`erd`:e===`flowchart`?`flowchart`:`drawings`;return await b.getResource(t)||((await b.getAllResources(n)).find(e=>String(e.uid??e.id)===t)??null)}let r=await _(`/api/${e===`erd`?`diagrams`:e===`flowchart`?`flowcharts`:`drawings`}/${t}`);return r.ok?r.json():null}function z({document:e,previewSchema:t,previewKey:n}){let r=(0,A.useMemo)(()=>se(e),[e]),{isGuest:c,resolvedTheme:m}=S(),[C,E]=(0,A.useState)(r.nodes),[k,j]=(0,A.useState)(r.edges),[M,N]=(0,A.useState)(null),[I,L]=(0,A.useState)(null),[R,z]=(0,A.useState)(null),[B,V]=(0,A.useState)([]),[H,U]=(0,A.useState)(!1),W=(0,A.useRef)(C),G=(0,A.useRef)(k),K=(0,A.useRef)(null),q=(0,A.useMemo)(()=>x(e),[e]),J=q??{x:0,y:0,zoom:1},Y=(0,A.useRef)(J);W.current=C,G.current=k;let X=(0,A.useCallback)((t,n)=>{K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let r=t.map(e=>({...e.data,x:e.position.x,y:e.position.y})),i=n.map(v),a=y(t,n);try{if(c){let t=await b.getResource(e.uid??e.id);t&&await b.saveResource({...t,entities:r,relationships:i,data:null,dbml_source:a,viewport_x:Y.current.x,viewport_y:Y.current.y,viewport_zoom:Y.current.zoom,updated_at:new Date().toISOString()})}else if(!(await _(`/api/diagrams/save/${e.uid??e.id}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entities:r,relationships:i,viewport:Y.current,data:null,dbmlSource:a})})).ok)throw Error()}catch{f.error(`Could not save ERD changes`)}},350)},[e.id,e.uid,c]);(0,A.useEffect)(()=>{if(!(!t||!n))try{let e=re(W.current,G.current,`erd-generate-sql`,t);if(!e)throw Error();let n=w(W.current,G.current,e.nodes,e.edges);if(n.changes.length===0){z(null),f.success(`No schema changes found`);return}N(null),L(null),V(n.changes.map(e=>e.id)),U(!1),z({originalNodes:W.current,originalEdges:G.current,proposedNodes:e.nodes,proposedEdges:e.edges,result:n})}catch{f.error(`Could not parse the schema for diff`)}},[n,t]);let le=(0,A.useCallback)(()=>{if(!R)return;let e=D(R.originalNodes,R.originalEdges,R.proposedNodes,R.proposedEdges,R.result,B);E(e.nodes),j(e.edges),z(null),X(e.nodes,e.edges),f.success(`Schema changes merged successfully`)},[B,R,X]),ue=(0,A.useCallback)(e=>{let t=o(e,W.current);E(t),e.some(e=>e.type!==`select`&&e.type!==`dimensions`)&&X(t,G.current)},[X]),de=(0,A.useCallback)(e=>{let t=a(e,G.current);j(t),e.some(e=>e.type!==`select`)&&X(W.current,t)},[X]),fe=(0,A.useCallback)(e=>{let t=ee({...e,id:crypto.randomUUID(),type:`smoothstep`,label:`1:N`},G.current);j(t),X(W.current,t)},[X]),pe=(0,A.useCallback)((e,t)=>{let n=typeof t==`string`?{label:t}:t,r=G.current.map(t=>t.id===e?{...t,...n,data:{...t.data||{},...n.data||{}}}:t);j(r),X(W.current,r)},[X]),me=(0,A.useCallback)(e=>{let t=e=>e&&(e.endsWith(`-source`)?e.replace(/-source$/,`-source-l`):e.endsWith(`-source-l`)?e.replace(/-source-l$/,`-source`):e.endsWith(`-target`)?e.replace(/-target$/,`-target-r`):e.endsWith(`-target-r`)?e.replace(/-target-r$/,`-target`):e),n=G.current.map(n=>n.id===e?{...n,sourceHandle:t(n.sourceHandle),targetHandle:t(n.targetHandle)}:n);j(n),X(W.current,n)},[X]),he=(0,A.useCallback)(e=>{let t=G.current.filter(t=>t.id!==e);j(t),L(null),X(W.current,t)},[X]),ge=(0,A.useCallback)((e,t)=>{let n=e=>e?.replace(/^col-/,``).replace(/-(source|target)(-(l|r))?$/,``);if(!t.sourceHandle||!t.targetHandle)return;if(String(t.source)!==String(e.source)||String(t.target)!==String(e.target)||n(t.sourceHandle)!==n(e.sourceHandle)||n(t.targetHandle)!==n(e.targetHandle)){f.info(`Only the connector position can be changed`);return}let r=(e,t)=>{let r=n(t);return W.current.find(t=>String(t.id)===String(e))?.data.columns.find(e=>String(e.id)===String(r))},i=r(t.source,t.sourceHandle),a=r(t.target,t.targetHandle);if(i&&a&&i.type!==a.type){f.error(`Type Mismatch`,{description:`Cannot reconnect ${i.type} to ${a.type}`});return}let o=d(e,t,G.current);j(o),X(W.current,o)},[X]),_e=(0,A.useCallback)(e=>{let t=W.current.map(t=>t.id===e.id?{...t,data:e}:t);E(t),X(t,G.current)},[X]),ve=(0,A.useCallback)(e=>{let t=W.current.filter(t=>t.id!==e),n=G.current.filter(t=>t.source!==e&&t.target!==e);E(t),j(n),N(null),X(t,n)},[X]),ye=(0,A.useCallback)(()=>{let e=crypto.randomUUID(),t={id:e,name:`new_table`,x:80,y:80,color:`#6366f1`,columns:[]},n=[...W.current,{id:e,type:`entity`,position:{x:80,y:80},data:t}];E(n),N(e),X(n,G.current)},[X]),be=(0,A.useCallback)(()=>{if(W.current.length===0)return;let e=oe(W.current,G.current);E(e),X(e,G.current)},[X]),xe=(0,A.useCallback)((e,t)=>{Y.current=t},[]),Z=(0,A.useCallback)((e,t)=>{Y.current=t,e&&X(W.current,G.current)},[X]);(0,A.useEffect)(()=>{let e=e=>N(e.detail?.id??null);return window.addEventListener(O,e),()=>window.removeEventListener(O,e)},[]);let Q=C.find(e=>e.id===M)?.data??null,Se=k.find(e=>e.id===I)??null,Ce=m===`dark`?`#222`:`#ccc`,$=(0,A.useMemo)(()=>({type:`smoothstep`,animated:!1,reconnectable:!0,style:{stroke:`var(--edge-color)`,strokeWidth:2},markerEnd:{type:te.Arrow,color:`var(--edge-color)`,width:10,height:10}}),[]),we=(0,A.useMemo)(()=>C.map(e=>{let t=e.id===M;return!!e.selected===t?e:{...e,selected:t}}),[C,M]),Te=(0,A.useMemo)(()=>P(k,M),[k,M]),Ee=(0,A.useMemo)(()=>R?P(R.result.edges,null):[],[R]),De=(0,A.useMemo)(()=>R?.result.nodes.map(e=>({...e,data:{...e.data,isDiffMode:!0}}))??[],[R]);return(0,F.jsxs)(`div`,{className:`relative h-full min-h-0 overflow-hidden bg-background`,children:[(0,F.jsxs)(l,{nodes:R?De:we,edges:R?Ee:Te,nodeTypes:ce,onNodesChange:ue,onEdgesChange:de,onConnect:fe,onReconnect:ge,nodesDraggable:!R,nodesConnectable:!R,elementsSelectable:!R,edgesReconnectable:!R,defaultEdgeOptions:$,onNodeClick:(e,t)=>{L(null),N(t.id)},onNodeDoubleClick:(e,t)=>{L(null),N(t.id)},onEdgeClick:(e,t)=>{N(null),L(t.id)},onPaneClick:()=>{N(null),L(null)},onMove:xe,onMoveEnd:Z,colorMode:m,connectionLineType:ne.SmoothStep,connectionLineStyle:$.style,onlyRenderVisibleElements:!0,defaultViewport:J,fitView:!q,children:[(0,F.jsx)(u,{variant:s.Lines,gap:50,size:1,color:Ce}),(0,F.jsx)(i,{position:`bottom-left`,showInteractive:!1})]}),!R&&(0,F.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center`,children:(0,F.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-1 rounded-lg border bg-background/95 p-1 shadow-sm backdrop-blur`,children:[(0,F.jsxs)(p,{size:`sm`,onClick:ye,children:[(0,F.jsx)(g,{}),` Table`]}),(0,F.jsxs)(p,{variant:`outline`,size:`sm`,onClick:be,disabled:C.length===0,title:`Automatically arrange tables`,children:[(0,F.jsx)(h,{}),` Auto Layout`]})]})}),!R&&Q&&(0,F.jsx)(`aside`,{className:`absolute inset-y-0 right-0 z-20 w-[min(22rem,82%)] border-l bg-background shadow-xl`,children:(0,F.jsx)(ae,{selectedEntity:Q,onUpdateEntity:_e,onDeleteEntity:ve,onBackToTables:()=>N(null),propertiesOnly:!0})}),(0,F.jsx)(ie,{isOpen:!R&&!!I,onOpenChange:e=>{e||L(null)},selectedEdge:Se,nodes:C,handleEdgeUpdate:pe,handleEdgeFlip:me,deleteEdge:he}),R&&(0,F.jsx)(T,{diff:R.result,approvedIds:B,showChecklist:H,onApprovedIdsChange:V,onShowChecklistChange:U,onReject:()=>{z(null),f.info(`Schema update rejected`)},onMerge:le})]})}function B({pane:e,document:t}){let{saveFlowchart:n,saveDrawing:r,triggerDebouncedSync:i}=S();return e.type===`erd`?(0,F.jsx)(c,{children:(0,F.jsx)(z,{document:t,previewSchema:e.previewSchema,previewKey:e.previewKey},t.uid??t.id)}):e.type===`flowchart`?(0,F.jsx)(I,{companionMode:!0,activeFlowchartId:t.uid??t.id,activeFlowchart:t,handleFlowchartChange:(e,r)=>void n({...t,data:JSON.stringify({nodes:e,edges:r})}).then(()=>i()),saveFlowchart:n,triggerDebouncedSync:i}):(0,F.jsx)(L,{compact:!0,drawing:t,onSave:r,onChange:e=>void r({...t,data:e}).then(()=>i()),onDelete:()=>{}})}function V({pane:e}){let{isGuest:t}=S(),[n,r]=(0,A.useState)(),[i,a]=(0,A.useState)(`loading`);return(0,A.useEffect)(()=>{let n=!0;return a(`loading`),r(void 0),R(e.type,e.uid,t).then(e=>{n&&(r(e),a(e?`ready`:`missing`))}).catch(()=>{n&&a(`missing`)}),()=>{n=!1}},[t,e.type,e.uid]),i===`loading`?(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:(0,F.jsx)(C,{className:`size-4 animate-spin`})}):i===`missing`?(0,F.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,F.jsx)(m,{className:`size-5`}),`File unavailable`]}):(0,F.jsx)(B,{pane:e,document:n})}export{V as NotesCompanionPane};