erdbpro 3.4.7-rc.21 → 3.4.7-rc.23
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.
- package/dist/assets/{AdminRoute-CQDU_ayP.js → AdminRoute-CGaf3MmY.js} +2 -2
- package/dist/assets/{Combination-CCpMCFUv.js → Combination-ODHvOWIL.js} +1 -1
- package/dist/assets/{DataViewerModeToolbar-DAc45Clx.js → DataViewerModeToolbar-CTZ_IF-h.js} +1 -1
- package/dist/assets/{DbClientEditorRoute-GMVkB_mg.js → DbClientEditorRoute-BfVdRXEq.js} +1 -1
- package/dist/assets/{DiagramEditorRoute-C-_yxkTW.js → DiagramEditorRoute--oIiSyZa.js} +1 -1
- package/dist/assets/{DrawingEditorRoute-CXi7vytK.js → DrawingEditorRoute-C0PSRKcg.js} +2 -2
- package/dist/assets/{DrawingsView-BrRF2jgO.js → DrawingsView-BKMifs8N.js} +1 -1
- package/dist/assets/{ERDComments-BUHJbOth.js → ERDComments-C8fNJVjv.js} +1 -1
- package/dist/assets/{ExcalidrawEditor-DqJMng9N.js → ExcalidrawEditor-Cpfty11o.js} +8 -8
- package/dist/assets/{FileCommentMarkers-BEd-xpS3.js → FileCommentMarkers-DcbXvzWA.js} +1 -1
- package/dist/assets/{FlowchartEditorRoute--zCHc1B5.js → FlowchartEditorRoute-DyjIO7wD.js} +1 -1
- package/dist/assets/{FlowchartView-DciDbtr_.js → FlowchartView-B5bGHefb.js} +1 -1
- package/dist/assets/{JumpToNode-C1cRpO0L.js → JumpToNode-BThjKSZV.js} +1 -1
- package/dist/assets/{LibraryRoute-CjyGkKde.js → LibraryRoute-CGT2KYpx.js} +1 -1
- package/dist/assets/{NoteEditorRoute-D0cYpQnJ.js → NoteEditorRoute-SpJlsHHZ.js} +2 -2
- package/dist/assets/{NotesCompanionPane-Bqf8Y0Gr.js → NotesCompanionPane-CaTzZvRR.js} +2 -2
- package/dist/assets/{NotesView-D_JQFKQE.js → NotesView--7XXcBWJ.js} +3 -3
- package/dist/assets/{ProjectFileTabs-BOrh-oHn.js → ProjectFileTabs-YN19u31w.js} +1 -1
- package/dist/assets/{TeamInventoryRoute-BgSdrUyd.js → TeamInventoryRoute-bQ7xxw2j.js} +1 -1
- package/dist/assets/{TeamManagementRoute-C8vvn5sH.js → TeamManagementRoute-DawyUaXQ.js} +1 -1
- package/dist/assets/{TrashView-DWWWel1v.js → TrashView-CkFFvEzi.js} +1 -1
- package/dist/assets/{UserManagementRoute-BeAk3VKO.js → UserManagementRoute-BqsNYbE_.js} +1 -1
- package/dist/assets/{WorkspaceProvider-Dhoj0Xbq.js → WorkspaceProvider-Br57T-Kq.js} +3 -3
- package/dist/assets/{abnfDiagram-N423BO3Z-C8R382jL.js → abnfDiagram-N423BO3Z-BGxLpkyD.js} +1 -1
- package/dist/assets/{ar-SA-G6X2FPQ2-Crfs_bPs.js → ar-SA-G6X2FPQ2-C_Clr09S.js} +1 -1
- package/dist/assets/{architectureDiagram-T3A2C74G-S5A3eo84.js → architectureDiagram-T3A2C74G-CfHb2SKH.js} +1 -1
- package/dist/assets/{az-AZ-76LH7QW2-BO0ecaW6.js → az-AZ-76LH7QW2-ByHAVYqO.js} +1 -1
- package/dist/assets/{bg-BG-XCXSNQG7-BRCAScGy.js → bg-BG-XCXSNQG7-1aSkLGAr.js} +1 -1
- package/dist/assets/{blockDiagram-VBNYF7ZC-CtEL46Vs.js → blockDiagram-VBNYF7ZC-DFv0IuP2.js} +1 -1
- package/dist/assets/{bn-BD-2XOGV67Q-BoSYFyQN.js → bn-BD-2XOGV67Q-D8IpzSlU.js} +1 -1
- package/dist/assets/{c4Diagram-5PPSVZJV-5JSioGu7.js → c4Diagram-5PPSVZJV-CrdMsUJG.js} +1 -1
- package/dist/assets/{ca-ES-6MX7JW3Y-BAh4vQnt.js → ca-ES-6MX7JW3Y-rkMJgEVj.js} +1 -1
- package/dist/assets/{calendar-khMoEUuA.js → calendar-CsxtM8Ee.js} +1 -1
- package/dist/assets/channel-CZWUNv9F.js +1 -0
- package/dist/assets/{chunk-2GRJ4B5K-BLGh68r7.js → chunk-2GRJ4B5K-BSe4PZ8R.js} +1 -1
- package/dist/assets/{chunk-4I5QYGJK-Ci2XHJDu.js → chunk-4I5QYGJK-ppskie2a.js} +1 -1
- package/dist/assets/{chunk-5RXB4S5H-YRZYLkAf.js → chunk-5RXB4S5H-Dp92DKyT.js} +1 -1
- package/dist/assets/{chunk-6Q2QTUOP-WjQyJRvr.js → chunk-6Q2QTUOP-Dt7Wy1MN.js} +1 -1
- package/dist/assets/{chunk-7Z6QIM7H-BtAP_NqK.js → chunk-7Z6QIM7H-B8aU7Nt4.js} +1 -1
- package/dist/assets/{chunk-EIO257PC-Dq7qnuYK.js → chunk-EIO257PC-a-x7pNkq.js} +1 -1
- package/dist/assets/{chunk-GF5L2VYU-BNsp-0ov.js → chunk-GF5L2VYU-B94FVn_t.js} +1 -1
- package/dist/assets/{chunk-I66GZJ75-CZgw4C1J.js → chunk-I66GZJ75-BKdKVHL9.js} +1 -1
- package/dist/assets/{chunk-JQJVKLGR-CEKNTmxh.js → chunk-JQJVKLGR-Bna7jX9l.js} +1 -1
- package/dist/assets/{chunk-KBJHAD2P-DZ8inz6u.js → chunk-KBJHAD2P-CSfvb4rn.js} +1 -1
- package/dist/assets/{chunk-NSK5VX7P-CLHlYxiA.js → chunk-NSK5VX7P-lepe65E6.js} +1 -1
- package/dist/assets/{chunk-QR6OTTB3-BbbN9kKQ.js → chunk-QR6OTTB3-ClTIGwWh.js} +1 -1
- package/dist/assets/{chunk-UBXNYLIW-BGdKXyy2.js → chunk-UBXNYLIW-Bj2Q58aB.js} +1 -1
- package/dist/assets/{chunk-W5SLKNZC-CqP1CUWk.js → chunk-W5SLKNZC-LJdrXo25.js} +1 -1
- package/dist/assets/{chunk-WRU74C26-BY2meOyO.js → chunk-WRU74C26-DwauVv8n.js} +1 -1
- package/dist/assets/classDiagram-JCYQIIEL-DN5ycsl8.js +1 -0
- package/dist/assets/classDiagram-v2-OCEON4UE-DN5ycsl8.js +1 -0
- package/dist/assets/{cs-CZ-2BRQDIVT-CNpvz2bN.js → cs-CZ-2BRQDIVT-DO8l41NW.js} +1 -1
- package/dist/assets/{cynefinDiagram-MW4NZA55-CLzuUG98.js → cynefinDiagram-MW4NZA55-C6q793Qi.js} +1 -1
- package/dist/assets/{da-DK-5WZEPLOC-Cmz3uT4J.js → da-DK-5WZEPLOC-5-OHPh-J.js} +1 -1
- package/dist/assets/{dagre-VZM6K2ZE-CernzOtO.js → dagre-VZM6K2ZE-Cf2BO9il.js} +1 -1
- package/dist/assets/{de-DE-XR44H4JA-CwtvQFPB.js → de-DE-XR44H4JA-CNcPQhq2.js} +1 -1
- package/dist/assets/{diagram-7IWD3JNH-ClDcJRnz.js → diagram-7IWD3JNH-kTSnrRUS.js} +1 -1
- package/dist/assets/{diagram-B4RE2ZJO-B13yki5A.js → diagram-B4RE2ZJO-DLsq7e0U.js} +1 -1
- package/dist/assets/{diagram-LBJQPF4R-BWcRPAJx.js → diagram-LBJQPF4R-BGPlLylL.js} +1 -1
- package/dist/assets/{diagram-Q27KOJAE-BJijI8pA.js → diagram-Q27KOJAE-BGYasYe4.js} +1 -1
- package/dist/assets/{diagram-UB23O5K3-D346GSjs.js → diagram-UB23O5K3-BNOxG2l-.js} +1 -1
- package/dist/assets/{dist-BjmBiP-9.js → dist-BIRElXCr.js} +4 -4
- package/dist/assets/{ebnfDiagram-BXEA7PRR-Bq_-ddau.js → ebnfDiagram-BXEA7PRR-fpWYiwpQ.js} +1 -1
- package/dist/assets/{el-GR-BZB4AONW-CY5bQLVI.js → el-GR-BZB4AONW-bWxeYWzI.js} +1 -1
- package/dist/assets/{en-B4ZKOASM-CFamyLdX.js → en-B4ZKOASM-BW0OYgQc.js} +1 -1
- package/dist/assets/{erDiagram-JOGREHBK-CEddZSRs.js → erDiagram-JOGREHBK-BxFG6ogi.js} +1 -1
- package/dist/assets/{erd-edge-style-DZEKHO4a.js → erd-edge-style-B8eVeo8P.js} +1 -1
- package/dist/assets/{es-ES-U4NZUMDT-CghV15rm.js → es-ES-U4NZUMDT-BaArjf-W.js} +1 -1
- package/dist/assets/{eu-ES-A7QVB2H4-DMtxy7Gv.js → eu-ES-A7QVB2H4-D8Cjr68-.js} +1 -1
- package/dist/assets/{fa-IR-HGAKTJCU-8T88WX46.js → fa-IR-HGAKTJCU-FG_czHgl.js} +1 -1
- package/dist/assets/{fi-FI-Z5N7JZ37-BHHGjAlm.js → fi-FI-Z5N7JZ37-dVafK0em.js} +1 -1
- package/dist/assets/flowDiagram-UKHOOZJN-C6uzeQQJ.js +1 -0
- package/dist/assets/{fr-FR-RHASNOE6-JL4BJkNG.js → fr-FR-RHASNOE6-D-w4f6y3.js} +1 -1
- package/dist/assets/{ganttDiagram-PKOTCBZU-CrSoP5Qm.js → ganttDiagram-PKOTCBZU-DQOe8d3p.js} +1 -1
- package/dist/assets/{gitGraphDiagram-DS77QQ5N-BAAz-RTm.js → gitGraphDiagram-DS77QQ5N--M52QWZG.js} +1 -1
- package/dist/assets/{gl-ES-HMX3MZ6V-BZ9_5BWE.js → gl-ES-HMX3MZ6V-BU2g3H1S.js} +1 -1
- package/dist/assets/{he-IL-6SHJWFNN-BCZv-OtT.js → he-IL-6SHJWFNN-DEJ8rf7l.js} +1 -1
- package/dist/assets/{hi-IN-IWLTKZ5I-BpU0NEGa.js → hi-IN-IWLTKZ5I-CH1OKnkJ.js} +1 -1
- package/dist/assets/{hu-HU-A5ZG7DT2-Do9bKk8W.js → hu-HU-A5ZG7DT2-DUWDBOgI.js} +1 -1
- package/dist/assets/{id-ID-SAP4L64H-Cz_oFVP7.js → id-ID-SAP4L64H-D_T4SYl1.js} +1 -1
- package/dist/assets/image-GAAHSSAO-DKLIPV4z.js +1 -0
- package/dist/assets/{index-pNTxMoqm.js → index-D_7xzFLd.js} +4 -4
- package/dist/assets/{infoDiagram-6WML65LV-rAb507jA.js → infoDiagram-6WML65LV-BfJRjVw9.js} +1 -1
- package/dist/assets/{ishikawaDiagram-WSZJBQD7-BQOxwTMS.js → ishikawaDiagram-WSZJBQD7-CNqZ98Ew.js} +1 -1
- package/dist/assets/{it-IT-JPQ66NNP-9Uy-mitQ.js → it-IT-JPQ66NNP-W03sdg-O.js} +1 -1
- package/dist/assets/{ja-JP-DBVTYXUO-ZlmHtaep.js → ja-JP-DBVTYXUO-E3XL7qg-.js} +1 -1
- package/dist/assets/{journeyDiagram-NVQOT4AX-BLZC2prD.js → journeyDiagram-NVQOT4AX-B5Q7GayG.js} +1 -1
- package/dist/assets/{kaa-6HZHGXH3-lADp_yx9.js → kaa-6HZHGXH3-D1U6Rac3.js} +1 -1
- package/dist/assets/{kab-KAB-ZGHBKWFO-9uWApRHy.js → kab-KAB-ZGHBKWFO-CuGVul0e.js} +1 -1
- package/dist/assets/{kanban-definition-27J2QSJJ-BBRq88Bi.js → kanban-definition-27J2QSJJ-Dh4eynSf.js} +1 -1
- package/dist/assets/{kk-KZ-P5N5QNE5-BYqZz_3h.js → kk-KZ-P5N5QNE5-CK1R6aGP.js} +1 -1
- package/dist/assets/{km-KH-HSX4SM5Z-C1QgnSRW.js → km-KH-HSX4SM5Z-DYgfTGhG.js} +1 -1
- package/dist/assets/{ko-KR-MTYHY66A-C25YBAJt.js → ko-KR-MTYHY66A-CLpvp1pe.js} +1 -1
- package/dist/assets/{ku-TR-6OUDTVRD-raX5R_HH.js → ku-TR-6OUDTVRD-CIji_Uva.js} +1 -1
- package/dist/assets/{line-DoNX4ids.js → line-Wt_rTVVQ.js} +1 -1
- package/dist/assets/{lt-LT-XHIRWOB4-D--mvaU4.js → lt-LT-XHIRWOB4-DNkQhuYL.js} +1 -1
- package/dist/assets/{lv-LV-5QDEKY6T-DPeeeCqk.js → lv-LV-5QDEKY6T-Dyd1xt8m.js} +1 -1
- package/dist/assets/{mindmap-definition-FAOFIHXS-Cn56lM9E.js → mindmap-definition-FAOFIHXS-D7EcTl7F.js} +1 -1
- package/dist/assets/{mr-IN-CRQNXWMA-Bj8iztNV.js → mr-IN-CRQNXWMA-CrLzfs9o.js} +1 -1
- package/dist/assets/{my-MM-5M5IBNSE-iyoTiAHD.js → my-MM-5M5IBNSE-UXEoKNRR.js} +1 -1
- package/dist/assets/{nb-NO-T6EIAALU-DSBUUwFJ.js → nb-NO-T6EIAALU-Cksz4o4S.js} +1 -1
- package/dist/assets/{nl-NL-IS3SIHDZ-B0opfM9r.js → nl-NL-IS3SIHDZ-DoJoWSgy.js} +1 -1
- package/dist/assets/{nn-NO-6E72VCQL-D167Jkm5.js → nn-NO-6E72VCQL-wts-HCgu.js} +1 -1
- package/dist/assets/{note-importer-iF9_wP3y.js → note-importer-Dto2FGfG.js} +2 -2
- package/dist/assets/{oc-FR-POXYY2M6-DSDlkeYA.js → oc-FR-POXYY2M6-DEWCqiB6.js} +1 -1
- package/dist/assets/{pa-IN-N4M65BXN-HYzDDCI1.js → pa-IN-N4M65BXN-DnZ9lTGB.js} +1 -1
- package/dist/assets/{pegDiagram-VL7TDLO6-D27B6QZv.js → pegDiagram-VL7TDLO6-DXBDnNrL.js} +1 -1
- package/dist/assets/percentages-BXMCSKIN-BYWjblP6.js +1 -0
- package/dist/assets/{pieDiagram-7S7Q4E2Y-CUIO6ZsJ.js → pieDiagram-7S7Q4E2Y-cwpSMbnZ.js} +1 -1
- package/dist/assets/{pl-PL-T2D74RX3-CORaZ-__.js → pl-PL-T2D74RX3-CKm5y1W9.js} +1 -1
- package/dist/assets/{pt-BR-5N22H2LF-BS1QnMWx.js → pt-BR-5N22H2LF-Cvr-aWC1.js} +1 -1
- package/dist/assets/{pt-PT-UZXXM6DQ-Bq9Ith3m.js → pt-PT-UZXXM6DQ-C2qRjySg.js} +1 -1
- package/dist/assets/{quadrantDiagram-CIZ2JOQS-DKETRRdw.js → quadrantDiagram-CIZ2JOQS-eWk7Aerk.js} +1 -1
- package/dist/assets/{railroadDiagram-AXF67PYL-CdqstxHS.js → railroadDiagram-AXF67PYL-B7CGvgJk.js} +1 -1
- package/dist/assets/{requirementDiagram-LRYGKXZP-CMoFj1Wc.js → requirementDiagram-LRYGKXZP-tqwmIOsS.js} +1 -1
- package/dist/assets/{ro-RO-JPDTUUEW-DczFVCK0.js → ro-RO-JPDTUUEW-PmNWA823.js} +1 -1
- package/dist/assets/{ru-RU-B4JR7IUQ-zrDqyjuB.js → ru-RU-B4JR7IUQ-DYG2yHwc.js} +1 -1
- package/dist/assets/{sankeyDiagram-W5VNT64P-CY7WtIuA.js → sankeyDiagram-W5VNT64P-Dz3IpZ2G.js} +1 -1
- package/dist/assets/{sequenceDiagram-SI44F4Z6-B-T5d08H.js → sequenceDiagram-SI44F4Z6-GLzINRW2.js} +1 -1
- package/dist/assets/{si-LK-N5RQ5JYF-fPQ5hCHv.js → si-LK-N5RQ5JYF-313JBkVE.js} +1 -1
- package/dist/assets/{sk-SK-C5VTKIMK-C7BrINOu.js → sk-SK-C5VTKIMK-CvIsq8y8.js} +1 -1
- package/dist/assets/{sl-SI-NN7IZMDC-CGIq63WU.js → sl-SI-NN7IZMDC-CDdMXtOw.js} +1 -1
- package/dist/assets/{stateDiagram-OKZ733FA-CUWuX1W8.js → stateDiagram-OKZ733FA-BHXyF9Wq.js} +1 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-DofToG_K.js +1 -0
- package/dist/assets/subset-shared.chunk-DAy_nMUU.js +1 -0
- package/dist/assets/{subset-worker.chunk-BXR0VyZX.js → subset-worker.chunk-DyHtHnQt.js} +1 -1
- package/dist/assets/{sv-SE-XGPEYMSR-CVLKo7cZ.js → sv-SE-XGPEYMSR-DOhe-zUw.js} +1 -1
- package/dist/assets/{swimlanes-SLNWSIFB-C0BQWQRj.js → swimlanes-SLNWSIFB-CB-S9KkC.js} +1 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-BL_d62JR.js +8 -0
- package/dist/assets/{ta-IN-2NMHFXQM-CdxiWU2y.js → ta-IN-2NMHFXQM-BMP10iOH.js} +1 -1
- package/dist/assets/{th-TH-HPSO5L25-DAliTgyC.js → th-TH-HPSO5L25-1mbI-czB.js} +1 -1
- package/dist/assets/{timeline-definition-Z64GVDOM-s3dn0R6m.js → timeline-definition-Z64GVDOM-Cyu1nCOR.js} +1 -1
- package/dist/assets/{tr-TR-DEFEU3FU-UCNe7rMM.js → tr-TR-DEFEU3FU-Wy67R3VT.js} +1 -1
- package/dist/assets/{uk-UA-QMV73CPH-B2_N2PJN.js → uk-UA-QMV73CPH-BMHP-X3H.js} +1 -1
- package/dist/assets/{vennDiagram-T6HMQDX7-DDl_H4hk.js → vennDiagram-T6HMQDX7-3SYGyxoS.js} +1 -1
- package/dist/assets/{vi-VN-M7AON7JQ-BTtOpGCI.js → vi-VN-M7AON7JQ-DT0VDP9G.js} +1 -1
- package/dist/assets/{wardleyDiagram-T6FBY63Y-9YOdVQBr.js → wardleyDiagram-T6FBY63Y-CkUKeeqQ.js} +1 -1
- package/dist/assets/{xychartDiagram-ELKLHX3M-hw9EMP9D.js → xychartDiagram-ELKLHX3M-DmA_xeAt.js} +1 -1
- package/dist/assets/{zh-CN-LNUGB5OW-Cap66XAb.js → zh-CN-LNUGB5OW-ll96CfZl.js} +1 -1
- package/dist/assets/{zh-HK-E62DVLB3-C7Tp27Pz.js → zh-HK-E62DVLB3-CVVeADj5.js} +1 -1
- package/dist/assets/{zh-TW-RAJ6MFWO-BcVDi11y.js → zh-TW-RAJ6MFWO-Dpd57l-N.js} +1 -1
- package/dist/index.html +3 -3
- package/dist-server/index.js +138 -138
- package/package.json +1 -1
- package/dist/assets/channel-Bj-EvaE9.js +0 -1
- package/dist/assets/classDiagram-JCYQIIEL-QsDNWCFN.js +0 -1
- package/dist/assets/classDiagram-v2-OCEON4UE-QsDNWCFN.js +0 -1
- package/dist/assets/flowDiagram-UKHOOZJN-DBfgBMwA.js +0 -1
- package/dist/assets/image-GAAHSSAO-DBRlpNYg.js +0 -1
- package/dist/assets/percentages-BXMCSKIN-vLCddYnx.js +0 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-0SggpZ-_.js +0 -1
- package/dist/assets/subset-shared.chunk-CC0NsaPQ.js +0 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-sauIdk6n.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-BAQH6VUv.js";import{Kt as a}from"./index-
|
|
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-BAQH6VUv.js";import{Kt as a}from"./index-D_7xzFLd.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-
|
|
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-Br57T-Kq.js";import{n as a}from"./WorkspaceContext-O7njKDwj.js";import{gn as o}from"./index-D_7xzFLd.js";import{n as s}from"./ERDComments-C8fNJVjv.js";import{FlowchartView as c}from"./FlowchartView-B5bGHefb.js";import{t as l}from"./ProjectFileTabs-YN19u31w.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&&e.getFileAccessRole(f)!==`viewer`&&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),userId:String(e.user.id),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||e.isReadOnlyFile(f),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{n as r}from"./dist-D0tkMM_Y.js";import{a as i,b as a,c as o,d as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as ee,t as te,u as ne,x as g,y as _}from"./downloadSVG-C2LckkLx.js";import{a as v,h as re,r as ie}from"./esm-B1WURL1q.js";import{t as y}from"./button-D2dALS3q.js";import{i as b,n as x,o as S,s as C,t as w}from"./select-xSghKb2x.js";import{I as T,b as ae,o as oe}from"./CommentThreadView-Dx7ndjrK.js";import{t as se}from"./check-Uq0GkTkz.js";import{n as E,t as ce}from"./move-BzTcfKj2.js";import{A as D,C as le,M as ue,T as O,j as de,w as k}from"./hover-card-CqLOdc_X.js";import{t as fe}from"./plus-DfXp3YpY.js";import{a as A,c as pe,d as me,i as j,l as M,n as N,o as P,s as F,t as I}from"./dialog-EJdgZKa4.js";import{t as L}from"./trash-2-BmZK7fDJ.js";import{t as he}from"./undo-2-FZYgYKq2.js";import{t as ge}from"./card-DFJ6ytRY.js";import{t as R}from"./input-BUIkeoB3.js";import{n as _e}from"./WorkspaceContext-O7njKDwj.js";import{t as z}from"./label-CCjvjYto.js";import{A as ve,D as ye,Kt as be,O as xe,en as Se,gn as Ce,j as we,k as Te}from"./index-pNTxMoqm.js";import{i as Ee,r as De,t as Oe}from"./ERDComments-BUHJbOth.js";import{t as ke}from"./JumpToNode-C1cRpO0L.js";var B=e(t(),1),V=n(),H=(0,B.memo)(({data:e,id:t,selected:n})=>{let[r,i]=(0,B.useState)(!1),a=`!w-1.5 !h-1.5 !bg-white !border-none opacity-0 group-hover:opacity-100 transition-opacity z-20 cursor-crosshair`,o=(0,B.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]),s=(0,B.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]),c=(0,B.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,V.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,V.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,V.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,V.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,V.jsx)(`div`,{className:`absolute inset-0 rounded-[50px] pointer-events-none`,style:t});case`circle`:return(0,V.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,V.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,V.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,V.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,V.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,V.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,V.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,V.jsx)(`path`,{d:`M70,2 V30 H98`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`})]});case`cloud`:return(0,V.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,V.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,V.jsx)(`div`,{className:`absolute inset-0 rounded-md pointer-events-none`,style:t})}},[e.color,e.shape,n]),l=(0,V.jsxs)(`div`,{className:`relative group flex items-center justify-center cursor-pointer transition-all duration-300 hover:scale-[1.02] ${o}`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{aspectRatio:e.shape===`circle`?`1 / 1`:`auto`},children:[(0,V.jsx)(d,{isVisible:!e._readOnly&&(n||r),keepAspectRatio:e.shape===`circle`,minWidth:s.width,minHeight:s.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`}}),c,e._commentsEnabled&&(0,V.jsx)(`div`,{className:`absolute -right-2 -top-2 z-60`,children:(0,V.jsx)(Oe,{anchor:{type:`shape`,id:t}})}),(0,V.jsx)(m,{id:`top`,type:`target`,position:v.Top,className:a}),(0,V.jsx)(m,{id:`top`,type:`source`,position:v.Top,className:a}),(0,V.jsx)(m,{id:`bottom`,type:`target`,position:v.Bottom,className:a}),(0,V.jsx)(m,{id:`bottom`,type:`source`,position:v.Bottom,className:a}),(0,V.jsx)(m,{id:`right`,type:`target`,position:v.Right,className:a}),(0,V.jsx)(m,{id:`right`,type:`source`,position:v.Right,className:a}),(0,V.jsx)(m,{id:`left`,type:`target`,position:v.Left,className:a}),(0,V.jsx)(m,{id:`left`,type:`source`,position:v.Left,className:a}),(0,V.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,V.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,V.jsxs)(le,{children:[(0,V.jsx)(D,{className:`contents`,children:l}),(0,V.jsx)(k,{className:`min-w-36`,positionerClassName:`z-[210]`,children:(0,V.jsxs)(O,{onClick:e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent(De,{detail:{type:`shape`,id:t}}))},children:[(0,V.jsx)(be,{"aria-hidden":`true`}),`Comment`]})})]}):l}),U=e=>e.trim().toLowerCase().includes(`start`);function Ae({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=U(n.label);return(0,V.jsx)(I,{open:e,onOpenChange:t,children:(0,V.jsxs)(j,{className:`sm:max-w-sm`,children:[(0,V.jsxs)(F,{children:[(0,V.jsx)(M,{children:`Create New Symbol`}),(0,V.jsx)(A,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,V.jsxs)(N,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Label`}),(0,V.jsx)(R,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Group Title`}),(0,V.jsx)(R,{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,V.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Shape Type`}),(0,V.jsxs)(w,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select a shape`,children:n.shape?p[n.shape]:`Select a shape`})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`rectangle`,children:`Rectangle (Process)`}),(0,V.jsx)(b,{value:`oval`,children:`Oval (Start/End)`}),(0,V.jsx)(b,{value:`diamond`,children:`Diamond (Decision)`}),(0,V.jsx)(b,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,V.jsx)(b,{value:`database`,children:`Cylinder (Database)`}),(0,V.jsx)(b,{value:`document`,children:`Document`}),(0,V.jsx)(b,{value:`cloud`,children:`Cloud (External System)`}),(0,V.jsx)(b,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Color`}),(0,V.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:l.map(e=>(0,V.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,V.jsxs)(P,{children:[(0,V.jsx)(y,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,V.jsx)(y,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function je(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?je(n):!1,[c,u]=(0,B.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),d=e=>{u(e),r({code:e})};return(0,V.jsx)(I,{open:!!e,onOpenChange:e=>{e||t()},children:(0,V.jsxs)(j,{className:`sm:max-w-sm`,children:[(0,V.jsxs)(F,{children:[(0,V.jsx)(M,{children:`Symbol Properties`}),(0,V.jsx)(A,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,V.jsxs)(N,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Label`}),(0,V.jsx)(R,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,V.jsx)(`textarea`,{value:c,onChange:e=>d(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,V.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,V.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Group Title`}),(0,V.jsx)(R,{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,V.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Shape Type`}),(0,V.jsxs)(w,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select a shape`,children:n.data.shape?p[n.data.shape]:`Select a shape`})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`rectangle`,children:`Rectangle (Process)`}),(0,V.jsx)(b,{value:`oval`,children:`Oval (Start/End)`}),(0,V.jsx)(b,{value:`diamond`,children:`Diamond (Decision)`}),(0,V.jsx)(b,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,V.jsx)(b,{value:`database`,children:`Cylinder (Database)`}),(0,V.jsx)(b,{value:`document`,children:`Document`}),(0,V.jsx)(b,{value:`cloud`,children:`Cloud (External System)`}),(0,V.jsx)(b,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Color`}),(0,V.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:l.map(e=>(0,V.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,V.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,V.jsxs)(y,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,V.jsx)(L,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,V.jsxs)(y,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,V.jsx)(L,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Ne({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:a,onEdgeTypeChange:o,onArrowChange:s,onLabelChange:c,onDeleteEdge:l}){return(0,V.jsx)(I,{open:!!e,onOpenChange:e=>{e||t()},children:(0,V.jsxs)(j,{className:`sm:max-w-sm`,children:[(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,V.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,V.jsx)(M,{children:`Connector Properties`}),(0,V.jsx)(A,{children:`Format the line style and arrows.`})]}),(0,V.jsx)(y,{variant:`ghost`,size:`icon`,onClick:l,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,children:(0,V.jsx)(L,{className:`w-4 h-4`})})]})}),n&&(0,V.jsxs)(N,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Text Label`}),(0,V.jsx)(R,{value:typeof n.label==`string`?n.label:``,onChange:e=>c(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Line Style`}),(0,V.jsxs)(w,{value:r?`dashed`:`solid`,onValueChange:e=>o(e||``),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select line style`,children:i[r?`dashed`:`solid`]})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`solid`,children:`Solid Line`}),(0,V.jsx)(b,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Arrow Style`}),(0,V.jsxs)(w,{value:a,onValueChange:e=>s(e||``),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select arrow style`,children:h[a]})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`end`,children:`Arrow at End`}),(0,V.jsx)(b,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,V.jsx)(b,{value:`both`,children:`Arrows Both Ends`}),(0,V.jsx)(b,{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,B.useState)(null),u=(0,B.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,V.jsxs)(I,{open:!0,onOpenChange:e=>{e||r()},children:[(0,V.jsx)(pe,{}),(0,V.jsxs)(j,{size:`2xl`,showCloseButton:!0,children:[(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`size-8 rounded-lg bg-indigo-500/10 flex items-center justify-center`,children:(0,V.jsx)(Ce,{className:`size-4 text-indigo-400`})}),(0,V.jsx)(`div`,{children:(0,V.jsx)(M,{children:`Preview Changes`})})]})}),(0,V.jsx)(N,{children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.length>0&&(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`New Symbols (`,e.length,`)`]}),(0,V.jsx)(`div`,{className:`max-h-75 overflow-y-auto custom-scrollbar space-y-2`,children:e.map(e=>(0,V.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-2 border-b border-border/20 bg-muted/50`,children:[(0,V.jsx)(Ce,{className:`size-3 text-indigo-400 shrink-0`}),(0,V.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.data.label}),(0,V.jsx)(`span`,{className:`text-[9px] text-muted-foreground ml-auto`,children:e.data.shape})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono`,children:[(0,V.jsx)(`span`,{className:`text-gray-500`,children:`Shape:`}),(0,V.jsx)(`span`,{className:`text-gray-300`,children:e.data.shape}),e.data.color&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`text-gray-500 ml-2`,children:`Color:`}),(0,V.jsx)(`span`,{className:`text-gray-300`,children:e.data.color})]})]})]},e.id))})]}),u&&(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Changes`}),(0,V.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,V.jsx)(`div`,{className:`divide-y divide-border/10`,children:u.map((e,t)=>{if(e.type===`header`)return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border/30`,children:[e.isNew&&(0,V.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,V.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,V.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-0.5 ${a}`,children:[(0,V.jsx)(`span`,{className:`w-4 shrink-0 select-none ${o}`,children:e.prefix}),(0,V.jsx)(`span`,{className:`w-20 shrink-0 ${c}`,children:e.field}),e.oldVal&&(0,V.jsx)(`span`,{className:`text-red-400/70 line-through`,children:e.oldVal}),e.oldVal&&e.newVal&&(0,V.jsx)(`span`,{className:`text-gray-600`,children:`→`}),e.newVal&&(0,V.jsx)(`span`,{className:s,children:e.newVal})]},t)})})})]}),!u&&!e.length&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes detected.`})]})}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 pt-4 pb-6`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-3`,children:a.length>0&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(E,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Replace:`}),(0,V.jsxs)(w,{value:c??``,onValueChange:e=>l(e||null),children:[(0,V.jsx)(S,{className:`h-7 text-[12px]`,children:(0,V.jsx)(C,{placeholder:`All Symbols`})}),(0,V.jsxs)(x,{children:[(0,V.jsx)(b,{value:``,children:`All Symbols`}),a.map(e=>(0,V.jsx)(b,{value:e,children:e},e))]})]})]})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(y,{variant:`outline`,size:`sm`,onClick:r,className:`gap-2`,children:[(0,V.jsx)(me,{className:`size-4`}),`Cancel`]}),(0,V.jsxs)(y,{size:`sm`,onClick:()=>n(c||void 0),className:`gap-2`,children:[(0,V.jsx)(se,{className:`size-4`}),i]})]})]})]})]})}function W(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 Fe(e,t){return W(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function Ie(e,t){let n=[`top`,`bottom`,`left`,`right`],r=W(e.position),i=W(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 Le(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 G(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{n as r}from"./dist-D0tkMM_Y.js";import{a as i,b as a,c as o,d as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as ee,t as te,u as ne,x as g,y as _}from"./downloadSVG-C2LckkLx.js";import{a as v,h as re,r as ie}from"./esm-B1WURL1q.js";import{t as y}from"./button-D2dALS3q.js";import{i as b,n as x,o as S,s as C,t as w}from"./select-xSghKb2x.js";import{I as T,b as ae,o as oe}from"./CommentThreadView-Dx7ndjrK.js";import{t as se}from"./check-Uq0GkTkz.js";import{n as E,t as ce}from"./move-BzTcfKj2.js";import{A as D,C as le,M as ue,T as O,j as de,w as k}from"./hover-card-CqLOdc_X.js";import{t as fe}from"./plus-DfXp3YpY.js";import{a as A,c as pe,d as me,i as j,l as M,n as N,o as P,s as F,t as I}from"./dialog-EJdgZKa4.js";import{t as L}from"./trash-2-BmZK7fDJ.js";import{t as he}from"./undo-2-FZYgYKq2.js";import{t as ge}from"./card-DFJ6ytRY.js";import{t as R}from"./input-BUIkeoB3.js";import{n as _e}from"./WorkspaceContext-O7njKDwj.js";import{t as z}from"./label-CCjvjYto.js";import{A as ve,D as ye,Kt as be,O as xe,en as Se,gn as Ce,j as we,k as Te}from"./index-D_7xzFLd.js";import{i as Ee,r as De,t as Oe}from"./ERDComments-C8fNJVjv.js";import{t as ke}from"./JumpToNode-BThjKSZV.js";var B=e(t(),1),V=n(),H=(0,B.memo)(({data:e,id:t,selected:n})=>{let[r,i]=(0,B.useState)(!1),a=`!w-1.5 !h-1.5 !bg-white !border-none opacity-0 group-hover:opacity-100 transition-opacity z-20 cursor-crosshair`,o=(0,B.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]),s=(0,B.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]),c=(0,B.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,V.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,V.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,V.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,V.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,V.jsx)(`div`,{className:`absolute inset-0 rounded-[50px] pointer-events-none`,style:t});case`circle`:return(0,V.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,V.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,V.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,V.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,V.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,V.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,V.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,V.jsx)(`path`,{d:`M70,2 V30 H98`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`})]});case`cloud`:return(0,V.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,V.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,V.jsx)(`div`,{className:`absolute inset-0 rounded-md pointer-events-none`,style:t})}},[e.color,e.shape,n]),l=(0,V.jsxs)(`div`,{className:`relative group flex items-center justify-center cursor-pointer transition-all duration-300 hover:scale-[1.02] ${o}`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{aspectRatio:e.shape===`circle`?`1 / 1`:`auto`},children:[(0,V.jsx)(d,{isVisible:!e._readOnly&&(n||r),keepAspectRatio:e.shape===`circle`,minWidth:s.width,minHeight:s.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`}}),c,e._commentsEnabled&&(0,V.jsx)(`div`,{className:`absolute -right-2 -top-2 z-60`,children:(0,V.jsx)(Oe,{anchor:{type:`shape`,id:t}})}),(0,V.jsx)(m,{id:`top`,type:`target`,position:v.Top,className:a}),(0,V.jsx)(m,{id:`top`,type:`source`,position:v.Top,className:a}),(0,V.jsx)(m,{id:`bottom`,type:`target`,position:v.Bottom,className:a}),(0,V.jsx)(m,{id:`bottom`,type:`source`,position:v.Bottom,className:a}),(0,V.jsx)(m,{id:`right`,type:`target`,position:v.Right,className:a}),(0,V.jsx)(m,{id:`right`,type:`source`,position:v.Right,className:a}),(0,V.jsx)(m,{id:`left`,type:`target`,position:v.Left,className:a}),(0,V.jsx)(m,{id:`left`,type:`source`,position:v.Left,className:a}),(0,V.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,V.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,V.jsxs)(le,{children:[(0,V.jsx)(D,{className:`contents`,children:l}),(0,V.jsx)(k,{className:`min-w-36`,positionerClassName:`z-[210]`,children:(0,V.jsxs)(O,{onClick:e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent(De,{detail:{type:`shape`,id:t}}))},children:[(0,V.jsx)(be,{"aria-hidden":`true`}),`Comment`]})})]}):l}),U=e=>e.trim().toLowerCase().includes(`start`);function Ae({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=U(n.label);return(0,V.jsx)(I,{open:e,onOpenChange:t,children:(0,V.jsxs)(j,{className:`sm:max-w-sm`,children:[(0,V.jsxs)(F,{children:[(0,V.jsx)(M,{children:`Create New Symbol`}),(0,V.jsx)(A,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,V.jsxs)(N,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Label`}),(0,V.jsx)(R,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Group Title`}),(0,V.jsx)(R,{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,V.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Shape Type`}),(0,V.jsxs)(w,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select a shape`,children:n.shape?p[n.shape]:`Select a shape`})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`rectangle`,children:`Rectangle (Process)`}),(0,V.jsx)(b,{value:`oval`,children:`Oval (Start/End)`}),(0,V.jsx)(b,{value:`diamond`,children:`Diamond (Decision)`}),(0,V.jsx)(b,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,V.jsx)(b,{value:`database`,children:`Cylinder (Database)`}),(0,V.jsx)(b,{value:`document`,children:`Document`}),(0,V.jsx)(b,{value:`cloud`,children:`Cloud (External System)`}),(0,V.jsx)(b,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Color`}),(0,V.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:l.map(e=>(0,V.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,V.jsxs)(P,{children:[(0,V.jsx)(y,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,V.jsx)(y,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function je(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?je(n):!1,[c,u]=(0,B.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),d=e=>{u(e),r({code:e})};return(0,V.jsx)(I,{open:!!e,onOpenChange:e=>{e||t()},children:(0,V.jsxs)(j,{className:`sm:max-w-sm`,children:[(0,V.jsxs)(F,{children:[(0,V.jsx)(M,{children:`Symbol Properties`}),(0,V.jsx)(A,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,V.jsxs)(N,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Label`}),(0,V.jsx)(R,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,V.jsx)(`textarea`,{value:c,onChange:e=>d(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,V.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,V.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Group Title`}),(0,V.jsx)(R,{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,V.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Shape Type`}),(0,V.jsxs)(w,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select a shape`,children:n.data.shape?p[n.data.shape]:`Select a shape`})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`rectangle`,children:`Rectangle (Process)`}),(0,V.jsx)(b,{value:`oval`,children:`Oval (Start/End)`}),(0,V.jsx)(b,{value:`diamond`,children:`Diamond (Decision)`}),(0,V.jsx)(b,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,V.jsx)(b,{value:`database`,children:`Cylinder (Database)`}),(0,V.jsx)(b,{value:`document`,children:`Document`}),(0,V.jsx)(b,{value:`cloud`,children:`Cloud (External System)`}),(0,V.jsx)(b,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Color`}),(0,V.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:l.map(e=>(0,V.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,V.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,V.jsxs)(y,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,V.jsx)(L,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,V.jsxs)(y,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,V.jsx)(L,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Ne({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:a,onEdgeTypeChange:o,onArrowChange:s,onLabelChange:c,onDeleteEdge:l}){return(0,V.jsx)(I,{open:!!e,onOpenChange:e=>{e||t()},children:(0,V.jsxs)(j,{className:`sm:max-w-sm`,children:[(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,V.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,V.jsx)(M,{children:`Connector Properties`}),(0,V.jsx)(A,{children:`Format the line style and arrows.`})]}),(0,V.jsx)(y,{variant:`ghost`,size:`icon`,onClick:l,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,children:(0,V.jsx)(L,{className:`w-4 h-4`})})]})}),n&&(0,V.jsxs)(N,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Text Label`}),(0,V.jsx)(R,{value:typeof n.label==`string`?n.label:``,onChange:e=>c(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Line Style`}),(0,V.jsxs)(w,{value:r?`dashed`:`solid`,onValueChange:e=>o(e||``),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select line style`,children:i[r?`dashed`:`solid`]})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`solid`,children:`Solid Line`}),(0,V.jsx)(b,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(z,{children:`Arrow Style`}),(0,V.jsxs)(w,{value:a,onValueChange:e=>s(e||``),children:[(0,V.jsx)(S,{className:`w-full bg-muted border-border text-foreground`,children:(0,V.jsx)(C,{placeholder:`Select arrow style`,children:h[a]})}),(0,V.jsxs)(x,{className:`bg-popover border-border text-popover-foreground`,children:[(0,V.jsx)(b,{value:`end`,children:`Arrow at End`}),(0,V.jsx)(b,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,V.jsx)(b,{value:`both`,children:`Arrows Both Ends`}),(0,V.jsx)(b,{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,B.useState)(null),u=(0,B.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,V.jsxs)(I,{open:!0,onOpenChange:e=>{e||r()},children:[(0,V.jsx)(pe,{}),(0,V.jsxs)(j,{size:`2xl`,showCloseButton:!0,children:[(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`size-8 rounded-lg bg-indigo-500/10 flex items-center justify-center`,children:(0,V.jsx)(Ce,{className:`size-4 text-indigo-400`})}),(0,V.jsx)(`div`,{children:(0,V.jsx)(M,{children:`Preview Changes`})})]})}),(0,V.jsx)(N,{children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.length>0&&(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`New Symbols (`,e.length,`)`]}),(0,V.jsx)(`div`,{className:`max-h-75 overflow-y-auto custom-scrollbar space-y-2`,children:e.map(e=>(0,V.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-2 border-b border-border/20 bg-muted/50`,children:[(0,V.jsx)(Ce,{className:`size-3 text-indigo-400 shrink-0`}),(0,V.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.data.label}),(0,V.jsx)(`span`,{className:`text-[9px] text-muted-foreground ml-auto`,children:e.data.shape})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono`,children:[(0,V.jsx)(`span`,{className:`text-gray-500`,children:`Shape:`}),(0,V.jsx)(`span`,{className:`text-gray-300`,children:e.data.shape}),e.data.color&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`text-gray-500 ml-2`,children:`Color:`}),(0,V.jsx)(`span`,{className:`text-gray-300`,children:e.data.color})]})]})]},e.id))})]}),u&&(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Changes`}),(0,V.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,V.jsx)(`div`,{className:`divide-y divide-border/10`,children:u.map((e,t)=>{if(e.type===`header`)return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border/30`,children:[e.isNew&&(0,V.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,V.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,V.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-0.5 ${a}`,children:[(0,V.jsx)(`span`,{className:`w-4 shrink-0 select-none ${o}`,children:e.prefix}),(0,V.jsx)(`span`,{className:`w-20 shrink-0 ${c}`,children:e.field}),e.oldVal&&(0,V.jsx)(`span`,{className:`text-red-400/70 line-through`,children:e.oldVal}),e.oldVal&&e.newVal&&(0,V.jsx)(`span`,{className:`text-gray-600`,children:`→`}),e.newVal&&(0,V.jsx)(`span`,{className:s,children:e.newVal})]},t)})})})]}),!u&&!e.length&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes detected.`})]})}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 pt-4 pb-6`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-3`,children:a.length>0&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(E,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Replace:`}),(0,V.jsxs)(w,{value:c??``,onValueChange:e=>l(e||null),children:[(0,V.jsx)(S,{className:`h-7 text-[12px]`,children:(0,V.jsx)(C,{placeholder:`All Symbols`})}),(0,V.jsxs)(x,{children:[(0,V.jsx)(b,{value:``,children:`All Symbols`}),a.map(e=>(0,V.jsx)(b,{value:e,children:e},e))]})]})]})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(y,{variant:`outline`,size:`sm`,onClick:r,className:`gap-2`,children:[(0,V.jsx)(me,{className:`size-4`}),`Cancel`]}),(0,V.jsxs)(y,{size:`sm`,onClick:()=>n(c||void 0),className:`gap-2`,children:[(0,V.jsx)(se,{className:`size-4`}),i]})]})]})]})]})}function W(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 Fe(e,t){return W(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function Ie(e,t){let n=[`top`,`bottom`,`left`,`right`],r=W(e.position),i=W(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 Le(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 G(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{a as r}from"./dist-D0tkMM_Y.js";import{S as i}from"./downloadSVG-C2LckkLx.js";import{t as a}from"./button-D2dALS3q.js";import{a as o,d as s,i as c,o as l,r as u,s as d,t as f}from"./dropdown-menu-BrGjsCp0.js";import{h as p}from"./select-xSghKb2x.js";import{s as m}from"./CommentThreadView-Dx7ndjrK.js";import{f as h}from"./dialog-EJdgZKa4.js";import{t as g}from"./input-BUIkeoB3.js";import{Xt as _}from"./index-
|
|
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}from"./dist-D0tkMM_Y.js";import{S as i}from"./downloadSVG-C2LckkLx.js";import{t as a}from"./button-D2dALS3q.js";import{a as o,d as s,i as c,o as l,r as u,s as d,t as f}from"./dropdown-menu-BrGjsCp0.js";import{h as p}from"./select-xSghKb2x.js";import{s as m}from"./CommentThreadView-Dx7ndjrK.js";import{f as h}from"./dialog-EJdgZKa4.js";import{t as g}from"./input-BUIkeoB3.js";import{Xt as _}from"./index-D_7xzFLd.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)(f,{open:x,onOpenChange:S,children:[(0,y.jsx)(s,{render:(0,y.jsxs)(a,{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)(p,{className:`w-3 h-3 ml-2 opacity-50`})]})}),(0,y.jsxs)(u,{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)(h,{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)(d,{className:`bg-border/50`}),(0,y.jsxs)(c,{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)(m,{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)(o,{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 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{n as r}from"./dist-D0tkMM_Y.js";import{c as i}from"./chunk-BV7QT456-CCzugQp2.js";import{t as a}from"./button-D2dALS3q.js";import{i as o,n as s,o as c,s as l,t as u}from"./select-xSghKb2x.js";import{t as d}from"./arrow-left-Cfq6LFs7.js";import{s as f}from"./useField-F6rVNyMc.js";import{t as p}from"./ConfirmModal-DqvHDAUo.js";import{t as m}from"./file-image-C1wgTBuF.js";import{t as h}from"./refresh-cw-Bmpxlvmc.js";import{t as g}from"./trash-2-BmZK7fDJ.js";import{t as _}from"./undo-2-FZYgYKq2.js";import{a as v,n as y}from"./api-BAQH6VUv.js";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./table-Bs3EelYM.js";import{Q as E,Z as D,Zn as O}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{n as r}from"./dist-D0tkMM_Y.js";import{c as i}from"./chunk-BV7QT456-CCzugQp2.js";import{t as a}from"./button-D2dALS3q.js";import{i as o,n as s,o as c,s as l,t as u}from"./select-xSghKb2x.js";import{t as d}from"./arrow-left-Cfq6LFs7.js";import{s as f}from"./useField-F6rVNyMc.js";import{t as p}from"./ConfirmModal-DqvHDAUo.js";import{t as m}from"./file-image-C1wgTBuF.js";import{t as h}from"./refresh-cw-Bmpxlvmc.js";import{t as g}from"./trash-2-BmZK7fDJ.js";import{t as _}from"./undo-2-FZYgYKq2.js";import{a as v,n as y}from"./api-BAQH6VUv.js";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./table-Bs3EelYM.js";import{Q as E,Z as D,Zn as O}from"./index-D_7xzFLd.js";var k=e(t(),1),A=n(),j=30,M={all:`All files`,unused:`Unused only`},N={size:`Largest first`,date:`Newest first`};function P(){let e=i(),[t,n]=(0,k.useState)(`all`),[P,F]=(0,k.useState)(`size`),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)([]),[B,V]=(0,k.useState)(!0),[H,U]=(0,k.useState)(null),[W,G]=(0,k.useState)(1),K=(0,k.useCallback)(async e=>{V(!0);try{let n=await y(`/api/library?filter=${t}&sort=${P}&page=${e}`);if(!n.ok)throw Error();let r=await n.json();if(L(r),r.items.length===0&&e>1){G(e-1);return}z(r.items)}catch{r.error(`The Library could not be loaded.`)}finally{V(!1)}},[t,P]);(0,k.useEffect)(()=>{K(W)},[K,W]);let q=async e=>{if(e.length===1){let t=await(await y(`/api/library/usage?key=${encodeURIComponent(e[0].key)}`)).json().catch(()=>({documents:[]}));if(t.documents?.length){let e=t.documents.map(e=>e.title+(e.isDeleted?` (in Trash)`:``)).join(`, `);r.error(`This image is still used by: ${e}. Remove it from those documents first.`);return}}U({items:e,message:`${e.length===1?`This image`:`${e.length} unused images`} will stop counting toward storage now and be removed for good after ${j} days. You can undo until then.`})},J=async()=>{let e=H?.items??[];U(null);let t=0;for(let n of e)(await y(`/api/library`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:n.key})})).ok||t++;t?r.error(`${t} image${t===1?` is`:`s are`} still in use and ${t===1?`was`:`were`} kept.`):r.success(e.length===1?`Image deleted`:`Unused images deleted`),K(W)},Y=async e=>{let t=await y(`/api/library/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e.key})}),n=await t.json().catch(()=>({}));if(!t.ok){r.error(n.error||`The image could not be restored.`);return}r.success(`Image restored`),K(W)},X=I?Math.max(1,Math.ceil(I.total/I.page_size)):1,Z=R.filter(e=>e.unused&&e.status===`committed`&&e.can_delete);return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border bg-background`,children:[(0,A.jsx)(`div`,{className:`shrink-0 border-b p-6`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(a,{variant:`ghost`,size:`sm`,className:`-ml-2 mb-2`,onClick:()=>e(-1),children:[(0,A.jsx)(d,{className:`mr-1 size-4`}),` Back`]}),(0,A.jsxs)(`h2`,{className:`flex items-center gap-2 text-2xl font-bold`,children:[(0,A.jsx)(m,{className:`size-6 text-muted-foreground`}),` Library`]}),(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Files uploaded to `,I?.scope===`user`?`your Personal Workspace`:`this Team workspace by all members`,`. Unused files still count toward storage until deleted.`]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,A.jsxs)(u,{value:t,onValueChange:e=>{e&&(n(e),G(1))},children:[(0,A.jsx)(c,{size:`sm`,"aria-label":`Filter`,className:`w-32`,children:(0,A.jsx)(l,{children:M[t]})}),(0,A.jsxs)(s,{children:[(0,A.jsx)(o,{value:`all`,children:M.all}),(0,A.jsx)(o,{value:`unused`,children:M.unused})]})]}),(0,A.jsxs)(u,{value:P,onValueChange:e=>{e&&(F(e),G(1))},children:[(0,A.jsx)(c,{size:`sm`,"aria-label":`Sort`,className:`w-36`,children:(0,A.jsx)(l,{children:N[P]})}),(0,A.jsxs)(s,{children:[(0,A.jsx)(o,{value:`size`,children:N.size}),(0,A.jsx)(o,{value:`date`,children:N.date})]})]}),(0,A.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>void K(W),disabled:B,children:[(0,A.jsx)(h,{className:`mr-1 size-4 ${B?`animate-spin`:``}`}),` Refresh`]}),I?.can_bulk_delete&&Z.length>0&&(0,A.jsxs)(a,{variant:`destructive`,size:`sm`,onClick:()=>void q(Z),children:[(0,A.jsx)(g,{className:`mr-1 size-4`}),` Delete unused (`,Z.length,`)`]})]})]})}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6 custom-scrollbar`,children:[R.length===0?!B&&(0,A.jsx)(`div`,{className:`rounded-lg border border-dashed py-12 text-center text-muted-foreground`,children:t===`unused`?`No unused files.`:`No files uploaded yet.`}):(0,A.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,A.jsxs)(T,{children:[(0,A.jsx)(b,{children:(0,A.jsxs)(C,{children:[(0,A.jsx)(x,{className:`w-20`,children:`Preview`}),(0,A.jsx)(x,{children:`File`}),(0,A.jsx)(x,{children:`Size`}),(0,A.jsx)(x,{children:`Uploaded`}),(0,A.jsx)(x,{className:`text-right`,children:`Actions`})]})}),(0,A.jsx)(S,{children:R.map(e=>(0,A.jsxs)(C,{children:[(0,A.jsx)(w,{children:e.mime_type.startsWith(`image/`)&&e.status===`committed`?(0,A.jsx)(`img`,{src:`${v()}/api/serve/${e.key}`,alt:``,loading:`lazy`,decoding:`async`,className:`h-12 w-16 rounded border object-cover`}):(0,A.jsx)(`div`,{className:`flex h-12 w-16 items-center justify-center rounded border text-muted-foreground`,children:(0,A.jsx)(m,{className:`size-5`})})}),(0,A.jsxs)(w,{children:[(0,A.jsx)(`div`,{className:`font-medium`,children:e.key.split(`/`).pop()}),(0,A.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[(0,A.jsx)(D,{variant:`outline`,className:`capitalize`,children:e.feature}),e.status===`deleted`?(0,A.jsxs)(D,{variant:`destructive`,children:[`Deleted · removed `,new Date(new Date(e.deleted_at||e.created_at).getTime()+j*864e5).toLocaleDateString()]}):e.unused?(0,A.jsx)(D,{variant:`secondary`,children:`Unused`}):null]})]}),(0,A.jsx)(w,{className:`text-sm`,children:E(e.bytes)}),(0,A.jsxs)(w,{className:`text-xs text-muted-foreground`,children:[new Date(e.created_at).toLocaleString(),e.uploaded_by_name&&(0,A.jsx)(`span`,{className:`block`,children:e.uploaded_by_name})]}),(0,A.jsx)(w,{className:`text-right`,children:e.can_delete?e.status===`deleted`?(0,A.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>void Y(e),children:[(0,A.jsx)(_,{className:`mr-1 size-4`}),` Undo`]}):(0,A.jsxs)(a,{variant:`destructive`,size:`sm`,onClick:()=>void q([e]),children:[(0,A.jsx)(g,{className:`mr-1 size-4`}),` Delete`]}):(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uploader or Manager only`})})]},e.key))})]})}),I&&X>1&&(0,A.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,A.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Page `,W,` of `,X,` · `,I.total,` files`]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Previous page`,disabled:W<=1||B,onClick:()=>G(W-1),children:(0,A.jsx)(O,{className:`h-4 w-4`})}),Array.from({length:X},(e,t)=>t+1).filter(e=>e===1||e===X||Math.abs(e-W)<=2).reduce((e,t,n,r)=>(n>0&&t-r[n-1]>1&&e.push(`ellipsis`),e.push(t),e),[]).map((e,t)=>e===`ellipsis`?(0,A.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`},`e-${t}`):(0,A.jsx)(a,{variant:e===W?`default`:`outline`,size:`icon-xs`,"aria-current":e===W?`page`:void 0,disabled:B,onClick:()=>G(e),className:e===W?``:`text-muted-foreground`,children:e},e)),(0,A.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Next page`,disabled:W>=X||B,onClick:()=>G(W+1),children:(0,A.jsx)(f,{className:`h-4 w-4`})})]})]})]}),(0,A.jsx)(p,{isOpen:H!==null,title:`Delete from Library?`,message:H?.message??``,confirmText:`Delete`,onConfirm:()=>void J(),onCancel:()=>U(null)})]})}export{P as LibraryRoute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView
|
|
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{l as i,u as a}from"./chunk-BV7QT456-CCzugQp2.js";import{t as o}from"./createLucideIcon-CyOWwA0s.js";import"./WorkspaceProvider-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView--7XXcBWJ.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/dist-D0tkMM_Y.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/createLucideIcon-CyOWwA0s.js","assets/alert-dialog-DK2RCz-0.js","assets/useBaseUiId-r-qiwcia.js","assets/button-D2dALS3q.js","assets/dropdown-menu-BrGjsCp0.js","assets/useOnFirstRender-1giFodLk.js","assets/select-xSghKb2x.js","assets/floating-ui.react-dom-OhALwEl4.js","assets/CompositeList-l_GSXRZM.js","assets/check-Uq0GkTkz.js","assets/useField-F6rVNyMc.js","assets/useControlled-CwUHqyRq.js","assets/useCompositeItem-DgcRHBrd.js","assets/CommentThreadView-Dx7ndjrK.js","assets/dialog-EJdgZKa4.js","assets/api-BAQH6VUv.js","assets/link-2-C71ROdND.js","assets/arrow-left-Cfq6LFs7.js","assets/ConfirmModal-DqvHDAUo.js","assets/wand-sparkles-DfkrzvIR.js","assets/calendar-CsxtM8Ee.js","assets/note-importer-Dto2FGfG.js","assets/image-compression-DagnqRIG.js","assets/index-D_7xzFLd.js","assets/downloadSVG-C2LckkLx.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/vanilla--C5Lp_AM.js","assets/copy-CIp5gOrB.js","assets/hard-drive-B6OfPqtv.js","assets/w3c-keyname-CHFwa9la.js","assets/input-BUIkeoB3.js","assets/plus-DfXp3YpY.js","assets/refresh-cw-Bmpxlvmc.js","assets/sparkles-BKYYqRE2.js","assets/trash-2-BmZK7fDJ.js","assets/card-DFJ6ytRY.js","assets/checkbox-CFF_zUIN.js","assets/minus-d4YlhnV9.js","assets/table-Bs3EelYM.js","assets/fileOwnership-DvxzSccE.js","assets/WorkspaceProvider-Br57T-Kq.js","assets/localPersistence-CjYRImp1.js","assets/useAuth-CQkE8axg.js","assets/diagramVersioning-BcJWSqo3.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/WorkspaceContext-O7njKDwj.js","assets/label-CCjvjYto.js","assets/textarea-D2E-6RLc.js","assets/extends-CvVTau-c.js","assets/index-CpmJMylY.css","assets/file-image-C1wgTBuF.js","assets/image-rU2A9CMJ.js","assets/move-BzTcfKj2.js","assets/hover-card-CqLOdc_X.js","assets/refresh-ccw-otI6Z4JU.js","assets/undo-2-FZYgYKq2.js","assets/user-x-Drb9lgxy.js","assets/user-cog-DrTVVVeT.js","assets/Combination-ODHvOWIL.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{l as i,u as a}from"./chunk-BV7QT456-CCzugQp2.js";import{t as o}from"./createLucideIcon-CyOWwA0s.js";import"./WorkspaceProvider-Br57T-Kq.js";import{n as s}from"./WorkspaceContext-O7njKDwj.js";import{t as c}from"./ProjectFileTabs-YN19u31w.js";var l=o(`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`}]]),u=e(t(),1),d=n(),f=u.lazy(()=>r(()=>import(`./NotesView--7XXcBWJ.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,59,60,61,62,63,64,65,66,67])));function p(){let e=s(),t=i(),{id:n}=a(),{activeNote:r,activeNoteUid:o,saveNote:p,handleNoteChange:m,deleteNote:h,isPublicView:g,isLoading:_,isNoteItemLoading:v,handleNoteSelect:y}=e,b=(0,u.useRef)(!1);(0,u.useEffect)(()=>{if(!(g||!n)&&!b.current){if(o===n){b.current=!0;return}o||(b.current=!0,y(n))}},[n,o,g,y]);let x=r?.project_id??r?.projectId,S=e.projects.find(e=>String(e.id)===String(x)),C=S?.team_id??S?.teamId,w=!g&&!e.isGuest&&e.getFileAccessRole(r)!==`viewer`&&C&&t?.activeTeamId&&String(C)===String(t.activeTeamId)&&r?.uid?{projectId:String(x),teamId:String(t.activeTeamId),featureType:`note`,fileId:String(r.uid)}:null;return!g&&!o?n&&!b.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 note...`})]}):(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 note to view`})}):!r&&!v?(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(l,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Note not found`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This note may have been deleted or is no longer available.`})]}):r?(0,d.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,d.jsx)(c,{currentView:`notes`}),(0,d.jsx)(u.Suspense,{fallback:(0,d.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,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)(`span`,{className:`text-xs text-muted-foreground/60 animate-pulse`,children:`Loading note...`})]})}),children:(0,d.jsx)(f,{isLoading:v,activeNoteUid:g?null:o,activeNote:r,saveNote:p,handleNoteChange:m,deleteNote:h,isReadOnly:g||e.isReadOnlyFile(r),commentFile:w})})]}):(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 note...`})]})}export{p as NoteEditorRoute,l as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{n as r}from"./dist-D0tkMM_Y.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{_ as a,d as o,h as s,l as c,u as l,v as u,y as d}from"./downloadSVG-C2LckkLx.js";import{ct as ee,h as te,r as ne,t as f}from"./esm-B1WURL1q.js";import{U as p}from"./alert-dialog-DK2RCz-0.js";import{t as m}from"./button-D2dALS3q.js";import{n as re}from"./calendar-khMoEUuA.js";import{M as ie}from"./hover-card-CqLOdc_X.js";import{t as ae}from"./plus-DfXp3YpY.js";import{n as h}from"./api-BAQH6VUv.js";import{v as g}from"./WorkspaceProvider-Dhoj0Xbq.js";import{E as _,a as v}from"./note-importer-iF9_wP3y.js";import{t as y}from"./localPersistence-CjYRImp1.js";import{n as b}from"./WorkspaceContext-O7njKDwj.js";import{I as oe,S as se,en as x}from"./index-pNTxMoqm.js";import"./ERDComments-BUHJbOth.js";import{a as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./erd-edge-style-DZEKHO4a.js";var k=e(t(),1);function A(e){if(!e)return null;try{return typeof e==`string`?JSON.parse(e):e}catch{return null}}function j(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 M(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(j)}}}function ce(e){let t=A(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(M),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 N(e,t){return O(e,t?[t]:[])}var P=n(),F={entity:T},I=(0,k.lazy)(()=>i(()=>import(`./FlowchartView-DciDbtr_.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,56,57,58,59,60,61,62,63]))),L=(0,k.lazy)(()=>i(()=>import(`./ExcalidrawEditor-DqJMng9N.js`),__vite__mapDeps([64,1,2,3,25,8,9,10,15,24,52,33,59,35,36,4,5,6,7,12,13,14,21,11,16,17,18,19,22,20,23,37,38,39,40,41,42,43,32,28,44,45,29,31,46,47,48,49,50,51,53,54,55,56,57,34,58,60,65,66])));async function R(e,t,n){if(n){let n=e===`erd`?`erd`:e===`flowchart`?`flowchart`:`drawings`;return await y.getResource(t)||((await y.getAllResources(n)).find(e=>String(e.uid??e.id)===t)??null)}let r=await h(`/api/${e===`erd`?`diagrams`:e===`flowchart`?`flowcharts`:`drawings`}/${t}`);return r.ok?r.json():null}function z({document:e,previewSchema:t,previewKey:n}){let i=(0,k.useMemo)(()=>ce(e),[e]),{isGuest:s,resolvedTheme:p}=b(),[x,T]=(0,k.useState)(i.nodes),[O,A]=(0,k.useState)(i.edges),[j,M]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(null),[B,V]=(0,k.useState)([]),[H,U]=(0,k.useState)(!1),W=(0,k.useRef)(x),G=(0,k.useRef)(O),K=(0,k.useRef)(null),q=(0,k.useMemo)(()=>g(e),[e]),J=q??{x:0,y:0,zoom:1},Y=(0,k.useRef)(J);W.current=x,G.current=O;let X=(0,k.useCallback)((t,n)=>{K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let i=t.map(e=>({...e.data,x:e.position.x,y:e.position.y})),a=n.map(_),o=v(t,n);try{if(s){let t=await y.getResource(e.uid??e.id);t&&await y.saveResource({...t,entities:i,relationships:a,data:null,dbml_source:o,viewport_x:Y.current.x,viewport_y:Y.current.y,viewport_zoom:Y.current.zoom,updated_at:new Date().toISOString()})}else if(!(await h(`/api/diagrams/save/${e.uid??e.id}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entities:i,relationships:a,viewport:Y.current,data:null,dbmlSource:o})})).ok)throw Error()}catch{r.error(`Could not save ERD changes`)}},350)},[e.id,e.uid,s]);(0,k.useEffect)(()=>{if(!(!t||!n))try{let e=re(W.current,G.current,`erd-generate-sql`,t);if(!e)throw Error();let n=C(W.current,G.current,e.nodes,e.edges);if(n.changes.length===0){z(null),r.success(`No schema changes found`);return}M(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{r.error(`Could not parse the schema for diff`)}},[n,t]);let le=(0,k.useCallback)(()=>{if(!R)return;let e=E(R.originalNodes,R.originalEdges,R.proposedNodes,R.proposedEdges,R.result,B);T(e.nodes),A(e.edges),z(null),X(e.nodes,e.edges),r.success(`Schema changes merged successfully`)},[B,R,X]),ue=(0,k.useCallback)(e=>{let t=u(e,W.current);T(t),e.some(e=>e.type!==`select`&&e.type!==`dimensions`)&&X(t,G.current)},[X]),de=(0,k.useCallback)(e=>{let t=a(e,G.current);A(t),e.some(e=>e.type!==`select`)&&X(W.current,t)},[X]),fe=(0,k.useCallback)(e=>{let t=te({...e,id:crypto.randomUUID(),type:`smoothstep`,label:`1:N`},G.current);A(t),X(W.current,t)},[X]),pe=(0,k.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);A(r),X(W.current,r)},[X]),me=(0,k.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);A(n),X(W.current,n)},[X]),he=(0,k.useCallback)(e=>{let t=G.current.filter(t=>t.id!==e);A(t),L(null),X(W.current,t)},[X]),ge=(0,k.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)){r.info(`Only the connector position can be changed`);return}let i=(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))},a=i(t.source,t.sourceHandle),o=i(t.target,t.targetHandle);if(a&&o&&a.type!==o.type){r.error(`Type Mismatch`,{description:`Cannot reconnect ${a.type} to ${o.type}`});return}let s=ee(e,t,G.current);A(s),X(W.current,s)},[X]),_e=(0,k.useCallback)(e=>{let t=W.current.map(t=>t.id===e.id?{...t,data:e}:t);T(t),X(t,G.current)},[X]),ve=(0,k.useCallback)(e=>{let t=W.current.filter(t=>t.id!==e),n=G.current.filter(t=>t.source!==e&&t.target!==e);T(t),A(n),M(null),X(t,n)},[X]),ye=(0,k.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}];T(n),M(e),X(n,G.current)},[X]),be=(0,k.useCallback)(()=>{if(W.current.length===0)return;let e=S(W.current,G.current);T(e),X(e,G.current)},[X]),xe=(0,k.useCallback)((e,t)=>{Y.current=t},[]),Z=(0,k.useCallback)((e,t)=>{Y.current=t,e&&X(W.current,G.current)},[X]);(0,k.useEffect)(()=>{let e=e=>M(e.detail?.id??null);return window.addEventListener(D,e),()=>window.removeEventListener(D,e)},[]);let Q=x.find(e=>e.id===j)?.data??null,Se=O.find(e=>e.id===I)??null,Ce=p===`dark`?`#222`:`#ccc`,$=(0,k.useMemo)(()=>({type:`smoothstep`,animated:!1,reconnectable:!0,style:{stroke:`var(--edge-color)`,strokeWidth:2},markerEnd:{type:ne.Arrow,color:`var(--edge-color)`,width:10,height:10}}),[]),we=(0,k.useMemo)(()=>x.map(e=>{let t=e.id===j;return!!e.selected===t?e:{...e,selected:t}}),[x,j]),Te=(0,k.useMemo)(()=>N(O,j),[O,j]),Ee=(0,k.useMemo)(()=>R?N(R.result.edges,null):[],[R]),De=(0,k.useMemo)(()=>R?.result.nodes.map(e=>({...e,data:{...e.data,isDiffMode:!0}}))??[],[R]);return(0,P.jsxs)(`div`,{className:`relative h-full min-h-0 overflow-hidden bg-background`,children:[(0,P.jsxs)(d,{nodes:R?De:we,edges:R?Ee:Te,nodeTypes:F,onNodesChange:ue,onEdgesChange:de,onConnect:fe,onReconnect:ge,nodesDraggable:!R,nodesConnectable:!R,elementsSelectable:!R,edgesReconnectable:!R,defaultEdgeOptions:$,onNodeClick:(e,t)=>{L(null),M(t.id)},onNodeDoubleClick:(e,t)=>{L(null),M(t.id)},onEdgeClick:(e,t)=>{M(null),L(t.id)},onPaneClick:()=>{M(null),L(null)},onMove:xe,onMoveEnd:Z,colorMode:p,connectionLineType:f.SmoothStep,connectionLineStyle:$.style,onlyRenderVisibleElements:!0,defaultViewport:J,fitView:!q,children:[(0,P.jsx)(c,{variant:l.Lines,gap:50,size:1,color:Ce}),(0,P.jsx)(o,{position:`bottom-left`,showInteractive:!1})]}),!R&&(0,P.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center`,children:(0,P.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,P.jsxs)(m,{size:`sm`,onClick:ye,children:[(0,P.jsx)(ae,{}),` Table`]}),(0,P.jsxs)(m,{variant:`outline`,size:`sm`,onClick:be,disabled:x.length===0,title:`Automatically arrange tables`,children:[(0,P.jsx)(ie,{}),` Auto Layout`]})]})}),!R&&Q&&(0,P.jsx)(`aside`,{className:`absolute inset-y-0 right-0 z-20 w-[min(22rem,82%)] border-l bg-background shadow-xl`,children:(0,P.jsx)(se,{selectedEntity:Q,onUpdateEntity:_e,onDeleteEntity:ve,onBackToTables:()=>M(null),propertiesOnly:!0})}),(0,P.jsx)(oe,{isOpen:!R&&!!I,onOpenChange:e=>{e||L(null)},selectedEdge:Se,nodes:x,handleEdgeUpdate:pe,handleEdgeFlip:me,deleteEdge:he}),R&&(0,P.jsx)(w,{diff:R.result,approvedIds:B,showChecklist:H,onApprovedIdsChange:V,onShowChecklistChange:U,onReject:()=>{z(null),r.info(`Schema update rejected`)},onMerge:le})]})}function B({pane:e,document:t}){let{saveFlowchart:n,saveDrawing:r,triggerDebouncedSync:i}=b();return e.type===`erd`?(0,P.jsx)(s,{children:(0,P.jsx)(z,{document:t,previewSchema:e.previewSchema,previewKey:e.previewKey},t.uid??t.id)}):e.type===`flowchart`?(0,P.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,P.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}=b(),[n,r]=(0,k.useState)(),[i,a]=(0,k.useState)(`loading`);return(0,k.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,P.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:(0,P.jsx)(x,{className:`size-4 animate-spin`})}):i===`missing`?(0,P.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(p,{className:`size-5`}),`File unavailable`]}):(0,P.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-B5bGHefb.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/dist-D0tkMM_Y.js","assets/downloadSVG-C2LckkLx.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/vanilla--C5Lp_AM.js","assets/button-D2dALS3q.js","assets/createLucideIcon-CyOWwA0s.js","assets/select-xSghKb2x.js","assets/alert-dialog-DK2RCz-0.js","assets/useBaseUiId-r-qiwcia.js","assets/useOnFirstRender-1giFodLk.js","assets/floating-ui.react-dom-OhALwEl4.js","assets/CompositeList-l_GSXRZM.js","assets/check-Uq0GkTkz.js","assets/useField-F6rVNyMc.js","assets/useControlled-CwUHqyRq.js","assets/CommentThreadView-Dx7ndjrK.js","assets/dropdown-menu-BrGjsCp0.js","assets/useCompositeItem-DgcRHBrd.js","assets/dialog-EJdgZKa4.js","assets/api-BAQH6VUv.js","assets/preload-helper-Czpn1I53.js","assets/move-BzTcfKj2.js","assets/hover-card-CqLOdc_X.js","assets/plus-DfXp3YpY.js","assets/trash-2-BmZK7fDJ.js","assets/undo-2-FZYgYKq2.js","assets/card-DFJ6ytRY.js","assets/input-BUIkeoB3.js","assets/WorkspaceContext-O7njKDwj.js","assets/label-CCjvjYto.js","assets/index-D_7xzFLd.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/link-2-C71ROdND.js","assets/arrow-left-Cfq6LFs7.js","assets/ConfirmModal-DqvHDAUo.js","assets/wand-sparkles-DfkrzvIR.js","assets/copy-CIp5gOrB.js","assets/hard-drive-B6OfPqtv.js","assets/w3c-keyname-CHFwa9la.js","assets/refresh-cw-Bmpxlvmc.js","assets/sparkles-BKYYqRE2.js","assets/checkbox-CFF_zUIN.js","assets/minus-d4YlhnV9.js","assets/table-Bs3EelYM.js","assets/fileOwnership-DvxzSccE.js","assets/WorkspaceProvider-Br57T-Kq.js","assets/note-importer-Dto2FGfG.js","assets/image-compression-DagnqRIG.js","assets/localPersistence-CjYRImp1.js","assets/useAuth-CQkE8axg.js","assets/diagramVersioning-BcJWSqo3.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/textarea-D2E-6RLc.js","assets/extends-CvVTau-c.js","assets/index-CpmJMylY.css","assets/ERDComments-C8fNJVjv.js","assets/ERDComments-CHpVij2M.css","assets/JumpToNode-BThjKSZV.js","assets/ExcalidrawEditor-Cpfty11o.js","assets/Combination-ODHvOWIL.js","assets/FileCommentMarkers-DcbXvzWA.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{n as r}from"./dist-D0tkMM_Y.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{_ as a,d as o,h as s,l as c,u as l,v as u,y as d}from"./downloadSVG-C2LckkLx.js";import{ct as ee,h as te,r as ne,t as f}from"./esm-B1WURL1q.js";import{U as p}from"./alert-dialog-DK2RCz-0.js";import{t as m}from"./button-D2dALS3q.js";import{n as re}from"./calendar-CsxtM8Ee.js";import{M as ie}from"./hover-card-CqLOdc_X.js";import{t as ae}from"./plus-DfXp3YpY.js";import{n as h}from"./api-BAQH6VUv.js";import{v as g}from"./WorkspaceProvider-Br57T-Kq.js";import{E as _,a as v}from"./note-importer-Dto2FGfG.js";import{t as y}from"./localPersistence-CjYRImp1.js";import{n as b}from"./WorkspaceContext-O7njKDwj.js";import{I as oe,S as se,en as x}from"./index-D_7xzFLd.js";import"./ERDComments-C8fNJVjv.js";import{a as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./erd-edge-style-B8eVeo8P.js";var k=e(t(),1);function A(e){if(!e)return null;try{return typeof e==`string`?JSON.parse(e):e}catch{return null}}function j(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 M(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(j)}}}function ce(e){let t=A(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(M),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 N(e,t){return O(e,t?[t]:[])}var P=n(),F={entity:T},I=(0,k.lazy)(()=>i(()=>import(`./FlowchartView-B5bGHefb.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,56,57,58,59,60,61,62,63]))),L=(0,k.lazy)(()=>i(()=>import(`./ExcalidrawEditor-Cpfty11o.js`),__vite__mapDeps([64,1,2,3,25,8,9,10,15,24,52,33,59,35,36,4,5,6,7,12,13,14,21,11,16,17,18,19,22,20,23,37,38,39,40,41,42,43,32,28,44,45,29,31,46,47,48,49,50,51,53,54,55,56,57,34,58,60,65,66])));async function R(e,t,n){if(n){let n=e===`erd`?`erd`:e===`flowchart`?`flowchart`:`drawings`;return await y.getResource(t)||((await y.getAllResources(n)).find(e=>String(e.uid??e.id)===t)??null)}let r=await h(`/api/${e===`erd`?`diagrams`:e===`flowchart`?`flowcharts`:`drawings`}/${t}`);return r.ok?r.json():null}function z({document:e,previewSchema:t,previewKey:n}){let i=(0,k.useMemo)(()=>ce(e),[e]),{isGuest:s,resolvedTheme:p}=b(),[x,T]=(0,k.useState)(i.nodes),[O,A]=(0,k.useState)(i.edges),[j,M]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(null),[B,V]=(0,k.useState)([]),[H,U]=(0,k.useState)(!1),W=(0,k.useRef)(x),G=(0,k.useRef)(O),K=(0,k.useRef)(null),q=(0,k.useMemo)(()=>g(e),[e]),J=q??{x:0,y:0,zoom:1},Y=(0,k.useRef)(J);W.current=x,G.current=O;let X=(0,k.useCallback)((t,n)=>{K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let i=t.map(e=>({...e.data,x:e.position.x,y:e.position.y})),a=n.map(_),o=v(t,n);try{if(s){let t=await y.getResource(e.uid??e.id);t&&await y.saveResource({...t,entities:i,relationships:a,data:null,dbml_source:o,viewport_x:Y.current.x,viewport_y:Y.current.y,viewport_zoom:Y.current.zoom,updated_at:new Date().toISOString()})}else if(!(await h(`/api/diagrams/save/${e.uid??e.id}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entities:i,relationships:a,viewport:Y.current,data:null,dbmlSource:o})})).ok)throw Error()}catch{r.error(`Could not save ERD changes`)}},350)},[e.id,e.uid,s]);(0,k.useEffect)(()=>{if(!(!t||!n))try{let e=re(W.current,G.current,`erd-generate-sql`,t);if(!e)throw Error();let n=C(W.current,G.current,e.nodes,e.edges);if(n.changes.length===0){z(null),r.success(`No schema changes found`);return}M(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{r.error(`Could not parse the schema for diff`)}},[n,t]);let le=(0,k.useCallback)(()=>{if(!R)return;let e=E(R.originalNodes,R.originalEdges,R.proposedNodes,R.proposedEdges,R.result,B);T(e.nodes),A(e.edges),z(null),X(e.nodes,e.edges),r.success(`Schema changes merged successfully`)},[B,R,X]),ue=(0,k.useCallback)(e=>{let t=u(e,W.current);T(t),e.some(e=>e.type!==`select`&&e.type!==`dimensions`)&&X(t,G.current)},[X]),de=(0,k.useCallback)(e=>{let t=a(e,G.current);A(t),e.some(e=>e.type!==`select`)&&X(W.current,t)},[X]),fe=(0,k.useCallback)(e=>{let t=te({...e,id:crypto.randomUUID(),type:`smoothstep`,label:`1:N`},G.current);A(t),X(W.current,t)},[X]),pe=(0,k.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);A(r),X(W.current,r)},[X]),me=(0,k.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);A(n),X(W.current,n)},[X]),he=(0,k.useCallback)(e=>{let t=G.current.filter(t=>t.id!==e);A(t),L(null),X(W.current,t)},[X]),ge=(0,k.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)){r.info(`Only the connector position can be changed`);return}let i=(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))},a=i(t.source,t.sourceHandle),o=i(t.target,t.targetHandle);if(a&&o&&a.type!==o.type){r.error(`Type Mismatch`,{description:`Cannot reconnect ${a.type} to ${o.type}`});return}let s=ee(e,t,G.current);A(s),X(W.current,s)},[X]),_e=(0,k.useCallback)(e=>{let t=W.current.map(t=>t.id===e.id?{...t,data:e}:t);T(t),X(t,G.current)},[X]),ve=(0,k.useCallback)(e=>{let t=W.current.filter(t=>t.id!==e),n=G.current.filter(t=>t.source!==e&&t.target!==e);T(t),A(n),M(null),X(t,n)},[X]),ye=(0,k.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}];T(n),M(e),X(n,G.current)},[X]),be=(0,k.useCallback)(()=>{if(W.current.length===0)return;let e=S(W.current,G.current);T(e),X(e,G.current)},[X]),xe=(0,k.useCallback)((e,t)=>{Y.current=t},[]),Z=(0,k.useCallback)((e,t)=>{Y.current=t,e&&X(W.current,G.current)},[X]);(0,k.useEffect)(()=>{let e=e=>M(e.detail?.id??null);return window.addEventListener(D,e),()=>window.removeEventListener(D,e)},[]);let Q=x.find(e=>e.id===j)?.data??null,Se=O.find(e=>e.id===I)??null,Ce=p===`dark`?`#222`:`#ccc`,$=(0,k.useMemo)(()=>({type:`smoothstep`,animated:!1,reconnectable:!0,style:{stroke:`var(--edge-color)`,strokeWidth:2},markerEnd:{type:ne.Arrow,color:`var(--edge-color)`,width:10,height:10}}),[]),we=(0,k.useMemo)(()=>x.map(e=>{let t=e.id===j;return!!e.selected===t?e:{...e,selected:t}}),[x,j]),Te=(0,k.useMemo)(()=>N(O,j),[O,j]),Ee=(0,k.useMemo)(()=>R?N(R.result.edges,null):[],[R]),De=(0,k.useMemo)(()=>R?.result.nodes.map(e=>({...e,data:{...e.data,isDiffMode:!0}}))??[],[R]);return(0,P.jsxs)(`div`,{className:`relative h-full min-h-0 overflow-hidden bg-background`,children:[(0,P.jsxs)(d,{nodes:R?De:we,edges:R?Ee:Te,nodeTypes:F,onNodesChange:ue,onEdgesChange:de,onConnect:fe,onReconnect:ge,nodesDraggable:!R,nodesConnectable:!R,elementsSelectable:!R,edgesReconnectable:!R,defaultEdgeOptions:$,onNodeClick:(e,t)=>{L(null),M(t.id)},onNodeDoubleClick:(e,t)=>{L(null),M(t.id)},onEdgeClick:(e,t)=>{M(null),L(t.id)},onPaneClick:()=>{M(null),L(null)},onMove:xe,onMoveEnd:Z,colorMode:p,connectionLineType:f.SmoothStep,connectionLineStyle:$.style,onlyRenderVisibleElements:!0,defaultViewport:J,fitView:!q,children:[(0,P.jsx)(c,{variant:l.Lines,gap:50,size:1,color:Ce}),(0,P.jsx)(o,{position:`bottom-left`,showInteractive:!1})]}),!R&&(0,P.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center`,children:(0,P.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,P.jsxs)(m,{size:`sm`,onClick:ye,children:[(0,P.jsx)(ae,{}),` Table`]}),(0,P.jsxs)(m,{variant:`outline`,size:`sm`,onClick:be,disabled:x.length===0,title:`Automatically arrange tables`,children:[(0,P.jsx)(ie,{}),` Auto Layout`]})]})}),!R&&Q&&(0,P.jsx)(`aside`,{className:`absolute inset-y-0 right-0 z-20 w-[min(22rem,82%)] border-l bg-background shadow-xl`,children:(0,P.jsx)(se,{selectedEntity:Q,onUpdateEntity:_e,onDeleteEntity:ve,onBackToTables:()=>M(null),propertiesOnly:!0})}),(0,P.jsx)(oe,{isOpen:!R&&!!I,onOpenChange:e=>{e||L(null)},selectedEdge:Se,nodes:x,handleEdgeUpdate:pe,handleEdgeFlip:me,deleteEdge:he}),R&&(0,P.jsx)(w,{diff:R.result,approvedIds:B,showChecklist:H,onApprovedIdsChange:V,onShowChecklistChange:U,onReject:()=>{z(null),r.info(`Schema update rejected`)},onMerge:le})]})}function B({pane:e,document:t}){let{saveFlowchart:n,saveDrawing:r,triggerDebouncedSync:i}=b();return e.type===`erd`?(0,P.jsx)(s,{children:(0,P.jsx)(z,{document:t,previewSchema:e.previewSchema,previewKey:e.previewKey},t.uid??t.id)}):e.type===`flowchart`?(0,P.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,P.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}=b(),[n,r]=(0,k.useState)(),[i,a]=(0,k.useState)(`loading`);return(0,k.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,P.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:(0,P.jsx)(x,{className:`size-4 animate-spin`})}):i===`missing`?(0,P.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(p,{className:`size-5`}),`File unavailable`]}):(0,P.jsx)(B,{pane:e,document:n})}export{V as NotesCompanionPane};
|