erdbpro 3.4.5 → 3.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/assets/{AdminRoute-DrYi0_XF.js → AdminRoute-DgDkZ4nF.js} +2 -2
  2. package/dist/assets/{Combination-DBeRPSUX.js → Combination-2nvE_f7E.js} +1 -1
  3. package/dist/assets/{DataViewerModeToolbar-DnGcPEs4.js → DataViewerModeToolbar-CKe16HBw.js} +1 -1
  4. package/dist/assets/{DbClientEditorRoute-Bh_OaDEN.js → DbClientEditorRoute-fJWu1kOz.js} +1 -1
  5. package/dist/assets/{DiagramEditorRoute-Bw_onGfJ.js → DiagramEditorRoute-B97Lhpc3.js} +1 -1
  6. package/dist/assets/{DrawingEditorRoute-C4BSj3Ah.js → DrawingEditorRoute-DTSanAwe.js} +2 -2
  7. package/dist/assets/{DrawingsView-D0eNZF8l.js → DrawingsView-FhP6fHck.js} +1 -1
  8. package/dist/assets/{EntityNode-BubcTPns.js → EntityNode-Bt4UGEm3.js} +1 -1
  9. package/dist/assets/{ExcalidrawEditor-eQe4pyA3.js → ExcalidrawEditor-ChIW-Ded.js} +8 -8
  10. package/dist/assets/{FlowchartEditorRoute-EVt67UAs.js → FlowchartEditorRoute-DqW7ZUNe.js} +1 -1
  11. package/dist/assets/{FlowchartView-BDDl2HRQ.js → FlowchartView-CrVsO2vu.js} +1 -1
  12. package/dist/assets/{NoteEditorRoute-KduExmWL.js → NoteEditorRoute-DyQFlEwZ.js} +2 -2
  13. package/dist/assets/{NotesCompanionPane-Dgymv75J.js → NotesCompanionPane-DKOyUbEq.js} +2 -2
  14. package/dist/assets/{NotesView-DZLeeonI.js → NotesView-JL9UDwtI.js} +3 -3
  15. package/dist/assets/{ProjectFileTabs-DNmVwnNp.js → ProjectFileTabs-QBFv5wt8.js} +1 -1
  16. package/dist/assets/{TrashView-DodCb2d-.js → TrashView-D2MC_GHI.js} +1 -1
  17. package/dist/assets/{WorkspaceProvider-BKu0LKCS.js → WorkspaceProvider-BNlC5Aj9.js} +3 -3
  18. package/dist/assets/{abnfDiagram-N423BO3Z-BIaHzJSW.js → abnfDiagram-N423BO3Z-rdjDMYmk.js} +1 -1
  19. package/dist/assets/{ar-SA-G6X2FPQ2-CG4gXaCk.js → ar-SA-G6X2FPQ2-D-wZBCct.js} +1 -1
  20. package/dist/assets/{architectureDiagram-T3A2C74G-CiqSC_06.js → architectureDiagram-T3A2C74G-D2XKy1I-.js} +1 -1
  21. package/dist/assets/{az-AZ-76LH7QW2--jJJqvOX.js → az-AZ-76LH7QW2-tRs_Pz64.js} +1 -1
  22. package/dist/assets/{bg-BG-XCXSNQG7-5KB8b4-1.js → bg-BG-XCXSNQG7-BxpcvAnk.js} +1 -1
  23. package/dist/assets/{blockDiagram-VBNYF7ZC-DVnzKjMe.js → blockDiagram-VBNYF7ZC-CurlQYzG.js} +1 -1
  24. package/dist/assets/{bn-BD-2XOGV67Q-CSVJMRsA.js → bn-BD-2XOGV67Q-DcE6m_gh.js} +1 -1
  25. package/dist/assets/{c4Diagram-5PPSVZJV-DgFibHYM.js → c4Diagram-5PPSVZJV-BWMSf8Uz.js} +1 -1
  26. package/dist/assets/{ca-ES-6MX7JW3Y-C6W3PhTR.js → ca-ES-6MX7JW3Y-DeZm4mo7.js} +1 -1
  27. package/dist/assets/channel-C-Vpit1r.js +1 -0
  28. package/dist/assets/{chunk-2GRJ4B5K-BfJo-pSq.js → chunk-2GRJ4B5K-Cm1y2-Ee.js} +1 -1
  29. package/dist/assets/{chunk-4I5QYGJK-Bk5sydqb.js → chunk-4I5QYGJK-CsKzyaJI.js} +1 -1
  30. package/dist/assets/{chunk-5RXB4S5H-DO-MIcW8.js → chunk-5RXB4S5H-DDpfVIm_.js} +1 -1
  31. package/dist/assets/{chunk-6Q2QTUOP-CJO9T2Bg.js → chunk-6Q2QTUOP-Dd9xhZLT.js} +1 -1
  32. package/dist/assets/{chunk-7Z6QIM7H-wPvC3972.js → chunk-7Z6QIM7H-COVXKJw_.js} +1 -1
  33. package/dist/assets/{chunk-EIO257PC-BcR-Rmn-.js → chunk-EIO257PC-CLFyWRCM.js} +1 -1
  34. package/dist/assets/{chunk-GF5L2VYU-Ck5ix3h2.js → chunk-GF5L2VYU-Co_XT84R.js} +1 -1
  35. package/dist/assets/{chunk-I66GZJ75-BAPujJrX.js → chunk-I66GZJ75-ulf_GU5E.js} +1 -1
  36. package/dist/assets/{chunk-JQJVKLGR-B-Y010j-.js → chunk-JQJVKLGR-BK8QLtEB.js} +1 -1
  37. package/dist/assets/{chunk-KBJHAD2P-DwvdQHWQ.js → chunk-KBJHAD2P-Br3LWFmh.js} +1 -1
  38. package/dist/assets/{chunk-NSK5VX7P-BQcxfnS7.js → chunk-NSK5VX7P-9pzbFNE6.js} +1 -1
  39. package/dist/assets/{chunk-QR6OTTB3-Bu6w4SAv.js → chunk-QR6OTTB3-C49IoXTG.js} +1 -1
  40. package/dist/assets/{chunk-UBXNYLIW-Bg0ANHdr.js → chunk-UBXNYLIW-B-j0Dx3b.js} +1 -1
  41. package/dist/assets/{chunk-W5SLKNZC-WKiLOi7m.js → chunk-W5SLKNZC-T0cRMfAg.js} +1 -1
  42. package/dist/assets/{chunk-WRU74C26-DPaj0R57.js → chunk-WRU74C26-BUeKsIa5.js} +1 -1
  43. package/dist/assets/classDiagram-JCYQIIEL-0DCh0TfU.js +1 -0
  44. package/dist/assets/classDiagram-v2-OCEON4UE-0DCh0TfU.js +1 -0
  45. package/dist/assets/{cs-CZ-2BRQDIVT-D5UyiAfP.js → cs-CZ-2BRQDIVT-B6GaNo9q.js} +1 -1
  46. package/dist/assets/{cynefinDiagram-MW4NZA55-BmAPgFC3.js → cynefinDiagram-MW4NZA55-Bafd50WW.js} +1 -1
  47. package/dist/assets/{da-DK-5WZEPLOC-DzEZP48n.js → da-DK-5WZEPLOC-BXFwx3s4.js} +1 -1
  48. package/dist/assets/{dagre-VZM6K2ZE-CxYfeVya.js → dagre-VZM6K2ZE-7kLXKNwB.js} +1 -1
  49. package/dist/assets/{de-DE-XR44H4JA-DjuR_7Bi.js → de-DE-XR44H4JA-bQLFbqt2.js} +1 -1
  50. package/dist/assets/{diagram-7IWD3JNH-B5s4gGUD.js → diagram-7IWD3JNH-oTsaTWFG.js} +1 -1
  51. package/dist/assets/{diagram-B4RE2ZJO-CxwFiZ8o.js → diagram-B4RE2ZJO-9KN3-yPJ.js} +1 -1
  52. package/dist/assets/{diagram-LBJQPF4R-pOUu0uVk.js → diagram-LBJQPF4R-BAVWoI4m.js} +1 -1
  53. package/dist/assets/{diagram-Q27KOJAE-DabrQjsP.js → diagram-Q27KOJAE-BYBZ4IQA.js} +1 -1
  54. package/dist/assets/{diagram-UB23O5K3-BSE4nJMe.js → diagram-UB23O5K3--NanIpJM.js} +1 -1
  55. package/dist/assets/{dist-BG5dNAT3.js → dist-DqM5r95V.js} +4 -4
  56. package/dist/assets/{ebnfDiagram-BXEA7PRR-CP7jO6yI.js → ebnfDiagram-BXEA7PRR-CjC-VFSZ.js} +1 -1
  57. package/dist/assets/{el-GR-BZB4AONW-D-Db6qae.js → el-GR-BZB4AONW-BtzLRSEQ.js} +1 -1
  58. package/dist/assets/{en-B4ZKOASM-BbFTnkBC.js → en-B4ZKOASM-HxwhFgGa.js} +1 -1
  59. package/dist/assets/{erDiagram-JOGREHBK-EqmxZSIG.js → erDiagram-JOGREHBK-Y1SCSg0i.js} +1 -1
  60. package/dist/assets/{erdActions-VP-88Vry.js → erdActions-L-01Q-vA.js} +1 -1
  61. package/dist/assets/{es-ES-U4NZUMDT-RLVF3TwQ.js → es-ES-U4NZUMDT-D50-n_in.js} +1 -1
  62. package/dist/assets/{eu-ES-A7QVB2H4-B3yllD6c.js → eu-ES-A7QVB2H4-CTwzW678.js} +1 -1
  63. package/dist/assets/{fa-IR-HGAKTJCU-6dh_ViSv.js → fa-IR-HGAKTJCU-BDG-UhDp.js} +1 -1
  64. package/dist/assets/{fi-FI-Z5N7JZ37-Bn4at9_s.js → fi-FI-Z5N7JZ37-DuFdenFA.js} +1 -1
  65. package/dist/assets/flowDiagram-UKHOOZJN-CT16VuyC.js +1 -0
  66. package/dist/assets/{fr-FR-RHASNOE6-gr6d7jAa.js → fr-FR-RHASNOE6-B8o1o4eJ.js} +1 -1
  67. package/dist/assets/{ganttDiagram-PKOTCBZU-DJuDa00y.js → ganttDiagram-PKOTCBZU-shEQcDyK.js} +1 -1
  68. package/dist/assets/{gitGraphDiagram-DS77QQ5N-CXoCI54z.js → gitGraphDiagram-DS77QQ5N-Db_j7GQO.js} +1 -1
  69. package/dist/assets/{gl-ES-HMX3MZ6V-Bgv0CTGP.js → gl-ES-HMX3MZ6V-BFTWNE8w.js} +1 -1
  70. package/dist/assets/{he-IL-6SHJWFNN-C-1FWvRf.js → he-IL-6SHJWFNN-CyGJot7_.js} +1 -1
  71. package/dist/assets/{hi-IN-IWLTKZ5I-D1hlRs_K.js → hi-IN-IWLTKZ5I-UtdBOP2Q.js} +1 -1
  72. package/dist/assets/{hu-HU-A5ZG7DT2-BWKvbmHV.js → hu-HU-A5ZG7DT2-RkBRb3xN.js} +1 -1
  73. package/dist/assets/{id-ID-SAP4L64H-BeLPjdZ_.js → id-ID-SAP4L64H-DrJYmXU-.js} +1 -1
  74. package/dist/assets/image-GAAHSSAO-BwLYp0vk.js +1 -0
  75. package/dist/assets/{index-C3r2kpyC.js → index-B9iPSCUH.js} +4 -4
  76. package/dist/assets/{infoDiagram-6WML65LV-D1lynf9u.js → infoDiagram-6WML65LV-oTWa1vXF.js} +1 -1
  77. package/dist/assets/{ishikawaDiagram-WSZJBQD7-DpVH03gN.js → ishikawaDiagram-WSZJBQD7-BIBR_xc8.js} +1 -1
  78. package/dist/assets/{it-IT-JPQ66NNP-BE7vmYAT.js → it-IT-JPQ66NNP-C9okdrxf.js} +1 -1
  79. package/dist/assets/{ja-JP-DBVTYXUO-qXtpKb5u.js → ja-JP-DBVTYXUO-YT0TsCL_.js} +1 -1
  80. package/dist/assets/{journeyDiagram-NVQOT4AX-BsF2KEus.js → journeyDiagram-NVQOT4AX-CBQtULOf.js} +1 -1
  81. package/dist/assets/{kaa-6HZHGXH3-aDi8T9ap.js → kaa-6HZHGXH3-DgPjurcA.js} +1 -1
  82. package/dist/assets/{kab-KAB-ZGHBKWFO-CR2CfRi_.js → kab-KAB-ZGHBKWFO-BpXzSrcD.js} +1 -1
  83. package/dist/assets/{kanban-definition-27J2QSJJ-Cl4N_QQU.js → kanban-definition-27J2QSJJ-CU9LgakH.js} +1 -1
  84. package/dist/assets/{kk-KZ-P5N5QNE5-DjUmH-P5.js → kk-KZ-P5N5QNE5-1lv4xg33.js} +1 -1
  85. package/dist/assets/{km-KH-HSX4SM5Z-CyNPtzM3.js → km-KH-HSX4SM5Z-7DgXWklW.js} +1 -1
  86. package/dist/assets/{ko-KR-MTYHY66A-CgFlnosj.js → ko-KR-MTYHY66A-D1thdd_d.js} +1 -1
  87. package/dist/assets/{ku-TR-6OUDTVRD-D77qM3OE.js → ku-TR-6OUDTVRD-DyVpcYFS.js} +1 -1
  88. package/dist/assets/{line-Bz4J9juH.js → line-CLz9rAv7.js} +1 -1
  89. package/dist/assets/{lt-LT-XHIRWOB4-Cz0nGCpZ.js → lt-LT-XHIRWOB4-J5rBl71J.js} +1 -1
  90. package/dist/assets/{lv-LV-5QDEKY6T-B0AN-h0Y.js → lv-LV-5QDEKY6T-CAW59kOD.js} +1 -1
  91. package/dist/assets/{mindmap-definition-FAOFIHXS-CTk2KZzX.js → mindmap-definition-FAOFIHXS-XoNJwOqL.js} +1 -1
  92. package/dist/assets/{mr-IN-CRQNXWMA-SQAI4q2W.js → mr-IN-CRQNXWMA-Bm0Z6C8Q.js} +1 -1
  93. package/dist/assets/{my-MM-5M5IBNSE-RUb9G-l1.js → my-MM-5M5IBNSE-DxllHCGM.js} +1 -1
  94. package/dist/assets/{nb-NO-T6EIAALU-CHt-iHDP.js → nb-NO-T6EIAALU-CMuKdeiA.js} +1 -1
  95. package/dist/assets/{nl-NL-IS3SIHDZ-CcRbegnc.js → nl-NL-IS3SIHDZ-CJ7kHw5K.js} +1 -1
  96. package/dist/assets/{nn-NO-6E72VCQL-DtnGt-Um.js → nn-NO-6E72VCQL-BkILq0vB.js} +1 -1
  97. package/dist/assets/{note-importer-B6ql7t2r.js → note-importer-QEXL_ehd.js} +2 -2
  98. package/dist/assets/{oc-FR-POXYY2M6-Chi6gHvw.js → oc-FR-POXYY2M6-vbumMs3W.js} +1 -1
  99. package/dist/assets/{pa-IN-N4M65BXN-b20NieWg.js → pa-IN-N4M65BXN-CACJ1jF8.js} +1 -1
  100. package/dist/assets/{pegDiagram-VL7TDLO6-DTlHveRH.js → pegDiagram-VL7TDLO6-DdDC6Bjm.js} +1 -1
  101. package/dist/assets/percentages-BXMCSKIN-5ldjLSCX.js +1 -0
  102. package/dist/assets/{pieDiagram-7S7Q4E2Y-BTnTvVK5.js → pieDiagram-7S7Q4E2Y-YzV23_TA.js} +1 -1
  103. package/dist/assets/{pl-PL-T2D74RX3-B2Ing3px.js → pl-PL-T2D74RX3-BCKbtMny.js} +1 -1
  104. package/dist/assets/{pt-BR-5N22H2LF-CSpjm1Sp.js → pt-BR-5N22H2LF-fdpUIDnp.js} +1 -1
  105. package/dist/assets/{pt-PT-UZXXM6DQ-BJ3Ndc7i.js → pt-PT-UZXXM6DQ-CzznqsZL.js} +1 -1
  106. package/dist/assets/{quadrantDiagram-CIZ2JOQS-DNIiCyYf.js → quadrantDiagram-CIZ2JOQS-DRb29tvs.js} +1 -1
  107. package/dist/assets/{railroadDiagram-AXF67PYL-BS6Q9VmO.js → railroadDiagram-AXF67PYL-DxxQpRMW.js} +1 -1
  108. package/dist/assets/{requirementDiagram-LRYGKXZP-CrLBS59l.js → requirementDiagram-LRYGKXZP-cijYtzSI.js} +1 -1
  109. package/dist/assets/{ro-RO-JPDTUUEW-VjQCLUXP.js → ro-RO-JPDTUUEW-CeY5v17X.js} +1 -1
  110. package/dist/assets/{ru-RU-B4JR7IUQ-CRdjuuv9.js → ru-RU-B4JR7IUQ-aJDbScZA.js} +1 -1
  111. package/dist/assets/{sankeyDiagram-W5VNT64P-gsIoAwUA.js → sankeyDiagram-W5VNT64P-nkJ5LbWU.js} +1 -1
  112. package/dist/assets/{sequenceDiagram-SI44F4Z6-XZTPXpTp.js → sequenceDiagram-SI44F4Z6-CE90KQiN.js} +1 -1
  113. package/dist/assets/{si-LK-N5RQ5JYF-B_feK85p.js → si-LK-N5RQ5JYF-DKOSdn32.js} +1 -1
  114. package/dist/assets/{sk-SK-C5VTKIMK-fcWDOZ4q.js → sk-SK-C5VTKIMK-7NoIEJOz.js} +1 -1
  115. package/dist/assets/{sl-SI-NN7IZMDC-DZaUphkt.js → sl-SI-NN7IZMDC-a9YQ-eVo.js} +1 -1
  116. package/dist/assets/{stateDiagram-OKZ733FA-WPy8HF60.js → stateDiagram-OKZ733FA-D4waY69Z.js} +1 -1
  117. package/dist/assets/stateDiagram-v2-UEYNNEHI-eKQUK8OR.js +1 -0
  118. package/dist/assets/subset-shared.chunk-CqOzG2sM.js +1 -0
  119. package/dist/assets/{subset-worker.chunk-Clzwhyvs.js → subset-worker.chunk-BsUyu6Ps.js} +1 -1
  120. package/dist/assets/{sv-SE-XGPEYMSR-DrbbsUyQ.js → sv-SE-XGPEYMSR-B5nLzhyg.js} +1 -1
  121. package/dist/assets/{swimlanes-SLNWSIFB-D4z9qwfX.js → swimlanes-SLNWSIFB-QoxGz5P-.js} +1 -1
  122. package/dist/assets/swimlanesDiagram-ULZ7WXOC-Bg29s9e3.js +8 -0
  123. package/dist/assets/{ta-IN-2NMHFXQM-Y5VJiFwc.js → ta-IN-2NMHFXQM-B35mCoha.js} +1 -1
  124. package/dist/assets/{th-TH-HPSO5L25-BKS6bxz1.js → th-TH-HPSO5L25-CvvDV1N0.js} +1 -1
  125. package/dist/assets/{timeline-definition-Z64GVDOM-CAoZtDwA.js → timeline-definition-Z64GVDOM-BNvlkfbE.js} +1 -1
  126. package/dist/assets/{tr-TR-DEFEU3FU-CEHSX0uR.js → tr-TR-DEFEU3FU-8sHd0Yor.js} +1 -1
  127. package/dist/assets/{uk-UA-QMV73CPH-DLxBVU34.js → uk-UA-QMV73CPH-LKFWkEcd.js} +1 -1
  128. package/dist/assets/{vennDiagram-T6HMQDX7-BRdzUVJj.js → vennDiagram-T6HMQDX7-CbNMVuSH.js} +1 -1
  129. package/dist/assets/{vi-VN-M7AON7JQ-D1GV_new.js → vi-VN-M7AON7JQ-DaRGfV0w.js} +1 -1
  130. package/dist/assets/{wardleyDiagram-T6FBY63Y-JVbV7JBk.js → wardleyDiagram-T6FBY63Y-Be31RuFO.js} +1 -1
  131. package/dist/assets/{xychartDiagram-ELKLHX3M-ATEjNUSw.js → xychartDiagram-ELKLHX3M-B65cYfAo.js} +1 -1
  132. package/dist/assets/{zh-CN-LNUGB5OW-gSK0Mg4q.js → zh-CN-LNUGB5OW-De3ZTNi3.js} +1 -1
  133. package/dist/assets/{zh-HK-E62DVLB3-CKO-0Ly6.js → zh-HK-E62DVLB3-Skca7pgd.js} +1 -1
  134. package/dist/assets/{zh-TW-RAJ6MFWO-BYW5DTNY.js → zh-TW-RAJ6MFWO-DnaO71RW.js} +1 -1
  135. package/dist/index.html +3 -3
  136. package/dist-server/index.js +3 -3
  137. package/package.json +1 -1
  138. package/dist/assets/channel-DRYJfrrf.js +0 -1
  139. package/dist/assets/classDiagram-JCYQIIEL-BIX50rl-.js +0 -1
  140. package/dist/assets/classDiagram-v2-OCEON4UE-BIX50rl-.js +0 -1
  141. package/dist/assets/flowDiagram-UKHOOZJN-Cmscwpyz.js +0 -1
  142. package/dist/assets/image-GAAHSSAO-BDqkWo5z.js +0 -1
  143. package/dist/assets/percentages-BXMCSKIN-NYJord4U.js +0 -1
  144. package/dist/assets/stateDiagram-v2-UEYNNEHI-APHd0SA2.js +0 -1
  145. package/dist/assets/subset-shared.chunk-DyXAjJN9.js +0 -1
  146. package/dist/assets/swimlanesDiagram-ULZ7WXOC-uLXOIwEf.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{L as r,O as i,z as a}from"./note-importer-B6ql7t2r.js";import{n as o}from"./WorkspaceContext-M-vT9OAZ.js";import{r as s}from"./utils-TcK2FSyg.js";import{c,l,t as ee}from"./input-BDCM7QEk.js";import{t as u}from"./api-B4Lp0KNi.js";import"./WorkspaceProvider-BKu0LKCS.js";import{En as d,Nt as f,Tn as p,gn as m,sn as h}from"./index-C3r2kpyC.js";var g=e(t(),1),_=n(),v=[{id:`notes`,label:`Notes`,icon:m,route:`/notes`},{id:`erd`,label:`ERD Builder`,icon:p,route:`/diagrams`},{id:`db-client`,label:`DB Client`,icon:d,route:`/db-client`},{id:`flowchart`,label:`Flowchart`,icon:h,route:`/flowcharts`},{id:`drawings`,label:`Drawings`,icon:f,route:`/drawings`}],y=e=>e.title||e.name||`Untitled`,b=e=>e.uid||e.id,x=e=>new Date(e.created_at||e.createdAt||0).getTime(),S=3e4,C=new Map,w=new Map,T=(e,t)=>{let n=e?.uid??e?.id;return n==null?null:{type:t,uid:String(n),title:y(e),createdAt:e.created_at??e.createdAt}};function E(e,t){let n=t=>!t.is_deleted&&!t.isDeleted&&String(t.project_id??t.projectId)===String(e),r=(e,t)=>e.filter(n).map(e=>T(e,t)).filter(e=>e!==null);return[...r(t.notes,`notes`),...r(t.diagrams.filter(e=>(e.source_type??e.sourceType)!==`production_db`),`erd`),...r(t.flowcharts,`flowchart`),...r(t.drawings,`drawings`)]}function te(...e){return[...new Map(e.flatMap(e=>e.map(e=>[`${e.type}-${e.uid}`,e]))).values()].sort((e,t)=>x(e)-x(t))}async function ne(e,t){let n=String(e),r=`${t}:${n}`,i=C.get(r);if(i&&i.expiresAt>Date.now())return i;let a=w.get(r);if(a)return a;let o=u(`/api/projects/${encodeURIComponent(n)}/files`).then(async e=>{if(!e.ok)throw Error(`Failed to load project files`);let t=await e.json(),n={files:Array.isArray(t.data)?t.data:[]};return C.set(r,{...n,expiresAt:Date.now()+S}),n}).finally(()=>w.delete(r));return w.set(r,o),o}function D({currentView:e,currentFile:t}){let[n,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(`notes`),[p,m]=(0,g.useState)(``),[h,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)({projectKey:``,files:[]}),w=(0,g.useRef)(null),D=(0,g.useRef)(null),O=r(),[k]=a(),{user:A,isGuest:j,activeProjectId:M,notes:N,diagrams:P,drawings:F,flowcharts:I,activeDiagram:L,activeNote:R,activeDrawing:z,activeFlowchart:B,activeDiagramId:V,activeNoteUid:H,activeDrawingId:U,activeFlowchartId:W,handleDiagramSelect:G,handleSidebarDiagramCreate:K,handleSidebarNoteCreate:q,handleSidebarDrawingCreate:J,handleSidebarFlowchartCreate:Y}=o();(0,g.useEffect)(()=>{if(!n)return;let e=e=>{w.current?.contains(e.target)||(u(!1),m(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]),(0,g.useEffect)(()=>{n&&setTimeout(()=>D.current?.focus(),0)},[n,d]);let X=(0,g.useMemo)(()=>{let n=t??(e===`notes`?R:e===`erd`?L:e===`flowchart`?B:z);return n?.project_id??n?.projectId??(M&&M!==`all`?M:k.get(`pid`))},[M,R,L,B,z,t,e,k]),re=X==null?``:String(X),Z=S.projectKey===re?S.files:[],Q=(0,g.useMemo)(()=>X?E(X,{notes:N,diagrams:P,drawings:F,flowcharts:I}):[],[X,N,P,F,I]);(0,g.useEffect)(()=>{if(!X){C({projectKey:``,files:[]});return}if(!j&&A?.id==null)return;let e=!1,t=String(X);return(async()=>{try{let n;if(j){let[e,t,r,a]=await Promise.all([i.getAllResources(`notes`),i.getAllResources(`erd`),i.getAllResources(`flowchart`),i.getAllResources(`drawings`)]);n=E(X,{notes:e,diagrams:t,flowcharts:r,drawings:a})}else n=(await ne(X,A.id)).files;e||C({projectKey:t,files:n})}catch{e||C({projectKey:t,files:[]})}})(),()=>{e=!0}},[X,j,A?.id]);let ie=(0,g.useMemo)(()=>{if(!X)return[];let n=t??(e===`notes`?R:e===`erd`?L:e===`flowchart`?B:z),r=n?T(n,e):null;return te(Z,Q,r?[r]:[]).map(e=>({file:e,type:e.type}))},[X,Z,Q,e,t,R,L,B,z]),ae=t?b(t):e===`notes`?H:e===`erd`?L?.uid||V:e===`flowchart`?B?.uid||W:z?.uid||U,oe=(e,t)=>{if(e===`erd`){G(String(b(t)));return}let n=v.find(t=>t.id===e);if(!n)return;let r=new URLSearchParams({pid:String(X)});O(`${n.route}/${b(t)}?${r}`)},$=async()=>{let e=p.trim();if(!(!e||h||!X)){x(!0);try{let t=String(X);d===`notes`?await q(e,t):d===`erd`?await K(e,t):d===`flowchart`?await Y(e,t):await J(e,t),u(!1),m(``)}finally{x(!1)}}};return X?(0,_.jsxs)(`div`,{className:`flex min-h-12 items-center border-b bg-background shrink-0`,children:[(0,_.jsx)(`div`,{className:`flex-1 min-w-0 overflow-x-auto scrollbar-hide`,children:(0,_.jsx)(`div`,{className:`flex items-center justify-start gap-1 px-3 py-2`,children:ie.map(({file:t,type:n})=>{let r=v.find(e=>e.id===n),i=r.icon,a=b(t);return(0,_.jsxs)(`button`,{onClick:()=>oe(n,t),className:s(`flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors`,e===n&&String(ae)===String(a)?`bg-primary text-primary-foreground shadow-sm`:`bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground`),title:`${r.label}: ${y(t)}`,children:[(0,_.jsx)(i,{className:`size-3.5`}),(0,_.jsx)(`span`,{className:`truncate`,children:y(t)})]},`${n}-${a}`)})})}),(0,_.jsxs)(`div`,{ref:w,className:`relative shrink-0 self-stretch border-l bg-background px-2 py-2`,children:[(0,_.jsx)(`button`,{onClick:()=>u(e=>!e),className:`flex size-8 items-center justify-center rounded-md bg-primary text-primary-foreground shadow-sm hover:bg-primary/90`,"aria-label":`Create file`,"aria-expanded":n,children:(0,_.jsx)(c,{className:`size-4`})}),n&&(0,_.jsxs)(`div`,{className:`absolute right-2 top-full z-50 mt-1 w-72 overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md`,children:[(0,_.jsx)(`div`,{className:`max-h-56 overflow-y-auto p-1`,children:v.filter(e=>e.id!==`db-client`).map(e=>{let t=e.icon;return(0,_.jsxs)(`button`,{onClick:()=>f(e.id),className:s(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent`,d===e.id&&`bg-accent text-accent-foreground`),children:[(0,_.jsx)(t,{className:`size-4`}),(0,_.jsx)(`span`,{className:`flex-1`,children:e.label}),d===e.id&&(0,_.jsx)(l,{className:`size-4`})]},e.id)})}),(0,_.jsxs)(`div`,{className:`sticky bottom-0 flex gap-2 border-t bg-popover p-2`,children:[(0,_.jsx)(ee,{ref:D,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&$(),e.key===`Escape`&&(u(!1),m(``))},placeholder:`New file name`,className:`h-8 text-xs`,disabled:h}),(0,_.jsx)(`button`,{onClick:$,disabled:!p.trim()||h,className:`h-8 shrink-0 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,children:`Create`})]})]})]})]}):null}export{D as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{L as r,O as i,z as a}from"./note-importer-QEXL_ehd.js";import{n as o}from"./WorkspaceContext-M-vT9OAZ.js";import{r as s}from"./utils-TcK2FSyg.js";import{c,l,t as ee}from"./input-BDCM7QEk.js";import{t as u}from"./api-B4Lp0KNi.js";import"./WorkspaceProvider-BNlC5Aj9.js";import{En as d,Nt as f,Tn as p,gn as m,sn as h}from"./index-B9iPSCUH.js";var g=e(t(),1),_=n(),v=[{id:`notes`,label:`Notes`,icon:m,route:`/notes`},{id:`erd`,label:`ERD Builder`,icon:p,route:`/diagrams`},{id:`db-client`,label:`DB Client`,icon:d,route:`/db-client`},{id:`flowchart`,label:`Flowchart`,icon:h,route:`/flowcharts`},{id:`drawings`,label:`Drawings`,icon:f,route:`/drawings`}],y=e=>e.title||e.name||`Untitled`,b=e=>e.uid||e.id,x=e=>new Date(e.created_at||e.createdAt||0).getTime(),S=3e4,C=new Map,w=new Map,T=(e,t)=>{let n=e?.uid??e?.id;return n==null?null:{type:t,uid:String(n),title:y(e),createdAt:e.created_at??e.createdAt}};function E(e,t){let n=t=>!t.is_deleted&&!t.isDeleted&&String(t.project_id??t.projectId)===String(e),r=(e,t)=>e.filter(n).map(e=>T(e,t)).filter(e=>e!==null);return[...r(t.notes,`notes`),...r(t.diagrams.filter(e=>(e.source_type??e.sourceType)!==`production_db`),`erd`),...r(t.flowcharts,`flowchart`),...r(t.drawings,`drawings`)]}function te(...e){return[...new Map(e.flatMap(e=>e.map(e=>[`${e.type}-${e.uid}`,e]))).values()].sort((e,t)=>x(e)-x(t))}async function ne(e,t){let n=String(e),r=`${t}:${n}`,i=C.get(r);if(i&&i.expiresAt>Date.now())return i;let a=w.get(r);if(a)return a;let o=u(`/api/projects/${encodeURIComponent(n)}/files`).then(async e=>{if(!e.ok)throw Error(`Failed to load project files`);let t=await e.json(),n={files:Array.isArray(t.data)?t.data:[]};return C.set(r,{...n,expiresAt:Date.now()+S}),n}).finally(()=>w.delete(r));return w.set(r,o),o}function D({currentView:e,currentFile:t}){let[n,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(`notes`),[p,m]=(0,g.useState)(``),[h,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)({projectKey:``,files:[]}),w=(0,g.useRef)(null),D=(0,g.useRef)(null),O=r(),[k]=a(),{user:A,isGuest:j,activeProjectId:M,notes:N,diagrams:P,drawings:F,flowcharts:I,activeDiagram:L,activeNote:R,activeDrawing:z,activeFlowchart:B,activeDiagramId:V,activeNoteUid:H,activeDrawingId:U,activeFlowchartId:W,handleDiagramSelect:G,handleSidebarDiagramCreate:K,handleSidebarNoteCreate:q,handleSidebarDrawingCreate:J,handleSidebarFlowchartCreate:Y}=o();(0,g.useEffect)(()=>{if(!n)return;let e=e=>{w.current?.contains(e.target)||(u(!1),m(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]),(0,g.useEffect)(()=>{n&&setTimeout(()=>D.current?.focus(),0)},[n,d]);let X=(0,g.useMemo)(()=>{let n=t??(e===`notes`?R:e===`erd`?L:e===`flowchart`?B:z);return n?.project_id??n?.projectId??(M&&M!==`all`?M:k.get(`pid`))},[M,R,L,B,z,t,e,k]),re=X==null?``:String(X),Z=S.projectKey===re?S.files:[],Q=(0,g.useMemo)(()=>X?E(X,{notes:N,diagrams:P,drawings:F,flowcharts:I}):[],[X,N,P,F,I]);(0,g.useEffect)(()=>{if(!X){C({projectKey:``,files:[]});return}if(!j&&A?.id==null)return;let e=!1,t=String(X);return(async()=>{try{let n;if(j){let[e,t,r,a]=await Promise.all([i.getAllResources(`notes`),i.getAllResources(`erd`),i.getAllResources(`flowchart`),i.getAllResources(`drawings`)]);n=E(X,{notes:e,diagrams:t,flowcharts:r,drawings:a})}else n=(await ne(X,A.id)).files;e||C({projectKey:t,files:n})}catch{e||C({projectKey:t,files:[]})}})(),()=>{e=!0}},[X,j,A?.id]);let ie=(0,g.useMemo)(()=>{if(!X)return[];let n=t??(e===`notes`?R:e===`erd`?L:e===`flowchart`?B:z),r=n?T(n,e):null;return te(Z,Q,r?[r]:[]).map(e=>({file:e,type:e.type}))},[X,Z,Q,e,t,R,L,B,z]),ae=t?b(t):e===`notes`?H:e===`erd`?L?.uid||V:e===`flowchart`?B?.uid||W:z?.uid||U,oe=(e,t)=>{if(e===`erd`){G(String(b(t)));return}let n=v.find(t=>t.id===e);if(!n)return;let r=new URLSearchParams({pid:String(X)});O(`${n.route}/${b(t)}?${r}`)},$=async()=>{let e=p.trim();if(!(!e||h||!X)){x(!0);try{let t=String(X);d===`notes`?await q(e,t):d===`erd`?await K(e,t):d===`flowchart`?await Y(e,t):await J(e,t),u(!1),m(``)}finally{x(!1)}}};return X?(0,_.jsxs)(`div`,{className:`flex min-h-12 items-center border-b bg-background shrink-0`,children:[(0,_.jsx)(`div`,{className:`flex-1 min-w-0 overflow-x-auto scrollbar-hide`,children:(0,_.jsx)(`div`,{className:`flex items-center justify-start gap-1 px-3 py-2`,children:ie.map(({file:t,type:n})=>{let r=v.find(e=>e.id===n),i=r.icon,a=b(t);return(0,_.jsxs)(`button`,{onClick:()=>oe(n,t),className:s(`flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors`,e===n&&String(ae)===String(a)?`bg-primary text-primary-foreground shadow-sm`:`bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground`),title:`${r.label}: ${y(t)}`,children:[(0,_.jsx)(i,{className:`size-3.5`}),(0,_.jsx)(`span`,{className:`truncate`,children:y(t)})]},`${n}-${a}`)})})}),(0,_.jsxs)(`div`,{ref:w,className:`relative shrink-0 self-stretch border-l bg-background px-2 py-2`,children:[(0,_.jsx)(`button`,{onClick:()=>u(e=>!e),className:`flex size-8 items-center justify-center rounded-md bg-primary text-primary-foreground shadow-sm hover:bg-primary/90`,"aria-label":`Create file`,"aria-expanded":n,children:(0,_.jsx)(c,{className:`size-4`})}),n&&(0,_.jsxs)(`div`,{className:`absolute right-2 top-full z-50 mt-1 w-72 overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md`,children:[(0,_.jsx)(`div`,{className:`max-h-56 overflow-y-auto p-1`,children:v.filter(e=>e.id!==`db-client`).map(e=>{let t=e.icon;return(0,_.jsxs)(`button`,{onClick:()=>f(e.id),className:s(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent`,d===e.id&&`bg-accent text-accent-foreground`),children:[(0,_.jsx)(t,{className:`size-4`}),(0,_.jsx)(`span`,{className:`flex-1`,children:e.label}),d===e.id&&(0,_.jsx)(l,{className:`size-4`})]},e.id)})}),(0,_.jsxs)(`div`,{className:`sticky bottom-0 flex gap-2 border-t bg-popover p-2`,children:[(0,_.jsx)(ee,{ref:D,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&$(),e.key===`Escape`&&(u(!1),m(``))},placeholder:`New file name`,className:`h-8 text-xs`,disabled:h}),(0,_.jsx)(`button`,{onClick:$,disabled:!p.trim()||h,className:`h-8 shrink-0 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,children:`Create`})]})]})]})]}):null}export{D 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{A as r,E as i,c as a,et as o,j as s,k as c,n as l,r as u,t as d,tt as f,u as p,y as m}from"./useControlled-DHoxCuAI.js";import{A as h,C as g,D as _,M as v,N as y,O as b,P as x,i as S,k as C,n as w,t as T,w as E,x as D}from"./useCompositeItem-ZIV61RjL.js";import{r as O}from"./utils-TcK2FSyg.js";import{t as k}from"./refresh-ccw-DFj0g7WT.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./table-DCsJJ7Zs.js";import{Bt as I,En as L,Kt as R,Nt as z,Tn as B,_t as V,cn as H,g as ee,h as U,pt as te,tt as W}from"./index-C3r2kpyC.js";var G=e(t()),K=G.createContext(void 0);function q(){let e=G.useContext(K);if(e===void 0)throw Error(o(64));return e}var ne=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),J={tabActivationDirection:e=>({[ne.activationDirection]:e})},Y=n(),re=G.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:o=`horizontal`,render:s,value:c,...l}=e,p=C(),m=Object.hasOwn(e,`defaultValue`),h=G.useRef([]),[g,_]=G.useState(()=>new Map),[v,y]=d({controlled:c,default:r,name:`Tabs`,state:`value`}),b=c!==void 0,[x,S]=G.useState(()=>new Map),[T,E]=G.useState(`none`),D=a((e,t)=>{i?.(e,t),!t.isCanceled&&(y(e),E(t.activationDirection))}),O=a((e,t)=>{_(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),k=a((e,t)=>{_(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),A=G.useCallback(e=>g.get(e),[g]),j=G.useCallback(e=>{for(let t of x.values())if(e===t?.value)return t?.id},[x]),M=G.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of x.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[x]),N=G.useMemo(()=>({direction:p,getTabElementBySelectedValue:M,getTabIdByPanelValue:j,getTabPanelIdByValue:A,onValueChange:D,orientation:o,registerMountedTabPanel:O,setTabMap:S,unregisterMountedTabPanel:k,tabActivationDirection:T,value:v}),[p,M,j,A,D,o,O,S,k,T,v]),P=G.useMemo(()=>{for(let e of x.values())if(e!=null&&e.value===v)return e},[x,v]),F=G.useMemo(()=>{for(let e of x.values())if(e!=null&&!e.disabled)return e.value},[x]);f(()=>{if(b||x.size===0)return;let e=P?.disabled;if(m&&e&&v===r||!e&&(P!=null||v===null))return;let t=F??null;v!==t&&(y(t),E(`none`))},[r,F,m,b,P,E,y,x,v]);let I=u(`div`,e,{state:{orientation:o,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:J});return(0,Y.jsx)(K.Provider,{value:N,children:(0,Y.jsx)(w,{elementsRef:h,children:I})})}),X=G.createContext(void 0);function ie(){let e=G.useContext(X);if(e===void 0)throw Error(o(65));return e}var ae=G.forwardRef(function(e,t){let{className:n,disabled:i=!1,render:a,value:o,id:d,nativeButton:h=!0,...g}=e,{value:_,getTabPanelIdByValue:v,orientation:y}=q(),{activateOnFocus:b,highlightedTabIndex:x,onTabActivation:S,registerTabResizeObserverElement:C,setHighlightedTabIndex:w,tabsListElement:D}=ie(),O=l(d),k=G.useMemo(()=>({disabled:i,id:O,value:o}),[i,O,o]),{compositeProps:A,compositeRef:j,index:M}=T({metadata:k}),N=o===_,P=G.useRef(!1),F=G.useRef(null);G.useEffect(()=>{let e=F.current;if(e)return C(e)},[C]),f(()=>{if(P.current){P.current=!1;return}if(!(N&&M>-1&&x!==M))return;let e=D;if(e!=null){let t=r(c(e));if(t&&s(e,t))return}i||w(M)},[N,M,x,w,i,D]);let{getButtonProps:I,buttonRef:L}=E({disabled:i,native:h,focusableWhenDisabled:!0}),R=v(o),z=G.useRef(!1),B=G.useRef(!1);function V(e){N||i||S(o,p(m,e.nativeEvent,void 0,{activationDirection:`none`}))}function H(e){N||(M>-1&&!i&&w(M),!i&&b&&(!z.current||z.current&&B.current)&&S(o,p(m,e.nativeEvent,void 0,{activationDirection:`none`})))}function U(e){if(N||i)return;z.current=!0;function t(){z.current=!1,B.current=!1}(!e.button||e.button===0)&&(B.current=!0,c(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return u(`button`,e,{state:{disabled:i,active:N,orientation:y},ref:[t,L,j,F],props:[A,{role:`tab`,"aria-controls":R,"aria-selected":N,id:O,onClick:V,onFocus:H,onPointerDown:U,[ee]:N?``:void 0,onKeyDownCapture(){P.current=!0}},g,I]})}),oe=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=v.startingStyle]=`startingStyle`,e[e.endingStyle=v.endingStyle]=`endingStyle`,e}({}),se={...J,...y},ce=G.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,...o}=e,{value:s,getTabIdByPanelValue:c,orientation:d,tabActivationDirection:p,registerMountedTabPanel:m,unregisterMountedTabPanel:g}=q(),_=l(),v=G.useMemo(()=>({id:_,value:r}),[_,r]),{ref:y,index:C}=S({metadata:v}),w=r===s,{mounted:T,transitionStatus:E,setMounted:D}=x(w),O=!T,k=c(r),A={hidden:O,orientation:d,tabActivationDirection:p,transitionStatus:E},j=G.useRef(null),M=u(`div`,e,{state:A,ref:[t,y,j],props:[{"aria-labelledby":k,hidden:O,id:_,role:`tabpanel`,tabIndex:w?0:-1,inert:b(!w),[oe.index]:C},o],stateAttributesMapping:se});return h({open:w,ref:j,onComplete(){w||D(!1)}}),f(()=>{if(!(O&&!a)&&_!=null)return m(r,_),()=>{g(r,_)}},[O,a,r,_,m,g]),a||T?M:null}),le=G.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:o=!0,render:s,...c}=e,{getTabElementBySelectedValue:l,onValueChange:u,orientation:d,value:f,setTabMap:p,tabActivationDirection:m}=q(),[h,g]=G.useState(0),[_,v]=G.useState(null),y=G.useRef(new Set),b=G.useRef(new Set),x=G.useRef(null),S=a(()=>{y.current.forEach(e=>{e()})});G.useEffect(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{y.current.size&&S()});return x.current=e,_&&e.observe(_),b.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),x.current=null}},[_,S]);let C=a(e=>(y.current.add(e),()=>{y.current.delete(e)})),w=a(e=>(b.current.add(e),x.current?.observe(e),()=>{b.current.delete(e),x.current?.unobserve(e)})),T=ue(f,d,_,l),E=a((e,t)=>{e!==f&&(t.activationDirection=T(e),u(e,t))}),D={orientation:d,tabActivationDirection:m},O={"aria-orientation":d===`vertical`?`vertical`:void 0,role:`tablist`},k=G.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:h,registerIndicatorUpdateListener:C,registerTabResizeObserverElement:w,onTabActivation:E,setHighlightedTabIndex:g,tabsListElement:_}),[n,h,C,w,E,g,_]);return(0,Y.jsx)(X.Provider,{value:k,children:(0,Y.jsx)(U,{render:s,className:r,state:D,refs:[t,v],props:[O,c],stateAttributesMapping:J,highlightedIndex:h,enableHomeAndEndKeys:!0,loopFocus:o,orientation:d,onHighlightedIndexChange:g,onMapChange:p,disabledIndices:i})})});function Z(e,t){let{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect();return{left:n-i,top:r-a}}function ue(e,t,n,r){let[i,a]=G.useState(null);return f(()=>{if(e==null||n==null){a(null);return}let i=r(e);if(i==null){a(null);return}let{left:o,top:s}=Z(i,n);a(t===`horizontal`?o:s)},[t,r,n,e]),G.useCallback(o=>{if(o===e)return`none`;if(o==null)return a(null),`none`;if(o!=null&&n!=null){let e=r(o);if(e!=null){let{left:r,top:o}=Z(e,n);if(i==null)return a(t===`horizontal`?r:o),`none`;if(t===`horizontal`){if(r<i)return a(r),`left`;if(r>i)return a(r),`right`}else if(o<i)return a(o),`up`;else if(o>i)return a(o),`down`}}return`none`},[r,t,i,n,e])}function de({className:e,orientation:t=`horizontal`,...n}){return(0,Y.jsx)(re,{"data-slot":`tabs`,"data-orientation":t,className:O(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var fe=g(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function pe({className:e,variant:t=`default`,...n}){return(0,Y.jsx)(le,{"data-slot":`tabs-list`,"data-variant":t,className:O(fe({variant:t}),e),...n})}function Q({className:e,...t}){return(0,Y.jsx)(ae,{"data-slot":`tabs-trigger`,className:O(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function $({className:e,...t}){return(0,Y.jsx)(ce,{"data-slot":`tabs-content`,className:O(`flex-1 text-sm outline-none`,e),...t})}function me({clients:e,restore:t,permanentlyDelete:n}){return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(L,{size:18,className:`text-cyan-400`}),` DB Clients`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.length,` Items`]})]}),e.length===0?(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed py-12 text-center text-muted-foreground`,children:`No deleted DB Clients`}):(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`DB Client Name`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`flex items-center gap-2 font-medium`,children:[(0,Y.jsx)(L,{size:14}),e.name]}),(0,Y.jsx)(P,{className:`text-xs font-semibold text-muted-foreground`,children:e.project?.name||`-`}),(0,Y.jsx)(P,{className:`text-xs text-muted-foreground`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>t(e),children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),`Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>n(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),`Delete`]})]})})]},e.id))})]})})]})}function he({trashData:e,restoreProject:t,restoreDiagram:n,restoreNote:r,restoreDrawing:i,restoreFlowchart:a,restoreDbClient:o,fetchTrash:s,handleProjectPermanentDelete:c,handleDiagramPermanentDelete:l,handleNotePermanentDelete:u,handleDrawingPermanentDelete:d,handleFlowchartPermanentDelete:f,handleDbClientPermanentDelete:p,isLoading:m=!1}){return(0,Y.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 border rounded-xl bg-background overflow-hidden relative`,children:[m&&e.projects.length===0&&(0,Y.jsxs)(`div`,{className:`absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/60 backdrop-blur-[1px]`,children:[(0,Y.jsx)(R,{className:`w-8 h-8 text-primary animate-spin opacity-60`}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs font-medium text-muted-foreground`,children:`Loading trash...`})]}),(0,Y.jsxs)(`div`,{className:`p-6 border-b shrink-0`,children:[(0,Y.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,Y.jsx)(te,{size:24,className:`text-muted-foreground`}),`Trash Bin`]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage your deleted files and projects. Items can be restored or permanently deleted.`})]}),(0,Y.jsxs)(de,{defaultValue:`projects`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`div`,{className:`shrink-0 overflow-x-auto border-b px-6 py-3 custom-scrollbar`,children:(0,Y.jsxs)(pe,{className:`w-max`,children:[(0,Y.jsxs)(Q,{value:`projects`,children:[`Projects (`,e.projects.length,`)`]}),(0,Y.jsxs)(Q,{value:`diagrams`,children:[`ERD (`,e.diagrams.length,`)`]}),(0,Y.jsxs)(Q,{value:`db-clients`,children:[`DB Client (`,e.dbClients?.length||0,`)`]}),(0,Y.jsxs)(Q,{value:`notes`,children:[`Notes (`,e.notes.length,`)`]}),(0,Y.jsxs)(Q,{value:`drawings`,children:[`Drawings (`,e.drawings.length,`)`]}),(0,Y.jsxs)(Q,{value:`flowcharts`,children:[`Flowcharts (`,e.flowcharts?.length||0,`)`]})]})}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar`,children:(0,Y.jsxs)(`div`,{className:`p-6`,children:[(0,Y.jsxs)($,{value:`projects`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(H,{size:18,className:`text-orange-400`}),`Projects`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.projects.length,` Items`]})]}),e.projects.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted projects`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Project Name`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.projects.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(H,{size:14,className:`text-muted-foreground`}),e.name]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at||e.created_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await t(e.id),s()},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>c(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsxs)($,{value:`diagrams`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(B,{size:18,className:`text-blue-400`}),`Diagrams`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.diagrams.length,` Items`]})]}),e.diagrams.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted diagrams`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Diagram Name`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.diagrams.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(B,{size:14,className:`text-muted-foreground`}),e.name]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await n(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>l(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsx)($,{value:`db-clients`,className:`mt-0`,children:(0,Y.jsx)(me,{clients:e.dbClients||[],restore:o,permanentlyDelete:p})}),(0,Y.jsxs)($,{value:`notes`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(V,{size:18,className:`text-yellow-400`}),`Notes`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.notes.length,` Items`]})]}),e.notes.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted notes`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Note Title`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.notes.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(V,{size:14,className:`text-muted-foreground`}),e.title]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await r(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>u(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsxs)($,{value:`drawings`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(z,{size:18,className:`text-purple-400`}),`Drawings`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.drawings.length,` Items`]})]}),e.drawings.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted drawings`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Drawing Title`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.drawings.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(z,{size:14,className:`text-muted-foreground`}),e.title]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await i(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>d(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsxs)($,{value:`flowcharts`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(I,{size:18,className:`text-green-400`}),`Flowcharts`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.flowcharts?.length||0,` Items`]})]}),!e.flowcharts||e.flowcharts.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted flowcharts`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Flowchart Title`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.flowcharts.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(I,{size:14,className:`text-muted-foreground`}),e.title]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await a(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>f(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]})]})})]})]})}export{he as TrashView};
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,E as i,c as a,et as o,j as s,k as c,n as l,r as u,t as d,tt as f,u as p,y as m}from"./useControlled-DHoxCuAI.js";import{A as h,C as g,D as _,M as v,N as y,O as b,P as x,i as S,k as C,n as w,t as T,w as E,x as D}from"./useCompositeItem-ZIV61RjL.js";import{r as O}from"./utils-TcK2FSyg.js";import{t as k}from"./refresh-ccw-DFj0g7WT.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./table-DCsJJ7Zs.js";import{Bt as I,En as L,Kt as R,Nt as z,Tn as B,_t as V,cn as H,g as ee,h as U,pt as te,tt as W}from"./index-B9iPSCUH.js";var G=e(t()),K=G.createContext(void 0);function q(){let e=G.useContext(K);if(e===void 0)throw Error(o(64));return e}var ne=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),J={tabActivationDirection:e=>({[ne.activationDirection]:e})},Y=n(),re=G.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:o=`horizontal`,render:s,value:c,...l}=e,p=C(),m=Object.hasOwn(e,`defaultValue`),h=G.useRef([]),[g,_]=G.useState(()=>new Map),[v,y]=d({controlled:c,default:r,name:`Tabs`,state:`value`}),b=c!==void 0,[x,S]=G.useState(()=>new Map),[T,E]=G.useState(`none`),D=a((e,t)=>{i?.(e,t),!t.isCanceled&&(y(e),E(t.activationDirection))}),O=a((e,t)=>{_(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),k=a((e,t)=>{_(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),A=G.useCallback(e=>g.get(e),[g]),j=G.useCallback(e=>{for(let t of x.values())if(e===t?.value)return t?.id},[x]),M=G.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of x.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[x]),N=G.useMemo(()=>({direction:p,getTabElementBySelectedValue:M,getTabIdByPanelValue:j,getTabPanelIdByValue:A,onValueChange:D,orientation:o,registerMountedTabPanel:O,setTabMap:S,unregisterMountedTabPanel:k,tabActivationDirection:T,value:v}),[p,M,j,A,D,o,O,S,k,T,v]),P=G.useMemo(()=>{for(let e of x.values())if(e!=null&&e.value===v)return e},[x,v]),F=G.useMemo(()=>{for(let e of x.values())if(e!=null&&!e.disabled)return e.value},[x]);f(()=>{if(b||x.size===0)return;let e=P?.disabled;if(m&&e&&v===r||!e&&(P!=null||v===null))return;let t=F??null;v!==t&&(y(t),E(`none`))},[r,F,m,b,P,E,y,x,v]);let I=u(`div`,e,{state:{orientation:o,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:J});return(0,Y.jsx)(K.Provider,{value:N,children:(0,Y.jsx)(w,{elementsRef:h,children:I})})}),X=G.createContext(void 0);function ie(){let e=G.useContext(X);if(e===void 0)throw Error(o(65));return e}var ae=G.forwardRef(function(e,t){let{className:n,disabled:i=!1,render:a,value:o,id:d,nativeButton:h=!0,...g}=e,{value:_,getTabPanelIdByValue:v,orientation:y}=q(),{activateOnFocus:b,highlightedTabIndex:x,onTabActivation:S,registerTabResizeObserverElement:C,setHighlightedTabIndex:w,tabsListElement:D}=ie(),O=l(d),k=G.useMemo(()=>({disabled:i,id:O,value:o}),[i,O,o]),{compositeProps:A,compositeRef:j,index:M}=T({metadata:k}),N=o===_,P=G.useRef(!1),F=G.useRef(null);G.useEffect(()=>{let e=F.current;if(e)return C(e)},[C]),f(()=>{if(P.current){P.current=!1;return}if(!(N&&M>-1&&x!==M))return;let e=D;if(e!=null){let t=r(c(e));if(t&&s(e,t))return}i||w(M)},[N,M,x,w,i,D]);let{getButtonProps:I,buttonRef:L}=E({disabled:i,native:h,focusableWhenDisabled:!0}),R=v(o),z=G.useRef(!1),B=G.useRef(!1);function V(e){N||i||S(o,p(m,e.nativeEvent,void 0,{activationDirection:`none`}))}function H(e){N||(M>-1&&!i&&w(M),!i&&b&&(!z.current||z.current&&B.current)&&S(o,p(m,e.nativeEvent,void 0,{activationDirection:`none`})))}function U(e){if(N||i)return;z.current=!0;function t(){z.current=!1,B.current=!1}(!e.button||e.button===0)&&(B.current=!0,c(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return u(`button`,e,{state:{disabled:i,active:N,orientation:y},ref:[t,L,j,F],props:[A,{role:`tab`,"aria-controls":R,"aria-selected":N,id:O,onClick:V,onFocus:H,onPointerDown:U,[ee]:N?``:void 0,onKeyDownCapture(){P.current=!0}},g,I]})}),oe=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=v.startingStyle]=`startingStyle`,e[e.endingStyle=v.endingStyle]=`endingStyle`,e}({}),se={...J,...y},ce=G.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,...o}=e,{value:s,getTabIdByPanelValue:c,orientation:d,tabActivationDirection:p,registerMountedTabPanel:m,unregisterMountedTabPanel:g}=q(),_=l(),v=G.useMemo(()=>({id:_,value:r}),[_,r]),{ref:y,index:C}=S({metadata:v}),w=r===s,{mounted:T,transitionStatus:E,setMounted:D}=x(w),O=!T,k=c(r),A={hidden:O,orientation:d,tabActivationDirection:p,transitionStatus:E},j=G.useRef(null),M=u(`div`,e,{state:A,ref:[t,y,j],props:[{"aria-labelledby":k,hidden:O,id:_,role:`tabpanel`,tabIndex:w?0:-1,inert:b(!w),[oe.index]:C},o],stateAttributesMapping:se});return h({open:w,ref:j,onComplete(){w||D(!1)}}),f(()=>{if(!(O&&!a)&&_!=null)return m(r,_),()=>{g(r,_)}},[O,a,r,_,m,g]),a||T?M:null}),le=G.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:o=!0,render:s,...c}=e,{getTabElementBySelectedValue:l,onValueChange:u,orientation:d,value:f,setTabMap:p,tabActivationDirection:m}=q(),[h,g]=G.useState(0),[_,v]=G.useState(null),y=G.useRef(new Set),b=G.useRef(new Set),x=G.useRef(null),S=a(()=>{y.current.forEach(e=>{e()})});G.useEffect(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{y.current.size&&S()});return x.current=e,_&&e.observe(_),b.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),x.current=null}},[_,S]);let C=a(e=>(y.current.add(e),()=>{y.current.delete(e)})),w=a(e=>(b.current.add(e),x.current?.observe(e),()=>{b.current.delete(e),x.current?.unobserve(e)})),T=ue(f,d,_,l),E=a((e,t)=>{e!==f&&(t.activationDirection=T(e),u(e,t))}),D={orientation:d,tabActivationDirection:m},O={"aria-orientation":d===`vertical`?`vertical`:void 0,role:`tablist`},k=G.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:h,registerIndicatorUpdateListener:C,registerTabResizeObserverElement:w,onTabActivation:E,setHighlightedTabIndex:g,tabsListElement:_}),[n,h,C,w,E,g,_]);return(0,Y.jsx)(X.Provider,{value:k,children:(0,Y.jsx)(U,{render:s,className:r,state:D,refs:[t,v],props:[O,c],stateAttributesMapping:J,highlightedIndex:h,enableHomeAndEndKeys:!0,loopFocus:o,orientation:d,onHighlightedIndexChange:g,onMapChange:p,disabledIndices:i})})});function Z(e,t){let{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect();return{left:n-i,top:r-a}}function ue(e,t,n,r){let[i,a]=G.useState(null);return f(()=>{if(e==null||n==null){a(null);return}let i=r(e);if(i==null){a(null);return}let{left:o,top:s}=Z(i,n);a(t===`horizontal`?o:s)},[t,r,n,e]),G.useCallback(o=>{if(o===e)return`none`;if(o==null)return a(null),`none`;if(o!=null&&n!=null){let e=r(o);if(e!=null){let{left:r,top:o}=Z(e,n);if(i==null)return a(t===`horizontal`?r:o),`none`;if(t===`horizontal`){if(r<i)return a(r),`left`;if(r>i)return a(r),`right`}else if(o<i)return a(o),`up`;else if(o>i)return a(o),`down`}}return`none`},[r,t,i,n,e])}function de({className:e,orientation:t=`horizontal`,...n}){return(0,Y.jsx)(re,{"data-slot":`tabs`,"data-orientation":t,className:O(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var fe=g(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function pe({className:e,variant:t=`default`,...n}){return(0,Y.jsx)(le,{"data-slot":`tabs-list`,"data-variant":t,className:O(fe({variant:t}),e),...n})}function Q({className:e,...t}){return(0,Y.jsx)(ae,{"data-slot":`tabs-trigger`,className:O(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function $({className:e,...t}){return(0,Y.jsx)(ce,{"data-slot":`tabs-content`,className:O(`flex-1 text-sm outline-none`,e),...t})}function me({clients:e,restore:t,permanentlyDelete:n}){return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(L,{size:18,className:`text-cyan-400`}),` DB Clients`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.length,` Items`]})]}),e.length===0?(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed py-12 text-center text-muted-foreground`,children:`No deleted DB Clients`}):(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`DB Client Name`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`flex items-center gap-2 font-medium`,children:[(0,Y.jsx)(L,{size:14}),e.name]}),(0,Y.jsx)(P,{className:`text-xs font-semibold text-muted-foreground`,children:e.project?.name||`-`}),(0,Y.jsx)(P,{className:`text-xs text-muted-foreground`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>t(e),children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),`Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>n(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),`Delete`]})]})})]},e.id))})]})})]})}function he({trashData:e,restoreProject:t,restoreDiagram:n,restoreNote:r,restoreDrawing:i,restoreFlowchart:a,restoreDbClient:o,fetchTrash:s,handleProjectPermanentDelete:c,handleDiagramPermanentDelete:l,handleNotePermanentDelete:u,handleDrawingPermanentDelete:d,handleFlowchartPermanentDelete:f,handleDbClientPermanentDelete:p,isLoading:m=!1}){return(0,Y.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 border rounded-xl bg-background overflow-hidden relative`,children:[m&&e.projects.length===0&&(0,Y.jsxs)(`div`,{className:`absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/60 backdrop-blur-[1px]`,children:[(0,Y.jsx)(R,{className:`w-8 h-8 text-primary animate-spin opacity-60`}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs font-medium text-muted-foreground`,children:`Loading trash...`})]}),(0,Y.jsxs)(`div`,{className:`p-6 border-b shrink-0`,children:[(0,Y.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,Y.jsx)(te,{size:24,className:`text-muted-foreground`}),`Trash Bin`]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage your deleted files and projects. Items can be restored or permanently deleted.`})]}),(0,Y.jsxs)(de,{defaultValue:`projects`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`div`,{className:`shrink-0 overflow-x-auto border-b px-6 py-3 custom-scrollbar`,children:(0,Y.jsxs)(pe,{className:`w-max`,children:[(0,Y.jsxs)(Q,{value:`projects`,children:[`Projects (`,e.projects.length,`)`]}),(0,Y.jsxs)(Q,{value:`diagrams`,children:[`ERD (`,e.diagrams.length,`)`]}),(0,Y.jsxs)(Q,{value:`db-clients`,children:[`DB Client (`,e.dbClients?.length||0,`)`]}),(0,Y.jsxs)(Q,{value:`notes`,children:[`Notes (`,e.notes.length,`)`]}),(0,Y.jsxs)(Q,{value:`drawings`,children:[`Drawings (`,e.drawings.length,`)`]}),(0,Y.jsxs)(Q,{value:`flowcharts`,children:[`Flowcharts (`,e.flowcharts?.length||0,`)`]})]})}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar`,children:(0,Y.jsxs)(`div`,{className:`p-6`,children:[(0,Y.jsxs)($,{value:`projects`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(H,{size:18,className:`text-orange-400`}),`Projects`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.projects.length,` Items`]})]}),e.projects.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted projects`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Project Name`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.projects.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(H,{size:14,className:`text-muted-foreground`}),e.name]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at||e.created_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await t(e.id),s()},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>c(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsxs)($,{value:`diagrams`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(B,{size:18,className:`text-blue-400`}),`Diagrams`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.diagrams.length,` Items`]})]}),e.diagrams.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted diagrams`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Diagram Name`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.diagrams.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(B,{size:14,className:`text-muted-foreground`}),e.name]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await n(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>l(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsx)($,{value:`db-clients`,className:`mt-0`,children:(0,Y.jsx)(me,{clients:e.dbClients||[],restore:o,permanentlyDelete:p})}),(0,Y.jsxs)($,{value:`notes`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(V,{size:18,className:`text-yellow-400`}),`Notes`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.notes.length,` Items`]})]}),e.notes.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted notes`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Note Title`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.notes.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(V,{size:14,className:`text-muted-foreground`}),e.title]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await r(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>u(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsxs)($,{value:`drawings`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(z,{size:18,className:`text-purple-400`}),`Drawings`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.drawings.length,` Items`]})]}),e.drawings.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted drawings`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Drawing Title`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.drawings.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(z,{size:14,className:`text-muted-foreground`}),e.title]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await i(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>d(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]}),(0,Y.jsxs)($,{value:`flowcharts`,className:`mt-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Y.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,Y.jsx)(I,{size:18,className:`text-green-400`}),`Flowcharts`]}),(0,Y.jsxs)(W,{variant:`outline`,children:[e.flowcharts?.length||0,` Items`]})]}),!e.flowcharts||e.flowcharts.length===0?(0,Y.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted flowcharts`}):(0,Y.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,Y.jsxs)(F,{children:[(0,Y.jsx)(A,{children:(0,Y.jsxs)(N,{children:[(0,Y.jsx)(j,{children:`Flowchart Title`}),(0,Y.jsx)(j,{children:`Project`}),(0,Y.jsx)(j,{children:`Deleted At`}),(0,Y.jsx)(j,{className:`text-right`,children:`Actions`})]})}),(0,Y.jsx)(M,{children:e.flowcharts.map(e=>(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(P,{className:`font-medium flex items-center gap-2`,children:[(0,Y.jsx)(I,{size:14,className:`text-muted-foreground`}),e.title]}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,Y.jsx)(P,{className:`text-muted-foreground text-xs`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,Y.jsx)(P,{className:`text-right`,children:(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsxs)(D,{variant:`outline`,size:`sm`,onClick:async()=>{await a(e)},children:[(0,Y.jsx)(k,{size:14,className:`mr-1`}),` Restore`]}),(0,Y.jsxs)(D,{variant:`destructive`,size:`sm`,onClick:()=>f(e),children:[(0,Y.jsx)(_,{size:14,className:`mr-1`}),` Delete`]})]})})]},e.id))})]})})]})]})})]})]})}export{he as TrashView};