@intent-hq/web 2.286.1 → 2.286.2

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 (209) hide show
  1. package/bin/intent-web.mjs +11 -2
  2. package/package.json +1 -1
  3. package/web/app/immutable/assets/0.B2ssLqMh.css +1 -0
  4. package/web/app/immutable/chunks/{RNQdr-NN.js → -C2IRcJ4.js} +1 -1
  5. package/web/app/immutable/chunks/{BR5lR6Td.js → -bBOxk3W.js} +1 -1
  6. package/web/app/immutable/chunks/{DWvbS4mu.js → -f5HsMRH.js} +1 -1
  7. package/web/app/immutable/chunks/{D4uZwrDX.js → -lPRd7v2.js} +1 -1
  8. package/web/app/immutable/chunks/{oTkHTTGI.js → 2jTJ7ui5.js} +1 -1
  9. package/web/app/immutable/chunks/{O_LhoKyf.js → 2qd-rLGS.js} +1 -1
  10. package/web/app/immutable/chunks/{DQprfQGN.js → 5KQTpdV3.js} +1 -1
  11. package/web/app/immutable/chunks/{Ct7iVnk5.js → 7yhhL_Kv.js} +2 -2
  12. package/web/app/immutable/chunks/{C4Zcz5ig.js → 8GVegoKX.js} +1 -1
  13. package/web/app/immutable/chunks/{BHwB2t2J.js → 8RNmk_9I.js} +6 -6
  14. package/web/app/immutable/chunks/{CeHlFtmN.js → 8wBQgcHV.js} +1 -1
  15. package/web/app/immutable/chunks/{DKnyYiOE.js → 9N2fNktT.js} +1 -1
  16. package/web/app/immutable/chunks/{CNG6DDdt.js → 9s3D9jIu.js} +1 -1
  17. package/web/app/immutable/chunks/{BaWkgFPr.js → A1I58Dap.js} +1 -1
  18. package/web/app/immutable/chunks/{C9129WmZ.js → B-RiR-3W.js} +1 -1
  19. package/web/app/immutable/chunks/{B78OjmQ3.js → B1W2g1fL.js} +1 -1
  20. package/web/app/immutable/chunks/{b7qEBWdv.js → B1pmGVIx.js} +1 -1
  21. package/web/app/immutable/chunks/{ALbX902-.js → B2fuxI_8.js} +1 -1
  22. package/web/app/immutable/chunks/{C4lY6YLh.js → B2xxVCZM.js} +1 -1
  23. package/web/app/immutable/chunks/{B5NXv3LV.js → B3kscBFg.js} +6 -6
  24. package/web/app/immutable/chunks/{CG-WEY6g.js → B5Gxq3jJ.js} +1 -1
  25. package/web/app/immutable/chunks/{2LPpSBFe.js → BCJ6mCcP.js} +1 -1
  26. package/web/app/immutable/chunks/{CaJjlkv1.js → BCK268oV.js} +1 -1
  27. package/web/app/immutable/chunks/{Bxc57npw.js → BCyLWzW8.js} +1 -1
  28. package/web/app/immutable/chunks/{CnT2T-Bp.js → BIH7Omo4.js} +4 -4
  29. package/web/app/immutable/chunks/{CgOfeXf8.js → BILk4fAN.js} +1 -1
  30. package/web/app/immutable/chunks/{CEiokx4X.js → BMTtG9zH.js} +1 -1
  31. package/web/app/immutable/chunks/{Ds-FLOE0.js → BORtTc-e.js} +1 -1
  32. package/web/app/immutable/chunks/{-4iKCYSl.js → BPovTGvM.js} +1 -1
  33. package/web/app/immutable/chunks/{BB0aq9c_.js → BPsVnNyd.js} +1 -1
  34. package/web/app/immutable/chunks/{C6RQmr0V.js → BSa8UQqG.js} +1 -1
  35. package/web/app/immutable/chunks/{CjOWZNUy.js → BU4UpNXO.js} +1 -1
  36. package/web/app/immutable/chunks/{nvAK9EyO.js → BXidsM5y.js} +1 -1
  37. package/web/app/immutable/chunks/{kpgdVhmB.js → BYX5z7iO.js} +1 -1
  38. package/web/app/immutable/chunks/{Cc8gV_FE.js → BZtjF7Ie.js} +1 -1
  39. package/web/app/immutable/chunks/{gn8kmMF6.js → BaaGaTiz.js} +1 -1
  40. package/web/app/immutable/chunks/{Dj9OdxPP.js → BbRTv7cq.js} +1 -1
  41. package/web/app/immutable/chunks/{B_Ngo80M.js → BdXOFJeo.js} +1 -1
  42. package/web/app/immutable/chunks/{D61mreVc.js → BgghSBWo.js} +1 -1
  43. package/web/app/immutable/chunks/{F7QETuhI.js → BisYAzdD.js} +1 -1
  44. package/web/app/immutable/chunks/{B5VfU0KM.js → BkXluBMH.js} +1 -1
  45. package/web/app/immutable/chunks/{BKAT2tIv.js → Bmg84LND.js} +1 -1
  46. package/web/app/immutable/chunks/Bo4gq_23.js +4 -0
  47. package/web/app/immutable/chunks/{C5E1PJb6.js → BofkdNap.js} +2 -2
  48. package/web/app/immutable/chunks/{Dh52so4o.js → BqJTmha5.js} +3 -3
  49. package/web/app/immutable/chunks/{BdvBYYZC.js → BqR317mE.js} +1 -1
  50. package/web/app/immutable/chunks/{BTRxaITj.js → BsMjnrdy.js} +1 -1
  51. package/web/app/immutable/chunks/{De60mY1u.js → Btt3OR2y.js} +1 -1
  52. package/web/app/immutable/chunks/{Du9ULB4g.js → BuknD9D8.js} +1 -1
  53. package/web/app/immutable/chunks/{BbANJKYX.js → Bzy14_Y3.js} +1 -1
  54. package/web/app/immutable/chunks/{D6eVIgjz.js → BzzEl9C8.js} +1 -1
  55. package/web/app/immutable/chunks/{l6-BV5ui.js → C--dVDXo.js} +1 -1
  56. package/web/app/immutable/chunks/{BCYRUItZ.js → C60Ik0Qb.js} +4 -4
  57. package/web/app/immutable/chunks/{3sa2ZSPC.js → C627-01N.js} +1 -1
  58. package/web/app/immutable/chunks/{BgX6IJDk.js → C6GT9iuD.js} +1 -1
  59. package/web/app/immutable/chunks/{ChOA9PWi.js → C6ldMp_G.js} +1 -1
  60. package/web/app/immutable/chunks/{BAEKjYyz.js → C8COLGeG.js} +1 -1
  61. package/web/app/immutable/chunks/{CusMGTEg.js → CAuyDtSk.js} +1 -1
  62. package/web/app/immutable/chunks/{CJKeXT5H.js → CB_Kofwn.js} +1 -1
  63. package/web/app/immutable/chunks/{F9nw4iUp.js → CCWZuPTG.js} +1 -1
  64. package/web/app/immutable/chunks/{Cg71xtru.js → CD2a7NWW.js} +1 -1
  65. package/web/app/immutable/chunks/{DvDXb3dW.js → CEByQsO_.js} +1 -1
  66. package/web/app/immutable/chunks/{HHGL3CBU.js → CED7K7pn.js} +1 -1
  67. package/web/app/immutable/chunks/{CN1yc9sw.js → CFgi_DMD.js} +1 -1
  68. package/web/app/immutable/chunks/{B_IE7AMR.js → CGmXQTqt.js} +1 -1
  69. package/web/app/immutable/chunks/CJdFRWjw.js +3 -0
  70. package/web/app/immutable/chunks/{DiBTM3GP.js → CKNNEoUh.js} +1 -1
  71. package/web/app/immutable/chunks/{Cv6pFp-w.js → CKwby1z3.js} +1 -1
  72. package/web/app/immutable/chunks/{vkDSSzeI.js → CNr93ccj.js} +1 -1
  73. package/web/app/immutable/chunks/{BsKoK3Rk.js → COemOf_j.js} +1 -1
  74. package/web/app/immutable/chunks/{3q61Z6zu.js → COnjpG4O.js} +1 -1
  75. package/web/app/immutable/chunks/{laFenviK.js → COsML5DR.js} +3 -3
  76. package/web/app/immutable/chunks/{XgTDusK7.js → CPGCgkWj.js} +1 -1
  77. package/web/app/immutable/chunks/{DoIwXvY5.js → CPtB0jUS.js} +1 -1
  78. package/web/app/immutable/chunks/{qsyNpi2_.js → CQAMVzSj.js} +1 -1
  79. package/web/app/immutable/chunks/{B1kJVNhf.js → CSggmaYx.js} +1 -1
  80. package/web/app/immutable/chunks/{DqkDKEMV.js → CVH0m_ri.js} +1 -1
  81. package/web/app/immutable/chunks/{DU5u4CoB.js → CW-LHLDp.js} +7 -7
  82. package/web/app/immutable/chunks/{BmnDHgDT.js → CXSuJ2ZK.js} +1 -1
  83. package/web/app/immutable/chunks/{BCiyShif.js → CY2SJz5g.js} +1 -1
  84. package/web/app/immutable/chunks/{9JjZRepm.js → CZtxOtGv.js} +1 -1
  85. package/web/app/immutable/chunks/{CdEtW7wp.js → CZvzT-U0.js} +1 -1
  86. package/web/app/immutable/chunks/{BkBZtLYF.js → CaADSFdg.js} +1 -1
  87. package/web/app/immutable/chunks/{hTe-_Fjh.js → CaWaQ99W.js} +3 -3
  88. package/web/app/immutable/chunks/{BdMP-rwq.js → CaypYiAV.js} +1 -1
  89. package/web/app/immutable/chunks/{BGgB8Pc0.js → CbFEmy2D.js} +2 -2
  90. package/web/app/immutable/chunks/{CfHaLL96.js → CclcGP3X.js} +1 -1
  91. package/web/app/immutable/chunks/{Bg8XhRuy.js → CgJW_HcZ.js} +1 -1
  92. package/web/app/immutable/chunks/Ch6rVsLf.js +8 -0
  93. package/web/app/immutable/chunks/{Bn4hj7HG.js → Cip0e418.js} +1 -1
  94. package/web/app/immutable/chunks/{DeD2_APR.js → Ciz44nC1.js} +1 -1
  95. package/web/app/immutable/chunks/{D9qYrFLr.js → CjokggNJ.js} +1 -1
  96. package/web/app/immutable/chunks/{pUHkzJ_d.js → CjpXXX_J.js} +1 -1
  97. package/web/app/immutable/chunks/{BnDVzHAF.js → CmKUsKaf.js} +1 -1
  98. package/web/app/immutable/chunks/{4LCvEsVS.js → CmYElrEr.js} +1 -1
  99. package/web/app/immutable/chunks/{DES0UXLU.js → CmjmDPGO.js} +1 -1
  100. package/web/app/immutable/chunks/{BhIrT2jr.js → CtuQQgf2.js} +2 -2
  101. package/web/app/immutable/chunks/{CMieQf0P.js → Cvr-8bX_.js} +1 -1
  102. package/web/app/immutable/chunks/{DM4MRAyE.js → CwcHW8S6.js} +1 -1
  103. package/web/app/immutable/chunks/{2FstYM1s.js → CxtuGanp.js} +1 -1
  104. package/web/app/immutable/chunks/{DAPK9slU.js → CyIz5Rp5.js} +1 -1
  105. package/web/app/immutable/chunks/{YIljg4QC.js → CySbf6TD.js} +1 -1
  106. package/web/app/immutable/chunks/{2oaDc1nn.js → Cz0pfiI3.js} +1 -1
  107. package/web/app/immutable/chunks/{lN-utS8K.js → D5QJ-2vz.js} +1 -1
  108. package/web/app/immutable/chunks/{DuzQF9m7.js → D6VZoi9m.js} +1 -1
  109. package/web/app/immutable/chunks/{CC-oK8xP.js → D9KFPzLd.js} +2 -2
  110. package/web/app/immutable/chunks/{C5RdKv5y.js → D9f7U_gJ.js} +1 -1
  111. package/web/app/immutable/chunks/{CjOA3fQ_.js → DCIaHRk5.js} +1 -1
  112. package/web/app/immutable/chunks/{DGWxO_aL.js → DDD7SYSD.js} +1 -1
  113. package/web/app/immutable/chunks/{Bz08MgGK.js → DEjCmBII.js} +1 -1
  114. package/web/app/immutable/chunks/{CcFGFqFC.js → DEo5oMHN.js} +1 -1
  115. package/web/app/immutable/chunks/{BIGmpOjZ.js → DGG8qQva.js} +1 -1
  116. package/web/app/immutable/chunks/{DeMWATch.js → DJHSMHzO.js} +1 -1
  117. package/web/app/immutable/chunks/{DLOFCVO4.js → DN8s5MPu.js} +1 -1
  118. package/web/app/immutable/chunks/{Uvf94Vit.js → DNv7jzNl.js} +1 -1
  119. package/web/app/immutable/chunks/{Cic3Ymv4.js → DOB0mTS8.js} +2 -2
  120. package/web/app/immutable/chunks/{aWlYJ1qq.js → DP7FYu47.js} +1 -1
  121. package/web/app/immutable/chunks/{BY3DTY8F.js → DU1XmBqY.js} +1 -1
  122. package/web/app/immutable/chunks/{BwqCA_Tg.js → DVAcX8po.js} +1 -1
  123. package/web/app/immutable/chunks/{C68FzyYL.js → DVGkNFGJ.js} +1 -1
  124. package/web/app/immutable/chunks/{CQlclm_i.js → DXXGL7Ej.js} +1 -1
  125. package/web/app/immutable/chunks/{l9lbU6dU.js → DY42fpE9.js} +1 -1
  126. package/web/app/immutable/chunks/{B-34RgWF.js → DaXLi7kw.js} +1 -1
  127. package/web/app/immutable/chunks/{Ov_SEXEY.js → Db85r7-o.js} +1 -1
  128. package/web/app/immutable/chunks/{R0wDqNpY.js → Dd8Oh65P.js} +1 -1
  129. package/web/app/immutable/chunks/{HjNzRj_q.js → Ddh0rE8O.js} +1 -1
  130. package/web/app/immutable/chunks/{B8N5zbP-.js → DekSqFjl.js} +1 -1
  131. package/web/app/immutable/chunks/{CQ8xUw8b.js → DfBQRVUY.js} +1 -1
  132. package/web/app/immutable/chunks/{CM-RTisq.js → Dfex6H6B.js} +1 -1
  133. package/web/app/immutable/chunks/{p20Ma5Ub.js → Dh_7SQPV.js} +1 -1
  134. package/web/app/immutable/chunks/{DJeS0Z6Z.js → DhbLviZQ.js} +1 -1
  135. package/web/app/immutable/chunks/{CJlBFmXK.js → DixA-W0V.js} +1 -1
  136. package/web/app/immutable/chunks/{bb6KeZoT.js → DjrSmzCc.js} +1 -1
  137. package/web/app/immutable/chunks/{B2SAFlE_.js → DkEnUmDM.js} +1 -1
  138. package/web/app/immutable/chunks/{Dz40TuR7.js → Dko-Flac.js} +1 -1
  139. package/web/app/immutable/chunks/{B5WfnJ_I.js → DnC7pGbF.js} +1 -1
  140. package/web/app/immutable/chunks/{CcDZ8sih.js → DntMfhqH.js} +4 -4
  141. package/web/app/immutable/chunks/{Fy3QvGgT.js → DoVZd79N.js} +1 -1
  142. package/web/app/immutable/chunks/{DdZVLxLI.js → DpNOuMqA.js} +1 -1
  143. package/web/app/immutable/chunks/{Cbe4LDCb.js → DqRQRrwd.js} +1 -1
  144. package/web/app/immutable/chunks/{DuXpwSkB.js → Dt2W2Job.js} +1 -1
  145. package/web/app/immutable/chunks/{CN6UuCI4.js → DvExSeJx.js} +2 -2
  146. package/web/app/immutable/chunks/{pqiENG4w.js → DzFUmVmc.js} +1 -1
  147. package/web/app/immutable/chunks/{D7y4iPD0.js → DzYj9I01.js} +1 -1
  148. package/web/app/immutable/chunks/{DHLYr2dR.js → Eor-CiZM.js} +1 -1
  149. package/web/app/immutable/chunks/{BOFk1KrL.js → FpRDS6GR.js} +1 -1
  150. package/web/app/immutable/chunks/{zln0bEou.js → GKyoWP3c.js} +1 -1
  151. package/web/app/immutable/chunks/{DcOGngFl.js → GVi-o-HG.js} +1 -1
  152. package/web/app/immutable/chunks/{DyjYgqtH.js → IJO_5iR4.js} +1 -1
  153. package/web/app/immutable/chunks/{fsCYHFC5.js → IhfTHHOz.js} +1 -1
  154. package/web/app/immutable/chunks/{BIY56SBV.js → Jrnc38lr.js} +1 -1
  155. package/web/app/immutable/chunks/{BsNGkCax.js → JvqNZ4n7.js} +1 -1
  156. package/web/app/immutable/chunks/{DZ2EweHv.js → KClCJGZO.js} +1 -1
  157. package/web/app/immutable/chunks/{B5OVBjIf.js → MZfXqgXX.js} +1 -1
  158. package/web/app/immutable/chunks/{B0jdpkVd.js → N_1l7hXH.js} +1 -1
  159. package/web/app/immutable/chunks/{JktSJt1s.js → OZGRjDvq.js} +1 -1
  160. package/web/app/immutable/chunks/{BDFJ3z4C.js → R8dYtUzD.js} +1 -1
  161. package/web/app/immutable/chunks/{B-jWalbO.js → R8eRTNnP.js} +1 -1
  162. package/web/app/immutable/chunks/{BUqUwu2G.js → R9TZ8GIl.js} +1 -1
  163. package/web/app/immutable/chunks/{Cf1Jz9Vb.js → Shvd3y-7.js} +1 -1
  164. package/web/app/immutable/chunks/{C9g8CU4z.js → SpvqHVer.js} +1 -1
  165. package/web/app/immutable/chunks/{Bluyq349.js → Tbr6p59b.js} +1 -1
  166. package/web/app/immutable/chunks/{PSWhBTN5.js → XXA_973X.js} +1 -1
  167. package/web/app/immutable/chunks/{BxKmCVSh.js → YE41SUlf.js} +1 -1
  168. package/web/app/immutable/chunks/{CbQJkQ1_.js → Z1DZJfze.js} +1 -1
  169. package/web/app/immutable/chunks/{ChMhvUux.js → ZD-F4NvX.js} +1 -1
  170. package/web/app/immutable/chunks/{CJPP3n_b.js → ZDypNe47.js} +1 -1
  171. package/web/app/immutable/chunks/{qk0mFpjO.js → _EZnucM4.js} +1 -1
  172. package/web/app/immutable/chunks/{xpCT4rnW.js → dOrUcrda.js} +1 -1
  173. package/web/app/immutable/chunks/{Cdv2uRTZ.js → iQlEdXPk.js} +1 -1
  174. package/web/app/immutable/chunks/{BhBL2il-.js → jUTK_aDz.js} +1 -1
  175. package/web/app/immutable/chunks/{VwRqUxpW.js → jWQiaOEh.js} +1 -1
  176. package/web/app/immutable/chunks/{TKnaMJht.js → mIgIf34G.js} +1 -1
  177. package/web/app/immutable/chunks/{Dxitz0gG.js → nHFvNMoD.js} +1 -1
  178. package/web/app/immutable/chunks/{CqwbuddS.js → nUiGI9_j.js} +1 -1
  179. package/web/app/immutable/chunks/{CzK2fiHA.js → rcY8Jah2.js} +1 -1
  180. package/web/app/immutable/chunks/{CU9uaZDq.js → tDd-6B2L.js} +1 -1
  181. package/web/app/immutable/chunks/{cKTNBTNE.js → uuDLpQqj.js} +1 -1
  182. package/web/app/immutable/chunks/{QOLdaLP0.js → wcwUUENo.js} +1 -1
  183. package/web/app/immutable/chunks/{DrI7rzCm.js → xx12n3Gb.js} +1 -1
  184. package/web/app/immutable/chunks/{BwixslcF.js → zCdOCSz2.js} +1 -1
  185. package/web/app/immutable/chunks/zh3oQLeX.js +1 -0
  186. package/web/app/immutable/entry/{app.BvKW_t2N.js → app.VJdWRZXW.js} +2 -2
  187. package/web/app/immutable/entry/start.CgJpRFs5.js +1 -0
  188. package/web/app/immutable/nodes/{0.BYMSP7Y-.js → 0.znaZSkGz.js} +1 -1
  189. package/web/app/immutable/nodes/{1.DIEji4Js.js → 1.QD_AYG75.js} +1 -1
  190. package/web/app/immutable/nodes/{10.DvTvrgji.js → 10.gF8-cogW.js} +1 -1
  191. package/web/app/immutable/nodes/{14.CJs3OY3_.js → 14.Dg2AgOXG.js} +1 -1
  192. package/web/app/immutable/nodes/{16.DsO7YO_c.js → 16.DwkJcrpd.js} +2 -2
  193. package/web/app/immutable/nodes/{2.Cht0dQl2.js → 2.BtT3yj0F.js} +3 -3
  194. package/web/app/immutable/nodes/{3.BGeidrSE.js → 3.CvwCGNZG.js} +1 -1
  195. package/web/app/immutable/nodes/{4.iguZO2rl.js → 4.DkczoMth.js} +1 -1
  196. package/web/app/immutable/nodes/{5.BppWO1IB.js → 5.BCyXLcum.js} +1 -1
  197. package/web/app/immutable/nodes/{6.ChXOvT3x.js → 6.BpqkaXHY.js} +1 -1
  198. package/web/app/immutable/nodes/{7.CgsIeK3J.js → 7.qMlWyBnC.js} +1 -1
  199. package/web/app/immutable/nodes/{8.Bq2NzD4c.js → 8.Bq5rrqJa.js} +11 -11
  200. package/web/app/immutable/nodes/{9.CvEBRJEV.js → 9.CA3t47dE.js} +1 -1
  201. package/web/app/version.json +1 -1
  202. package/web/generated/paraglide.js +8 -8
  203. package/web/index.html +10 -10
  204. package/web/app/immutable/assets/0.Racpq4cy.css +0 -1
  205. package/web/app/immutable/chunks/172GvQgx.js +0 -4
  206. package/web/app/immutable/chunks/BZXl3la6.js +0 -1
  207. package/web/app/immutable/chunks/CDuyWy4D.js +0 -3
  208. package/web/app/immutable/chunks/DNOilvOO.js +0 -8
  209. package/web/app/immutable/entry/start.CQ7TZDH6.js +0 -1
