erdbpro 3.4.7-rc.44 → 3.4.7-rc.46

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 (151) hide show
  1. package/dist/assets/{AdminRoute-CIIKzhqe.js → AdminRoute-DtQLiVk7.js} +2 -2
  2. package/dist/assets/{Combination-CjkFysA5.js → Combination-CmdVtARU.js} +1 -1
  3. package/dist/assets/{DataViewerModeToolbar-D_7r3CGn.js → DataViewerModeToolbar-CmNdyxnH.js} +1 -1
  4. package/dist/assets/{DbClientEditorRoute-D7vYCgpX.js → DbClientEditorRoute-Drq_M3Yx.js} +1 -1
  5. package/dist/assets/{DiagramEditorRoute-Zorqaykg.js → DiagramEditorRoute-CdaFhppe.js} +1 -1
  6. package/dist/assets/{DrawingEditorRoute-nbYAil9w.js → DrawingEditorRoute-DXs9ZwGw.js} +2 -2
  7. package/dist/assets/{DrawingsView-CYIkKwZF.js → DrawingsView-BZ5daO67.js} +8 -8
  8. package/dist/assets/ERDComments-DRgQCzYK.js +8 -0
  9. package/dist/assets/{FlowchartEditorRoute-BvXkFNiE.js → FlowchartEditorRoute-RNeE9gKM.js} +1 -1
  10. package/dist/assets/{JumpToNode-ImB9k7b-.js → JumpToNode-B-2fNnUQ.js} +1 -1
  11. package/dist/assets/{LibraryRoute-BFClD9jY.js → LibraryRoute-D8fjICbE.js} +1 -1
  12. package/dist/assets/{NoteEditorRoute-et3MvMI9.js → NoteEditorRoute-BPmH4J2c.js} +2 -2
  13. package/dist/assets/{NotesView-DWBUoc_x.js → NotesView-wvEOVfdQ.js} +2 -2
  14. package/dist/assets/{TeamInventoryRoute-B9QpWGD0.js → TeamInventoryRoute-D7qeeeMy.js} +1 -1
  15. package/dist/assets/{TeamManagementRoute-CcscQM0G.js → TeamManagementRoute-Bh8cBVdg.js} +1 -1
  16. package/dist/assets/{TrashView-z5g7B0Co.js → TrashView-DtioMwev.js} +1 -1
  17. package/dist/assets/{UserManagementRoute-Ct4Hj-s2.js → UserManagementRoute-D_JeYUv6.js} +1 -1
  18. package/dist/assets/WorkspaceProvider-BAyO6Rw9.js +71 -0
  19. package/dist/assets/{abnfDiagram-VCTEODGH-Dqsq5-yB.js → abnfDiagram-VCTEODGH-D4rPi4GI.js} +1 -1
  20. package/dist/assets/{ar-SA-G6X2FPQ2-yikulqoW.js → ar-SA-G6X2FPQ2-DL-AqB0I.js} +1 -1
  21. package/dist/assets/{architectureDiagram-5GKGNRK7-3UhvBdFi.js → architectureDiagram-5GKGNRK7-CpfrjUQI.js} +1 -1
  22. package/dist/assets/{az-AZ-76LH7QW2-D6RjqObc.js → az-AZ-76LH7QW2-7XH5eh9f.js} +1 -1
  23. package/dist/assets/{bg-BG-XCXSNQG7-CJTEu99d.js → bg-BG-XCXSNQG7-BriVyLK2.js} +1 -1
  24. package/dist/assets/{blockDiagram-I7D4REHJ-CO-CysIS.js → blockDiagram-I7D4REHJ-DFjRX3XM.js} +1 -1
  25. package/dist/assets/{bn-BD-2XOGV67Q-C8VNz5ol.js → bn-BD-2XOGV67Q-CuJumsmR.js} +1 -1
  26. package/dist/assets/{c4Diagram-7LVT6UL2-DUss4j72.js → c4Diagram-7LVT6UL2-BrN4G_5Q.js} +1 -1
  27. package/dist/assets/{ca-ES-6MX7JW3Y-R7FCTDWo.js → ca-ES-6MX7JW3Y-RZgQtNw9.js} +1 -1
  28. package/dist/assets/channel-D51nncLc.js +1 -0
  29. package/dist/assets/{chunk-4HAMMTFA-BElFyPLF.js → chunk-4HAMMTFA-DyG7G8rz.js} +1 -1
  30. package/dist/assets/{chunk-75Z2AOVW-BnaqlloT.js → chunk-75Z2AOVW-oAiLGXnU.js} +1 -1
  31. package/dist/assets/{chunk-DU6HZSFF-s9-PxDTv.js → chunk-DU6HZSFF-Dg35re7u.js} +1 -1
  32. package/dist/assets/{chunk-EIO257PC-C_-lvGS_.js → chunk-EIO257PC-DHYESTCQ.js} +1 -1
  33. package/dist/assets/{chunk-F27PBJKO-DdYTqkBl.js → chunk-F27PBJKO-B9qtvImq.js} +1 -1
  34. package/dist/assets/{chunk-GMAD6QVW-Dvk8Gktm.js → chunk-GMAD6QVW-D7cvrRMn.js} +1 -1
  35. package/dist/assets/{chunk-GVQU2GXP-O4YJ1zg0.js → chunk-GVQU2GXP-BXWZUUwM.js} +1 -1
  36. package/dist/assets/{chunk-IMKFNOWR-DyC2OsiQ.js → chunk-IMKFNOWR-DcEgk8mQ.js} +1 -1
  37. package/dist/assets/{chunk-L3NEJ4N5-B6f0ZOuA.js → chunk-L3NEJ4N5-ClIQo6oC.js} +1 -1
  38. package/dist/assets/{chunk-OSK3NFVY-BPylahkd.js → chunk-OSK3NFVY-alNqqcFC.js} +1 -1
  39. package/dist/assets/{chunk-P2QGCYS3-DGWfxMCl.js → chunk-P2QGCYS3-BF0S3Pyx.js} +1 -1
  40. package/dist/assets/{chunk-POPQ4Y6H-CbS3pRWk.js → chunk-POPQ4Y6H-DM9F1B1r.js} +1 -1
  41. package/dist/assets/{chunk-PWAF6VOD-BYHFXvbM.js → chunk-PWAF6VOD-CURLC4LN.js} +1 -1
  42. package/dist/assets/{chunk-SHT3W25Y-V3ypcKtK.js → chunk-SHT3W25Y-PaG_b3PS.js} +1 -1
  43. package/dist/assets/{chunk-SVP7TREG-Ca8KsGoV.js → chunk-SVP7TREG-Cyh_IWt4.js} +1 -1
  44. package/dist/assets/{chunk-TICWLB2K-CXhZBl0R.js → chunk-TICWLB2K-Cro7zdpk.js} +1 -1
  45. package/dist/assets/classDiagram-ZZMXUADV-DvfadCrC.js +1 -0
  46. package/dist/assets/classDiagram-v2-VYDZK3BY-DvfadCrC.js +1 -0
  47. package/dist/assets/{cs-CZ-2BRQDIVT-0rNz2x83.js → cs-CZ-2BRQDIVT-DE09_Dvf.js} +1 -1
  48. package/dist/assets/{cynefinDiagram-5FMLGOSQ-D2wylZq6.js → cynefinDiagram-5FMLGOSQ-xDS6qsZ3.js} +1 -1
  49. package/dist/assets/{da-DK-5WZEPLOC-BfCyScgr.js → da-DK-5WZEPLOC-Duu1_i4F.js} +1 -1
  50. package/dist/assets/{dagre-GXQ25YYZ-Dw4vxaVY.js → dagre-GXQ25YYZ-BIk78eFn.js} +1 -1
  51. package/dist/assets/{de-DE-XR44H4JA-BIN7WdxT.js → de-DE-XR44H4JA-CQHTsLYE.js} +1 -1
  52. package/dist/assets/{diagram-S7CK7UJ4-B6fix_v1.js → diagram-S7CK7UJ4-CBAQW6lj.js} +1 -1
  53. package/dist/assets/{diagram-UQ7AKVKN-BrXgbr8C.js → diagram-UQ7AKVKN-lxzfcX0D.js} +1 -1
  54. package/dist/assets/{diagram-VSXAHHWV-3KQ_KEch.js → diagram-VSXAHHWV-BmCMPjaO.js} +1 -1
  55. package/dist/assets/{diagram-VX7I27RA-DTz-6Fkn.js → diagram-VX7I27RA-BBtyvuf8.js} +1 -1
  56. package/dist/assets/{diagram-Z3DM3KII-BP28KvLc.js → diagram-Z3DM3KII-CVC5ahA7.js} +1 -1
  57. package/dist/assets/{dist-8JFy3V3b.js → dist-q_-39YCO.js} +4 -4
  58. package/dist/assets/{ebnfDiagram-PWID7BFC-BdjxHW3y.js → ebnfDiagram-PWID7BFC-C9foEyob.js} +1 -1
  59. package/dist/assets/{el-GR-BZB4AONW-Qao2qfsb.js → el-GR-BZB4AONW-DSCTaPaY.js} +1 -1
  60. package/dist/assets/{en-B4ZKOASM-CPvM0JvO.js → en-B4ZKOASM-DhI9rhyT.js} +1 -1
  61. package/dist/assets/{erDiagram-RLTQ6QDP-Dffv6MkK.js → erDiagram-RLTQ6QDP-CTAh1SMr.js} +1 -1
  62. package/dist/assets/{erdActions-C1fVMvH-.js → erdActions-_LXqMXn7.js} +1 -1
  63. package/dist/assets/{es-ES-U4NZUMDT-C5dlC0Qr.js → es-ES-U4NZUMDT-WugVzmOf.js} +1 -1
  64. package/dist/assets/{eu-ES-A7QVB2H4-DTSsxWEY.js → eu-ES-A7QVB2H4-BIgV2CAd.js} +1 -1
  65. package/dist/assets/{fa-IR-HGAKTJCU-BY2MxvkZ.js → fa-IR-HGAKTJCU-BadkrQQc.js} +1 -1
  66. package/dist/assets/{fi-FI-Z5N7JZ37-CiYL9SKb.js → fi-FI-Z5N7JZ37-wNV0Hnro.js} +1 -1
  67. package/dist/assets/flowDiagram-HODETNUW-B8-9YVB5.js +1 -0
  68. package/dist/assets/{fr-FR-RHASNOE6-BxRzq23X.js → fr-FR-RHASNOE6--WkscHNJ.js} +1 -1
  69. package/dist/assets/{ganttDiagram-EL5Y4UJY-DSwr9WOg.js → ganttDiagram-EL5Y4UJY-DpVIXbHT.js} +1 -1
  70. package/dist/assets/{gitGraphDiagram-WWUBYQGX-wardzK_h.js → gitGraphDiagram-WWUBYQGX-CNfPMc21.js} +1 -1
  71. package/dist/assets/{gl-ES-HMX3MZ6V-BGdM_7Ni.js → gl-ES-HMX3MZ6V-Bls5IuZb.js} +1 -1
  72. package/dist/assets/{he-IL-6SHJWFNN-7yKFAoeV.js → he-IL-6SHJWFNN-Bk-6o0Tf.js} +1 -1
  73. package/dist/assets/{hi-IN-IWLTKZ5I-B1hmF8aD.js → hi-IN-IWLTKZ5I-BzkV-_rU.js} +1 -1
  74. package/dist/assets/{hu-HU-A5ZG7DT2-B9Cvjz96.js → hu-HU-A5ZG7DT2-CQm489w6.js} +1 -1
  75. package/dist/assets/{id-ID-SAP4L64H-BjAWHt1W.js → id-ID-SAP4L64H-BwfW__Z-.js} +1 -1
  76. package/dist/assets/{image-GAAHSSAO-Cw60NVQj.js → image-GAAHSSAO-DJOeurE4.js} +1 -1
  77. package/dist/assets/{index-Dj_OkW0L.js → index-CPxZ4xhG.js} +114 -114
  78. package/dist/assets/{infoDiagram-27XIBGKW-CZ3WRqov.js → infoDiagram-27XIBGKW-C3V7C3jN.js} +1 -1
  79. package/dist/assets/{ishikawaDiagram-5VMMS53U-CUs8zhfV.js → ishikawaDiagram-5VMMS53U-CSYgI2XX.js} +1 -1
  80. package/dist/assets/{it-IT-JPQ66NNP-C-eFnQGx.js → it-IT-JPQ66NNP-B0uXS0lR.js} +1 -1
  81. package/dist/assets/{ja-JP-DBVTYXUO-B85nazjT.js → ja-JP-DBVTYXUO-BZXWqVgR.js} +1 -1
  82. package/dist/assets/{journeyDiagram-3NMN7TZE-BSrsL07i.js → journeyDiagram-3NMN7TZE-CEbasK0T.js} +1 -1
  83. package/dist/assets/{kaa-6HZHGXH3-DeSQfHpr.js → kaa-6HZHGXH3-C5G08lzV.js} +1 -1
  84. package/dist/assets/{kab-KAB-ZGHBKWFO-Bgb3QLej.js → kab-KAB-ZGHBKWFO-Wtydyl4y.js} +1 -1
  85. package/dist/assets/{kanban-definition-UXKFOSKX-BfyQ_2pA.js → kanban-definition-UXKFOSKX-By9kyfJm.js} +1 -1
  86. package/dist/assets/{kk-KZ-P5N5QNE5-PLcR_JsJ.js → kk-KZ-P5N5QNE5-BgabEBcI.js} +1 -1
  87. package/dist/assets/{km-KH-HSX4SM5Z-C6bV40S9.js → km-KH-HSX4SM5Z-CGJJW3yP.js} +1 -1
  88. package/dist/assets/{ko-KR-MTYHY66A-Cw5Gzmuc.js → ko-KR-MTYHY66A-9bZOXci7.js} +1 -1
  89. package/dist/assets/{ku-TR-6OUDTVRD-9onuO1DN.js → ku-TR-6OUDTVRD-SyRuhlkg.js} +1 -1
  90. package/dist/assets/{line-CEsSfwrt.js → line-DGOczTVq.js} +1 -1
  91. package/dist/assets/{lt-LT-XHIRWOB4-we6dLscd.js → lt-LT-XHIRWOB4-D4XDJ3Pi.js} +1 -1
  92. package/dist/assets/{lv-LV-5QDEKY6T-CK8gaMD1.js → lv-LV-5QDEKY6T-D83nQWT4.js} +1 -1
  93. package/dist/assets/{mindmap-definition-YA3MSWOX-DSvnR9uT.js → mindmap-definition-YA3MSWOX-BozvSE6k.js} +1 -1
  94. package/dist/assets/{mr-IN-CRQNXWMA-DxkYo1vj.js → mr-IN-CRQNXWMA-ZfMPpEhL.js} +1 -1
  95. package/dist/assets/{my-MM-5M5IBNSE-DwzaKDh_.js → my-MM-5M5IBNSE-CAL1i6Rw.js} +1 -1
  96. package/dist/assets/{nb-NO-T6EIAALU-DxGq_fCs.js → nb-NO-T6EIAALU-DrSB2Pk0.js} +1 -1
  97. package/dist/assets/{nl-NL-IS3SIHDZ-DpNE4IQq.js → nl-NL-IS3SIHDZ-BD_BEJUm.js} +1 -1
  98. package/dist/assets/{nn-NO-6E72VCQL-DA5eKzNT.js → nn-NO-6E72VCQL-BhkzSlqp.js} +1 -1
  99. package/dist/assets/{note-importer-NZUWzjz4.js → note-importer-Cxdf3khP.js} +2 -2
  100. package/dist/assets/{oc-FR-POXYY2M6-FaBR5-6M.js → oc-FR-POXYY2M6-CPbzNzTc.js} +1 -1
  101. package/dist/assets/{pa-IN-N4M65BXN-DgQUn5DO.js → pa-IN-N4M65BXN-8U_wHdTb.js} +1 -1
  102. package/dist/assets/{pegDiagram-XKGWAZYB-CKcZ_Mgd.js → pegDiagram-XKGWAZYB-CakCu3WZ.js} +1 -1
  103. package/dist/assets/percentages-BXMCSKIN-BpIsgTPS.js +1 -0
  104. package/dist/assets/{pieDiagram-E7YTZNPT-hzb2SMu-.js → pieDiagram-E7YTZNPT-C-1SO3c-.js} +1 -1
  105. package/dist/assets/{pl-PL-T2D74RX3-RE0nRzFB.js → pl-PL-T2D74RX3-Bksr4i1d.js} +1 -1
  106. package/dist/assets/{popover-CeOegac2.js → popover-l5FGEnVW.js} +1 -1
  107. package/dist/assets/{pt-BR-5N22H2LF-Bi8IaAdL.js → pt-BR-5N22H2LF-D1fx1GA1.js} +1 -1
  108. package/dist/assets/{pt-PT-UZXXM6DQ-Dg0KTP03.js → pt-PT-UZXXM6DQ-CdiaZIDf.js} +1 -1
  109. package/dist/assets/{quadrantDiagram-AXDQQJYC-CKUz5ePa.js → quadrantDiagram-AXDQQJYC-2Jlm3iZU.js} +1 -1
  110. package/dist/assets/{railroadDiagram-O6MQD6OU-e3fbKnKE.js → railroadDiagram-O6MQD6OU-sVWcU6xh.js} +1 -1
  111. package/dist/assets/{requirementDiagram-BXWQKSXE-BIGZ0lEO.js → requirementDiagram-BXWQKSXE-C7tJ-rol.js} +1 -1
  112. package/dist/assets/{ro-RO-JPDTUUEW-Be6TTU7Y.js → ro-RO-JPDTUUEW-Ccorj9mZ.js} +1 -1
  113. package/dist/assets/{ru-RU-B4JR7IUQ-DZVVzktF.js → ru-RU-B4JR7IUQ-DXiGalr0.js} +1 -1
  114. package/dist/assets/{sankeyDiagram-P5KCCOFB-B3jGQPHU.js → sankeyDiagram-P5KCCOFB-DhQMnB0o.js} +1 -1
  115. package/dist/assets/{sequenceDiagram-WJ2MYXX4-BPx5mPXP.js → sequenceDiagram-WJ2MYXX4-CnzIhrkc.js} +1 -1
  116. package/dist/assets/{si-LK-N5RQ5JYF-CtCKYYbg.js → si-LK-N5RQ5JYF-CaxgsxY7.js} +1 -1
  117. package/dist/assets/{sk-SK-C5VTKIMK-IH-KiHSM.js → sk-SK-C5VTKIMK-B0yU0CA-.js} +1 -1
  118. package/dist/assets/{sl-SI-NN7IZMDC-DfE9Yvq6.js → sl-SI-NN7IZMDC-CpuJ1tDD.js} +1 -1
  119. package/dist/assets/{stateDiagram-D77RDMKH-TfNLPjYa.js → stateDiagram-D77RDMKH-ZkjDY6rW.js} +1 -1
  120. package/dist/assets/stateDiagram-v2-MP3YSRHH-C86jsQ0r.js +1 -0
  121. package/dist/assets/subset-shared.chunk-Dp1yq9Mp.js +1 -0
  122. package/dist/assets/{subset-worker.chunk-BgO2mUZs.js → subset-worker.chunk-BLG8BNVy.js} +1 -1
  123. package/dist/assets/{sv-SE-XGPEYMSR-qTgAoG9G.js → sv-SE-XGPEYMSR-DJLhv9wt.js} +1 -1
  124. package/dist/assets/{swimlanes-42K2YHIH-1WUOnqh-.js → swimlanes-42K2YHIH-DOkLGW9j.js} +1 -1
  125. package/dist/assets/swimlanesDiagram-VR7AAH4N-CqvJgsEc.js +8 -0
  126. package/dist/assets/{ta-IN-2NMHFXQM-t5WIFFTF.js → ta-IN-2NMHFXQM-Bwxz2SQd.js} +1 -1
  127. package/dist/assets/{th-TH-HPSO5L25-C5nCmDIb.js → th-TH-HPSO5L25-CDYvkwiq.js} +1 -1
  128. package/dist/assets/{timeline-definition-24CTP7MA-DTwoo1WA.js → timeline-definition-24CTP7MA-K_9ExG9n.js} +1 -1
  129. package/dist/assets/{tr-TR-DEFEU3FU-CQH3sp_V.js → tr-TR-DEFEU3FU-_UdQtlRf.js} +1 -1
  130. package/dist/assets/{uk-UA-QMV73CPH-kDTmiJ6-.js → uk-UA-QMV73CPH-BnoWFiIT.js} +1 -1
  131. package/dist/assets/{vennDiagram-4TSXK5OY-C7eOS0qU.js → vennDiagram-4TSXK5OY-CU_NWErL.js} +1 -1
  132. package/dist/assets/{vi-VN-M7AON7JQ-CVuULQ1U.js → vi-VN-M7AON7JQ-DBjiZyuQ.js} +1 -1
  133. package/dist/assets/{w3c-keyname-BHJ3Azyy.js → w3c-keyname-UmTNCLNK.js} +1 -1
  134. package/dist/assets/{wardleyDiagram-VM6X3IG4-BGUMO7LV.js → wardleyDiagram-VM6X3IG4-CdDynCDg.js} +1 -1
  135. package/dist/assets/{xychartDiagram-S5SC5T6Z-C0913ZvF.js → xychartDiagram-S5SC5T6Z-Bsc2J7gA.js} +1 -1
  136. package/dist/assets/{zh-CN-LNUGB5OW-C13VM0wi.js → zh-CN-LNUGB5OW-DVEe6rPw.js} +1 -1
  137. package/dist/assets/{zh-HK-E62DVLB3-BZuGWBtr.js → zh-HK-E62DVLB3-DcfLk1Wm.js} +1 -1
  138. package/dist/assets/{zh-TW-RAJ6MFWO-Ci6wUfre.js → zh-TW-RAJ6MFWO-UwGnrZVz.js} +1 -1
  139. package/dist/index.html +7 -7
  140. package/dist-server/index.js +5 -4
  141. package/package.json +1 -1
  142. package/dist/assets/ERDComments-BgnRJ-nP.js +0 -8
  143. package/dist/assets/WorkspaceProvider-B9rJwzKp.js +0 -71
  144. package/dist/assets/channel-72aB9mJv.js +0 -1
  145. package/dist/assets/classDiagram-ZZMXUADV-s6p5KZZU.js +0 -1
  146. package/dist/assets/classDiagram-v2-VYDZK3BY-s6p5KZZU.js +0 -1
  147. package/dist/assets/flowDiagram-HODETNUW-BnN2cF8R.js +0 -1
  148. package/dist/assets/percentages-BXMCSKIN-DnfuyF9m.js +0 -1
  149. package/dist/assets/stateDiagram-v2-MP3YSRHH-Cnczj5Ai.js +0 -1
  150. package/dist/assets/subset-shared.chunk-CF5IaOnK.js +0 -1
  151. package/dist/assets/swimlanesDiagram-VR7AAH4N-BBq5fivK.js +0 -8
