erdbpro 3.4.4 → 3.4.5
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-DsqESu86.js → AdminRoute-DrYi0_XF.js} +2 -2
- package/dist/assets/{Combination-CBqK2WAU.js → Combination-DBeRPSUX.js} +1 -1
- package/dist/assets/{DataViewerModeToolbar-BU6kDj47.js → DataViewerModeToolbar-DnGcPEs4.js} +1 -1
- package/dist/assets/{DbClientEditorRoute-BPkxDlEV.js → DbClientEditorRoute-Bh_OaDEN.js} +1 -1
- package/dist/assets/{DiagramEditorRoute-b4Ig6As2.js → DiagramEditorRoute-Bw_onGfJ.js} +1 -1
- package/dist/assets/{DrawingEditorRoute-D5qz16fk.js → DrawingEditorRoute-C4BSj3Ah.js} +2 -2
- package/dist/assets/{DrawingsView-D6jqtkJo.js → DrawingsView-D0eNZF8l.js} +1 -1
- package/dist/assets/{EntityNode-Cki4Jhtp.js → EntityNode-BubcTPns.js} +1 -1
- package/dist/assets/{ExcalidrawEditor-TMvfpKwf.js → ExcalidrawEditor-eQe4pyA3.js} +8 -8
- package/dist/assets/{FlowchartEditorRoute-CwXZOk29.js → FlowchartEditorRoute-EVt67UAs.js} +1 -1
- package/dist/assets/{FlowchartView-BFDLbzoI.js → FlowchartView-BDDl2HRQ.js} +1 -1
- package/dist/assets/{NoteEditorRoute-1iyXm69g.js → NoteEditorRoute-KduExmWL.js} +2 -2
- package/dist/assets/{NotesCompanionPane-ZAIDpKhe.js → NotesCompanionPane-Dgymv75J.js} +2 -2
- package/dist/assets/{NotesView-UWK1NzH3.js → NotesView-DZLeeonI.js} +3 -3
- package/dist/assets/{ProjectFileTabs-CnNVuuxZ.js → ProjectFileTabs-DNmVwnNp.js} +1 -1
- package/dist/assets/{TrashView-DKVlHc8k.js → TrashView-DodCb2d-.js} +1 -1
- package/dist/assets/{WorkspaceProvider-BFt1fLnH.js → WorkspaceProvider-BKu0LKCS.js} +3 -3
- package/dist/assets/{abnfDiagram-N423BO3Z-CRhYhlyn.js → abnfDiagram-N423BO3Z-BIaHzJSW.js} +1 -1
- package/dist/assets/{ar-SA-G6X2FPQ2-CiROUGDv.js → ar-SA-G6X2FPQ2-CG4gXaCk.js} +1 -1
- package/dist/assets/{architectureDiagram-T3A2C74G-Bszvbsiy.js → architectureDiagram-T3A2C74G-CiqSC_06.js} +1 -1
- package/dist/assets/{az-AZ-76LH7QW2-BoY22mYB.js → az-AZ-76LH7QW2--jJJqvOX.js} +1 -1
- package/dist/assets/{bg-BG-XCXSNQG7-BfSTkttr.js → bg-BG-XCXSNQG7-5KB8b4-1.js} +1 -1
- package/dist/assets/{blockDiagram-VBNYF7ZC-DY0FcgGi.js → blockDiagram-VBNYF7ZC-DVnzKjMe.js} +1 -1
- package/dist/assets/{bn-BD-2XOGV67Q-BtArxgmC.js → bn-BD-2XOGV67Q-CSVJMRsA.js} +1 -1
- package/dist/assets/{c4Diagram-5PPSVZJV-BeXLC2Fp.js → c4Diagram-5PPSVZJV-DgFibHYM.js} +1 -1
- package/dist/assets/{ca-ES-6MX7JW3Y-CEOeq30Y.js → ca-ES-6MX7JW3Y-C6W3PhTR.js} +1 -1
- package/dist/assets/channel-DRYJfrrf.js +1 -0
- package/dist/assets/{chunk-2GRJ4B5K-BrABFCRg.js → chunk-2GRJ4B5K-BfJo-pSq.js} +1 -1
- package/dist/assets/{chunk-4I5QYGJK-rnMKF4Yp.js → chunk-4I5QYGJK-Bk5sydqb.js} +1 -1
- package/dist/assets/{chunk-5RXB4S5H-DfCjXD_8.js → chunk-5RXB4S5H-DO-MIcW8.js} +1 -1
- package/dist/assets/{chunk-6Q2QTUOP-XrL0WVCh.js → chunk-6Q2QTUOP-CJO9T2Bg.js} +1 -1
- package/dist/assets/{chunk-7Z6QIM7H-C76Kvofr.js → chunk-7Z6QIM7H-wPvC3972.js} +1 -1
- package/dist/assets/{chunk-EIO257PC-DLzT_bHO.js → chunk-EIO257PC-BcR-Rmn-.js} +1 -1
- package/dist/assets/{chunk-GF5L2VYU-DB-q8Pjx.js → chunk-GF5L2VYU-Ck5ix3h2.js} +1 -1
- package/dist/assets/{chunk-I66GZJ75-BElJmWk6.js → chunk-I66GZJ75-BAPujJrX.js} +1 -1
- package/dist/assets/{chunk-JQJVKLGR-CcLom7yx.js → chunk-JQJVKLGR-B-Y010j-.js} +1 -1
- package/dist/assets/{chunk-KBJHAD2P-CijZRlin.js → chunk-KBJHAD2P-DwvdQHWQ.js} +1 -1
- package/dist/assets/{chunk-NSK5VX7P-BgGi-QUV.js → chunk-NSK5VX7P-BQcxfnS7.js} +1 -1
- package/dist/assets/{chunk-QR6OTTB3-PPOImnQe.js → chunk-QR6OTTB3-Bu6w4SAv.js} +1 -1
- package/dist/assets/{chunk-UBXNYLIW-DCkgIwAO.js → chunk-UBXNYLIW-Bg0ANHdr.js} +1 -1
- package/dist/assets/{chunk-W5SLKNZC-DsQvkmTJ.js → chunk-W5SLKNZC-WKiLOi7m.js} +1 -1
- package/dist/assets/{chunk-WRU74C26-CIYOFIRf.js → chunk-WRU74C26-DPaj0R57.js} +1 -1
- package/dist/assets/classDiagram-JCYQIIEL-BIX50rl-.js +1 -0
- package/dist/assets/classDiagram-v2-OCEON4UE-BIX50rl-.js +1 -0
- package/dist/assets/{cs-CZ-2BRQDIVT-DXGAPl52.js → cs-CZ-2BRQDIVT-D5UyiAfP.js} +1 -1
- package/dist/assets/{cynefinDiagram-MW4NZA55-CMoNLYRc.js → cynefinDiagram-MW4NZA55-BmAPgFC3.js} +1 -1
- package/dist/assets/{da-DK-5WZEPLOC-BYm2m-qs.js → da-DK-5WZEPLOC-DzEZP48n.js} +1 -1
- package/dist/assets/{dagre-VZM6K2ZE-CzwDhr_E.js → dagre-VZM6K2ZE-CxYfeVya.js} +1 -1
- package/dist/assets/{de-DE-XR44H4JA-Cj6FS0f3.js → de-DE-XR44H4JA-DjuR_7Bi.js} +1 -1
- package/dist/assets/{diagram-7IWD3JNH-DWOyz22F.js → diagram-7IWD3JNH-B5s4gGUD.js} +1 -1
- package/dist/assets/{diagram-B4RE2ZJO-CB8eQU5c.js → diagram-B4RE2ZJO-CxwFiZ8o.js} +1 -1
- package/dist/assets/{diagram-LBJQPF4R-SyCyf0e1.js → diagram-LBJQPF4R-pOUu0uVk.js} +1 -1
- package/dist/assets/{diagram-Q27KOJAE-D4RAD4ph.js → diagram-Q27KOJAE-DabrQjsP.js} +1 -1
- package/dist/assets/{diagram-UB23O5K3-QHDbFwLp.js → diagram-UB23O5K3-BSE4nJMe.js} +1 -1
- package/dist/assets/{dist-Bbp_4vOv.js → dist-BG5dNAT3.js} +4 -4
- package/dist/assets/{ebnfDiagram-BXEA7PRR-CxP4nARN.js → ebnfDiagram-BXEA7PRR-CP7jO6yI.js} +1 -1
- package/dist/assets/{el-GR-BZB4AONW-D6sm4SVh.js → el-GR-BZB4AONW-D-Db6qae.js} +1 -1
- package/dist/assets/{en-B4ZKOASM-h2uiUwq8.js → en-B4ZKOASM-BbFTnkBC.js} +1 -1
- package/dist/assets/{erDiagram-JOGREHBK-CrHty4vG.js → erDiagram-JOGREHBK-EqmxZSIG.js} +1 -1
- package/dist/assets/{erdActions-Dc1G4NT5.js → erdActions-VP-88Vry.js} +1 -1
- package/dist/assets/{es-ES-U4NZUMDT-DaHIB9Nh.js → es-ES-U4NZUMDT-RLVF3TwQ.js} +1 -1
- package/dist/assets/{eu-ES-A7QVB2H4-JL-tKIG_.js → eu-ES-A7QVB2H4-B3yllD6c.js} +1 -1
- package/dist/assets/{fa-IR-HGAKTJCU-mQfxi4rI.js → fa-IR-HGAKTJCU-6dh_ViSv.js} +1 -1
- package/dist/assets/{fi-FI-Z5N7JZ37-DVlwx9X6.js → fi-FI-Z5N7JZ37-Bn4at9_s.js} +1 -1
- package/dist/assets/flowDiagram-UKHOOZJN-Cmscwpyz.js +1 -0
- package/dist/assets/{fr-FR-RHASNOE6-CiH6Au8c.js → fr-FR-RHASNOE6-gr6d7jAa.js} +1 -1
- package/dist/assets/{ganttDiagram-PKOTCBZU-C8kCjgG9.js → ganttDiagram-PKOTCBZU-DJuDa00y.js} +1 -1
- package/dist/assets/{gitGraphDiagram-DS77QQ5N-DyDeob-5.js → gitGraphDiagram-DS77QQ5N-CXoCI54z.js} +1 -1
- package/dist/assets/{gl-ES-HMX3MZ6V-BBB-d8Mx.js → gl-ES-HMX3MZ6V-Bgv0CTGP.js} +1 -1
- package/dist/assets/{he-IL-6SHJWFNN-Z91w13F5.js → he-IL-6SHJWFNN-C-1FWvRf.js} +1 -1
- package/dist/assets/{hi-IN-IWLTKZ5I-CbheEEe8.js → hi-IN-IWLTKZ5I-D1hlRs_K.js} +1 -1
- package/dist/assets/{hu-HU-A5ZG7DT2-DiL7hHNi.js → hu-HU-A5ZG7DT2-BWKvbmHV.js} +1 -1
- package/dist/assets/{id-ID-SAP4L64H-B3UbeWNg.js → id-ID-SAP4L64H-BeLPjdZ_.js} +1 -1
- package/dist/assets/image-GAAHSSAO-BDqkWo5z.js +1 -0
- package/dist/assets/index-C3r2kpyC.js +884 -0
- package/dist/assets/{infoDiagram-6WML65LV-D5MCgtmM.js → infoDiagram-6WML65LV-D1lynf9u.js} +1 -1
- package/dist/assets/{ishikawaDiagram-WSZJBQD7-Ddxh-RLg.js → ishikawaDiagram-WSZJBQD7-DpVH03gN.js} +1 -1
- package/dist/assets/{it-IT-JPQ66NNP-Bw487Jbj.js → it-IT-JPQ66NNP-BE7vmYAT.js} +1 -1
- package/dist/assets/{ja-JP-DBVTYXUO-CezLzeOo.js → ja-JP-DBVTYXUO-qXtpKb5u.js} +1 -1
- package/dist/assets/{journeyDiagram-NVQOT4AX-BImXIfyg.js → journeyDiagram-NVQOT4AX-BsF2KEus.js} +1 -1
- package/dist/assets/{kaa-6HZHGXH3-BF8Spb5E.js → kaa-6HZHGXH3-aDi8T9ap.js} +1 -1
- package/dist/assets/{kab-KAB-ZGHBKWFO-C4ZUtiKB.js → kab-KAB-ZGHBKWFO-CR2CfRi_.js} +1 -1
- package/dist/assets/{kanban-definition-27J2QSJJ-9VGXUuIj.js → kanban-definition-27J2QSJJ-Cl4N_QQU.js} +1 -1
- package/dist/assets/{kk-KZ-P5N5QNE5-g_vnUUcj.js → kk-KZ-P5N5QNE5-DjUmH-P5.js} +1 -1
- package/dist/assets/{km-KH-HSX4SM5Z-BOwEXyZ7.js → km-KH-HSX4SM5Z-CyNPtzM3.js} +1 -1
- package/dist/assets/{ko-KR-MTYHY66A-DC1WnzBL.js → ko-KR-MTYHY66A-CgFlnosj.js} +1 -1
- package/dist/assets/{ku-TR-6OUDTVRD-DD9gJRrR.js → ku-TR-6OUDTVRD-D77qM3OE.js} +1 -1
- package/dist/assets/{line-6jHkzcbb.js → line-Bz4J9juH.js} +1 -1
- package/dist/assets/{lt-LT-XHIRWOB4-DrLrIYgA.js → lt-LT-XHIRWOB4-Cz0nGCpZ.js} +1 -1
- package/dist/assets/{lv-LV-5QDEKY6T-DXh-jV4R.js → lv-LV-5QDEKY6T-B0AN-h0Y.js} +1 -1
- package/dist/assets/{mindmap-definition-FAOFIHXS-NkDV2mqL.js → mindmap-definition-FAOFIHXS-CTk2KZzX.js} +1 -1
- package/dist/assets/{mr-IN-CRQNXWMA-D9QV3zBZ.js → mr-IN-CRQNXWMA-SQAI4q2W.js} +1 -1
- package/dist/assets/{my-MM-5M5IBNSE-BvY1X3Ab.js → my-MM-5M5IBNSE-RUb9G-l1.js} +1 -1
- package/dist/assets/{nb-NO-T6EIAALU-DVu4lTBi.js → nb-NO-T6EIAALU-CHt-iHDP.js} +1 -1
- package/dist/assets/{nl-NL-IS3SIHDZ-DckMtk8V.js → nl-NL-IS3SIHDZ-CcRbegnc.js} +1 -1
- package/dist/assets/{nn-NO-6E72VCQL-CUfF3pYd.js → nn-NO-6E72VCQL-DtnGt-Um.js} +1 -1
- package/dist/assets/{note-importer-Bi-otidG.js → note-importer-B6ql7t2r.js} +2 -2
- package/dist/assets/{oc-FR-POXYY2M6-CXethMle.js → oc-FR-POXYY2M6-Chi6gHvw.js} +1 -1
- package/dist/assets/{pa-IN-N4M65BXN-BHBqiuU1.js → pa-IN-N4M65BXN-b20NieWg.js} +1 -1
- package/dist/assets/{pegDiagram-VL7TDLO6-CuIxpAd8.js → pegDiagram-VL7TDLO6-DTlHveRH.js} +1 -1
- package/dist/assets/percentages-BXMCSKIN-NYJord4U.js +1 -0
- package/dist/assets/{pieDiagram-7S7Q4E2Y-D29C_sXK.js → pieDiagram-7S7Q4E2Y-BTnTvVK5.js} +1 -1
- package/dist/assets/{pl-PL-T2D74RX3-ydfSMrfV.js → pl-PL-T2D74RX3-B2Ing3px.js} +1 -1
- package/dist/assets/{pt-BR-5N22H2LF-Ck4s57Xw.js → pt-BR-5N22H2LF-CSpjm1Sp.js} +1 -1
- package/dist/assets/{pt-PT-UZXXM6DQ-Bw7y2bi5.js → pt-PT-UZXXM6DQ-BJ3Ndc7i.js} +1 -1
- package/dist/assets/{quadrantDiagram-CIZ2JOQS-xWx3bSs-.js → quadrantDiagram-CIZ2JOQS-DNIiCyYf.js} +1 -1
- package/dist/assets/{railroadDiagram-AXF67PYL-Bt7IOjkc.js → railroadDiagram-AXF67PYL-BS6Q9VmO.js} +1 -1
- package/dist/assets/{requirementDiagram-LRYGKXZP-BlrB1SY-.js → requirementDiagram-LRYGKXZP-CrLBS59l.js} +1 -1
- package/dist/assets/{ro-RO-JPDTUUEW-BaPy9LfR.js → ro-RO-JPDTUUEW-VjQCLUXP.js} +1 -1
- package/dist/assets/{ru-RU-B4JR7IUQ-au5VLX71.js → ru-RU-B4JR7IUQ-CRdjuuv9.js} +1 -1
- package/dist/assets/{sankeyDiagram-W5VNT64P-CegIEtnL.js → sankeyDiagram-W5VNT64P-gsIoAwUA.js} +1 -1
- package/dist/assets/{sequenceDiagram-SI44F4Z6-DPy1px1Q.js → sequenceDiagram-SI44F4Z6-XZTPXpTp.js} +1 -1
- package/dist/assets/{si-LK-N5RQ5JYF-CPhvhvOK.js → si-LK-N5RQ5JYF-B_feK85p.js} +1 -1
- package/dist/assets/{sk-SK-C5VTKIMK-DCt1WKzH.js → sk-SK-C5VTKIMK-fcWDOZ4q.js} +1 -1
- package/dist/assets/{sl-SI-NN7IZMDC-DQeMrjgb.js → sl-SI-NN7IZMDC-DZaUphkt.js} +1 -1
- package/dist/assets/{stateDiagram-OKZ733FA-DxMvdMib.js → stateDiagram-OKZ733FA-WPy8HF60.js} +1 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-APHd0SA2.js +1 -0
- package/dist/assets/subset-shared.chunk-DyXAjJN9.js +1 -0
- package/dist/assets/{subset-worker.chunk-DNRuahaE.js → subset-worker.chunk-Clzwhyvs.js} +1 -1
- package/dist/assets/{sv-SE-XGPEYMSR-CDpaSmYY.js → sv-SE-XGPEYMSR-DrbbsUyQ.js} +1 -1
- package/dist/assets/{swimlanes-SLNWSIFB-uAM7GWDR.js → swimlanes-SLNWSIFB-D4z9qwfX.js} +1 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-uLXOIwEf.js +8 -0
- package/dist/assets/{ta-IN-2NMHFXQM-DaoR00gR.js → ta-IN-2NMHFXQM-Y5VJiFwc.js} +1 -1
- package/dist/assets/{th-TH-HPSO5L25-iuBe47r_.js → th-TH-HPSO5L25-BKS6bxz1.js} +1 -1
- package/dist/assets/{timeline-definition-Z64GVDOM-C66YbgeV.js → timeline-definition-Z64GVDOM-CAoZtDwA.js} +1 -1
- package/dist/assets/{tr-TR-DEFEU3FU-B_uUqanw.js → tr-TR-DEFEU3FU-CEHSX0uR.js} +1 -1
- package/dist/assets/{uk-UA-QMV73CPH-BTSn5Aae.js → uk-UA-QMV73CPH-DLxBVU34.js} +1 -1
- package/dist/assets/{vennDiagram-T6HMQDX7-BTAfAMLF.js → vennDiagram-T6HMQDX7-BRdzUVJj.js} +1 -1
- package/dist/assets/{vi-VN-M7AON7JQ-J57Rg3Ii.js → vi-VN-M7AON7JQ-D1GV_new.js} +1 -1
- package/dist/assets/{wardleyDiagram-T6FBY63Y-CNM2hyzo.js → wardleyDiagram-T6FBY63Y-JVbV7JBk.js} +1 -1
- package/dist/assets/{xychartDiagram-ELKLHX3M-_wSNKxRP.js → xychartDiagram-ELKLHX3M-ATEjNUSw.js} +1 -1
- package/dist/assets/{zh-CN-LNUGB5OW-CGCzix0k.js → zh-CN-LNUGB5OW-gSK0Mg4q.js} +1 -1
- package/dist/assets/{zh-HK-E62DVLB3-D74oZGZU.js → zh-HK-E62DVLB3-CKO-0Ly6.js} +1 -1
- package/dist/assets/{zh-TW-RAJ6MFWO-BfKVvrg0.js → zh-TW-RAJ6MFWO-BYW5DTNY.js} +1 -1
- package/dist/index.html +3 -3
- package/dist-server/index.js +5 -1
- package/package.json +1 -1
- package/dist/assets/channel-DguCx1QT.js +0 -1
- package/dist/assets/classDiagram-JCYQIIEL-CCpv7-JF.js +0 -1
- package/dist/assets/classDiagram-v2-OCEON4UE-CCpv7-JF.js +0 -1
- package/dist/assets/flowDiagram-UKHOOZJN-DZLVvIRA.js +0 -1
- package/dist/assets/image-GAAHSSAO-ebSOoDu1.js +0 -1
- package/dist/assets/index-CIb9-CLP.js +0 -845
- package/dist/assets/percentages-BXMCSKIN-BoJ2Ielj.js +0 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-PDrqfO_v.js +0 -1
- package/dist/assets/subset-shared.chunk-DeBxeTa4.js +0 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-CmHZJc0X.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{R as r}from"./note-importer-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{R as r}from"./note-importer-B6ql7t2r.js";import{n as i}from"./WorkspaceContext-M-vT9OAZ.js";import"./WorkspaceProvider-BKu0LKCS.js";import{sn as a}from"./index-C3r2kpyC.js";import{FlowchartView as o}from"./FlowchartView-BDDl2HRQ.js";import{t as s}from"./ProjectFileTabs-DNmVwnNp.js";var c=e(t(),1),l=n();function u(){let e=i(),{id:t}=r(),{activeFlowchart:n,activeFlowchartId:u,handleFlowchartChange:d,isPublicView:f,isLoading:p,isFlowchartItemLoading:m,handleFlowchartSelect:h,saveFlowchart:g,triggerDebouncedSync:_}=e,v=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(!(f||!t)&&!v.current){if(String(u)===t){v.current=!0;return}u||(v.current=!0,h(t))}},[t,u,f,h]),!f&&!u?t&&!v.current?(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,l.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]}):(0,l.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,l.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a flowchart to view`})}):!n&&!m?(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(a,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,l.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Flowchart not found`}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This flowchart may have been deleted or is no longer available.`})]}):n?(0,l.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,l.jsx)(s,{currentView:`flowchart`}),(0,l.jsx)(o,{isLoading:m,activeFlowchartId:u,activeFlowchart:n,handleFlowchartChange:d,isReadOnly:f,saveFlowchart:g,triggerDebouncedSync:_})]}):(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,l.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]})}export{u as FlowchartEditorRoute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{a as r,c as i,d as a,f as o,i as s,n as c,o as l,p as u,r as d,s as f,t as p}from"./downloadSVG-sVCad7p8.js";import{_ as ee,a as m,n as h,s as g}from"./dist--spER_Rx.js";import{n as te}from"./WorkspaceContext-M-vT9OAZ.js";import{G as _,H as v,J as y,K as b,V as x,W as S,Y as C,a as w,ft as ne,i as T,l as E,mt as D,n as re,q as O,s as k,u as A}from"./AIActionContext-sBtUZeB9.js";import{D as j,x as M}from"./useCompositeItem-ZIV61RjL.js";import{c as ie,l as N,t as P}from"./input-BDCM7QEk.js";import{n as ae,t as oe}from"./move-BlLS6EPB.js";import{n as se,r as ce,t as le}from"./undo-2-DSs-RD2B.js";import{t as ue}from"./card-Dy6p8t6g.js";import{t as F}from"./label-Co-it7VP.js";import{A as de,C as fe,D as I,Kt as pe,M as me,O as he,S as ge,T as _e,j as ve,k as ye,sn as be,w as xe,x as Se}from"./index-CIb9-CLP.js";/* empty css */import{t as Ce}from"./JumpToNode-NAVBzr-5.js";var L=e(t(),1),R=n(),z=(0,L.memo)(({data:e,selected:t})=>{let[n,r]=(0,L.useState)(!1),i=`!w-1.5 !h-1.5 !bg-white !border-none opacity-0 group-hover:opacity-100 transition-opacity z-20 cursor-crosshair`,a=(0,L.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]),o=(0,L.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]),s=(0,L.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,R.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,R.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,R.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,R.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,R.jsx)(`div`,{className:`absolute inset-0 rounded-[50px] pointer-events-none`,style:t});case`circle`:return(0,R.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,R.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,R.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,R.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,R.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,R.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,R.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,R.jsx)(`path`,{d:`M70,2 V30 H98`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`})]});case`cloud`:return(0,R.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,R.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,R.jsx)(`div`,{className:`absolute inset-0 rounded-md pointer-events-none`,style:t})}},[e.color,e.shape,t]);return(0,R.jsxs)(`div`,{className:`relative group flex items-center justify-center cursor-pointer transition-all duration-300 hover:scale-[1.02] ${a}`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{aspectRatio:e.shape===`circle`?`1 / 1`:`auto`},children:[(0,R.jsx)(f,{isVisible:t||n,keepAspectRatio:e.shape===`circle`,minWidth:o.width,minHeight:o.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`}}),s,(0,R.jsx)(l,{id:`top`,type:`target`,position:g.Top,className:i}),(0,R.jsx)(l,{id:`top`,type:`source`,position:g.Top,className:i}),(0,R.jsx)(l,{id:`bottom`,type:`target`,position:g.Bottom,className:i}),(0,R.jsx)(l,{id:`bottom`,type:`source`,position:g.Bottom,className:i}),(0,R.jsx)(l,{id:`right`,type:`target`,position:g.Right,className:i}),(0,R.jsx)(l,{id:`right`,type:`source`,position:g.Right,className:i}),(0,R.jsx)(l,{id:`left`,type:`target`,position:g.Left,className:i}),(0,R.jsx)(l,{id:`left`,type:`source`,position:g.Left,className:i}),(0,R.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,R.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})]})}),B=e=>e.trim().toLowerCase().includes(`start`);function we({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=B(n.label);return(0,R.jsx)(x,{open:e,onOpenChange:t,children:(0,R.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(C,{children:`Create New Symbol`}),(0,R.jsx)(_,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,R.jsxs)(v,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Label`}),(0,R.jsx)(P,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Group Title`}),(0,R.jsx)(P,{value:n.section||``,onChange:e=>r({...n,section:e.target.value||void 0}),placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted border-border text-foreground`}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Shape Type`}),(0,R.jsxs)(T,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select a shape`,children:n.shape?de[n.shape]:`Select a shape`})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`rectangle`,children:`Rectangle (Process)`}),(0,R.jsx)(k,{value:`oval`,children:`Oval (Start/End)`}),(0,R.jsx)(k,{value:`diamond`,children:`Diamond (Decision)`}),(0,R.jsx)(k,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,R.jsx)(k,{value:`database`,children:`Cylinder (Database)`}),(0,R.jsx)(k,{value:`document`,children:`Document`}),(0,R.jsx)(k,{value:`cloud`,children:`Cloud (External System)`}),(0,R.jsx)(k,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Color`}),(0,R.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,R.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,R.jsxs)(b,{children:[(0,R.jsx)(M,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,R.jsx)(M,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function V(e){return e.data.label.trim().toLowerCase().includes(`start`)}function Te({selectedNodeId:e,onClose:t,selectedNode:n,onUpdateNodeData:r,onDeleteNode:i,onDeleteGroup:a,onValidateSection:o}){let s=n?V(n):!1,[c,l]=(0,L.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),u=e=>{l(e),r({code:e})};return(0,R.jsx)(x,{open:!!e,onOpenChange:e=>{e||t()},children:(0,R.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(C,{children:`Symbol Properties`}),(0,R.jsx)(_,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,R.jsxs)(v,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Label`}),(0,R.jsx)(P,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,R.jsx)(`textarea`,{value:c,onChange:e=>u(e.target.value),placeholder:n.data.shape===`diamond`?`e.g. return context.amount > 100 ? 'Yes' : 'No';`:`e.g. context.status = 'Approved'; context.tries += 1;`,className:`w-full h-24 bg-muted border border-border rounded-md p-2 text-xs font-mono text-foreground placeholder:text-muted-foreground/50 resize-none focus:outline-none focus:border-ring`}),(0,R.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,R.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Group Title`}),(0,R.jsx)(P,{value:n.data.section||``,onChange:e=>r({section:e.target.value||void 0}),onBlur:e=>{let t=e.target.value;t&&o&&!o(t)&&r({section:void 0})},placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted/50 border-border text-foreground`}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Shape Type`}),(0,R.jsxs)(T,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select a shape`,children:n.data.shape?de[n.data.shape]:`Select a shape`})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`rectangle`,children:`Rectangle (Process)`}),(0,R.jsx)(k,{value:`oval`,children:`Oval (Start/End)`}),(0,R.jsx)(k,{value:`diamond`,children:`Diamond (Decision)`}),(0,R.jsx)(k,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,R.jsx)(k,{value:`database`,children:`Cylinder (Database)`}),(0,R.jsx)(k,{value:`document`,children:`Document`}),(0,R.jsx)(k,{value:`cloud`,children:`Cloud (External System)`}),(0,R.jsx)(k,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Color`}),(0,R.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,R.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,R.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,R.jsxs)(M,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,R.jsx)(j,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,R.jsxs)(M,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,R.jsx)(j,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Ee({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:i,onEdgeTypeChange:a,onArrowChange:o,onLabelChange:s,onDeleteEdge:c}){return(0,R.jsx)(x,{open:!!e,onOpenChange:e=>{e||t()},children:(0,R.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,R.jsx)(O,{children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,R.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,R.jsx)(C,{children:`Connector Properties`}),(0,R.jsx)(_,{children:`Format the line style and arrows.`})]}),(0,R.jsx)(M,{variant:`ghost`,size:`icon`,onClick:c,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,children:(0,R.jsx)(j,{className:`w-4 h-4`})})]})}),n&&(0,R.jsxs)(v,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Text Label`}),(0,R.jsx)(P,{value:typeof n.label==`string`?n.label:``,onChange:e=>s(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Line Style`}),(0,R.jsxs)(T,{value:r?`dashed`:`solid`,onValueChange:e=>a(e||``),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select line style`,children:ye[r?`dashed`:`solid`]})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`solid`,children:`Solid Line`}),(0,R.jsx)(k,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Arrow Style`}),(0,R.jsxs)(T,{value:i,onValueChange:e=>o(e||``),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select arrow style`,children:I[i]})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`end`,children:`Arrow at End`}),(0,R.jsx)(k,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,R.jsx)(k,{value:`both`,children:`Arrows Both Ends`}),(0,R.jsx)(k,{value:`none`,children:`No Arrows (Line only)`})]})]})]})]})]})})}function De({nodes:e,edges:t,onConfirm:n,onCancel:r,confirmLabel:i=`Confirm Append`,canvasGroups:a=[],existingNodes:o=[],existingEdges:s=[]}){let[c,l]=(0,L.useState)(null),u=(0,L.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,R.jsxs)(x,{open:!0,onOpenChange:e=>{e||r()},children:[(0,R.jsx)(y,{}),(0,R.jsxs)(S,{size:`2xl`,showCloseButton:!0,children:[(0,R.jsx)(O,{children:(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`div`,{className:`size-8 rounded-lg bg-indigo-500/10 flex items-center justify-center`,children:(0,R.jsx)(be,{className:`size-4 text-indigo-400`})}),(0,R.jsx)(`div`,{children:(0,R.jsx)(C,{children:`Preview Changes`})})]})}),(0,R.jsx)(v,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.length>0&&(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`New Symbols (`,e.length,`)`]}),(0,R.jsx)(`div`,{className:`max-h-75 overflow-y-auto custom-scrollbar space-y-2`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-2 border-b border-border/20 bg-muted/50`,children:[(0,R.jsx)(be,{className:`size-3 text-indigo-400 shrink-0`}),(0,R.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.data.label}),(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground ml-auto`,children:e.data.shape})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono`,children:[(0,R.jsx)(`span`,{className:`text-gray-500`,children:`Shape:`}),(0,R.jsx)(`span`,{className:`text-gray-300`,children:e.data.shape}),e.data.color&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 ml-2`,children:`Color:`}),(0,R.jsx)(`span`,{className:`text-gray-300`,children:e.data.color})]})]})]},e.id))})]}),u&&(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Changes`}),(0,R.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,R.jsx)(`div`,{className:`divide-y divide-border/10`,children:u.map((e,t)=>{if(e.type===`header`)return(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border/30`,children:[e.isNew&&(0,R.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,R.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,R.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-0.5 ${a}`,children:[(0,R.jsx)(`span`,{className:`w-4 shrink-0 select-none ${o}`,children:e.prefix}),(0,R.jsx)(`span`,{className:`w-20 shrink-0 ${c}`,children:e.field}),e.oldVal&&(0,R.jsx)(`span`,{className:`text-red-400/70 line-through`,children:e.oldVal}),e.oldVal&&e.newVal&&(0,R.jsx)(`span`,{className:`text-gray-600`,children:`→`}),e.newVal&&(0,R.jsx)(`span`,{className:s,children:e.newVal})]},t)})})})]}),!u&&!e.length&&(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes detected.`})]})}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 pt-4 pb-6`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-3`,children:a.length>0&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(ae,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,R.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Replace:`}),(0,R.jsxs)(T,{value:c??``,onValueChange:e=>l(e||null),children:[(0,R.jsx)(E,{className:`h-7 text-[12px]`,children:(0,R.jsx)(A,{placeholder:`All Symbols`})}),(0,R.jsxs)(w,{children:[(0,R.jsx)(k,{value:``,children:`All Symbols`}),a.map(e=>(0,R.jsx)(k,{value:e,children:e},e))]})]})]})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(M,{variant:`outline`,size:`sm`,onClick:r,className:`gap-2`,children:[(0,R.jsx)(ne,{className:`size-4`}),`Cancel`]}),(0,R.jsxs)(M,{size:`sm`,onClick:()=>n(c||void 0),className:`gap-2`,children:[(0,R.jsx)(N,{className:`size-4`}),i]})]})]})]})]})}function H(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 Oe(e,t){return H(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function ke(e,t){let n=[`top`,`bottom`,`left`,`right`],r=H(e.position),i=H(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 Ae(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 U(e,t,n){switch(e){case`diamond`:return`<polygon points="80,2 158,35 80,68 2,35" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`parallelogram`:return`<polygon points="32,2 158,2 128,68 2,68" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`oval`:return`<ellipse cx="80" cy="35" rx="78" ry="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`circle`:return`<circle cx="80" cy="35" r="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`database`:return`<g>
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{a as r,c as i,d as a,f as o,i as s,n as c,o as l,p as u,r as d,s as f,t as p}from"./downloadSVG-sVCad7p8.js";import{_ as ee,a as m,n as h,s as g}from"./dist--spER_Rx.js";import{n as te}from"./WorkspaceContext-M-vT9OAZ.js";import{G as _,H as v,J as y,K as b,V as x,W as S,Y as C,a as w,ft as ne,i as T,l as E,mt as D,n as re,q as O,s as k,u as A}from"./AIActionContext-sBtUZeB9.js";import{D as j,x as M}from"./useCompositeItem-ZIV61RjL.js";import{c as ie,l as N,t as P}from"./input-BDCM7QEk.js";import{n as ae,t as oe}from"./move-BlLS6EPB.js";import{n as se,r as ce,t as le}from"./undo-2-DSs-RD2B.js";import{t as ue}from"./card-Dy6p8t6g.js";import{t as F}from"./label-Co-it7VP.js";import{A as de,C as fe,D as I,Kt as pe,M as me,O as he,S as ge,T as _e,j as ve,k as ye,sn as be,w as xe,x as Se}from"./index-C3r2kpyC.js";/* empty css */import{t as Ce}from"./JumpToNode-NAVBzr-5.js";var L=e(t(),1),R=n(),z=(0,L.memo)(({data:e,selected:t})=>{let[n,r]=(0,L.useState)(!1),i=`!w-1.5 !h-1.5 !bg-white !border-none opacity-0 group-hover:opacity-100 transition-opacity z-20 cursor-crosshair`,a=(0,L.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]),o=(0,L.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]),s=(0,L.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,R.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,R.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,R.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,R.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,R.jsx)(`div`,{className:`absolute inset-0 rounded-[50px] pointer-events-none`,style:t});case`circle`:return(0,R.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,R.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,R.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,R.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,R.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,R.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,R.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,R.jsx)(`path`,{d:`M70,2 V30 H98`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`})]});case`cloud`:return(0,R.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,R.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,R.jsx)(`div`,{className:`absolute inset-0 rounded-md pointer-events-none`,style:t})}},[e.color,e.shape,t]);return(0,R.jsxs)(`div`,{className:`relative group flex items-center justify-center cursor-pointer transition-all duration-300 hover:scale-[1.02] ${a}`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{aspectRatio:e.shape===`circle`?`1 / 1`:`auto`},children:[(0,R.jsx)(f,{isVisible:t||n,keepAspectRatio:e.shape===`circle`,minWidth:o.width,minHeight:o.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`}}),s,(0,R.jsx)(l,{id:`top`,type:`target`,position:g.Top,className:i}),(0,R.jsx)(l,{id:`top`,type:`source`,position:g.Top,className:i}),(0,R.jsx)(l,{id:`bottom`,type:`target`,position:g.Bottom,className:i}),(0,R.jsx)(l,{id:`bottom`,type:`source`,position:g.Bottom,className:i}),(0,R.jsx)(l,{id:`right`,type:`target`,position:g.Right,className:i}),(0,R.jsx)(l,{id:`right`,type:`source`,position:g.Right,className:i}),(0,R.jsx)(l,{id:`left`,type:`target`,position:g.Left,className:i}),(0,R.jsx)(l,{id:`left`,type:`source`,position:g.Left,className:i}),(0,R.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,R.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})]})}),B=e=>e.trim().toLowerCase().includes(`start`);function we({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=B(n.label);return(0,R.jsx)(x,{open:e,onOpenChange:t,children:(0,R.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(C,{children:`Create New Symbol`}),(0,R.jsx)(_,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,R.jsxs)(v,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Label`}),(0,R.jsx)(P,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Group Title`}),(0,R.jsx)(P,{value:n.section||``,onChange:e=>r({...n,section:e.target.value||void 0}),placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted border-border text-foreground`}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Shape Type`}),(0,R.jsxs)(T,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select a shape`,children:n.shape?de[n.shape]:`Select a shape`})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`rectangle`,children:`Rectangle (Process)`}),(0,R.jsx)(k,{value:`oval`,children:`Oval (Start/End)`}),(0,R.jsx)(k,{value:`diamond`,children:`Diamond (Decision)`}),(0,R.jsx)(k,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,R.jsx)(k,{value:`database`,children:`Cylinder (Database)`}),(0,R.jsx)(k,{value:`document`,children:`Document`}),(0,R.jsx)(k,{value:`cloud`,children:`Cloud (External System)`}),(0,R.jsx)(k,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Color`}),(0,R.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,R.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,R.jsxs)(b,{children:[(0,R.jsx)(M,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,R.jsx)(M,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function V(e){return e.data.label.trim().toLowerCase().includes(`start`)}function Te({selectedNodeId:e,onClose:t,selectedNode:n,onUpdateNodeData:r,onDeleteNode:i,onDeleteGroup:a,onValidateSection:o}){let s=n?V(n):!1,[c,l]=(0,L.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),u=e=>{l(e),r({code:e})};return(0,R.jsx)(x,{open:!!e,onOpenChange:e=>{e||t()},children:(0,R.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(C,{children:`Symbol Properties`}),(0,R.jsx)(_,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,R.jsxs)(v,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Label`}),(0,R.jsx)(P,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,R.jsx)(`textarea`,{value:c,onChange:e=>u(e.target.value),placeholder:n.data.shape===`diamond`?`e.g. return context.amount > 100 ? 'Yes' : 'No';`:`e.g. context.status = 'Approved'; context.tries += 1;`,className:`w-full h-24 bg-muted border border-border rounded-md p-2 text-xs font-mono text-foreground placeholder:text-muted-foreground/50 resize-none focus:outline-none focus:border-ring`}),(0,R.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,R.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Group Title`}),(0,R.jsx)(P,{value:n.data.section||``,onChange:e=>r({section:e.target.value||void 0}),onBlur:e=>{let t=e.target.value;t&&o&&!o(t)&&r({section:void 0})},placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted/50 border-border text-foreground`}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Shape Type`}),(0,R.jsxs)(T,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select a shape`,children:n.data.shape?de[n.data.shape]:`Select a shape`})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`rectangle`,children:`Rectangle (Process)`}),(0,R.jsx)(k,{value:`oval`,children:`Oval (Start/End)`}),(0,R.jsx)(k,{value:`diamond`,children:`Diamond (Decision)`}),(0,R.jsx)(k,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,R.jsx)(k,{value:`database`,children:`Cylinder (Database)`}),(0,R.jsx)(k,{value:`document`,children:`Document`}),(0,R.jsx)(k,{value:`cloud`,children:`Cloud (External System)`}),(0,R.jsx)(k,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Color`}),(0,R.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:he.map(e=>(0,R.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,R.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,R.jsxs)(M,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,R.jsx)(j,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,R.jsxs)(M,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,R.jsx)(j,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Ee({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:i,onEdgeTypeChange:a,onArrowChange:o,onLabelChange:s,onDeleteEdge:c}){return(0,R.jsx)(x,{open:!!e,onOpenChange:e=>{e||t()},children:(0,R.jsxs)(S,{className:`sm:max-w-sm`,children:[(0,R.jsx)(O,{children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,R.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,R.jsx)(C,{children:`Connector Properties`}),(0,R.jsx)(_,{children:`Format the line style and arrows.`})]}),(0,R.jsx)(M,{variant:`ghost`,size:`icon`,onClick:c,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,children:(0,R.jsx)(j,{className:`w-4 h-4`})})]})}),n&&(0,R.jsxs)(v,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Text Label`}),(0,R.jsx)(P,{value:typeof n.label==`string`?n.label:``,onChange:e=>s(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Line Style`}),(0,R.jsxs)(T,{value:r?`dashed`:`solid`,onValueChange:e=>a(e||``),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select line style`,children:ye[r?`dashed`:`solid`]})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`solid`,children:`Solid Line`}),(0,R.jsx)(k,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(F,{children:`Arrow Style`}),(0,R.jsxs)(T,{value:i,onValueChange:e=>o(e||``),children:[(0,R.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,R.jsx)(A,{placeholder:`Select arrow style`,children:I[i]})}),(0,R.jsxs)(w,{className:`bg-popover border-border text-popover-foreground`,children:[(0,R.jsx)(k,{value:`end`,children:`Arrow at End`}),(0,R.jsx)(k,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,R.jsx)(k,{value:`both`,children:`Arrows Both Ends`}),(0,R.jsx)(k,{value:`none`,children:`No Arrows (Line only)`})]})]})]})]})]})})}function De({nodes:e,edges:t,onConfirm:n,onCancel:r,confirmLabel:i=`Confirm Append`,canvasGroups:a=[],existingNodes:o=[],existingEdges:s=[]}){let[c,l]=(0,L.useState)(null),u=(0,L.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,R.jsxs)(x,{open:!0,onOpenChange:e=>{e||r()},children:[(0,R.jsx)(y,{}),(0,R.jsxs)(S,{size:`2xl`,showCloseButton:!0,children:[(0,R.jsx)(O,{children:(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`div`,{className:`size-8 rounded-lg bg-indigo-500/10 flex items-center justify-center`,children:(0,R.jsx)(be,{className:`size-4 text-indigo-400`})}),(0,R.jsx)(`div`,{children:(0,R.jsx)(C,{children:`Preview Changes`})})]})}),(0,R.jsx)(v,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.length>0&&(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`New Symbols (`,e.length,`)`]}),(0,R.jsx)(`div`,{className:`max-h-75 overflow-y-auto custom-scrollbar space-y-2`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-2 border-b border-border/20 bg-muted/50`,children:[(0,R.jsx)(be,{className:`size-3 text-indigo-400 shrink-0`}),(0,R.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.data.label}),(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground ml-auto`,children:e.data.shape})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono`,children:[(0,R.jsx)(`span`,{className:`text-gray-500`,children:`Shape:`}),(0,R.jsx)(`span`,{className:`text-gray-300`,children:e.data.shape}),e.data.color&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 ml-2`,children:`Color:`}),(0,R.jsx)(`span`,{className:`text-gray-300`,children:e.data.color})]})]})]},e.id))})]}),u&&(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Changes`}),(0,R.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,R.jsx)(`div`,{className:`divide-y divide-border/10`,children:u.map((e,t)=>{if(e.type===`header`)return(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border/30`,children:[e.isNew&&(0,R.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,R.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,R.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-0.5 ${a}`,children:[(0,R.jsx)(`span`,{className:`w-4 shrink-0 select-none ${o}`,children:e.prefix}),(0,R.jsx)(`span`,{className:`w-20 shrink-0 ${c}`,children:e.field}),e.oldVal&&(0,R.jsx)(`span`,{className:`text-red-400/70 line-through`,children:e.oldVal}),e.oldVal&&e.newVal&&(0,R.jsx)(`span`,{className:`text-gray-600`,children:`→`}),e.newVal&&(0,R.jsx)(`span`,{className:s,children:e.newVal})]},t)})})})]}),!u&&!e.length&&(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes detected.`})]})}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 pt-4 pb-6`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-3`,children:a.length>0&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(ae,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,R.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Replace:`}),(0,R.jsxs)(T,{value:c??``,onValueChange:e=>l(e||null),children:[(0,R.jsx)(E,{className:`h-7 text-[12px]`,children:(0,R.jsx)(A,{placeholder:`All Symbols`})}),(0,R.jsxs)(w,{children:[(0,R.jsx)(k,{value:``,children:`All Symbols`}),a.map(e=>(0,R.jsx)(k,{value:e,children:e},e))]})]})]})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(M,{variant:`outline`,size:`sm`,onClick:r,className:`gap-2`,children:[(0,R.jsx)(ne,{className:`size-4`}),`Cancel`]}),(0,R.jsxs)(M,{size:`sm`,onClick:()=>n(c||void 0),className:`gap-2`,children:[(0,R.jsx)(N,{className:`size-4`}),i]})]})]})]})]})}function H(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 Oe(e,t){return H(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function ke(e,t){let n=[`top`,`bottom`,`left`,`right`],r=H(e.position),i=H(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 Ae(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 U(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,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{R as i}from"./note-importer-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-DZLeeonI.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/react-dom-CGnP4YFq.js","assets/preload-helper-Czpn1I53.js","assets/note-importer-B6ql7t2r.js","assets/dist--spER_Rx.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/utils-TcK2FSyg.js","assets/api-B4Lp0KNi.js","assets/image-compression-COYPhRs3.js","assets/WorkspaceContext-M-vT9OAZ.js","assets/AIActionContext-sBtUZeB9.js","assets/useControlled-DHoxCuAI.js","assets/floating-ui.utils.dom-B_-bZDGP.js","assets/useCompositeItem-ZIV61RjL.js","assets/floating-ui.utils-DrtUanoU.js","assets/createLucideIcon-CyJfQrak.js","assets/floating-ui.react-dom-C3qLYNxV.js","assets/input-BDCM7QEk.js","assets/erdActions-VP-88Vry.js","assets/scroll-area-CQ2HKq3N.js","assets/index-C3r2kpyC.js","assets/downloadSVG-sVCad7p8.js","assets/vanilla--C5Lp_AM.js","assets/link-2-DBo-eQZM.js","assets/wand-sparkles-C9YiTYBh.js","assets/popover-B51mz7qL.js","assets/card-Dy6p8t6g.js","assets/textarea-Bvirh6bi.js","assets/extends-CvVTau-c.js","assets/table-DCsJJ7Zs.js","assets/WorkspaceProvider-BKu0LKCS.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/label-Co-it7VP.js","assets/index-DuOqxUTN.css","assets/image-vqz7pCPE.js","assets/move-BlLS6EPB.js","assets/undo-2-DSs-RD2B.js","assets/refresh-ccw-DFj0g7WT.js","assets/Combination-DBeRPSUX.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{R as i}from"./note-importer-B6ql7t2r.js";import{n as a}from"./WorkspaceContext-M-vT9OAZ.js";import{t as o}from"./createLucideIcon-CyJfQrak.js";import"./WorkspaceProvider-BKu0LKCS.js";import{t as s}from"./ProjectFileTabs-DNmVwnNp.js";var c=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`}]]),l=e(t(),1),u=n(),d=l.lazy(()=>r(()=>import(`./NotesView-DZLeeonI.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])));function f(){let e=a(),{id:t}=i(),{activeNote:n,activeNoteUid:r,saveNote:o,handleNoteChange:f,deleteNote:p,isPublicView:m,isLoading:h,isNoteItemLoading:g,handleNoteSelect:_}=e,v=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(!(m||!t)&&!v.current){if(r===t){v.current=!0;return}r||(v.current=!0,_(t))}},[t,r,m,_]),!m&&!r?t&&!v.current?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]}):(0,u.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a note to view`})}):!n&&!g?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(c,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Note not found`}),(0,u.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This note may have been deleted or is no longer available.`})]}):n?(0,u.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,u.jsx)(s,{currentView:`notes`}),(0,u.jsx)(l.Suspense,{fallback:(0,u.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,u.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`span`,{className:`text-xs text-muted-foreground/60 animate-pulse`,children:`Loading note...`})]})}),children:(0,u.jsx)(d,{isLoading:g,activeNoteUid:m?null:r,activeNote:n,saveNote:o,handleNoteChange:f,deleteNote:p,isReadOnly:m})})]}):(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]})}export{f as NoteEditorRoute,c as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-
|
|
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{E as i,O as a,a as o}from"./note-importer-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-BDDl2HRQ.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/downloadSVG-sVCad7p8.js","assets/react-dom-CGnP4YFq.js","assets/dist--spER_Rx.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/WorkspaceContext-M-vT9OAZ.js","assets/vanilla--C5Lp_AM.js","assets/AIActionContext-sBtUZeB9.js","assets/useControlled-DHoxCuAI.js","assets/floating-ui.utils.dom-B_-bZDGP.js","assets/useCompositeItem-ZIV61RjL.js","assets/floating-ui.utils-DrtUanoU.js","assets/utils-TcK2FSyg.js","assets/createLucideIcon-CyJfQrak.js","assets/floating-ui.react-dom-C3qLYNxV.js","assets/input-BDCM7QEk.js","assets/move-BlLS6EPB.js","assets/undo-2-DSs-RD2B.js","assets/card-Dy6p8t6g.js","assets/label-Co-it7VP.js","assets/index-C3r2kpyC.js","assets/preload-helper-Czpn1I53.js","assets/note-importer-B6ql7t2r.js","assets/api-B4Lp0KNi.js","assets/image-compression-COYPhRs3.js","assets/link-2-DBo-eQZM.js","assets/wand-sparkles-C9YiTYBh.js","assets/popover-B51mz7qL.js","assets/scroll-area-CQ2HKq3N.js","assets/textarea-Bvirh6bi.js","assets/extends-CvVTau-c.js","assets/table-DCsJJ7Zs.js","assets/WorkspaceProvider-BKu0LKCS.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/index-DuOqxUTN.css","assets/JumpToNode-NAVBzr-5.js","assets/style-CHpVij2M.css","assets/ExcalidrawEditor-eQe4pyA3.js","assets/Combination-DBeRPSUX.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{E as i,O as a,a as o}from"./note-importer-B6ql7t2r.js";import{a as s,c,d as l,i as u,l as d,r as f,u as p}from"./downloadSVG-sVCad7p8.js";import{_ as m,a as h,n as g,r as _,ut as v}from"./dist--spER_Rx.js";import{n as y}from"./WorkspaceContext-M-vT9OAZ.js";import{x as ee}from"./useCompositeItem-ZIV61RjL.js";import{c as b}from"./input-BDCM7QEk.js";import{c as x}from"./popover-B51mz7qL.js";import{t as S}from"./api-B4Lp0KNi.js";import{I as C,Kt as w,m as T}from"./index-C3r2kpyC.js";/* empty css */import{n as E,t as D}from"./EntityNode-BubcTPns.js";var O=e(t(),1),k=n(),A={entity:D},j=(0,O.lazy)(()=>r(()=>import(`./FlowchartView-BDDl2HRQ.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]))),M=(0,O.lazy)(()=>r(()=>import(`./ExcalidrawEditor-eQe4pyA3.js`),__vite__mapDeps([41,1,2,4,24,8,9,17,12,14,26,27,33,42,23,25,5,6,7,15,3,11,10,13,16,18,28,29,30,31,21,32,34,35,36,37,22,38])));function N(e){if(!e)return null;try{return typeof e==`string`?JSON.parse(e):e}catch{return null}}function P(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 F(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(P)}}}async function I(e,t,n){if(n){let n=e===`erd`?`erd`:e===`flowchart`?`flowchart`:`drawings`;return await a.getResource(t)||((await a.getAllResources(n)).find(e=>String(e.uid??e.id)===t)??null)}let r=await S(`/api/${e===`erd`?`diagrams`:e===`flowchart`?`flowcharts`:`drawings`}/${t}`);return r.ok?r.json():null}function L(e){let t=N(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(F),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 R(e,t){let n=!!t;return e.map(e=>{let r=n&&(e.source===t||e.target===t),i=r||e.selected?`var(--edge-selected)`:`var(--edge-color)`,a=[e.className,r?`edge-animated-active`:n?`edge-dimmed`:``].filter(Boolean).join(` `);return{...e,type:`smoothstep`,style:{...e.style,stroke:i,strokeWidth:2},markerEnd:{type:h.Arrow,color:i,width:10,height:10},className:a}})}function z({document:e}){let t=(0,O.useMemo)(()=>L(e),[e]),{isGuest:n,resolvedTheme:r}=y(),[c,x]=(0,O.useState)(t.nodes),[w,D]=(0,O.useState)(t.edges),[j,M]=(0,O.useState)(null),[N,P]=(0,O.useState)(null),F=(0,O.useRef)(c),I=(0,O.useRef)(w),z=(0,O.useRef)(null);F.current=c,I.current=w;let B=(0,O.useCallback)((t,r)=>{z.current&&clearTimeout(z.current),z.current=setTimeout(async()=>{let s=t.map(e=>({...e.data,x:e.position.x,y:e.position.y})),c=r.map(i),l=o(t,r);try{if(n){let t=await a.getResource(e.uid??e.id);t&&await a.saveResource({...t,entities:s,relationships:c,data:null,dbml_source:l,updated_at:new Date().toISOString()})}else if(!(await S(`/api/diagrams/save/${e.uid??e.id}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entities:s,relationships:c,viewport:{x:0,y:0,zoom:1},data:null,dbmlSource:l})})).ok)throw Error()}catch{g.error(`Could not save ERD changes`)}},350)},[e.id,e.uid,n]),V=(0,O.useCallback)(e=>{let t=p(e,F.current);x(t),e.some(e=>e.type!==`select`&&e.type!==`dimensions`)&&B(t,I.current)},[B]),H=(0,O.useCallback)(e=>{let t=d(e,I.current);D(t),e.some(e=>e.type!==`select`)&&B(F.current,t)},[B]),U=(0,O.useCallback)(e=>{let t=m({...e,id:crypto.randomUUID(),type:`smoothstep`,label:`1:N`},I.current);D(t),B(F.current,t)},[B]),W=(0,O.useCallback)((e,t)=>{let n=typeof t==`string`?{label:t}:t,r=I.current.map(t=>t.id===e?{...t,...n,data:{...t.data||{},...n.data||{}}}:t);D(r),B(F.current,r)},[B]),G=(0,O.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=I.current.map(n=>n.id===e?{...n,sourceHandle:t(n.sourceHandle),targetHandle:t(n.targetHandle)}:n);D(n),B(F.current,n)},[B]),K=(0,O.useCallback)(e=>{let t=I.current.filter(t=>t.id!==e);D(t),P(null),B(F.current,t)},[B]),q=(0,O.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)){g.info(`Only the connector position can be changed`);return}let r=(e,t)=>{let r=n(t);return F.current.find(t=>String(t.id)===String(e))?.data.columns.find(e=>String(e.id)===String(r))},i=r(t.source,t.sourceHandle),a=r(t.target,t.targetHandle);if(i&&a&&i.type!==a.type){g.error(`Type Mismatch`,{description:`Cannot reconnect ${i.type} to ${a.type}`});return}let o=v(e,t,I.current);D(o),B(F.current,o)},[B]),J=(0,O.useCallback)(e=>{let t=F.current.map(t=>t.id===e.id?{...t,data:e}:t);x(t),B(t,I.current)},[B]),Y=(0,O.useCallback)(e=>{let t=F.current.filter(t=>t.id!==e),n=I.current.filter(t=>t.source!==e&&t.target!==e);x(t),D(n),M(null),B(t,n)},[B]),X=(0,O.useCallback)(()=>{let e=crypto.randomUUID(),t={id:e,name:`new_table`,x:80,y:80,color:`#6366f1`,columns:[]},n=[...F.current,{id:e,type:`entity`,position:{x:80,y:80},data:t}];x(n),M(e),B(n,I.current)},[B]);(0,O.useEffect)(()=>{let e=e=>M(e.detail?.id??null);return window.addEventListener(E,e),()=>window.removeEventListener(E,e)},[]);let Z=c.find(e=>e.id===j)?.data??null,Q=w.find(e=>e.id===N)??null,te=r===`dark`?`#222`:`#ccc`,$=(0,O.useMemo)(()=>({type:`smoothstep`,animated:!1,reconnectable:!0,style:{stroke:`var(--edge-color)`,strokeWidth:2},markerEnd:{type:h.Arrow,color:`var(--edge-color)`,width:10,height:10}}),[]),ne=(0,O.useMemo)(()=>c.map(e=>{let t=e.id===j;return!!e.selected===t?e:{...e,selected:t}}),[c,j]),re=(0,O.useMemo)(()=>R(w,j),[w,j]);return(0,k.jsxs)(`div`,{className:`relative h-full min-h-0 overflow-hidden bg-background`,children:[(0,k.jsxs)(l,{nodes:ne,edges:re,nodeTypes:A,onNodesChange:V,onEdgesChange:H,onConnect:U,onReconnect:q,nodesDraggable:!0,nodesConnectable:!0,elementsSelectable:!0,edgesReconnectable:!0,defaultEdgeOptions:$,onNodeClick:(e,t)=>{P(null),M(t.id)},onNodeDoubleClick:(e,t)=>{P(null),M(t.id)},onEdgeClick:(e,t)=>{M(null),P(t.id)},onPaneClick:()=>{M(null),P(null)},colorMode:r,connectionLineType:_.SmoothStep,connectionLineStyle:$.style,onlyRenderVisibleElements:!0,fitView:!0,children:[(0,k.jsx)(f,{variant:u.Lines,gap:50,size:1,color:te}),(0,k.jsx)(s,{position:`bottom-left`,showInteractive:!1})]}),(0,k.jsxs)(ee,{className:`absolute left-3 top-3 z-10`,size:`sm`,onClick:X,children:[(0,k.jsx)(b,{}),` Table`]}),Z&&(0,k.jsx)(`aside`,{className:`absolute inset-y-0 right-0 z-20 w-[min(22rem,82%)] border-l bg-background shadow-xl`,children:(0,k.jsx)(T,{selectedEntity:Z,onUpdateEntity:J,onDeleteEntity:Y,onBackToTables:()=>M(null),propertiesOnly:!0})}),(0,k.jsx)(C,{isOpen:!!N,onOpenChange:e=>{e||P(null)},selectedEdge:Q,nodes:c,handleEdgeUpdate:W,handleEdgeFlip:G,deleteEdge:K})]})}function B({pane:e,document:t}){let{saveFlowchart:n,saveDrawing:r,triggerDebouncedSync:i}=y();return e.type===`erd`?(0,k.jsx)(c,{children:(0,k.jsx)(z,{document:t},t.uid??t.id)}):e.type===`flowchart`?(0,k.jsx)(j,{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,k.jsx)(M,{compact:!0,drawing:t,onSave:r,onChange:e=>void r({...t,data:e}).then(()=>i()),onDelete:()=>{}})}function V({pane:e}){let{isGuest:t}=y(),[n,r]=(0,O.useState)(),[i,a]=(0,O.useState)(`loading`);return(0,O.useEffect)(()=>{let n=!0;return a(`loading`),r(void 0),I(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,k.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:(0,k.jsx)(w,{className:`size-4 animate-spin`})}):i===`missing`?(0,k.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,k.jsx)(x,{className:`size-5`}),`File unavailable`]}):(0,k.jsx)(B,{pane:e,document:n})}export{V as NotesCompanionPane};
|