@@ -1 +1 @@
1
- import{gF as C,gl as G,Gg as x,G_ as R,rN as B,sC as F,x$ as N,y0 as $,Ge as D,Gf as H,y1 as V}from"./BjFoJgFv.js";import{N as d,o as K,B as U,e as j,l as g,p as q,u as z,v as J}from"./B6LKhrY2.js";import{dv as M}from"./DUT4V6mb.js";import{r as Q}from"./BKAT2tIv.js";import{bo as l}from"./COCO5InB.js";import{b4 as X,a9 as T}from"./C5Xi5eLp.js";import{g as Y}from"./wGTbEzRg.js";function I(e,t){const a=d.select(e.state),n=g.select(e.state);if(!n)return null;const c=a.indexOf(n),s=c+(t==="left"?-1:1),r=a[s];return c<0||!r?null:(e.dispatch(B(n,r,t==="left"?"before":"after")),n)}function E(e){const t=g.select(e);return t&&d.select(e).includes(t)?t:null}function f(e,t,a){const n=E(e.state),c=n?`/workspace/${n}`:Q(M.select(e.state));return t!==c&&a(c),n}function Z(e,t,a,n){return e.dispatch(C(t)),f(e,a,n),t}function y(e,t){const n=t.match(/^\/workspace\/([^/]+)/)?.[1];return n?n==="new"?null:n:null}function ee(e,t,a,n){if(a==="/")return A(e,t==="next"?0:"last",a,n);e.dispatch(t==="next"?D():H());const c=g.select(e.state);if(!c)return null;const s=`/workspace/${c}`;return a!==s&&n(s),c}function te(e,t,a){const n=y(e,t);return n?Z(e,n,t,a):null}function ae(e,t,a){const n=y(e,t);if(!n)return null;const c=K.select(e.state,n);if(!c)return null;const s=c.tabs.find(m=>m.id===c.activeTabId),r=c.tabs.length===0&&c.activeTabId===null,w=U.select(e.state,n)>1&&(r||c.tabs.length===1&&s!==void 0&&s.closable!==!1);if((!s||s.closable===!1)&&!w)return null;const _=a??Y(n)?.availableCanvasWidth??void 0;return e.dispatch(G(n,void 0,_)),s?.id??c.id}function ne(e,t){const a=e.state.panelLayout.byWorkspaceId[t];return!a||a.restoreStatus==="pending"?!1:j.select(e.state,t).length===0}function oe(e,t,a){E(e.state)||e.dispatch(x(0)),f(e,t,a)}function S(e,t,{navigate:a,closeWindow:n}){return n?(n(),"window"):(f(e,t,a),null)}function ce(e,t,a){const n=y(e,t);return n?ae(e,t,a.availableCanvasWidth)!==null?"panel":ne(e,n)?(e.dispatch(C(n)),d.select(e.state).length>0?(oe(e,t,a.navigate),"workspace"):S(e,t,a)??"workspace"):null:d.select(e.state).length>0?null:S(e,t,a)}function se(e,t,a){return e.dispatch(V()),f(e,t,a)}function le(e,t,a){const n=t.match(/^\/workspace\/([^/]+)/),c=n&&n[1]!=="new"?n[1]:null,s=z.select(e.state),r=c?J.select(e.state,c):null;return c&&r&&(!s||r.closedAt>=s.closedAt)?r.kind==="column"?(e.dispatch(N(c)),"column"):(e.dispatch($(c)),r.kind):s?(se(e,t,a),"workspace"):null}function re(e,t){const a=t.match(/^\/workspace\/([^/]+)/),n=a&&a[1]!=="new"?a[1]:null;if(!n)return null;const c=F(n);return e.dispatch(c),q.select(e.state,n)}function A(e,t,a,n){const c=d.select(e.state),s=t==="last"?c.length-1:t;return s<0||s>=c.length?null:(e.dispatch(x(s)),f(e,a,n))}function we({isMac:e,register:t,store:a,getCurrentPath:n,navigate:c,openNewWorkspace:s,onCreateAgent:r,onCreateNote:w,onCreateTerminal:_,onCreateBrowser:m,onWorkspaceTabMoved:W,closeWindow:O,resolveBinding:k}){const u=e?{meta:!0}:{ctrl:!0},P=X("TOGGLE_SIDEBAR",e),b=o=>()=>o(n()),L=o=>()=>{const p=n().match(/^\/workspace\/([^/]+)/);p?.[1]&&p[1]!=="new"&&o(p[1])},i=o=>k?{binding:()=>k(o)}:{};t({...i("global.new-space"),...u,key:"n",global:!0,description:l.workspace_shortcuts_newSpace_description(),action:s}),t({...i("panel.toggle-sidebar"),...P,global:!0,description:T.TOGGLE_SIDEBAR.label,action:()=>a.dispatch(R())}),t({...i("navigation.new-tab"),...u,key:"t",global:!0,description:l.workspace_shortcuts_newPanel_description(),action:b(o=>re(a,o))});for(const[o,p,h,v]of[["workspace.new-agent","a",l.ui_shortcuts_newAgent_label(),r],["workspace.new-note","n",l.layout_panelEmptyState_newItem_tooltip({label:l.layout_panelEmptyState_note_label()}),w],["workspace.new-terminal","t",l.layout_panelEmptyState_newItem_tooltip({label:l.layout_panelEmptyState_terminal_label()}),_],["workspace.new-browser","b",l.layout_panelEmptyState_newItem_tooltip({label:l.layout_panelEmptyState_browser_label()}),m]])v&&t({...i(o),...u,key:p,alt:!0,global:!0,allowInTerminal:!0,description:h,action:L(v)});t({...i("navigation.close-tab"),...u,key:"w",global:!0,description:l.workspace_shortcuts_closePanelTab_description(),action:b(o=>ce(a,o,{navigate:c,closeWindow:O}))}),t({...i("navigation.close-space-tab"),...u,key:"w",shift:!0,global:!0,description:l.workspace_shortcuts_closeSpaceTab_description(),action:b(o=>te(a,o,c))}),t({...i("navigation.reopen-tab"),...u,key:"t",shift:!0,global:!0,description:l.workspace_shortcuts_reopenClosedTabOrSpace_description(),action:b(o=>le(a,o,c))}),t({...i("navigation.move-space-tab-left"),...u,key:"ArrowLeft",alt:!0,shift:!0,global:!0,description:T.MOVE_SPACE_TAB_LEFT.label,action:()=>{const o=I(a,"left");o&&W?.({workspaceId:o,position:d.select(a.state).indexOf(o)+1})}}),t({...i("navigation.move-space-tab-right"),...u,key:"ArrowRight",alt:!0,shift:!0,global:!0,description:T.MOVE_SPACE_TAB_RIGHT.label,action:()=>{const o=I(a,"right");o&&W?.({workspaceId:o,position:d.select(a.state).indexOf(o)+1})}});for(const[o,p]of[["next",!1],["previous",!0]])t({...i(o==="next"?"global.next-space":"global.previous-space"),key:"Tab",ctrl:!0,shift:p,global:!0,description:o==="next"?l.workspace_shortcuts_nextSpaceTab_description():l.workspace_shortcuts_previousSpaceTab_description(),action:b(h=>ee(a,o,h,c))});for(let o=1;o<=9;o++)t({...k?{binding:()=>k("navigation.go-to-tab").replace(/([1-8])-9$/,String(o))}:{},...u,key:String(o),global:!0,description:o===1?l.home_navigation_description():o===9?l.workspace_shortcuts_selectLastSpaceTab_description():l.workspace_shortcuts_selectSpaceTab_description({digit:o}),action:b(p=>o===1?c("/"):A(a,o===9?"last":o-2,p,c))})}export{ce as c,we as r};
1
+ import{gF as C,gl as G,Gg as x,G_ as R,rN as B,sC as F,x$ as N,y0 as $,Ge as D,Gf as H,y1 as V}from"./BjFoJgFv.js";import{N as d,o as K,B as U,e as j,l as g,p as q,u as z,v as J}from"./B6LKhrY2.js";import{dv as M}from"./DUT4V6mb.js";import{r as Q}from"./Bmg84LND.js";import{bo as l}from"./COCO5InB.js";import{b4 as X,a9 as T}from"./C5Xi5eLp.js";import{g as Y}from"./wGTbEzRg.js";function I(e,t){const a=d.select(e.state),n=g.select(e.state);if(!n)return null;const c=a.indexOf(n),s=c+(t==="left"?-1:1),r=a[s];return c<0||!r?null:(e.dispatch(B(n,r,t==="left"?"before":"after")),n)}function E(e){const t=g.select(e);return t&&d.select(e).includes(t)?t:null}function f(e,t,a){const n=E(e.state),c=n?`/workspace/${n}`:Q(M.select(e.state));return t!==c&&a(c),n}function Z(e,t,a,n){return e.dispatch(C(t)),f(e,a,n),t}function y(e,t){const n=t.match(/^\/workspace\/([^/]+)/)?.[1];return n?n==="new"?null:n:null}function ee(e,t,a,n){if(a==="/")return A(e,t==="next"?0:"last",a,n);e.dispatch(t==="next"?D():H());const c=g.select(e.state);if(!c)return null;const s=`/workspace/${c}`;return a!==s&&n(s),c}function te(e,t,a){const n=y(e,t);return n?Z(e,n,t,a):null}function ae(e,t,a){const n=y(e,t);if(!n)return null;const c=K.select(e.state,n);if(!c)return null;const s=c.tabs.find(m=>m.id===c.activeTabId),r=c.tabs.length===0&&c.activeTabId===null,w=U.select(e.state,n)>1&&(r||c.tabs.length===1&&s!==void 0&&s.closable!==!1);if((!s||s.closable===!1)&&!w)return null;const _=a??Y(n)?.availableCanvasWidth??void 0;return e.dispatch(G(n,void 0,_)),s?.id??c.id}function ne(e,t){const a=e.state.panelLayout.byWorkspaceId[t];return!a||a.restoreStatus==="pending"?!1:j.select(e.state,t).length===0}function oe(e,t,a){E(e.state)||e.dispatch(x(0)),f(e,t,a)}function S(e,t,{navigate:a,closeWindow:n}){return n?(n(),"window"):(f(e,t,a),null)}function ce(e,t,a){const n=y(e,t);return n?ae(e,t,a.availableCanvasWidth)!==null?"panel":ne(e,n)?(e.dispatch(C(n)),d.select(e.state).length>0?(oe(e,t,a.navigate),"workspace"):S(e,t,a)??"workspace"):null:d.select(e.state).length>0?null:S(e,t,a)}function se(e,t,a){return e.dispatch(V()),f(e,t,a)}function le(e,t,a){const n=t.match(/^\/workspace\/([^/]+)/),c=n&&n[1]!=="new"?n[1]:null,s=z.select(e.state),r=c?J.select(e.state,c):null;return c&&r&&(!s||r.closedAt>=s.closedAt)?r.kind==="column"?(e.dispatch(N(c)),"column"):(e.dispatch($(c)),r.kind):s?(se(e,t,a),"workspace"):null}function re(e,t){const a=t.match(/^\/workspace\/([^/]+)/),n=a&&a[1]!=="new"?a[1]:null;if(!n)return null;const c=F(n);return e.dispatch(c),q.select(e.state,n)}function A(e,t,a,n){const c=d.select(e.state),s=t==="last"?c.length-1:t;return s<0||s>=c.length?null:(e.dispatch(x(s)),f(e,a,n))}function we({isMac:e,register:t,store:a,getCurrentPath:n,navigate:c,openNewWorkspace:s,onCreateAgent:r,onCreateNote:w,onCreateTerminal:_,onCreateBrowser:m,onWorkspaceTabMoved:W,closeWindow:O,resolveBinding:k}){const u=e?{meta:!0}:{ctrl:!0},P=X("TOGGLE_SIDEBAR",e),b=o=>()=>o(n()),L=o=>()=>{const p=n().match(/^\/workspace\/([^/]+)/);p?.[1]&&p[1]!=="new"&&o(p[1])},i=o=>k?{binding:()=>k(o)}:{};t({...i("global.new-space"),...u,key:"n",global:!0,description:l.workspace_shortcuts_newSpace_description(),action:s}),t({...i("panel.toggle-sidebar"),...P,global:!0,description:T.TOGGLE_SIDEBAR.label,action:()=>a.dispatch(R())}),t({...i("navigation.new-tab"),...u,key:"t",global:!0,description:l.workspace_shortcuts_newPanel_description(),action:b(o=>re(a,o))});for(const[o,p,h,v]of[["workspace.new-agent","a",l.ui_shortcuts_newAgent_label(),r],["workspace.new-note","n",l.layout_panelEmptyState_newItem_tooltip({label:l.layout_panelEmptyState_note_label()}),w],["workspace.new-terminal","t",l.layout_panelEmptyState_newItem_tooltip({label:l.layout_panelEmptyState_terminal_label()}),_],["workspace.new-browser","b",l.layout_panelEmptyState_newItem_tooltip({label:l.layout_panelEmptyState_browser_label()}),m]])v&&t({...i(o),...u,key:p,alt:!0,global:!0,allowInTerminal:!0,description:h,action:L(v)});t({...i("navigation.close-tab"),...u,key:"w",global:!0,description:l.workspace_shortcuts_closePanelTab_description(),action:b(o=>ce(a,o,{navigate:c,closeWindow:O}))}),t({...i("navigation.close-space-tab"),...u,key:"w",shift:!0,global:!0,description:l.workspace_shortcuts_closeSpaceTab_description(),action:b(o=>te(a,o,c))}),t({...i("navigation.reopen-tab"),...u,key:"t",shift:!0,global:!0,description:l.workspace_shortcuts_reopenClosedTabOrSpace_description(),action:b(o=>le(a,o,c))}),t({...i("navigation.move-space-tab-left"),...u,key:"ArrowLeft",alt:!0,shift:!0,global:!0,description:T.MOVE_SPACE_TAB_LEFT.label,action:()=>{const o=I(a,"left");o&&W?.({workspaceId:o,position:d.select(a.state).indexOf(o)+1})}}),t({...i("navigation.move-space-tab-right"),...u,key:"ArrowRight",alt:!0,shift:!0,global:!0,description:T.MOVE_SPACE_TAB_RIGHT.label,action:()=>{const o=I(a,"right");o&&W?.({workspaceId:o,position:d.select(a.state).indexOf(o)+1})}});for(const[o,p]of[["next",!1],["previous",!0]])t({...i(o==="next"?"global.next-space":"global.previous-space"),key:"Tab",ctrl:!0,shift:p,global:!0,description:o==="next"?l.workspace_shortcuts_nextSpaceTab_description():l.workspace_shortcuts_previousSpaceTab_description(),action:b(h=>ee(a,o,h,c))});for(let o=1;o<=9;o++)t({...k?{binding:()=>k("navigation.go-to-tab").replace(/([1-8])-9$/,String(o))}:{},...u,key:String(o),global:!0,description:o===1?l.home_navigation_description():o===9?l.workspace_shortcuts_selectLastSpaceTab_description():l.workspace_shortcuts_selectSpaceTab_description({digit:o}),action:b(p=>o===1?c("/"):A(a,o===9?"last":o-2,p,c))})}export{ce as c,we as r};
@@ -1,2 +1,2 @@
1
- import{t as Mt,bq as ee,_ as Vr,a_ as ce,by as Tt,bu as he,bs as Jt,b as Ut,bo as c}from"./COCO5InB.js";import{bs as Rt,ca as $e,aD as e,bH as u,a5 as M,bA as P,W as s,bn as zt,bV as H,c9 as i,aA as te,c6 as Nt,ay as de,be as Xe,b$ as Qe,b_ as D,bO as g,bS as p,bl as S,aB as C,bj as Er,aw as et,ai as Ar,c5 as vr,a as pr,a7 as Le,aj as ct,cd as Wr,br as Br}from"./B8o4lNgr.js";import{B as gr,D as Nr}from"./Cdhgfy6h.js";import{s as tt,l as bt,k as ar,h as xt}from"./Crs9I2MT.js";import{c as Ft}from"./oALOmsvi.js";import{b as mr}from"./D2g8BuR1.js";import{G2 as A,mu as _r,tC as hr,tB as wr,I8 as Or,I9 as Hr,ei as qr,ej as Gr,HC as or,kJ as Ot,zu as ir,qC as nr,mQ as Kr,xc as Xr,a3 as sr,Gy as Yr,GN as Jr,m5 as Zr,i0 as Qr,mw as ea,td as ta,xz as ra,HB as aa}from"./BjFoJgFv.js";import{g as oa}from"./CoSk1zgY.js";import{a as ia,g as na,i as sa,c as la,h as da,d as ca,e as lr,f as ua,b as Ht}from"./DROi8p_h.js";import{bx as fa,bK as va,dj as pa}from"./DUT4V6mb.js";import{w as dr,d as ga}from"./BCu94obu.js";import{f as ma}from"./B6LKhrY2.js";import{n as qt}from"./CJvhopKt.js";import{f as Se,ax as _a}from"./C5Xi5eLp.js";import"./Dck4Okga.js";import{F as Ze,a9 as ha,ar as wa,aU as ba,a_ as Dt,cj as xa,ck as ya,bh as Pa,cG as $a,c0 as ka}from"./BDq7EC2K.js";import{g as Ia,i as Ca,w as cr}from"./bjkNeafo.js";import{c as Fa}from"./ChTqQfQN.js";import"./BlJs0v1V.js";import{M as Sa}from"./B5NXv3LV.js";import{i as Gt,b as Da,a as ja}from"./H2jLkRRS.js";import{C as Xt,p as Ma}from"./DjZWf4AT.js";import{M as Ta}from"./CcDZ8sih.js";import{t as Kt,u as br}from"./Bqoyy9yx.js";import"./hMX_6Iel.js";import"./1jz3AJ7K.js";import{M as St}from"./CpWqDujk.js";import{V as Ua}from"./DQPsLJmj.js";import{bC as Ra,aW as za}from"./D6eVIgjz.js";import{ag as La}from"./BCYRUItZ.js";const xr=A.createSelector((we,x)=>_r(we.pdfPreview.previews,x));var Va=C('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),Ea=C('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function Yt(we,x){if(new.target)return Mt({component:Yt,...we});Rt(x,!0);const ke=()=>he(be,"$preview",rt),[rt,re]=Jt();let $=ee(x,"workspaceId",7),ae=ee(x,"filePath",7),Ie=ee(x,"gitRootId",7);const De=crypto.randomUUID(),be=xr(De),me=new WeakMap;let J=H(null),He=H(void 0),W=H(1),N=H(1),oe=H(!0),R=H(!1),Ve=H(null),Be=H(0);const xe=i(()=>ke()?.error??e(Ve)),je=i(()=>e(xe)==="missing"?c.file_pdf_missing_error():e(xe)==="large"?c.file_pdf_large_error():e(xe)==="invalid"?c.file_pdf_invalid_error():e(xe)==="password"?c.file_pdf_password_error():c.file_pdf_load_error());$e(()=>{const l=$(),y=ae();e(Be);const z=crypto.randomUUID();return A.dispatch(hr(De,z,l,y,...Ie()?[{gitRootId:Ie()}]:[])),()=>{A.dispatch(wr(De,z))}}),$e(()=>{const l=ke()?.url;let y=!1,z;if(u(J,null),u(Ve,null),u(oe,!0),u(W,1),u(N,1),!!l)return(async()=>{try{const{loadPdfDocument:K}=await Vr(async()=>{const{loadPdfDocument:_e}=await import("./BqoyBPEG.js");return{loadPdfDocument:_e}},[],import.meta.url);if(y)return;z=K(l);const ie=await z.promise;y||u(J,ie)}catch(K){if(y)return;u(Ve,K instanceof Error&&K.name==="PasswordException"?"password":K instanceof Error&&K.name==="InvalidPDFException"?"invalid":"load",!0)}finally{y||u(oe,!1)}})(),()=>{y=!0,z?.destroy()}}),$e(()=>{const l=e(J),y=e(He),z=e(W),K=e(N);if(!l||!y)return;let ie=!1,_e,U;const ne=()=>{if(!U)return;const X=(me.get(U)??1)-1;X?me.set(U,X):(me.delete(U),U.cleanup()),U=void 0};return u(R,!0),(async()=>{try{if(U=await l.getPage(z),me.set(U,(me.get(U)??0)+1),ie){ne();return}const X=U.getViewport({scale:K}),Z=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(X.width*X.height)));y.width=Math.ceil(X.width*Z),y.height=Math.ceil(X.height*Z),y.style.width=`${X.width}px`,y.style.height=`${X.height}px`,_e=U.render({canvas:y,viewport:X,transform:[Z,0,0,Z,0,0]}),await _e.promise}catch{ie||u(Ve,"invalid")}finally{ie||u(R,!1)}})(),()=>{ie=!0,_e?.cancel(),_e?_e.promise.then(ne,ne):ne()}});var Ne={get workspaceId(){return $()},set workspaceId(l){$(l),te()},get filePath(){return ae()},set filePath(l){ae(l),te()},get gitRootId(){return Ie()},set gitRootId(l){Ie(l),te()},$set:Tt,$on:(l,y)=>Ut(x,l,y)},o=Ea(),d=M(o);{var T=l=>{{const y=K=>{Xe();var ie=Qe();D(()=>g(ie,e(je))),s(K,ie)};let z=i(()=>c.ui_combobox_retry_label());Ia(l,{onRetry:()=>Nt(Be),get retryLabel(){return e(z)},class:"m-auto",message:y,$$slots:{message:!0}})}},_=l=>{{let y=i(()=>c.file_pdf_loading_label());Ca(l,{get label(){return e(y)},count:1,class:"p-4"})}},w=l=>{var y=Va(),z=de(y),K=M(z);{let pe=i(()=>e(W)<=1);Se(K,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>Nt(W,-1),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.file_pdf_previous_label()]),s(ye,Pe)},$$slots:{default:!0}})}var ie=p(K,2),_e=S(ie,!0),U=p(ie,2);{let pe=i(()=>e(W)>=e(J).numPages);Se(U,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>Nt(W),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.file_pdf_next_label()]),s(ye,Pe)},$$slots:{default:!0}})}var ne=p(U,2);{let pe=i(()=>e(N)<=.25);Se(ne,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>u(N,Math.max(.25,e(N)-.25),!0),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.editor_fileViewer_zoomOut_tooltip()]),s(ye,Pe)},$$slots:{default:!0}})}var X=p(ne,2),Z=S(X,!0),at=p(X,2);{let pe=i(()=>e(N)>=3);Se(at,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>u(N,Math.min(3,e(N)+.25),!0),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.editor_fileViewer_zoomIn_tooltip()]),s(ye,Pe)},$$slots:{default:!0}})}P(z);var ot=p(z,2),qe=M(ot);let Ye;mr(qe,pe=>u(He,pe),()=>e(He)),P(ot),D((pe,ye,Ge)=>{g(_e,pe),g(Z,ye),tt(ot,"aria-busy",e(R)),tt(qe,"aria-label",Ge),Ye=bt(qe,"",Ye,{visibility:e(R)?"hidden":"visible"})},[()=>c.file_pdf_page_label({page:Kt(e(W)),total:Kt(e(J).numPages)}),()=>br(e(N),{style:"percent"}),()=>c.file_pdf_canvas_ariaLabel({name:ae(),page:Kt(e(W))})]),s(l,y)};ce(d,l=>{e(xe)?l(T):e(oe)||ke()?.status==="loading"?l(_,1):e(J)&&l(w,2)})}P(o),s(we,o);var Ee=zt(Ne);return re(),Ee}const Aa=A.createSelector((we,x)=>_r(we.videoPreview.previews,x));var Wa=C('<p role="status"> </p>'),Ba=C('<p role="alert"> </p>'),Na=C('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),Oa=C('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),Ha=C('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function yr(we,x){if(new.target)return Mt({component:yr,...we});Rt(x,!0);const ke=()=>he(He,"$preview",rt),[rt,re]=Jt();let $=ee(x,"sourceUrl",7),ae=ee(x,"fileName",7),Ie=ee(x,"allowDownload",7),De=ee(x,"downloading",7),be=ee(x,"onDownload",7),me=H(null);const J=crypto.randomUUID(),He=Aa(J),W=i(()=>ke()?.status==="loading"),N=i(()=>e(me)??ke()?.error);let oe=!1,R=!1;Er(()=>{R=!0,A.dispatch(Or(J))});function Ve(){if(R||e(W))return;const _=$().startsWith("workspace-file://")?new URL($()):null;if(oe||!_||!_.pathname.toLowerCase().endsWith(".mp4")){u(me,"unsupported");return}oe=!0,_.searchParams.set("preview","h264"),A.dispatch(Hr(J,_.hostname,_.toString()))}function Be(_){if(R)return;const w=_.currentTarget.error?.code;w===2?u(me,"network"):w!==1&&Ve()}var xe={get sourceUrl(){return $()},set sourceUrl(_){$(_),te()},get fileName(){return ae()},set fileName(_){ae(_),te()},get allowDownload(){return Ie()},set allowDownload(_){Ie(_),te()},get downloading(){return De()},set downloading(_){De(_),te()},get onDownload(){return be()},set onDownload(_){be(_),te()},$set:Tt,$on:(_,w)=>Ut(x,_,w)},je=Ha(),Ne=M(je);{var o=_=>{var w=Na(),Ee=M(w),l=S(Ee,!0),y=p(Ee,2);{var z=U=>{var ne=Wa(),X=S(ne,!0);D(Z=>g(X,Z),[()=>c.editor_fileViewer_videoPreparing_label()]),s(U,ne)},K=U=>{var ne=Ba(),X=S(ne,!0);D(Z=>g(X,Z),[()=>e(N)==="network"?c.editor_fileViewer_videoLoad_error():c.editor_fileViewer_videoUnsupported_label()]),s(U,ne)};ce(y,U=>{e(W)?U(z):U(K,-1)})}var ie=p(y,2);{var _e=U=>{Se(U,{variant:"secondary",size:"sm",get onclick(){return be()},get disabled(){return De()},children:(ne,X)=>{Xe();var Z=Qe();D(at=>g(Z,at),[()=>c.layout_fileTab_downloadFile_label()]),s(ne,Z)},$$slots:{default:!0}})};ce(ie,U=>{Ie()&&U(_e)})}P(w),D(()=>g(l,ae())),s(_,w)},d=_=>{var w=Oa(),Ee=S(w,!0);D(l=>{tt(w,"src",ke()?.url??$()),g(Ee,l)},[()=>c.editor_fileViewer_videoUnsupported_label()]),et("error",w,Be),et("loadedmetadata",w,l=>{l.currentTarget.videoWidth===0&&Ve()}),s(_,w)};ce(Ne,_=>{e(N)||e(W)?_(o):_(d,-1)})}P(je),s(we,je);var T=zt(xe);return re(),T}var qa=C('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),Ga=C('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Ka=C('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Xa=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),Ya=C("<!> ",1),Ja=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),Za=C('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),Qa=C('<td class="border border-border px-2 py-1 text-xs"> </td>'),eo=C("<tr></tr>"),to=C('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),ro=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),ao=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),oo=C('<div class="h-full flex flex-col"><!></div>');function jt(we,x){if(new.target)return Mt({component:jt,...we});Rt(x,!0);const ke=t=>{var a=qa(),f=de(a);{let O=i(()=>c.editor_fileViewer_zoomOut_tooltip());Se(f,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ne,get title(){return e(O)},children:(j,L)=>{Ze(j,{get icon(){return xa},size:"sm"})},$$slots:{default:!0}})}var m=p(f,2),h=S(m,!0),k=p(m,2);{let O=i(()=>c.editor_fileViewer_zoomIn_tooltip());Se(k,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:U,get title(){return e(O)},children:(j,L)=>{Ze(j,{get icon(){return ya},size:"sm"})},$$slots:{default:!0}})}Xe(2),D(()=>g(h,e(Ve))),s(t,a)},rt=Fa("FileViewer");let re=ee(x,"filePath",7),$=ee(x,"fileContent",7,""),ae=ee(x,"sourceUrl",7),Ie=ee(x,"language",7),De=ee(x,"isBinary",7),be=ee(x,"allowDownload",7,!0),me=ee(x,"onDownload",7),J=ee(x,"downloading",7,!1);const He=t=>{const a=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(a)?"image":a==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(a)?"video":["mp3","wav","ogg","m4a","flac"].includes(a)?"audio":a==="pdf"?"pdf":["md","markdown"].includes(a)?"markdown":a==="json"?"json":a==="csv"?"csv":["yaml","yml"].includes(a)?"yaml":a==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(a)?"archive":["exe","dll","so","dylib","wasm"].includes(a)?"binary":"text"},W=i(()=>He(re())),N=i(()=>re().split("/").pop()||c.editor_fileViewer_unknown_fallback());let oe=H(100),R=H(0);const Ve=i(()=>br(e(oe)/100,{style:"percent",maximumFractionDigits:0}));let Be=H(!1),xe=H(0),je=H(0),Ne=H(0),o=H(0),d=H(!1),T=null;function _(){const t=T;T=null,u(d,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function w(t){if(t.button!==0||!t.isPrimary||T)return;const a=t.currentTarget;a.setPointerCapture(t.pointerId),T={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:a},u(d,!0),t.preventDefault()}function Ee(t){if(!(!T||t.pointerId!==T.pointerId)){if((t.buttons&1)===0){_();return}u(Ne,T.viewport.scrollLeft,!0),u(o,T.viewport.scrollTop,!0),u(xe,e(xe)+(t.clientX-T.x)),u(je,e(je)+(t.clientY-T.y)),T.x=t.clientX,T.y=t.clientY}}function l(t){t.pointerId===T?.pointerId&&_()}$e(()=>{re(),ae(),e(oe),e(R),u(Ne,0),u(o,0)}),$e(()=>(re(),ae(),vr(()=>{_(),u(xe,0),u(je,0)}),_));const y=t=>{const a=t.split(".").pop()?.toLowerCase();return a==="jpg"||a==="jpeg"?"image/jpeg":a==="png"?"image/png":a==="gif"?"image/gif":a==="webp"?"image/webp":"application/octet-stream"},z=t=>{const a=t.split(".").pop()?.toLowerCase();if(a==="mp4")return"video/mp4";if(a==="webm")return"video/webm"},K=()=>{if(ae())return ae();if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():De()?`data:${y(re())};base64,${$()}`:`data:${y(re())};base64,${$()}`;if($()instanceof ArrayBuffer){const a=new Uint8Array($()).reduce((m,h)=>m+String.fromCharCode(h),""),f=btoa(a);return`data:${y(re())};base64,${f}`}return""},ie=()=>{if(ae())return ae();const t=z(re());if(!t)return"";if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():`data:${t};base64,${$()}`;const a=new Uint8Array($()),f=[],m=32768;for(let h=0;h<a.length;h+=m)f.push(String.fromCharCode(...a.subarray(h,h+m)));return`data:${t};base64,${btoa(f.join(""))}`},_e=()=>{const t=typeof $()=="string"?new TextEncoder().encode($()):new Uint8Array($()),a=[],f=32768;for(let m=0;m<t.length;m+=f)a.push(String.fromCharCode(...t.subarray(m,m+f)));return`data:image/svg+xml;base64,${btoa(a.join(""))}`},U=()=>{u(oe,Math.min(e(oe)+25,500),!0)},ne=()=>{u(oe,Math.max(e(oe)-25,25),!0)},X=()=>{u(R,(e(R)+90)%360)},Z=()=>{if(!be()||J())return;if(me()){me()();return}const t=document.createElement("a");t.href=e(W)==="video"?ie():e(W)==="svg"?_e():K(),t.download=e(N),t.click()},at=async()=>{try{const t=K(),a=new Image;a.crossOrigin="anonymous";const f=await new Promise((m,h)=>{a.onload=()=>{const k=document.createElement("canvas");k.width=a.naturalWidth,k.height=a.naturalHeight;const O=k.getContext("2d");if(!O){h(new Error("Failed to get canvas context"));return}O.drawImage(a,0,0),k.toBlob(j=>{j?m(j):h(new Error("Failed to create blob from canvas"))},"image/png",1)},a.onerror=()=>h(new Error("Failed to load image")),a.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":f})]),u(Be,!0),setTimeout(()=>u(Be,!1),2e3)}catch(t){rt.error("Failed to copy image:",t)}},ot=t=>{try{const a=JSON.parse(t);return JSON.stringify(a,null,2)}catch{return t}},qe=t=>t.split(`
1
+ import{t as Mt,bq as ee,_ as Vr,a_ as ce,by as Tt,bu as he,bs as Jt,b as Ut,bo as c}from"./COCO5InB.js";import{bs as Rt,ca as $e,aD as e,bH as u,a5 as M,bA as P,W as s,bn as zt,bV as H,c9 as i,aA as te,c6 as Nt,ay as de,be as Xe,b$ as Qe,b_ as D,bO as g,bS as p,bl as S,aB as C,bj as Er,aw as et,ai as Ar,c5 as vr,a as pr,a7 as Le,aj as ct,cd as Wr,br as Br}from"./B8o4lNgr.js";import{B as gr,D as Nr}from"./Cdhgfy6h.js";import{s as tt,l as bt,k as ar,h as xt}from"./Crs9I2MT.js";import{c as Ft}from"./oALOmsvi.js";import{b as mr}from"./D2g8BuR1.js";import{G2 as A,mu as _r,tC as hr,tB as wr,I8 as Or,I9 as Hr,ei as qr,ej as Gr,HC as or,kJ as Ot,zu as ir,qC as nr,mQ as Kr,xc as Xr,a3 as sr,Gy as Yr,GN as Jr,m5 as Zr,i0 as Qr,mw as ea,td as ta,xz as ra,HB as aa}from"./BjFoJgFv.js";import{g as oa}from"./CoSk1zgY.js";import{a as ia,g as na,i as sa,c as la,h as da,d as ca,e as lr,f as ua,b as Ht}from"./DROi8p_h.js";import{bx as fa,bK as va,dj as pa}from"./DUT4V6mb.js";import{w as dr,d as ga}from"./BCu94obu.js";import{f as ma}from"./B6LKhrY2.js";import{n as qt}from"./CJvhopKt.js";import{f as Se,ax as _a}from"./C5Xi5eLp.js";import"./Dck4Okga.js";import{F as Ze,a9 as ha,ar as wa,aU as ba,a_ as Dt,cj as xa,ck as ya,bh as Pa,cG as $a,c0 as ka}from"./BDq7EC2K.js";import{g as Ia,i as Ca,w as cr}from"./bjkNeafo.js";import{c as Fa}from"./ChTqQfQN.js";import"./BlJs0v1V.js";import{M as Sa}from"./B3kscBFg.js";import{i as Gt,b as Da,a as ja}from"./H2jLkRRS.js";import{C as Xt,p as Ma}from"./DjZWf4AT.js";import{M as Ta}from"./DntMfhqH.js";import{t as Kt,u as br}from"./Bqoyy9yx.js";import"./hMX_6Iel.js";import"./1jz3AJ7K.js";import{M as St}from"./CpWqDujk.js";import{V as Ua}from"./DQPsLJmj.js";import{bC as Ra,aW as za}from"./BzzEl9C8.js";import{ag as La}from"./C60Ik0Qb.js";const xr=A.createSelector((we,x)=>_r(we.pdfPreview.previews,x));var Va=C('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),Ea=C('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function Yt(we,x){if(new.target)return Mt({component:Yt,...we});Rt(x,!0);const ke=()=>he(be,"$preview",rt),[rt,re]=Jt();let $=ee(x,"workspaceId",7),ae=ee(x,"filePath",7),Ie=ee(x,"gitRootId",7);const De=crypto.randomUUID(),be=xr(De),me=new WeakMap;let J=H(null),He=H(void 0),W=H(1),N=H(1),oe=H(!0),R=H(!1),Ve=H(null),Be=H(0);const xe=i(()=>ke()?.error??e(Ve)),je=i(()=>e(xe)==="missing"?c.file_pdf_missing_error():e(xe)==="large"?c.file_pdf_large_error():e(xe)==="invalid"?c.file_pdf_invalid_error():e(xe)==="password"?c.file_pdf_password_error():c.file_pdf_load_error());$e(()=>{const l=$(),y=ae();e(Be);const z=crypto.randomUUID();return A.dispatch(hr(De,z,l,y,...Ie()?[{gitRootId:Ie()}]:[])),()=>{A.dispatch(wr(De,z))}}),$e(()=>{const l=ke()?.url;let y=!1,z;if(u(J,null),u(Ve,null),u(oe,!0),u(W,1),u(N,1),!!l)return(async()=>{try{const{loadPdfDocument:K}=await Vr(async()=>{const{loadPdfDocument:_e}=await import("./BqoyBPEG.js");return{loadPdfDocument:_e}},[],import.meta.url);if(y)return;z=K(l);const ie=await z.promise;y||u(J,ie)}catch(K){if(y)return;u(Ve,K instanceof Error&&K.name==="PasswordException"?"password":K instanceof Error&&K.name==="InvalidPDFException"?"invalid":"load",!0)}finally{y||u(oe,!1)}})(),()=>{y=!0,z?.destroy()}}),$e(()=>{const l=e(J),y=e(He),z=e(W),K=e(N);if(!l||!y)return;let ie=!1,_e,U;const ne=()=>{if(!U)return;const X=(me.get(U)??1)-1;X?me.set(U,X):(me.delete(U),U.cleanup()),U=void 0};return u(R,!0),(async()=>{try{if(U=await l.getPage(z),me.set(U,(me.get(U)??0)+1),ie){ne();return}const X=U.getViewport({scale:K}),Z=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(X.width*X.height)));y.width=Math.ceil(X.width*Z),y.height=Math.ceil(X.height*Z),y.style.width=`${X.width}px`,y.style.height=`${X.height}px`,_e=U.render({canvas:y,viewport:X,transform:[Z,0,0,Z,0,0]}),await _e.promise}catch{ie||u(Ve,"invalid")}finally{ie||u(R,!1)}})(),()=>{ie=!0,_e?.cancel(),_e?_e.promise.then(ne,ne):ne()}});var Ne={get workspaceId(){return $()},set workspaceId(l){$(l),te()},get filePath(){return ae()},set filePath(l){ae(l),te()},get gitRootId(){return Ie()},set gitRootId(l){Ie(l),te()},$set:Tt,$on:(l,y)=>Ut(x,l,y)},o=Ea(),d=M(o);{var T=l=>{{const y=K=>{Xe();var ie=Qe();D(()=>g(ie,e(je))),s(K,ie)};let z=i(()=>c.ui_combobox_retry_label());Ia(l,{onRetry:()=>Nt(Be),get retryLabel(){return e(z)},class:"m-auto",message:y,$$slots:{message:!0}})}},_=l=>{{let y=i(()=>c.file_pdf_loading_label());Ca(l,{get label(){return e(y)},count:1,class:"p-4"})}},w=l=>{var y=Va(),z=de(y),K=M(z);{let pe=i(()=>e(W)<=1);Se(K,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>Nt(W,-1),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.file_pdf_previous_label()]),s(ye,Pe)},$$slots:{default:!0}})}var ie=p(K,2),_e=S(ie,!0),U=p(ie,2);{let pe=i(()=>e(W)>=e(J).numPages);Se(U,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>Nt(W),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.file_pdf_next_label()]),s(ye,Pe)},$$slots:{default:!0}})}var ne=p(U,2);{let pe=i(()=>e(N)<=.25);Se(ne,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>u(N,Math.max(.25,e(N)-.25),!0),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.editor_fileViewer_zoomOut_tooltip()]),s(ye,Pe)},$$slots:{default:!0}})}var X=p(ne,2),Z=S(X,!0),at=p(X,2);{let pe=i(()=>e(N)>=3);Se(at,{variant:"ghost",size:"compact",get disabled(){return e(pe)},onclick:()=>u(N,Math.min(3,e(N)+.25),!0),children:(ye,Ge)=>{Xe();var Pe=Qe();D(ue=>g(Pe,ue),[()=>c.editor_fileViewer_zoomIn_tooltip()]),s(ye,Pe)},$$slots:{default:!0}})}P(z);var ot=p(z,2),qe=M(ot);let Ye;mr(qe,pe=>u(He,pe),()=>e(He)),P(ot),D((pe,ye,Ge)=>{g(_e,pe),g(Z,ye),tt(ot,"aria-busy",e(R)),tt(qe,"aria-label",Ge),Ye=bt(qe,"",Ye,{visibility:e(R)?"hidden":"visible"})},[()=>c.file_pdf_page_label({page:Kt(e(W)),total:Kt(e(J).numPages)}),()=>br(e(N),{style:"percent"}),()=>c.file_pdf_canvas_ariaLabel({name:ae(),page:Kt(e(W))})]),s(l,y)};ce(d,l=>{e(xe)?l(T):e(oe)||ke()?.status==="loading"?l(_,1):e(J)&&l(w,2)})}P(o),s(we,o);var Ee=zt(Ne);return re(),Ee}const Aa=A.createSelector((we,x)=>_r(we.videoPreview.previews,x));var Wa=C('<p role="status"> </p>'),Ba=C('<p role="alert"> </p>'),Na=C('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),Oa=C('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),Ha=C('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function yr(we,x){if(new.target)return Mt({component:yr,...we});Rt(x,!0);const ke=()=>he(He,"$preview",rt),[rt,re]=Jt();let $=ee(x,"sourceUrl",7),ae=ee(x,"fileName",7),Ie=ee(x,"allowDownload",7),De=ee(x,"downloading",7),be=ee(x,"onDownload",7),me=H(null);const J=crypto.randomUUID(),He=Aa(J),W=i(()=>ke()?.status==="loading"),N=i(()=>e(me)??ke()?.error);let oe=!1,R=!1;Er(()=>{R=!0,A.dispatch(Or(J))});function Ve(){if(R||e(W))return;const _=$().startsWith("workspace-file://")?new URL($()):null;if(oe||!_||!_.pathname.toLowerCase().endsWith(".mp4")){u(me,"unsupported");return}oe=!0,_.searchParams.set("preview","h264"),A.dispatch(Hr(J,_.hostname,_.toString()))}function Be(_){if(R)return;const w=_.currentTarget.error?.code;w===2?u(me,"network"):w!==1&&Ve()}var xe={get sourceUrl(){return $()},set sourceUrl(_){$(_),te()},get fileName(){return ae()},set fileName(_){ae(_),te()},get allowDownload(){return Ie()},set allowDownload(_){Ie(_),te()},get downloading(){return De()},set downloading(_){De(_),te()},get onDownload(){return be()},set onDownload(_){be(_),te()},$set:Tt,$on:(_,w)=>Ut(x,_,w)},je=Ha(),Ne=M(je);{var o=_=>{var w=Na(),Ee=M(w),l=S(Ee,!0),y=p(Ee,2);{var z=U=>{var ne=Wa(),X=S(ne,!0);D(Z=>g(X,Z),[()=>c.editor_fileViewer_videoPreparing_label()]),s(U,ne)},K=U=>{var ne=Ba(),X=S(ne,!0);D(Z=>g(X,Z),[()=>e(N)==="network"?c.editor_fileViewer_videoLoad_error():c.editor_fileViewer_videoUnsupported_label()]),s(U,ne)};ce(y,U=>{e(W)?U(z):U(K,-1)})}var ie=p(y,2);{var _e=U=>{Se(U,{variant:"secondary",size:"sm",get onclick(){return be()},get disabled(){return De()},children:(ne,X)=>{Xe();var Z=Qe();D(at=>g(Z,at),[()=>c.layout_fileTab_downloadFile_label()]),s(ne,Z)},$$slots:{default:!0}})};ce(ie,U=>{Ie()&&U(_e)})}P(w),D(()=>g(l,ae())),s(_,w)},d=_=>{var w=Oa(),Ee=S(w,!0);D(l=>{tt(w,"src",ke()?.url??$()),g(Ee,l)},[()=>c.editor_fileViewer_videoUnsupported_label()]),et("error",w,Be),et("loadedmetadata",w,l=>{l.currentTarget.videoWidth===0&&Ve()}),s(_,w)};ce(Ne,_=>{e(N)||e(W)?_(o):_(d,-1)})}P(je),s(we,je);var T=zt(xe);return re(),T}var qa=C('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),Ga=C('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Ka=C('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),Xa=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),Ya=C("<!> ",1),Ja=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),Za=C('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),Qa=C('<td class="border border-border px-2 py-1 text-xs"> </td>'),eo=C("<tr></tr>"),to=C('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),ro=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),ao=C('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),oo=C('<div class="h-full flex flex-col"><!></div>');function jt(we,x){if(new.target)return Mt({component:jt,...we});Rt(x,!0);const ke=t=>{var a=qa(),f=de(a);{let O=i(()=>c.editor_fileViewer_zoomOut_tooltip());Se(f,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:ne,get title(){return e(O)},children:(j,L)=>{Ze(j,{get icon(){return xa},size:"sm"})},$$slots:{default:!0}})}var m=p(f,2),h=S(m,!0),k=p(m,2);{let O=i(()=>c.editor_fileViewer_zoomIn_tooltip());Se(k,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:U,get title(){return e(O)},children:(j,L)=>{Ze(j,{get icon(){return ya},size:"sm"})},$$slots:{default:!0}})}Xe(2),D(()=>g(h,e(Ve))),s(t,a)},rt=Fa("FileViewer");let re=ee(x,"filePath",7),$=ee(x,"fileContent",7,""),ae=ee(x,"sourceUrl",7),Ie=ee(x,"language",7),De=ee(x,"isBinary",7),be=ee(x,"allowDownload",7,!0),me=ee(x,"onDownload",7),J=ee(x,"downloading",7,!1);const He=t=>{const a=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(a)?"image":a==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(a)?"video":["mp3","wav","ogg","m4a","flac"].includes(a)?"audio":a==="pdf"?"pdf":["md","markdown"].includes(a)?"markdown":a==="json"?"json":a==="csv"?"csv":["yaml","yml"].includes(a)?"yaml":a==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(a)?"archive":["exe","dll","so","dylib","wasm"].includes(a)?"binary":"text"},W=i(()=>He(re())),N=i(()=>re().split("/").pop()||c.editor_fileViewer_unknown_fallback());let oe=H(100),R=H(0);const Ve=i(()=>br(e(oe)/100,{style:"percent",maximumFractionDigits:0}));let Be=H(!1),xe=H(0),je=H(0),Ne=H(0),o=H(0),d=H(!1),T=null;function _(){const t=T;T=null,u(d,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function w(t){if(t.button!==0||!t.isPrimary||T)return;const a=t.currentTarget;a.setPointerCapture(t.pointerId),T={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:a},u(d,!0),t.preventDefault()}function Ee(t){if(!(!T||t.pointerId!==T.pointerId)){if((t.buttons&1)===0){_();return}u(Ne,T.viewport.scrollLeft,!0),u(o,T.viewport.scrollTop,!0),u(xe,e(xe)+(t.clientX-T.x)),u(je,e(je)+(t.clientY-T.y)),T.x=t.clientX,T.y=t.clientY}}function l(t){t.pointerId===T?.pointerId&&_()}$e(()=>{re(),ae(),e(oe),e(R),u(Ne,0),u(o,0)}),$e(()=>(re(),ae(),vr(()=>{_(),u(xe,0),u(je,0)}),_));const y=t=>{const a=t.split(".").pop()?.toLowerCase();return a==="jpg"||a==="jpeg"?"image/jpeg":a==="png"?"image/png":a==="gif"?"image/gif":a==="webp"?"image/webp":"application/octet-stream"},z=t=>{const a=t.split(".").pop()?.toLowerCase();if(a==="mp4")return"video/mp4";if(a==="webm")return"video/webm"},K=()=>{if(ae())return ae();if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():De()?`data:${y(re())};base64,${$()}`:`data:${y(re())};base64,${$()}`;if($()instanceof ArrayBuffer){const a=new Uint8Array($()).reduce((m,h)=>m+String.fromCharCode(h),""),f=btoa(a);return`data:${y(re())};base64,${f}`}return""},ie=()=>{if(ae())return ae();const t=z(re());if(!t)return"";if(typeof $()=="string")return $().startsWith("data:")||$().startsWith("http")?$():`data:${t};base64,${$()}`;const a=new Uint8Array($()),f=[],m=32768;for(let h=0;h<a.length;h+=m)f.push(String.fromCharCode(...a.subarray(h,h+m)));return`data:${t};base64,${btoa(f.join(""))}`},_e=()=>{const t=typeof $()=="string"?new TextEncoder().encode($()):new Uint8Array($()),a=[],f=32768;for(let m=0;m<t.length;m+=f)a.push(String.fromCharCode(...t.subarray(m,m+f)));return`data:image/svg+xml;base64,${btoa(a.join(""))}`},U=()=>{u(oe,Math.min(e(oe)+25,500),!0)},ne=()=>{u(oe,Math.max(e(oe)-25,25),!0)},X=()=>{u(R,(e(R)+90)%360)},Z=()=>{if(!be()||J())return;if(me()){me()();return}const t=document.createElement("a");t.href=e(W)==="video"?ie():e(W)==="svg"?_e():K(),t.download=e(N),t.click()},at=async()=>{try{const t=K(),a=new Image;a.crossOrigin="anonymous";const f=await new Promise((m,h)=>{a.onload=()=>{const k=document.createElement("canvas");k.width=a.naturalWidth,k.height=a.naturalHeight;const O=k.getContext("2d");if(!O){h(new Error("Failed to get canvas context"));return}O.drawImage(a,0,0),k.toBlob(j=>{j?m(j):h(new Error("Failed to create blob from canvas"))},"image/png",1)},a.onerror=()=>h(new Error("Failed to load image")),a.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":f})]),u(Be,!0),setTimeout(()=>u(Be,!1),2e3)}catch(t){rt.error("Failed to copy image:",t)}},ot=t=>{try{const a=JSON.parse(t);return JSON.stringify(a,null,2)}catch{return t}},qe=t=>t.split(`
2
2
  `).map(f=>f.split(",").map(m=>m.trim()));var Ye={get filePath(){return re()},set filePath(t){re(t),te()},get fileContent(){return $()},set fileContent(t=""){$(t),te()},get sourceUrl(){return ae()},set sourceUrl(t){ae(t),te()},get language(){return Ie()},set language(t){Ie(t),te()},get isBinary(){return De()},set isBinary(t){De(t),te()},get allowDownload(){return be()},set allowDownload(t=!0){be(t),te()},get onDownload(){return me()},set onDownload(t){me(t),te()},get downloading(){return J()},set downloading(t=!1){J(t),te()},$set:Tt,$on:(t,a)=>Ut(x,t,a)},pe=oo();et("blur",pr,_);var ye=M(pe);{var Ge=t=>{var a=Ga(),f=M(a),m=M(f);ke(m);var h=p(m,2);{let Q=i(()=>c.editor_fileViewer_rotate_tooltip());Se(h,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:X,get title(){return e(Q)},children:(ge,Me)=>{Ze(ge,{get icon(){return ha},size:"sm"})},$$slots:{default:!0}})}var k=p(h,4);{let Q=i(()=>c.editor_fileViewer_copyImage_tooltip());Se(k,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:at,get title(){return e(Q)},children:(ge,Me)=>{var Ce=Le(),Vt=de(Ce);{var ut=Fe=>{Ze(Fe,{get icon(){return wa},size:"sm",class:"text-green-500"})},kt=Fe=>{Ze(Fe,{get icon(){return ba},size:"sm"})};ce(Vt,Fe=>{e(Be)?Fe(ut):Fe(kt,-1)})}s(ge,Ce)},$$slots:{default:!0}})}var O=p(k,2);{let Q=i(()=>!be()||J()),ge=i(()=>c.editor_fileViewer_download_tooltip());Se(O,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:Z,get disabled(){return e(Q)},get title(){return e(ge)},children:(Me,Ce)=>{Ze(Me,{get icon(){return Dt},size:"sm"})},$$slots:{default:!0}})}var j=p(O,2),L=S(j,!0);P(f);var V=p(f,2),se=S(V);P(a),D(Q=>{g(L,e(N)),ar(V,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(d)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),bt(V,`--pan-scroll-x: ${e(Ne)??""}px; --pan-scroll-y: ${e(o)??""}px;`),tt(se,"src",Q),tt(se,"alt",e(N)),bt(se,`translate: ${e(xe)??""}px ${e(je)??""}px; transform: scale(${e(oe)/100}) rotate(${e(R)??""}deg); transition: transform 0.2s;`)},[()=>K()]),ct("pointerdown",V,w),ct("pointermove",V,Ee),ct("pointerup",V,l),et("pointercancel",V,l),et("lostpointercapture",V,l),s(t,a)},Pe=t=>{var a=Ka(),f=M(a),m=M(f);ke(m);var h=p(m,2);{let V=i(()=>!be()||J()),se=i(()=>c.editor_fileViewer_download_tooltip());Se(h,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:Z,get disabled(){return e(V)},get title(){return e(se)},children:(Q,ge)=>{Ze(Q,{get icon(){return Dt},size:"sm"})},$$slots:{default:!0}})}var k=p(h,2),O=S(k,!0);P(f);var j=p(f,2),L=S(j);P(a),D(V=>{g(O,e(N)),ar(j,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(d)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),bt(j,`--pan-scroll-x: ${e(Ne)??""}px; --pan-scroll-y: ${e(o)??""}px;`),tt(L,"src",V),tt(L,"alt",e(N)),bt(L,`translate: ${e(xe)??""}px ${e(je)??""}px; transform: scale(${e(oe)/100});`)},[()=>_e()]),ct("pointerdown",j,w),ct("pointermove",j,Ee),ct("pointerup",j,l),et("pointercancel",j,l),et("lostpointercapture",j,l),s(t,a)},ue=t=>{const a=i(ie);var f=Le(),m=de(f);gr(m,()=>re()+e(a),h=>{yr(h,{get sourceUrl(){return e(a)},get fileName(){return e(N)},get allowDownload(){return be()},get downloading(){return J()},onDownload:Z})}),s(t,f)},it=t=>{var a=Xa(),f=p(M(a),2),m=S(f,!0),h=p(f,2),k=M(h),O=p(k);P(h),P(a),D((j,L)=>{g(m,e(N)),tt(k,"src",j),g(O,` ${L??""}`)},[()=>K(),()=>c.editor_fileViewer_audioUnsupported_label()]),s(t,a)},yt=t=>{var a=Ja(),f=p(M(a),2),m=S(f,!0),h=p(f,2);{let k=i(()=>!be()||J());Se(h,{size:"sm",variant:"secondary",onclick:Z,get disabled(){return e(k)},children:(O,j)=>{var L=Ya(),V=de(L);Ze(V,{get icon(){return Dt},size:"sm",class:"mr-2"});var se=p(V);D(Q=>g(se,` ${Q??""}`),[()=>c.editor_fileViewer_downloadPdf_label()]),s(O,L)},$$slots:{default:!0}})}P(a),D(k=>g(m,k),[()=>c.editor_fileViewer_pdfUnavailable_label()]),s(t,a)},lt=t=>{{let a=i(()=>ot($().toString()));Xt(t,{get value(){return e(a)},language:"json",get fileName(){return re()},lineNumbers:!0,readOnly:!0})}},Pt=t=>{const a=i(()=>qe($().toString()));var f=to(),m=M(f),h=M(m),k=M(h);xt(k,23,()=>e(a)[0]||[],(j,L)=>`header-${L}-${j}`,(j,L)=>{var V=Za(),se=S(V,!0);D(()=>g(se,e(L))),s(j,V)}),P(k),P(h);var O=p(h);xt(O,23,()=>e(a).slice(1),(j,L)=>`row-${L}`,(j,L,V)=>{var se=eo();xt(se,23,()=>e(L),(Q,ge)=>`cell-${e(V)}-${ge}`,(Q,ge)=>{var Me=Qa(),Ce=S(Me,!0);D(()=>g(Ce,e(ge))),s(Q,Me)}),P(se),s(j,se)}),P(O),P(m),P(f),s(t,f)},Lt=t=>{var a=ro(),f=p(M(a),2),m=S(f,!0),h=p(f,2),k=S(h,!0);P(a),D(O=>{g(m,e(N)),g(k,O)},[()=>c.editor_fileViewer_archive_label()]),s(t,a)},$t=t=>{var a=ao(),f=p(M(a),2),m=S(f,!0),h=p(f,2),k=S(h,!0);P(a),D(O=>{g(m,e(N)),g(k,O)},[()=>c.editor_fileViewer_binary_label()]),s(t,a)},Je=t=>{{let a=i(()=>$().toString());Xt(t,{get value(){return e(a)},get language(){return Ie()},get fileName(){return re()},lineNumbers:!0,highlightActiveLine:!0})}};ce(ye,t=>{e(W)==="image"?t(Ge):e(W)==="svg"?t(Pe,1):e(W)==="video"?t(ue,2):e(W)==="audio"?t(it,3):e(W)==="pdf"?t(yt,4):e(W)==="json"?t(lt,5):e(W)==="csv"?t(Pt,6):e(W)==="archive"?t(Lt,7):e(W)==="binary"?t($t,8):t(Je,-1)})}return P(pe),s(we,pe),zt(Ye)}Ar(["pointerdown","pointermove","pointerup"]);var io=C("<!> <!>",1),no=C("<!> <!> <!>",1),so=C('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p> </p> <p class="text-xs"> </p></div>'),ur=C('<div class="flex h-full items-center justify-center p-4 text-subtle"><p role="alert"> </p></div>'),lo=C('<div class="flex h-full items-center justify-center text-subtle"><p> </p></div>'),fr=C('<div class="flex items-center justify-center h-full text-subtle"><p> </p></div>'),co=C('<div class="flex items-center gap-3"><!> <!></div>'),uo=C('<div class="flex flex-col h-full"><div class="flex-1 p-4 space-y-2"></div></div>'),fo=C("<li><!></li>"),vo=C('<p class="text-xs mt-2"> </p> <ul class="flex flex-col items-center gap-1"></ul>',1),po=C('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p class="text-danger"> </p> <p class="text-xs"> </p> <p class="text-xs font-mono"> </p> <!></div>'),go=C('<div class="flex flex-col items-center justify-center h-full text-subtle gap-3 p-4"><p> </p> <p class="text-xs break-all"> </p> <!></div>'),mo=C('<div class="h-full overflow-auto p-4"><!></div>');function _o(we,x){if(new.target)return Mt({component:_o,...we});Rt(x,!0);const ke=()=>he(Pe,"$workspace",R),rt=()=>he(K,"$fileContentStore",R),re=()=>he(ie,"$fileLoadingStore",R),$=()=>he(_e,"$fileSavingStore",R),ae=()=>he(U,"$fileErrorStore",R),Ie=()=>he(ne,"$fileNotFoundCandidatesStore",R),De=()=>he(X,"$isFileBinaryStore",R),be=()=>he(Z,"$isFileDirtyStore",R),me=()=>he(at,"$fileLastUpdatedStore",R),J=()=>he(ot,"$ftChanges$",R),He=()=>he(Ge,"$gutterRead$",R),W=()=>he(je,"$lineWrapping",R),N=()=>he(Ne,"$diffIndicators",R),oe=()=>he(pe,"$rootMediaPreview",R),[R,Ve]=Jt(),Be=r=>{var n=io(),I=de(n);{var F=ve=>{var Ae=Le(),Oe=de(Ae);Ft(Oe,()=>St,(dt,pt)=>{pt(dt,{get icon(){return Pa},get label(){return e(f)},disabled:!0})}),s(ve,Ae)};ce(I,ve=>{!e(se)&&!e(l)&&!e(Je)&&ve(F)})}var fe=p(I,2);{var Te=ve=>{{let Ae=i(()=>!e(It)||!e(L)),Oe=i(()=>!e(l)&&(!e(It)||!e(L)));Ua(ve,{embedded:!0,showFold:!1,showSplit:!1,get showPreview(){return e(It)},get previewEnabled(){return e(L)},onTogglePreview:()=>u(L,!e(L)),get showWrap(){return e(Ae)},get wrapEnabled(){return W()},onToggleWrap:()=>A.dispatch(Jr()),get showDiff(){return e(Oe)},get diffEnabled(){return N()},onToggleDiff:()=>A.dispatch(Yr())})}};ce(fe,ve=>{o().filePath&&!e(se)&&!e(Je)&&ve(Te)})}s(r,n)},xe=r=>{var n=Le(),I=de(n);{var F=fe=>{var Te=no(),ve=de(Te);{var Ae=We=>{var Ke=Le(),nt=de(Ke);{let gt=i(()=>c.layout_fileTab_goToChanges_tooltip());Ft(nt,()=>St,(mt,_t)=>{_t(mt,{get icon(){return ka},get label(){return e(gt)},onclick:Dr})})}s(We,Ke)};ce(ve,We=>{e($r)&&We(Ae)})}var Oe=p(ve,2);{var dt=We=>{var Ke=Le(),nt=de(Ke);{let gt=i(()=>c.layout_fileTab_downloadFile_label()),mt=i(()=>!e(ft)||e(Fe));Ft(nt,()=>St,(_t,At)=>{At(_t,{get icon(){return Dt},get label(){return e(gt)},onclick:Ct,get disabled(){return e(mt)}})})}s(We,Ke)};ce(Oe,We=>{e(Ce)&&We(dt)})}var pt=p(Oe,2);{let We=i(()=>c.layout_fileTab_deleteFile_tooltip());Ft(pt,()=>St,(Ke,nt)=>{nt(Ke,{get icon(){return $a},get label(){return e(We)},onclick:jr,destructive:!0})})}s(fe,Te)};ce(I,fe=>{o().filePath&&!e(se)&&!e(l)&&fe(F)})}s(r,n)},je=Ra(),Ne=za();let o=ee(x,"tab",7),d=ee(x,"workspaceId",7),T=ee(x,"isActive",7),_=ee(x,"isPanelFocused",7);$e(()=>{const r=d();if(!(!T()||!r||e(w)))return A.dispatch(qr(r,"files")),()=>A.dispatch(Gr(r,"files"))});const w=i(()=>typeof o().data?.gitRootId=="string"?o().data.gitRootId:void 0),Ee=i(()=>typeof o().data?.gitRootPath=="string"?o().data.gitRootPath:void 0),l=i(()=>!!e(w)),y=i(()=>o().filePath?ma(o().filePath,e(w)):o().filePath),z=Wr(e(y));$e(()=>{z.set(e(y))});const K=ia(d(),z),ie=na(d(),z),_e=sa(d(),z),U=la(d(),z),ne=da(d(),z),X=ca(d(),z),Z=lr(d(),z),at=ua(d(),z),ot=fa(d()),qe=oa(),Ye=crypto.randomUUID(),pe=xr(Ye),ye=`file-gutter:${crypto.randomUUID()}`,Ge=va(d(),ye),Pe=pa(d()),ue=i(()=>ke()?.worktreePath||ke()?.repositoryPath||ke()?.path||null),it=i(rt),yt=i(re),lt=i($),Pt=i(ae),Lt=5,$t=i(()=>(Ie()??[]).slice(0,Lt)),Je=i(De),t=i(be),a=i(me),f=i(()=>e(lt)?c.ui_saveIndicator_saving_tooltip():e(t)?c.ui_saveIndicator_autoSaving_tooltip():c.ui_saveIndicator_saved_tooltip());let m=H(null),h=H(Br([])),k=H(null),O=H(void 0),j=H(void 0),L=H(!0);$e(()=>{const r=o().data?.line,n=o().data?.jumpTimestamp;!r||n!==void 0&&n===e(j)||(u(j,n,!0),u(O,{line:r},!0),u(L,!1))});const V=i(()=>e(w)?dr(o().filePath,e(Ee)):null),se=i(()=>e(w)?!e(V):!!(o().filePath&&(Da(o().filePath)||e(ue)&&ja(o().filePath,e(ue))))),Q=i(()=>o().filePath&&e(ue)?Gt(o().filePath)?o().filePath:`${e(ue)}/${o().filePath}`:null),ge=i(()=>!!o().filePath&&/\.pdf$/i.test(o().filePath)),Me=i(()=>!!o().filePath&&/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(o().filePath)),Ce=i(()=>d()&&/^[A-Za-z0-9._-]+$/.test(d())?dr(o().filePath,e(ue)):null),Vt=i(()=>!e(w)&&e(Ce)?e(Ce).split("/").slice(0,-1).join("/"):void 0),ut=i(()=>e(ge)||e(Me)?e(Ce):null),kt=i(()=>e(w)&&e(Me)?{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",mp4:"video/mp4",webm:"video/webm"}[o().filePath?.split(".").pop()?.toLowerCase()??""]:void 0);$e(()=>{if(!T()||!e(w)||!e(V)||!e(kt))return;const r=crypto.randomUUID();return A.dispatch(hr(Ye,r,d(),e(V),{gitRootId:e(w),mimeType:e(kt)})),()=>A.dispatch(wr(Ye,r))});let Fe=H(!1);const ft=i(()=>!!e(Ce)&&!e(yt)&&(!e(Me)||e(k)===e(Ce))),Zt=i(()=>e(k)&&d()?`workspace-file://${d()}/${e(k).split("/").map(encodeURIComponent).join("/")}`:null),Et=i(()=>o().filePath?ea(o().filePath):"plaintext"),It=i(()=>e(Et)==="markdown");$e(()=>{if(!T()||e(ge)||e(w))return;const r=e(ut),n=o().filePath,I=d(),F=o().id;if(u(k,null),!r||!n||!I)return;let fe=!1;const Te=()=>!fe&&d()===I&&o().id===F&&o().filePath===n;return(async()=>{let ve=!1;try{ve=(await _a("file.stat",{workspaceId:I,path:r}))?.isFile===!0}catch{}if(!Te())return;if(ve){u(k,r,!0);return}if(!/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(r)){u(k,r,!0);return}const{candidates:Ae,truncated:Oe}=await Sa(I,r);if(Te()){if(!Oe&&Ae.length===1){A.dispatch(or(I,n,Ae[0],F));return}u(k,r,!0)}})(),()=>{fe=!0}});function Pr(r,n){return!!(r.file===n||r.relativePath===n||r.relativePath&&n.endsWith("/"+r.relativePath)||r.file&&n.endsWith("/"+r.file)||r.relativePath&&r.relativePath.endsWith("/"+n)||r.file&&r.file.endsWith("/"+n))}const vt=i(()=>e(l)||!o().filePath?null:J().find(r=>Pr(r,o().filePath))??null),$r=i(()=>!!e(vt));$e(()=>{if(e(l))return;const r=d(),n=o().filePath,I=e(ue);return()=>{if(!r||!n)return;const F=Ht.select(A.state,r,n);if(F?.kind!=="editable-text")return;const fe=Ot(F.localContent),Te=lr.select(A.state,r,n),ve=Gt(n)?n:I?`${I}/${n}`:null;Te&&ve&&A.dispatch(ir(r,n,ve,fe))}}),$e(()=>{const r=o().filePath,n=e(Q),I=d();if(!T())return;const F=!e(w)&&!!r&&Gt(r)&&!e(ue);r&&I&&!e(se)&&!e(Me)&&!e(ge)&&!F&&(e(w)&&e(V)&&e(y)?A.dispatch(nr(I,e(y),n??r,{gitRoot:{id:e(w),relativePath:e(V)}})):A.dispatch(nr(I,r,n??r)))});function kr(){return e(it)??""}function Ir(r){e(l)||e(Je)||!o().filePath||!d()||!e(Q)||A.dispatch(aa(d(),o().filePath,Ot(r)))}function Cr(){if(e(l)||e(Je)||!o().filePath||!e(Q)||e(it)===null||e(lt))return;const r=Ht.select(A.state,d(),o().filePath);r?.kind==="editable-text"&&A.dispatch(ir(d(),o().filePath,e(Q),Ot(r.localContent)))}function Fr(r){const n=o().filePath;!n||!d()||(A.dispatch(ra(d(),n)),A.dispatch(or(d(),n,r,o().id)))}$e(()=>{const r=o().filePath,n=e(vt);if(!r||!n){u(h,[],!0);return}if(!T())return;const I=d(),F=crypto.randomUUID();return A.dispatch(Kr(I,ye,F,{kind:"diffs",path:r,staged:n.stage==="staged"})),()=>{A.dispatch(Xr(I,ye,F))}}),$e(()=>{const r=He(),n=r?.result?.kind==="diffs"?r.result.chunks:[],I=n.find(F=>F.file===o().filePath)??n[0];u(h,I?Ma(I.chunks.map(F=>({oldStart:F.oldStart,oldLines:F.oldLines,newStart:F.newStart,newLines:F.newLines,lines:F.lines.map(fe=>(fe.type===sr.Addition?"+":fe.type===sr.Deletion?"-":" ")+fe.content)}))):[],!0)});function Sr(r){const n=/Mac|iPhone|iPad|iPod/.test(navigator.userAgent),I=Te=>Nr(r,La(Te),n);if(I("editor.save")){r.preventDefault(),e(t)&&!e(lt)&&Cr();return}const F=I("editor.undo")?"undo":I("editor.redo")?"redo":I("editor.toggle-task-list")?"toggle-task-list":I("editor.copy")?"copy":I("editor.select-all")?"select-all":null;if(!F||e(l)&&F!=="copy"&&F!=="select-all")return;F!=="toggle-task-list"&&e(m)?.runShortcut(F)&&r.preventDefault()}function Dr(r){if(!o().filePath||!e(vt))return;const n=r?.metaKey||r?.ctrlKey||!1,F=r?.target?.closest("[data-panel-id]")?.getAttribute("data-panel-id")??void 0;A.dispatch(ta(d(),e(vt),{filePath:o().filePath,changeId:e(vt).id,openInAdjacentPanel:n,sourcePanelId:F}))}async function Ct(){const r=e(Ce);if(!(e(l)||!r||!d()||!e(ft)||e(Fe))){u(Fe,!0);try{const n=await ga(d(),r,e(ue));!n?.success&&!n?.canceled&&qt.error(n?.error?.message||c.layout_fileTab_downloadFailed_error())}catch{qt.error(c.layout_fileTab_downloadFailed_error())}finally{u(Fe,!1)}}}function jr(){const r=e(Q);if(e(l)||!o().filePath||!d()||!r)return;const n=Zr(Ht.select(A.state,d(),o().filePath));if(!n){qt.error(c.ui_reversibleActions_failed_error({message:c.fileExplorer_tree_undoUnavailable_error()}));return}A.dispatch(Qr(d(),o().filePath,{absolutePath:r,tabId:o().id,snapshot:n}))}$e(()=>{if(!qe||!T())return;const r={isDirty:!e(l)&&e(t),isSaving:!e(l)&&e(lt)};vr(()=>{qe.registerActions({display:Be,actions:xe}),qe.registerState(r)})});var Mr={get tab(){return o()},set tab(r){o(r),te()},get workspaceId(){return d()},set workspaceId(r){d(r),te()},get isActive(){return T()},set isActive(r){T(r),te()},get isPanelFocused(){return _()},set isPanelFocused(r){_(r),te()},$set:Tt,$on:(r,n)=>Ut(x,r,n)},Qt=Le();et("keydown",pr,r=>T()&&Sr(r));var Tr=de(Qt);{var Ur=r=>{var n=Le(),I=de(n);gr(I,()=>o().filePath,F=>{var fe=Le(),Te=de(fe);{var ve=b=>{var v=so(),E=M(v),q=S(E,!0),B=p(E,2),Ue=S(B,!0);P(v),D(Y=>{g(q,Y),g(Ue,o().filePath)},[()=>c.layout_fileTab_outsideWorkspace_label()]),s(b,v)},Ae=b=>{var v=Le(),E=de(v);{var q=B=>{Yt(B,{get workspaceId(){return d()},get filePath(){return e(V)},get gitRootId(){return e(w)}})};ce(E,B=>{T()&&B(q)})}s(b,v)},Oe=b=>{var v=Le(),E=de(v);{var q=Y=>{var G=ur(),le=M(G),Re=S(le,!0);P(G),D(ze=>g(Re,ze),[()=>c.layout_fileTab_errorLoading_label()]),s(Y,G)},B=Y=>{jt(Y,{get filePath(){return o().filePath},get sourceUrl(){return oe().url},allowDownload:!1})},Ue=Y=>{var G=lo(),le=M(G),Re=S(le,!0);P(G),D(ze=>g(Re,ze),[()=>c.layout_fileTab_preparing_label()]),s(Y,G)};ce(E,Y=>{oe()?.error?Y(q):oe()?.url?Y(B,1):Y(Ue,-1)})}s(b,v)},dt=b=>{var v=Le(),E=de(v);{var q=B=>{Yt(B,{get workspaceId(){return d()},get filePath(){return e(ut)}})};ce(E,B=>{T()&&B(q)})}s(b,v)},pt=b=>{var v=ur(),E=M(v),q=S(E,!0);P(v),D(B=>g(q,B),[()=>c.file_pdf_load_error()]),s(b,v)},We=b=>{{let v=i(()=>e(k)??o().filePath),E=i(()=>!e(l)&&e(ft));jt(b,{get filePath(){return e(v)},get sourceUrl(){return e(Zt)},onDownload:Ct,get allowDownload(){return e(E)},get downloading(){return e(Fe)}})}},Ke=b=>{var v=fr(),E=M(v),q=S(E,!0);P(v),D(B=>g(q,B),[()=>c.layout_fileTab_preparing_label()]),s(b,v)},nt=b=>{var v=uo(),E=M(v);xt(E,20,()=>[...Array(20).keys()],q=>q,(q,B)=>{var Ue=co(),Y=M(Ue);cr(Y,{class:"h-3 w-8 shrink-0"});var G=p(Y,2);cr(G,{class:"h-3",style:`width: ${30+Math.random()*60}%`}),P(Ue),s(q,Ue)}),P(E),P(v),s(b,v)},gt=b=>{var v=po(),E=M(v),q=S(E,!0),B=p(E,2),Ue=S(B,!0),Y=p(B,2),G=S(Y,!0),le=p(Y,2);{var Re=ze=>{var st=vo(),ht=de(st),Wt=S(ht,!0),er=p(ht,2);xt(er,20,()=>e($t),wt=>wt,(wt,tr)=>{var Bt=fo(),zr=M(Bt);Se(zr,{variant:"link",size:"compact",class:"h-auto p-0 font-mono text-xs",onclick:()=>Fr(tr),children:(Lr,ho)=>{Xe();var rr=Qe();D(()=>g(rr,tr)),s(Lr,rr)},$$slots:{default:!0}}),P(Bt),s(wt,Bt)}),P(er),D(wt=>g(Wt,wt),[()=>c.layout_fileTab_didYouMean_label()]),s(ze,st)};ce(le,ze=>{e($t).length>0&&ze(Re)})}P(v),D(ze=>{g(q,ze),g(Ue,e(Pt)),g(G,o().filePath)},[()=>c.layout_fileTab_errorLoading_label()]),s(b,v)},mt=b=>{var v=go(),E=M(v),q=S(E,!0),B=p(E,2),Ue=S(B,!0),Y=p(B,2);{var G=le=>{{let Re=i(()=>!e(ft)||e(Fe));Se(le,{variant:"secondary",size:"sm",onclick:Ct,get disabled(){return e(Re)},children:(ze,st)=>{Xe();var ht=Qe();D(Wt=>g(ht,Wt),[()=>c.layout_fileTab_downloadFile_label()]),s(ze,ht)},$$slots:{default:!0}})}};ce(Y,le=>{!e(l)&&e(Ce)&&le(G)})}P(v),D(le=>{g(q,le),g(Ue,o().filePath)},[()=>c.editor_fileViewer_binary_label()]),s(b,v)},_t=b=>{const v=i(()=>o().filePath?.toLowerCase().endsWith(".svg"));var E=Le(),q=de(E);{var B=G=>{{let le=i(()=>o().filePath||""),Re=i(()=>!e(l)&&e(ft));jt(G,{get filePath(){return e(le)},get fileContent(){return e(it)},get language(){return e(Et)},get isBinary(){return e(Je)},onDownload:Ct,get allowDownload(){return e(Re)},get downloading(){return e(Fe)}})}},Ue=G=>{var le=mo(),Re=M(le);Ta(Re,{get content(){return e(it)},get workspaceId(){return d()},get relativeMediaBase(){return e(Vt)},renderRichFencesAsCode:!0,renderDiagrams:!0}),P(le),s(G,le)},Y=G=>{var le=kr,Re=Ir;{let ze=i(()=>N()?e(h):[]);mr(Xt(G,{get value(){return le()},set value(st){Re(st)},get language(){return e(Et)},get readOnly(){return e(l)},get fileName(){return o().filePath},get workspaceId(){return d()},get filePath(){return o().filePath},get lineWrapping(){return W()},get lineChanges(){return e(ze)},get jumpTo(){return e(O)},get externalContentVersion(){return e(a)},get isPanelFocused(){return _()}}),st=>u(m,st,!0),()=>e(m))}};ce(q,G=>{e(v)?G(B):e(It)&&e(L)?G(Ue,1):G(Y,-1)})}s(b,E)},At=b=>{var v=fr(),E=M(v),q=S(E,!0);P(v),D(B=>g(q,B),[()=>c.layout_fileTab_preparing_label()]),s(b,v)};ce(Te,b=>{e(se)?b(ve):e(w)&&e(ge)&&e(V)?b(Ae,1):e(w)&&e(Me)?b(Oe,2):e(ge)&&e(ut)?b(dt,3):e(ge)?b(pt,4):e(Zt)?b(We,5):e(Me)?b(Ke,6):e(yt)?b(nt,7):e(Pt)?b(gt,8):e(Je)?b(mt,9):e(it)!==null?b(_t,10):b(At,-1)})}s(F,fe)}),s(r,n)};ce(Tr,r=>{o().filePath&&r(Ur)})}s(we,Qt);var Rr=zt(Mr);return Ve(),Rr}export{_o as default};
@@ -1 +1 @@
1
- import{a}from"./DU5u4CoB.js";import{c3 as o}from"./BHwB2t2J.js";var c=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{c as g};
1
+ import{a}from"./CW-LHLDp.js";import{c3 as o}from"./8RNmk_9I.js";var c=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{c as g};
@@ -1 +1 @@
1
- import{b as R,s as W,S as N}from"./Uvf94Vit.js";import{l as P}from"./DES0UXLU.js";import{a as f,N as t,ad as S,r as U,G as _,p as z,V as C,aV as F}from"./DU5u4CoB.js";import{c3 as H,bz as O,ae as J}from"./BHwB2t2J.js";import"./4LCvEsVS.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)<c&&x>p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),V=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),q=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Z=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"<br/>");p=p.replace(/\n/g,"<br/>");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),j=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Z(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&V(n),(i.type==="fork"||i.type==="join")&&q(n,i),i.type==="note"&&j(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),G=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=O().x(function(s){return s.x}).y(function(s){return s.y}).curve(J),p=e.append("path").attr("d",l(n)).attr("id","edge"+G).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=C(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=F.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}G++},"drawEdge"),b,T={},Q=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;U(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){m=!1;break}d?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:m?1:b.edgeLengthFactor,nodeSep:m?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:m?1:b.edgeLengthFactor,nodeSep:m?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const x=p.db.getStates(),g=p.db.getRelations(),o=Object.keys(x);for(const r of o){const u=x[r];d&&(u.parentId=d);let h;if(u.doc){let w=i.append("g").attr("id",u.id).attr("class","stateGroup");h=A(u.doc,w,u.id,!c,n,l,p);{w=$(w,u,c);let E=w.node().getBBox();h.width=E.width,h.height=E.height+b.padding/2,T[u.id]={y:b.compositTitleSize}}}else h=L(i,u,a);if(u.note){const w={descriptions:[],id:u.id+"-note",note:u.note,type:"note"},E=L(i,w,a);u.note.position==="left of"?(a.setNode(h.id+"-note",E),a.setNode(h.id,h)):(a.setNode(h.id,h),a.setNode(h.id+"-note",E)),a.setParent(h.id,h.id+"-group"),a.setParent(h.id+"-note",h.id+"-group")}else a.setNode(h.id,h)}S.debug("Count=",a.nodeCount(),a);let B=0;g.forEach(function(r){B++,S.debug("Setting edge",r),a.setEdge(r.id1,r.id2,{relation:r,width:at(r.title),height:b.labelHeight*z.getRows(r.title).length,labelpos:"c"},"id"+B)}),P(a),S.debug("Graph after layout",a.nodes());const y=i.node();a.nodes().forEach(function(r){r!==void 0&&a.node(r)!==void 0?(S.warn("Node "+r+": "+JSON.stringify(a.node(r))),n.select("#"+y.id+" #"+r).attr("transform","translate("+(a.node(r).x-a.node(r).width/2)+","+(a.node(r).y+(T[r]?T[r].y:0)-a.node(r).height/2)+" )"),n.select("#"+y.id+" #"+r).attr("data-x-shift",a.node(r).x-a.node(r).width/2),l.querySelectorAll("#"+y.id+" #"+r+" .divider").forEach(h=>{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:Q,draw:et},ct={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ct as diagram};
1
+ import{b as R,s as W,S as N}from"./DNv7jzNl.js";import{l as P}from"./CmjmDPGO.js";import{a as f,N as t,ad as S,r as U,G as _,p as z,V as C,aV as F}from"./CW-LHLDp.js";import{c3 as H,bz as O,ae as J}from"./8RNmk_9I.js";import"./CmYElrEr.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)<c&&x>p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),V=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),q=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Z=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"<br/>");p=p.replace(/\n/g,"<br/>");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),j=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Z(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&V(n),(i.type==="fork"||i.type==="join")&&q(n,i),i.type==="note"&&j(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),G=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=O().x(function(s){return s.x}).y(function(s){return s.y}).curve(J),p=e.append("path").attr("d",l(n)).attr("id","edge"+G).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=C(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=F.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}G++},"drawEdge"),b,T={},Q=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;U(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){m=!1;break}d?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:m?1:b.edgeLengthFactor,nodeSep:m?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:m?1:b.edgeLengthFactor,nodeSep:m?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const x=p.db.getStates(),g=p.db.getRelations(),o=Object.keys(x);for(const r of o){const u=x[r];d&&(u.parentId=d);let h;if(u.doc){let w=i.append("g").attr("id",u.id).attr("class","stateGroup");h=A(u.doc,w,u.id,!c,n,l,p);{w=$(w,u,c);let E=w.node().getBBox();h.width=E.width,h.height=E.height+b.padding/2,T[u.id]={y:b.compositTitleSize}}}else h=L(i,u,a);if(u.note){const w={descriptions:[],id:u.id+"-note",note:u.note,type:"note"},E=L(i,w,a);u.note.position==="left of"?(a.setNode(h.id+"-note",E),a.setNode(h.id,h)):(a.setNode(h.id,h),a.setNode(h.id+"-note",E)),a.setParent(h.id,h.id+"-group"),a.setParent(h.id+"-note",h.id+"-group")}else a.setNode(h.id,h)}S.debug("Count=",a.nodeCount(),a);let B=0;g.forEach(function(r){B++,S.debug("Setting edge",r),a.setEdge(r.id1,r.id2,{relation:r,width:at(r.title),height:b.labelHeight*z.getRows(r.title).length,labelpos:"c"},"id"+B)}),P(a),S.debug("Graph after layout",a.nodes());const y=i.node();a.nodes().forEach(function(r){r!==void 0&&a.node(r)!==void 0?(S.warn("Node "+r+": "+JSON.stringify(a.node(r))),n.select("#"+y.id+" #"+r).attr("transform","translate("+(a.node(r).x-a.node(r).width/2)+","+(a.node(r).y+(T[r]?T[r].y:0)-a.node(r).height/2)+" )"),n.select("#"+y.id+" #"+r).attr("data-x-shift",a.node(r).x-a.node(r).width/2),l.querySelectorAll("#"+y.id+" #"+r+" .divider").forEach(h=>{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:Q,draw:et},ct={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ct as diagram};