@@ -0,0 +1,8 @@
1
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{a as r,l as i,n as a}from"./dist-B2tJVU7c.js";import{Z as o}from"./note-importer-Cxdf3khP.js";import{at as s,f as c,it as l,l as u,s as d,t as f}from"./button-BoRKNt3a.js";import{Dt as p,E as m,Lt as h,S as g,Zt as _,at as v,en as y,gn as b,mn as x,mt as S,nn as C,pt as w}from"./useOpenInteractionType-8RZuPnpG.js";import{s as T}from"./useField-BVrxe_qk.js";import{n as E,t as D}from"./popover-l5FGEnVW.js";import{C as O,S as k,T as A,_ as j,a as ee,b as M,d as N,f as P,g as F,h as I,p as L,r as R,s as z,t as te,v as ne,w as B,x as re,y as ie}from"./dropdown-menu-rZKTxsXp.js";import{a as ae,c as V,f as H,i as oe,l as se,n as ce,o as le,r as ue,s as U,t as de}from"./check-CkCHT6D9.js";import{a as W}from"./CompositeList-fgcZ0MvU.js";import{c as fe,l as G,u as pe}from"./select-pQS-1nhx.js";import{t as K}from"./ConfirmModal-DJuZVQTe.js";import{t as me}from"./ellipsis-BGAMAt1v.js";import{d as he}from"./dialog-C2aDTmOl.js";import{t as ge}from"./trash-2-DPFpHyly.js";import{n as q}from"./api-CUfeViMG.js";import{n as _e}from"./useAuth-BIu3hkix.js";var J=d(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ve=d(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ye=d(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),be=d(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),xe=d(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Se=d(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Ce=d(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),we=6048e5,Te=864e5,Ee=6e4,De=525600,Oe=43200,ke=1440,Ae=Symbol.for(`constructDateFrom`);function je(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Ae in e?e[Ae](t):e instanceof Date?new e.constructor(t):new Date(t)}function Me(e,t){return je(t||e,e)}var Ne={};function Pe(){return Ne}function Fe(e){let t=Me(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-n}function Ie(e,...t){let n=je.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Le(e,t){let n=+Me(e)-Me(t);return n<0?-1:n>0?1:n}function Re(e){return je(e,Date.now())}function ze(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}var Be={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Ve=(e,t,n)=>{let r,i=Be[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function He(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Ue={date:He({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:He({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:He({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},We={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Ge=(e,t,n,r)=>We[e];function Ke(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var qe={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Ke({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Ke({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Ke({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Ke({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Ke({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Je(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Xe(s,e=>e.test(o)):Ye(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Ye(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Xe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Ze(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Qe={code:`en-US`,formatDistance:Ve,formatLong:Ue,formatRelative:Ge,localize:qe,match:{ordinalNumber:Ze({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Je({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Je({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Je({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Je({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Je({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function $e(e,t,n){let r=Pe(),i=n?.locale??r.locale??Qe,a=Le(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Ie(n?.in,...a>0?[t,e]:[e,t]),l=ze(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/Ee,f=(u-(Fe(c)-Fe(s)))/Ee,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}if(m===`day`){let e=l(f/ke);return i.formatDistance(`xDays`,e,o)}if(m===`month`){let e=l(f/Oe);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}{let e=l(f/De);return i.formatDistance(`xYears`,e,o)}}function et(e,t){return $e(e,Re(e),t)}var Y=e(t(),1),X=n(),tt=(0,Y.createContext)(null),nt=(0,Y.createContext)(null);function rt({value:e,children:t}){return(0,X.jsx)(nt.Provider,{value:e.setActionContextData,children:(0,X.jsx)(tt.Provider,{value:e,children:t})})}function it({children:e,panelMode:t,onPanelModeChange:n}){let[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(`closed`),l=t??s,u=n??c,[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)([`replace`,`append`]),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),y=(0,Y.useCallback)((e,t,n)=>{i(e),o(t&&n?{actionId:t,onResult:n}:null),u(`chat`)},[u]),b=(0,Y.useCallback)(()=>{i(null)},[]),x=(0,Y.useCallback)(()=>{o(null)},[]),S=(0,Y.useCallback)((e,t)=>(f(()=>e),m(t??[`replace`,`append`]),()=>{f(null),m([`replace`,`append`])}),[]),C=(0,Y.useCallback)((e,t,n)=>d?(d(e,t,n),!0):!1,[d]),w=(0,Y.useMemo)(()=>({sendAction:y,pendingPrompt:r,pendingAction:a,clearPrompt:b,clearPendingAction:x,rightPanelMode:l,setRightPanelMode:u,registerContentHandler:S,applyContent:C,hasContentHandler:!!d,contentHandlerStrategies:p,selectionText:h,setSelectionText:g,actionContextData:_,setActionContextData:v}),[y,r,a,b,x,l,u,S,C,d,p,h,g,_,v]);return(0,X.jsx)(nt.Provider,{value:v,children:(0,X.jsx)(tt.Provider,{value:w,children:e})})}function at(){let e=(0,Y.useContext)(tt);if(!e)throw Error(`useAIAction must be used within AIActionProvider`);return e}function ot(){let e=(0,Y.useContext)(nt);if(!e)throw Error(`useSetActionContextData must be used within AIActionProvider`);return e}var st=Y.createContext(void 0);function ct(){let e=Y.useContext(st);if(e===void 0)throw Error(l(53));return e}var lt=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function Z(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}var ut=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),dt=function(e){return e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),ft={hasOverflowX:e=>e?{[dt.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[dt.hasOverflowY]:``}:null,overflowXStart:e=>e?{[dt.overflowXStart]:``}:null,overflowXEnd:e=>e?{[dt.overflowXEnd]:``}:null,overflowYStart:e=>e?{[dt.overflowYStart]:``}:null,overflowYEnd:e=>e?{[dt.overflowYEnd]:``}:null,cornerHidden:()=>null},pt={x:0,y:0},mt={width:0,height:0},ht={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},gt={x:!0,y:!0,corner:!0},_t=Y.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...a}=e,o=vt(i),s=g(),l=b(),d=b(),{nonce:f,disableStyleElements:p}=fe(),[m,h]=Y.useState(!1),[_,v]=Y.useState(!1),[x,S]=Y.useState(!1),[C,w]=Y.useState(!1),[T,E]=Y.useState(!1),[D,O]=Y.useState(mt),[k,A]=Y.useState(mt),[j,ee]=Y.useState(ht),[M,N]=Y.useState(gt),P=Y.useRef(null),F=Y.useRef(null),I=Y.useRef(null),L=Y.useRef(null),R=Y.useRef(null),z=Y.useRef(null),te=Y.useRef(null),ne=Y.useRef(!1),B=Y.useRef(0),re=Y.useRef(0),ie=Y.useRef(0),ae=Y.useRef(0),V=Y.useRef(`vertical`),H=Y.useRef(pt),oe=c(e=>{let t=e.x-H.current.x,n=e.y-H.current.y;H.current=e,n!==0&&(S(!0),l.start(500,()=>{S(!1)})),t!==0&&(v(!0),d.start(500,()=>{v(!1)}))}),se=c(e=>{e.button===0&&(ne.current=!0,B.current=e.clientY,re.current=e.clientX,V.current=e.currentTarget.getAttribute(ut.orientation),F.current&&(ie.current=F.current.scrollTop,ae.current=F.current.scrollLeft),R.current&&V.current===`vertical`&&R.current.setPointerCapture(e.pointerId),z.current&&V.current===`horizontal`&&z.current.setPointerCapture(e.pointerId))}),ce=c(e=>{if(!ne.current)return;let t=e.clientY-B.current,n=e.clientX-re.current;if(F.current){let r=F.current.scrollHeight,i=F.current.clientHeight,a=F.current.scrollWidth,o=F.current.clientWidth;if(R.current&&I.current&&V.current===`vertical`){let n=Z(I.current,`padding`,`y`),a=Z(R.current,`margin`,`y`),o=R.current.offsetHeight,s=t/(I.current.offsetHeight-o-n-a);F.current.scrollTop=ie.current+s*(r-i),e.preventDefault(),S(!0),l.start(500,()=>{S(!1)})}if(z.current&&L.current&&V.current===`horizontal`){let t=Z(L.current,`padding`,`x`),r=Z(z.current,`margin`,`x`),i=z.current.offsetWidth,s=n/(L.current.offsetWidth-i-t-r);F.current.scrollLeft=ae.current+s*(a-o),e.preventDefault(),v(!0),d.start(500,()=>{v(!1)})}}}),le=c(e=>{ne.current=!1,R.current&&V.current===`vertical`&&R.current.releasePointerCapture(e.pointerId),z.current&&V.current===`horizontal`&&z.current.releasePointerCapture(e.pointerId)});function ue(e){w(e.pointerType===`touch`)}function U(e){if(ue(e),e.pointerType!==`touch`){let t=y(P.current,e.target);h(t)}}let de=Y.useMemo(()=>({scrolling:_||x,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:j.xStart,overflowXEnd:j.xEnd,overflowYStart:j.yStart,overflowYEnd:j.yEnd,cornerHidden:M.corner}),[_,x,M.x,M.y,M.corner,j]),W={role:`presentation`,onPointerEnter:U,onPointerMove:U,onPointerDown:ue,onPointerLeave(){h(!1)},style:{position:`relative`,[lt.scrollAreaCornerHeight]:`${D.height}px`,[lt.scrollAreaCornerWidth]:`${D.width}px`}},G=u(`div`,e,{state:de,ref:[t,P],props:[W,a],stateAttributesMapping:ft}),K=Y.useMemo(()=>({handlePointerDown:se,handlePointerMove:ce,handlePointerUp:le,handleScroll:oe,cornerSize:D,setCornerSize:O,thumbSize:k,setThumbSize:A,hasMeasuredScrollbar:T,setHasMeasuredScrollbar:E,touchModality:C,cornerRef:te,scrollingX:_,setScrollingX:v,scrollingY:x,setScrollingY:S,hovering:m,setHovering:h,viewportRef:F,rootRef:P,scrollbarYRef:I,scrollbarXRef:L,thumbYRef:R,thumbXRef:z,rootId:s,hiddenState:M,setHiddenState:N,overflowEdges:j,setOverflowEdges:ee,viewportState:de,overflowEdgeThreshold:o}),[se,ce,le,oe,D,k,T,C,_,v,x,S,m,h,s,M,j,de,o]);return(0,X.jsxs)(st.Provider,{value:K,children:[!p&&pe.getElement(f),G]})});function vt(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}var yt=Y.createContext(void 0);function bt(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}var xt=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({});function St(e,t){if(t<=0)return 0;let n=G(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var Ct=!1,wt=typeof ResizeObserver<`u`;function Tt(){Ct||x||(typeof CSS<`u`&&`registerProperty`in CSS&&[xt.scrollAreaOverflowXStart,xt.scrollAreaOverflowXEnd,xt.scrollAreaOverflowYStart,xt.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),Ct=!0)}var Et=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:a,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:d,thumbXRef:f,cornerRef:p,cornerSize:m,setCornerSize:h,setThumbSize:g,rootId:_,setHiddenState:v,hiddenState:y,setHasMeasuredScrollbar:x,handleScroll:S,setHovering:C,setOverflowEdges:w,overflowEdges:T,overflowEdgeThreshold:E,scrollingX:D,scrollingY:O}=ct(),k=W(),A=Y.useRef(!0),j=Y.useRef([NaN,NaN,NaN,NaN]),ee=b(),M=b(),N=c(()=>{let e=a.current,t=o.current,n=l.current,r=d.current,i=f.current,s=p.current;if(!e)return;let c=e.scrollHeight,u=e.scrollWidth,_=e.clientHeight,y=e.clientWidth,b=e.scrollTop,S=e.scrollLeft,C=j.current,T=Number.isNaN(C[0]);if(C[0]=_,C[1]=c,C[2]=y,C[3]=u,T&&x(!0),c===0||u===0)return;let D=Dt(e),O=D.y,A=D.x,ee=y/u,M=_/c,N=Math.max(0,u-y),P=Math.max(0,c-_),F=0,I=0;if(!A){let e=0;e=G(k===`rtl`?-S:S,0,N),F=St(e,N),I=N-F}let L=O?0:G(b,0,P),R=O?0:St(L,P),z=O?0:P-R,te=A?0:y,ne=O?0:_,B=0,re=0;!A&&!O&&(B=t?.offsetWidth||0,re=n?.offsetHeight||0);let ie=m.width===0&&m.height===0,ae=ie?B:0,V=ie?re:0,H=Z(n,`padding`,`x`),oe=Z(t,`padding`,`y`),se=Z(i,`margin`,`x`),ce=Z(r,`margin`,`y`),le=te-H-se,ue=ne-oe-ce,U=n?Math.min(n.offsetWidth-ae,le):le,de=t?Math.min(t.offsetHeight-V,ue):ue,W=Math.max(16,U*ee),fe=Math.max(16,de*M);if(g(e=>e.height===fe&&e.width===W?e:{width:W,height:fe}),t&&r){let e=t.offsetHeight-fe-oe-ce,n=c-_,i=n===0?0:b/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-W-H-se,t=u-y,r=t===0?0:S/t,a=k===`rtl`?G(r*e,-e,0):G(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let pe=[[xt.scrollAreaOverflowXStart,F],[xt.scrollAreaOverflowXEnd,I],[xt.scrollAreaOverflowYStart,R],[xt.scrollAreaOverflowYEnd,z]];for(let[t,n]of pe)e.style.setProperty(t,`${n}px`);s&&(A||O?h({width:0,height:0}):!A&&!O&&h({width:B,height:re})),v(e=>Ot(e,D));let K={xStart:!A&&F>E.xStart,xEnd:!A&&I>E.xEnd,yStart:!O&&R>E.yStart,yEnd:!O&&z>E.yEnd};w(e=>e.xStart===K.xStart&&e.xEnd===K.xEnd&&e.yStart===K.yStart&&e.yEnd===K.yEnd?e:K)});s(()=>{if(a.current&&(Tt(),!wt))return bt(a.current,()=>{N()})},[N,a]),s(()=>{queueMicrotask(N)},[N,y,k]),s(()=>{a.current?.matches(`:hover`)&&C(!0)},[a,C]),Y.useEffect(()=>{let e=a.current;if(!wt||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=j.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}N()});return n.observe(e),M.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(N).catch(()=>{})}),()=>{n.disconnect(),M.clear()}},[N,a,M]);function P(){A.current=!1}let F={role:`presentation`,..._&&{"data-id":`${_}-viewport`},tabIndex:y.x&&y.y?-1:0,className:pe.className,style:{overflow:`scroll`},onScroll(){a.current&&(N(),A.current||S({x:a.current.scrollLeft,y:a.current.scrollTop}),ee.start(100,()=>{A.current=!0}))},onWheel:P,onTouchMove:P,onPointerMove:P,onPointerEnter:P,onKeyDown:P},I=Y.useMemo(()=>({scrolling:D||O,hasOverflowX:!y.x,hasOverflowY:!y.y,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:y.corner}),[D,O,y.x,y.y,y.corner,T]),L=u(`div`,e,{ref:[t,a],state:I,props:[F,i],stateAttributesMapping:ft}),R=Y.useMemo(()=>({computeThumbPosition:N}),[N]);return(0,X.jsx)(yt.Provider,{value:R,children:L})});function Dt(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function Ot(e,t){return e.y===t.y&&e.x===t.x&&e.corner===t.corner?e:t}var kt=Y.createContext(void 0);function At(){let e=Y.useContext(kt);if(e===void 0)throw Error(l(54));return e}var jt=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Mt=Y.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...o}=e,{hovering:s,scrollingX:c,scrollingY:l,hiddenState:d,overflowEdges:f,scrollbarYRef:p,scrollbarXRef:m,viewportRef:h,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:y,rootId:b,thumbSize:x,hasMeasuredScrollbar:S}=ct(),C={hovering:s,scrolling:{horizontal:c,vertical:l}[i],orientation:i,hasOverflowX:!d.x,hasOverflowY:!d.y,overflowXStart:f.xStart,overflowXEnd:f.xEnd,overflowYStart:f.yStart,overflowYEnd:f.yEnd,cornerHidden:d.corner},w=W(),T=!S&&!a;Y.useEffect(()=>{let e=h.current,t=i===`vertical`?p.current:m.current;if(!t)return;function n(n){if(e&&t&&!n.ctrlKey){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,m,p,h]);let E={...b&&{"data-id":`${b}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&h.current){if(g.current&&p.current&&i===`vertical`){let t=Z(g.current,`margin`,`y`),n=Z(p.current,`padding`,`y`),r=g.current.offsetHeight,i=p.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=h.current.scrollHeight,s=h.current.clientHeight,c=a/(p.current.offsetHeight-r-n-t)*(o-s);h.current.scrollTop=c}if(_.current&&m.current&&i===`horizontal`){let t=Z(_.current,`margin`,`x`),n=Z(m.current,`padding`,`x`),r=_.current.offsetWidth,i=m.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=h.current.scrollWidth,s=h.current.clientWidth,c=a/(m.current.offsetWidth-r-n-t),l;w===`rtl`?(l=(1-c)*(o-s),h.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),h.current.scrollLeft=l}v(e)}},onPointerUp:y,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:T?`hidden`:void 0,...i===`vertical`&&{top:0,bottom:`var(${lt.scrollAreaCornerHeight})`,insetInlineEnd:0,[jt.scrollAreaThumbHeight]:`${x.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${lt.scrollAreaCornerWidth})`,bottom:0,[jt.scrollAreaThumbWidth]:`${x.width}px`}}},D=u(`div`,e,{ref:[t,i===`vertical`?p:m],state:C,props:[E,o],stateAttributesMapping:ft}),O=Y.useMemo(()=>({orientation:i}),[i]),k=i===`vertical`?d.y:d.x;return!a&&k?null:(0,X.jsx)(kt.Provider,{value:O,children:D})}),Nt=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:o,handlePointerDown:s,handlePointerMove:c,handlePointerUp:l,setScrollingX:d,setScrollingY:f,hasMeasuredScrollbar:p}=ct(),{orientation:m}=At();return u(`div`,e,{ref:[t,m===`vertical`?a:o],state:{orientation:m},props:[{onPointerDown:s,onPointerMove:c,onPointerUp(e){m===`vertical`&&f(!1),m===`horizontal`&&d(!1),l(e)},style:{visibility:p?void 0:`hidden`,...m===`vertical`&&{height:`var(${jt.scrollAreaThumbHeight})`},...m===`horizontal`&&{width:`var(${jt.scrollAreaThumbWidth})`}}},i]})}),Pt=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:o,hiddenState:s}=ct(),c=u(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},i]});return s.corner?null:c}),Ft=e(i(),1),It=Y.forwardRef(({className:e,children:t,...n},i)=>(0,X.jsxs)(_t,{ref:i,"data-slot":`scroll-area`,className:r(`relative`,e),...n,children:[(0,X.jsx)(Et,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,X.jsx)(Lt,{}),(0,X.jsx)(Pt,{})]}));It.displayName=`ScrollArea`;var Lt=Y.forwardRef(({className:e,orientation:t=`vertical`,...n},i)=>(0,X.jsx)(Mt,{ref:i,"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:r(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,X.jsx)(Nt,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})}));Lt.displayName=`ScrollBar`;var Rt=Y.createContext(null);function zt(){let e=Y.useContext(Rt);if(!e)throw Error(`MessageScroller components must be inside MessageScrollerProvider`);return e}function Bt({children:e,defaultScrollPosition:t=`end`}){let[n,r]=Y.useState(null),[i,a]=Y.useState(!1),o=Y.useRef(!0),s=Y.useCallback(()=>{if(!n)return;let e=n.scrollHeight-n.scrollTop-n.clientHeight>8;o.current=!e,a(e)},[n]),c=Y.useCallback(e=>{r(t=>t===e?t:e)},[]),l=Y.useCallback(()=>{n&&n.scrollTo({top:n.scrollHeight,behavior:`smooth`})},[n]);return Y.useEffect(()=>{if(n)return s(),n.addEventListener(`scroll`,s,{passive:!0}),()=>n.removeEventListener(`scroll`,s)},[s,n]),(0,X.jsx)(Rt.Provider,{value:{defaultScrollPosition:t,viewport:n,registerViewport:c,scrollToEnd:l,canScrollEnd:i,shouldFollowRef:o},children:e})}function Vt({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`message-scroller`,className:r(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function Ht({className:e,children:t,...n}){let i=Y.useRef(null),{registerViewport:a}=zt();return Y.useEffect(()=>{let e=i.current?.querySelector(`[data-slot="scroll-area-viewport"]`)??null;return a(e),()=>a(null)},[a]),(0,X.jsx)(It,{ref:i,className:r(`min-h-0 min-w-0 flex-1 overscroll-contain`,e),...n,children:t})}function Ut({className:e,children:t,...n}){let{defaultScrollPosition:i,viewport:a,shouldFollowRef:o}=zt(),s=Y.useRef(!1);return Y.useEffect(()=>{a&&a.scrollHeight!==0&&(!s.current||o.current)&&(a.scrollTop=i===`start`?0:a.scrollHeight,s.current=!0)},[t,i,a]),(0,X.jsx)(`div`,{"data-slot":`message-scroller-content`,role:`log`,"aria-relevant":`additions`,className:r(`flex h-max min-h-full flex-col gap-3`,e),...n,children:t})}function Wt({className:e,messageId:t,scrollAnchor:n=!1,...i}){return(0,X.jsx)(`div`,{"data-slot":`message-scroller-item`,"data-message-id":t,"data-scroll-anchor":n?`true`:`false`,className:r(`min-w-0 shrink-0`,e),...i})}function Gt({className:e,children:t,...n}){let{canScrollEnd:i,scrollToEnd:a}=zt();return(0,X.jsx)(f,{type:`button`,variant:`secondary`,size:`icon-sm`,"aria-label":`Scroll to latest message`,"data-slot":`message-scroller-button`,"data-active":i?`true`:`false`,tabIndex:i?0:-1,className:r(`absolute bottom-3 left-1/2 z-10 -translate-x-1/2 shadow-sm transition-[opacity,transform]`,i?`translate-y-0 opacity-100`:`pointer-events-none translate-y-2 opacity-0`,e),onClick:a,...n,children:t??(0,X.jsx)(J,{"aria-hidden":`true`})})}var Kt=e=>`/api/projects/${encodeURIComponent(e.projectId)}/comments`,qt=e=>`feature_type=${e.featureType}&file_id=${encodeURIComponent(e.fileId)}`,Q=(e,t,n)=>e?.[t]??e?.[n];async function Jt(e){let t=await e.json().catch(()=>({}));if(!e.ok)throw Object.assign(Error(t.error||`Comment request failed`),{status:e.status});return t}async function Yt(e){return((await Jt(await q(`${Kt(e)}/markers?${qt(e)}`))).markers||[]).map(e=>{let t=Q(e,`rootMessage`,`root_message`),n=Q(e,`latestMessage`,`latest_message`),r=e=>e?{authorName:String(Q(e,`authorName`,`author_name`)??``),body:String(e.body??``),createdAt:String(Q(e,`createdAt`,`created_at`)??``)}:null;return{threadId:Q(e,`threadId`,`thread_id`)?String(Q(e,`threadId`,`thread_id`)):null,anchorType:String(Q(e,`anchorType`,`anchor_type`)),anchorId:String(Q(e,`anchorId`,`anchor_id`)),status:e.status===`resolved`?`resolved`:`open`,messageCount:Number(Q(e,`messageCount`,`message_count`)??0),replyCount:Number(Q(e,`replyCount`,`reply_count`)??0),unreadCount:Number(Q(e,`unreadCount`,`unread_count`)??0),rootMessage:r(t),latestMessage:r(n)}})}async function Xt(e,t,n){let r=`${qt(e)}&anchor_type=${encodeURIComponent(t.type)}&anchor_id=${encodeURIComponent(t.id)}`+(n?`&before_created_at=${encodeURIComponent(n.createdAt)}&before_id=${encodeURIComponent(n.id)}`:``),i=await Jt(await q(`${Kt(e)}/anchor?${r}`)),a=(i.threads||[])[0],o=Q(i,`nextCursor`,`next_cursor`);return{threadId:a?String(a.id):null,createdBy:a&&String(Q(a,`createdBy`,`created_by`)??``)||null,status:a?.status===`resolved`?`resolved`:`open`,messages:(i.messages||[]).map(e=>({id:String(e.id),authorId:String(Q(e,`authorId`,`author_id`)),authorName:String(Q(e,`authorName`,`author_name`)||`Team member`),body:String(e.body),createdAt:String(Q(e,`createdAt`,`created_at`))})),hasMore:!!Q(i,`hasMore`,`has_more`),nextCursor:o?{createdAt:String(Q(o,`createdAt`,`created_at`)),id:String(o.id)}:null}}async function Zt(e,t,n){await Jt(await q(Kt(e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n,context:{type:t.type,id:t.id,featureType:e.featureType,fileId:e.fileId}})})),tn(e)}async function Qt(e,t,n){await Jt(await q(`${Kt(e)}/${encodeURIComponent(t)}?${qt(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:n})})),tn(e)}async function $t(e,t,n,r){await Jt(await q(`${Kt(e)}/${encodeURIComponent(t)}/messages/${encodeURIComponent(n.id)}?${qt(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:r,expectedBody:n.body})})),tn(e)}async function en(e,t){await Jt(await q(`${Kt(e)}/${encodeURIComponent(t)}?${qt(e)}`,{method:`DELETE`})),tn(e)}function tn(e){window.dispatchEvent(new CustomEvent(`collaboration-updated`,{detail:{teamId:e.teamId,projectId:e.projectId}}))}async function nn(e,t){await q(`${Kt(e)}/${encodeURIComponent(t)}/read?${qt(e)}`,{method:`POST`}).catch(()=>void 0)}function rn(e,t){return t>=e.length?[...e]:e.slice(e.length-t)}function an(e,t){return Math.max(e-t,0)}function on(e,t){let n=e;if(typeof e==`string`)try{n=JSON.parse(e)}catch{return!1}let r=n?.[t.type===`relationship`?`edges`:`nodes`];return Array.isArray(r)&&r.some(e=>e?.id===t.id)}function sn(e,t,n=!0){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(`open`),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(10),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),x=(0,Y.useRef)(0),S=`${e.projectId}|${e.featureType}|${e.fileId}|${t.type}|${t.id}`,C=(0,Y.useCallback)((e,t)=>{o(e.threadId),c(e.createdBy),u(e.status),f(e.nextCursor),i(n=>{if(!t)return e.messages;let r=new Set(n.map(e=>e.id));return[...e.messages.filter(e=>!r.has(e.id)),...n]})},[]),w=(0,Y.useCallback)(async()=>{let n=++x.current;g(!0),b(``);try{let r=await Xt(e,t);if(n!==x.current)return;i(r.messages),o(r.threadId),c(r.createdBy),u(r.status),f(r.nextCursor),r.threadId&&nn(e,r.threadId)}catch(e){n===x.current&&e?.status!==404&&b(`Could not load this comment.`)}finally{n===x.current&&g(!1)}},[S]);(0,Y.useEffect)(()=>(i([]),o(null),c(null),m(10),f(null),n&&w(),()=>{x.current++}),[n,S,w]);let T=(0,Y.useCallback)(async()=>{if(p+10<=r.length||!d)m(e=>e+10);else{g(!0);try{C(await Xt(e,t,d),!0),m(e=>e+10)}catch{b(`Could not load older comments.`)}finally{g(!1)}}},[p,r.length,d,S,C]),E=(0,Y.useCallback)(async n=>{let r=n.trim();if(!r||_)return!1;v(!0),b(``);try{return await Zt(e,t,r),await w(),!0}catch(e){return b(e?.status===409?`This comment was resolved. Reopen it to reply.`:`Could not send the comment. Try again.`),!1}finally{v(!1)}},[_,S,w]),D=(0,Y.useCallback)(async()=>{if(a)try{await Qt(e,a,l===`open`?`resolved`:`open`),await w()}catch{b(`Could not update this comment. Refresh and try again.`)}},[a,l,S,w]),O=(0,Y.useCallback)(async(t,n)=>{let r=n.trim();if(!a||!r||_)return!1;if(r===t.body)return!0;v(!0),b(``);try{return await $t(e,a,t,r),i(e=>e.map(e=>e.id===t.id?{...e,body:r}:e)),!0}catch(e){return b(e?.status===409?`This comment changed. Check the latest text and edit again.`:`Could not edit the comment. Try again.`),await w(),!1}finally{v(!1)}},[a,_,S,w]),k=(0,Y.useCallback)(async()=>{if(!a||_)return!1;v(!0),b(``);try{return await en(e,a),x.current++,i([]),o(null),c(null),f(null),!0}catch{return b(`Could not delete this comment. Refresh and try again.`),!1}finally{v(!1)}},[a,_,S]);return{messages:rn(r,p),hidden:an(r.length,p)+ +!!d,hasOlder:an(r.length,p)>0||!!d,total:r.length,threadId:a,createdBy:s,status:l,loading:h,sending:_,error:y,showOlder:T,send:E,edit:O,toggleResolved:D,deleteThread:k,reload:w}}var cn=[`bg-teal-600`,`bg-sky-600`,`bg-violet-600`,`bg-rose-600`,`bg-amber-600`,`bg-emerald-600`];function ln({name:e,className:t}){let n=(e.trim()[0]||`?`).toUpperCase(),i=cn[[...e].reduce((e,t)=>e+t.charCodeAt(0),0)%cn.length];return(0,X.jsx)(`span`,{className:r(`flex size-6 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white`,i,t),"aria-hidden":`true`,children:n})}function un(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=Math.max(Math.round((Date.now()-t.getTime())/6e4),0);return n<1?`now`:n<60?`${n}m`:n<1440?`${Math.round(n/60)}h`:n<10080?`${Math.round(n/60/24)}d`:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function dn({file:e,anchor:t,autoFocus:n=!1,showActions:i=!0,onDirtyChange:a,onClose:o,onExpand:s,className:c}){let l=sn(e,t),u=String(_e().user?.id??``),[d,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(!1),b=(0,Y.useRef)(null),x=(0,Y.useRef)(null),S=l.messages[l.messages.length-1]?.id;(0,Y.useEffect)(()=>{n&&b.current?.focus()},[n]),(0,Y.useEffect)(()=>{a?.(d.trim().length>0||m!==null&&g.trim()!==m.body)},[d,m,g,a]),(0,Y.useEffect)(()=>{let e=b.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[d]),(0,Y.useEffect)(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[S]);let C=async()=>{await l.send(d)&&p(``)},w=async()=>{m&&await l.edit(m,g)&&h(null)},T=async()=>{y(!1),await l.deleteThread()&&o?.()};return(0,X.jsxs)(`div`,{className:r(`flex min-h-0 flex-col gap-2`,c),children:[i&&(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[l.threadId&&(0,X.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6`,onClick:()=>void l.toggleResolved(),title:l.status===`open`?`Resolve`:`Reopen`,"aria-label":l.status===`open`?`Resolve comment`:`Reopen comment`,children:l.status===`open`?(0,X.jsx)(de,{className:`size-3.5`}):(0,X.jsx)(Ce,{className:`size-3.5`})}),s&&(0,X.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6`,onClick:s,title:`Open in comments panel`,"aria-label":`Open in comments panel`,children:(0,X.jsx)(Se,{className:`size-3.5`})}),o&&(0,X.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6`,onClick:o,title:`Close`,"aria-label":`Close comment`,children:(0,X.jsx)(he,{className:`size-3.5`})})]}),l.hasOlder&&(0,X.jsx)(`button`,{type:`button`,disabled:l.loading,onClick:()=>void l.showOlder(),className:`self-start rounded px-1 text-xs text-muted-foreground hover:text-foreground disabled:opacity-60`,children:`Show old comments`}),(0,X.jsxs)(`ul`,{ref:x,className:`flex max-h-72 flex-col gap-2.5 overflow-y-auto pr-1`,children:[l.messages.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex gap-2`,children:[(0,X.jsx)(ln,{name:e.authorName,className:`size-5 text-[10px]`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.authorName}),(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:un(e.createdAt)}),e.authorId===u&&m?.id!==e.id&&(0,X.jsx)(`button`,{type:`button`,disabled:l.sending,onClick:()=>{h(e),_(e.body)},className:`shrink-0 text-[11px] text-muted-foreground hover:text-foreground hover:underline disabled:opacity-60`,children:`Edit`}),t===0&&!l.hasOlder&&l.threadId&&l.createdBy===u&&m?.id!==e.id&&(0,X.jsx)(`button`,{type:`button`,disabled:l.sending,onClick:()=>y(!0),className:`shrink-0 text-[11px] text-muted-foreground hover:text-destructive hover:underline disabled:opacity-60`,children:`Delete`})]}),m?.id===e.id?(0,X.jsxs)(`form`,{className:`mt-1 flex items-end gap-1 rounded-md border bg-background px-2 py-1 focus-within:border-ring`,onSubmit:e=>{e.preventDefault(),w()},children:[(0,X.jsx)(`textarea`,{"data-comment-draft":!0,autoFocus:!0,rows:1,maxLength:4e3,value:g,"aria-label":`Edit comment`,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),w()),e.key===`Escape`&&(e.stopPropagation(),h(null))},className:`max-h-[120px] min-h-5 min-w-0 flex-1 resize-none bg-transparent text-xs outline-none`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Cancel edit`,disabled:l.sending,onClick:()=>h(null),className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground hover:text-foreground disabled:opacity-40`,children:(0,X.jsx)(he,{"aria-hidden":`true`,className:`size-3`})}),(0,X.jsx)(`button`,{type:`submit`,"aria-label":`Save comment`,disabled:!g.trim()||l.sending,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-sky-500 text-white disabled:opacity-40`,children:(0,X.jsx)(de,{"aria-hidden":`true`,className:`size-3`})})]}):(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs leading-snug`,children:e.body})]})]},e.id)),l.loading&&!l.messages.length&&(0,X.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`Loading…`})]}),l.status===`resolved`&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Resolved. Reopen it to reply.`}),l.error&&(0,X.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:l.error}),l.status===`open`&&(0,X.jsxs)(`form`,{className:`mx-0.5 mb-0.5 flex items-end gap-1.5 rounded-lg border border-input bg-background px-2.5 py-1.5 transition-colors focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-primary/20`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,X.jsx)(`textarea`,{"data-comment-draft":!0,ref:b,value:d,rows:1,maxLength:4e3,placeholder:l.messages.length?`Reply…`:`Add a comment…`,"aria-label":l.messages.length?`Reply to comment`:`Add a comment`,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),C()),e.key===`Escape`&&o?.()},className:`max-h-[120px] min-h-6 flex-1 resize-none bg-transparent py-0.5 text-xs outline-none placeholder:text-muted-foreground`}),(0,X.jsx)(`button`,{type:`submit`,disabled:!d.trim()||l.sending,"aria-label":`Send comment`,className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-sky-500 text-white disabled:opacity-40`,children:(0,X.jsx)(ve,{className:`size-3.5`})})]}),(0,X.jsx)(K,{isOpen:v,title:`Delete thread?`,message:`This permanently deletes the thread and all of its comments.`,confirmText:`Delete Thread`,cancelText:`Cancel`,variant:`danger`,onCancel:()=>y(!1),onConfirm:()=>{T()}})]})}function fn(e,t=0){let n=e.indexOf(`{`,t);if(n===-1)return null;let r=0,i=null,a=!1;for(let t=n;t<e.length;t++){let o=e[t];if(i)a?a=!1:o===`\\`?a=!0:o===i&&(i=null);else if(o===`"`||o===`'`)i=o;else if(o===`{`&&r++,o===`}`&&r--,r===0)return e.substring(n,t+1)}return null}function pn(e){function t(e){let t=0;for(;t<e.length;){let n=fn(e,t);if(!n)return null;try{let e=JSON.parse(n);if(e&&Array.isArray(e.nodes))return n}catch{}let r=e.indexOf(`{`,t);if(r===-1)return null;t=r+1}return null}for(let n of vn(e)){let e=t(n);if(e)return e}return t(e)}function mn(e){let t=pn(e);if(t)try{let e=JSON.parse(t);if(e&&Array.isArray(e.nodes))return!0}catch{}try{let t=JSON.parse(e.trim());if(t&&Array.isArray(t.nodes))return!0}catch{}return!1}function hn(e){let t=/\b(CREATE\s+TABLE|ALTER\s+TABLE|INSERT\s+INTO)\b/i,n=/```(?:\w*)\n?([\s\S]*?)```/g,r;for(;(r=n.exec(e))!==null;)if(t.test(r[1]))return!0;return!!t.test(e)}var gn=/^\s*(?:Project|TableGroup|Table|Enum)\s+(?:"[^"]+"|[\w.]+)\s*\{|^\s*Ref\s*:/im,_n=/^\s*(?:Project|TableGroup|Table|Enum)\s+(?:"[^"]+"|[\w.]+)\s*\{|^\s*Ref\s*:/i;function vn(e){let t=/```[^\r\n]*\r?\n?([\s\S]*?)```/g,n=[],r;for(;(r=t.exec(e))!==null;){let e=r[1].trim();e&&n.push(e)}return n}function yn(e){let t=e.split(/\r?\n/),n=t.findIndex(e=>_n.test(e));if(n===-1)return null;let r=[],i=0,a=!1;for(let e=n;e<t.length;e+=1){let n=t[e],o=n.trim(),s=_n.test(n),c=!o||o.startsWith(`//`);if(a||s||c){if(a&&i===0&&!s&&!c)break;a=!0,r.push(n);for(let e of n)e===`{`&&(i+=1),e===`}`&&(i=Math.max(0,i-1))}}let o=r.join(`
2
+ `).trim();return gn.test(o)?o:null}function bn(e){return Sn(e)!==null}function xn(e){let t=/\b(CREATE\s+TABLE|ALTER\s+TABLE|INSERT\s+INTO)\b/i,n=/```(?:\w*)\n?([\s\S]*?)```/g,r,i=[];for(;(r=n.exec(e))!==null;)t.test(r[1])&&i.push(r[1].trim());return i.length>0?i.join(`
3
+
4
+ `):t.test(e)?e.trim():null}function Sn(e){let t=[];for(let n of vn(e)){let e=yn(n);e&&t.push(e)}return t.length>0?t.join(`
5
+
6
+ `):yn(e)}function Cn(e){return bn(e)||hn(e)}function wn(e){return Sn(e)||xn(e)}function Tn(e){let t=pn(e);if(t)try{let e=JSON.parse(t);if(e&&Array.isArray(e.nodes))return t.trim()}catch{}try{let t=JSON.parse(e.trim());if(t&&Array.isArray(t.nodes))return e.trim()}catch{}return null}function En(e){return e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``}var Dn=[/\b(beri\s*tahu|kabari|let\s+me\s+know|tell\s+me|lmk)\b/i,/\b(gunakan|klik|click|use)\s+(tombol|button)\b/i,/\b(jika\s+ada|if\s+(you\s+(have|need|want)|there\s+is|anything))\b/i,/\b(jika\s+sudah\s+sesuai|if\s+(it|this|that)\s+(looks|is)\s+(good|correct|right|ok|okay))\b/i,/\b(semoga\s+membantu|hope\s+(this|it|that)\s+helps)\b/i,/\b(saya\s+siap|i'?m\s+(ready|here)|happy\s+to\s+help)\b/i,/\b(silahkan|feel\s+free|don'?t\s+hesitate)\b/i,/\b(^\*\*Catatan\*\*|^\*\*Note\*\*|^\*\*Tips?\*\*)/im];function On(e){let t=e.split(/\n---\n/);if(t.length<2)return e.trim();let n=t[0].trim();if(n.length>0&&n.length<350&&t.shift(),t.length>=1){let e=t[t.length-1].trim();Dn.some(t=>t.test(e))&&t.pop()}return t.join(`
7
+ ---
8
+ `).trim()||e.trim()}function kn(e,t,n){return e&&e!==t?n?.(e):void 0}function An(e){let[t,n]=Y.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=Y.useRef(null),i=Y.useRef(null),a=Y.useRef(null),o=Y.useRef(null),s=Y.useRef(!0),c=Y.useRef(null),l=v(),u=Y.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,X.jsx)(re.Provider,{value:u,children:(0,X.jsx)(O.Provider,{value:void 0,children:(0,X.jsx)(F,{...e})})})}var jn=500,Mn=Y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{setAnchor:a,actionsRef:o,internalBackdropRef:s,backdropRef:c,positionerRef:l,allowMouseUpTriggerRef:d,initialCursorPointRef:f,rootId:g}=k(!1),{store:v}=B(!1),x=v.useState(`open`),T=v.useState(`disabled`),E=Y.useRef(null),D=Y.useRef(null),O=b(),A=b(),j=Y.useRef(!1);function ee(e,t,n){let r=n.type.startsWith(`touch`);f.current={x:e,y:t},a({getBoundingClientRect(){return DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}}),j.current=!1,o.current?.setOpen(!0,w(p,n)),A.start(jn,()=>{j.current=!0})}function M(e){T||(d.current=!0,_(e),ee(e.clientX,e.clientY,e.nativeEvent),h(E.current).addEventListener(`mouseup`,e=>{if(d.current=!1,!j.current)return;A.clear(),j.current=!1;let t=C(e);y(l.current,t)||g&&t&&L(t)===g||o.current?.setOpen(!1,w(S,e))},{once:!0}))}function N(e){if(!T&&(d.current=!1,e.touches.length===1)){e.stopPropagation();let t=e.touches[0];D.current={x:t.clientX,y:t.clientY},O.start(jn,()=>{D.current&&ee(D.current.x,D.current.y,e.nativeEvent)})}}function P(e){if(O.isStarted()&&D.current&&e.touches.length===1){let t=e.touches[0],n=Math.abs(t.clientX-D.current.x),r=Math.abs(t.clientY-D.current.y);(n>10||r>10)&&O.clear()}}function F(){O.clear(),D.current=null}return Y.useEffect(()=>{function e(e){if(T)return;let t=C(e);(y(E.current,t)||y(s.current,t)||y(c.current,t))&&e.preventDefault()}let t=h(E.current);return t.addEventListener(`contextmenu`,e),()=>{t.removeEventListener(`contextmenu`,e)}},[c,T,s]),u(`div`,e,{state:{open:x},ref:[E,t],props:[{onContextMenu:M,onTouchStart:N,onTouchMove:P,onTouchEnd:F,onTouchCancel:F,style:{WebkitTouchCallout:`none`}},i],stateAttributesMapping:m})});function Nn({...e}){return(0,X.jsx)(An,{"data-slot":`context-menu`,...e})}var Pn=Y.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Mn,{ref:n,"data-slot":`context-menu-trigger`,className:e,...t}));Pn.displayName=`ContextMenuTrigger`;function Fn({sideOffset:e=4,anchor:t,className:n,positionerClassName:i,...a}){return(0,X.jsx)(ne,{children:(0,X.jsx)(j,{className:r(`isolate z-50`,i),sideOffset:e,anchor:t,children:(0,X.jsx)(ie,{"data-slot":`context-menu-content`,className:r(`z-50 min-w-32 max-w-(--available-width) max-h-(--available-height) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),...a})})})}function In({className:e,variant:t=`default`,...n}){return(0,X.jsx)(M,{"data-slot":`context-menu-item`,"data-variant":t,className:r(`group/context-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n})}function Ln({...e}){return(0,X.jsx)(I,{"data-slot":`context-menu-sub`,...e})}function Rn({className:e,children:t,...n}){return(0,X.jsxs)(P,{"data-slot":`context-menu-sub-trigger`,className:r(`flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground`,e),...n,children:[t,(0,X.jsx)(T,{className:`ml-auto size-4`})]})}function zn({className:e,sideOffset:t=4,...n}){return(0,X.jsx)(Fn,{sideOffset:t,className:r(`min-w-40`,e),...n})}function Bn({className:e,...t}){return(0,X.jsx)(A,{"data-slot":`context-menu-separator`,className:r(`-mx-1 my-1 h-px bg-border`,e),...t})}typeof window<`u`&&window.document&&window.document.createElement;function $(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Vn(e,t=[]){let n=[];function r(t,r){let i=Y.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=Y.useMemo(()=>o,Object.values(o));return(0,X.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=Y.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>Y.createContext(e));return function(n){let r=n?.[e]||t;return Y.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Hn(i,...t)]}function Hn(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Y.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Un=globalThis?.document?Y.useLayoutEffect:()=>{},Wn=Y.useInsertionEffect||Un;function Gn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Kn({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=Y.useRef(e!==void 0);Y.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,Y.useCallback(t=>{if(s){let n=qn(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Kn({defaultProp:e,onChange:t}){let[n,r]=Y.useState(e),i=Y.useRef(n),a=Y.useRef(t);return Wn(()=>{a.current=t},[t]),Y.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function qn(e){return typeof e==`function`}function Jn(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Yn(...e){return t=>{let n=!1,r=e.map(e=>{let r=Jn(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Jn(e[t],null)}}}}function Xn(...e){return Y.useCallback(Yn(...e),e)}function Zn(e){let t=Qn(e),n=Y.forwardRef((e,n)=>{let{children:r,...i}=e,a=Y.Children.toArray(r),o=a.find(er);if(o){let e=o.props.children,r=a.map(t=>t===o?Y.Children.count(e)>1?Y.Children.only(null):Y.isValidElement(e)?e.props.children:null:t);return(0,X.jsx)(t,{...i,ref:n,children:Y.isValidElement(e)?Y.cloneElement(e,void 0,r):null})}return(0,X.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Qn(e){let t=Y.forwardRef((e,t)=>{let{children:n,...r}=e;if(Y.isValidElement(n)){let e=nr(n),i=tr(r,n.props);return n.type!==Y.Fragment&&(i.ref=t?Yn(t,e):e),Y.cloneElement(n,i)}return Y.Children.count(n)>1?Y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $n=Symbol(`radix.slottable`);function er(e){return Y.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===$n}function tr(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function nr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rr=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Zn(`Primitive.${t}`),r=Y.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,X.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ir(e,t){e&&Ft.flushSync(()=>e.dispatchEvent(t))}var ar=`Arrow`,or=Y.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,X.jsx)(rr.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,X.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});or.displayName=ar;var sr=or;function cr(e){let t=Y.useRef(e);return Y.useEffect(()=>{t.current=e}),Y.useMemo(()=>(...e)=>t.current?.(...e),[])}function lr(e){let[t,n]=Y.useState(void 0);return Un(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}var ur=`Popper`,[dr,fr]=Vn(ur),[pr,mr]=dr(ur),hr=e=>{let{__scopePopper:t,children:n}=e,[r,i]=Y.useState(null);return(0,X.jsx)(pr,{scope:t,anchor:r,onAnchorChange:i,children:n})};hr.displayName=ur;var gr=`PopperAnchor`,_r=Y.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=mr(gr,n),o=Y.useRef(null),s=Xn(t,o),c=Y.useRef(null);return Y.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,X.jsx)(rr.div,{...i,ref:s})});_r.displayName=gr;var vr=`PopperContent`,[yr,br]=dr(vr),xr=Y.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=mr(vr,n),[_,v]=Y.useState(null),y=Xn(t,e=>v(e)),[b,x]=Y.useState(null),S=lr(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(Tr),altBoundary:O},{refs:A,floatingStyles:j,placement:ee,isPositioned:M,middlewareData:N}=se({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>H(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[le({mainAxis:i+w,alignmentAxis:o}),c&&U({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?ae():void 0,...k}),c&&ue({...k}),V({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&ce({element:b,padding:s}),Er({arrowWidth:C,arrowHeight:w}),f&&oe({strategy:`referenceHidden`,...k})]}),[P,F]=Dr(ee),I=cr(m);Un(()=>{M&&I?.()},[M,I]);let L=N.arrow?.x,R=N.arrow?.y,z=N.arrow?.centerOffset!==0,[te,ne]=Y.useState();return Un(()=>{_&&ne(window.getComputedStyle(_).zIndex)},[_]),(0,X.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:M?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:te,"--radix-popper-transform-origin":[N.transformOrigin?.x,N.transformOrigin?.y].join(` `),...N.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,X.jsx)(yr,{scope:n,placedSide:P,onArrowChange:x,arrowX:L,arrowY:R,shouldHideArrow:z,children:(0,X.jsx)(rr.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:M?void 0:`none`}})})})});xr.displayName=vr;var Sr=`PopperArrow`,Cr={top:`bottom`,right:`left`,bottom:`top`,left:`right`},wr=Y.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=br(Sr,n),a=Cr[i.placedSide];return(0,X.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,X.jsx)(sr,{...r,ref:t,style:{...r.style,display:`block`}})})});wr.displayName=Sr;function Tr(e){return e!==null}var Er=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Dr(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Dr(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Or=hr,kr=_r,Ar=xr,jr=wr,Mr=`Portal`,Nr=Y.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=Y.useState(!1);Un(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Ft.createPortal((0,X.jsx)(rr.div,{...r,ref:t}),o):null});Nr.displayName=Mr;function Pr(e,t){return Y.useReducer((e,n)=>t[e][n]??e,e)}var Fr=e=>{let{present:t,children:n}=e,r=Ir(t),i=typeof n==`function`?n({present:r.isPresent}):Y.Children.only(n),a=Xn(r.ref,Rr(i));return typeof n==`function`||r.isPresent?Y.cloneElement(i,{ref:a}):null};Fr.displayName=`Presence`;function Ir(e){let[t,n]=Y.useState(),r=Y.useRef(null),i=Y.useRef(e),a=Y.useRef(`none`),[o,s]=Pr(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Y.useEffect(()=>{let e=Lr(r.current);a.current=o===`mounted`?e:`none`},[o]),Un(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Lr(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Un(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Lr(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Lr(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:Y.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Lr(e){return e?.animationName||`none`}function Rr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zr(e,t=globalThis?.document){let n=cr(e);Y.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Br=`DismissableLayer`,Vr=`dismissableLayer.update`,Hr=`dismissableLayer.pointerDownOutside`,Ur=`dismissableLayer.focusOutside`,Wr,Gr=Y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kr=Y.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=Y.useContext(Gr),[u,d]=Y.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=Y.useState({}),m=Xn(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Yr(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));b&&!n&&(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Xr(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return zr(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),Y.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Wr=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Zr(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Wr)}},[u,f,n,l]),Y.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Zr())},[u,l]),Y.useEffect(()=>{let e=()=>p({});return document.addEventListener(Vr,e),()=>document.removeEventListener(Vr,e)},[]),(0,X.jsx)(rr.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:$(e.onFocusCapture,S.onFocusCapture),onBlurCapture:$(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:$(e.onPointerDownCapture,x.onPointerDownCapture)})});Kr.displayName=Br;var qr=`DismissableLayerBranch`,Jr=Y.forwardRef((e,t)=>{let n=Y.useContext(Gr),r=Y.useRef(null),i=Xn(t,r);return Y.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,X.jsx)(rr.div,{...e,ref:i})});Jr.displayName=qr;function Yr(e,t=globalThis?.document){let n=cr(e),r=Y.useRef(!1),i=Y.useRef(()=>{});return Y.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Qr(Hr,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Xr(e,t=globalThis?.document){let n=cr(e),r=Y.useRef(!1);return Y.useEffect(()=>{let e=e=>{e.target&&!r.current&&Qr(Ur,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Zr(){let e=new CustomEvent(Vr);document.dispatchEvent(e)}function Qr(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ir(i,a):i.dispatchEvent(a)}var $r,ei=`HoverCard`,[ti,ni]=Vn(ei,[fr]),ri=fr(),[ii,ai]=ti(ei),oi=e=>{let{__scopeHoverCard:t,children:n,open:r,defaultOpen:i,onOpenChange:a,openDelay:o=700,closeDelay:s=300}=e,c=ri(t),l=Y.useRef(0),u=Y.useRef(0),d=Y.useRef(!1),f=Y.useRef(!1),[p,m]=Gn({prop:r,defaultProp:i??!1,onChange:a,caller:ei}),h=Y.useCallback(()=>{clearTimeout(u.current),l.current=window.setTimeout(()=>m(!0),o)},[o,m]),g=Y.useCallback(()=>{clearTimeout(l.current),!d.current&&!f.current&&(u.current=window.setTimeout(()=>m(!1),s))},[s,m]),_=Y.useCallback(()=>m(!1),[m]);return Y.useEffect(()=>()=>{clearTimeout(l.current),clearTimeout(u.current)},[]),(0,X.jsx)(ii,{scope:t,open:p,onOpenChange:m,onOpen:h,onClose:g,onDismiss:_,hasSelectionRef:d,isPointerDownOnContentRef:f,children:(0,X.jsx)(Or,{...c,children:n})})};oi.displayName=ei;var si=`HoverCardTrigger`,ci=Y.forwardRef((e,t)=>{let{__scopeHoverCard:n,...r}=e,i=ai(si,n),a=ri(n);return(0,X.jsx)(kr,{asChild:!0,...a,children:(0,X.jsx)(rr.a,{"data-state":i.open?`open`:`closed`,...r,ref:t,onPointerEnter:$(e.onPointerEnter,vi(i.onOpen)),onPointerLeave:$(e.onPointerLeave,vi(i.onClose)),onFocus:$(e.onFocus,i.onOpen),onBlur:$(e.onBlur,i.onClose),onTouchStart:$(e.onTouchStart,e=>e.preventDefault())})})});ci.displayName=si;var li=`HoverCardPortal`,[ui,di]=ti(li,{forceMount:void 0}),fi=e=>{let{__scopeHoverCard:t,forceMount:n,children:r,container:i}=e,a=ai(li,t);return(0,X.jsx)(ui,{scope:t,forceMount:n,children:(0,X.jsx)(Fr,{present:n||a.open,children:(0,X.jsx)(Nr,{asChild:!0,container:i,children:r})})})};fi.displayName=li;var pi=`HoverCardContent`,mi=Y.forwardRef((e,t)=>{let n=di(pi,e.__scopeHoverCard),{forceMount:r=n.forceMount,...i}=e,a=ai(pi,e.__scopeHoverCard);return(0,X.jsx)(Fr,{present:r||a.open,children:(0,X.jsx)(hi,{"data-state":a.open?`open`:`closed`,...i,onPointerEnter:$(e.onPointerEnter,vi(a.onOpen)),onPointerLeave:$(e.onPointerLeave,vi(a.onClose)),ref:t})})});mi.displayName=pi;var hi=Y.forwardRef((e,t)=>{let{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,...s}=e,c=ai(pi,n),l=ri(n),u=Y.useRef(null),d=Xn(t,u),[f,p]=Y.useState(!1);return Y.useEffect(()=>{if(f){let e=document.body;return $r=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect=`none`,e.style.webkitUserSelect=`none`,()=>{e.style.userSelect=$r,e.style.webkitUserSelect=$r}}},[f]),Y.useEffect(()=>{if(u.current){let e=()=>{p(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==``&&(c.hasSelectionRef.current=!0)})};return document.addEventListener(`pointerup`,e),()=>{document.removeEventListener(`pointerup`,e),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),Y.useEffect(()=>{u.current&&yi(u.current).forEach(e=>e.setAttribute(`tabindex`,`-1`))}),(0,X.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:$(a,e=>{e.preventDefault()}),onDismiss:c.onDismiss,children:(0,X.jsx)(Ar,{...l,...s,onPointerDown:$(s.onPointerDown,e=>{e.currentTarget.contains(e.target)&&p(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:d,style:{...s.style,userSelect:f?`text`:void 0,WebkitUserSelect:f?`text`:void 0,"--radix-hover-card-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-hover-card-content-available-width":`var(--radix-popper-available-width)`,"--radix-hover-card-content-available-height":`var(--radix-popper-available-height)`,"--radix-hover-card-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-hover-card-trigger-height":`var(--radix-popper-anchor-height)`}})})}),gi=`HoverCardArrow`,_i=Y.forwardRef((e,t)=>{let{__scopeHoverCard:n,...r}=e,i=ri(n);return(0,X.jsx)(jr,{...i,...r,ref:t})});_i.displayName=gi;function vi(e){return t=>t.pointerType===`touch`?void 0:e()}function yi(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var bi=oi,xi=ci,Si=fi,Ci=mi,wi=bi,Ti=xi,Ei=Y.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...i},a)=>(0,X.jsx)(Ci,{ref:a,align:t,sideOffset:n,className:r(`z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i}));Ei.displayName=Ci.displayName;var Di={diagram:[`table`,`relationship`],flowchart:[`shape`]},Oi={table:`Table`,relationship:`Relationship`,shape:`Shape`},ki=`file-comment-open-request`,Ai=(0,Y.createContext)(null),ji=e=>`${e.type}:${e.id}`;function Mi(e){let t=e.nextCursor;return{hasMore:e.hasMore===!0,nextCursor:t?.createdAt&&t.id?{createdAt:String(t.createdAt),id:String(t.id)}:null}}function Ni(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,e);return[...n.values()].sort((e,t)=>Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.id.localeCompare(t.id))}function Pi(e,t,n,r){if(r?.size===0)return{...n,messages:t};let i=r?e.messages.filter(e=>r.has(e.threadId)):e.messages,a=Ni(i,t).slice(-Math.max(50,i.length)),o=a[0],s=i.length>0&&e.hasMore||n.hasMore;return{messages:a,hasMore:s,nextCursor:s&&o?{createdAt:o.createdAt,id:o.id}:null}}function Fi(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:et(t,{addSuffix:!0})}function Ii(e,t=144){e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,t)}px`}async function Li(e,t){let n=await q(e,t),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error||`Could not load comments.`);return r}function Ri({config:e,children:t}){let n=o(),r=(0,Y.useId)(),i=`/api/projects/${encodeURIComponent(e.projectId)}/comments`,s=e.featureType??`diagram`,c=`feature_type=${s}&file_id=${encodeURIComponent(e.fileId)}`,[l,u]=(0,Y.useState)(new Map),[d,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)([]),[v,y]=(0,Y.useState)({messages:[],hasMore:!1,nextCursor:null}),b=v.messages,[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(``),[T,O]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(``),[P,F]=(0,Y.useState)(null),[I,L]=(0,Y.useState)(``),[ne,B]=(0,Y.useState)(!1),[re,ie]=(0,Y.useState)(null),ae=(0,Y.useRef)(null),V=(0,Y.useRef)(null),H=(0,Y.useRef)(0),oe=(0,Y.useRef)(0),se=(0,Y.useRef)(l);se.current=l;let ce=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{d||(ce.current=null)},[d]);let le=(0,Y.useRef)(null),ue=(0,Y.useCallback)(e=>{le.current=e},[]),U=(0,Y.useCallback)(async()=>{let e=++oe.current;try{let t=((await Li(`${i}/markers?${c}`)).markers||[]).map(e=>{let t=Number(e.messageCount??e.message_count??0),n=e.rootMessage??e.root_message;return{anchorType:e.anchorType??e.anchor_type,anchorId:String(e.anchorId??e.anchor_id),status:e.status===`resolved`?`resolved`:`open`,messageCount:t,unreadCount:Number(e.unreadCount??e.unread_count??0),replyCount:Number(e.replyCount??e.reply_count??Math.max(t-1,0)),rootMessage:n?{authorId:n.authorId==null&&n.author_id==null?void 0:String(n.authorId??n.author_id),authorName:String(n.authorName??n.author_name??`Team member`),body:String(n.body??``),createdAt:String(n.createdAt??n.created_at??``)}:null}});e===oe.current&&u(new Map(t.map(e=>[ji({type:e.anchorType,id:e.anchorId}),e])))}catch{}},[i,c]),W=(0,Y.useCallback)(async(e,t=!0,n=!1)=>{let r=++H.current;S(!1),n||(O(!0),M(``));try{let a=await Li(`${i}/anchor?${c}&anchor_type=${e.type}&anchor_id=${encodeURIComponent(e.id)}`);if(r!==H.current)return;let o=(a.threads||[]).map(e=>({id:String(e.id),status:e.status===`resolved`?`resolved`:`open`,createdBy:String(e.createdBy??e.created_by??``)})),s=(a.messages||[]).map(e=>({id:String(e.id),threadId:String(e.threadId??e.thread_id),authorId:String(e.authorId??e.author_id),authorName:String(e.authorName??e.author_name??`Team member`),body:String(e.body),createdAt:String(e.createdAt??e.created_at)}));_(o);let l=Mi(a),u=new Set(o.map(e=>e.id));y(e=>n&&o.length?Pi(e,s,l,u):{...l,messages:s}),n&&o.length||(F(null),L(``),B(!1)),t&&o.length&&(await Promise.all(o.map(e=>Li(`${i}/${encodeURIComponent(e.id)}/read?${c}`,{method:`POST`}))),r===H.current&&await U())}catch{!n&&r===H.current&&M(`Could not load comments. Try again.`)}finally{r===H.current&&O(!1)}},[i,c,U]),fe=(0,Y.useCallback)(async()=>{let e=v.nextCursor;if(!d||!e||!v.hasMore||x)return;let t=++H.current,n=new URLSearchParams({before_created_at:e.createdAt,before_id:e.id});S(!0),M(``);try{let e=await Li(`${i}/anchor?${c}&anchor_type=${d.type}&anchor_id=${encodeURIComponent(d.id)}&${n}`);if(t!==H.current)return;let r=(e.messages||[]).map(e=>({id:String(e.id),threadId:String(e.threadId??e.thread_id),authorId:String(e.authorId??e.author_id),authorName:String(e.authorName??e.author_name??`Team member`),body:String(e.body),createdAt:String(e.createdAt??e.created_at)})),a=Mi(e);y(e=>({...a,messages:Ni(e.messages,r)}))}catch(e){t===H.current&&M(e instanceof Error?e.message:`Could not load earlier comments.`)}finally{t===H.current&&S(!1)}},[d,i,x,v,c]),G=(0,Y.useCallback)(e=>{ce.current=e,p(e),h(null),w(``),_([]),y({messages:[],hasMore:!1,nextCursor:null}),F(null),L(``),B(!1);let t=se.current.has(ji(e))?null:le.current;t?(H.current++,O(!0),M(``),Promise.resolve().then(()=>t(e)).catch(()=>{}).then(()=>{ce.current===e&&W(e)})):W(e)},[W]),pe=C.trim()!==``||P!==null&&I!==(b.find(e=>e.id===P)?.body??``),q=(0,Y.useRef)({hasUnsent:!1,active:null});q.current={hasUnsent:pe,active:d};let _e=(0,Y.useCallback)(e=>{let{hasUnsent:t,active:n}=q.current;t&&n?(n.type!==e.type||n.id!==e.id)&&ie({anchor:e}):G(e)},[G]);(0,Y.useEffect)(()=>{U();let t=()=>{U(),d&&document.visibilityState===`visible`&&W(d,!1,!0)},n=n=>{let r=n.detail;r?.teamId&&String(r.teamId)!==e.teamId||r?.projectId&&String(r.projectId)!==e.projectId||t()},r=n=>{let r=n.detail;r?.teamId===e.teamId&&r.eventType===`cloud.workspace.sync`&&t()},i=n=>{n.detail?.teamId===e.teamId&&t()},a=e=>{let t=e.detail;t&&Di[s].includes(t.type)&&t.id&&_e(t)};window.addEventListener(`collaboration-updated`,n),window.addEventListener(`cloud-workspace-sync`,r),window.addEventListener(`cloud-live-sync-reconnected`,i),window.addEventListener(ki,a);let o=window.setInterval(()=>{document.visibilityState===`visible`&&t()},15e3);return()=>{window.removeEventListener(`collaboration-updated`,n),window.removeEventListener(`cloud-workspace-sync`,r),window.removeEventListener(`cloud-live-sync-reconnected`,i),window.removeEventListener(ki,a),window.clearInterval(o)}},[d,e.projectId,e.teamId,s,W,U,_e]);let J=g[0]??null,be=d?l.get(ji(d)):void 0,xe=J?.status===`resolved`||!J&&be?.status===`resolved`;(0,Y.useEffect)(()=>{P&&V.current&&(Ii(V.current),V.current.focus(),V.current.setSelectionRange(V.current.value.length,V.current.value.length))},[P]),(0,Y.useEffect)(()=>{if(!d||!m||T||xe)return;let e=window.setTimeout(()=>ae.current?.focus(),80);return()=>window.clearTimeout(e)},[d,m,T,xe]);let Se=()=>window.dispatchEvent(new CustomEvent(`collaboration-updated`,{detail:{teamId:e.teamId,projectId:e.projectId}})),we=t=>{t.authorId===e.userId&&(F(t.id),L(t.body),M(``))},Te=async e=>{e.preventDefault();let t=b.find(e=>e.id===P),n=I.trim();if(t&&n&&!k){A(!0),M(``);try{await Li(`${i}/${encodeURIComponent(t.threadId)}/messages/${encodeURIComponent(t.id)}?${c}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n,expectedBody:t.body})}),y(e=>({...e,messages:e.messages.map(e=>e.id===t.id?{...e,body:n}:e)})),F(null),L(``),d&&await W(d,!1,!0),Se()}catch(e){d&&await W(d,!1,!0),M(e instanceof Error?e.message:`Could not edit comment.`)}finally{A(!1)}}},Ee=async()=>{if(!d||!J||k)return;A(!0),M(``);let e=J.status;try{let t=e===`open`?`resolved`:`open`;await Li(`${i}/${encodeURIComponent(J.id)}?${c}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t,expectedStatus:e})}),_(e=>e.map(e=>e.id===J.id?{...e,status:t}:e)),u(e=>{let n=ji(d),r=e.get(n);if(!r)return e;let i=new Map(e);return i.set(n,{...r,status:t}),i}),await W(d,!1,!0),Se()}catch(e){d&&await W(d,!1,!0),M(e instanceof Error?e.message:`Could not update thread.`)}finally{A(!1)}},De=async()=>{if(d&&J&&!k){A(!0),M(``);try{await Li(`${i}/${encodeURIComponent(J.id)}?${c}`,{method:`DELETE`}),B(!1),p(null),h(null),H.current++,_([]),y({messages:[],hasMore:!1,nextCursor:null}),await U(),Se()}catch(e){M(e instanceof Error?e.message:`Could not delete thread.`)}finally{A(!1)}}},Oe=async t=>{t.preventDefault();let n=C.trim();if(!(!d||!n||T||xe||k)){A(!0),M(``);try{let t=J?.status===`open`?J:null;t?await Li(`${i}/${encodeURIComponent(t.id)}/messages?${c}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n})}):await Li(`${i}?${c}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:n,context:{type:d.type,id:d.id,featureType:s,fileId:e.fileId}})}),w(``),ae.current&&(ae.current.style.height=``),await W(d,!0,!0),Se()}catch(e){M(e instanceof Error?e.message:`Could not send comment.`),a.error(`Could not send comment.`)}finally{A(!1)}}},ke=(0,Y.useMemo)(()=>({markers:l,active:d,open:_e,setAnchorElement:h,setPrepareAnchor:ue}),[l,d,_e,ue]);return(0,X.jsxs)(Ai.Provider,{value:ke,children:[t,(0,X.jsx)(D,{open:!!d&&!!m,onOpenChange:(e,t)=>{let r=t.event?.target;!e&&n&&t.reason===`outside-press`&&r instanceof Element&&!n.host.current?.contains(r)||(e||!ne&&!re)&&(!e&&pe?ie({anchor:null}):e||(p(null),h(null),H.current++))},children:(0,X.jsxs)(E,{anchor:m,side:`right`,align:`start`,sideOffset:12,className:`z-200 flex max-h-[min(380px,70vh)] w-[min(300px,calc(100vw-24px))] flex-col gap-0 overflow-hidden p-0`,"aria-label":`Comments`,children:[J&&(0,X.jsx)(`div`,{className:`absolute right-1.5 top-1.5 z-10`,children:(0,X.jsxs)(te,{children:[(0,X.jsx)(N,{render:(0,X.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`size-5`,"aria-label":`Comment thread actions`,children:(0,X.jsx)(me,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsxs)(R,{align:`end`,className:`w-48`,positionerClassName:`z-[210]`,children:[(0,X.jsxs)(ee,{onClick:()=>void Ee(),disabled:k,children:[J.status===`open`?(0,X.jsx)(ye,{"aria-hidden":`true`}):(0,X.jsx)(Ce,{"aria-hidden":`true`}),J.status===`open`?`Resolve Thread`:`Reopen Thread`]}),J.createdBy===e.userId&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{}),(0,X.jsxs)(ee,{variant:`destructive`,onClick:()=>B(!0),disabled:k,children:[(0,X.jsx)(ge,{"aria-hidden":`true`}),`Delete Thread`]})]})]})]})}),(T||b.length>0)&&(0,X.jsx)(Bt,{defaultScrollPosition:`end`,children:(0,X.jsx)(Vt,{className:`flex-1`,children:(0,X.jsx)(Ht,{"aria-label":`Comment history`,className:`px-2 py-2`,children:(0,X.jsxs)(Ut,{className:`gap-2`,children:[T&&b.length===0?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading…`}):null,v.hasMore&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(f,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>void fe(),disabled:x,children:x?`Loading…`:`Load earlier comments`})}),(0,X.jsx)(`div`,{className:`space-y-2.5`,children:b.map((t,n)=>(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(ln,{name:t.authorName,className:`size-5 text-[10px]`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2${n===0&&J?` pr-6`:``}`,children:[(0,X.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:t.authorName}),(0,X.jsx)(`time`,{className:`shrink-0 text-[11px] text-muted-foreground`,dateTime:t.createdAt,title:Fi(t.createdAt),children:un(t.createdAt)}),t.authorId===e.userId&&P!==t.id&&(0,X.jsx)(`button`,{type:`button`,className:`shrink-0 text-[11px] text-muted-foreground hover:text-foreground hover:underline`,onClick:()=>we(t),children:`Edit`})]}),P===t.id?(0,X.jsxs)(`form`,{onSubmit:Te,className:`mt-1 flex items-end gap-1 rounded-md border bg-background px-2 py-1 focus-within:border-ring`,children:[(0,X.jsx)(`textarea`,{"data-comment-draft":!0,ref:V,rows:1,maxLength:4e3,value:I,onChange:e=>{L(e.target.value),Ii(e.target)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},className:`min-w-0 max-h-[120px] min-h-5 flex-1 resize-none bg-transparent text-xs outline-none`,"aria-label":`Edit comment`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Cancel edit`,disabled:k,onClick:()=>{F(null),L(``)},className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground hover:text-foreground disabled:opacity-40`,children:(0,X.jsx)(he,{"aria-hidden":`true`,className:`size-3`})}),(0,X.jsx)(`button`,{type:`submit`,"aria-label":`Save comment`,disabled:!I.trim()||k,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-sky-500 text-white disabled:opacity-40`,children:(0,X.jsx)(de,{"aria-hidden":`true`,className:`size-3`})})]}):(0,X.jsx)(`p`,{className:`whitespace-pre-wrap wrap-break-word text-xs leading-snug`,children:t.body})]})]},t.id))})]})})})},d?ji(d):`comment-history`),(0,X.jsxs)(`form`,{onSubmit:Oe,className:`mx-2 mb-2 flex shrink-0 items-end gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring ${T||b.length>0?`mt-0`:`mt-2`}`,children:[(0,X.jsx)(`label`,{className:`sr-only`,htmlFor:r,children:`Write a comment`}),(0,X.jsx)(`textarea`,{"data-comment-draft":!0,ref:ae,id:r,rows:1,maxLength:4e3,value:C,disabled:T||xe||k,onChange:e=>{w(e.target.value),Ii(e.target)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:xe?`Reopen thread to comment…`:b.length?`Reply…`:`Add a comment…`,className:`min-w-0 max-h-[120px] min-h-5 flex-1 resize-none bg-transparent text-xs outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60`}),(0,X.jsx)(`button`,{type:`submit`,"aria-label":`Send comment`,disabled:!C.trim()||T||xe||k,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-sky-500 text-white disabled:opacity-40`,children:(0,X.jsx)(ve,{"aria-hidden":`true`,className:`size-3`})})]}),j?(0,X.jsx)(`p`,{role:`alert`,className:`px-3 pb-2 text-xs text-destructive`,children:j}):null]})}),(0,X.jsx)(K,{isOpen:re!==null,title:`Discard unsent comment?`,message:`You have text that hasn't been sent or saved. If you leave now, it will be lost.`,confirmText:`Discard`,cancelText:`Cancel`,variant:`warning`,onCancel:()=>{ie(null),window.setTimeout(()=>(P?V:ae).current?.focus(),150)},onConfirm:()=>{let e=re?.anchor??null;ie(null),w(``),F(null),L(``),e?G(e):(p(null),h(null),H.current++)}}),(0,X.jsx)(K,{isOpen:ne,title:`Delete thread?`,message:`This permanently deletes the thread and all of its comments.`,confirmText:`Delete Thread`,cancelText:`Cancel`,variant:`danger`,onCancel:()=>B(!1),onConfirm:()=>{De()}})]})}function zi(){return(0,Y.useContext)(Ai)}function Bi({prepare:e}){let t=zi()?.setPrepareAnchor,n=(0,Y.useRef)(e);return n.current=e,(0,Y.useEffect)(()=>(t?.(e=>n.current(e)),()=>t?.(null)),[t]),null}function Vi({anchor:e}){let t=zi(),n=(0,Y.useRef)(null),r=t?.markers.get(ji(e)),i=t?.active?.type===e.type&&t.active.id===e.id;if((0,Y.useLayoutEffect)(()=>{i&&t?.setAnchorElement(n.current)},[i,t]),!t||!r&&!i)return null;let a=r?.unreadCount||0,o=r?.status===`resolved`;return(0,X.jsxs)(wi,{openDelay:180,closeDelay:100,children:[(0,X.jsx)(Ti,{asChild:!0,children:(0,X.jsx)(`button`,{ref:n,type:`button`,className:`nodrag nopan flex h-4 min-w-4 items-center justify-center rounded-full border-0 px-1 text-[9px] font-bold leading-none shadow-sm focus-visible:outline-2 focus-visible:outline-offset-2 ${o?`bg-foreground text-background hover:opacity-80 focus-visible:outline-foreground`:`bg-sky-500 text-white hover:bg-sky-600 focus-visible:outline-sky-500 dark:bg-sky-400 dark:text-slate-950 dark:hover:bg-sky-300`}`,"aria-label":`${Oi[e.type]} comments${o?`, resolved`:a?`, ${a} unread`:``}`,onPointerDown:e=>e.stopPropagation(),onClick:n=>{n.stopPropagation(),t.open(e)},children:o?(0,X.jsx)(de,{"aria-hidden":`true`,className:`size-2.5 stroke-[3]`}):a>0?a>3?`3+`:a:(0,X.jsx)(`span`,{className:`sr-only`,children:`Comments`})})}),!i&&r?.rootMessage&&(0,X.jsx)(Si,{children:(0,X.jsx)(Ei,{side:`right`,sideOffset:8,className:`w-[min(18rem,calc(100vw-1rem))] p-2.5`,"aria-label":`Comment preview`,children:(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(ln,{name:r.rootMessage.authorName,className:`size-5 text-[10px]`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:r.rootMessage.authorName}),r.rootMessage.createdAt?(0,X.jsx)(`time`,{className:`shrink-0 text-[11px] text-muted-foreground`,dateTime:r.rootMessage.createdAt,title:Fi(r.rootMessage.createdAt),children:un(r.rootMessage.createdAt)}):null]}),(0,X.jsx)(`p`,{className:`line-clamp-3 break-words text-xs leading-snug`,children:r.rootMessage.body}),r.replyCount>0?(0,X.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[r.replyCount,` `,r.replyCount===1?`reply`:`replies`]}):null]})]})})})]})}export{Wt as $,Bn as A,mn as B,Gn as C,xe as Ct,Nn as D,J as Dt,$ as E,ve as Et,Sn as F,dn as G,kn as H,Tn as I,Qt as J,un as K,xn as L,zn as M,Rn as N,Fn as O,Pn as P,Ut as Q,wn as R,Xn as S,Se as St,Vn as T,ye as Tt,On as U,Cn as V,ln as W,Vt as X,on as Y,Gt as Z,cr as _,Te as _t,zi as a,at,Zn as b,Oe as bt,Ti as c,Qe as ct,Nr as d,Le as dt,Bt as et,kr as f,Ie as ft,fr as g,je as gt,Or as h,Me as ht,Bi as i,rt as it,Ln as j,In as k,Kr as l,ze as lt,Ar as m,Pe as mt,Ri as n,It as nt,wi as o,ot,jr as p,Fe as pt,Yt as q,ki as r,it as rt,Ei as s,et as st,Vi as t,Ht as tt,Fr as u,Re as ut,rr as v,we as vt,Un as w,be as wt,Yn as x,Ce as xt,ir as y,ke as yt,En as z};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{a as r,n as i}from"./dist-B2tJVU7c.js";import{d as a,u as o}from"./chunk-BV7QT456-B3UxAK3W.js";import{$ as s,Q as c,X as l,at as u,ct as d,ht as f,lt as ee,ot as te,pt as p,r as ne,st as m,tt as re}from"./note-importer-NZUWzjz4.js";import{t as h}from"./button-BoRKNt3a.js";import{f as ie,l as ae,o as oe,s as se,u as ce}from"./popover-CeOegac2.js";import{Y as le,at as ue,i as de,n as g,wt as fe}from"./ERDComments-BgnRJ-nP.js";import{i as _,n as v,o as y,r as pe,s as b,t as x}from"./select-pQS-1nhx.js";import{t as me}from"./ConfirmModal-DJuZVQTe.js";import{n as he,t as ge}from"./move-B7unHbzE.js";import{n as _e,t as ve}from"./redo-2-pHmjKxwl.js";import{a as S,d as ye,i as C,l as w,n as T,o as E,s as D,t as O}from"./dialog-C2aDTmOl.js";import{t as k}from"./trash-2-DPFpHyly.js";import{t as be}from"./undo-2-Lua5EZG-.js";import{t as A}from"./input-D_eLLMB7.js";import{F as j,I as xe,L as Se,M,N,P,j as Ce,m as we}from"./WorkspaceProvider-B9rJwzKp.js";import{n as Te}from"./WorkspaceContext-CitlpD55.js";import{t as F}from"./label-CNlirj1C.js";import{C as Ee,F as I,Qt as De,S as Oe,_ as ke,at as Ae,b as je,ct as Me,d as L,f as Ne,g as Pe,h as Fe,m as Ie,p as Le,v as Re,x as ze,y as Be}from"./index-Dj_OkW0L.js";import{t as Ve}from"./JumpToNode-ImB9k7b-.js";var R=e(t(),1);function He(e,t,n){let r=l();(0,R.useEffect)(()=>{if(!e)return;let i=e=>{!r()||e.defaultPrevented||e.isComposing||e.altKey||(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`z`&&(e.target?.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"]), .cm-editor, [data-keyboard-trap], [role="dialog"], [role="alertdialog"], [role="listbox"], [role="menu"]`)||(e.preventDefault(),e.stopPropagation(),e.shiftKey?n():t()))};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[e,r,t,n])}var z=n();function Ue({shape:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.75,strokeLinejoin:`round`};return(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`size-4 shrink-0`,viewBox:`0 0 24 24`,children:[e===`diamond`&&(0,z.jsx)(`path`,{...t,d:`m12 3 8 9-8 9-8-9z`}),e===`parallelogram`&&(0,z.jsx)(`path`,{...t,d:`m7 4h14l-4 16H3z`}),e===`oval`&&(0,z.jsx)(`rect`,{...t,x:`3`,y:`6`,width:`18`,height:`12`,rx:`6`}),e===`circle`&&(0,z.jsx)(`circle`,{...t,cx:`12`,cy:`12`,r:`8`}),e===`database`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{...t,d:`M4 6v12c0 3 16 3 16 0V6`}),(0,z.jsx)(`ellipse`,{...t,cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,z.jsx)(`path`,{...t,d:`M4 12c0 3 16 3 16 0`})]}),e===`document`&&(0,z.jsx)(`path`,{...t,d:`M5 3h9l5 5v13H5zM14 3v5h5`}),e===`cloud`&&(0,z.jsx)(`path`,{...t,d:`M6 18h11a4 4 0 0 0 .7-7.9A5.5 5.5 0 0 0 7 8.5 4.5 4.5 0 0 0 6 18Z`}),e===`rectangle`&&(0,z.jsx)(`rect`,{...t,x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`})]})}var We=e=>e.trim().toLowerCase().includes(`start`);function Ge({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=We(n.label);return(0,z.jsx)(O,{open:e,onOpenChange:t,children:(0,z.jsxs)(C,{className:`sm:max-w-md`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(w,{children:`Create New Symbol`}),(0,z.jsx)(S,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,z.jsxs)(T,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(A,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(A,{value:n.section||``,onChange:e=>r({...n,section:e.target.value||void 0}),placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(x,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select a shape`,children:n.shape?j[n.shape]:`Select a shape`})}),(0,z.jsx)(v,{className:`bg-popover border-border text-popover-foreground`,children:Object.entries(j).map(([e,t])=>(0,z.jsxs)(_,{value:e,children:[(0,z.jsx)(Ue,{shape:e}),t]},e))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:N.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.color===e?`border-ring scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({...n,color:e}),"aria-label":`Set symbol color to ${e}`},e))})]})]}),(0,z.jsxs)(E,{children:[(0,z.jsx)(h,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,z.jsx)(h,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function Ke(e){return e.data.label.trim().toLowerCase().includes(`start`)}function qe({selectedNodeId:e,onClose:t,selectedNode:n,onUpdateNodeData:r,onDeleteNode:i,onDeleteGroup:a,onValidateSection:o}){let s=n?Ke(n):!1,[c,l]=(0,R.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),u=e=>{l(e),r({code:e})};return(0,z.jsx)(O,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(C,{className:`sm:max-w-md`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(w,{children:`Symbol Properties`}),(0,z.jsx)(S,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,z.jsxs)(T,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(A,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>u(e.target.value),placeholder:n.data.shape===`diamond`?`e.g. return context.amount > 100 ? 'Yes' : 'No';`:`e.g. context.status = 'Approved'; context.tries += 1;`,className:`w-full h-24 bg-muted border border-border rounded-md p-2 text-xs font-mono text-foreground placeholder:text-muted-foreground/50 resize-none focus:outline-none focus:border-ring`}),(0,z.jsxs)(`p`,{className:`text-[9px] text-muted-foreground/50 leading-normal`,children:[`Attached sandbox logic. For Decision diamonds, return the matching branch label (case-sensitive). Process symbols can mutate variables in the `,(0,z.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(A,{value:n.data.section||``,onChange:e=>r({section:e.target.value||void 0}),onBlur:e=>{let t=e.target.value;t&&o&&!o(t)&&r({section:void 0})},placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted/50 border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(x,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select a shape`,children:n.data.shape?j[n.data.shape]:`Select a shape`})}),(0,z.jsx)(v,{className:`bg-popover border-border text-popover-foreground`,children:Object.entries(j).map(([e,t])=>(0,z.jsxs)(_,{value:e,children:[(0,z.jsx)(Ue,{shape:e}),t]},e))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:N.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.data.color===e?`border-ring scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({color:e}),"aria-label":`Set symbol color to ${e}`},e))})]}),(0,z.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,z.jsxs)(h,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,z.jsx)(k,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,z.jsxs)(h,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,z.jsx)(k,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Je({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:i,onEdgeTypeChange:a,onArrowChange:o,onLabelChange:s,onDeleteEdge:c}){return(0,z.jsx)(O,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,z.jsx)(D,{children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,z.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,z.jsx)(w,{children:`Connector Properties`}),(0,z.jsx)(S,{children:`Format the line style and arrows.`})]}),(0,z.jsx)(h,{variant:`ghost`,size:`icon`,onClick:c,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,"aria-label":`Delete Connector`,children:(0,z.jsx)(k,{className:`w-4 h-4`})})]})}),n&&(0,z.jsxs)(T,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Text Label`}),(0,z.jsx)(A,{value:typeof n.label==`string`?n.label:``,onChange:e=>s(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Line Style`}),(0,z.jsxs)(x,{value:r?`dashed`:`solid`,onValueChange:e=>a(e||``),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select line style`,children:P[r?`dashed`:`solid`]})}),(0,z.jsxs)(v,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(_,{value:`solid`,children:`Solid Line`}),(0,z.jsx)(_,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Arrow Style`}),(0,z.jsxs)(x,{value:i,onValueChange:e=>o(e||``),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select arrow style`,children:M[i]})}),(0,z.jsxs)(v,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(_,{value:`end`,children:`Arrow at End`}),(0,z.jsx)(_,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,z.jsx)(_,{value:`both`,children:`Arrows Both Ends`}),(0,z.jsx)(_,{value:`none`,children:`No Arrows (Line only)`})]})]})]})]})]})})}function Ye({nodes:e,edges:t,onConfirm:n,onCancel:r,confirmLabel:i=`Confirm Append`,mode:a=`append`,canvasGroups:o=[],existingNodes:s=[],existingEdges:c=[]}){let[l,u]=(0,R.useState)(``),[d]=(0,R.useState)(()=>({nodes:s,edges:c})),f=(0,R.useMemo)(()=>{let n={nodes:e,edges:t};return a===`append`?ze(d,n):a===`replace`&&l?Oe(d,n,l):n},[d,e,t,a,l]);return(0,z.jsx)(O,{open:!0,onOpenChange:e=>{e||r()},children:(0,z.jsxs)(C,{size:`4xl`,className:`max-h-[92dvh]`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(w,{children:`Preview Flowchart Changes`}),(0,z.jsx)(S,{children:`Review the shapes and connectors before applying changes. Pan and zoom to inspect each flow.`})]}),(0,z.jsxs)(T,{className:`space-y-4`,children:[(0,z.jsxs)(`div`,{className:d.nodes.length?`grid grid-cols-1 gap-4 lg:grid-cols-2`:`grid grid-cols-1`,children:[d.nodes.length>0&&(0,z.jsx)(L,{canvas:d,title:`Current canvas`}),(0,z.jsx)(L,{canvas:f,title:`After applying AI`},l)]}),(0,z.jsx)(Ne,{before:d,after:f})]}),(0,z.jsxs)(E,{className:`flex-wrap gap-3`,children:[a===`replace`&&o.length>0&&(0,z.jsxs)(x,{value:l,onValueChange:e=>u(e??``),children:[(0,z.jsx)(y,{className:`mr-auto w-52`,"aria-label":`Replacement scope`,children:(0,z.jsx)(b,{children:l||`All symbols`})}),(0,z.jsxs)(v,{children:[(0,z.jsx)(_,{value:``,children:`All symbols`}),o.map(e=>(0,z.jsx)(_,{value:e,children:e},e))]})]}),(0,z.jsx)(h,{variant:`outline`,onClick:r,children:`Cancel`}),(0,z.jsx)(h,{onClick:()=>n(f),children:l?`Replace Group`:i})]})]})})}function B(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 V(e,t){return B(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function Xe(e,t){let n=[`top`,`bottom`,`left`,`right`],r=B(e.position),i=B(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 Ze(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 Qe(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-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{a as r,n as i}from"./dist-B2tJVU7c.js";import{d as a,u as o}from"./chunk-BV7QT456-B3UxAK3W.js";import{$ as s,Q as c,X as l,at as u,ct as d,ht as f,lt as ee,ot as te,pt as p,r as ne,st as m,tt as re}from"./note-importer-Cxdf3khP.js";import{t as h}from"./button-BoRKNt3a.js";import{f as ie,l as ae,o as oe,s as se,u as ce}from"./popover-l5FGEnVW.js";import{Y as le,at as ue,i as de,n as g,wt as fe}from"./ERDComments-DRgQCzYK.js";import{i as _,n as v,o as y,r as pe,s as b,t as x}from"./select-pQS-1nhx.js";import{t as me}from"./ConfirmModal-DJuZVQTe.js";import{n as he,t as ge}from"./move-B7unHbzE.js";import{n as _e,t as ve}from"./redo-2-pHmjKxwl.js";import{a as S,d as ye,i as C,l as w,n as T,o as E,s as D,t as O}from"./dialog-C2aDTmOl.js";import{t as k}from"./trash-2-DPFpHyly.js";import{t as be}from"./undo-2-Lua5EZG-.js";import{t as A}from"./input-D_eLLMB7.js";import{F as j,I as M,L as xe,N,P,R as Se,j as Ce,m as we}from"./WorkspaceProvider-BAyO6Rw9.js";import{n as Te}from"./WorkspaceContext-CitlpD55.js";import{t as F}from"./label-CNlirj1C.js";import{C as Ee,F as I,Qt as De,S as Oe,_ as ke,at as Ae,b as je,ct as Me,d as L,f as Ne,g as Pe,h as Fe,m as Ie,p as Le,v as Re,x as ze,y as Be}from"./index-CPxZ4xhG.js";import{t as Ve}from"./JumpToNode-B-2fNnUQ.js";var R=e(t(),1);function He(e,t,n){let r=l();(0,R.useEffect)(()=>{if(!e)return;let i=e=>{!r()||e.defaultPrevented||e.isComposing||e.altKey||(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`z`&&(e.target?.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"]), .cm-editor, [data-keyboard-trap], [role="dialog"], [role="alertdialog"], [role="listbox"], [role="menu"]`)||(e.preventDefault(),e.stopPropagation(),e.shiftKey?n():t()))};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[e,r,t,n])}var z=n();function Ue({shape:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.75,strokeLinejoin:`round`};return(0,z.jsxs)(`svg`,{"aria-hidden":`true`,className:`size-4 shrink-0`,viewBox:`0 0 24 24`,children:[e===`diamond`&&(0,z.jsx)(`path`,{...t,d:`m12 3 8 9-8 9-8-9z`}),e===`parallelogram`&&(0,z.jsx)(`path`,{...t,d:`m7 4h14l-4 16H3z`}),e===`oval`&&(0,z.jsx)(`rect`,{...t,x:`3`,y:`6`,width:`18`,height:`12`,rx:`6`}),e===`circle`&&(0,z.jsx)(`circle`,{...t,cx:`12`,cy:`12`,r:`8`}),e===`database`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`path`,{...t,d:`M4 6v12c0 3 16 3 16 0V6`}),(0,z.jsx)(`ellipse`,{...t,cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,z.jsx)(`path`,{...t,d:`M4 12c0 3 16 3 16 0`})]}),e===`document`&&(0,z.jsx)(`path`,{...t,d:`M5 3h9l5 5v13H5zM14 3v5h5`}),e===`cloud`&&(0,z.jsx)(`path`,{...t,d:`M6 18h11a4 4 0 0 0 .7-7.9A5.5 5.5 0 0 0 7 8.5 4.5 4.5 0 0 0 6 18Z`}),e===`rectangle`&&(0,z.jsx)(`rect`,{...t,x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`})]})}var We=e=>e.trim().toLowerCase().includes(`start`);function Ge({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=We(n.label);return(0,z.jsx)(O,{open:e,onOpenChange:t,children:(0,z.jsxs)(C,{className:`sm:max-w-md`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(w,{children:`Create New Symbol`}),(0,z.jsx)(S,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,z.jsxs)(T,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(A,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(A,{value:n.section||``,onChange:e=>r({...n,section:e.target.value||void 0}),placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(x,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select a shape`,children:n.shape?M[n.shape]:`Select a shape`})}),(0,z.jsx)(v,{className:`bg-popover border-border text-popover-foreground`,children:Object.entries(M).map(([e,t])=>(0,z.jsxs)(_,{value:e,children:[(0,z.jsx)(Ue,{shape:e}),t]},e))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:P.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.color===e?`border-ring scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({...n,color:e}),"aria-label":`Set symbol color to ${e}`},e))})]})]}),(0,z.jsxs)(E,{children:[(0,z.jsx)(h,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,z.jsx)(h,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function Ke(e){return e.data.label.trim().toLowerCase().includes(`start`)}function qe({selectedNodeId:e,onClose:t,selectedNode:n,onUpdateNodeData:r,onDeleteNode:i,onDeleteGroup:a,onValidateSection:o}){let s=n?Ke(n):!1,[c,l]=(0,R.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),u=e=>{l(e),r({code:e})};return(0,z.jsx)(O,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(C,{className:`sm:max-w-md`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(w,{children:`Symbol Properties`}),(0,z.jsx)(S,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,z.jsxs)(T,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Label`}),(0,z.jsx)(A,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>u(e.target.value),placeholder:n.data.shape===`diamond`?`e.g. return context.amount > 100 ? 'Yes' : 'No';`:`e.g. context.status = 'Approved'; context.tries += 1;`,className:`w-full h-24 bg-muted border border-border rounded-md p-2 text-xs font-mono text-foreground placeholder:text-muted-foreground/50 resize-none focus:outline-none focus:border-ring`}),(0,z.jsxs)(`p`,{className:`text-[9px] text-muted-foreground/50 leading-normal`,children:[`Attached sandbox logic. For Decision diamonds, return the matching branch label (case-sensitive). Process symbols can mutate variables in the `,(0,z.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Group Title`}),(0,z.jsx)(A,{value:n.data.section||``,onChange:e=>r({section:e.target.value||void 0}),onBlur:e=>{let t=e.target.value;t&&o&&!o(t)&&r({section:void 0})},placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted/50 border-border text-foreground`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Shape Type`}),(0,z.jsxs)(x,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select a shape`,children:n.data.shape?M[n.data.shape]:`Select a shape`})}),(0,z.jsx)(v,{className:`bg-popover border-border text-popover-foreground`,children:Object.entries(M).map(([e,t])=>(0,z.jsxs)(_,{value:e,children:[(0,z.jsx)(Ue,{shape:e}),t]},e))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Color`}),(0,z.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:P.map(e=>(0,z.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.data.color===e?`border-ring scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({color:e}),"aria-label":`Set symbol color to ${e}`},e))})]}),(0,z.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,z.jsxs)(h,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,z.jsx)(k,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,z.jsxs)(h,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,z.jsx)(k,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function Je({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:i,onEdgeTypeChange:a,onArrowChange:o,onLabelChange:s,onDeleteEdge:c}){return(0,z.jsx)(O,{open:!!e,onOpenChange:e=>{e||t()},children:(0,z.jsxs)(C,{className:`sm:max-w-sm`,children:[(0,z.jsx)(D,{children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,z.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,z.jsx)(w,{children:`Connector Properties`}),(0,z.jsx)(S,{children:`Format the line style and arrows.`})]}),(0,z.jsx)(h,{variant:`ghost`,size:`icon`,onClick:c,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,"aria-label":`Delete Connector`,children:(0,z.jsx)(k,{className:`w-4 h-4`})})]})}),n&&(0,z.jsxs)(T,{className:`space-y-6`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Text Label`}),(0,z.jsx)(A,{value:typeof n.label==`string`?n.label:``,onChange:e=>s(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Line Style`}),(0,z.jsxs)(x,{value:r?`dashed`:`solid`,onValueChange:e=>a(e||``),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select line style`,children:j[r?`dashed`:`solid`]})}),(0,z.jsxs)(v,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(_,{value:`solid`,children:`Solid Line`}),(0,z.jsx)(_,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(F,{children:`Arrow Style`}),(0,z.jsxs)(x,{value:i,onValueChange:e=>o(e||``),children:[(0,z.jsx)(y,{className:`w-full bg-muted border-border text-foreground`,children:(0,z.jsx)(b,{placeholder:`Select arrow style`,children:N[i]})}),(0,z.jsxs)(v,{className:`bg-popover border-border text-popover-foreground`,children:[(0,z.jsx)(_,{value:`end`,children:`Arrow at End`}),(0,z.jsx)(_,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,z.jsx)(_,{value:`both`,children:`Arrows Both Ends`}),(0,z.jsx)(_,{value:`none`,children:`No Arrows (Line only)`})]})]})]})]})]})})}function Ye({nodes:e,edges:t,onConfirm:n,onCancel:r,confirmLabel:i=`Confirm Append`,mode:a=`append`,canvasGroups:o=[],existingNodes:s=[],existingEdges:c=[]}){let[l,u]=(0,R.useState)(``),[d]=(0,R.useState)(()=>({nodes:s,edges:c})),f=(0,R.useMemo)(()=>{let n={nodes:e,edges:t};return a===`append`?ze(d,n):a===`replace`&&l?Oe(d,n,l):n},[d,e,t,a,l]);return(0,z.jsx)(O,{open:!0,onOpenChange:e=>{e||r()},children:(0,z.jsxs)(C,{size:`4xl`,className:`max-h-[92dvh]`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(w,{children:`Preview Flowchart Changes`}),(0,z.jsx)(S,{children:`Review the shapes and connectors before applying changes. Pan and zoom to inspect each flow.`})]}),(0,z.jsxs)(T,{className:`space-y-4`,children:[(0,z.jsxs)(`div`,{className:d.nodes.length?`grid grid-cols-1 gap-4 lg:grid-cols-2`:`grid grid-cols-1`,children:[d.nodes.length>0&&(0,z.jsx)(L,{canvas:d,title:`Current canvas`}),(0,z.jsx)(L,{canvas:f,title:`After applying AI`},l)]}),(0,z.jsx)(Ne,{before:d,after:f})]}),(0,z.jsxs)(E,{className:`flex-wrap gap-3`,children:[a===`replace`&&o.length>0&&(0,z.jsxs)(x,{value:l,onValueChange:e=>u(e??``),children:[(0,z.jsx)(y,{className:`mr-auto w-52`,"aria-label":`Replacement scope`,children:(0,z.jsx)(b,{children:l||`All symbols`})}),(0,z.jsxs)(v,{children:[(0,z.jsx)(_,{value:``,children:`All symbols`}),o.map(e=>(0,z.jsx)(_,{value:e,children:e},e))]})]}),(0,z.jsx)(h,{variant:`outline`,onClick:r,children:`Cancel`}),(0,z.jsx)(h,{onClick:()=>n(f),children:l?`Replace Group`:i})]})]})})}function B(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 V(e,t){return B(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function Xe(e,t){let n=[`top`,`bottom`,`left`,`right`],r=B(e.position),i=B(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 Ze(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 Qe(e,t,n){switch(e){case`diamond`:return`<polygon points="80,2 158,35 80,68 2,35" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`parallelogram`:return`<polygon points="32,2 158,2 128,68 2,68" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`oval`:return`<ellipse cx="80" cy="35" rx="78" ry="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`circle`:return`<circle cx="80" cy="35" r="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`database`:return`<g>
2
2
  <path d="M2,14 L2,56 C2,68 158,68 158,56 L158,14" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />
3
3
  <ellipse cx="80" cy="14" rx="78" ry="10.5" fill="${t}30" stroke="${t}" stroke-width="2" filter="url(#shadow)" />
4
4
  <path d="M2,35 C2,45.5 158,45.5 158,35" fill="none" stroke="${t}" stroke-width="2" opacity="0.3" />
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{a as r}from"./dist-B2tJVU7c.js";import{X as i,lt as a}from"./note-importer-NZUWzjz4.js";import{t as o}from"./button-BoRKNt3a.js";import{f as s,l as c,u as l}from"./popover-CeOegac2.js";import{a as u,d,i as f,o as p,r as m,s as h,t as g}from"./dropdown-menu-rZKTxsXp.js";import{r as _}from"./getPseudoElementBounds-Dgxi_dXc.js";import{Ct as v,nt as y}from"./ERDComments-BgnRJ-nP.js";import{f as b}from"./dialog-C2aDTmOl.js";import{t as x}from"./input-D_eLLMB7.js";var S=e(t(),1);function C(e,t){let n=i(),r=typeof navigator<`u`&&/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent);return(0,S.useEffect)(()=>{if(!e)return;let i=e=>{n()&&(!(r?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)||e.key.toLowerCase()!==`f`||!e.shiftKey||e.altKey||e.isComposing||e.defaultPrevented||e.target?.closest(`.cm-editor, [role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),e.stopPropagation(),t()))};return window.addEventListener(`keydown`,i,!0),()=>window.removeEventListener(`keydown`,i,!0)},[e,r,t]),{label:r?`⇧⌘F`:`Ctrl+Shift+F`,ariaKeyShortcuts:r?`Meta+Shift+F`:`Control+Shift+F`}}var w=n();function T({nodes:e,className:t,label:n=`Symbol`,iconOnly:i=!1,findShortcut:T=!1}){let{fitView:E}=a(),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(``),j=S.useRef(null),M=C(T,S.useCallback(()=>{O(!0),j.current?.focus(),j.current?.select()},[]));S.useEffect(()=>{D&&setTimeout(()=>j.current?.focus(),100)},[D]);let N=e=>{e.stopPropagation(),e.key===`Escape`&&O(!1)},P=(0,S.useMemo)(()=>{let t=k.trim().toLowerCase();return t?e.filter(e=>{let n=e.data;return(n.name||n.label||``).toLowerCase().includes(t)}):e},[e,k]),F=e=>{O(!1),A(``),e.position.x+(e.measured?.width??200)/2,e.position.y+(e.measured?.height??100)/2,setTimeout(()=>{E({nodes:[{id:e.id}],duration:0,padding:1.5,minZoom:1.2,maxZoom:1.2})},100)},I=(0,w.jsx)(d,{render:(0,w.jsxs)(o,{variant:`outline`,size:i?`icon-lg`:`sm`,"aria-label":`Jump to ${n}`,"aria-keyshortcuts":T?M.ariaKeyShortcuts:void 0,className:r(!i&&`h-9 px-3 text-xs font-bold border-border/50 bg-muted/20 hover:bg-muted text-muted-foreground transition-all`,t),children:[(0,w.jsx)(v,{className:r(`size-3.5`,!i&&`mr-2`)}),!i&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Jump to `,n]}),(0,w.jsx)(`span`,{className:`sm:hidden`,children:`Jump`}),(0,w.jsx)(_,{className:`size-3 ml-2 opacity-50`})]})]})});return(0,w.jsxs)(g,{open:D,onOpenChange:O,children:[i?(0,w.jsxs)(c,{children:[(0,w.jsx)(s,{render:I}),(0,w.jsxs)(l,{side:`right`,className:`gap-6`,children:[(0,w.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`Jump to `,n]}),T&&(0,w.jsx)(`kbd`,{className:`ml-auto shrink-0 whitespace-nowrap font-sans text-xs tracking-widest opacity-70`,children:M.label})]})]}):I,(0,w.jsxs)(m,{align:`start`,side:i?`right`:`bottom`,className:`w-[280px] p-0 shadow-2xl border-border/50 bg-background/95 backdrop-blur-xl`,children:[(0,w.jsx)(`div`,{className:`p-3 pb-2`,onPointerDown:e=>e.stopPropagation(),children:(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(b,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground`}),(0,w.jsx)(x,{ref:j,placeholder:`Search ${n.toLowerCase()}s...`,className:`h-8 pl-8 text-xs bg-muted/50 border-none focus-visible:ring-1 focus-visible:ring-primary/50`,value:k,onChange:e=>A(e.target.value),onKeyDown:N,autoComplete:`off`})]})}),(0,w.jsx)(h,{className:`bg-border/50`}),(0,w.jsxs)(f,{children:[(0,w.jsxs)(p,{className:`px-3 pt-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/70`,children:[`Showing `,P.length,` of `,e.length,` `,n.toLowerCase(),`s`]}),(0,w.jsx)(y,{className:`h-[250px] px-1 pb-1`,children:P.length===0?(0,w.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted-foreground italic`,children:`No matching items found`}):P.map(e=>{let t=e.data,n=t.name||t.label||`Unnamed component`;return(0,w.jsxs)(u,{onClick:()=>F(e),className:`flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors focus:bg-accent focus:text-accent-foreground rounded-lg mx-1`,children:[(0,w.jsx)(`div`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:e.data.color||`#8b5cf6`}}),(0,w.jsx)(`span`,{className:`text-[13px] font-medium truncate tracking-tight`,children:n})]},e.id)})})]})]})]})}export{T as t};
1
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{a as r}from"./dist-B2tJVU7c.js";import{X as i,lt as a}from"./note-importer-Cxdf3khP.js";import{t as o}from"./button-BoRKNt3a.js";import{f as s,l as c,u as l}from"./popover-l5FGEnVW.js";import{a as u,d,i as f,o as p,r as m,s as h,t as g}from"./dropdown-menu-rZKTxsXp.js";import{r as _}from"./getPseudoElementBounds-Dgxi_dXc.js";import{Ct as v,nt as y}from"./ERDComments-DRgQCzYK.js";import{f as b}from"./dialog-C2aDTmOl.js";import{t as x}from"./input-D_eLLMB7.js";var S=e(t(),1);function C(e,t){let n=i(),r=typeof navigator<`u`&&/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent);return(0,S.useEffect)(()=>{if(!e)return;let i=e=>{n()&&(!(r?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)||e.key.toLowerCase()!==`f`||!e.shiftKey||e.altKey||e.isComposing||e.defaultPrevented||e.target?.closest(`.cm-editor, [role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),e.stopPropagation(),t()))};return window.addEventListener(`keydown`,i,!0),()=>window.removeEventListener(`keydown`,i,!0)},[e,r,t]),{label:r?`⇧⌘F`:`Ctrl+Shift+F`,ariaKeyShortcuts:r?`Meta+Shift+F`:`Control+Shift+F`}}var w=n();function T({nodes:e,className:t,label:n=`Symbol`,iconOnly:i=!1,findShortcut:T=!1}){let{fitView:E}=a(),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(``),j=S.useRef(null),M=C(T,S.useCallback(()=>{O(!0),j.current?.focus(),j.current?.select()},[]));S.useEffect(()=>{D&&setTimeout(()=>j.current?.focus(),100)},[D]);let N=e=>{e.stopPropagation(),e.key===`Escape`&&O(!1)},P=(0,S.useMemo)(()=>{let t=k.trim().toLowerCase();return t?e.filter(e=>{let n=e.data;return(n.name||n.label||``).toLowerCase().includes(t)}):e},[e,k]),F=e=>{O(!1),A(``),e.position.x+(e.measured?.width??200)/2,e.position.y+(e.measured?.height??100)/2,setTimeout(()=>{E({nodes:[{id:e.id}],duration:0,padding:1.5,minZoom:1.2,maxZoom:1.2})},100)},I=(0,w.jsx)(d,{render:(0,w.jsxs)(o,{variant:`outline`,size:i?`icon-lg`:`sm`,"aria-label":`Jump to ${n}`,"aria-keyshortcuts":T?M.ariaKeyShortcuts:void 0,className:r(!i&&`h-9 px-3 text-xs font-bold border-border/50 bg-muted/20 hover:bg-muted text-muted-foreground transition-all`,t),children:[(0,w.jsx)(v,{className:r(`size-3.5`,!i&&`mr-2`)}),!i&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Jump to `,n]}),(0,w.jsx)(`span`,{className:`sm:hidden`,children:`Jump`}),(0,w.jsx)(_,{className:`size-3 ml-2 opacity-50`})]})]})});return(0,w.jsxs)(g,{open:D,onOpenChange:O,children:[i?(0,w.jsxs)(c,{children:[(0,w.jsx)(s,{render:I}),(0,w.jsxs)(l,{side:`right`,className:`gap-6`,children:[(0,w.jsxs)(`span`,{className:`whitespace-nowrap`,children:[`Jump to `,n]}),T&&(0,w.jsx)(`kbd`,{className:`ml-auto shrink-0 whitespace-nowrap font-sans text-xs tracking-widest opacity-70`,children:M.label})]})]}):I,(0,w.jsxs)(m,{align:`start`,side:i?`right`:`bottom`,className:`w-[280px] p-0 shadow-2xl border-border/50 bg-background/95 backdrop-blur-xl`,children:[(0,w.jsx)(`div`,{className:`p-3 pb-2`,onPointerDown:e=>e.stopPropagation(),children:(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(b,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground`}),(0,w.jsx)(x,{ref:j,placeholder:`Search ${n.toLowerCase()}s...`,className:`h-8 pl-8 text-xs bg-muted/50 border-none focus-visible:ring-1 focus-visible:ring-primary/50`,value:k,onChange:e=>A(e.target.value),onKeyDown:N,autoComplete:`off`})]})}),(0,w.jsx)(h,{className:`bg-border/50`}),(0,w.jsxs)(f,{children:[(0,w.jsxs)(p,{className:`px-3 pt-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/70`,children:[`Showing `,P.length,` of `,e.length,` `,n.toLowerCase(),`s`]}),(0,w.jsx)(y,{className:`h-[250px] px-1 pb-1`,children:P.length===0?(0,w.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted-foreground italic`,children:`No matching items found`}):P.map(e=>{let t=e.data,n=t.name||t.label||`Unnamed component`;return(0,w.jsxs)(u,{onClick:()=>F(e),className:`flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors focus:bg-accent focus:text-accent-foreground rounded-lg mx-1`,children:[(0,w.jsx)(`div`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:e.data.color||`#8b5cf6`}}),(0,w.jsx)(`span`,{className:`text-[13px] font-medium truncate tracking-tight`,children:n})]},e.id)})})]})]})]})}export{T as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{n as r}from"./dist-B2tJVU7c.js";import{l as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as a}from"./button-BoRKNt3a.js";import{s as o}from"./useField-BVrxe_qk.js";import{t as s}from"./chevron-left-CB01oDjc.js";import{i as c,n as l,o as u,s as d,t as f}from"./select-pQS-1nhx.js";import{t as p}from"./ConfirmModal-DJuZVQTe.js";import{t as m}from"./file-image-B0FVtvx-.js";import{t as h}from"./refresh-cw-B1eEBXCn.js";import{t as g}from"./trash-2-DPFpHyly.js";import{t as _}from"./undo-2-Lua5EZG-.js";import{a as v,n as y}from"./api-CUfeViMG.js";import{G as b,J as x,K as S,Q as C,U as w,W as T,Z as E,nr as D,q as O}from"./index-Dj_OkW0L.js";var k=e(t(),1),A=n(),j=30,M={all:`All files`,unused:`Unused only`},N={size:`Largest first`,date:`Newest first`};function P(){let e=i(),[t,n]=(0,k.useState)(`all`),[P,F]=(0,k.useState)(`size`),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)([]),[B,V]=(0,k.useState)(!0),[H,U]=(0,k.useState)(null),[W,G]=(0,k.useState)(1),K=(0,k.useCallback)(async e=>{V(!0);try{let n=await y(`/api/library?filter=${t}&sort=${P}&page=${e}`);if(!n.ok)throw Error();let r=await n.json();if(L(r),r.items.length===0&&e>1){G(e-1);return}z(r.items)}catch{r.error(`The Library could not be loaded.`)}finally{V(!1)}},[t,P]);(0,k.useEffect)(()=>{K(W)},[K,W]);let q=async e=>{if(e.length===1){let t=await(await y(`/api/library/usage?key=${encodeURIComponent(e[0].key)}`)).json().catch(()=>({documents:[]}));if(t.documents?.length){let e=t.documents.map(e=>e.title+(e.isDeleted?` (in Trash)`:``)).join(`, `);r.error(`This image is still used by: ${e}. Remove it from those documents first.`);return}}U({items:e,message:`${e.length===1?`This image`:`${e.length} unused images`} will stop counting toward storage now and be removed for good after ${j} days. You can undo until then.`})},J=async()=>{let e=H?.items??[];U(null);let t=0;for(let n of e)(await y(`/api/library`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:n.key})})).ok||t++;t?r.error(`${t} image${t===1?` is`:`s are`} still in use and ${t===1?`was`:`were`} kept.`):r.success(e.length===1?`Image deleted`:`Unused images deleted`),K(W)},Y=async e=>{let t=await y(`/api/library/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e.key})}),n=await t.json().catch(()=>({}));t.ok?(r.success(`Image restored`),K(W)):r.error(n.error||`The image could not be restored.`)},X=I?Math.max(1,Math.ceil(I.total/I.page_size)):1,Z=R.filter(e=>e.unused&&e.status===`committed`&&e.can_delete);return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border bg-background`,children:[(0,A.jsx)(`div`,{className:`shrink-0 border-b p-6`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(a,{variant:`ghost`,size:`sm`,className:`-ml-2 mb-2`,onClick:()=>e(-1),children:[(0,A.jsx)(D,{className:`mr-1 size-4`}),` Back`]}),(0,A.jsxs)(`h2`,{className:`flex items-center gap-2 text-2xl font-bold`,children:[(0,A.jsx)(m,{className:`size-6 text-muted-foreground`}),` Library`]}),(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Files uploaded to `,I?.scope===`user`?`your Personal Workspace`:`this Team workspace by all members`,`. Unused files still count toward storage until deleted.`]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,A.jsxs)(f,{value:t,onValueChange:e=>{e&&(n(e),G(1))},children:[(0,A.jsx)(u,{size:`sm`,"aria-label":`Filter`,className:`w-32`,children:(0,A.jsx)(d,{children:M[t]})}),(0,A.jsxs)(l,{children:[(0,A.jsx)(c,{value:`all`,children:M.all}),(0,A.jsx)(c,{value:`unused`,children:M.unused})]})]}),(0,A.jsxs)(f,{value:P,onValueChange:e=>{e&&(F(e),G(1))},children:[(0,A.jsx)(u,{size:`sm`,"aria-label":`Sort`,className:`w-36`,children:(0,A.jsx)(d,{children:N[P]})}),(0,A.jsxs)(l,{children:[(0,A.jsx)(c,{value:`size`,children:N.size}),(0,A.jsx)(c,{value:`date`,children:N.date})]})]}),(0,A.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>void K(W),disabled:B,children:[(0,A.jsx)(h,{className:`mr-1 size-4 ${B?`animate-spin`:``}`}),` Refresh`]}),I?.can_bulk_delete&&Z.length>0&&(0,A.jsxs)(a,{variant:`destructive`,size:`sm`,onClick:()=>void q(Z),children:[(0,A.jsx)(g,{className:`mr-1 size-4`}),` Delete unused (`,Z.length,`)`]})]})]})}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6 custom-scrollbar`,children:[R.length===0?!B&&(0,A.jsx)(`div`,{className:`rounded-lg border border-dashed py-12 text-center text-muted-foreground`,children:t===`unused`?`No unused files.`:`No files uploaded yet.`}):(0,A.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,A.jsxs)(w,{children:[(0,A.jsx)(O,{children:(0,A.jsxs)(x,{children:[(0,A.jsx)(S,{className:`w-20`,children:`Preview`}),(0,A.jsx)(S,{children:`File`}),(0,A.jsx)(S,{children:`Size`}),(0,A.jsx)(S,{children:`Uploaded`}),(0,A.jsx)(S,{className:`text-right`,children:`Actions`})]})}),(0,A.jsx)(T,{children:R.map(e=>(0,A.jsxs)(x,{children:[(0,A.jsx)(b,{children:e.mime_type.startsWith(`image/`)&&e.status===`committed`?(0,A.jsx)(`img`,{src:`${v()}/api/serve/${e.key}`,alt:``,loading:`lazy`,decoding:`async`,className:`h-12 w-16 rounded border object-cover`}):(0,A.jsx)(`div`,{className:`flex h-12 w-16 items-center justify-center rounded border text-muted-foreground`,children:(0,A.jsx)(m,{className:`size-5`})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(`div`,{className:`font-medium`,children:e.key.split(`/`).pop()}),(0,A.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[(0,A.jsx)(E,{variant:`outline`,className:`capitalize`,children:e.feature}),e.status===`deleted`?(0,A.jsxs)(E,{variant:`destructive`,children:[`Deleted · removed `,new Date(new Date(e.deleted_at||e.created_at).getTime()+j*864e5).toLocaleDateString()]}):e.unused?(0,A.jsx)(E,{variant:`secondary`,children:`Unused`}):null]})]}),(0,A.jsx)(b,{className:`text-sm`,children:C(e.bytes)}),(0,A.jsxs)(b,{className:`text-xs text-muted-foreground`,children:[new Date(e.created_at).toLocaleString(),e.uploaded_by_name&&(0,A.jsx)(`span`,{className:`block`,children:e.uploaded_by_name})]}),(0,A.jsx)(b,{className:`text-right`,children:e.can_delete?e.status===`deleted`?(0,A.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>void Y(e),children:[(0,A.jsx)(_,{className:`mr-1 size-4`}),` Undo`]}):(0,A.jsxs)(a,{variant:`destructive`,size:`sm`,onClick:()=>void q([e]),children:[(0,A.jsx)(g,{className:`mr-1 size-4`}),` Delete`]}):(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uploader or Manager only`})})]},e.key))})]})}),I&&X>1&&(0,A.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,A.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Page `,W,` of `,X,` · `,I.total,` files`]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Previous page`,disabled:W<=1||B,onClick:()=>G(W-1),children:(0,A.jsx)(s,{className:`h-4 w-4`})}),Array.from({length:X},(e,t)=>t+1).filter(e=>e===1||e===X||Math.abs(e-W)<=2).reduce((e,t,n,r)=>(n>0&&t-r[n-1]>1&&e.push(`ellipsis`),e.push(t),e),[]).map((e,t)=>e===`ellipsis`?(0,A.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`},`e-${t}`):(0,A.jsx)(a,{variant:e===W?`default`:`outline`,size:`icon-xs`,"aria-current":e===W?`page`:void 0,disabled:B,onClick:()=>G(e),className:e===W?``:`text-muted-foreground`,children:e},e)),(0,A.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Next page`,disabled:W>=X||B,onClick:()=>G(W+1),children:(0,A.jsx)(o,{className:`h-4 w-4`})})]})]})]}),(0,A.jsx)(p,{isOpen:H!==null,title:`Delete from Library?`,message:H?.message??``,confirmText:`Delete`,onConfirm:()=>void J(),onCancel:()=>U(null)})]})}export{P as LibraryRoute};
1
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{n as r}from"./dist-B2tJVU7c.js";import{l as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as a}from"./button-BoRKNt3a.js";import{s as o}from"./useField-BVrxe_qk.js";import{t as s}from"./chevron-left-CB01oDjc.js";import{i as c,n as l,o as u,s as d,t as f}from"./select-pQS-1nhx.js";import{t as p}from"./ConfirmModal-DJuZVQTe.js";import{t as m}from"./file-image-B0FVtvx-.js";import{t as h}from"./refresh-cw-B1eEBXCn.js";import{t as g}from"./trash-2-DPFpHyly.js";import{t as _}from"./undo-2-Lua5EZG-.js";import{a as v,n as y}from"./api-CUfeViMG.js";import{G as b,J as x,K as S,Q as C,U as w,W as T,Z as E,nr as D,q as O}from"./index-CPxZ4xhG.js";var k=e(t(),1),A=n(),j=30,M={all:`All files`,unused:`Unused only`},N={size:`Largest first`,date:`Newest first`};function P(){let e=i(),[t,n]=(0,k.useState)(`all`),[P,F]=(0,k.useState)(`size`),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)([]),[B,V]=(0,k.useState)(!0),[H,U]=(0,k.useState)(null),[W,G]=(0,k.useState)(1),K=(0,k.useCallback)(async e=>{V(!0);try{let n=await y(`/api/library?filter=${t}&sort=${P}&page=${e}`);if(!n.ok)throw Error();let r=await n.json();if(L(r),r.items.length===0&&e>1){G(e-1);return}z(r.items)}catch{r.error(`The Library could not be loaded.`)}finally{V(!1)}},[t,P]);(0,k.useEffect)(()=>{K(W)},[K,W]);let q=async e=>{if(e.length===1){let t=await(await y(`/api/library/usage?key=${encodeURIComponent(e[0].key)}`)).json().catch(()=>({documents:[]}));if(t.documents?.length){let e=t.documents.map(e=>e.title+(e.isDeleted?` (in Trash)`:``)).join(`, `);r.error(`This image is still used by: ${e}. Remove it from those documents first.`);return}}U({items:e,message:`${e.length===1?`This image`:`${e.length} unused images`} will stop counting toward storage now and be removed for good after ${j} days. You can undo until then.`})},J=async()=>{let e=H?.items??[];U(null);let t=0;for(let n of e)(await y(`/api/library`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:n.key})})).ok||t++;t?r.error(`${t} image${t===1?` is`:`s are`} still in use and ${t===1?`was`:`were`} kept.`):r.success(e.length===1?`Image deleted`:`Unused images deleted`),K(W)},Y=async e=>{let t=await y(`/api/library/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e.key})}),n=await t.json().catch(()=>({}));t.ok?(r.success(`Image restored`),K(W)):r.error(n.error||`The image could not be restored.`)},X=I?Math.max(1,Math.ceil(I.total/I.page_size)):1,Z=R.filter(e=>e.unused&&e.status===`committed`&&e.can_delete);return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border bg-background`,children:[(0,A.jsx)(`div`,{className:`shrink-0 border-b p-6`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(a,{variant:`ghost`,size:`sm`,className:`-ml-2 mb-2`,onClick:()=>e(-1),children:[(0,A.jsx)(D,{className:`mr-1 size-4`}),` Back`]}),(0,A.jsxs)(`h2`,{className:`flex items-center gap-2 text-2xl font-bold`,children:[(0,A.jsx)(m,{className:`size-6 text-muted-foreground`}),` Library`]}),(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Files uploaded to `,I?.scope===`user`?`your Personal Workspace`:`this Team workspace by all members`,`. Unused files still count toward storage until deleted.`]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,A.jsxs)(f,{value:t,onValueChange:e=>{e&&(n(e),G(1))},children:[(0,A.jsx)(u,{size:`sm`,"aria-label":`Filter`,className:`w-32`,children:(0,A.jsx)(d,{children:M[t]})}),(0,A.jsxs)(l,{children:[(0,A.jsx)(c,{value:`all`,children:M.all}),(0,A.jsx)(c,{value:`unused`,children:M.unused})]})]}),(0,A.jsxs)(f,{value:P,onValueChange:e=>{e&&(F(e),G(1))},children:[(0,A.jsx)(u,{size:`sm`,"aria-label":`Sort`,className:`w-36`,children:(0,A.jsx)(d,{children:N[P]})}),(0,A.jsxs)(l,{children:[(0,A.jsx)(c,{value:`size`,children:N.size}),(0,A.jsx)(c,{value:`date`,children:N.date})]})]}),(0,A.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>void K(W),disabled:B,children:[(0,A.jsx)(h,{className:`mr-1 size-4 ${B?`animate-spin`:``}`}),` Refresh`]}),I?.can_bulk_delete&&Z.length>0&&(0,A.jsxs)(a,{variant:`destructive`,size:`sm`,onClick:()=>void q(Z),children:[(0,A.jsx)(g,{className:`mr-1 size-4`}),` Delete unused (`,Z.length,`)`]})]})]})}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6 custom-scrollbar`,children:[R.length===0?!B&&(0,A.jsx)(`div`,{className:`rounded-lg border border-dashed py-12 text-center text-muted-foreground`,children:t===`unused`?`No unused files.`:`No files uploaded yet.`}):(0,A.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,A.jsxs)(w,{children:[(0,A.jsx)(O,{children:(0,A.jsxs)(x,{children:[(0,A.jsx)(S,{className:`w-20`,children:`Preview`}),(0,A.jsx)(S,{children:`File`}),(0,A.jsx)(S,{children:`Size`}),(0,A.jsx)(S,{children:`Uploaded`}),(0,A.jsx)(S,{className:`text-right`,children:`Actions`})]})}),(0,A.jsx)(T,{children:R.map(e=>(0,A.jsxs)(x,{children:[(0,A.jsx)(b,{children:e.mime_type.startsWith(`image/`)&&e.status===`committed`?(0,A.jsx)(`img`,{src:`${v()}/api/serve/${e.key}`,alt:``,loading:`lazy`,decoding:`async`,className:`h-12 w-16 rounded border object-cover`}):(0,A.jsx)(`div`,{className:`flex h-12 w-16 items-center justify-center rounded border text-muted-foreground`,children:(0,A.jsx)(m,{className:`size-5`})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(`div`,{className:`font-medium`,children:e.key.split(`/`).pop()}),(0,A.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[(0,A.jsx)(E,{variant:`outline`,className:`capitalize`,children:e.feature}),e.status===`deleted`?(0,A.jsxs)(E,{variant:`destructive`,children:[`Deleted · removed `,new Date(new Date(e.deleted_at||e.created_at).getTime()+j*864e5).toLocaleDateString()]}):e.unused?(0,A.jsx)(E,{variant:`secondary`,children:`Unused`}):null]})]}),(0,A.jsx)(b,{className:`text-sm`,children:C(e.bytes)}),(0,A.jsxs)(b,{className:`text-xs text-muted-foreground`,children:[new Date(e.created_at).toLocaleString(),e.uploaded_by_name&&(0,A.jsx)(`span`,{className:`block`,children:e.uploaded_by_name})]}),(0,A.jsx)(b,{className:`text-right`,children:e.can_delete?e.status===`deleted`?(0,A.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>void Y(e),children:[(0,A.jsx)(_,{className:`mr-1 size-4`}),` Undo`]}):(0,A.jsxs)(a,{variant:`destructive`,size:`sm`,onClick:()=>void q([e]),children:[(0,A.jsx)(g,{className:`mr-1 size-4`}),` Delete`]}):(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uploader or Manager only`})})]},e.key))})]})}),I&&X>1&&(0,A.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,A.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Page `,W,` of `,X,` · `,I.total,` files`]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Previous page`,disabled:W<=1||B,onClick:()=>G(W-1),children:(0,A.jsx)(s,{className:`h-4 w-4`})}),Array.from({length:X},(e,t)=>t+1).filter(e=>e===1||e===X||Math.abs(e-W)<=2).reduce((e,t,n,r)=>(n>0&&t-r[n-1]>1&&e.push(`ellipsis`),e.push(t),e),[]).map((e,t)=>e===`ellipsis`?(0,A.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`},`e-${t}`):(0,A.jsx)(a,{variant:e===W?`default`:`outline`,size:`icon-xs`,"aria-current":e===W?`page`:void 0,disabled:B,onClick:()=>G(e),className:e===W?``:`text-muted-foreground`,children:e},e)),(0,A.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Next page`,disabled:W>=X||B,onClick:()=>G(W+1),children:(0,A.jsx)(o,{className:`h-4 w-4`})})]})]})]}),(0,A.jsx)(p,{isOpen:H!==null,title:`Delete from Library?`,message:H?.message??``,confirmText:`Delete`,onConfirm:()=>void J(),onCancel:()=>U(null)})]})}export{P as LibraryRoute};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-DWBUoc_x.js","assets/rolldown-runtime-BCiCTKAo.js","assets/jsx-runtime-Cl3nUQcN.js","assets/dist-B2tJVU7c.js","assets/chunk-BV7QT456-B3UxAK3W.js","assets/note-importer-NZUWzjz4.js","assets/src-C_gRsKqw.js","assets/value-CHmTzbgv.js","assets/image-compression-su-JvgYP.js","assets/preload-helper-BLdHbfdN.js","assets/api-CUfeViMG.js","assets/button-BoRKNt3a.js","assets/useField-BVrxe_qk.js","assets/useOpenInteractionType-8RZuPnpG.js","assets/popover-CeOegac2.js","assets/dropdown-menu-rZKTxsXp.js","assets/check-CkCHT6D9.js","assets/getPseudoElementBounds-Dgxi_dXc.js","assets/CompositeList-fgcZ0MvU.js","assets/useCompositeItem-DuwIR47L.js","assets/ERDComments-BgnRJ-nP.js","assets/select-pQS-1nhx.js","assets/ConfirmModal-DJuZVQTe.js","assets/alert-dialog-WL8sXxIT.js","assets/ellipsis-BGAMAt1v.js","assets/dialog-C2aDTmOl.js","assets/trash-2-DPFpHyly.js","assets/link-2-BrX-3vw2.js","assets/w3c-keyname-BHJ3Azyy.js","assets/input-D_eLLMB7.js","assets/chevron-left-CB01oDjc.js","assets/erdActions-C1fVMvH-.js","assets/pen-tool-DmvCCYqc.js","assets/move-B7unHbzE.js","assets/field-n9pl0vBs.js","assets/file-image-B0FVtvx-.js","assets/hard-drive-CrTpFIk_.js","assets/image-BL95x2v1.js","assets/redo-2-pHmjKxwl.js","assets/message-square-D0gsxj3O.js","assets/refresh-ccw-CDPwRXxv.js","assets/refresh-cw-B1eEBXCn.js","assets/sparkles-DxlLz1gp.js","assets/undo-2-Lua5EZG-.js","assets/user-x-DvhsEMZL.js","assets/user-cog-DHNnqUNW.js","assets/localPersistence-CGAJ2Ky5.js","assets/WorkspaceContext-CitlpD55.js","assets/index-Dj_OkW0L.js","assets/fileOwnership-DvxzSccE.js","assets/WorkspaceProvider-B9rJwzKp.js","assets/useAuth-BIu3hkix.js","assets/diagramVersioning-CIsEnz78.js","assets/dist-js-CoMyUP6l.js","assets/core-DNaw6KYU.js","assets/label-CNlirj1C.js","assets/index-DCj2b-5G.css","assets/Combination-CjkFysA5.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{d as r,u as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{s as a}from"./button-BoRKNt3a.js";import{t as o}from"./preload-helper-BLdHbfdN.js";import"./WorkspaceProvider-B9rJwzKp.js";import{n as s}from"./WorkspaceContext-CitlpD55.js";import{F as c}from"./index-Dj_OkW0L.js";var l=a(`file-question-mark`,[[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),u=e(t(),1),d=n(),f=u.lazy(()=>o(()=>import(`./NotesView-DWBUoc_x.js`).then(e=>({default:e.NotesView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57])));function p(){let e=s(),t=i(),{id:n}=r(),{activeNote:a,activeNoteUid:o,saveNote:p,handleNoteChange:m,deleteNote:h,isPublicView:g,isLoading:_,isNoteItemLoading:v,handleNoteSelect:y}=e,b=(0,u.useRef)(!1);(0,u.useEffect)(()=>{!g&&n&&(b.current||(o===n?b.current=!0:o||(b.current=!0,y(n))))},[n,o,g,y]);let x=a?.project_id??a?.projectId,S=e.projects.find(e=>String(e.id)===String(x)),C=S?.team_id??S?.teamId,w=!g&&!e.isGuest&&e.getFileAccessRole(a)!==`viewer`&&C&&t?.activeTeamId&&String(C)===String(t.activeTeamId)&&a?.uid?{projectId:String(x),teamId:String(t.activeTeamId),featureType:`note`,fileId:String(a.uid)}:null;return!g&&!o?n&&!b.current?(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]}):(0,d.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a note to view`})}):!a&&!v?(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(l,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Note not found`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This note may have been deleted or is no longer available.`})]}):a?(0,d.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,d.jsx)(c,{currentView:`notes`}),(0,d.jsx)(u.Suspense,{fallback:(0,d.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground/60 animate-pulse`,children:`Loading note...`})]})}),children:(0,d.jsx)(f,{isLoading:v,activeNoteUid:g?null:o,activeNote:a,saveNote:p,handleNoteChange:m,deleteNote:h,isReadOnly:g||e.isReadOnlyFile(a),commentFile:w})})]}):(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]})}export{p as NoteEditorRoute,l as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-wvEOVfdQ.js","assets/rolldown-runtime-BCiCTKAo.js","assets/jsx-runtime-Cl3nUQcN.js","assets/dist-B2tJVU7c.js","assets/chunk-BV7QT456-B3UxAK3W.js","assets/note-importer-Cxdf3khP.js","assets/src-C_gRsKqw.js","assets/value-CHmTzbgv.js","assets/image-compression-su-JvgYP.js","assets/preload-helper-BLdHbfdN.js","assets/api-CUfeViMG.js","assets/button-BoRKNt3a.js","assets/useField-BVrxe_qk.js","assets/useOpenInteractionType-8RZuPnpG.js","assets/popover-l5FGEnVW.js","assets/dropdown-menu-rZKTxsXp.js","assets/check-CkCHT6D9.js","assets/getPseudoElementBounds-Dgxi_dXc.js","assets/CompositeList-fgcZ0MvU.js","assets/useCompositeItem-DuwIR47L.js","assets/ERDComments-DRgQCzYK.js","assets/select-pQS-1nhx.js","assets/ConfirmModal-DJuZVQTe.js","assets/alert-dialog-WL8sXxIT.js","assets/ellipsis-BGAMAt1v.js","assets/dialog-C2aDTmOl.js","assets/trash-2-DPFpHyly.js","assets/useAuth-BIu3hkix.js","assets/link-2-BrX-3vw2.js","assets/w3c-keyname-UmTNCLNK.js","assets/input-D_eLLMB7.js","assets/chevron-left-CB01oDjc.js","assets/erdActions-_LXqMXn7.js","assets/pen-tool-DmvCCYqc.js","assets/move-B7unHbzE.js","assets/field-n9pl0vBs.js","assets/file-image-B0FVtvx-.js","assets/hard-drive-CrTpFIk_.js","assets/image-BL95x2v1.js","assets/redo-2-pHmjKxwl.js","assets/message-square-D0gsxj3O.js","assets/refresh-ccw-CDPwRXxv.js","assets/refresh-cw-B1eEBXCn.js","assets/sparkles-DxlLz1gp.js","assets/undo-2-Lua5EZG-.js","assets/user-x-DvhsEMZL.js","assets/user-cog-DHNnqUNW.js","assets/localPersistence-CGAJ2Ky5.js","assets/WorkspaceContext-CitlpD55.js","assets/index-CPxZ4xhG.js","assets/fileOwnership-DvxzSccE.js","assets/WorkspaceProvider-BAyO6Rw9.js","assets/diagramVersioning-CIsEnz78.js","assets/dist-js-CoMyUP6l.js","assets/core-DNaw6KYU.js","assets/label-CNlirj1C.js","assets/index-DCj2b-5G.css","assets/Combination-CmdVtARU.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{d as r,u as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{s as a}from"./button-BoRKNt3a.js";import{t as o}from"./preload-helper-BLdHbfdN.js";import"./WorkspaceProvider-BAyO6Rw9.js";import{n as s}from"./WorkspaceContext-CitlpD55.js";import{F as c}from"./index-CPxZ4xhG.js";var l=a(`file-question-mark`,[[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),u=e(t(),1),d=n(),f=u.lazy(()=>o(()=>import(`./NotesView-wvEOVfdQ.js`).then(e=>({default:e.NotesView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57])));function p(){let e=s(),t=i(),{id:n}=r(),{activeNote:a,activeNoteUid:o,saveNote:p,handleNoteChange:m,deleteNote:h,isPublicView:g,isLoading:_,isNoteItemLoading:v,handleNoteSelect:y}=e,b=(0,u.useRef)(!1);(0,u.useEffect)(()=>{!g&&n&&(b.current||(o===n?b.current=!0:o||(b.current=!0,y(n))))},[n,o,g,y]);let x=a?.project_id??a?.projectId,S=e.projects.find(e=>String(e.id)===String(x)),C=S?.team_id??S?.teamId,w=!g&&!e.isGuest&&e.getFileAccessRole(a)!==`viewer`&&C&&t?.activeTeamId&&String(C)===String(t.activeTeamId)&&a?.uid?{projectId:String(x),teamId:String(t.activeTeamId),featureType:`note`,fileId:String(a.uid)}:null;return!g&&!o?n&&!b.current?(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]}):(0,d.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a note to view`})}):!a&&!v?(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(l,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,d.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Note not found`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This note may have been deleted or is no longer available.`})]}):a?(0,d.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,d.jsx)(c,{currentView:`notes`}),(0,d.jsx)(u.Suspense,{fallback:(0,d.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground/60 animate-pulse`,children:`Loading note...`})]})}),children:(0,d.jsx)(f,{isLoading:v,activeNoteUid:g?null:o,activeNote:a,saveNote:p,handleNoteChange:m,deleteNote:h,isReadOnly:g||e.isReadOnlyFile(a),commentFile:w})})]}):(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,d.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,d.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]})}export{p as NoteEditorRoute,l as t};