@intent-hq/web 2.310.1 → 2.310.3

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 (252) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/assets/{DiagramPresentation.fimBl1wP.css → DiagramPresentation.Bfi3xHm0.css} +1 -1
  3. package/web/app/immutable/chunks/-xK_vQQs.js +1 -0
  4. package/web/app/immutable/chunks/{CeEeQIAV.js → 2rlMb19F.js} +1 -1
  5. package/web/app/immutable/chunks/{Bhcwd2SW.js → 6Z5k9P1U.js} +4 -4
  6. package/web/app/immutable/chunks/7xAw-BT0.js +213 -0
  7. package/web/app/immutable/chunks/{t3bi-ExW.js → B1s3oEqm.js} +2 -2
  8. package/web/app/immutable/chunks/{phowbgF-.js → B2JLNOy6.js} +1 -1
  9. package/web/app/immutable/chunks/B53WwE3a.js +1 -0
  10. package/web/app/immutable/chunks/{R7gFhaG_.js → B7VncZW5.js} +1 -1
  11. package/web/app/immutable/chunks/{EZw3rvya.js → B7s4-XTz.js} +30 -30
  12. package/web/app/immutable/chunks/{DOHtPCK9.js → BDPXN-l5.js} +1 -1
  13. package/web/app/immutable/chunks/{zXW6V5sa.js → BENBNSN7.js} +1 -1
  14. package/web/app/immutable/chunks/{DevHtnbn.js → BFXzH5IE.js} +1 -1
  15. package/web/app/immutable/chunks/BGcL9rs9.js +217 -0
  16. package/web/app/immutable/chunks/BHnD9zfx.js +99 -0
  17. package/web/app/immutable/chunks/{qMHHnffV.js → BI_SwxaN.js} +1 -1
  18. package/web/app/immutable/chunks/{BV9p4X5I.js → BMMFveB2.js} +6 -6
  19. package/web/app/immutable/chunks/BP6OqM9o.js +1 -0
  20. package/web/app/immutable/chunks/BRvgBsbx.js +291 -0
  21. package/web/app/immutable/chunks/{Cuozo7M1.js → BSel_zEu.js} +1 -1
  22. package/web/app/immutable/chunks/{B4dTn6xv.js → BUlPMLws.js} +1 -1
  23. package/web/app/immutable/chunks/{xMirTl3q.js → BYxB_o2p.js} +2 -2
  24. package/web/app/immutable/chunks/{CsYRAdgB.js → B_mbXOka.js} +1 -1
  25. package/web/app/immutable/chunks/BakMVsPT.js +2 -0
  26. package/web/app/immutable/chunks/{DeopB2f-.js → Bd0N6Q84.js} +3 -3
  27. package/web/app/immutable/chunks/{CHH2PtZ7.js → BfPWAh77.js} +1 -1
  28. package/web/app/immutable/chunks/BfZK-g4H.js +2 -0
  29. package/web/app/immutable/chunks/BhWJ-mUa.js +292 -0
  30. package/web/app/immutable/chunks/{CwH3s3Sg.js → Bhw4MKUW.js} +1 -1
  31. package/web/app/immutable/chunks/{CUvX4uDB.js → BmpVZmDT.js} +3 -3
  32. package/web/app/immutable/chunks/{BNg3GOxL.js → Bn-4GS40.js} +2 -2
  33. package/web/app/immutable/chunks/BpXeqZkK.js +12 -0
  34. package/web/app/immutable/chunks/{D-9LH0ah.js → Bpofk5Ge.js} +1 -1
  35. package/web/app/immutable/chunks/{DjEB6QMF.js → BrV7vQ-C.js} +1 -1
  36. package/web/app/immutable/chunks/ByGoYv9M.js +1 -0
  37. package/web/app/immutable/chunks/C-1nTNwc.js +120 -0
  38. package/web/app/immutable/chunks/{CBHPIqXg.js → C3nOF7W6.js} +1 -1
  39. package/web/app/immutable/chunks/{BIxkRFIj.js → C72YfPmr.js} +2 -2
  40. package/web/app/immutable/chunks/{DMGAuSgb.js → C87YV7yB.js} +4 -4
  41. package/web/app/immutable/chunks/{Coy9jSf1.js → CCDTjxXZ.js} +1 -1
  42. package/web/app/immutable/chunks/CEXJj_TX.js +62 -0
  43. package/web/app/immutable/chunks/CHFvnHJS.js +39 -0
  44. package/web/app/immutable/chunks/{CWyh7Yhz.js → CK1qXB1I.js} +1 -1
  45. package/web/app/immutable/chunks/{CCIGQjYf.js → CLEySo6k.js} +1 -1
  46. package/web/app/immutable/chunks/{DXOCO_oS.js → CNxOtEoC.js} +1 -1
  47. package/web/app/immutable/chunks/{7KTbkf4W.js → CPi1vTiT.js} +2 -2
  48. package/web/app/immutable/chunks/{ejL3HmTG.js → CQI-dvtu.js} +3 -3
  49. package/web/app/immutable/chunks/CSiG9Hvp.js +1 -0
  50. package/web/app/immutable/chunks/{C0DDaBnV.js → CTaTQq2B.js} +1 -1
  51. package/web/app/immutable/chunks/{dtB9lR1B.js → CUMlGGeg.js} +1 -1
  52. package/web/app/immutable/chunks/{fULl8IO9.js → CVyfvlNb.js} +7 -7
  53. package/web/app/immutable/chunks/{DUkegami.js → C_tu278J.js} +1 -1
  54. package/web/app/immutable/chunks/CcUMYVEM.js +41 -0
  55. package/web/app/immutable/chunks/Ccfa6x-j.js +24 -0
  56. package/web/app/immutable/chunks/{BmDskjjc.js → Cd_IIsl2.js} +1 -1
  57. package/web/app/immutable/chunks/CeijcUhC.js +38 -0
  58. package/web/app/immutable/chunks/Ci2_N-bK.js +370 -0
  59. package/web/app/immutable/chunks/CiPifYNB.js +1 -0
  60. package/web/app/immutable/chunks/{D8SVxzqF.js → CjcP6chv.js} +1 -1
  61. package/web/app/immutable/chunks/Cl430GWg.js +344 -0
  62. package/web/app/immutable/chunks/ClKsLSpN.js +27 -0
  63. package/web/app/immutable/chunks/ClebXGIM.js +141 -0
  64. package/web/app/immutable/chunks/{DOVnLHFz.js → CnIb6mve.js} +1 -1
  65. package/web/app/immutable/chunks/{qOCErwrn.js → CrdTEIp7.js} +1 -1
  66. package/web/app/immutable/chunks/{CPvhRhlk.js → Cstq9SM5.js} +11 -11
  67. package/web/app/immutable/chunks/CuzanJ4G.js +1 -0
  68. package/web/app/immutable/chunks/{D81gRUjY.js → D-QdqmeZ.js} +1 -1
  69. package/web/app/immutable/chunks/D0gJOzJU.js +40 -0
  70. package/web/app/immutable/chunks/{CoeuT-m3.js → D2ffSQ9J.js} +1 -1
  71. package/web/app/immutable/chunks/D2ojbL4J.js +98 -0
  72. package/web/app/immutable/chunks/{Bfkn2BGM.js → D3lH_sy-.js} +1 -1
  73. package/web/app/immutable/chunks/{C0Yks_oS.js → D5XrjD_m.js} +1 -1
  74. package/web/app/immutable/chunks/{DzvQOT8_.js → D5gGhPeB.js} +1 -1
  75. package/web/app/immutable/chunks/{DLm51UIm.js → D7ePuUtq.js} +1 -1
  76. package/web/app/immutable/chunks/{B9r0JXjW.js → D9RktmhG.js} +1 -1
  77. package/web/app/immutable/chunks/{Si43_nYW.js → D9zTmP-H.js} +3 -3
  78. package/web/app/immutable/chunks/{DQEBW0YT.js → DAhqFWJw.js} +1 -1
  79. package/web/app/immutable/chunks/{B20hJMKp.js → DAmyup4Q.js} +2 -2
  80. package/web/app/immutable/chunks/{B0X6Qy4e.js → DH-0T9oO.js} +1 -1
  81. package/web/app/immutable/chunks/{D-o9b0Cd.js → DHf042m3.js} +2 -2
  82. package/web/app/immutable/chunks/DICP2Iar.js +169 -0
  83. package/web/app/immutable/chunks/{D04E4MVv.js → DJ4er0zy.js} +4 -4
  84. package/web/app/immutable/chunks/{BtHVXttl.js → DLTK7s08.js} +5 -5
  85. package/web/app/immutable/chunks/{DQulsXJ7.js → DM80xiYc.js} +1 -1
  86. package/web/app/immutable/chunks/{BsP5G0Fo.js → DPWD_Z0m.js} +1 -1
  87. package/web/app/immutable/chunks/{t9id1Dgw.js → DPjuFI2m.js} +1 -1
  88. package/web/app/immutable/chunks/{DhdMM_zt.js → DR30pTuY.js} +14 -14
  89. package/web/app/immutable/chunks/{D_9AVJm5.js → DStbB4cJ.js} +1 -1
  90. package/web/app/immutable/chunks/{C8CCN24q.js → DV_gHrZ4.js} +1 -1
  91. package/web/app/immutable/chunks/{CQe4IdgR.js → DWqMBuHP.js} +1 -1
  92. package/web/app/immutable/chunks/DhDem5lD.js +34 -0
  93. package/web/app/immutable/chunks/{DaEQgqyy.js → Dj7a19mR.js} +1 -1
  94. package/web/app/immutable/chunks/{CnmCWFKQ.js → Dn1Hge9W.js} +2 -2
  95. package/web/app/immutable/chunks/{DxlwMmI8.js → DpbPS--w.js} +1 -1
  96. package/web/app/immutable/chunks/{Drg52kVf.js → DqPGIq9m.js} +1 -1
  97. package/web/app/immutable/chunks/Dr9n9KYD.js +8 -0
  98. package/web/app/immutable/chunks/Dx4xDmS-.js +1 -0
  99. package/web/app/immutable/chunks/{D411lQkp.js → DxBZwGJl.js} +1 -1
  100. package/web/app/immutable/chunks/{CEdLQlJ6.js → EF47gh5F.js} +6 -6
  101. package/web/app/immutable/chunks/FTZaXc8b.js +106 -0
  102. package/web/app/immutable/chunks/NHQiGgbv.js +200 -0
  103. package/web/app/immutable/chunks/{BCm8Gasf.js → OEEtadht.js} +1 -1
  104. package/web/app/immutable/chunks/{DCeW9_0X.js → PR2rc_KV.js} +2 -2
  105. package/web/app/immutable/chunks/{_F3xl3RI.js → Q48HTbqK.js} +1 -1
  106. package/web/app/immutable/chunks/{TQIai6Ne.js → Sd4DhpzB.js} +79 -79
  107. package/web/app/immutable/chunks/{C-Mmob1s.js → WaYTk5P-.js} +1 -1
  108. package/web/app/immutable/chunks/{ByGsJxdn.js → X-Frg4xt.js} +1 -1
  109. package/web/app/immutable/chunks/YDWB9C4j.js +36 -0
  110. package/web/app/immutable/chunks/{BUSwtV99.js → YqBgboHy.js} +1 -1
  111. package/web/app/immutable/chunks/{B_D0NLtg.js → _GDZ01fB.js} +1 -1
  112. package/web/app/immutable/chunks/{C7oH1dbI.js → aloh9OcN.js} +1 -1
  113. package/web/app/immutable/chunks/{BEhoKnQT.js → ap51LBWo.js} +1 -1
  114. package/web/app/immutable/chunks/bBO0iA4_.js +7 -0
  115. package/web/app/immutable/chunks/cMysCMc_.js +24 -0
  116. package/web/app/immutable/chunks/dpdLM1Cx.js +140 -0
  117. package/web/app/immutable/chunks/eHLf0w_s.js +1 -0
  118. package/web/app/immutable/chunks/fyjA8lOg.js +4 -0
  119. package/web/app/immutable/chunks/{CQf-fH5v.js → h6Xb9K7f.js} +1 -1
  120. package/web/app/immutable/chunks/{j0ThtFJc.js → iX-41BqF.js} +1 -1
  121. package/web/app/immutable/chunks/ibC6Wlul.js +3 -0
  122. package/web/app/immutable/chunks/jU5_8m_P.js +84 -0
  123. package/web/app/immutable/chunks/{BKGPkCRs.js → kHJUvxPR.js} +1 -1
  124. package/web/app/immutable/chunks/{BBTS8ZOM.js → lG67Zx5D.js} +3 -3
  125. package/web/app/immutable/chunks/{CgAIOmc3.js → lb9Uy5lM.js} +4 -4
  126. package/web/app/immutable/chunks/{DdAxykhC.js → lh2cjQS1.js} +1 -1
  127. package/web/app/immutable/chunks/{r1_PrlQL.js → lqs_HYEw.js} +1 -1
  128. package/web/app/immutable/chunks/{CnszEr0a.js → oEWQ7BWN.js} +1 -1
  129. package/web/app/immutable/chunks/{BGLkcG6I.js → ry72TFIz.js} +2 -2
  130. package/web/app/immutable/chunks/{BV7dztYI.js → ryFwnMjp.js} +1 -1
  131. package/web/app/immutable/chunks/{CsASRGy9.js → uOEty9O6.js} +5 -5
  132. package/web/app/immutable/chunks/wh3Y68il.js +1 -0
  133. package/web/app/immutable/chunks/{DRMT9vvq.js → xPs_63iv.js} +1 -1
  134. package/web/app/immutable/entry/{app.DlF41taB.js → app.np0VAfbg.js} +2 -2
  135. package/web/app/immutable/entry/start.BGCfjmAX.js +1 -0
  136. package/web/app/immutable/nodes/{0.BLjNhnkb.js → 0.DoZAnEaT.js} +1 -1
  137. package/web/app/immutable/nodes/{1.DaghOy3j.js → 1.BfLNDde5.js} +1 -1
  138. package/web/app/immutable/nodes/{10.CbV_flkh.js → 10.WVRhKQHR.js} +1 -1
  139. package/web/app/immutable/nodes/{14.N_oC1pv5.js → 14.BGrxllXE.js} +1 -1
  140. package/web/app/immutable/nodes/{16.Cn0uYbJe.js → 16.CkZkKSWx.js} +2 -2
  141. package/web/app/immutable/nodes/{2.CMERPJYK.js → 2.COM3w17g.js} +8 -8
  142. package/web/app/immutable/nodes/{3.Dk5w9XeG.js → 3.BhRx3b1m.js} +1 -1
  143. package/web/app/immutable/nodes/{4.CvLiKH0B.js → 4.C02hhSi-.js} +1 -1
  144. package/web/app/immutable/nodes/{5.BL5oLCOi.js → 5.Dgt2hWD3.js} +1 -1
  145. package/web/app/immutable/nodes/{6.DiKzgiKt.js → 6.KyP4WP5g.js} +1 -1
  146. package/web/app/immutable/nodes/{7.CM-hNW3A.js → 7.BxnoAMeX.js} +1 -1
  147. package/web/app/immutable/nodes/{8.BThIGSQR.js → 8.CnlHpTsC.js} +2 -2
  148. package/web/app/immutable/nodes/{9.D70tN3NX.js → 9.CJ1_wepy.js} +18 -18
  149. package/web/app/version.json +1 -1
  150. package/web/index.html +9 -9
  151. package/web/app/immutable/chunks/-SL67XKV.js +0 -1
  152. package/web/app/immutable/chunks/351KaJp_.js +0 -24
  153. package/web/app/immutable/chunks/7Iuyw4Ow.js +0 -106
  154. package/web/app/immutable/chunks/9ySBq1wF.js +0 -36
  155. package/web/app/immutable/chunks/B2safKX4.js +0 -1
  156. package/web/app/immutable/chunks/B8QrskMI.js +0 -139
  157. package/web/app/immutable/chunks/BCO4VeSA.js +0 -1
  158. package/web/app/immutable/chunks/BCaDoF8Y.js +0 -1
  159. package/web/app/immutable/chunks/BEdJCn-8.js +0 -1
  160. package/web/app/immutable/chunks/BGBb6fI-.js +0 -120
  161. package/web/app/immutable/chunks/BGQ3htf5.js +0 -1
  162. package/web/app/immutable/chunks/BKLEAopb.js +0 -7
  163. package/web/app/immutable/chunks/BKSgn5w-.js +0 -1
  164. package/web/app/immutable/chunks/BKY64haD.js +0 -12
  165. package/web/app/immutable/chunks/BOXqfDS_.js +0 -40
  166. package/web/app/immutable/chunks/BP_ooGOd.js +0 -24
  167. package/web/app/immutable/chunks/BQApP15C.js +0 -99
  168. package/web/app/immutable/chunks/BS6cE8e9.js +0 -231
  169. package/web/app/immutable/chunks/BTXk2yGf.js +0 -96
  170. package/web/app/immutable/chunks/BVrOGXf1.js +0 -78
  171. package/web/app/immutable/chunks/BZoKWA-r.js +0 -96
  172. package/web/app/immutable/chunks/BbiXTFqz.js +0 -1
  173. package/web/app/immutable/chunks/BgmKjqUX.js +0 -1
  174. package/web/app/immutable/chunks/Bk7xBWHf.js +0 -34
  175. package/web/app/immutable/chunks/BoiNnj2h.js +0 -1
  176. package/web/app/immutable/chunks/BrVvVCxw.js +0 -1
  177. package/web/app/immutable/chunks/ByM2DIOs.js +0 -1
  178. package/web/app/immutable/chunks/ByzYvvQp.js +0 -70
  179. package/web/app/immutable/chunks/Bz0SnIMO.js +0 -1
  180. package/web/app/immutable/chunks/C1IwSyrV.js +0 -99
  181. package/web/app/immutable/chunks/C9gL5x04.js +0 -39
  182. package/web/app/immutable/chunks/C9nyJoiB.js +0 -41
  183. package/web/app/immutable/chunks/CBV2Z_QZ.js +0 -89
  184. package/web/app/immutable/chunks/CDHds8o_.js +0 -3
  185. package/web/app/immutable/chunks/CHIHAnR-.js +0 -1
  186. package/web/app/immutable/chunks/CHj2oCmD.js +0 -39
  187. package/web/app/immutable/chunks/CIXNMjfT.js +0 -206
  188. package/web/app/immutable/chunks/CKFDW9cI.js +0 -24
  189. package/web/app/immutable/chunks/CKQlE_M1.js +0 -88
  190. package/web/app/immutable/chunks/CSBhPNbN.js +0 -206
  191. package/web/app/immutable/chunks/CSLTsum9.js +0 -38
  192. package/web/app/immutable/chunks/CSbiiZpm.js +0 -354
  193. package/web/app/immutable/chunks/CToDhNW4.js +0 -1
  194. package/web/app/immutable/chunks/CYFK9YEX.js +0 -168
  195. package/web/app/immutable/chunks/CcGF51wP.js +0 -1
  196. package/web/app/immutable/chunks/Cd5vVJw4.js +0 -292
  197. package/web/app/immutable/chunks/CgjSMAIJ.js +0 -120
  198. package/web/app/immutable/chunks/Ck7B90Kr.js +0 -38
  199. package/web/app/immutable/chunks/CkAILno9.js +0 -62
  200. package/web/app/immutable/chunks/CkawHIFZ.js +0 -1
  201. package/web/app/immutable/chunks/ClXr1b-t.js +0 -8
  202. package/web/app/immutable/chunks/CmWBRPmR.js +0 -24
  203. package/web/app/immutable/chunks/Cmo-9vFV.js +0 -1
  204. package/web/app/immutable/chunks/CoFCa7Mb.js +0 -231
  205. package/web/app/immutable/chunks/CrcLvVto.js +0 -84
  206. package/web/app/immutable/chunks/Cs_Q6mos.js +0 -1
  207. package/web/app/immutable/chunks/CsnLwu9F.js +0 -2
  208. package/web/app/immutable/chunks/CuYeKLE8.js +0 -8
  209. package/web/app/immutable/chunks/CvOaoHrI.js +0 -1
  210. package/web/app/immutable/chunks/CvYzv8kf.js +0 -1
  211. package/web/app/immutable/chunks/CxRm1vYn.js +0 -342
  212. package/web/app/immutable/chunks/CyfBUrNA.js +0 -1
  213. package/web/app/immutable/chunks/D1QKDDLH.js +0 -1
  214. package/web/app/immutable/chunks/D61DwhDw.js +0 -3
  215. package/web/app/immutable/chunks/DBAJPVI_.js +0 -1
  216. package/web/app/immutable/chunks/DBt8jmEX.js +0 -40
  217. package/web/app/immutable/chunks/DD-T_Om0.js +0 -178
  218. package/web/app/immutable/chunks/DEOiJZFa.js +0 -168
  219. package/web/app/immutable/chunks/DHW4IXFj.js +0 -36
  220. package/web/app/immutable/chunks/DJ0w8Oax.js +0 -129
  221. package/web/app/immutable/chunks/DJ52BT20.js +0 -1
  222. package/web/app/immutable/chunks/DK1048Bw.js +0 -129
  223. package/web/app/immutable/chunks/DZ0nrC9W.js +0 -162
  224. package/web/app/immutable/chunks/DeRneTJF.js +0 -106
  225. package/web/app/immutable/chunks/Df6EnPla.js +0 -4
  226. package/web/app/immutable/chunks/DfMKUxMU.js +0 -30
  227. package/web/app/immutable/chunks/DkH3yb1j.js +0 -34
  228. package/web/app/immutable/chunks/Doxgswr3.js +0 -4
  229. package/web/app/immutable/chunks/Dt53cexP.js +0 -1
  230. package/web/app/immutable/chunks/Dx6eBL0x.js +0 -1
  231. package/web/app/immutable/chunks/HP7Asd0t.js +0 -2
  232. package/web/app/immutable/chunks/HP8lGamR.js +0 -257
  233. package/web/app/immutable/chunks/HzpfURmp.js +0 -84
  234. package/web/app/immutable/chunks/PJfe_iA1.js +0 -1
  235. package/web/app/immutable/chunks/PXMyYXQv.js +0 -1
  236. package/web/app/immutable/chunks/Qi3HrsAm.js +0 -1
  237. package/web/app/immutable/chunks/S1FanOB0.js +0 -162
  238. package/web/app/immutable/chunks/SuMU9B9i.js +0 -1
  239. package/web/app/immutable/chunks/UaGv-ChR.js +0 -257
  240. package/web/app/immutable/chunks/YqyEOqRv.js +0 -178
  241. package/web/app/immutable/chunks/_MGNV7ZN.js +0 -338
  242. package/web/app/immutable/chunks/_lZu5Dth.js +0 -292
  243. package/web/app/immutable/chunks/gzjZWAx8.js +0 -62
  244. package/web/app/immutable/chunks/hqSEunOk.js +0 -15
  245. package/web/app/immutable/chunks/nGCCQCpO.js +0 -1
  246. package/web/app/immutable/chunks/o-kBqlaj.js +0 -7
  247. package/web/app/immutable/chunks/opO2fBQB.js +0 -1
  248. package/web/app/immutable/chunks/pdFamTTi.js +0 -7
  249. package/web/app/immutable/chunks/rEI8JpP3.js +0 -1
  250. package/web/app/immutable/chunks/s5P9UVzf.js +0 -1
  251. package/web/app/immutable/chunks/sIHUXgeh.js +0 -41
  252. package/web/app/immutable/entry/start.CCtO40vu.js +0 -1
@@ -1,18 +1,18 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/Bgegixo2.js","/app/immutable/chunks/7rNOGHzs.js","/app/immutable/chunks/B8o4lNgr.js","/app/immutable/chunks/CQ4a5a4v.js","/app/immutable/chunks/DmsDslNo.js","/app/immutable/chunks/UyBYtOpv.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/D2g8BuR1.js","/app/immutable/chunks/CiENRH6A.js","/app/immutable/chunks/DCaHy20k.js","/app/immutable/chunks/CzrrO9Ap.js","/app/immutable/chunks/BlOn95cv.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/i-jR1dYx.js","/app/immutable/chunks/CRwmdgt6.js","/app/immutable/chunks/CjSUqH7t.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/DsfzfmK9.js","/app/immutable/chunks/KQTrHxko.js","/app/immutable/chunks/CFejQM6t.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/C_n9DeKj.js","/app/immutable/chunks/DzMmhJrp.js","/app/immutable/chunks/B2KJmqK3.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/D4jXWSLn.js","/app/immutable/chunks/yAjP_kdp.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/DNen9YXB.js","/app/immutable/chunks/CC6TxnfE.js","/app/immutable/chunks/DBIwerkr.js","/app/immutable/chunks/Cqzl755B.js","/app/immutable/chunks/CiPGfArf.js","/app/immutable/assets/register.CUyDR59i.css","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/DQ5DxPhl.js","/app/immutable/assets/terminal-manager.MhP_vFvK.css","/app/immutable/chunks/zXW6V5sa.js","/app/immutable/chunks/DUkegami.js","/app/immutable/chunks/BkBdyRjM.js","/app/immutable/chunks/DCeW9_0X.js","/app/immutable/chunks/CB-g50lR.js","/app/immutable/chunks/CPQdU3ZA.js","/app/immutable/chunks/D-cnPaTJ.js","/app/immutable/assets/pending-agent-deletions.UE5obH5A.css","/app/immutable/chunks/BNg3GOxL.js","/app/immutable/chunks/lfJ8pseq.js","/app/immutable/chunks/D2AmAQEr.js","/app/immutable/chunks/CUrlpJj4.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/C0Yks_oS.js","/app/immutable/chunks/BKY64haD.js","/app/immutable/chunks/BV7dztYI.js","/app/immutable/chunks/B0X6Qy4e.js"])))=>i.map(i=>d[i]);
2
- var J0=Object.defineProperty;var rp=n=>{throw TypeError(n)};var X0=(n,e,t)=>e in n?J0(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var nt=(n,e,t)=>X0(n,typeof e!="symbol"?e+"":e,t),Q0=(n,e,t)=>e.has(n)||rp("Cannot "+t);var ri=(n,e,t)=>(Q0(n,e,"read from private field"),t?t.call(n):e.get(n)),ba=(n,e,t)=>e.has(n)?rp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{aa as Y0,cd as Z0,bK as sp,Q as ip,bJ as op,O as ap,at as ew,by as tw,au as nw,aE as rw,bo as Vi,bs as Lt,a7 as Je,ay as ce,W as k,aD as l,a5 as te,bf as ls,bA as Y,bn as Ot,c9 as w,aA as b,aB as N,bH as x,bS as R,b_ as L,bl as re,bO as B,cb as sw,bV as fe,aw as xo,bz as Fd,be as Ht,b$ as Vt,aC as Wi,bv as lp,al as iw,ai as So,ca as ft,aj as Kr,br as Ar,bb as vl,c3 as io,aG as ow,bk as Lf,c0 as qo,bj as ql,c5 as ii}from"./B8o4lNgr.js";import{dN as Pm,F as aw,E as lw,Y as cw,Q as Of,R as uw,h as Hd,aB as dw,aa as fw,S as hw,dO as pw,$ as gw,c8 as Nf,cB as rd,bY as mw,aR as vw,cA as bw}from"./KQTrHxko.js";import{t as Nt,bq as y,a_ as V,by as Dt,b as $t,br as ui,bt as us,bo as _,bw as cp,bs as Jl,bu as rn,_ as cs}from"./7rNOGHzs.js";import{t as as,H as Ss,g as yw,i as Im,u as Lm,j as ww,v as xw,E as Ud,c as Vd,C as Bo}from"./DzMmhJrp.js";import{aB as Om,cO as kw,aA as _w,bD as Sw,F as ut,c_ as Fi,c$ as Cw,bl as Js,bq as Df,br as $f,aP as Mw,aQ as sd,bT as Tw,bU as Ew,cl as Aw,bC as Dc,cm as Bf,aX as Nm,a7 as Dm,cn as Rw,ay as Pw,av as Da,b9 as Iw,bs as zf,bf as Ff,s as Lw,bB as Ow,aG as up,be as Fo,cU as $m,cR as Nw,ci as Bm,cF as zm,aj as Dw,au as Fm,ax as dp,ao as $w,ai as Bw,ar as zw,cS as Fw,aL as id,cj as Hw,bu as Uw,c7 as Vw,ct as fp,V as Ww,cC as Kw,as as jw,bR as Gw,ap as qw,c3 as Jw,bK as Xw,cV as Qw,ak as Yw,bj as Zw,aZ as e1,cZ as t1,al as n1,bP as r1,aR as s1,a_ as i1,bZ as o1,bb as a1,cs as l1,cy as c1,bO as u1,bm as d1,bg as Wd,v as f1,b8 as h1,ck as hp,aO as p1,at as Hm,c9 as $c,$ as g1}from"./CFejQM6t.js";import{aI as m1,ay as v1,au as b1,ah as y1,Q as w1,cV as x1,aD as k1,cH as pp,aQ as gp,cr as _1,aF as mp,s as ya,ao as S1,a1 as C1,cQ as M1,aT as T1,a4 as E1,cy as A1,cu as R1,cs as P1,cE as I1,cG as L1,cD as O1,ct as N1,aB as od,aw as vp,X as D1,S as sl,O as $1,ax as B1,W as z1,m as F1,T as H1,a5 as U1,ak as Um,j as ad}from"./TQIai6Ne.js";import{c as oa,f as br,l as Hi,k as wt,d as Xn,s as xt,a as Pl,h as Cs,i as Tc,I as li}from"./DmsDslNo.js";import{s as On}from"./CQ4a5a4v.js";import{aT as $a,aJ as Ls,bn as Hf,av as V1,aH as W1,aF as K1,aE as j1,aS as G1,bp,an as q1,as as J1,at as X1,a5 as Vm,aq as Q1,ar as Y1,f as Ze,br as Z1,aW as ex,aw as tx,aQ as nx,aj as rx,am as Eu,ax as Wm}from"./Bgegixo2.js";import{a as sx,J as ja,P as ix,s as Uf,k as Vf,l as Ho,K as Km,o as jm,M as Wf,x as ox,v as ax,y as Gm,L as Do,H as lx,R as cx,n as ux,g as dx,i as fx,h as hx,E as px}from"./DSjRkndX.js";import{i as qm,f as gx,I as Xr,a as mx}from"./DZX-XWnb.js";import"./DbAK3Zju.js";import{c as Rt}from"./CiENRH6A.js";import{b as Qn}from"./D2g8BuR1.js";import{b as Jm}from"./BaQ9zUUl.js";import{f as vx,g as bx}from"./DsNWmyox.js";import{F as yx,c as wx,n as _s,t as yp}from"./lfJ8pseq.js";import{c as Ga,l as _t}from"./ChTqQfQN.js";import"./D-cnPaTJ.js";import{mU as xx,c as Ec,Hq as It,n5 as kx,bi as Xm,AU as wp,pX as Kd,Hg as _x,eb as xp,fS as Sx,n6 as Kf,g as Cx,rs as kp,K7 as Mx,Km as Tx,Kl as Ex,K6 as Ax,Bo as Rx,F$ as Px,xK as Ix,jW as Lx,G5 as Ox}from"./CRwmdgt6.js";import{o as Nx,t as Dx,s as Qm,H as _p,e as $x,y as Bx,J as jf,L as zx,S as Fx,I as Hx,p as Ux,P as Vx,q as Gf,a0 as yr,C as Wx,r as qf,B as Kx,k as jx,x as ld,w as Gx,G as qx,T as Jx,u as Xx,v as Sp,h as Qx,W as Yx,l as Zx,n as ek}from"./t3bi-ExW.js";import{F as tk,n as Jf,m as nk,t as jd,u as Xf,k as Ym,O as wa,M as Zm}from"./Ck-Ax5yG.js";import{ce as Bc,B as Cp,bx as rk,bE as sk,T as Mp,aK as ev,aL as ik,aI as ok,aJ as ak,aO as lk}from"./DUkegami.js";import{bI as ck,a9 as uk}from"./CB-g50lR.js";import{g as dk}from"./CMiilI_P.js";import{M as tv,E as Qf,F as fk,x as hk}from"./DCaHy20k.js";import{s as pk,C as Tp}from"./BGspgxWf.js";import"./CKEqC8_B.js";import"./DFHyIdsA.js";import{y as xa}from"./yAjP_kdp.js";import{I as Yf}from"./DlodKoXT.js";import{i as cd}from"./BkBdyRjM.js";import{d as gk}from"./C0Yks_oS.js";function ZD(n,e){var t=ap,r=ip,s=n();return{subscribe:Z0(s,o=>{var a=s!==n(),c,u=ip,d=ap;sp(r),op(t);try{c=ew(()=>{tw(()=>{const f=n();a&&o(f)})})}finally{sp(u),op(d)}return a=!0,c}).subscribe}}function e$(n){let e;const t=Y0(s=>{let i=!1;const o=n.subscribe(a=>{e=a,i&&s()});return i=!0,o});function r(){return nw()?(t(),e):rw(n)}return"set"in n?{get current(){return r()},set current(s){n.set(s)}}:{get current(){return r()}}}var mk=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","type","disabled","openOnHover","openDelay","closeDelay"]),vk=N("<button><!></button>");function nv(n,e){const t=Vi();if(new.target)return Nt({component:nv,...n});Lt(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>$a(t)),o=y(e,"ref",15,null),a=y(e,"type",7,"button"),c=y(e,"disabled",7,!1),u=y(e,"openOnHover",7,!1),d=y(e,"openDelay",7,700),f=y(e,"closeDelay",7,300),h=ui(e,mk);const p=Nx.create({id:Ls(()=>i()),ref:Ls(()=>o(),m=>o(m)),disabled:Ls(()=>!!c()),openOnHover:Ls(()=>u()),openDelay:Ls(()=>d()),closeDelay:Ls(()=>f())}),g=w(()=>Hf(h,p.props,{type:a()}));var v={get children(){return r()},set children(m){r(m),b()},get child(){return s()},set child(m){s(m),b()},get id(){return i()},set id(m=$a(t)){i(m),b()},get ref(){return o()},set ref(m=null){o(m),b()},get type(){return a()},set type(m="button"){a(m),b()},get disabled(){return c()},set disabled(m=!1){c(m),b()},get openOnHover(){return u()},set openOnHover(m=!1){u(m),b()},get openDelay(){return d()},set openDelay(m=700){d(m),b()},get closeDelay(){return f()},set closeDelay(m=300){f(m),b()},$set:Dt,$on:(m,S)=>$t(e,m,S)};return tk(n,{get id(){return i()},get ref(){return p.opts.ref},children:(m,S)=>{var I=Je(),C=ce(I);{var M=P=>{var E=Je(),z=ce(E);On(z,s,()=>({props:l(g)})),k(P,E)},O=P=>{var E=vk();oa(E,()=>({...l(g)}));var z=te(E);On(z,()=>r()??ls),Y(E),k(P,E)};V(C,P=>{s()?P(M):P(O,-1)})}k(m,I)},$$slots:{default:!0}}),Ot(v)}var bk=new Set(["$$slots","$$events","$$legacy","ref"]);function rv(n,e){if(new.target)return Nt({component:rv,...n});Lt(e,!0);let t=y(e,"ref",15,null),r=ui(e,bk);var s={get ref(){return t()},set ref(i=null){t(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return yx(n,us(()=>r,{"data-popover-arrow":"",get ref(){return t()},set ref(i){t(i)}})),Ot(s)}var yk=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","value"]),wk=N("<div><!></div>");function sv(n,e){const t=Vi();if(new.target)return Nt({component:sv,...n});Lt(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>$a(t)),o=y(e,"ref",15,null),a=y(e,"value",7),c=ui(e,yk);const u=Dx.create({value:Ls(()=>a()),id:Ls(()=>i()),ref:Ls(()=>o(),m=>o(m))}),d=w(()=>Hf(c,u.props));var f={get children(){return r()},set children(m){r(m),b()},get child(){return s()},set child(m){s(m),b()},get id(){return i()},set id(m=$a(t)){i(m),b()},get ref(){return o()},set ref(m=null){o(m),b()},get value(){return a()},set value(m){a(m),b()},$set:Dt,$on:(m,S)=>$t(e,m,S)},h=Je(),p=ce(h);{var g=m=>{var S=Je(),I=ce(S);On(I,s,()=>({props:l(d)})),k(m,S)},v=m=>{var S=wk();oa(S,()=>({...l(d)}));var I=te(S);On(I,()=>r()??ls),Y(S),k(m,S)};V(p,m=>{s()?m(g):m(v,-1)})}return k(n,h),Ot(f)}const xk=G1({component:"toggle",parts:["root"]});var Vl,Wl;const qh=class qh{constructor(e){nt(this,"opts");nt(this,"attachment");ba(this,Vl,w(()=>({pressed:this.opts.pressed.current})));ba(this,Wl,w(()=>({[xk.root]:"",id:this.opts.id.current,"data-disabled":j1(this.opts.disabled.current),"aria-pressed":K1(this.opts.pressed.current),"data-state":kk(this.opts.pressed.current),disabled:W1(this.opts.disabled.current),onclick:this.onclick,...this.attachment})));this.opts=e,this.attachment=V1(this.opts.ref),this.onclick=this.onclick.bind(this)}static create(e){return new qh(e)}onclick(e){this.opts.disabled.current||(this.opts.pressed.current=!this.opts.pressed.current)}get snippetProps(){return l(ri(this,Vl))}set snippetProps(e){x(ri(this,Vl),e)}get props(){return l(ri(this,Wl))}set props(e){x(ri(this,Wl),e)}};Vl=new WeakMap,Wl=new WeakMap;let Gd=qh;function kk(n){return n?"on":"off"}var _k=new Set(["$$slots","$$events","$$legacy","ref","id","pressed","onPressedChange","disabled","type","children","child"]),Sk=N("<button><!></button>");function iv(n,e){const t=Vi();if(new.target)return Nt({component:iv,...n});Lt(e,!0);let r=y(e,"ref",15,null),s=y(e,"id",23,()=>$a(t)),i=y(e,"pressed",15,!1),o=y(e,"onPressedChange",7,bp),a=y(e,"disabled",7,!1),c=y(e,"type",7,"button"),u=y(e,"children",7),d=y(e,"child",7),f=ui(e,_k);const h=Gd.create({pressed:Ls(()=>i(),C=>{i(C),o()(C)}),disabled:Ls(()=>a()??!1),id:Ls(()=>s()),ref:Ls(()=>r(),C=>r(C))}),p=w(()=>Hf(f,h.props,{type:c()}));var g={get ref(){return r()},set ref(C=null){r(C),b()},get id(){return s()},set id(C=$a(t)){s(C),b()},get pressed(){return i()},set pressed(C=!1){i(C),b()},get onPressedChange(){return o()},set onPressedChange(C=bp){o(C),b()},get disabled(){return a()},set disabled(C=!1){a(C),b()},get type(){return c()},set type(C="button"){c(C),b()},get children(){return u()},set children(C){u(C),b()},get child(){return d()},set child(C){d(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},v=Je(),m=ce(v);{var S=C=>{var M=Je(),O=ce(M);{let P=w(()=>({props:l(p),...h.snippetProps}));On(O,d,()=>l(P))}k(C,M)},I=C=>{var M=Sk();oa(M,()=>({...l(p)}));var O=te(M);On(O,()=>u()??ls,()=>h.snippetProps),Y(M),k(C,M)};V(m,C=>{d()?C(S):C(I,-1)})}return k(n,v),Ot(g)}var Ck=N('<h4 class="type-body font-medium"> </h4>'),Mk=N('<div class="flex items-start gap-2"><!> <!></div>'),Tk=N("<p> </p>"),Ek=N('<div class="type-caption"><!></div>'),Ak=N("<div><!></div>"),Rk=N("<div></div>"),Pk=N('<div class="relative"><!> <div><!> <!> <!></div> <!></div> <!>',1),Ik=N("<!><!>",1);function Zf(n,e){if(new.target)return Nt({component:Zf,...n});Lt(e,!0);let t=y(e,"title",7,""),r=y(e,"description",7,""),s=y(e,"content",7),i=y(e,"side",7,"top"),o=y(e,"align",7,"center"),a=y(e,"sideOffset",7,8),c=y(e,"alignOffset",7,0),u=y(e,"delayDuration",7,200),d=y(e,"disableHoverableContent",7,!1),f=y(e,"disableCloseOnTriggerClick",7,!1),h=y(e,"disabled",7,!1),p=y(e,"open",15,!1),g=y(e,"onOpenChange",7),v=y(e,"class",7,""),m=y(e,"contentClass",7,""),S=y(e,"contentContainerClass",7,""),I=y(e,"showArrow",7,!0),C=y(e,"showClose",7,!1),M=y(e,"onClose",7),O=y(e,"variant",7,"default"),P=y(e,"maxWidth",7,"20rem"),E=y(e,"interactive",7,!1),z=y(e,"disableAnimation",7,!1),G=y(e,"children",7),J=y(e,"trigger",7),K=y(e,"icon",7),Q=y(e,"footer",7),$=y(e,"iconClass",7,""),X=y(e,"footerClass",7,""),de=y(e,"descriptionClass",7,""),me=y(e,"onclick",7);const ie={default:{bg:"bg-popover",text:"text-popover-foreground",border:"",icon:null,iconColor:""},info:{bg:"bg-popover",text:"text-info",border:"border border-info/40",icon:Sw,iconColor:"text-info"},success:{bg:"bg-popover",text:"text-success",border:"border border-success/40",icon:_w,iconColor:"text-success"},warning:{bg:"bg-popover",text:"text-warning-ink",border:"border border-warning/40",icon:kw,iconColor:"text-warning-ink"},error:{bg:"bg-danger",text:"text-danger-background",border:"border border-danger/40",icon:Om,iconColor:"text-danger-background"},custom:{bg:"",text:"",border:"",icon:null,iconColor:""}},q=w(()=>ie[O()]),j=w(()=>K()||l(q).icon),ne=w(()=>br("overlay-surface z-(--layer-tooltip)",!z()&&"tooltip-motion",l(q).bg,l(q).text,l(q).border,m()));function we(H){p(H),g()?.(H)}function be(){p(!1),M()?.()}var Se={get title(){return t()},set title(H=""){t(H),b()},get description(){return r()},set description(H=""){r(H),b()},get content(){return s()},set content(H){s(H),b()},get side(){return i()},set side(H="top"){i(H),b()},get align(){return o()},set align(H="center"){o(H),b()},get sideOffset(){return a()},set sideOffset(H=8){a(H),b()},get alignOffset(){return c()},set alignOffset(H=0){c(H),b()},get delayDuration(){return u()},set delayDuration(H=200){u(H),b()},get disableHoverableContent(){return d()},set disableHoverableContent(H=!1){d(H),b()},get disableCloseOnTriggerClick(){return f()},set disableCloseOnTriggerClick(H=!1){f(H),b()},get disabled(){return h()},set disabled(H=!1){h(H),b()},get open(){return p()},set open(H=!1){p(H),b()},get onOpenChange(){return g()},set onOpenChange(H){g(H),b()},get class(){return v()},set class(H=""){v(H),b()},get contentClass(){return m()},set contentClass(H=""){m(H),b()},get contentContainerClass(){return S()},set contentContainerClass(H=""){S(H),b()},get showArrow(){return I()},set showArrow(H=!0){I(H),b()},get showClose(){return C()},set showClose(H=!1){C(H),b()},get onClose(){return M()},set onClose(H){M(H),b()},get variant(){return O()},set variant(H="default"){O(H),b()},get maxWidth(){return P()},set maxWidth(H="20rem"){P(H),b()},get interactive(){return E()},set interactive(H=!1){E(H),b()},get disableAnimation(){return z()},set disableAnimation(H=!1){z(H),b()},get children(){return G()},set children(H){G(H),b()},get trigger(){return J()},set trigger(H){J(H),b()},get icon(){return K()},set icon(H){K(H),b()},get footer(){return Q()},set footer(H){Q(H),b()},get iconClass(){return $()},set iconClass(H=""){$(H),b()},get footerClass(){return X()},set footerClass(H=""){X(H),b()},get descriptionClass(){return de()},set descriptionClass(H=""){de(H),b()},get onclick(){return me()},set onclick(H){me(H),b()},$set:Dt,$on:(H,W)=>$t(e,H,W)},se=Je(),oe=ce(se);{let H=w(()=>E()?0:u());Rt(oe,()=>Y1,(W,D)=>{D(W,{get delayDuration(){return l(H)},children:(ae,ge)=>{var ue=Je(),pe=ce(ue);{let ke=w(()=>E()?0:u()),ye=w(()=>!E()&&d());Rt(pe,()=>q1,(Z,$e)=>{$e(Z,{onOpenChange:we,get delayDuration(){return l(ke)},get disableHoverableContent(){return l(ye)},get disableCloseOnTriggerClick(){return f()},get open(){return p()},set open(lt){p(lt)},children:(lt,St)=>{var De=Ik(),Le=ce(De);{const bt=(Be,he)=>{let Ne=()=>(he?.()).props;X1(Be,{get triggerProps(){return Ne()},children:(je,Tt)=>{var ee=Je(),Ge=ce(ee);{var it=mt=>{var Mt=Je(),Ue=ce(Mt);On(Ue,()=>J()??ls),k(mt,Mt)},Xe=mt=>{var Mt=Je(),Ue=ce(Mt);On(Ue,()=>G()??ls),k(mt,Mt)};V(Ge,mt=>{J()?mt(it):G()&&mt(Xe,1)})}k(je,ee)},$$slots:{default:!0}})};let sn=w(()=>br("inline-flex",v()));Rt(Le,()=>J1,(Be,he)=>{he(Be,{get class(){return l(sn)},get disabled(){return h()},get onclick(){return me()},"data-tooltip-trigger":!0,child:bt,$$slots:{child:!0}})})}var Qe=R(Le);{var Ct=bt=>{var sn=Je(),Be=ce(sn);Rt(Be,()=>Vm,(he,Ne)=>{Ne(he,{children:(je,Tt)=>{var ee=Je(),Ge=ce(ee);Rt(Ge,()=>Q1,(it,Xe)=>{Xe(it,{role:"tooltip",get side(){return i()},get align(){return o()},get sideOffset(){return a()},get alignOffset(){return c()},get class(){return l(ne)},"data-tooltip-content":!0,"data-overlay-surface":!0,onFocusOutside:()=>{},children:(mt,Mt)=>{var Ue=Pk(),Ke=ce(Ue),Me=te(Ke);{var Xt=Re=>{{let We=w(()=>_.ui_tooltipRich_close_ariaLabel());Ze(Re,{variant:"ghost",size:"icon-compact",onclick:be,class:"absolute -right-1 -top-1 size-5 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground motion-reduce:transition-none",get"aria-label"(){return l(We)},children:(Pt,Ye)=>{ut(Pt,{get icon(){return Fi},size:"xs",class:"w-3 h-3"})},$$slots:{default:!0}})}};V(Me,Re=>{C()&&Re(Xt)})}var tn=R(Me,2),es=te(tn);{var le=Re=>{var We=Mk(),Pt=te(We);{var Ye=at=>{{let Bt=w(()=>br("w-4 h-4 mt-0.5 flex-shrink-0",l(q).iconColor,$()));ut(at,{get icon(){return l(j)},size:"1x",get class(){return l(Bt)}})}};V(Pt,at=>{l(j)&&at(Ye)})}var ze=R(Pt,2);{var pt=at=>{var Bt=Ck(),rt=re(Bt,!0);L(()=>B(rt,t())),k(at,Bt)};V(ze,at=>{t()&&at(pt)})}Y(We),k(Re,We)};V(es,Re=>{(t()||l(j))&&Re(le)})}var ot=R(es,2);{var At=Re=>{var We=Tk(),Pt=re(We,!0);L(Ye=>{wt(We,1,Ye),B(Pt,r())},[()=>Xn(br("type-body opacity-90",de()))]),k(Re,We)};V(ot,Re=>{r()&&Re(At)})}var Zt=R(ot,2);{var Ve=Re=>{var We=Ek(),Pt=te(We);On(Pt,()=>s()??ls),Y(We),k(Re,We)};V(Zt,Re=>{s()&&Re(Ve)})}Y(tn);var ht=R(tn,2);{var Et=Re=>{var We=Ak(),Pt=te(We);On(Pt,()=>Q()??ls),Y(We),L(Ye=>wt(We,1,Ye),[()=>Xn(br("px-3 py-2",X()))]),k(Re,We)};V(ht,Re=>{Q()&&Re(Et)})}Y(Ke);var qe=R(Ke,2);{var yt=Re=>{var We=Je(),Pt=ce(We);{const Ye=(ze,pt)=>{let at=()=>(pt?.()).props;var Bt=Rk();oa(Bt,rt=>({class:rt,...at()}),[()=>br("z-50 bg-border","data-[side=top]:w-px data-[side=top]:h-2","data-[side=bottom]:w-px data-[side=bottom]:h-2","data-[side=left]:h-px data-[side=left]:w-2","data-[side=right]:h-px data-[side=right]:w-2")]),k(ze,Bt)};Rt(Pt,()=>wx,(ze,pt)=>{pt(ze,{child:Ye,$$slots:{child:!0}})})}k(Re,We)};V(qe,Re=>{I()&&Re(yt)})}L(()=>{Hi(Ke,`max-width: ${P()??""};`),wt(tn,1,`px-3 py-2 space-y-1 ${S()??""}`)}),k(mt,Ue)},$$slots:{default:!0}})}),k(je,ee)},$$slots:{default:!0}})}),k(bt,sn)};V(Qe,bt=>{!h()&&(t()||r()||s())&&bt(Ct)})}k(lt,De)},$$slots:{default:!0}})})}k(ae,ue)},$$slots:{default:!0}})})}return k(n,se),Ot(Se)}var Lk=new Set(["$$slots","$$events","$$legacy","leading","title","description","trailing","selected","disabled","class"]),Ok=N('<span data-slot="action-row-leading" class="first-line-icon w-(--menu-icon-size)"><!></span>'),Nk=N('<span data-slot="action-row-description"><!></span>'),Dk=N('<span data-slot="action-row-trailing" class="first-line-icon gap-2"><!></span>'),$k=N('<button><!> <span data-slot="action-row-content" class="flex min-w-0 flex-1 flex-col gap-0.5"><span data-slot="action-row-title" class="min-w-0 break-words"><!></span> <!></span> <!></button>');function ov(n,e){if(new.target)return Nt({component:ov,...n});Lt(e,!0);let t=y(e,"leading",7),r=y(e,"title",7),s=y(e,"description",7),i=y(e,"trailing",7),o=y(e,"selected",7,!1),a=y(e,"disabled",7,!1),c=y(e,"class",7),u=ui(e,Lk);var d={get leading(){return t()},set leading(O){t(O),b()},get title(){return r()},set title(O){r(O),b()},get description(){return s()},set description(O){s(O),b()},get trailing(){return i()},set trailing(O){i(O),b()},get selected(){return o()},set selected(O=!1){o(O),b()},get disabled(){return a()},set disabled(O=!1){a(O),b()},get class(){return c()},set class(O){c(O),b()},$set:Dt,$on:(O,P)=>$t(e,O,P)},f=$k();oa(f,O=>({type:"button",...u,disabled:a(),"data-slot":"menu-action-row","data-selected":o()?"":void 0,class:O}),[()=>br(Jf(),"items-start whitespace-normal text-foreground hover:bg-hover active:bg-active focus-visible:bg-hover focus-visible:outline-solid focus-visible:-outline-offset-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50",o()&&"bg-selected hover:bg-selected focus-visible:bg-selected",c())]);var h=te(f);{var p=O=>{var P=Ok(),E=te(P);On(E,t),Y(P),k(O,P)};V(h,O=>{t()&&O(p)})}var g=R(h,2),v=te(g),m=te(v);On(m,r),Y(v);var S=R(v,2);{var I=O=>{var P=Nk(),E=te(P);On(E,s),Y(P),L(()=>wt(P,1,`min-w-0 break-words ${nk}`)),k(O,P)};V(S,O=>{s()&&O(I)})}Y(g);var C=R(g,2);{var M=O=>{var P=Dk(),E=te(P);On(E,i),Y(P),k(O,P)};V(C,O=>{i()&&O(M)})}return Y(f),k(n,f),Ot(d)}const eh=nv,t$=rv;var Bk=new Set(["$$slots","$$events","$$legacy","value","class","children"]);function av(n,e){if(new.target)return Nt({component:av,...n});Lt(e,!0);let t=y(e,"value",7),r=y(e,"class",7),s=y(e,"children",7),i=ui(e,Bk);var o={get value(){return t()},set value(u){t(u),b()},get class(){return r()},set class(u){r(u),b()},get children(){return s()},set children(u){s(u),b()},$set:Dt,$on:(u,d)=>$t(e,u,d)},a=Je(),c=ce(a);{let u=w(()=>br("mt-3",r()));Rt(c,()=>sv,(d,f)=>{f(d,us({get value(){return t()},get class(){return l(u)}},()=>i,{children:(h,p)=>{var g=Je(),v=ce(g);On(v,()=>s()??ls),k(h,g)},$$slots:{default:!0}}))})}return k(n,a),Ot(o)}var zk=N('<img loading="lazy"/>');function lv(n,e){if(new.target)return Nt({component:lv,...n});Lt(e,!0);let t=y(e,"identity",7),r=y(e,"avatarUrl",7),s=y(e,"size",7,16),i=y(e,"class",7,""),o=y(e,"alt",7),a=y(e,"fallback",7),c=fe(!1);const u=w(()=>r()||`https://github.com/${encodeURIComponent(t())}.png?size=${s()*2}`);sw(()=>{t(),l(u),x(c,!1)});var d={get identity(){return t()},set identity(v){t(v),b()},get avatarUrl(){return r()},set avatarUrl(v){r(v),b()},get size(){return s()},set size(v=16){s(v),b()},get class(){return i()},set class(v=""){i(v),b()},get alt(){return o()},set alt(v){o(v),b()},get fallback(){return a()},set fallback(v){a(v),b()},$set:Dt,$on:(v,m)=>$t(e,v,m)},f=Je(),h=ce(f);{var p=v=>{var m=Je(),S=ce(m);On(S,()=>a()??ls),k(v,m)},g=v=>{var m=zk();L(()=>{xt(m,"src",l(u)),xt(m,"width",s()),xt(m,"height",s()),xt(m,"alt",o()??""),xt(m,"aria-hidden",o()===void 0?"true":void 0),wt(m,1,Xn(i()))}),xo("error",m,()=>{x(c,!0)}),Fd(m),k(v,m)};V(h,v=>{l(c)?v(p):v(g,-1)})}return k(n,f),Ot(d)}var Fk=new Set(["$$slots","$$events","$$legacy","children"]),Hk=Wi('<path d="M208,20H72A36,36,0,0,0,36,56V224a12,12,0,0,0,12,12H192a12,12,0,0,0,0-24H60v-4a12,12,0,0,1,12-12H208a12,12,0,0,0,12-12V32A12,12,0,0,0,208,20ZM120,44h36v59l-10.51-8.41a12,12,0,0,0-15,0L120,103Zm76,128H72a35.59,35.59,0,0,0-12,2.06V56A12,12,0,0,1,72,44H96v84a12,12,0,0,0,19.5,9.37l22.49-18,22.51,18A12,12,0,0,0,180,128V44h16Z"></path>'),Uk=Wi('<path d="M208,32V192H72a24,24,0,0,0-24,24V56A24,24,0,0,1,72,32h40v96l32-24,32,24V32Z" opacity="0.2"></path><path d="M208,24H72A32,32,0,0,0,40,56V224a8,8,0,0,0,8,8H192a8,8,0,0,0,0-16H56a16,16,0,0,1,16-16H208a8,8,0,0,0,8-8V32A8,8,0,0,0,208,24ZM120,40h48v72L148.79,97.6a8,8,0,0,0-9.6,0L120,112Zm80,144H72a31.82,31.82,0,0,0-16,4.29V56A16,16,0,0,1,72,40h32v88a8,8,0,0,0,12.8,6.4L144,114l27.21,20.4A8,8,0,0,0,176,136a8.1,8.1,0,0,0,3.58-.84A8,8,0,0,0,184,128V40h16Z"></path>',1),Vk=Wi('<path d="M208,24H72A32,32,0,0,0,40,56V224a8,8,0,0,0,8,8H192a8,8,0,0,0,0-16H56a16,16,0,0,1,16-16H208a8,8,0,0,0,8-8V32A8,8,0,0,0,208,24Zm-24,96-25.61-19.2a4,4,0,0,0-4.8,0L128,120V40h56Z"></path>'),Wk=Wi('<path d="M208,26H72A30,30,0,0,0,42,56V224a6,6,0,0,0,6,6H192a6,6,0,0,0,0-12H54v-2a18,18,0,0,1,18-18H208a6,6,0,0,0,6-6V32A6,6,0,0,0,208,26ZM118,38h52v78L147.59,99.2a6,6,0,0,0-7.2,0L118,116Zm84,148H72a29.87,29.87,0,0,0-18,6V56A18,18,0,0,1,72,38h34v90a6,6,0,0,0,9.6,4.8L144,111.5l28.41,21.3A6,6,0,0,0,182,128V38h20Z"></path>'),Kk=Wi('<path d="M208,24H72A32,32,0,0,0,40,56V224a8,8,0,0,0,8,8H192a8,8,0,0,0,0-16H56a16,16,0,0,1,16-16H208a8,8,0,0,0,8-8V32A8,8,0,0,0,208,24ZM120,40h48v72L148.79,97.6a8,8,0,0,0-9.6,0L120,112Zm80,144H72a31.82,31.82,0,0,0-16,4.29V56A16,16,0,0,1,72,40h32v88a8,8,0,0,0,12.8,6.4L144,114l27.21,20.4A8,8,0,0,0,176,136a8,8,0,0,0,8-8V40h16Z"></path>'),jk=Wi('<path d="M208,28H72A28,28,0,0,0,44,56V224a4,4,0,0,0,4,4H192a4,4,0,0,0,0-8H52v-4a20,20,0,0,1,20-20H208a4,4,0,0,0,4-4V32A4,4,0,0,0,208,28Zm-92,8h56v84l-25.61-19.2a4,4,0,0,0-4.8,0L116,120Zm88,152H72a27.94,27.94,0,0,0-20,8.42V56A20,20,0,0,1,72,36h36v92a4,4,0,0,0,6.4,3.2L144,109l29.61,22.2a4,4,0,0,0,2.4.8,4,4,0,0,0,4-4V36h24Z"></path>'),Gk=Wi('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function cv(n,e){if(new.target)return Nt({component:cv,...n});Lt(e,!0);const t=Cw();let r=y(e,"children",7),s=ui(e,Fk),i=w(()=>e.weight??t.weight??"regular"),o=w(()=>e.color??t.color??"currentColor"),a=w(()=>e.size??t.size??"1em"),c=w(()=>e.mirrored??t.mirrored??!1);function u(P){let{weight:E,color:z,size:G,mirrored:J,...K}=P;return K}var d={get children(){return r()},set children(P){r(P),b()},$set:Dt,$on:(P,E)=>$t(e,P,E)},f=Gk();oa(f,(P,E)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:l(a),height:l(a),fill:l(o),transform:l(c)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...P,...E}),[()=>u(t),()=>u(s)]);var h=te(f);{var p=P=>{var E=Je(),z=ce(E);On(z,r),k(P,E)};V(h,P=>{r()&&P(p)})}var g=R(h,2);{var v=P=>{var E=Hk();k(P,E)},m=P=>{var E=Uk();Ht(),k(P,E)},S=P=>{var E=Vk();k(P,E)},I=P=>{var E=Wk();k(P,E)},C=P=>{var E=Kk();k(P,E)},M=P=>{var E=jk();k(P,E)},O=P=>{var E=Vt();E.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),k(P,E)};V(g,P=>{l(i)==="bold"?P(v):l(i)==="duotone"?P(m,1):l(i)==="fill"?P(S,2):l(i)==="light"?P(I,3):l(i)==="regular"?P(C,4):l(i)==="thin"?P(M,5):P(O,-1)})}return Y(f),k(n,f),Ot(d)}function Ba(n,e){if(new.target)return Nt({component:Ba,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(i=16){t(i),b()},get class(){return r()},set class(i=""){r(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return cv(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Ot(s)}function th(n,e){if(new.target)return Nt({component:th,...n});Lt(e,!0);const t=g=>{var v=Je(),m=ce(v);{var S=M=>{ut(M,{get icon(){return Js},get size(){return a()},class:"shrink-0 text-muted-foreground"})},I=M=>{{let O=w(()=>s()==="github"?Df:$f);ut(M,{get icon(){return l(O)},get size(){return a()},class:"shrink-0 text-muted-foreground"})}},C=M=>{Ba(M,{get size(){return a()},class:"shrink-0 text-muted-foreground"})};V(m,M=>{o()?M(S):s()?M(I,1):M(C,-1)})}k(g,v)};let r=y(e,"owner",7),s=y(e,"provider",7),i=y(e,"avatarUrl",7),o=y(e,"local",7,!1),a=y(e,"size",7,20);var c={get owner(){return r()},set owner(g){r(g),b()},get provider(){return s()},set provider(g){s(g),b()},get avatarUrl(){return i()},set avatarUrl(g){i(g),b()},get local(){return o()},set local(g=!1){o(g),b()},get size(){return a()},set size(g=20){a(g),b()},$set:Dt,$on:(g,v)=>$t(e,g,v)},u=Je(),d=ce(u);{var f=g=>{lv(g,{get identity(){return r()},get avatarUrl(){return i()},get size(){return a()},class:"shrink-0 rounded-full",get fallback(){return t}})},h=g=>{{let v=w(()=>r()??"");Qm(g,{get avatarUrl(){return i()},get label(){return l(v)},get size(){return a()},referrerpolicy:"no-referrer"})}},p=g=>{t(g)};V(d,g=>{r()&&s()==="github"?g(f):i()?g(h,1):g(p,-1)})}return k(n,u),Ot(c)}var qk=Wi('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"></path></svg>');function nh(n,e){if(new.target)return Nt({component:nh,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(o=16){t(o),b()},get class(){return r()},set class(o=""){r(o),b()},$set:Dt,$on:(o,a)=>$t(e,o,a)},i=qk();return L(()=>{xt(i,"width",t()),xt(i,"height",t()),wt(i,0,Xn(r()))}),k(n,i),Ot(s)}function Jk(n){switch(n){case"running":return _.layout_activeCard_running_header();case"responding":return _.agentOverview_hierarchyGraph_statusResponding_label();case"unread":return _.layout_activeCard_unread_header();case"completed":return _.agentOverview_hierarchyGraph_statusCompleted_label();case"failed":return _.agentOverview_hierarchyGraph_statusFailed_label();case"question":return _.chat_questionWizard_title();case"waiting":return _.agentOverview_hierarchyGraph_statusWaiting_label();case"needs-permission":return _.events_activity_agentAskedPermission_label();case"attention-discussion":return _.chat_agentCard_attentionDiscussion_label();case"attention-blocker":return _.chat_agentCard_attentionBlocker_label();case"idle":return _.agentOverview_hierarchyGraph_statusIdle_label()}}var Xk=N('<span class="agent-avatar-unread-dot svelte-v6mebl" data-avatar-unread-dot=""></span>'),Qk=N('<span role="img" data-agent-avatar-with-state="" data-agent-avatar-surface=""><!> <!></span>');function uv(n,e){if(new.target)return Nt({component:uv,...n});Lt(e,!0);let t=y(e,"agentId",7),r=y(e,"specialist",7,null),s=y(e,"icon",7,null),i=y(e,"provider",7,void 0),o=y(e,"variant",7,_p),a=y(e,"size",7,void 0),c=y(e,"state",7,"idle"),u=y(e,"class",7,"");const d=w(()=>Jk(c())),f=w(()=>a()??Bx[o()].surface),h=w(()=>a()===void 0);var p={get agentId(){return t()},set agentId(C){t(C),b()},get specialist(){return r()},set specialist(C=null){r(C),b()},get icon(){return s()},set icon(C=null){s(C),b()},get provider(){return i()},set provider(C=void 0){i(C),b()},get variant(){return o()},set variant(C=_p){o(C),b()},get size(){return a()},set size(C=void 0){a(C),b()},get state(){return c()},set state(C="idle"){c(C),b()},get class(){return u()},set class(C=""){u(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},g=Qk();let v;var m=te(g);$x(m,{get agentId(){return t()},get specialist(){return r()},get icon(){return s()},get provider(){return i()},get variant(){return o()},get size(){return a()}});var S=R(m,2);{var I=C=>{var M=Xk();k(C,M)};V(S,C=>{c()==="unread"&&C(I)})}return Y(g),L(()=>{wt(g,1,`agent-avatar-with-state agent-avatar-with-state--${c()??""} ${u()??""}`,"svelte-v6mebl"),xt(g,"aria-label",l(d)),xt(g,"title",l(d)),xt(g,"data-avatar-state",c()),xt(g,"data-avatar-variant",l(h)?o():void 0),v=Hi(g,"",v,{width:l(h)?void 0:`${l(f)}px`,height:l(h)?void 0:`${l(f)}px`})}),k(n,g),Ot(p)}function qd(n){return aw(n)}function Yk(n){return lw(n)}function Ep(n,e={}){const{hasUnread:t=!1,isActive:r=!1,isCompleted:s=!1,isFailed:i=!1,hasQuestion:o=!1,hasPermissionRequest:a=!1,attentionKind:c=null}=e;return s&&!qd(n)?"completed":i||n.status===Ec.Error||n.status==="failed"?"failed":o?"question":a?"needs-permission":c==="discussion"?"attention-discussion":c==="blocker"?"attention-blocker":Yk(n)?"waiting":qd(n)?"running":t&&!r?"unread":"idle"}function Zk(n,e={}){if(!n)return Ep({},e);const t=xx(n),r=n.status===Ec.Completed||String(n.status).toLowerCase()==="completed",s=n.status===Ec.Error||n.status===Ec.Deleted||String(n.status).toLowerCase()==="failed";return Ep(Pm(n),{...e,hasQuestion:ck(n)||e.hasQuestion===!0,hasUnread:e.hasUnread??n.hasUnread,isCompleted:e.isCompleted??r,isFailed:e.isFailed??s,attentionKind:e.attentionKind??t?.kind??null})}function n$(n){return n?qd(Pm(n)):!1}function e_(n){if(!n||n.status!=="Open")return"";const e=[],t=[];if((n.mergeConflicts||n.mergeableState==="dirty")&&e.push(_.workspace_prStatus_mergeConflicts_tooltip()),n.mergeableState==="behind"&&e.push(_.workspace_prStatus_behindBase_tooltip()),n.mergeableState==="unstable"&&e.push(_.workspace_prStatus_checksUnstable_tooltip()),n.mergeableState==="unknown"&&e.push(_.workspace_prStatus_mergeabilityUnknown_tooltip()),n.ciStatus&&n.ciStatus.total>0){const s=as(n.ciStatus.total);if(n.ciStatus.failed>0){const i=as(n.ciStatus.failed);e.push(n.ciStatus.pending>0?_.workspace_prStatus_checksFailingRunning_tooltip({failed:i,total:s,pending:as(n.ciStatus.pending)}):_.workspace_prStatus_checksFailing_tooltip({failed:i,total:s}))}else n.ciStatus.pending>0?e.push(_.workspace_prStatus_checksRunning_tooltip({pending:as(n.ciStatus.pending),total:s})):t.push(_.workspace_prStatus_checksPassing_tooltip({passed:as(n.ciStatus.passed),total:s}))}if(n.reviewDecision==="CHANGES_REQUESTED"&&e.push(_.workspace_prStatus_changesRequested_tooltip()),n.reviewDecision==="REVIEW_REQUIRED"&&e.push(_.workspace_prStatus_awaitingReview_tooltip()),n.mergeableState==="blocked"&&!n.reviewDecision&&e.push(_.workspace_prStatus_awaitingReview_tooltip()),n.reviewComments&&n.reviewComments>0){const s=as(n.reviewComments);e.push(n.reviewComments===1?_.workspace_prStatus_reviewComments_one({count:s}):_.workspace_prStatus_reviewComments_many({count:s}))}n.reviewDecision==="APPROVED"&&n.approvedBy&&n.approvedBy.length>0&&t.push(_.workspace_prStatus_approvedBy_tooltip({names:n.approvedBy.join(", ")}));const r=[...e,...t];return r.length>0?r.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/Bgegixo2.js","/app/immutable/chunks/7rNOGHzs.js","/app/immutable/chunks/B8o4lNgr.js","/app/immutable/chunks/CQ4a5a4v.js","/app/immutable/chunks/DmsDslNo.js","/app/immutable/chunks/UyBYtOpv.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/D2g8BuR1.js","/app/immutable/chunks/CiENRH6A.js","/app/immutable/chunks/DCaHy20k.js","/app/immutable/chunks/CzrrO9Ap.js","/app/immutable/chunks/BlOn95cv.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/i-jR1dYx.js","/app/immutable/chunks/CRwmdgt6.js","/app/immutable/chunks/CjSUqH7t.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/DsfzfmK9.js","/app/immutable/chunks/KQTrHxko.js","/app/immutable/chunks/CFejQM6t.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/C_n9DeKj.js","/app/immutable/chunks/DzMmhJrp.js","/app/immutable/chunks/B2KJmqK3.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/D4jXWSLn.js","/app/immutable/chunks/yAjP_kdp.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/DNen9YXB.js","/app/immutable/chunks/CC6TxnfE.js","/app/immutable/chunks/DBIwerkr.js","/app/immutable/chunks/Cqzl755B.js","/app/immutable/chunks/CiPGfArf.js","/app/immutable/assets/register.CUyDR59i.css","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/DQ5DxPhl.js","/app/immutable/assets/terminal-manager.MhP_vFvK.css","/app/immutable/chunks/BENBNSN7.js","/app/immutable/chunks/C_tu278J.js","/app/immutable/chunks/BkBdyRjM.js","/app/immutable/chunks/PR2rc_KV.js","/app/immutable/chunks/CB-g50lR.js","/app/immutable/chunks/CPQdU3ZA.js","/app/immutable/chunks/D-cnPaTJ.js","/app/immutable/assets/pending-agent-deletions.UE5obH5A.css","/app/immutable/chunks/Bn-4GS40.js","/app/immutable/chunks/lfJ8pseq.js","/app/immutable/chunks/D2AmAQEr.js","/app/immutable/chunks/CUrlpJj4.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/D5XrjD_m.js","/app/immutable/chunks/BpXeqZkK.js","/app/immutable/chunks/ryFwnMjp.js","/app/immutable/chunks/DH-0T9oO.js"])))=>i.map(i=>d[i]);
2
+ var J0=Object.defineProperty;var rp=n=>{throw TypeError(n)};var X0=(n,e,t)=>e in n?J0(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var nt=(n,e,t)=>X0(n,typeof e!="symbol"?e+"":e,t),Y0=(n,e,t)=>e.has(n)||rp("Cannot "+t);var ri=(n,e,t)=>(Y0(n,e,"read from private field"),t?t.call(n):e.get(n)),ba=(n,e,t)=>e.has(n)?rp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{aa as Q0,cd as Z0,bK as sp,Q as ip,bJ as op,O as ap,at as ew,by as tw,au as nw,aE as rw,bo as Vi,bs as Lt,a7 as Je,ay as ce,W as k,aD as l,a5 as te,bf as ls,bA as Q,bn as Ot,c9 as w,aA as b,aB as N,bH as x,bS as R,b_ as L,bl as re,bO as B,cb as sw,bV as fe,aw as xo,bz as Fd,be as Ht,b$ as Vt,aC as Wi,bv as lp,al as iw,ai as So,ca as ft,aj as Kr,br as Ar,bb as vl,c3 as io,aG as ow,bk as Lf,c0 as qo,bj as ql,c5 as ii}from"./B8o4lNgr.js";import{dN as Pm,F as aw,E as lw,Y as cw,Q as Of,R as uw,h as Hd,aB as dw,aa as fw,S as hw,dO as pw,$ as gw,c8 as Nf,cB as rd,bY as mw,aR as vw,cA as bw}from"./KQTrHxko.js";import{t as Nt,bq as y,a_ as V,by as Dt,b as $t,br as ui,bt as us,bo as _,bw as cp,bs as Jl,bu as rn,_ as cs}from"./7rNOGHzs.js";import{t as as,H as Ss,g as yw,i as Im,u as Lm,j as ww,v as xw,E as Ud,c as Vd,C as Bo}from"./DzMmhJrp.js";import{aB as Om,cO as kw,aA as _w,bD as Sw,F as ut,c_ as Fi,c$ as Cw,bl as Js,bq as Df,br as $f,aP as Mw,aQ as sd,bT as Tw,bU as Ew,cl as Aw,bC as Dc,cm as Bf,aX as Nm,a7 as Dm,cn as Rw,ay as Pw,av as Da,b9 as Iw,bs as zf,bf as Ff,s as Lw,bB as Ow,aG as up,be as Fo,cU as $m,cR as Nw,ci as Bm,cF as zm,aj as Dw,au as Fm,ax as dp,ao as $w,ai as Bw,ar as zw,cS as Fw,aL as id,cj as Hw,bu as Uw,c7 as Vw,ct as fp,V as Ww,cC as Kw,as as jw,bR as Gw,ap as qw,c3 as Jw,bK as Xw,cV as Yw,ak as Qw,bj as Zw,aZ as e1,cZ as t1,al as n1,bP as r1,aR as s1,a_ as i1,bZ as o1,bb as a1,cs as l1,cy as c1,bO as u1,bm as d1,bg as Wd,v as f1,b8 as h1,ck as hp,aO as p1,at as Hm,c9 as $c,$ as g1}from"./CFejQM6t.js";import{aJ as m1,az as v1,av as b1,ah as y1,Q as w1,cW as x1,aE as k1,cI as pp,aR as gp,cs as _1,aG as mp,s as ya,ao as S1,a1 as C1,cR as M1,aU as T1,a4 as E1,cz as A1,cv as R1,ct as P1,cF as I1,cH as L1,cE as O1,cu as N1,aC as od,ax as vp,X as D1,S as sl,O as $1,ay as B1,W as z1,m as F1,T as H1,a5 as U1,ak as Um,j as ad}from"./Sd4DhpzB.js";import{c as oa,f as br,l as Hi,k as wt,d as Xn,s as xt,a as Pl,h as Cs,i as Tc,I as li}from"./DmsDslNo.js";import{s as On}from"./CQ4a5a4v.js";import{aT as $a,aJ as Ls,bn as Hf,av as V1,aH as W1,aF as K1,aE as j1,aS as G1,bp,an as q1,as as J1,at as X1,a5 as Vm,aq as Y1,ar as Q1,f as Ze,br as Z1,aW as ex,aw as tx,aQ as nx,aj as rx,am as Eu,ax as Wm}from"./Bgegixo2.js";import{a as sx,J as ja,P as ix,s as Uf,k as Vf,l as Ho,K as Km,o as jm,M as Wf,x as ox,v as ax,y as Gm,L as Do,H as lx,R as cx,n as ux,g as dx,i as fx,h as hx,E as px}from"./DSjRkndX.js";import{i as qm,f as gx,I as Xr,a as mx}from"./DZX-XWnb.js";import"./DbAK3Zju.js";import{c as Rt}from"./CiENRH6A.js";import{b as Yn}from"./D2g8BuR1.js";import{b as Jm}from"./BaQ9zUUl.js";import{f as vx,g as bx}from"./DsNWmyox.js";import{F as yx,c as wx,n as _s,t as yp}from"./lfJ8pseq.js";import{c as Ga,l as _t}from"./ChTqQfQN.js";import"./D-cnPaTJ.js";import{mU as xx,c as Ec,Hq as It,n5 as kx,bi as Xm,AU as wp,pX as Kd,Hg as _x,eb as xp,fS as Sx,n6 as Kf,g as Cx,rs as kp,K7 as Mx,Km as Tx,Kl as Ex,K6 as Ax,Bo as Rx,F$ as Px,xK as Ix,jW as Lx,G5 as Ox}from"./CRwmdgt6.js";import{o as Nx,t as Dx,s as Ym,H as _p,e as $x,y as Bx,J as jf,L as zx,S as Fx,I as Hx,p as Ux,P as Vx,q as Gf,a0 as yr,C as Wx,r as qf,B as Kx,k as jx,x as ld,w as Gx,G as qx,T as Jx,u as Xx,v as Sp,h as Yx,W as Qx,l as Zx,n as ek}from"./B1s3oEqm.js";import{F as tk,n as Jf,m as nk,t as jd,u as Xf,k as Qm,O as wa,M as Zm}from"./Ck-Ax5yG.js";import{ce as Bc,B as Cp,bx as rk,bE as sk,T as Mp,aK as ev,aL as ik,aI as ok,aJ as ak,aO as lk}from"./C_tu278J.js";import{bI as ck,a9 as uk}from"./CB-g50lR.js";import{g as dk}from"./CMiilI_P.js";import{M as tv,E as Yf,F as fk,x as hk}from"./DCaHy20k.js";import{s as pk,C as Tp}from"./BGspgxWf.js";import"./CKEqC8_B.js";import"./DFHyIdsA.js";import{y as xa}from"./yAjP_kdp.js";import{I as Qf}from"./DlodKoXT.js";import{i as cd}from"./BkBdyRjM.js";import{d as gk}from"./D5XrjD_m.js";function ZD(n,e){var t=ap,r=ip,s=n();return{subscribe:Z0(s,o=>{var a=s!==n(),c,u=ip,d=ap;sp(r),op(t);try{c=ew(()=>{tw(()=>{const f=n();a&&o(f)})})}finally{sp(u),op(d)}return a=!0,c}).subscribe}}function e$(n){let e;const t=Q0(s=>{let i=!1;const o=n.subscribe(a=>{e=a,i&&s()});return i=!0,o});function r(){return nw()?(t(),e):rw(n)}return"set"in n?{get current(){return r()},set current(s){n.set(s)}}:{get current(){return r()}}}var mk=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","type","disabled","openOnHover","openDelay","closeDelay"]),vk=N("<button><!></button>");function nv(n,e){const t=Vi();if(new.target)return Nt({component:nv,...n});Lt(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>$a(t)),o=y(e,"ref",15,null),a=y(e,"type",7,"button"),c=y(e,"disabled",7,!1),u=y(e,"openOnHover",7,!1),d=y(e,"openDelay",7,700),f=y(e,"closeDelay",7,300),h=ui(e,mk);const p=Nx.create({id:Ls(()=>i()),ref:Ls(()=>o(),m=>o(m)),disabled:Ls(()=>!!c()),openOnHover:Ls(()=>u()),openDelay:Ls(()=>d()),closeDelay:Ls(()=>f())}),g=w(()=>Hf(h,p.props,{type:a()}));var v={get children(){return r()},set children(m){r(m),b()},get child(){return s()},set child(m){s(m),b()},get id(){return i()},set id(m=$a(t)){i(m),b()},get ref(){return o()},set ref(m=null){o(m),b()},get type(){return a()},set type(m="button"){a(m),b()},get disabled(){return c()},set disabled(m=!1){c(m),b()},get openOnHover(){return u()},set openOnHover(m=!1){u(m),b()},get openDelay(){return d()},set openDelay(m=700){d(m),b()},get closeDelay(){return f()},set closeDelay(m=300){f(m),b()},$set:Dt,$on:(m,S)=>$t(e,m,S)};return tk(n,{get id(){return i()},get ref(){return p.opts.ref},children:(m,S)=>{var I=Je(),C=ce(I);{var M=P=>{var E=Je(),z=ce(E);On(z,s,()=>({props:l(g)})),k(P,E)},O=P=>{var E=vk();oa(E,()=>({...l(g)}));var z=te(E);On(z,()=>r()??ls),Q(E),k(P,E)};V(C,P=>{s()?P(M):P(O,-1)})}k(m,I)},$$slots:{default:!0}}),Ot(v)}var bk=new Set(["$$slots","$$events","$$legacy","ref"]);function rv(n,e){if(new.target)return Nt({component:rv,...n});Lt(e,!0);let t=y(e,"ref",15,null),r=ui(e,bk);var s={get ref(){return t()},set ref(i=null){t(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return yx(n,us(()=>r,{"data-popover-arrow":"",get ref(){return t()},set ref(i){t(i)}})),Ot(s)}var yk=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","value"]),wk=N("<div><!></div>");function sv(n,e){const t=Vi();if(new.target)return Nt({component:sv,...n});Lt(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>$a(t)),o=y(e,"ref",15,null),a=y(e,"value",7),c=ui(e,yk);const u=Dx.create({value:Ls(()=>a()),id:Ls(()=>i()),ref:Ls(()=>o(),m=>o(m))}),d=w(()=>Hf(c,u.props));var f={get children(){return r()},set children(m){r(m),b()},get child(){return s()},set child(m){s(m),b()},get id(){return i()},set id(m=$a(t)){i(m),b()},get ref(){return o()},set ref(m=null){o(m),b()},get value(){return a()},set value(m){a(m),b()},$set:Dt,$on:(m,S)=>$t(e,m,S)},h=Je(),p=ce(h);{var g=m=>{var S=Je(),I=ce(S);On(I,s,()=>({props:l(d)})),k(m,S)},v=m=>{var S=wk();oa(S,()=>({...l(d)}));var I=te(S);On(I,()=>r()??ls),Q(S),k(m,S)};V(p,m=>{s()?m(g):m(v,-1)})}return k(n,h),Ot(f)}const xk=G1({component:"toggle",parts:["root"]});var Vl,Wl;const qh=class qh{constructor(e){nt(this,"opts");nt(this,"attachment");ba(this,Vl,w(()=>({pressed:this.opts.pressed.current})));ba(this,Wl,w(()=>({[xk.root]:"",id:this.opts.id.current,"data-disabled":j1(this.opts.disabled.current),"aria-pressed":K1(this.opts.pressed.current),"data-state":kk(this.opts.pressed.current),disabled:W1(this.opts.disabled.current),onclick:this.onclick,...this.attachment})));this.opts=e,this.attachment=V1(this.opts.ref),this.onclick=this.onclick.bind(this)}static create(e){return new qh(e)}onclick(e){this.opts.disabled.current||(this.opts.pressed.current=!this.opts.pressed.current)}get snippetProps(){return l(ri(this,Vl))}set snippetProps(e){x(ri(this,Vl),e)}get props(){return l(ri(this,Wl))}set props(e){x(ri(this,Wl),e)}};Vl=new WeakMap,Wl=new WeakMap;let Gd=qh;function kk(n){return n?"on":"off"}var _k=new Set(["$$slots","$$events","$$legacy","ref","id","pressed","onPressedChange","disabled","type","children","child"]),Sk=N("<button><!></button>");function iv(n,e){const t=Vi();if(new.target)return Nt({component:iv,...n});Lt(e,!0);let r=y(e,"ref",15,null),s=y(e,"id",23,()=>$a(t)),i=y(e,"pressed",15,!1),o=y(e,"onPressedChange",7,bp),a=y(e,"disabled",7,!1),c=y(e,"type",7,"button"),u=y(e,"children",7),d=y(e,"child",7),f=ui(e,_k);const h=Gd.create({pressed:Ls(()=>i(),C=>{i(C),o()(C)}),disabled:Ls(()=>a()??!1),id:Ls(()=>s()),ref:Ls(()=>r(),C=>r(C))}),p=w(()=>Hf(f,h.props,{type:c()}));var g={get ref(){return r()},set ref(C=null){r(C),b()},get id(){return s()},set id(C=$a(t)){s(C),b()},get pressed(){return i()},set pressed(C=!1){i(C),b()},get onPressedChange(){return o()},set onPressedChange(C=bp){o(C),b()},get disabled(){return a()},set disabled(C=!1){a(C),b()},get type(){return c()},set type(C="button"){c(C),b()},get children(){return u()},set children(C){u(C),b()},get child(){return d()},set child(C){d(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},v=Je(),m=ce(v);{var S=C=>{var M=Je(),O=ce(M);{let P=w(()=>({props:l(p),...h.snippetProps}));On(O,d,()=>l(P))}k(C,M)},I=C=>{var M=Sk();oa(M,()=>({...l(p)}));var O=te(M);On(O,()=>u()??ls,()=>h.snippetProps),Q(M),k(C,M)};V(m,C=>{d()?C(S):C(I,-1)})}return k(n,v),Ot(g)}var Ck=N('<h4 class="type-body font-medium"> </h4>'),Mk=N('<div class="flex items-start gap-2"><!> <!></div>'),Tk=N("<p> </p>"),Ek=N('<div class="type-caption"><!></div>'),Ak=N("<div><!></div>"),Rk=N("<div></div>"),Pk=N('<div class="relative"><!> <div><!> <!> <!></div> <!></div> <!>',1),Ik=N("<!><!>",1);function Zf(n,e){if(new.target)return Nt({component:Zf,...n});Lt(e,!0);let t=y(e,"title",7,""),r=y(e,"description",7,""),s=y(e,"content",7),i=y(e,"side",7,"top"),o=y(e,"align",7,"center"),a=y(e,"sideOffset",7,8),c=y(e,"alignOffset",7,0),u=y(e,"delayDuration",7,200),d=y(e,"disableHoverableContent",7,!1),f=y(e,"disableCloseOnTriggerClick",7,!1),h=y(e,"disabled",7,!1),p=y(e,"open",15,!1),g=y(e,"onOpenChange",7),v=y(e,"class",7,""),m=y(e,"contentClass",7,""),S=y(e,"contentContainerClass",7,""),I=y(e,"showArrow",7,!0),C=y(e,"showClose",7,!1),M=y(e,"onClose",7),O=y(e,"variant",7,"default"),P=y(e,"maxWidth",7,"20rem"),E=y(e,"interactive",7,!1),z=y(e,"disableAnimation",7,!1),G=y(e,"children",7),J=y(e,"trigger",7),K=y(e,"icon",7),Y=y(e,"footer",7),$=y(e,"iconClass",7,""),X=y(e,"footerClass",7,""),de=y(e,"descriptionClass",7,""),me=y(e,"onclick",7);const ie={default:{bg:"bg-popover",text:"text-popover-foreground",border:"",icon:null,iconColor:""},info:{bg:"bg-popover",text:"text-info",border:"border border-info/40",icon:Sw,iconColor:"text-info"},success:{bg:"bg-popover",text:"text-success",border:"border border-success/40",icon:_w,iconColor:"text-success"},warning:{bg:"bg-popover",text:"text-warning-ink",border:"border border-warning/40",icon:kw,iconColor:"text-warning-ink"},error:{bg:"bg-danger",text:"text-danger-background",border:"border border-danger/40",icon:Om,iconColor:"text-danger-background"},custom:{bg:"",text:"",border:"",icon:null,iconColor:""}},q=w(()=>ie[O()]),j=w(()=>K()||l(q).icon),ne=w(()=>br("overlay-surface z-(--layer-tooltip)",!z()&&"tooltip-motion",l(q).bg,l(q).text,l(q).border,m()));function we(H){p(H),g()?.(H)}function be(){p(!1),M()?.()}var Se={get title(){return t()},set title(H=""){t(H),b()},get description(){return r()},set description(H=""){r(H),b()},get content(){return s()},set content(H){s(H),b()},get side(){return i()},set side(H="top"){i(H),b()},get align(){return o()},set align(H="center"){o(H),b()},get sideOffset(){return a()},set sideOffset(H=8){a(H),b()},get alignOffset(){return c()},set alignOffset(H=0){c(H),b()},get delayDuration(){return u()},set delayDuration(H=200){u(H),b()},get disableHoverableContent(){return d()},set disableHoverableContent(H=!1){d(H),b()},get disableCloseOnTriggerClick(){return f()},set disableCloseOnTriggerClick(H=!1){f(H),b()},get disabled(){return h()},set disabled(H=!1){h(H),b()},get open(){return p()},set open(H=!1){p(H),b()},get onOpenChange(){return g()},set onOpenChange(H){g(H),b()},get class(){return v()},set class(H=""){v(H),b()},get contentClass(){return m()},set contentClass(H=""){m(H),b()},get contentContainerClass(){return S()},set contentContainerClass(H=""){S(H),b()},get showArrow(){return I()},set showArrow(H=!0){I(H),b()},get showClose(){return C()},set showClose(H=!1){C(H),b()},get onClose(){return M()},set onClose(H){M(H),b()},get variant(){return O()},set variant(H="default"){O(H),b()},get maxWidth(){return P()},set maxWidth(H="20rem"){P(H),b()},get interactive(){return E()},set interactive(H=!1){E(H),b()},get disableAnimation(){return z()},set disableAnimation(H=!1){z(H),b()},get children(){return G()},set children(H){G(H),b()},get trigger(){return J()},set trigger(H){J(H),b()},get icon(){return K()},set icon(H){K(H),b()},get footer(){return Y()},set footer(H){Y(H),b()},get iconClass(){return $()},set iconClass(H=""){$(H),b()},get footerClass(){return X()},set footerClass(H=""){X(H),b()},get descriptionClass(){return de()},set descriptionClass(H=""){de(H),b()},get onclick(){return me()},set onclick(H){me(H),b()},$set:Dt,$on:(H,W)=>$t(e,H,W)},se=Je(),oe=ce(se);{let H=w(()=>E()?0:u());Rt(oe,()=>Q1,(W,D)=>{D(W,{get delayDuration(){return l(H)},children:(ae,ge)=>{var ue=Je(),pe=ce(ue);{let ke=w(()=>E()?0:u()),ye=w(()=>!E()&&d());Rt(pe,()=>q1,(Z,$e)=>{$e(Z,{onOpenChange:we,get delayDuration(){return l(ke)},get disableHoverableContent(){return l(ye)},get disableCloseOnTriggerClick(){return f()},get open(){return p()},set open(lt){p(lt)},children:(lt,St)=>{var De=Ik(),Le=ce(De);{const bt=(Be,he)=>{let Ne=()=>(he?.()).props;X1(Be,{get triggerProps(){return Ne()},children:(je,Tt)=>{var ee=Je(),Ge=ce(ee);{var it=mt=>{var Mt=Je(),Ue=ce(Mt);On(Ue,()=>J()??ls),k(mt,Mt)},Xe=mt=>{var Mt=Je(),Ue=ce(Mt);On(Ue,()=>G()??ls),k(mt,Mt)};V(Ge,mt=>{J()?mt(it):G()&&mt(Xe,1)})}k(je,ee)},$$slots:{default:!0}})};let sn=w(()=>br("inline-flex",v()));Rt(Le,()=>J1,(Be,he)=>{he(Be,{get class(){return l(sn)},get disabled(){return h()},get onclick(){return me()},"data-tooltip-trigger":!0,child:bt,$$slots:{child:!0}})})}var Ye=R(Le);{var Ct=bt=>{var sn=Je(),Be=ce(sn);Rt(Be,()=>Vm,(he,Ne)=>{Ne(he,{children:(je,Tt)=>{var ee=Je(),Ge=ce(ee);Rt(Ge,()=>Y1,(it,Xe)=>{Xe(it,{role:"tooltip",get side(){return i()},get align(){return o()},get sideOffset(){return a()},get alignOffset(){return c()},get class(){return l(ne)},"data-tooltip-content":!0,"data-overlay-surface":!0,onFocusOutside:()=>{},children:(mt,Mt)=>{var Ue=Pk(),Ke=ce(Ue),Me=te(Ke);{var Xt=Re=>{{let We=w(()=>_.ui_tooltipRich_close_ariaLabel());Ze(Re,{variant:"ghost",size:"icon-compact",onclick:be,class:"absolute -right-1 -top-1 size-5 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground motion-reduce:transition-none",get"aria-label"(){return l(We)},children:(Pt,Qe)=>{ut(Pt,{get icon(){return Fi},size:"xs",class:"w-3 h-3"})},$$slots:{default:!0}})}};V(Me,Re=>{C()&&Re(Xt)})}var tn=R(Me,2),es=te(tn);{var le=Re=>{var We=Mk(),Pt=te(We);{var Qe=at=>{{let Bt=w(()=>br("w-4 h-4 mt-0.5 flex-shrink-0",l(q).iconColor,$()));ut(at,{get icon(){return l(j)},size:"1x",get class(){return l(Bt)}})}};V(Pt,at=>{l(j)&&at(Qe)})}var ze=R(Pt,2);{var pt=at=>{var Bt=Ck(),rt=re(Bt,!0);L(()=>B(rt,t())),k(at,Bt)};V(ze,at=>{t()&&at(pt)})}Q(We),k(Re,We)};V(es,Re=>{(t()||l(j))&&Re(le)})}var ot=R(es,2);{var At=Re=>{var We=Tk(),Pt=re(We,!0);L(Qe=>{wt(We,1,Qe),B(Pt,r())},[()=>Xn(br("type-body opacity-90",de()))]),k(Re,We)};V(ot,Re=>{r()&&Re(At)})}var Zt=R(ot,2);{var Ve=Re=>{var We=Ek(),Pt=te(We);On(Pt,()=>s()??ls),Q(We),k(Re,We)};V(Zt,Re=>{s()&&Re(Ve)})}Q(tn);var ht=R(tn,2);{var Et=Re=>{var We=Ak(),Pt=te(We);On(Pt,()=>Y()??ls),Q(We),L(Qe=>wt(We,1,Qe),[()=>Xn(br("px-3 py-2",X()))]),k(Re,We)};V(ht,Re=>{Y()&&Re(Et)})}Q(Ke);var qe=R(Ke,2);{var yt=Re=>{var We=Je(),Pt=ce(We);{const Qe=(ze,pt)=>{let at=()=>(pt?.()).props;var Bt=Rk();oa(Bt,rt=>({class:rt,...at()}),[()=>br("z-50 bg-border","data-[side=top]:w-px data-[side=top]:h-2","data-[side=bottom]:w-px data-[side=bottom]:h-2","data-[side=left]:h-px data-[side=left]:w-2","data-[side=right]:h-px data-[side=right]:w-2")]),k(ze,Bt)};Rt(Pt,()=>wx,(ze,pt)=>{pt(ze,{child:Qe,$$slots:{child:!0}})})}k(Re,We)};V(qe,Re=>{I()&&Re(yt)})}L(()=>{Hi(Ke,`max-width: ${P()??""};`),wt(tn,1,`px-3 py-2 space-y-1 ${S()??""}`)}),k(mt,Ue)},$$slots:{default:!0}})}),k(je,ee)},$$slots:{default:!0}})}),k(bt,sn)};V(Ye,bt=>{!h()&&(t()||r()||s())&&bt(Ct)})}k(lt,De)},$$slots:{default:!0}})})}k(ae,ue)},$$slots:{default:!0}})})}return k(n,se),Ot(Se)}var Lk=new Set(["$$slots","$$events","$$legacy","leading","title","description","trailing","selected","disabled","class"]),Ok=N('<span data-slot="action-row-leading" class="first-line-icon w-(--menu-icon-size)"><!></span>'),Nk=N('<span data-slot="action-row-description"><!></span>'),Dk=N('<span data-slot="action-row-trailing" class="first-line-icon gap-2"><!></span>'),$k=N('<button><!> <span data-slot="action-row-content" class="flex min-w-0 flex-1 flex-col gap-0.5"><span data-slot="action-row-title" class="min-w-0 break-words"><!></span> <!></span> <!></button>');function ov(n,e){if(new.target)return Nt({component:ov,...n});Lt(e,!0);let t=y(e,"leading",7),r=y(e,"title",7),s=y(e,"description",7),i=y(e,"trailing",7),o=y(e,"selected",7,!1),a=y(e,"disabled",7,!1),c=y(e,"class",7),u=ui(e,Lk);var d={get leading(){return t()},set leading(O){t(O),b()},get title(){return r()},set title(O){r(O),b()},get description(){return s()},set description(O){s(O),b()},get trailing(){return i()},set trailing(O){i(O),b()},get selected(){return o()},set selected(O=!1){o(O),b()},get disabled(){return a()},set disabled(O=!1){a(O),b()},get class(){return c()},set class(O){c(O),b()},$set:Dt,$on:(O,P)=>$t(e,O,P)},f=$k();oa(f,O=>({type:"button",...u,disabled:a(),"data-slot":"menu-action-row","data-selected":o()?"":void 0,class:O}),[()=>br(Jf(),"items-start whitespace-normal text-foreground hover:bg-hover active:bg-active focus-visible:bg-hover focus-visible:outline-solid focus-visible:-outline-offset-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50",o()&&"bg-selected hover:bg-selected focus-visible:bg-selected",c())]);var h=te(f);{var p=O=>{var P=Ok(),E=te(P);On(E,t),Q(P),k(O,P)};V(h,O=>{t()&&O(p)})}var g=R(h,2),v=te(g),m=te(v);On(m,r),Q(v);var S=R(v,2);{var I=O=>{var P=Nk(),E=te(P);On(E,s),Q(P),L(()=>wt(P,1,`min-w-0 break-words ${nk}`)),k(O,P)};V(S,O=>{s()&&O(I)})}Q(g);var C=R(g,2);{var M=O=>{var P=Dk(),E=te(P);On(E,i),Q(P),k(O,P)};V(C,O=>{i()&&O(M)})}return Q(f),k(n,f),Ot(d)}const eh=nv,t$=rv;var Bk=new Set(["$$slots","$$events","$$legacy","value","class","children"]);function av(n,e){if(new.target)return Nt({component:av,...n});Lt(e,!0);let t=y(e,"value",7),r=y(e,"class",7),s=y(e,"children",7),i=ui(e,Bk);var o={get value(){return t()},set value(u){t(u),b()},get class(){return r()},set class(u){r(u),b()},get children(){return s()},set children(u){s(u),b()},$set:Dt,$on:(u,d)=>$t(e,u,d)},a=Je(),c=ce(a);{let u=w(()=>br("mt-3",r()));Rt(c,()=>sv,(d,f)=>{f(d,us({get value(){return t()},get class(){return l(u)}},()=>i,{children:(h,p)=>{var g=Je(),v=ce(g);On(v,()=>s()??ls),k(h,g)},$$slots:{default:!0}}))})}return k(n,a),Ot(o)}var zk=N('<img loading="lazy"/>');function lv(n,e){if(new.target)return Nt({component:lv,...n});Lt(e,!0);let t=y(e,"identity",7),r=y(e,"avatarUrl",7),s=y(e,"size",7,16),i=y(e,"class",7,""),o=y(e,"alt",7),a=y(e,"fallback",7),c=fe(!1);const u=w(()=>r()||`https://github.com/${encodeURIComponent(t())}.png?size=${s()*2}`);sw(()=>{t(),l(u),x(c,!1)});var d={get identity(){return t()},set identity(v){t(v),b()},get avatarUrl(){return r()},set avatarUrl(v){r(v),b()},get size(){return s()},set size(v=16){s(v),b()},get class(){return i()},set class(v=""){i(v),b()},get alt(){return o()},set alt(v){o(v),b()},get fallback(){return a()},set fallback(v){a(v),b()},$set:Dt,$on:(v,m)=>$t(e,v,m)},f=Je(),h=ce(f);{var p=v=>{var m=Je(),S=ce(m);On(S,()=>a()??ls),k(v,m)},g=v=>{var m=zk();L(()=>{xt(m,"src",l(u)),xt(m,"width",s()),xt(m,"height",s()),xt(m,"alt",o()??""),xt(m,"aria-hidden",o()===void 0?"true":void 0),wt(m,1,Xn(i()))}),xo("error",m,()=>{x(c,!0)}),Fd(m),k(v,m)};V(h,v=>{l(c)?v(p):v(g,-1)})}return k(n,f),Ot(d)}var Fk=new Set(["$$slots","$$events","$$legacy","children"]),Hk=Wi('<path d="M208,20H72A36,36,0,0,0,36,56V224a12,12,0,0,0,12,12H192a12,12,0,0,0,0-24H60v-4a12,12,0,0,1,12-12H208a12,12,0,0,0,12-12V32A12,12,0,0,0,208,20ZM120,44h36v59l-10.51-8.41a12,12,0,0,0-15,0L120,103Zm76,128H72a35.59,35.59,0,0,0-12,2.06V56A12,12,0,0,1,72,44H96v84a12,12,0,0,0,19.5,9.37l22.49-18,22.51,18A12,12,0,0,0,180,128V44h16Z"></path>'),Uk=Wi('<path d="M208,32V192H72a24,24,0,0,0-24,24V56A24,24,0,0,1,72,32h40v96l32-24,32,24V32Z" opacity="0.2"></path><path d="M208,24H72A32,32,0,0,0,40,56V224a8,8,0,0,0,8,8H192a8,8,0,0,0,0-16H56a16,16,0,0,1,16-16H208a8,8,0,0,0,8-8V32A8,8,0,0,0,208,24ZM120,40h48v72L148.79,97.6a8,8,0,0,0-9.6,0L120,112Zm80,144H72a31.82,31.82,0,0,0-16,4.29V56A16,16,0,0,1,72,40h32v88a8,8,0,0,0,12.8,6.4L144,114l27.21,20.4A8,8,0,0,0,176,136a8.1,8.1,0,0,0,3.58-.84A8,8,0,0,0,184,128V40h16Z"></path>',1),Vk=Wi('<path d="M208,24H72A32,32,0,0,0,40,56V224a8,8,0,0,0,8,8H192a8,8,0,0,0,0-16H56a16,16,0,0,1,16-16H208a8,8,0,0,0,8-8V32A8,8,0,0,0,208,24Zm-24,96-25.61-19.2a4,4,0,0,0-4.8,0L128,120V40h56Z"></path>'),Wk=Wi('<path d="M208,26H72A30,30,0,0,0,42,56V224a6,6,0,0,0,6,6H192a6,6,0,0,0,0-12H54v-2a18,18,0,0,1,18-18H208a6,6,0,0,0,6-6V32A6,6,0,0,0,208,26ZM118,38h52v78L147.59,99.2a6,6,0,0,0-7.2,0L118,116Zm84,148H72a29.87,29.87,0,0,0-18,6V56A18,18,0,0,1,72,38h34v90a6,6,0,0,0,9.6,4.8L144,111.5l28.41,21.3A6,6,0,0,0,182,128V38h20Z"></path>'),Kk=Wi('<path d="M208,24H72A32,32,0,0,0,40,56V224a8,8,0,0,0,8,8H192a8,8,0,0,0,0-16H56a16,16,0,0,1,16-16H208a8,8,0,0,0,8-8V32A8,8,0,0,0,208,24ZM120,40h48v72L148.79,97.6a8,8,0,0,0-9.6,0L120,112Zm80,144H72a31.82,31.82,0,0,0-16,4.29V56A16,16,0,0,1,72,40h32v88a8,8,0,0,0,12.8,6.4L144,114l27.21,20.4A8,8,0,0,0,176,136a8,8,0,0,0,8-8V40h16Z"></path>'),jk=Wi('<path d="M208,28H72A28,28,0,0,0,44,56V224a4,4,0,0,0,4,4H192a4,4,0,0,0,0-8H52v-4a20,20,0,0,1,20-20H208a4,4,0,0,0,4-4V32A4,4,0,0,0,208,28Zm-92,8h56v84l-25.61-19.2a4,4,0,0,0-4.8,0L116,120Zm88,152H72a27.94,27.94,0,0,0-20,8.42V56A20,20,0,0,1,72,36h36v92a4,4,0,0,0,6.4,3.2L144,109l29.61,22.2a4,4,0,0,0,2.4.8,4,4,0,0,0,4-4V36h24Z"></path>'),Gk=Wi('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function cv(n,e){if(new.target)return Nt({component:cv,...n});Lt(e,!0);const t=Cw();let r=y(e,"children",7),s=ui(e,Fk),i=w(()=>e.weight??t.weight??"regular"),o=w(()=>e.color??t.color??"currentColor"),a=w(()=>e.size??t.size??"1em"),c=w(()=>e.mirrored??t.mirrored??!1);function u(P){let{weight:E,color:z,size:G,mirrored:J,...K}=P;return K}var d={get children(){return r()},set children(P){r(P),b()},$set:Dt,$on:(P,E)=>$t(e,P,E)},f=Gk();oa(f,(P,E)=>({xmlns:"http://www.w3.org/2000/svg",role:"img",width:l(a),height:l(a),fill:l(o),transform:l(c)?"scale(-1, 1)":void 0,viewBox:"0 0 256 256",...P,...E}),[()=>u(t),()=>u(s)]);var h=te(f);{var p=P=>{var E=Je(),z=ce(E);On(z,r),k(P,E)};V(h,P=>{r()&&P(p)})}var g=R(h,2);{var v=P=>{var E=Hk();k(P,E)},m=P=>{var E=Uk();Ht(),k(P,E)},S=P=>{var E=Vk();k(P,E)},I=P=>{var E=Wk();k(P,E)},C=P=>{var E=Kk();k(P,E)},M=P=>{var E=jk();k(P,E)},O=P=>{var E=Vt();E.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),k(P,E)};V(g,P=>{l(i)==="bold"?P(v):l(i)==="duotone"?P(m,1):l(i)==="fill"?P(S,2):l(i)==="light"?P(I,3):l(i)==="regular"?P(C,4):l(i)==="thin"?P(M,5):P(O,-1)})}return Q(f),k(n,f),Ot(d)}function Ba(n,e){if(new.target)return Nt({component:Ba,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(i=16){t(i),b()},get class(){return r()},set class(i=""){r(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return cv(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Ot(s)}function th(n,e){if(new.target)return Nt({component:th,...n});Lt(e,!0);const t=g=>{var v=Je(),m=ce(v);{var S=M=>{ut(M,{get icon(){return Js},get size(){return a()},class:"shrink-0 text-muted-foreground"})},I=M=>{{let O=w(()=>s()==="github"?Df:$f);ut(M,{get icon(){return l(O)},get size(){return a()},class:"shrink-0 text-muted-foreground"})}},C=M=>{Ba(M,{get size(){return a()},class:"shrink-0 text-muted-foreground"})};V(m,M=>{o()?M(S):s()?M(I,1):M(C,-1)})}k(g,v)};let r=y(e,"owner",7),s=y(e,"provider",7),i=y(e,"avatarUrl",7),o=y(e,"local",7,!1),a=y(e,"size",7,20);var c={get owner(){return r()},set owner(g){r(g),b()},get provider(){return s()},set provider(g){s(g),b()},get avatarUrl(){return i()},set avatarUrl(g){i(g),b()},get local(){return o()},set local(g=!1){o(g),b()},get size(){return a()},set size(g=20){a(g),b()},$set:Dt,$on:(g,v)=>$t(e,g,v)},u=Je(),d=ce(u);{var f=g=>{lv(g,{get identity(){return r()},get avatarUrl(){return i()},get size(){return a()},class:"shrink-0 rounded-full",get fallback(){return t}})},h=g=>{{let v=w(()=>r()??"");Ym(g,{get avatarUrl(){return i()},get label(){return l(v)},get size(){return a()},referrerpolicy:"no-referrer"})}},p=g=>{t(g)};V(d,g=>{r()&&s()==="github"?g(f):i()?g(h,1):g(p,-1)})}return k(n,u),Ot(c)}var qk=Wi('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"></path></svg>');function nh(n,e){if(new.target)return Nt({component:nh,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(o=16){t(o),b()},get class(){return r()},set class(o=""){r(o),b()},$set:Dt,$on:(o,a)=>$t(e,o,a)},i=qk();return L(()=>{xt(i,"width",t()),xt(i,"height",t()),wt(i,0,Xn(r()))}),k(n,i),Ot(s)}function Jk(n){switch(n){case"running":return _.layout_activeCard_running_header();case"responding":return _.agentOverview_hierarchyGraph_statusResponding_label();case"unread":return _.layout_activeCard_unread_header();case"completed":return _.agentOverview_hierarchyGraph_statusCompleted_label();case"failed":return _.agentOverview_hierarchyGraph_statusFailed_label();case"question":return _.chat_questionWizard_title();case"waiting":return _.agentOverview_hierarchyGraph_statusWaiting_label();case"needs-permission":return _.events_activity_agentAskedPermission_label();case"attention-discussion":return _.chat_agentCard_attentionDiscussion_label();case"attention-blocker":return _.chat_agentCard_attentionBlocker_label();case"idle":return _.agentOverview_hierarchyGraph_statusIdle_label()}}var Xk=N('<span class="agent-avatar-unread-dot svelte-v6mebl" data-avatar-unread-dot=""></span>'),Yk=N('<span role="img" data-agent-avatar-with-state="" data-agent-avatar-surface=""><!> <!></span>');function uv(n,e){if(new.target)return Nt({component:uv,...n});Lt(e,!0);let t=y(e,"agentId",7),r=y(e,"specialist",7,null),s=y(e,"icon",7,null),i=y(e,"provider",7,void 0),o=y(e,"variant",7,_p),a=y(e,"size",7,void 0),c=y(e,"state",7,"idle"),u=y(e,"class",7,"");const d=w(()=>Jk(c())),f=w(()=>a()??Bx[o()].surface),h=w(()=>a()===void 0);var p={get agentId(){return t()},set agentId(C){t(C),b()},get specialist(){return r()},set specialist(C=null){r(C),b()},get icon(){return s()},set icon(C=null){s(C),b()},get provider(){return i()},set provider(C=void 0){i(C),b()},get variant(){return o()},set variant(C=_p){o(C),b()},get size(){return a()},set size(C=void 0){a(C),b()},get state(){return c()},set state(C="idle"){c(C),b()},get class(){return u()},set class(C=""){u(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},g=Yk();let v;var m=te(g);$x(m,{get agentId(){return t()},get specialist(){return r()},get icon(){return s()},get provider(){return i()},get variant(){return o()},get size(){return a()}});var S=R(m,2);{var I=C=>{var M=Xk();k(C,M)};V(S,C=>{c()==="unread"&&C(I)})}return Q(g),L(()=>{wt(g,1,`agent-avatar-with-state agent-avatar-with-state--${c()??""} ${u()??""}`,"svelte-v6mebl"),xt(g,"aria-label",l(d)),xt(g,"title",l(d)),xt(g,"data-avatar-state",c()),xt(g,"data-avatar-variant",l(h)?o():void 0),v=Hi(g,"",v,{width:l(h)?void 0:`${l(f)}px`,height:l(h)?void 0:`${l(f)}px`})}),k(n,g),Ot(p)}function qd(n){return aw(n)}function Qk(n){return lw(n)}function Ep(n,e={}){const{hasUnread:t=!1,isActive:r=!1,isCompleted:s=!1,isFailed:i=!1,hasQuestion:o=!1,hasPermissionRequest:a=!1,attentionKind:c=null}=e;return s&&!qd(n)?"completed":i||n.status===Ec.Error||n.status==="failed"?"failed":o?"question":a?"needs-permission":c==="discussion"?"attention-discussion":c==="blocker"?"attention-blocker":Qk(n)?"waiting":qd(n)?"running":t&&!r?"unread":"idle"}function Zk(n,e={}){if(!n)return Ep({},e);const t=xx(n),r=n.status===Ec.Completed||String(n.status).toLowerCase()==="completed",s=n.status===Ec.Error||n.status===Ec.Deleted||String(n.status).toLowerCase()==="failed";return Ep(Pm(n),{...e,hasQuestion:ck(n)||e.hasQuestion===!0,hasUnread:e.hasUnread??n.hasUnread,isCompleted:e.isCompleted??r,isFailed:e.isFailed??s,attentionKind:e.attentionKind??t?.kind??null})}function n$(n){return n?qd(Pm(n)):!1}function e_(n){if(!n||n.status!=="Open")return"";const e=[],t=[];if((n.mergeConflicts||n.mergeableState==="dirty")&&e.push(_.workspace_prStatus_mergeConflicts_tooltip()),n.mergeableState==="behind"&&e.push(_.workspace_prStatus_behindBase_tooltip()),n.mergeableState==="unstable"&&e.push(_.workspace_prStatus_checksUnstable_tooltip()),n.mergeableState==="unknown"&&e.push(_.workspace_prStatus_mergeabilityUnknown_tooltip()),n.ciStatus&&n.ciStatus.total>0){const s=as(n.ciStatus.total);if(n.ciStatus.failed>0){const i=as(n.ciStatus.failed);e.push(n.ciStatus.pending>0?_.workspace_prStatus_checksFailingRunning_tooltip({failed:i,total:s,pending:as(n.ciStatus.pending)}):_.workspace_prStatus_checksFailing_tooltip({failed:i,total:s}))}else n.ciStatus.pending>0?e.push(_.workspace_prStatus_checksRunning_tooltip({pending:as(n.ciStatus.pending),total:s})):t.push(_.workspace_prStatus_checksPassing_tooltip({passed:as(n.ciStatus.passed),total:s}))}if(n.reviewDecision==="CHANGES_REQUESTED"&&e.push(_.workspace_prStatus_changesRequested_tooltip()),n.reviewDecision==="REVIEW_REQUIRED"&&e.push(_.workspace_prStatus_awaitingReview_tooltip()),n.mergeableState==="blocked"&&!n.reviewDecision&&e.push(_.workspace_prStatus_awaitingReview_tooltip()),n.reviewComments&&n.reviewComments>0){const s=as(n.reviewComments);e.push(n.reviewComments===1?_.workspace_prStatus_reviewComments_one({count:s}):_.workspace_prStatus_reviewComments_many({count:s}))}n.reviewDecision==="APPROVED"&&n.approvedBy&&n.approvedBy.length>0&&t.push(_.workspace_prStatus_approvedBy_tooltip({names:n.approvedBy.join(", ")}));const r=[...e,...t];return r.length>0?r.join(`
3
3
  `):""}const t_={queued:0,draft:1,open:2,merged:3,closed:4};function dv(n,e){return n?`${n}#${e}`:String(e)}function ud(n,e){return dv(n?.toLowerCase(),e)}function n_(n,e){return n&&e?e.localeCompare(n):n?-1:e?1:0}function r_(n,e){return n==="merged"?{statusIcon:Mw,foregroundClass:"text-purple-500",backgroundClass:"bg-purple-500/10",accessibleStateLabel:_.workspace_prSection_merged_label()}:n==="closed"?{statusIcon:sd,foregroundClass:"text-danger",backgroundClass:"bg-danger-background/10",accessibleStateLabel:_.workspace_prSection_closed_label()}:n==="draft"?{statusIcon:sd,foregroundClass:"text-muted-foreground",backgroundClass:"bg-muted",accessibleStateLabel:_.workspace_prSection_statusDraft_label()}:{statusIcon:sd,foregroundClass:"text-success",backgroundClass:"bg-success/10",accessibleStateLabel:e?_.workspace_prSection_statusQueued_label():_.workspace_prSection_statusOpen_label()}}function r$({workspacePRs:n,activePR:e,monitors:t,workspaceRepo:r,buildPrUrl:s,getDisplayTitle:i,secondaryRoots:o=[]}){const a=[...n?.length?n:e?[e]:[],...o.flatMap(h=>h.repoOwner&&h.repoName?(h.pullRequests??[]).map(p=>({...p,url:p.url||`https://github.com/${h.repoOwner}/${h.repoName}/pull/${p.number}`})):[])],c=new Map(a.map(h=>[ud(m1(h.url)??r,h.number),h])),u=v1(b1(a,e,s,i,r),t,r),d=new Map;for(const h of u){const p=h.monitorIdentity??ud(h.crossRepo??r,h.number),g=d.get(p);if(!g){d.set(p,h);continue}g.monitorAgentId=h.monitorAgentId??g.monitorAgentId,g.monitorSnapshot=h.monitorSnapshot??g.monitorSnapshot,g.isInMergeQueue=g.isInMergeQueue||h.isInMergeQueue}return[...d.values()].map(h=>{const p=h.crossRepo??r,g=ud(p,h.number),v=h.resource?void 0:c.get(g),m=v?.isDraft?"draft":h.status,S=y1({...h,status:m});return{pr:h,repo:p,identity:g,source:v,status:m,queued:S,rank:t_[S?"queued":m]}}).sort((h,p)=>h.rank-p.rank||n_(h.pr.updatedAt,p.pr.updatedAt)||p.pr.number-h.pr.number||h.identity.localeCompare(p.identity)).map(({pr:h,repo:p,source:g,status:v,queued:m})=>{const S=h.monitorSnapshot?"":e_(g);return{identity:h.monitorIdentity??dv(p,h.number),resource:h.resource,monitorAvailability:h.monitorAvailability,numberLabel:cw(h,h.number),number:h.number,title:h.title,url:h.url,repo:p,repoContext:h.crossRepo?h.crossRepoDisplay??h.crossRepo:void 0,status:v,queued:m,...r_(v,m),details:[w1({...h,status:v}),S].filter(Boolean).join(`
4
- `),monitorAgentId:h.monitorAgentId,monitorOnly:h.monitorOnly===!0}})}function s_(n){return"type"in n&&n.type==="separator"}function s$(n){const e=n instanceof KeyboardEvent;if(e&&n.key!=="ContextMenu"&&!(n.shiftKey&&n.key==="F10"))return null;n.preventDefault(),n.stopPropagation();const t=n.currentTarget instanceof HTMLElement?n.currentTarget:null,r=t?.getBoundingClientRect();return{x:e?r?.left??0:n.clientX,y:e?r?.bottom??0:n.clientY,returnFocus:t}}function Jd(n,e,t=""){let r=0;const s=[];for(const[o,a]of n.entries()){if(s_(a)){r+=1;continue}if("type"in a&&a.type==="label"){s.push({kind:"label",id:a.id??`sidebar-label-${o}`,label:a.label,group:String(r)});continue}const c={id:a.id,label:a.label,icon:a.icon,disabled:a.disabled,disabledReason:a.disabledReason,shortcut:a.shortcut,closeOnSelect:a.closeOnSelect,group:String(r)};if(a.submenu)if(a.selection==="single"){const u=a.submenu.filter(h=>h.checked!==void 0),d=a.submenu.filter(h=>h.checked===void 0),f=u.map(h=>({kind:"radio",id:h.id,value:h.id,label:h.label,icon:h.icon,disabled:h.disabled,disabledReason:h.disabledReason,shortcut:h.shortcut,closeOnSelect:h.closeOnSelect}));s.push({...c,kind:"submenu",children:[...f.length>0?[{kind:"radio-group",id:`${a.id}-selection`,label:a.label,value:u.find(h=>h.checked)?.id??"",children:f}]:[],...Jd(d)]})}else s.push({...c,kind:"submenu",children:Jd(a.submenu)});else a.checked!==void 0?s.push({...c,kind:"checkbox",checked:a.checked,indicator:a.indicator}):s.push({...c,kind:"action",destructive:a.destructive})}if(e!=="single")return s;const i=[];for(const o of s){if(o.kind!=="checkbox"){i.push(o);continue}const a=i.at(-1),c={...o,kind:"radio",checked:void 0,value:o.id};a?.kind==="radio-group"&&a.group===o.group?(a.children=[...a.children,c],o.checked&&(a.value=o.id)):i.push({kind:"radio-group",id:`${o.id}-selection`,label:t,group:o.group,value:o.checked?o.id:"",children:[c]})}return i}function fv(n,e){for(const t of n){if("type"in t)continue;if(t.id===e)return t;const r=t.submenu?fv(t.submenu,e):void 0;if(r)return r}}function i_(n,e){if(new.target)return Nt({component:i_,...n});Lt(e,!0);let t=y(e,"x",7),r=y(e,"y",7),s=y(e,"items",7),i=y(e,"onClickOutside",7),o=y(e,"ariaLabel",23,()=>cp()),a=y(e,"returnFocus",7),c=y(e,"selection",7);const u=w(()=>Jd(s(),c(),o()));var d={get x(){return t()},set x(f){t(f),b()},get y(){return r()},set y(f){r(f),b()},get items(){return s()},set items(f){s(f),b()},get onClickOutside(){return i()},set onClickOutside(f){i(f),b()},get ariaLabel(){return o()},set ariaLabel(f=cp()){o(f),b()},get returnFocus(){return a()},set returnFocus(f){a(f),b()},get selection(){return c()},set selection(f){c(f),b()},$set:Dt,$on:(f,h)=>$t(e,f,h)};{let f=w(()=>({x:t(),y:r(),returnFocus:a()}));sx(n,{get actions(){return l(u)},get ariaLabel(){return o()},get contextMenu(){return l(f)},onAction:h=>fv(s(),h)?.onClick(),onOpenChange:h=>{h||i()?.()}})}return Ot(d)}function o_(){try{return It.state.userPreferences?.shortcutOverrides??{}}catch{return{}}}function zc(n){return tv(n,o_())}function i$(n){if(typeof It.getReadableState!="function")return lp(zc(n));try{return iw(It.getReadableState(),e=>tv(n,e.userPreferences?.shortcutOverrides??{}))}catch{return lp(zc(n))}}function a_(n,e){return n?.isExternalLink===!0&&typeof n.workspaceId=="string"&&n.workspaceId?n.workspaceId:e||void 0}function hv(n,e,t){const r=n.label||n.id||"mention";if(n.type==="member")return Of(r);if(n.type==="note"&&n.id&&t){const s=a_(n.meta,e),i=s?t(s,n.id)?.trim():void 0;if(i)return i}return r}function o$(n,e,t){if(typeof document>"u"||!n.includes('data-type="note"'))return n;const r=document.createElement("template");r.innerHTML=n;let s=!1;for(const i of r.content.querySelectorAll('[data-mention][data-type="note"]')){let o=null;try{o=JSON.parse(i.getAttribute("data-meta")||"{}")}catch{o=null}const a=i.textContent??"",c=hv({type:"note",id:i.getAttribute("data-id"),label:a,meta:o},e,t);c!==a&&(i.textContent=c,s=!0)}return s?r.innerHTML:n}const l_=(n,e)=>{let t;try{t=dk().state}catch{return}const r=t?.workspaceNotes?.byWorkspaceId?.[n]?.notes;return r?kx(r,e)?.title:void 0};var c_=N('<p class="mt-2 max-w-[90vw] rounded-md bg-black/60 px-3 py-1.5 text-center text-sm text-white"> </p>'),u_=N('<div data-media-lightbox-root="" data-image-lightbox-root="" class="fixed inset-0 z-[1000] flex cursor-zoom-out flex-col items-center justify-center bg-black/80 p-4 backdrop-blur-sm" style="pointer-events: auto;" role="dialog" aria-modal="true" tabindex="-1"><div class="absolute right-4 top-4 z-[1002] flex items-center gap-1"><!> <!></div> <div class="flex min-h-0 w-full flex-1 items-center justify-center"><!></div> <!></div>');function rh(n,e){if(new.target)return Nt({component:rh,...n});Lt(e,!0);let t=y(e,"open",15,!1),r=y(e,"ariaLabel",7),s=y(e,"closeLabel",7),i=y(e,"onClose",7),o=y(e,"openerElement",7,null),a=y(e,"children",7),c=y(e,"actions",7),u=y(e,"caption",7),d=y(e,"onKeydown",7),f=y(e,"onCopy",7);const h=qm(),p=gx(m);let g=fe(null),v=fe(null);function m(){t()&&(t(!1),i()?.(),o()?.isConnected&&o().focus({preventScroll:!0}))}function S(E){(E.target instanceof Element?E.target:null)?.closest('[data-media-lightbox-content], [role="toolbar"], button, input')||m()}function I(E){if(d()?.(E),E.defaultPrevented||E.key!=="Tab"||!l(g))return;const z=Array.from(l(g).querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),G=z[0],J=z[z.length-1];!G||!J||(E.shiftKey&&document.activeElement===G?(E.preventDefault(),J.focus()):!E.shiftKey&&document.activeElement===J&&(E.preventDefault(),G.focus()))}ft(()=>{if(t())return ja(m)}),ft(()=>{!t()||!l(v)||requestAnimationFrame(()=>l(v)?.focus())});var C={get open(){return t()},set open(E=!1){t(E),b()},get ariaLabel(){return r()},set ariaLabel(E){r(E),b()},get closeLabel(){return s()},set closeLabel(E){s(E),b()},get onClose(){return i()},set onClose(E){i(E),b()},get openerElement(){return o()},set openerElement(E=null){o(E),b()},get children(){return a()},set children(E){a(E),b()},get actions(){return c()},set actions(E){c(E),b()},get caption(){return u()},set caption(E){u(E),b()},get onKeydown(){return d()},set onKeydown(E){d(E),b()},get onCopy(){return f()},set onCopy(E){f(E),b()},$set:Dt,$on:(E,z)=>$t(e,E,z)},M=Je(),O=ce(M);{var P=E=>{{let z=w(()=>h?.target()??"body");ix(E,{get target(){return l(z)},zIndex:1e3,children:(G,J)=>{var K=u_(),Q=te(K),$=te(Q);{var X=ne=>{var we=Je(),be=ce(we);On(be,c),k(ne,we)};V($,ne=>{c()&&ne(X)})}var de=R($,2);Ze(de,{variant:"ghost",size:"icon",class:"text-white hover:bg-white/20 hover:text-white",onclick:m,get"aria-label"(){return s()},get ref(){return l(v)},set ref(ne){x(v,ne,!0)},children:(ne,we)=>{ut(ne,{get icon(){return Fi},size:"lg"})},$$slots:{default:!0}}),Y(Q),Pl(Q,ne=>p?.(ne));var me=R(Q,2),ie=te(me);On(ie,a),Y(me),Pl(me,ne=>p?.(ne));var q=R(me,2);{var j=ne=>{var we=c_(),be=re(we,!0);L(()=>B(be,u())),k(ne,we)};V(q,ne=>{u()&&ne(j)})}Y(K),Qn(K,ne=>x(g,ne),()=>l(g)),L(()=>xt(K,"aria-label",r())),Kr("click",K,S),Kr("keydown",K,I),xo("copy",K,function(...ne){f()?.apply(this,ne)}),Ss(3,K,()=>yw,()=>({tier:"moderate"})),k(G,K)},$$slots:{default:!0}})}};V(O,E=>{t()&&E(P)})}return k(n,M),Ot(C)}So(["click","keydown"]);function Au(n){if(!n.startsWith("workspace-file://"))return null;const t=n.slice(17).split(/[?#]/)[0].split("/"),r=t[0],s=t.slice(1);if(!r||s.length===0)return null;const i=[];for(const o of s){if(!o)return null;try{i.push(decodeURIComponent(o))}catch{return null}}return{workspaceId:r,path:i.join("/")}}function pv(n){try{return new URL(n).protocol==="https:"}catch{return!1}}function Xd(n){const e=/^data:([^;,]+);base64,(.*)$/s.exec(n);return e?{mimeType:e[1],base64:e[2]}:null}function Qd(n){return pv(n)||Au(n)!==null||/^workspace-asset:\/\/[^/?#]+/.test(n)||/^data:image\/[a-z0-9.+-]+(?:;[^,]*)?,/i.test(n)}function gv(n){if(n.length===0)return 0;let e=0;return n.endsWith("==")?e=2:n.endsWith("=")&&(e=1),Math.floor(n.length*3/4)-e}function d_(n,e){const t=atob(n),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return new Blob([r],{type:e})}const f_={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};function h_(n){if(n.workspacePath){const s=n.workspacePath.split("/").pop();if(s)return s}const e=(n.imageName||"image").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(e))return e;const t=n.mimeType?.split(";")[0].trim().toLowerCase(),r=t&&f_[t]||"png";return`${e}.${r}`}var p_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-dimensions"> </div>'),g_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-size"> </div>'),m_=N("<!> <!> <!>",1),v_=N("<!> <!> <!> <!>",1),b_=N("<!> <!>",1);function mv(n,e){if(new.target)return Nt({component:mv,...n});Lt(e,!0);let t=y(e,"imageUrl",7),r=y(e,"imageName",7),s=y(e,"open",15,!1),i=y(e,"triggerClass",7),o=y(e,"contentClass",7);const a=w(()=>Xd(t())),c=w(()=>Au(t())),u=w(()=>pv(t()));let d=fe(null),f=fe(null),h=null;function p(){if(h===t())return;const J=h=t();x(d,null),x(f,l(a)?gv(l(a).base64):null,!0);const K=new Image;K.onload=()=>{h===J&&x(d,{width:K.naturalWidth,height:K.naturalHeight},!0)},K.src=t(),l(a)||fetch(t()).then(Q=>Q.ok?Q.blob():null).then(Q=>{Q&&h===J&&x(f,Q.size,!0)}).catch(()=>{})}ft(()=>{s()&&p()}),ft(()=>{if(s())return ja(()=>{s(!1)})});async function g(J=t()){const K=Xd(J);if(K)return d_(K.base64,K.mimeType);const Q=await fetch(J);if(!Q.ok)throw new Error(`Image fetch failed: ${Q.status}`);return await Q.blob()}async function v(){let J=null;try{let K=t(),Q=l(a)?.mimeType;if(!l(a)){const X=await g();Q=X.type,J=URL.createObjectURL(X),K=J}const $=document.createElement("a");$.href=K,$.download=h_({workspacePath:l(c)?.path,imageName:r(),mimeType:Q}),document.body.appendChild($);try{$.click()}finally{$.remove()}}catch{_s.error(_.ui_imageActionsMenu_downloadFailed_error())}finally{J&&URL.revokeObjectURL(J)}}async function m(){if(l(c))try{await Bc(l(c).path),_s.success(_.ui_imageActionsMenu_pathCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}async function S(){if(l(u))try{await Bc(t()),_s.success(_.ui_imageActionsMenu_linkCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}async function I(J){let K,Q;try{let $;if(J.type.split(";")[0].trim()==="image/svg+xml"){Q=URL.createObjectURL(J);const me=new Image;me.src=Q,await me.decode(),$=me}else $=K=await createImageBitmap(J);const X=document.createElement("canvas");X.width=$ instanceof HTMLImageElement?$.naturalWidth:$.width,X.height=$ instanceof HTMLImageElement?$.naturalHeight:$.height;const de=X.getContext("2d");if(!de)throw new Error("2d canvas context unavailable");return de.drawImage($,0,0),await new Promise((me,ie)=>{X.toBlob(q=>q?me(q):ie(new Error("canvas toBlob failed")),"image/png")})}finally{K?.close(),Q&&URL.revokeObjectURL(Q)}}async function C(J=t()){try{let K=await g(J);K.type!=="image/png"&&(K=await I(K)),await navigator.clipboard.write([new ClipboardItem({"image/png":K})]),_s.success(_.ui_imageActionsMenu_imageCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}function M(J,K=t()){return J.defaultPrevented||!Qd(K)||J instanceof KeyboardEvent&&(J.key.toLowerCase()!=="c"||!(J.metaKey||J.ctrlKey)||J.altKey||J.shiftKey||J.isComposing)||Jm(J.target)||document.getSelection()?.toString()?!1:(J.preventDefault(),J.stopPropagation(),J instanceof KeyboardEvent&&J.repeat||(C(K),s(!1)),!0)}var O={handleCopy:M,get imageUrl(){return t()},set imageUrl(J){t(J),b()},get imageName(){return r()},set imageName(J){r(J),b()},get open(){return s()},set open(J=!1){s(J),b()},get triggerClass(){return i()},set triggerClass(J){i(J),b()},get contentClass(){return o()},set contentClass(J){o(J),b()},$set:Dt,$on:(J,K)=>$t(e,J,K)},P=Je(),E=ce(P);{var z=J=>{var K=Je(),Q=ce(K);Rt(Q,()=>Wf,($,X)=>{X($,{get open(){return s()},set open(de){s(de)},children:(de,me)=>{var ie=b_(),q=ce(ie);{const ne=(be,Se)=>{let se=()=>(Se?.()).props;{let oe=w(()=>_.ui_imageActionsMenu_trigger_ariaLabel());Ze(be,us(se,{variant:"plain",size:"icon-sm",wrapContent:!1,get active(){return s()},get"aria-label"(){return l(oe)},children:(H,W)=>{Km(H,{class:"size-3.5"})},$$slots:{default:!0}}))}};let we=w(()=>br("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",i()));Rt(q,()=>Uf,(be,Se)=>{Se(be,{get class(){return l(we)},onclick:se=>se.stopPropagation(),onkeydown:se=>M(se),oncopy:se=>M(se),child:ne,$$slots:{child:!0}})})}var j=R(q,2);Rt(j,()=>Vf,(ne,we)=>{we(ne,{get class(){return o()},align:"end",onkeydown:be=>M(be),oncopy:be=>M(be),children:(be,Se)=>{var se=v_(),oe=ce(se);Rt(oe,()=>Ho,(pe,ke)=>{ke(pe,{onSelect:()=>void v(),children:(ye,Z)=>{Ht();var $e=Vt();L(lt=>B($e,lt),[()=>_.ui_imageActionsMenu_download_label()]),k(ye,$e)},$$slots:{default:!0}})});var H=R(oe,2);Rt(H,()=>Ho,(pe,ke)=>{ke(pe,{onSelect:()=>void C(),children:(ye,Z)=>{Ht();var $e=Vt();L(lt=>B($e,lt),[()=>_.ui_imageActionsMenu_copyImage_label()]),k(ye,$e)},$$slots:{default:!0}})});var W=R(H,2);{var D=pe=>{var ke=Je(),ye=ce(ke);Rt(ye,()=>Ho,(Z,$e)=>{$e(Z,{onSelect:()=>void m(),children:(lt,St)=>{Ht();var De=Vt();L(Le=>B(De,Le),[()=>_.ui_imageActionsMenu_copyPath_label()]),k(lt,De)},$$slots:{default:!0}})}),k(pe,ke)},ae=pe=>{var ke=Je(),ye=ce(ke);Rt(ye,()=>Ho,(Z,$e)=>{$e(Z,{onSelect:()=>void S(),children:(lt,St)=>{Ht();var De=Vt();L(Le=>B(De,Le),[()=>_.ui_imageActionsMenu_copyLink_label()]),k(lt,De)},$$slots:{default:!0}})}),k(pe,ke)};V(W,pe=>{l(c)?pe(D):l(u)&&pe(ae,1)})}var ge=R(W,2);{var ue=pe=>{var ke=m_(),ye=ce(ke);Rt(ye,()=>jm,(De,Le)=>{Le(De,{})});var Z=R(ye,2);{var $e=De=>{var Le=p_(),Qe=re(Le,!0);L(Ct=>B(Qe,Ct),[()=>_.ui_imageActionsMenu_dimensions_label({width:as(l(d).width),height:as(l(d).height)})]),k(De,Le)};V(Z,De=>{l(d)&&De($e)})}var lt=R(Z,2);{var St=De=>{var Le=g_(),Qe=re(Le,!0);L(Ct=>B(Qe,Ct),[()=>Im(l(f))]),k(De,Le)};V(lt,De=>{l(f)!==null&&De(St)})}k(pe,ke)};V(ge,pe=>{(l(d)||l(f)!==null)&&pe(ue)})}k(be,se)},$$slots:{default:!0}})}),k(de,ie)},$$slots:{default:!0}})}),k(J,K)},G=w(()=>Qd(t()));V(E,J=>{l(G)&&J(z)})}return k(n,P),Ot(O)}var y_=N('<div role="application" tabindex="0" data-testid="zoom-pan-viewport"><div class="flex h-full w-full items-center justify-center will-change-transform" data-testid="zoom-pan-content"><!></div> <div class="absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 cursor-default items-center gap-2 rounded-full bg-black/60 px-3 py-1.5 backdrop-blur-sm" role="toolbar" tabindex="-1" data-testid="zoom-pan-controls"><!> <div class="w-36"><!></div> <!> <span class="min-w-12 text-center text-xs tabular-nums text-white/90" data-testid="zoom-pan-percent"> </span> <!></div></div>');function vv(n,e){if(new.target)return Nt({component:vv,...n});Lt(e,!0);let t=y(e,"children",7),r=y(e,"minZoom",7,.25),s=y(e,"maxZoom",7,8),i=y(e,"onScaleChange",7);const o=1.25,a=.0015,c=.01,u=4;let d=fe(1),f=fe(0),h=fe(0),p=fe(!1),g=fe(null);ft(()=>{i()?.(l(d))});let v=null,m=0,S=0,I=0,C=!1;const M=w(()=>Lm(l(d),{style:"percent",maximumFractionDigits:0}));function O(D){return Math.min(s(),Math.max(r(),D))}function P(D,ae,ge){const ue=O(ge),pe=l(g)?.getBoundingClientRect(),ke=pe?D-pe.left:0,ye=pe?ae-pe.top:0;x(f,ke-(ke-l(f))/l(d)*ue),x(h,ye-(ye-l(h))/l(d)*ue),x(d,ue,!0)}function E(D){const ae=l(g)?.getBoundingClientRect();ae?P(ae.left+ae.width/2,ae.top+ae.height/2,D):x(d,O(D),!0)}function z(){x(d,1),x(f,0),x(h,0)}function G(D){D.preventDefault();const ae=D.ctrlKey?c:a;P(D.clientX,D.clientY,l(d)*Math.exp(-D.deltaY*ae))}ft(()=>{const D=l(g);if(D)return D.addEventListener("wheel",G,{passive:!1}),()=>D.removeEventListener("wheel",G)});function J(D){if(D.metaKey||D.ctrlKey||D.altKey)return!1;if(D.key==="+"||D.key==="=")E(l(d)*o);else if(D.key==="-")E(l(d)/o);else if(D.key==="0")z();else return!1;return D.preventDefault(),!0}function K(D){if(D.button>0)return;x(p,!0),v=D.pointerId,m=D.clientX,S=D.clientY,I=0;const ae=D.currentTarget;typeof ae.setPointerCapture=="function"&&ae.setPointerCapture(D.pointerId)}function Q(D){if(!l(p)||D.pointerId!==v)return;const ae=D.clientX-m,ge=D.clientY-S;I+=Math.abs(ae)+Math.abs(ge),x(f,l(f)+ae),x(h,l(h)+ge),m=D.clientX,S=D.clientY}function $(D){if(!l(p)||D.pointerId!==v)return;x(p,!1),v=null,I>u&&(C=!0);const ae=D.currentTarget;typeof ae.hasPointerCapture=="function"&&typeof ae.releasePointerCapture=="function"&&ae.hasPointerCapture(D.pointerId)&&ae.releasePointerCapture(D.pointerId)}function X(D){C&&(C=!1,D.preventDefault(),D.stopPropagation())}function de(D){const ae=Number.parseFloat(D.currentTarget.value);Number.isFinite(ae)&&E(ae)}var me={handleKeydown:J,get children(){return t()},set children(D){t(D),b()},get minZoom(){return r()},set minZoom(D=.25){r(D),b()},get maxZoom(){return s()},set maxZoom(D=8){s(D),b()},get onScaleChange(){return i()},set onScaleChange(D){i(D),b()},$set:Dt,$on:(D,ae)=>$t(e,D,ae)},ie=y_(),q=te(ie),j=te(q);On(j,t),Y(q);var ne=R(q,2),we=te(ne);{let D=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel());Ze(we,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>E(l(d)/o),get"aria-label"(){return l(D)},get title(){return l(ae)},children:(ge,ue)=>{ut(ge,{get icon(){return Tw}})},$$slots:{default:!0}})}var be=R(we,2),Se=te(be);{let D=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel());ox(Se,{class:"accent-white",get min(){return r()},get max(){return s()},step:"0.01",get value(){return l(d)},oninput:de,get"aria-label"(){return l(D)},get title(){return l(ae)},"data-testid":"zoom-pan-slider"})}Y(be);var se=R(be,2);{let D=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel());Ze(se,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>E(l(d)*o),get"aria-label"(){return l(D)},get title(){return l(ae)},children:(ge,ue)=>{ut(ge,{get icon(){return Ew}})},$$slots:{default:!0}})}var oe=R(se,2),H=re(oe,!0),W=R(oe,2);{let D=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel());Ze(W,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:z,get"aria-label"(){return l(D)},get title(){return l(ae)},children:(ge,ue)=>{ut(ge,{get icon(){return Aw}})},$$slots:{default:!0}})}return Y(ne),Y(ie),Qn(ie,D=>x(g,D),()=>l(g)),L((D,ae)=>{wt(ie,1,`relative h-full w-full touch-none select-none overflow-hidden ${l(p)?"cursor-grabbing":"cursor-grab"}`),xt(ie,"aria-label",D),Hi(q,`transform: translate(${l(f)??""}px, ${l(h)??""}px) scale(${l(d)??""}); transform-origin: 0 0;`),xt(ne,"aria-label",ae),B(H,l(M))},[()=>_.ui_zoomPanViewport_viewport_ariaLabel(),()=>_.ui_zoomPanViewport_controls_ariaLabel()]),Kr("pointerdown",ie,K),Kr("pointermove",ie,Q),Kr("pointerup",ie,$),xo("pointercancel",ie,$),xo("click",ie,X,!0),Kr("keydown",ie,J),Kr("pointerdown",ne,D=>D.stopPropagation()),k(n,ie),Ot(me)}So(["pointerdown","pointermove","pointerup","keydown"]);var w_=N('<img class="max-h-[90vh] max-w-[90vw] rounded-lg object-contain" draggable="false" data-media-lightbox-content=""/>');function bv(n,e){if(new.target)return Nt({component:bv,...n});Lt(e,!0);const t=m=>{var S=Je(),I=ce(S);{var C=M=>{Qn(mv(M,{get imageUrl(){return s()},get imageName(){return i()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]",get open(){return l(f)},set open(O){x(f,O,!0)}}),O=>x(d,O,!0),()=>l(d))};V(I,M=>{c()&&M(C)})}k(m,S)};let r=y(e,"open",15,!1),s=y(e,"imageUrl",7),i=y(e,"imageName",23,()=>_.ui_imageLightbox_image_alt()),o=y(e,"onClose",7),a=y(e,"openerElement",7,null),c=y(e,"showActionsMenu",7,!1),u=fe(void 0),d=fe(void 0),f=fe(!1);ft(()=>{r()||x(f,!1)});function h(m){p(m),m.defaultPrevented||l(u)?.handleKeydown(m)}function p(m){r()&&c()&&l(d)?.handleCopy(m)}function g(m){!c()||!Qd(s())||(m.preventDefault(),m.stopPropagation(),x(f,!0))}var v={get open(){return r()},set open(m=!1){r(m),b()},get imageUrl(){return s()},set imageUrl(m){s(m),b()},get imageName(){return i()},set imageName(m=_.ui_imageLightbox_image_alt()){i(m),b()},get onClose(){return o()},set onClose(m){o(m),b()},get openerElement(){return a()},set openerElement(m=null){a(m),b()},get showActionsMenu(){return c()},set showActionsMenu(m=!1){c(m),b()},$set:Dt,$on:(m,S)=>$t(e,m,S)};{let m=w(()=>_.ui_imageLightbox_preview_ariaLabel()),S=w(()=>_.ui_imageLightbox_close_ariaLabel());rh(n,{get ariaLabel(){return l(m)},get closeLabel(){return l(S)},get onClose(){return o()},get openerElement(){return a()},get actions(){return t},onKeydown:h,onCopy:p,get open(){return r()},set open(I){r(I)},children:(I,C)=>{var M=Je(),O=ce(M);Qf(O,s,P=>{Qn(vv(P,{children:(E,z)=>{var G=w_();L(()=>{xt(G,"src",s()),xt(G,"alt",i())}),Kr("contextmenu",G,g),k(E,G)},$$slots:{default:!0}}),E=>x(u,E,!0),()=>l(u))}),k(I,M)},$$slots:{default:!0}})}return Ot(v)}So(["contextmenu"]);var x_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-duration"> </div>'),k_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-dimensions"> </div>'),__=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-size"> </div>'),S_=N("<!> <!> <!> <!>",1),C_=N("<!> <!> <!>",1),M_=N("<!> <!>",1);function Fc(n,e){if(new.target)return Nt({component:Fc,...n});Lt(e,!0);let t=y(e,"videoUrl",7),r=y(e,"videoName",7),s=y(e,"sourceKind",7),i=y(e,"mimeType",7),o=y(e,"open",15,!1),a=y(e,"triggerClass",7),c=y(e,"contentClass",7);const u=w(()=>Xd(t())),d=w(()=>Au(t())),f=w(()=>s()??(l(u)?"inline":l(d)?"workspace":"remote"));let h=fe(null),p=fe(null),g=fe(null),v=null;function m(){if(v===t())return;const E=v=t();x(h,null),x(p,null),x(g,l(u)?gv(l(u).base64):null,!0);const z=document.createElement("video");z.preload="metadata",z.onloadedmetadata=()=>{v===E&&(Number.isFinite(z.duration)&&z.duration>0&&x(h,z.duration,!0),z.videoWidth>0&&z.videoHeight>0&&x(p,{width:z.videoWidth,height:z.videoHeight},!0))},z.src=t(),l(u)||fetch(t()).then(G=>G.ok?G.blob():null).then(G=>{G&&v===E&&x(g,G.size,!0)}).catch(()=>{})}function S(){const E=l(d)?.path.split("/").pop();if(E)return E;const z=(r()||"video").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(z))return z;const G=(i()??l(u)?.mimeType)==="video/webm"?"webm":"mp4";return`${z}.${G}`}async function I(){let E=null;try{let z=t();if(!l(u)){const J=await fetch(t());if(!J.ok)throw new Error(`Video fetch failed: ${J.status}`);E=URL.createObjectURL(await J.blob()),z=E}const G=document.createElement("a");G.href=z,G.download=S(),document.body.appendChild(G),G.click(),G.remove(),E&&URL.revokeObjectURL(E)}catch{E&&URL.revokeObjectURL(E),_s.error(_.ui_videoActionsMenu_downloadFailed_error())}}async function C(E,z){try{await Bc(E),_s.success(z)}catch{_s.error(_.ui_videoActionsMenu_copyFailed_error())}}ft(()=>{o()&&m()}),ft(()=>{if(o())return ja(()=>{o(!1)})});var M={get videoUrl(){return t()},set videoUrl(E){t(E),b()},get videoName(){return r()},set videoName(E){r(E),b()},get sourceKind(){return s()},set sourceKind(E){s(E),b()},get mimeType(){return i()},set mimeType(E){i(E),b()},get open(){return o()},set open(E=!1){o(E),b()},get triggerClass(){return a()},set triggerClass(E){a(E),b()},get contentClass(){return c()},set contentClass(E){c(E),b()},$set:Dt,$on:(E,z)=>$t(e,E,z)},O=Je(),P=ce(O);return Rt(P,()=>Wf,(E,z)=>{z(E,{get open(){return o()},set open(G){o(G)},children:(G,J)=>{var K=M_(),Q=ce(K);{let X=w(()=>br("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",a())),de=w(()=>_.ui_videoActionsMenu_trigger_ariaLabel());Rt(Q,()=>Uf,(me,ie)=>{ie(me,{get class(){return l(X)},get"aria-label"(){return l(de)},onclick:q=>q.stopPropagation(),children:(q,j)=>{Km(q,{class:"size-3.5"})},$$slots:{default:!0}})})}var $=R(Q,2);Rt($,()=>Vf,(X,de)=>{de(X,{get class(){return c()},align:"end",children:(me,ie)=>{var q=C_(),j=ce(q);Rt(j,()=>Ho,(oe,H)=>{H(oe,{onSelect:()=>void I(),children:(W,D)=>{Ht();var ae=Vt();L(ge=>B(ae,ge),[()=>_.ui_videoActionsMenu_download_label()]),k(W,ae)},$$slots:{default:!0}})});var ne=R(j,2);{var we=oe=>{var H=Je(),W=ce(H);Rt(W,()=>Ho,(D,ae)=>{ae(D,{onSelect:()=>void C(l(d).path,_.ui_videoActionsMenu_pathCopied_label()),children:(ge,ue)=>{Ht();var pe=Vt();L(ke=>B(pe,ke),[()=>_.ui_videoActionsMenu_copyPath_label()]),k(ge,pe)},$$slots:{default:!0}})}),k(oe,H)},be=oe=>{var H=Je(),W=ce(H);Rt(W,()=>Ho,(D,ae)=>{ae(D,{onSelect:()=>void C(t(),_.ui_videoActionsMenu_linkCopied_label()),children:(ge,ue)=>{Ht();var pe=Vt();L(ke=>B(pe,ke),[()=>_.ui_videoActionsMenu_copyLink_label()]),k(ge,pe)},$$slots:{default:!0}})}),k(oe,H)};V(ne,oe=>{l(f)==="workspace"&&l(d)?oe(we):l(f)==="remote"&&oe(be,1)})}var Se=R(ne,2);{var se=oe=>{var H=S_(),W=ce(H);Rt(W,()=>jm,(ye,Z)=>{Z(ye,{})});var D=R(W,2);{var ae=ye=>{var Z=x_(),$e=re(Z,!0);L(lt=>B($e,lt),[()=>_.ui_videoActionsMenu_duration_label({duration:ww(l(h)*1e3)})]),k(ye,Z)};V(D,ye=>{l(h)!==null&&ye(ae)})}var ge=R(D,2);{var ue=ye=>{var Z=k_(),$e=re(Z,!0);L(lt=>B($e,lt),[()=>_.ui_videoActionsMenu_dimensions_label({width:as(l(p).width),height:as(l(p).height)})]),k(ye,Z)};V(ge,ye=>{l(p)&&ye(ue)})}var pe=R(ge,2);{var ke=ye=>{var Z=__(),$e=re(Z,!0);L(lt=>B($e,lt),[()=>Im(l(g))]),k(ye,Z)};V(pe,ye=>{l(g)!==null&&ye(ke)})}k(oe,H)};V(Se,oe=>{(l(h)!==null||l(p)||l(g)!==null)&&oe(se)})}k(me,q)},$$slots:{default:!0}})}),k(G,K)},$$slots:{default:!0}})}),k(n,O),Ot(M)}var T_=N('<p class="type-body text-white/80" role="status"> </p>'),E_=N('<div data-media-lightbox-content="" data-video-lightbox-root="" class="flex max-h-[90vh] max-w-[90vw] cursor-default flex-col items-center gap-3"><video controls="" preload="metadata" playsinline="" class="max-h-[85vh] max-w-[90vw] rounded-lg bg-black object-contain shadow-(--elevation-overlay)" data-testid="chat-video-player"> </video> <!></div>',2);function yv(n,e){if(new.target)return Nt({component:yv,...n});Lt(e,!0);const t=p=>{Fc(p,{get videoUrl(){return s()},get videoName(){return i()},get sourceKind(){return a()},get mimeType(){return c()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]"})};let r=y(e,"open",15,!1),s=y(e,"videoUrl",7),i=y(e,"videoName",23,()=>_.chat_videoBlock_fromAgent_label()),o=y(e,"poster",7),a=y(e,"sourceKind",7),c=y(e,"mimeType",7),u=y(e,"openerElement",7,null),d=y(e,"onClose",7),f=fe(!1);ft(()=>{!r()||!s()||x(f,!1)});var h={get open(){return r()},set open(p=!1){r(p),b()},get videoUrl(){return s()},set videoUrl(p){s(p),b()},get videoName(){return i()},set videoName(p=_.chat_videoBlock_fromAgent_label()){i(p),b()},get poster(){return o()},set poster(p){o(p),b()},get sourceKind(){return a()},set sourceKind(p){a(p),b()},get mimeType(){return c()},set mimeType(p){c(p),b()},get openerElement(){return u()},set openerElement(p=null){u(p),b()},get onClose(){return d()},set onClose(p){d(p),b()},$set:Dt,$on:(p,g)=>$t(e,p,g)};{let p=w(()=>_.chat_videoBlock_dialog_title({name:i()})),g=w(()=>_.chat_videoBlock_close_ariaLabel());rh(n,{get ariaLabel(){return l(p)},get closeLabel(){return l(g)},get openerElement(){return u()},get onClose(){return d()},get actions(){return t},get open(){return r()},set open(v){r(v)},children:(v,m)=>{var S=E_(),I=te(S),C=re(I,!0),M=R(I,2);{var O=P=>{var E=T_(),z=re(E,!0);L(G=>B(z,G),[()=>_.chat_videoBlock_unavailable_description()]),k(P,E)};V(M,P=>{l(f)&&P(O)})}Y(S),L(P=>{xt(I,"src",s()),xt(I,"poster",o()),xt(I,"aria-label",i()),B(C,P)},[()=>_.chat_videoBlock_unsupported_description()]),xo("error",I,()=>x(f,!0)),k(v,S)},$$slots:{default:!0}})}return Ot(h)}var A_=N('<span class="block truncate text-foreground"> </span>'),R_=N("<!> ",1),P_=N("<!> <!>",1),I_=N('<span class="flex shrink-0 flex-wrap items-center gap-1"><!> <!></span>'),L_=N('<div class="type-caption flex w-fit min-w-0 max-w-full items-center gap-3 whitespace-normal py-1 text-muted-foreground" role="status" data-testid="media-unavailable"><span class="flex min-w-0 max-w-full flex-1 items-start gap-2"><span class="first-line-icon" aria-hidden="true"><!></span> <span class="min-w-0"><!> <span class="block break-words"> </span></span></span> <!></div>');function wv(n,e){if(new.target)return Nt({component:wv,...n});Lt(e,!0);let t=y(e,"name",7),r=y(e,"reason",7),s=y(e,"path",7),i=y(e,"workspaceId",7),o=y(e,"onRetry",7);const a=w(()=>r()==="missing"?_.ui_mediaUnavailable_missing_description():r()==="unsupported"?_.ui_mediaUnavailable_unsupported_description():r()==="other-workspace"?_.ui_mediaUnavailable_otherWorkspace_description():r()==="invalid-link"?_.ui_mediaUnavailable_invalidLink_description():_.ui_mediaUnavailable_loadFailed_description());function c(z){z.preventDefault(),z.stopPropagation()}function u(z){c(z),o()?.()}async function d(z){if(c(z),!!s())try{await Bc(s()),_s.success(_.ui_imageActionsMenu_pathCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}function f(z){if(c(z),!s()||!i())return;const G=s().split("/").map(encodeURIComponent).join("/");jf(`intent://local/file/${G}`,{workspaceId:Xm(i())})}var h={get name(){return t()},set name(z){t(z),b()},get reason(){return r()},set reason(z){r(z),b()},get path(){return s()},set path(z){s(z),b()},get workspaceId(){return i()},set workspaceId(z){i(z),b()},get onRetry(){return o()},set onRetry(z){o(z),b()},$set:Dt,$on:(z,G)=>$t(e,z,G)},p=L_(),g=te(p),v=te(g),m=te(v);ut(m,{get icon(){return Dc},class:"size-3.5"}),Y(v);var S=R(v,2),I=te(S);{var C=z=>{var G=A_(),J=re(G,!0);Pl(G,(K,Q)=>jd?.(K,Q),t),L(()=>B(J,t())),k(z,G)};V(I,z=>{t()&&z(C)})}var M=R(I,2),O=re(M,!0);Y(S),Y(g);var P=R(g,2);{var E=z=>{var G=I_(),J=te(G);{var K=X=>{{let de=w(()=>_.chat_shared_retry_label());Ze(X,{variant:"ghost",size:"icon-compact",get tooltip(){return l(de)},onclick:u,children:(me,ie)=>{ut(me,{get icon(){return Bf},size:"xs"})},$$slots:{default:!0}})}};V(J,X=>{o()&&X(K)})}var Q=R(J,2);{var $=X=>{var de=P_(),me=ce(de);{var ie=j=>{Ze(j,{variant:"ghost",size:"compact",onclick:f,children:(ne,we)=>{var be=R_(),Se=ce(be);ut(Se,{get icon(){return Dm},size:"xs"});var se=R(Se);L(oe=>B(se,` ${oe??""}`),[()=>_.chat_changesPanel_openFile_tooltip()]),k(ne,be)},$$slots:{default:!0}})};V(me,j=>{i()&&r()!=="other-workspace"&&r()!=="invalid-link"&&j(ie)})}var q=R(me,2);{let j=w(()=>_.ui_imageActionsMenu_copyPath_label());Ze(q,{variant:"ghost",size:"icon-compact",get tooltip(){return l(j)},onclick:d,children:(ne,we)=>{ut(ne,{get icon(){return Nm},size:"xs"})},$$slots:{default:!0}})}k(X,de)};V(Q,X=>{s()&&X($)})}Y(G),k(z,G)};V(P,z=>{(o()||s())&&z(E)})}return Y(p),L(()=>{xt(p,"data-reason",r()),B(O,l(a))}),k(n,p),Ot(h)}const a$=It.createSelector(n=>n.featureCodes.activeFeatures),O_=It.createSelector((n,e)=>n.featureCodes.activeFeatures.includes(e)),l$=It.createSelector(n=>n.featureCodes.activeFeatures.length>0),c$=It.createSelector(n=>n.featureCodes.dialogOpen);var N_=N("<span> </span>"),D_=N('<div role="search"><div><!> <!> <!></div> <div><!> <!> <!></div></div>');function $_(n,e){if(new.target)return Nt({component:$_,...n});Lt(e,!0);let t=y(e,"query",15,""),r=y(e,"inputRef",15,null),s=y(e,"placeholder",23,()=>_.ui_panelFindBar_find_placeholder()),i=y(e,"disabled",7,!1),o=y(e,"inputDisabled",7,!1),a=y(e,"navigationDisabled",7,!1),c=y(e,"closeDisabled",7,!1),u=y(e,"disableNavigationWhenNoMatches",7,!0),d=y(e,"autofocus",7,!1),f=y(e,"selectOnFocus",7,!0),h=y(e,"focusTrigger",7),p=y(e,"currentMatchIndex",7,0),g=y(e,"totalMatches",7),v=y(e,"resultText",7,void 0),m=y(e,"emptyResultText",23,()=>_.ui_panelFindBar_noMatches_label()),S=y(e,"showResultText",7,!0),I=y(e,"showResultWhenQueryEmpty",7,!1),C=y(e,"resultFormat",7,"slash"),M=y(e,"resultVariant",7,void 0),O=y(e,"searchAriaLabel",23,()=>_.ui_panelFindBar_search_ariaLabel()),P=y(e,"previousLabel",23,()=>_.ui_panelFindBar_previous_label()),E=y(e,"previousShortcutLabel",7,"Shift+Enter"),z=y(e,"previousKeyShortcuts",7,"Shift+Enter"),G=y(e,"previousTitle",7,void 0),J=y(e,"nextLabel",23,()=>_.ui_panelFindBar_next_label()),K=y(e,"nextShortcutLabel",7,"Enter"),Q=y(e,"nextKeyShortcuts",7,"Enter"),$=y(e,"nextTitle",7,void 0),X=y(e,"closeLabel",23,()=>_.ui_panelFindBar_close_label()),de=y(e,"closeShortcutLabel",7,"Esc"),me=y(e,"closeKeyShortcuts",7,"Escape"),ie=y(e,"closeTitle",7,void 0),q=y(e,"layout",7,"floating"),j=y(e,"class",7),ne=y(e,"inputWrapperClass",7),we=y(e,"inputClass",7),be=y(e,"actionsClass",7),Se=y(e,"onPrevious",7),se=y(e,"onNext",7),oe=y(e,"onClose",7),H=y(e,"onQueryChange",7),W=y(e,"onInput",7),D=y(e,"onKeydown",7);const ae=w(()=>t().trim().length>0),ge=w(()=>i()||a()||!l(ae)||u()&&typeof g()=="number"&&g()<=0),ue=w(()=>{if(v()!==void 0)return v();if(!S()||!l(ae)&&!I()||typeof g()!="number")return null;if(g()<=0)return l(ae)?m():null;const ee=Math.min(Math.max(p()+1,1),g());return C()==="of"?_.ui_panelFindBar_matchOf_label({current:ee,total:g()}):`${ee} / ${g()}`}),pe=w(()=>M()??(typeof g()=="number"&&g()<=0&&l(ae)?"destructive":"muted"));ft(()=>{(d()||h()!==void 0)&&r()&&!i()&&!o()&&(r().focus(),f()&&r().select())});function ke(){r()?.focus()}function ye(){r()?.blur()}function Z(){r()?.select()}function $e(ee,Ge){return Ge?`${ee} (${Ge})`:ee}function lt(ee){t(ee.currentTarget.value),H()?.(t(),ee),W()?.(ee)}function St(ee){D()?.(ee),!ee.defaultPrevented&&(ee.key==="Escape"&&oe()&&!c()&&!i()?(ee.preventDefault(),oe()(ee)):ee.key==="Enter"&&!l(ge)&&(ee.preventDefault(),ee.shiftKey?Se()?.(t(),ee):se()?.(t(),ee)))}var De={focus:ke,blur:ye,select:Z,get query(){return t()},set query(ee=""){t(ee),b()},get inputRef(){return r()},set inputRef(ee=null){r(ee),b()},get placeholder(){return s()},set placeholder(ee=_.ui_panelFindBar_find_placeholder()){s(ee),b()},get disabled(){return i()},set disabled(ee=!1){i(ee),b()},get inputDisabled(){return o()},set inputDisabled(ee=!1){o(ee),b()},get navigationDisabled(){return a()},set navigationDisabled(ee=!1){a(ee),b()},get closeDisabled(){return c()},set closeDisabled(ee=!1){c(ee),b()},get disableNavigationWhenNoMatches(){return u()},set disableNavigationWhenNoMatches(ee=!0){u(ee),b()},get autofocus(){return d()},set autofocus(ee=!1){d(ee),b()},get selectOnFocus(){return f()},set selectOnFocus(ee=!0){f(ee),b()},get focusTrigger(){return h()},set focusTrigger(ee){h(ee),b()},get currentMatchIndex(){return p()},set currentMatchIndex(ee=0){p(ee),b()},get totalMatches(){return g()},set totalMatches(ee){g(ee),b()},get resultText(){return v()},set resultText(ee=void 0){v(ee),b()},get emptyResultText(){return m()},set emptyResultText(ee=_.ui_panelFindBar_noMatches_label()){m(ee),b()},get showResultText(){return S()},set showResultText(ee=!0){S(ee),b()},get showResultWhenQueryEmpty(){return I()},set showResultWhenQueryEmpty(ee=!1){I(ee),b()},get resultFormat(){return C()},set resultFormat(ee="slash"){C(ee),b()},get resultVariant(){return M()},set resultVariant(ee=void 0){M(ee),b()},get searchAriaLabel(){return O()},set searchAriaLabel(ee=_.ui_panelFindBar_search_ariaLabel()){O(ee),b()},get previousLabel(){return P()},set previousLabel(ee=_.ui_panelFindBar_previous_label()){P(ee),b()},get previousShortcutLabel(){return E()},set previousShortcutLabel(ee="Shift+Enter"){E(ee),b()},get previousKeyShortcuts(){return z()},set previousKeyShortcuts(ee="Shift+Enter"){z(ee),b()},get previousTitle(){return G()},set previousTitle(ee=void 0){G(ee),b()},get nextLabel(){return J()},set nextLabel(ee=_.ui_panelFindBar_next_label()){J(ee),b()},get nextShortcutLabel(){return K()},set nextShortcutLabel(ee="Enter"){K(ee),b()},get nextKeyShortcuts(){return Q()},set nextKeyShortcuts(ee="Enter"){Q(ee),b()},get nextTitle(){return $()},set nextTitle(ee=void 0){$(ee),b()},get closeLabel(){return X()},set closeLabel(ee=_.ui_panelFindBar_close_label()){X(ee),b()},get closeShortcutLabel(){return de()},set closeShortcutLabel(ee="Esc"){de(ee),b()},get closeKeyShortcuts(){return me()},set closeKeyShortcuts(ee="Escape"){me(ee),b()},get closeTitle(){return ie()},set closeTitle(ee=void 0){ie(ee),b()},get layout(){return q()},set layout(ee="floating"){q(ee),b()},get class(){return j()},set class(ee){j(ee),b()},get inputWrapperClass(){return ne()},set inputWrapperClass(ee){ne(ee),b()},get inputClass(){return we()},set inputClass(ee){we(ee),b()},get actionsClass(){return be()},set actionsClass(ee){be(ee),b()},get onPrevious(){return Se()},set onPrevious(ee){Se(ee),b()},get onNext(){return se()},set onNext(ee){se(ee),b()},get onClose(){return oe()},set onClose(ee){oe(ee),b()},get onQueryChange(){return H()},set onQueryChange(ee){H(ee),b()},get onInput(){return W()},set onInput(ee){W(ee),b()},get onKeydown(){return D()},set onKeydown(ee){D(ee),b()},$set:Dt,$on:(ee,Ge)=>$t(e,ee,Ge)},Le=D_(),Qe=te(Le),Ct=te(Qe);ut(Ct,{get icon(){return Rw},class:"size-3 shrink-0 text-muted-foreground"});var bt=R(Ct,2);{let ee=w(()=>i()||o()),Ge=w(()=>br("h-6 w-36 border-0 bg-transparent px-0 py-0 text-sm shadow-none","placeholder:text-muted-foreground",we()));Xr(bt,{type:"text",get placeholder(){return s()},get disabled(){return l(ee)},noFocusStyle:!0,get class(){return l(Ge)},get"aria-label"(){return O()},oninput:lt,onkeydown:St,get ref(){return r()},set ref(it){r(it)},get value(){return t()},set value(it){t(it)}})}var sn=R(bt,2);{var Be=ee=>{var Ge=N_(),it=re(Ge,!0);L(Xe=>{wt(Ge,1,Xe),B(it,l(ue))},[()=>Xn(br("whitespace-nowrap text-xs tabular-nums",l(pe)==="destructive"?"text-danger":"text-muted-foreground"))]),k(ee,Ge)};V(sn,ee=>{l(ue)&&ee(Be)})}Y(Qe);var he=R(Qe,2),Ne=te(he);{let ee=w(()=>G()??$e(P(),E()));Ze(Ne,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:Ge=>Se()?.(t(),Ge),get disabled(){return l(ge)},get"aria-label"(){return P()},get"aria-keyshortcuts"(){return z()},get title(){return l(ee)},children:(Ge,it)=>{ut(Ge,{get icon(){return Pw},class:"size-3"})},$$slots:{default:!0}})}var je=R(Ne,2);{let ee=w(()=>$()??$e(J(),K()));Ze(je,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:Ge=>se()?.(t(),Ge),get disabled(){return l(ge)},get"aria-label"(){return J()},get"aria-keyshortcuts"(){return Q()},get title(){return l(ee)},children:(Ge,it)=>{ut(Ge,{get icon(){return Da},class:"size-3"})},$$slots:{default:!0}})}var Tt=R(je,2);{let ee=w(()=>i()||c()),Ge=w(()=>ie()??$e(X(),de()));Ze(Tt,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:it=>oe()?.(it),get disabled(){return l(ee)},get"aria-label"(){return X()},get"aria-keyshortcuts"(){return me()},get title(){return l(Ge)},children:(it,Xe)=>{ut(it,{get icon(){return Fi},class:"size-3.5"})},$$slots:{default:!0}})}return Y(he),Y(Le),L((ee,Ge,it)=>{xt(Le,"aria-label",O()),wt(Le,1,ee),wt(Qe,1,Ge),wt(he,1,it)},[()=>Xn(br("inline-flex items-center gap-1 rounded-lg border border-border bg-background/95 px-2 py-1 shadow-lg backdrop-blur supports-[backdrop-filter]:bg-background/90",q()==="floating"&&"absolute top-2 right-4 z-50",i()&&"pointer-events-none opacity-60",j())),()=>Xn(br("flex h-7 min-w-0 items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2",ne())),()=>Xn(br("flex items-center gap-0.5",be()))]),k(n,Le),Ot(De)}var Ap=Object.defineProperty,B_=(n,e)=>{let t={};for(var r in n)Ap(t,r,{get:n[r],enumerable:!0});return Ap(t,Symbol.toStringTag,{value:"Module"}),t};function Ur(n){this.content=n}Ur.prototype={constructor:Ur,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Ur(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ur(t)},addToStart:function(n,e){return new Ur([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ur(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Ur(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ur.from(n),n.size?new Ur(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ur.from(n),n.size?new Ur(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ur.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ur.from=function(n){if(n instanceof Ur)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ur(e)};function xv(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){let o=s.text,a=i.text,c=0;for(;o[c]==a[c];c++)t++;return c&&c<o.length&&c<a.length&&Sv(o.charCodeAt(c-1))&&_v(o.charCodeAt(c))&&t--,t}if(s.content.size||i.content.size){let o=xv(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function kv(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),a=e.child(--i),c=o.nodeSize;if(o==a){t-=c,r-=c;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let u=o.text,d=a.text,f=u.length,h=d.length;for(;f>0&&h>0&&u[f-1]==d[h-1];)f--,h--,t--,r--;return f&&h&&f<u.length&&Sv(u.charCodeAt(f-1))&&_v(u.charCodeAt(f))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let u=kv(o.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}function _v(n){return n>=56320&&n<57344}function Sv(n){return n>=55296&&n<56320}class _e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,a=0;a<t;o++){let c=this.content[o],u=a+c.nodeSize;if(u>e&&r(c,s+a,i||null,o)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,t-d),r,s+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(a,c)=>{let u=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new _e(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let a=this.content[i],c=o+a.nodeSize;c>e&&((o<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),s+=a.nodeSize),o=c}return new _e(r,s)}cutByIndex(e,t){return e==t?_e.empty:e==0&&t==this.content.length?this:new _e(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new _e(s,i)}addToStart(e){return new _e([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new _e(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return xv(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return kv(this,e,t,r)}findIndex(e){if(e==0)return ac(0,e);if(e==this.size)return ac(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?ac(t+1,i):ac(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return _e.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return _e.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return _e.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new _e(t||e,r)}static from(e){if(!e)return _e.empty;if(e instanceof _e)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new _e([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}_e.empty=new _e([],0);const dd={index:0,offset:0};function ac(n,e){return dd.index=n,dd.offset=e,dd}function Hc(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Hc(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Hc(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let En=class Yd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Hc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Yd.none;if(e instanceof Yd)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};En.none=[];class Il extends Error{}class He{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Mv(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new He(r,this.openStart,this.openEnd)}removeBetween(e,t){return new He(Cv(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return He.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new He(_e.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new He(e,r,s)}}He.empty=new He(_e.empty,0,0);function Cv(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(s==e||i.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Cv(i.content,e-s-1,t-s-1)))}function Mv(n,e,t,r,s,i){let{index:o,offset:a}=n.findIndex(e),c=n.maybeChild(o);if(a==e||c.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let u=Mv(c.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?s-1:0,c);return u&&n.replaceChild(o,c.copy(u))}function z_(n,e,t){if(t.openStart>n.depth)throw new Il("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Il("Inconsistent open depths");return Tv(n,e,t,0)}function Tv(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Tv(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Xo(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=F_(t,n);return Xo(i,Av(n,o,a,e,r))}else return Xo(i,Uc(n,e,r))}function Ev(n,e){if(!e.type.compatibleContent(n.type))throw new Il("Cannot join "+e.type.name+" onto "+n.type.name)}function Zd(n,e,t){let r=n.node(t);return Ev(r,e.node(t)),r}function Jo(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function bl(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Jo(n.nodeAfter,r),i++));for(let a=i;a<o;a++)Jo(s.child(a),r);e&&e.depth==t&&e.textOffset&&Jo(e.nodeBefore,r)}function Xo(n,e){if(!n.type.validContent(e))throw new Il("Invalid content for node "+n.type.name);return n.copy(e)}function Av(n,e,t,r,s){let i=n.depth>s&&Zd(n,e,s+1),o=r.depth>s&&Zd(t,r,s+1),a=[];return bl(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(Ev(i,o),Jo(Xo(i,Av(n,e,t,r,s+1)),a)):(i&&Jo(Xo(i,Uc(n,e,s+1)),a),bl(e,t,s,a),o&&Jo(Xo(o,Uc(t,r,s+1)),a)),bl(r,null,s,a),new _e(a)}function Uc(n,e,t){let r=[];if(bl(null,n,t,r),n.depth>t){let s=Zd(n,e,t+1);Jo(Xo(s,Uc(n,e,t+1)),r)}return bl(e,null,t,r),new _e(r)}function F_(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(_e.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Ll{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return En.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Vc(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:a,offset:c}=o.content.findIndex(i),u=i-c;if(r.push(o,a,s+c),!u||(o=o.child(a),o.isText))break;i=u-1,s+=c+1}return new Ll(t,r,i)}static resolveCached(e,t){let r=Rp.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Rp.set(e,r=new H_);let s=r.elts[r.i]=Ll.resolve(e,t);return r.i=(r.i+1)%U_,s}}class H_{constructor(){this.elts=[],this.i=0}}const U_=12,Rp=new WeakMap;class Vc{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const V_=Object.create(null);let go=class ef{constructor(e,t,r,s=En.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||_e.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Hc(this.attrs,t||e.defaultAttrs||V_)&&En.sameSet(this.marks,r||En.none)}copy(e=null){return e==this.content?this:new ef(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ef(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return He.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),a=s.start(o),u=s.node(o).content.cut(s.pos-a,i.pos-a);return new He(u,s.depth-o,i.depth-o)}replace(e,t,r){return z_(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Ll.resolveCached(this,e)}resolveNoCache(e){return Ll.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rv(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=_e.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=s;c<i;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),Pp(this.type.attrs,this.attrs,"node",this.type.name);let e=En.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];Pp(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!En.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=_e.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,s,r)}};go.prototype.text=void 0;class Wc extends go{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Wc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Wc(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rv(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Pp(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${r}`);for(let s in n)n[s].validate&&n[s].validate(e[s])}class ea{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new W_(e,t);if(r.next==null)return ea.empty;let s=Pv(r);r.next&&r.err("Unexpected trailing text");let i=Q_(X_(s));return Y_(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,a){let c=o.matchFragment(e,r);if(c&&(!t||c.validEnd))return _e.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:f}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let h=i(f,a.concat(d));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:c}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!s.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
5
- `)}}ea.empty=new ea(!0);class W_{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Pv(n){let e=[];do e.push(K_(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function K_(n){let e=[];do e.push(j_(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function j_(n){let e=J_(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=G_(n,e);else break;return e}function Ip(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function G_(n,e){let t=Ip(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ip(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function q_(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function J_(n){if(n.eat("(")){let e=Pv(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=q_(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function X_(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,c){let u={term:c,to:a};return e[o].push(u),u}function s(o,a){o.forEach(c=>c.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((c,u)=>c.concat(i(u,a)),[]);if(o.type=="seq")for(let c=0;;c++){let u=i(o.exprs[c],a);if(c==o.exprs.length-1)return u;s(u,a=t())}else if(o.type=="star"){let c=t();return r(a,c),s(i(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=t();return s(i(o.expr,a),c),s(i(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let c=a;for(let u=0;u<o.min;u++){let d=t();s(i(o.expr,c),d),c=d}if(o.max==-1)s(i(o.expr,c),c);else for(let u=o.min;u<o.max;u++){let d=t();r(c,d),s(i(o.expr,c),d),c=d}return[r(c)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Iv(n,e){return e-n}function Lp(n,e){let t=[];return r(e),t.sort(Iv);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:a,to:c}=i[o];!a&&t.indexOf(c)==-1&&r(c)}}}function Q_(n){let e=Object.create(null);return t(Lp(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:a,to:c})=>{if(!a)return;let u;for(let d=0;d<s.length;d++)s[d][0]==a&&(u=s[d][1]);Lp(n,c).forEach(d=>{u||s.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new ea(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(Iv);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function Y_(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:c,next:u}=s.next[a];o.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Lv(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Ov(n,e){let t=Object.create(null);for(let r in n){let s=n[r],i=e&&e[r];if(i===void 0)if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r);else s.validate&&s.validate(i);t[r]=i}return t}function Nv(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new eS(n,r,e[r]);return t}let Op=class Dv{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Nv(e,r.attrs),this.defaultAttrs=Lv(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ea.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ov(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new go(this,this.computeAttrs(e),_e.from(t),En.setFrom(r))}createChecked(e=null,t,r){return t=_e.from(t),this.checkContent(t),new go(this,this.computeAttrs(e),t,En.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=_e.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(_e.empty,!0);return i?new go(this,e,t.append(i),En.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:En.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new Dv(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Z_(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class eS{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Z_(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ru{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Nv(e,s.attrs),this.excluded=null;let i=Lv(this.attrs);this.instance=i?new En(this,i):null}create(e=null){return!e&&this.instance?this.instance:new En(this,Ov(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Ru(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class $v{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Ur.from(e.nodes),t.marks=Ur.from(e.marks||{}),this.nodes=Op.compile(this.spec.nodes,this),this.marks=Ru.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=ea.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?Np(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Np(this,o.split(" "))}this.nodeFromJSON=s=>go.fromJSON(this,s),this.markFromJSON=s=>En.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Op){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new Wc(r,r.defaultAttrs,e,En.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Np(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let a in n.marks){let c=n.marks[a];(s=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function tS(n){return n.tag!=null}function nS(n){return n.style!=null}class mo{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(tS(s))this.tags.push(s);else if(nS(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new $p(this,t,!1);return r.addAll(e,En.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new $p(this,t,!0);return r.addAll(e,En.none,t.from,t.to),He.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(iS(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let c=o.getAttrs(t);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Bp(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Bp(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new mo(e,mo.schemaRules(e)))}}const Bv={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},rS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},zv={ol:!0,ul:!0},Ol=1,tf=2,yl=4;function Dp(n,e,t){return e!=null?(e?Ol:0)|(e==="full"?tf:0):n&&n.whitespace=="pre"?Ol|tf:t&~yl}class lc{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=En.none,this.match=i||(o&yl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(_e.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ol)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=_e.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(_e.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Bv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class $p{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Dp(null,t.preserveWhitespace,0)|(r?yl:0);s?i=new lc(s.type,s.attrs,En.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new lc(null,null,En.none,!0,null,o):i=new lc(e.schema.topNodeType,null,En.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&tf?"full":this.localPreserveWS||(s.options&Ol)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
4
+ `),monitorAgentId:h.monitorAgentId,monitorOnly:h.monitorOnly===!0}})}function s_(n){return"type"in n&&n.type==="separator"}function s$(n){const e=n instanceof KeyboardEvent;if(e&&n.key!=="ContextMenu"&&!(n.shiftKey&&n.key==="F10"))return null;n.preventDefault(),n.stopPropagation();const t=n.currentTarget instanceof HTMLElement?n.currentTarget:null,r=t?.getBoundingClientRect();return{x:e?r?.left??0:n.clientX,y:e?r?.bottom??0:n.clientY,returnFocus:t}}function Jd(n,e,t=""){let r=0;const s=[];for(const[o,a]of n.entries()){if(s_(a)){r+=1;continue}if("type"in a&&a.type==="label"){s.push({kind:"label",id:a.id??`sidebar-label-${o}`,label:a.label,group:String(r)});continue}const c={id:a.id,label:a.label,icon:a.icon,disabled:a.disabled,disabledReason:a.disabledReason,shortcut:a.shortcut,closeOnSelect:a.closeOnSelect,group:String(r)};if(a.submenu)if(a.selection==="single"){const u=a.submenu.filter(h=>h.checked!==void 0),d=a.submenu.filter(h=>h.checked===void 0),f=u.map(h=>({kind:"radio",id:h.id,value:h.id,label:h.label,icon:h.icon,disabled:h.disabled,disabledReason:h.disabledReason,shortcut:h.shortcut,closeOnSelect:h.closeOnSelect}));s.push({...c,kind:"submenu",children:[...f.length>0?[{kind:"radio-group",id:`${a.id}-selection`,label:a.label,value:u.find(h=>h.checked)?.id??"",children:f}]:[],...Jd(d)]})}else s.push({...c,kind:"submenu",children:Jd(a.submenu)});else a.checked!==void 0?s.push({...c,kind:"checkbox",checked:a.checked,indicator:a.indicator}):s.push({...c,kind:"action",destructive:a.destructive})}if(e!=="single")return s;const i=[];for(const o of s){if(o.kind!=="checkbox"){i.push(o);continue}const a=i.at(-1),c={...o,kind:"radio",checked:void 0,value:o.id};a?.kind==="radio-group"&&a.group===o.group?(a.children=[...a.children,c],o.checked&&(a.value=o.id)):i.push({kind:"radio-group",id:`${o.id}-selection`,label:t,group:o.group,value:o.checked?o.id:"",children:[c]})}return i}function fv(n,e){for(const t of n){if("type"in t)continue;if(t.id===e)return t;const r=t.submenu?fv(t.submenu,e):void 0;if(r)return r}}function i_(n,e){if(new.target)return Nt({component:i_,...n});Lt(e,!0);let t=y(e,"x",7),r=y(e,"y",7),s=y(e,"items",7),i=y(e,"onClickOutside",7),o=y(e,"ariaLabel",23,()=>cp()),a=y(e,"returnFocus",7),c=y(e,"selection",7);const u=w(()=>Jd(s(),c(),o()));var d={get x(){return t()},set x(f){t(f),b()},get y(){return r()},set y(f){r(f),b()},get items(){return s()},set items(f){s(f),b()},get onClickOutside(){return i()},set onClickOutside(f){i(f),b()},get ariaLabel(){return o()},set ariaLabel(f=cp()){o(f),b()},get returnFocus(){return a()},set returnFocus(f){a(f),b()},get selection(){return c()},set selection(f){c(f),b()},$set:Dt,$on:(f,h)=>$t(e,f,h)};{let f=w(()=>({x:t(),y:r(),returnFocus:a()}));sx(n,{get actions(){return l(u)},get ariaLabel(){return o()},get contextMenu(){return l(f)},onAction:h=>fv(s(),h)?.onClick(),onOpenChange:h=>{h||i()?.()}})}return Ot(d)}function o_(){try{return It.state.userPreferences?.shortcutOverrides??{}}catch{return{}}}function zc(n){return tv(n,o_())}function i$(n){if(typeof It.getReadableState!="function")return lp(zc(n));try{return iw(It.getReadableState(),e=>tv(n,e.userPreferences?.shortcutOverrides??{}))}catch{return lp(zc(n))}}function a_(n,e){return n?.isExternalLink===!0&&typeof n.workspaceId=="string"&&n.workspaceId?n.workspaceId:e||void 0}function hv(n,e,t){const r=n.label||n.id||"mention";if(n.type==="member")return Of(r);if(n.type==="note"&&n.id&&t){const s=a_(n.meta,e),i=s?t(s,n.id)?.trim():void 0;if(i)return i}return r}function o$(n,e,t){if(typeof document>"u"||!n.includes('data-type="note"'))return n;const r=document.createElement("template");r.innerHTML=n;let s=!1;for(const i of r.content.querySelectorAll('[data-mention][data-type="note"]')){let o=null;try{o=JSON.parse(i.getAttribute("data-meta")||"{}")}catch{o=null}const a=i.textContent??"",c=hv({type:"note",id:i.getAttribute("data-id"),label:a,meta:o},e,t);c!==a&&(i.textContent=c,s=!0)}return s?r.innerHTML:n}const l_=(n,e)=>{let t;try{t=dk().state}catch{return}const r=t?.workspaceNotes?.byWorkspaceId?.[n]?.notes;return r?kx(r,e)?.title:void 0};var c_=N('<p class="mt-2 max-w-[90vw] rounded-md bg-black/60 px-3 py-1.5 text-center text-sm text-white"> </p>'),u_=N('<div data-media-lightbox-root="" data-image-lightbox-root="" class="fixed inset-0 z-[1000] flex cursor-zoom-out flex-col items-center justify-center bg-black/80 p-4 backdrop-blur-sm" style="pointer-events: auto;" role="dialog" aria-modal="true" tabindex="-1"><div class="absolute right-4 top-4 z-[1002] flex items-center gap-1"><!> <!></div> <div class="flex min-h-0 w-full flex-1 items-center justify-center"><!></div> <!></div>');function rh(n,e){if(new.target)return Nt({component:rh,...n});Lt(e,!0);let t=y(e,"open",15,!1),r=y(e,"ariaLabel",7),s=y(e,"closeLabel",7),i=y(e,"onClose",7),o=y(e,"openerElement",7,null),a=y(e,"children",7),c=y(e,"actions",7),u=y(e,"caption",7),d=y(e,"onKeydown",7),f=y(e,"onCopy",7);const h=qm(),p=gx(m);let g=fe(null),v=fe(null);function m(){t()&&(t(!1),i()?.(),o()?.isConnected&&o().focus({preventScroll:!0}))}function S(E){(E.target instanceof Element?E.target:null)?.closest('[data-media-lightbox-content], [role="toolbar"], button, input')||m()}function I(E){if(d()?.(E),E.defaultPrevented||E.key!=="Tab"||!l(g))return;const z=Array.from(l(g).querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),G=z[0],J=z[z.length-1];!G||!J||(E.shiftKey&&document.activeElement===G?(E.preventDefault(),J.focus()):!E.shiftKey&&document.activeElement===J&&(E.preventDefault(),G.focus()))}ft(()=>{if(t())return ja(m)}),ft(()=>{!t()||!l(v)||requestAnimationFrame(()=>l(v)?.focus())});var C={get open(){return t()},set open(E=!1){t(E),b()},get ariaLabel(){return r()},set ariaLabel(E){r(E),b()},get closeLabel(){return s()},set closeLabel(E){s(E),b()},get onClose(){return i()},set onClose(E){i(E),b()},get openerElement(){return o()},set openerElement(E=null){o(E),b()},get children(){return a()},set children(E){a(E),b()},get actions(){return c()},set actions(E){c(E),b()},get caption(){return u()},set caption(E){u(E),b()},get onKeydown(){return d()},set onKeydown(E){d(E),b()},get onCopy(){return f()},set onCopy(E){f(E),b()},$set:Dt,$on:(E,z)=>$t(e,E,z)},M=Je(),O=ce(M);{var P=E=>{{let z=w(()=>h?.target()??"body");ix(E,{get target(){return l(z)},zIndex:1e3,children:(G,J)=>{var K=u_(),Y=te(K),$=te(Y);{var X=ne=>{var we=Je(),be=ce(we);On(be,c),k(ne,we)};V($,ne=>{c()&&ne(X)})}var de=R($,2);Ze(de,{variant:"ghost",size:"icon",class:"text-white hover:bg-white/20 hover:text-white",onclick:m,get"aria-label"(){return s()},get ref(){return l(v)},set ref(ne){x(v,ne,!0)},children:(ne,we)=>{ut(ne,{get icon(){return Fi},size:"lg"})},$$slots:{default:!0}}),Q(Y),Pl(Y,ne=>p?.(ne));var me=R(Y,2),ie=te(me);On(ie,a),Q(me),Pl(me,ne=>p?.(ne));var q=R(me,2);{var j=ne=>{var we=c_(),be=re(we,!0);L(()=>B(be,u())),k(ne,we)};V(q,ne=>{u()&&ne(j)})}Q(K),Yn(K,ne=>x(g,ne),()=>l(g)),L(()=>xt(K,"aria-label",r())),Kr("click",K,S),Kr("keydown",K,I),xo("copy",K,function(...ne){f()?.apply(this,ne)}),Ss(3,K,()=>yw,()=>({tier:"moderate"})),k(G,K)},$$slots:{default:!0}})}};V(O,E=>{t()&&E(P)})}return k(n,M),Ot(C)}So(["click","keydown"]);function Au(n){if(!n.startsWith("workspace-file://"))return null;const t=n.slice(17).split(/[?#]/)[0].split("/"),r=t[0],s=t.slice(1);if(!r||s.length===0)return null;const i=[];for(const o of s){if(!o)return null;try{i.push(decodeURIComponent(o))}catch{return null}}return{workspaceId:r,path:i.join("/")}}function pv(n){try{return new URL(n).protocol==="https:"}catch{return!1}}function Xd(n){const e=/^data:([^;,]+);base64,(.*)$/s.exec(n);return e?{mimeType:e[1],base64:e[2]}:null}function Yd(n){return pv(n)||Au(n)!==null||/^workspace-asset:\/\/[^/?#]+/.test(n)||/^data:image\/[a-z0-9.+-]+(?:;[^,]*)?,/i.test(n)}function gv(n){if(n.length===0)return 0;let e=0;return n.endsWith("==")?e=2:n.endsWith("=")&&(e=1),Math.floor(n.length*3/4)-e}function d_(n,e){const t=atob(n),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return new Blob([r],{type:e})}const f_={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};function h_(n){if(n.workspacePath){const s=n.workspacePath.split("/").pop();if(s)return s}const e=(n.imageName||"image").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(e))return e;const t=n.mimeType?.split(";")[0].trim().toLowerCase(),r=t&&f_[t]||"png";return`${e}.${r}`}var p_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-dimensions"> </div>'),g_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-size"> </div>'),m_=N("<!> <!> <!>",1),v_=N("<!> <!> <!> <!>",1),b_=N("<!> <!>",1);function mv(n,e){if(new.target)return Nt({component:mv,...n});Lt(e,!0);let t=y(e,"imageUrl",7),r=y(e,"imageName",7),s=y(e,"open",15,!1),i=y(e,"triggerClass",7),o=y(e,"contentClass",7);const a=w(()=>Xd(t())),c=w(()=>Au(t())),u=w(()=>pv(t()));let d=fe(null),f=fe(null),h=null;function p(){if(h===t())return;const J=h=t();x(d,null),x(f,l(a)?gv(l(a).base64):null,!0);const K=new Image;K.onload=()=>{h===J&&x(d,{width:K.naturalWidth,height:K.naturalHeight},!0)},K.src=t(),l(a)||fetch(t()).then(Y=>Y.ok?Y.blob():null).then(Y=>{Y&&h===J&&x(f,Y.size,!0)}).catch(()=>{})}ft(()=>{s()&&p()}),ft(()=>{if(s())return ja(()=>{s(!1)})});async function g(J=t()){const K=Xd(J);if(K)return d_(K.base64,K.mimeType);const Y=await fetch(J);if(!Y.ok)throw new Error(`Image fetch failed: ${Y.status}`);return await Y.blob()}async function v(){let J=null;try{let K=t(),Y=l(a)?.mimeType;if(!l(a)){const X=await g();Y=X.type,J=URL.createObjectURL(X),K=J}const $=document.createElement("a");$.href=K,$.download=h_({workspacePath:l(c)?.path,imageName:r(),mimeType:Y}),document.body.appendChild($);try{$.click()}finally{$.remove()}}catch{_s.error(_.ui_imageActionsMenu_downloadFailed_error())}finally{J&&URL.revokeObjectURL(J)}}async function m(){if(l(c))try{await Bc(l(c).path),_s.success(_.ui_imageActionsMenu_pathCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}async function S(){if(l(u))try{await Bc(t()),_s.success(_.ui_imageActionsMenu_linkCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}async function I(J){let K,Y;try{let $;if(J.type.split(";")[0].trim()==="image/svg+xml"){Y=URL.createObjectURL(J);const me=new Image;me.src=Y,await me.decode(),$=me}else $=K=await createImageBitmap(J);const X=document.createElement("canvas");X.width=$ instanceof HTMLImageElement?$.naturalWidth:$.width,X.height=$ instanceof HTMLImageElement?$.naturalHeight:$.height;const de=X.getContext("2d");if(!de)throw new Error("2d canvas context unavailable");return de.drawImage($,0,0),await new Promise((me,ie)=>{X.toBlob(q=>q?me(q):ie(new Error("canvas toBlob failed")),"image/png")})}finally{K?.close(),Y&&URL.revokeObjectURL(Y)}}async function C(J=t()){try{let K=await g(J);K.type!=="image/png"&&(K=await I(K)),await navigator.clipboard.write([new ClipboardItem({"image/png":K})]),_s.success(_.ui_imageActionsMenu_imageCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}function M(J,K=t()){return J.defaultPrevented||!Yd(K)||J instanceof KeyboardEvent&&(J.key.toLowerCase()!=="c"||!(J.metaKey||J.ctrlKey)||J.altKey||J.shiftKey||J.isComposing)||Jm(J.target)||document.getSelection()?.toString()?!1:(J.preventDefault(),J.stopPropagation(),J instanceof KeyboardEvent&&J.repeat||(C(K),s(!1)),!0)}var O={handleCopy:M,get imageUrl(){return t()},set imageUrl(J){t(J),b()},get imageName(){return r()},set imageName(J){r(J),b()},get open(){return s()},set open(J=!1){s(J),b()},get triggerClass(){return i()},set triggerClass(J){i(J),b()},get contentClass(){return o()},set contentClass(J){o(J),b()},$set:Dt,$on:(J,K)=>$t(e,J,K)},P=Je(),E=ce(P);{var z=J=>{var K=Je(),Y=ce(K);Rt(Y,()=>Wf,($,X)=>{X($,{get open(){return s()},set open(de){s(de)},children:(de,me)=>{var ie=b_(),q=ce(ie);{const ne=(be,Se)=>{let se=()=>(Se?.()).props;{let oe=w(()=>_.ui_imageActionsMenu_trigger_ariaLabel());Ze(be,us(se,{variant:"plain",size:"icon-sm",wrapContent:!1,get active(){return s()},get"aria-label"(){return l(oe)},children:(H,W)=>{Km(H,{class:"size-3.5"})},$$slots:{default:!0}}))}};let we=w(()=>br("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",i()));Rt(q,()=>Uf,(be,Se)=>{Se(be,{get class(){return l(we)},onclick:se=>se.stopPropagation(),onkeydown:se=>M(se),oncopy:se=>M(se),child:ne,$$slots:{child:!0}})})}var j=R(q,2);Rt(j,()=>Vf,(ne,we)=>{we(ne,{get class(){return o()},align:"end",onkeydown:be=>M(be),oncopy:be=>M(be),children:(be,Se)=>{var se=v_(),oe=ce(se);Rt(oe,()=>Ho,(pe,ke)=>{ke(pe,{onSelect:()=>void v(),children:(ye,Z)=>{Ht();var $e=Vt();L(lt=>B($e,lt),[()=>_.ui_imageActionsMenu_download_label()]),k(ye,$e)},$$slots:{default:!0}})});var H=R(oe,2);Rt(H,()=>Ho,(pe,ke)=>{ke(pe,{onSelect:()=>void C(),children:(ye,Z)=>{Ht();var $e=Vt();L(lt=>B($e,lt),[()=>_.ui_imageActionsMenu_copyImage_label()]),k(ye,$e)},$$slots:{default:!0}})});var W=R(H,2);{var D=pe=>{var ke=Je(),ye=ce(ke);Rt(ye,()=>Ho,(Z,$e)=>{$e(Z,{onSelect:()=>void m(),children:(lt,St)=>{Ht();var De=Vt();L(Le=>B(De,Le),[()=>_.ui_imageActionsMenu_copyPath_label()]),k(lt,De)},$$slots:{default:!0}})}),k(pe,ke)},ae=pe=>{var ke=Je(),ye=ce(ke);Rt(ye,()=>Ho,(Z,$e)=>{$e(Z,{onSelect:()=>void S(),children:(lt,St)=>{Ht();var De=Vt();L(Le=>B(De,Le),[()=>_.ui_imageActionsMenu_copyLink_label()]),k(lt,De)},$$slots:{default:!0}})}),k(pe,ke)};V(W,pe=>{l(c)?pe(D):l(u)&&pe(ae,1)})}var ge=R(W,2);{var ue=pe=>{var ke=m_(),ye=ce(ke);Rt(ye,()=>jm,(De,Le)=>{Le(De,{})});var Z=R(ye,2);{var $e=De=>{var Le=p_(),Ye=re(Le,!0);L(Ct=>B(Ye,Ct),[()=>_.ui_imageActionsMenu_dimensions_label({width:as(l(d).width),height:as(l(d).height)})]),k(De,Le)};V(Z,De=>{l(d)&&De($e)})}var lt=R(Z,2);{var St=De=>{var Le=g_(),Ye=re(Le,!0);L(Ct=>B(Ye,Ct),[()=>Im(l(f))]),k(De,Le)};V(lt,De=>{l(f)!==null&&De(St)})}k(pe,ke)};V(ge,pe=>{(l(d)||l(f)!==null)&&pe(ue)})}k(be,se)},$$slots:{default:!0}})}),k(de,ie)},$$slots:{default:!0}})}),k(J,K)},G=w(()=>Yd(t()));V(E,J=>{l(G)&&J(z)})}return k(n,P),Ot(O)}var y_=N('<div role="application" tabindex="0" data-testid="zoom-pan-viewport"><div class="flex h-full w-full items-center justify-center will-change-transform" data-testid="zoom-pan-content"><!></div> <div class="absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 cursor-default items-center gap-2 rounded-full bg-black/60 px-3 py-1.5 backdrop-blur-sm" role="toolbar" tabindex="-1" data-testid="zoom-pan-controls"><!> <div class="w-36"><!></div> <!> <span class="min-w-12 text-center text-xs tabular-nums text-white/90" data-testid="zoom-pan-percent"> </span> <!></div></div>');function vv(n,e){if(new.target)return Nt({component:vv,...n});Lt(e,!0);let t=y(e,"children",7),r=y(e,"minZoom",7,.25),s=y(e,"maxZoom",7,8),i=y(e,"onScaleChange",7);const o=1.25,a=.0015,c=.01,u=4;let d=fe(1),f=fe(0),h=fe(0),p=fe(!1),g=fe(null);ft(()=>{i()?.(l(d))});let v=null,m=0,S=0,I=0,C=!1;const M=w(()=>Lm(l(d),{style:"percent",maximumFractionDigits:0}));function O(D){return Math.min(s(),Math.max(r(),D))}function P(D,ae,ge){const ue=O(ge),pe=l(g)?.getBoundingClientRect(),ke=pe?D-pe.left:0,ye=pe?ae-pe.top:0;x(f,ke-(ke-l(f))/l(d)*ue),x(h,ye-(ye-l(h))/l(d)*ue),x(d,ue,!0)}function E(D){const ae=l(g)?.getBoundingClientRect();ae?P(ae.left+ae.width/2,ae.top+ae.height/2,D):x(d,O(D),!0)}function z(){x(d,1),x(f,0),x(h,0)}function G(D){D.preventDefault();const ae=D.ctrlKey?c:a;P(D.clientX,D.clientY,l(d)*Math.exp(-D.deltaY*ae))}ft(()=>{const D=l(g);if(D)return D.addEventListener("wheel",G,{passive:!1}),()=>D.removeEventListener("wheel",G)});function J(D){if(D.metaKey||D.ctrlKey||D.altKey)return!1;if(D.key==="+"||D.key==="=")E(l(d)*o);else if(D.key==="-")E(l(d)/o);else if(D.key==="0")z();else return!1;return D.preventDefault(),!0}function K(D){if(D.button>0)return;x(p,!0),v=D.pointerId,m=D.clientX,S=D.clientY,I=0;const ae=D.currentTarget;typeof ae.setPointerCapture=="function"&&ae.setPointerCapture(D.pointerId)}function Y(D){if(!l(p)||D.pointerId!==v)return;const ae=D.clientX-m,ge=D.clientY-S;I+=Math.abs(ae)+Math.abs(ge),x(f,l(f)+ae),x(h,l(h)+ge),m=D.clientX,S=D.clientY}function $(D){if(!l(p)||D.pointerId!==v)return;x(p,!1),v=null,I>u&&(C=!0);const ae=D.currentTarget;typeof ae.hasPointerCapture=="function"&&typeof ae.releasePointerCapture=="function"&&ae.hasPointerCapture(D.pointerId)&&ae.releasePointerCapture(D.pointerId)}function X(D){C&&(C=!1,D.preventDefault(),D.stopPropagation())}function de(D){const ae=Number.parseFloat(D.currentTarget.value);Number.isFinite(ae)&&E(ae)}var me={handleKeydown:J,get children(){return t()},set children(D){t(D),b()},get minZoom(){return r()},set minZoom(D=.25){r(D),b()},get maxZoom(){return s()},set maxZoom(D=8){s(D),b()},get onScaleChange(){return i()},set onScaleChange(D){i(D),b()},$set:Dt,$on:(D,ae)=>$t(e,D,ae)},ie=y_(),q=te(ie),j=te(q);On(j,t),Q(q);var ne=R(q,2),we=te(ne);{let D=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel());Ze(we,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>E(l(d)/o),get"aria-label"(){return l(D)},get title(){return l(ae)},children:(ge,ue)=>{ut(ge,{get icon(){return Tw}})},$$slots:{default:!0}})}var be=R(we,2),Se=te(be);{let D=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel());ox(Se,{class:"accent-white",get min(){return r()},get max(){return s()},step:"0.01",get value(){return l(d)},oninput:de,get"aria-label"(){return l(D)},get title(){return l(ae)},"data-testid":"zoom-pan-slider"})}Q(be);var se=R(be,2);{let D=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel());Ze(se,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>E(l(d)*o),get"aria-label"(){return l(D)},get title(){return l(ae)},children:(ge,ue)=>{ut(ge,{get icon(){return Ew}})},$$slots:{default:!0}})}var oe=R(se,2),H=re(oe,!0),W=R(oe,2);{let D=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel()),ae=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel());Ze(W,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:z,get"aria-label"(){return l(D)},get title(){return l(ae)},children:(ge,ue)=>{ut(ge,{get icon(){return Aw}})},$$slots:{default:!0}})}return Q(ne),Q(ie),Yn(ie,D=>x(g,D),()=>l(g)),L((D,ae)=>{wt(ie,1,`relative h-full w-full touch-none select-none overflow-hidden ${l(p)?"cursor-grabbing":"cursor-grab"}`),xt(ie,"aria-label",D),Hi(q,`transform: translate(${l(f)??""}px, ${l(h)??""}px) scale(${l(d)??""}); transform-origin: 0 0;`),xt(ne,"aria-label",ae),B(H,l(M))},[()=>_.ui_zoomPanViewport_viewport_ariaLabel(),()=>_.ui_zoomPanViewport_controls_ariaLabel()]),Kr("pointerdown",ie,K),Kr("pointermove",ie,Y),Kr("pointerup",ie,$),xo("pointercancel",ie,$),xo("click",ie,X,!0),Kr("keydown",ie,J),Kr("pointerdown",ne,D=>D.stopPropagation()),k(n,ie),Ot(me)}So(["pointerdown","pointermove","pointerup","keydown"]);var w_=N('<img class="max-h-[90vh] max-w-[90vw] rounded-lg object-contain" draggable="false" data-media-lightbox-content=""/>');function bv(n,e){if(new.target)return Nt({component:bv,...n});Lt(e,!0);const t=m=>{var S=Je(),I=ce(S);{var C=M=>{Yn(mv(M,{get imageUrl(){return s()},get imageName(){return i()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]",get open(){return l(f)},set open(O){x(f,O,!0)}}),O=>x(d,O,!0),()=>l(d))};V(I,M=>{c()&&M(C)})}k(m,S)};let r=y(e,"open",15,!1),s=y(e,"imageUrl",7),i=y(e,"imageName",23,()=>_.ui_imageLightbox_image_alt()),o=y(e,"onClose",7),a=y(e,"openerElement",7,null),c=y(e,"showActionsMenu",7,!1),u=fe(void 0),d=fe(void 0),f=fe(!1);ft(()=>{r()||x(f,!1)});function h(m){p(m),m.defaultPrevented||l(u)?.handleKeydown(m)}function p(m){r()&&c()&&l(d)?.handleCopy(m)}function g(m){!c()||!Yd(s())||(m.preventDefault(),m.stopPropagation(),x(f,!0))}var v={get open(){return r()},set open(m=!1){r(m),b()},get imageUrl(){return s()},set imageUrl(m){s(m),b()},get imageName(){return i()},set imageName(m=_.ui_imageLightbox_image_alt()){i(m),b()},get onClose(){return o()},set onClose(m){o(m),b()},get openerElement(){return a()},set openerElement(m=null){a(m),b()},get showActionsMenu(){return c()},set showActionsMenu(m=!1){c(m),b()},$set:Dt,$on:(m,S)=>$t(e,m,S)};{let m=w(()=>_.ui_imageLightbox_preview_ariaLabel()),S=w(()=>_.ui_imageLightbox_close_ariaLabel());rh(n,{get ariaLabel(){return l(m)},get closeLabel(){return l(S)},get onClose(){return o()},get openerElement(){return a()},get actions(){return t},onKeydown:h,onCopy:p,get open(){return r()},set open(I){r(I)},children:(I,C)=>{var M=Je(),O=ce(M);Yf(O,s,P=>{Yn(vv(P,{children:(E,z)=>{var G=w_();L(()=>{xt(G,"src",s()),xt(G,"alt",i())}),Kr("contextmenu",G,g),k(E,G)},$$slots:{default:!0}}),E=>x(u,E,!0),()=>l(u))}),k(I,M)},$$slots:{default:!0}})}return Ot(v)}So(["contextmenu"]);var x_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-duration"> </div>'),k_=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-dimensions"> </div>'),__=N('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-size"> </div>'),S_=N("<!> <!> <!> <!>",1),C_=N("<!> <!> <!>",1),M_=N("<!> <!>",1);function Fc(n,e){if(new.target)return Nt({component:Fc,...n});Lt(e,!0);let t=y(e,"videoUrl",7),r=y(e,"videoName",7),s=y(e,"sourceKind",7),i=y(e,"mimeType",7),o=y(e,"open",15,!1),a=y(e,"triggerClass",7),c=y(e,"contentClass",7);const u=w(()=>Xd(t())),d=w(()=>Au(t())),f=w(()=>s()??(l(u)?"inline":l(d)?"workspace":"remote"));let h=fe(null),p=fe(null),g=fe(null),v=null;function m(){if(v===t())return;const E=v=t();x(h,null),x(p,null),x(g,l(u)?gv(l(u).base64):null,!0);const z=document.createElement("video");z.preload="metadata",z.onloadedmetadata=()=>{v===E&&(Number.isFinite(z.duration)&&z.duration>0&&x(h,z.duration,!0),z.videoWidth>0&&z.videoHeight>0&&x(p,{width:z.videoWidth,height:z.videoHeight},!0))},z.src=t(),l(u)||fetch(t()).then(G=>G.ok?G.blob():null).then(G=>{G&&v===E&&x(g,G.size,!0)}).catch(()=>{})}function S(){const E=l(d)?.path.split("/").pop();if(E)return E;const z=(r()||"video").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(z))return z;const G=(i()??l(u)?.mimeType)==="video/webm"?"webm":"mp4";return`${z}.${G}`}async function I(){let E=null;try{let z=t();if(!l(u)){const J=await fetch(t());if(!J.ok)throw new Error(`Video fetch failed: ${J.status}`);E=URL.createObjectURL(await J.blob()),z=E}const G=document.createElement("a");G.href=z,G.download=S(),document.body.appendChild(G),G.click(),G.remove(),E&&URL.revokeObjectURL(E)}catch{E&&URL.revokeObjectURL(E),_s.error(_.ui_videoActionsMenu_downloadFailed_error())}}async function C(E,z){try{await Bc(E),_s.success(z)}catch{_s.error(_.ui_videoActionsMenu_copyFailed_error())}}ft(()=>{o()&&m()}),ft(()=>{if(o())return ja(()=>{o(!1)})});var M={get videoUrl(){return t()},set videoUrl(E){t(E),b()},get videoName(){return r()},set videoName(E){r(E),b()},get sourceKind(){return s()},set sourceKind(E){s(E),b()},get mimeType(){return i()},set mimeType(E){i(E),b()},get open(){return o()},set open(E=!1){o(E),b()},get triggerClass(){return a()},set triggerClass(E){a(E),b()},get contentClass(){return c()},set contentClass(E){c(E),b()},$set:Dt,$on:(E,z)=>$t(e,E,z)},O=Je(),P=ce(O);return Rt(P,()=>Wf,(E,z)=>{z(E,{get open(){return o()},set open(G){o(G)},children:(G,J)=>{var K=M_(),Y=ce(K);{let X=w(()=>br("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",a())),de=w(()=>_.ui_videoActionsMenu_trigger_ariaLabel());Rt(Y,()=>Uf,(me,ie)=>{ie(me,{get class(){return l(X)},get"aria-label"(){return l(de)},onclick:q=>q.stopPropagation(),children:(q,j)=>{Km(q,{class:"size-3.5"})},$$slots:{default:!0}})})}var $=R(Y,2);Rt($,()=>Vf,(X,de)=>{de(X,{get class(){return c()},align:"end",children:(me,ie)=>{var q=C_(),j=ce(q);Rt(j,()=>Ho,(oe,H)=>{H(oe,{onSelect:()=>void I(),children:(W,D)=>{Ht();var ae=Vt();L(ge=>B(ae,ge),[()=>_.ui_videoActionsMenu_download_label()]),k(W,ae)},$$slots:{default:!0}})});var ne=R(j,2);{var we=oe=>{var H=Je(),W=ce(H);Rt(W,()=>Ho,(D,ae)=>{ae(D,{onSelect:()=>void C(l(d).path,_.ui_videoActionsMenu_pathCopied_label()),children:(ge,ue)=>{Ht();var pe=Vt();L(ke=>B(pe,ke),[()=>_.ui_videoActionsMenu_copyPath_label()]),k(ge,pe)},$$slots:{default:!0}})}),k(oe,H)},be=oe=>{var H=Je(),W=ce(H);Rt(W,()=>Ho,(D,ae)=>{ae(D,{onSelect:()=>void C(t(),_.ui_videoActionsMenu_linkCopied_label()),children:(ge,ue)=>{Ht();var pe=Vt();L(ke=>B(pe,ke),[()=>_.ui_videoActionsMenu_copyLink_label()]),k(ge,pe)},$$slots:{default:!0}})}),k(oe,H)};V(ne,oe=>{l(f)==="workspace"&&l(d)?oe(we):l(f)==="remote"&&oe(be,1)})}var Se=R(ne,2);{var se=oe=>{var H=S_(),W=ce(H);Rt(W,()=>jm,(ye,Z)=>{Z(ye,{})});var D=R(W,2);{var ae=ye=>{var Z=x_(),$e=re(Z,!0);L(lt=>B($e,lt),[()=>_.ui_videoActionsMenu_duration_label({duration:ww(l(h)*1e3)})]),k(ye,Z)};V(D,ye=>{l(h)!==null&&ye(ae)})}var ge=R(D,2);{var ue=ye=>{var Z=k_(),$e=re(Z,!0);L(lt=>B($e,lt),[()=>_.ui_videoActionsMenu_dimensions_label({width:as(l(p).width),height:as(l(p).height)})]),k(ye,Z)};V(ge,ye=>{l(p)&&ye(ue)})}var pe=R(ge,2);{var ke=ye=>{var Z=__(),$e=re(Z,!0);L(lt=>B($e,lt),[()=>Im(l(g))]),k(ye,Z)};V(pe,ye=>{l(g)!==null&&ye(ke)})}k(oe,H)};V(Se,oe=>{(l(h)!==null||l(p)||l(g)!==null)&&oe(se)})}k(me,q)},$$slots:{default:!0}})}),k(G,K)},$$slots:{default:!0}})}),k(n,O),Ot(M)}var T_=N('<p class="type-body text-white/80" role="status"> </p>'),E_=N('<div data-media-lightbox-content="" data-video-lightbox-root="" class="flex max-h-[90vh] max-w-[90vw] cursor-default flex-col items-center gap-3"><video controls="" preload="metadata" playsinline="" class="max-h-[85vh] max-w-[90vw] rounded-lg bg-black object-contain shadow-(--elevation-overlay)" data-testid="chat-video-player"> </video> <!></div>',2);function yv(n,e){if(new.target)return Nt({component:yv,...n});Lt(e,!0);const t=p=>{Fc(p,{get videoUrl(){return s()},get videoName(){return i()},get sourceKind(){return a()},get mimeType(){return c()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]"})};let r=y(e,"open",15,!1),s=y(e,"videoUrl",7),i=y(e,"videoName",23,()=>_.chat_videoBlock_fromAgent_label()),o=y(e,"poster",7),a=y(e,"sourceKind",7),c=y(e,"mimeType",7),u=y(e,"openerElement",7,null),d=y(e,"onClose",7),f=fe(!1);ft(()=>{!r()||!s()||x(f,!1)});var h={get open(){return r()},set open(p=!1){r(p),b()},get videoUrl(){return s()},set videoUrl(p){s(p),b()},get videoName(){return i()},set videoName(p=_.chat_videoBlock_fromAgent_label()){i(p),b()},get poster(){return o()},set poster(p){o(p),b()},get sourceKind(){return a()},set sourceKind(p){a(p),b()},get mimeType(){return c()},set mimeType(p){c(p),b()},get openerElement(){return u()},set openerElement(p=null){u(p),b()},get onClose(){return d()},set onClose(p){d(p),b()},$set:Dt,$on:(p,g)=>$t(e,p,g)};{let p=w(()=>_.chat_videoBlock_dialog_title({name:i()})),g=w(()=>_.chat_videoBlock_close_ariaLabel());rh(n,{get ariaLabel(){return l(p)},get closeLabel(){return l(g)},get openerElement(){return u()},get onClose(){return d()},get actions(){return t},get open(){return r()},set open(v){r(v)},children:(v,m)=>{var S=E_(),I=te(S),C=re(I,!0),M=R(I,2);{var O=P=>{var E=T_(),z=re(E,!0);L(G=>B(z,G),[()=>_.chat_videoBlock_unavailable_description()]),k(P,E)};V(M,P=>{l(f)&&P(O)})}Q(S),L(P=>{xt(I,"src",s()),xt(I,"poster",o()),xt(I,"aria-label",i()),B(C,P)},[()=>_.chat_videoBlock_unsupported_description()]),xo("error",I,()=>x(f,!0)),k(v,S)},$$slots:{default:!0}})}return Ot(h)}var A_=N('<span class="block truncate text-foreground"> </span>'),R_=N("<!> ",1),P_=N("<!> <!>",1),I_=N('<span class="flex shrink-0 flex-wrap items-center gap-1"><!> <!></span>'),L_=N('<div class="type-caption flex w-fit min-w-0 max-w-full items-center gap-3 whitespace-normal py-1 text-muted-foreground" role="status" data-testid="media-unavailable"><span class="flex min-w-0 max-w-full flex-1 items-start gap-2"><span class="first-line-icon" aria-hidden="true"><!></span> <span class="min-w-0"><!> <span class="block break-words"> </span></span></span> <!></div>');function wv(n,e){if(new.target)return Nt({component:wv,...n});Lt(e,!0);let t=y(e,"name",7),r=y(e,"reason",7),s=y(e,"path",7),i=y(e,"workspaceId",7),o=y(e,"onRetry",7);const a=w(()=>r()==="missing"?_.ui_mediaUnavailable_missing_description():r()==="unsupported"?_.ui_mediaUnavailable_unsupported_description():r()==="other-workspace"?_.ui_mediaUnavailable_otherWorkspace_description():r()==="invalid-link"?_.ui_mediaUnavailable_invalidLink_description():_.ui_mediaUnavailable_loadFailed_description());function c(z){z.preventDefault(),z.stopPropagation()}function u(z){c(z),o()?.()}async function d(z){if(c(z),!!s())try{await Bc(s()),_s.success(_.ui_imageActionsMenu_pathCopied_label())}catch{_s.error(_.ui_imageActionsMenu_copyFailed_error())}}function f(z){if(c(z),!s()||!i())return;const G=s().split("/").map(encodeURIComponent).join("/");jf(`intent://local/file/${G}`,{workspaceId:Xm(i())})}var h={get name(){return t()},set name(z){t(z),b()},get reason(){return r()},set reason(z){r(z),b()},get path(){return s()},set path(z){s(z),b()},get workspaceId(){return i()},set workspaceId(z){i(z),b()},get onRetry(){return o()},set onRetry(z){o(z),b()},$set:Dt,$on:(z,G)=>$t(e,z,G)},p=L_(),g=te(p),v=te(g),m=te(v);ut(m,{get icon(){return Dc},class:"size-3.5"}),Q(v);var S=R(v,2),I=te(S);{var C=z=>{var G=A_(),J=re(G,!0);Pl(G,(K,Y)=>jd?.(K,Y),t),L(()=>B(J,t())),k(z,G)};V(I,z=>{t()&&z(C)})}var M=R(I,2),O=re(M,!0);Q(S),Q(g);var P=R(g,2);{var E=z=>{var G=I_(),J=te(G);{var K=X=>{{let de=w(()=>_.chat_shared_retry_label());Ze(X,{variant:"ghost",size:"icon-compact",get tooltip(){return l(de)},onclick:u,children:(me,ie)=>{ut(me,{get icon(){return Bf},size:"xs"})},$$slots:{default:!0}})}};V(J,X=>{o()&&X(K)})}var Y=R(J,2);{var $=X=>{var de=P_(),me=ce(de);{var ie=j=>{Ze(j,{variant:"ghost",size:"compact",onclick:f,children:(ne,we)=>{var be=R_(),Se=ce(be);ut(Se,{get icon(){return Dm},size:"xs"});var se=R(Se);L(oe=>B(se,` ${oe??""}`),[()=>_.chat_changesPanel_openFile_tooltip()]),k(ne,be)},$$slots:{default:!0}})};V(me,j=>{i()&&r()!=="other-workspace"&&r()!=="invalid-link"&&j(ie)})}var q=R(me,2);{let j=w(()=>_.ui_imageActionsMenu_copyPath_label());Ze(q,{variant:"ghost",size:"icon-compact",get tooltip(){return l(j)},onclick:d,children:(ne,we)=>{ut(ne,{get icon(){return Nm},size:"xs"})},$$slots:{default:!0}})}k(X,de)};V(Y,X=>{s()&&X($)})}Q(G),k(z,G)};V(P,z=>{(o()||s())&&z(E)})}return Q(p),L(()=>{xt(p,"data-reason",r()),B(O,l(a))}),k(n,p),Ot(h)}const a$=It.createSelector(n=>n.featureCodes.activeFeatures),O_=It.createSelector((n,e)=>n.featureCodes.activeFeatures.includes(e)),l$=It.createSelector(n=>n.featureCodes.activeFeatures.length>0),c$=It.createSelector(n=>n.featureCodes.dialogOpen);var N_=N("<span> </span>"),D_=N('<div role="search"><div><!> <!> <!></div> <div><!> <!> <!></div></div>');function $_(n,e){if(new.target)return Nt({component:$_,...n});Lt(e,!0);let t=y(e,"query",15,""),r=y(e,"inputRef",15,null),s=y(e,"placeholder",23,()=>_.ui_panelFindBar_find_placeholder()),i=y(e,"disabled",7,!1),o=y(e,"inputDisabled",7,!1),a=y(e,"navigationDisabled",7,!1),c=y(e,"closeDisabled",7,!1),u=y(e,"disableNavigationWhenNoMatches",7,!0),d=y(e,"autofocus",7,!1),f=y(e,"selectOnFocus",7,!0),h=y(e,"focusTrigger",7),p=y(e,"currentMatchIndex",7,0),g=y(e,"totalMatches",7),v=y(e,"resultText",7,void 0),m=y(e,"emptyResultText",23,()=>_.ui_panelFindBar_noMatches_label()),S=y(e,"showResultText",7,!0),I=y(e,"showResultWhenQueryEmpty",7,!1),C=y(e,"resultFormat",7,"slash"),M=y(e,"resultVariant",7,void 0),O=y(e,"searchAriaLabel",23,()=>_.ui_panelFindBar_search_ariaLabel()),P=y(e,"previousLabel",23,()=>_.ui_panelFindBar_previous_label()),E=y(e,"previousShortcutLabel",7,"Shift+Enter"),z=y(e,"previousKeyShortcuts",7,"Shift+Enter"),G=y(e,"previousTitle",7,void 0),J=y(e,"nextLabel",23,()=>_.ui_panelFindBar_next_label()),K=y(e,"nextShortcutLabel",7,"Enter"),Y=y(e,"nextKeyShortcuts",7,"Enter"),$=y(e,"nextTitle",7,void 0),X=y(e,"closeLabel",23,()=>_.ui_panelFindBar_close_label()),de=y(e,"closeShortcutLabel",7,"Esc"),me=y(e,"closeKeyShortcuts",7,"Escape"),ie=y(e,"closeTitle",7,void 0),q=y(e,"layout",7,"floating"),j=y(e,"class",7),ne=y(e,"inputWrapperClass",7),we=y(e,"inputClass",7),be=y(e,"actionsClass",7),Se=y(e,"onPrevious",7),se=y(e,"onNext",7),oe=y(e,"onClose",7),H=y(e,"onQueryChange",7),W=y(e,"onInput",7),D=y(e,"onKeydown",7);const ae=w(()=>t().trim().length>0),ge=w(()=>i()||a()||!l(ae)||u()&&typeof g()=="number"&&g()<=0),ue=w(()=>{if(v()!==void 0)return v();if(!S()||!l(ae)&&!I()||typeof g()!="number")return null;if(g()<=0)return l(ae)?m():null;const ee=Math.min(Math.max(p()+1,1),g());return C()==="of"?_.ui_panelFindBar_matchOf_label({current:ee,total:g()}):`${ee} / ${g()}`}),pe=w(()=>M()??(typeof g()=="number"&&g()<=0&&l(ae)?"destructive":"muted"));ft(()=>{(d()||h()!==void 0)&&r()&&!i()&&!o()&&(r().focus(),f()&&r().select())});function ke(){r()?.focus()}function ye(){r()?.blur()}function Z(){r()?.select()}function $e(ee,Ge){return Ge?`${ee} (${Ge})`:ee}function lt(ee){t(ee.currentTarget.value),H()?.(t(),ee),W()?.(ee)}function St(ee){D()?.(ee),!ee.defaultPrevented&&(ee.key==="Escape"&&oe()&&!c()&&!i()?(ee.preventDefault(),oe()(ee)):ee.key==="Enter"&&!l(ge)&&(ee.preventDefault(),ee.shiftKey?Se()?.(t(),ee):se()?.(t(),ee)))}var De={focus:ke,blur:ye,select:Z,get query(){return t()},set query(ee=""){t(ee),b()},get inputRef(){return r()},set inputRef(ee=null){r(ee),b()},get placeholder(){return s()},set placeholder(ee=_.ui_panelFindBar_find_placeholder()){s(ee),b()},get disabled(){return i()},set disabled(ee=!1){i(ee),b()},get inputDisabled(){return o()},set inputDisabled(ee=!1){o(ee),b()},get navigationDisabled(){return a()},set navigationDisabled(ee=!1){a(ee),b()},get closeDisabled(){return c()},set closeDisabled(ee=!1){c(ee),b()},get disableNavigationWhenNoMatches(){return u()},set disableNavigationWhenNoMatches(ee=!0){u(ee),b()},get autofocus(){return d()},set autofocus(ee=!1){d(ee),b()},get selectOnFocus(){return f()},set selectOnFocus(ee=!0){f(ee),b()},get focusTrigger(){return h()},set focusTrigger(ee){h(ee),b()},get currentMatchIndex(){return p()},set currentMatchIndex(ee=0){p(ee),b()},get totalMatches(){return g()},set totalMatches(ee){g(ee),b()},get resultText(){return v()},set resultText(ee=void 0){v(ee),b()},get emptyResultText(){return m()},set emptyResultText(ee=_.ui_panelFindBar_noMatches_label()){m(ee),b()},get showResultText(){return S()},set showResultText(ee=!0){S(ee),b()},get showResultWhenQueryEmpty(){return I()},set showResultWhenQueryEmpty(ee=!1){I(ee),b()},get resultFormat(){return C()},set resultFormat(ee="slash"){C(ee),b()},get resultVariant(){return M()},set resultVariant(ee=void 0){M(ee),b()},get searchAriaLabel(){return O()},set searchAriaLabel(ee=_.ui_panelFindBar_search_ariaLabel()){O(ee),b()},get previousLabel(){return P()},set previousLabel(ee=_.ui_panelFindBar_previous_label()){P(ee),b()},get previousShortcutLabel(){return E()},set previousShortcutLabel(ee="Shift+Enter"){E(ee),b()},get previousKeyShortcuts(){return z()},set previousKeyShortcuts(ee="Shift+Enter"){z(ee),b()},get previousTitle(){return G()},set previousTitle(ee=void 0){G(ee),b()},get nextLabel(){return J()},set nextLabel(ee=_.ui_panelFindBar_next_label()){J(ee),b()},get nextShortcutLabel(){return K()},set nextShortcutLabel(ee="Enter"){K(ee),b()},get nextKeyShortcuts(){return Y()},set nextKeyShortcuts(ee="Enter"){Y(ee),b()},get nextTitle(){return $()},set nextTitle(ee=void 0){$(ee),b()},get closeLabel(){return X()},set closeLabel(ee=_.ui_panelFindBar_close_label()){X(ee),b()},get closeShortcutLabel(){return de()},set closeShortcutLabel(ee="Esc"){de(ee),b()},get closeKeyShortcuts(){return me()},set closeKeyShortcuts(ee="Escape"){me(ee),b()},get closeTitle(){return ie()},set closeTitle(ee=void 0){ie(ee),b()},get layout(){return q()},set layout(ee="floating"){q(ee),b()},get class(){return j()},set class(ee){j(ee),b()},get inputWrapperClass(){return ne()},set inputWrapperClass(ee){ne(ee),b()},get inputClass(){return we()},set inputClass(ee){we(ee),b()},get actionsClass(){return be()},set actionsClass(ee){be(ee),b()},get onPrevious(){return Se()},set onPrevious(ee){Se(ee),b()},get onNext(){return se()},set onNext(ee){se(ee),b()},get onClose(){return oe()},set onClose(ee){oe(ee),b()},get onQueryChange(){return H()},set onQueryChange(ee){H(ee),b()},get onInput(){return W()},set onInput(ee){W(ee),b()},get onKeydown(){return D()},set onKeydown(ee){D(ee),b()},$set:Dt,$on:(ee,Ge)=>$t(e,ee,Ge)},Le=D_(),Ye=te(Le),Ct=te(Ye);ut(Ct,{get icon(){return Rw},class:"size-3 shrink-0 text-muted-foreground"});var bt=R(Ct,2);{let ee=w(()=>i()||o()),Ge=w(()=>br("h-6 w-36 border-0 bg-transparent px-0 py-0 text-sm shadow-none","placeholder:text-muted-foreground",we()));Xr(bt,{type:"text",get placeholder(){return s()},get disabled(){return l(ee)},noFocusStyle:!0,get class(){return l(Ge)},get"aria-label"(){return O()},oninput:lt,onkeydown:St,get ref(){return r()},set ref(it){r(it)},get value(){return t()},set value(it){t(it)}})}var sn=R(bt,2);{var Be=ee=>{var Ge=N_(),it=re(Ge,!0);L(Xe=>{wt(Ge,1,Xe),B(it,l(ue))},[()=>Xn(br("whitespace-nowrap text-xs tabular-nums",l(pe)==="destructive"?"text-danger":"text-muted-foreground"))]),k(ee,Ge)};V(sn,ee=>{l(ue)&&ee(Be)})}Q(Ye);var he=R(Ye,2),Ne=te(he);{let ee=w(()=>G()??$e(P(),E()));Ze(Ne,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:Ge=>Se()?.(t(),Ge),get disabled(){return l(ge)},get"aria-label"(){return P()},get"aria-keyshortcuts"(){return z()},get title(){return l(ee)},children:(Ge,it)=>{ut(Ge,{get icon(){return Pw},class:"size-3"})},$$slots:{default:!0}})}var je=R(Ne,2);{let ee=w(()=>$()??$e(J(),K()));Ze(je,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:Ge=>se()?.(t(),Ge),get disabled(){return l(ge)},get"aria-label"(){return J()},get"aria-keyshortcuts"(){return Y()},get title(){return l(ee)},children:(Ge,it)=>{ut(Ge,{get icon(){return Da},class:"size-3"})},$$slots:{default:!0}})}var Tt=R(je,2);{let ee=w(()=>i()||c()),Ge=w(()=>ie()??$e(X(),de()));Ze(Tt,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:it=>oe()?.(it),get disabled(){return l(ee)},get"aria-label"(){return X()},get"aria-keyshortcuts"(){return me()},get title(){return l(Ge)},children:(it,Xe)=>{ut(it,{get icon(){return Fi},class:"size-3.5"})},$$slots:{default:!0}})}return Q(he),Q(Le),L((ee,Ge,it)=>{xt(Le,"aria-label",O()),wt(Le,1,ee),wt(Ye,1,Ge),wt(he,1,it)},[()=>Xn(br("inline-flex items-center gap-1 rounded-lg border border-border bg-background/95 px-2 py-1 shadow-lg backdrop-blur supports-[backdrop-filter]:bg-background/90",q()==="floating"&&"absolute top-2 right-4 z-50",i()&&"pointer-events-none opacity-60",j())),()=>Xn(br("flex h-7 min-w-0 items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2",ne())),()=>Xn(br("flex items-center gap-0.5",be()))]),k(n,Le),Ot(De)}var Ap=Object.defineProperty,B_=(n,e)=>{let t={};for(var r in n)Ap(t,r,{get:n[r],enumerable:!0});return Ap(t,Symbol.toStringTag,{value:"Module"}),t};function Ur(n){this.content=n}Ur.prototype={constructor:Ur,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Ur(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ur(t)},addToStart:function(n,e){return new Ur([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ur(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Ur(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ur.from(n),n.size?new Ur(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ur.from(n),n.size?new Ur(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ur.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ur.from=function(n){if(n instanceof Ur)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ur(e)};function xv(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){let o=s.text,a=i.text,c=0;for(;o[c]==a[c];c++)t++;return c&&c<o.length&&c<a.length&&Sv(o.charCodeAt(c-1))&&_v(o.charCodeAt(c))&&t--,t}if(s.content.size||i.content.size){let o=xv(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function kv(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),a=e.child(--i),c=o.nodeSize;if(o==a){t-=c,r-=c;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let u=o.text,d=a.text,f=u.length,h=d.length;for(;f>0&&h>0&&u[f-1]==d[h-1];)f--,h--,t--,r--;return f&&h&&f<u.length&&Sv(u.charCodeAt(f-1))&&_v(u.charCodeAt(f))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let u=kv(o.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}function _v(n){return n>=56320&&n<57344}function Sv(n){return n>=55296&&n<56320}class _e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,a=0;a<t;o++){let c=this.content[o],u=a+c.nodeSize;if(u>e&&r(c,s+a,i||null,o)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,t-d),r,s+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(a,c)=>{let u=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new _e(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let a=this.content[i],c=o+a.nodeSize;c>e&&((o<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),s+=a.nodeSize),o=c}return new _e(r,s)}cutByIndex(e,t){return e==t?_e.empty:e==0&&t==this.content.length?this:new _e(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new _e(s,i)}addToStart(e){return new _e([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new _e(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return xv(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return kv(this,e,t,r)}findIndex(e){if(e==0)return ac(0,e);if(e==this.size)return ac(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?ac(t+1,i):ac(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return _e.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return _e.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return _e.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new _e(t||e,r)}static from(e){if(!e)return _e.empty;if(e instanceof _e)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new _e([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}_e.empty=new _e([],0);const dd={index:0,offset:0};function ac(n,e){return dd.index=n,dd.offset=e,dd}function Hc(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Hc(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Hc(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let En=class Qd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Hc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Qd.none;if(e instanceof Qd)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};En.none=[];class Il extends Error{}class He{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Mv(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new He(r,this.openStart,this.openEnd)}removeBetween(e,t){return new He(Cv(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return He.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new He(_e.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new He(e,r,s)}}He.empty=new He(_e.empty,0,0);function Cv(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(s==e||i.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Cv(i.content,e-s-1,t-s-1)))}function Mv(n,e,t,r,s,i){let{index:o,offset:a}=n.findIndex(e),c=n.maybeChild(o);if(a==e||c.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let u=Mv(c.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?s-1:0,c);return u&&n.replaceChild(o,c.copy(u))}function z_(n,e,t){if(t.openStart>n.depth)throw new Il("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Il("Inconsistent open depths");return Tv(n,e,t,0)}function Tv(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Tv(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Xo(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=F_(t,n);return Xo(i,Av(n,o,a,e,r))}else return Xo(i,Uc(n,e,r))}function Ev(n,e){if(!e.type.compatibleContent(n.type))throw new Il("Cannot join "+e.type.name+" onto "+n.type.name)}function Zd(n,e,t){let r=n.node(t);return Ev(r,e.node(t)),r}function Jo(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function bl(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Jo(n.nodeAfter,r),i++));for(let a=i;a<o;a++)Jo(s.child(a),r);e&&e.depth==t&&e.textOffset&&Jo(e.nodeBefore,r)}function Xo(n,e){if(!n.type.validContent(e))throw new Il("Invalid content for node "+n.type.name);return n.copy(e)}function Av(n,e,t,r,s){let i=n.depth>s&&Zd(n,e,s+1),o=r.depth>s&&Zd(t,r,s+1),a=[];return bl(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(Ev(i,o),Jo(Xo(i,Av(n,e,t,r,s+1)),a)):(i&&Jo(Xo(i,Uc(n,e,s+1)),a),bl(e,t,s,a),o&&Jo(Xo(o,Uc(t,r,s+1)),a)),bl(r,null,s,a),new _e(a)}function Uc(n,e,t){let r=[];if(bl(null,n,t,r),n.depth>t){let s=Zd(n,e,t+1);Jo(Xo(s,Uc(n,e,t+1)),r)}return bl(e,null,t,r),new _e(r)}function F_(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(_e.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Ll{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return En.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Vc(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:a,offset:c}=o.content.findIndex(i),u=i-c;if(r.push(o,a,s+c),!u||(o=o.child(a),o.isText))break;i=u-1,s+=c+1}return new Ll(t,r,i)}static resolveCached(e,t){let r=Rp.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Rp.set(e,r=new H_);let s=r.elts[r.i]=Ll.resolve(e,t);return r.i=(r.i+1)%U_,s}}class H_{constructor(){this.elts=[],this.i=0}}const U_=12,Rp=new WeakMap;class Vc{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const V_=Object.create(null);let go=class ef{constructor(e,t,r,s=En.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||_e.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Hc(this.attrs,t||e.defaultAttrs||V_)&&En.sameSet(this.marks,r||En.none)}copy(e=null){return e==this.content?this:new ef(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ef(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return He.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),a=s.start(o),u=s.node(o).content.cut(s.pos-a,i.pos-a);return new He(u,s.depth-o,i.depth-o)}replace(e,t,r){return z_(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Ll.resolveCached(this,e)}resolveNoCache(e){return Ll.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rv(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=_e.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=s;c<i;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),Pp(this.type.attrs,this.attrs,"node",this.type.name);let e=En.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];Pp(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!En.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=_e.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,s,r)}};go.prototype.text=void 0;class Wc extends go{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Wc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Wc(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rv(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Pp(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${r}`);for(let s in n)n[s].validate&&n[s].validate(e[s])}class ea{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new W_(e,t);if(r.next==null)return ea.empty;let s=Pv(r);r.next&&r.err("Unexpected trailing text");let i=Y_(X_(s));return Q_(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,a){let c=o.matchFragment(e,r);if(c&&(!t||c.validEnd))return _e.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:d,next:f}=o.next[u];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let h=i(f,a.concat(d));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:c}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!s.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
5
+ `)}}ea.empty=new ea(!0);class W_{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Pv(n){let e=[];do e.push(K_(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function K_(n){let e=[];do e.push(j_(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function j_(n){let e=J_(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=G_(n,e);else break;return e}function Ip(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function G_(n,e){let t=Ip(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ip(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function q_(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function J_(n){if(n.eat("(")){let e=Pv(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=q_(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function X_(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,c){let u={term:c,to:a};return e[o].push(u),u}function s(o,a){o.forEach(c=>c.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((c,u)=>c.concat(i(u,a)),[]);if(o.type=="seq")for(let c=0;;c++){let u=i(o.exprs[c],a);if(c==o.exprs.length-1)return u;s(u,a=t())}else if(o.type=="star"){let c=t();return r(a,c),s(i(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=t();return s(i(o.expr,a),c),s(i(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let c=a;for(let u=0;u<o.min;u++){let d=t();s(i(o.expr,c),d),c=d}if(o.max==-1)s(i(o.expr,c),c);else for(let u=o.min;u<o.max;u++){let d=t();r(c,d),s(i(o.expr,c),d),c=d}return[r(c)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Iv(n,e){return e-n}function Lp(n,e){let t=[];return r(e),t.sort(Iv);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:a,to:c}=i[o];!a&&t.indexOf(c)==-1&&r(c)}}}function Y_(n){let e=Object.create(null);return t(Lp(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:a,to:c})=>{if(!a)return;let u;for(let d=0;d<s.length;d++)s[d][0]==a&&(u=s[d][1]);Lp(n,c).forEach(d=>{u||s.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new ea(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(Iv);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function Q_(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:c,next:u}=s.next[a];o.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Lv(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Ov(n,e){let t=Object.create(null);for(let r in n){let s=n[r],i=e&&e[r];if(i===void 0)if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r);else s.validate&&s.validate(i);t[r]=i}return t}function Nv(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new eS(n,r,e[r]);return t}let Op=class Dv{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Nv(e,r.attrs),this.defaultAttrs=Lv(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ea.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ov(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new go(this,this.computeAttrs(e),_e.from(t),En.setFrom(r))}createChecked(e=null,t,r){return t=_e.from(t),this.checkContent(t),new go(this,this.computeAttrs(e),t,En.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=_e.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(_e.empty,!0);return i?new go(this,e,t.append(i),En.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:En.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new Dv(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Z_(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class eS{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Z_(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ru{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Nv(e,s.attrs),this.excluded=null;let i=Lv(this.attrs);this.instance=i?new En(this,i):null}create(e=null){return!e&&this.instance?this.instance:new En(this,Ov(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Ru(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class $v{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Ur.from(e.nodes),t.marks=Ur.from(e.marks||{}),this.nodes=Op.compile(this.spec.nodes,this),this.marks=Ru.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=ea.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?Np(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Np(this,o.split(" "))}this.nodeFromJSON=s=>go.fromJSON(this,s),this.markFromJSON=s=>En.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Op){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new Wc(r,r.defaultAttrs,e,En.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Np(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let a in n.marks){let c=n.marks[a];(s=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function tS(n){return n.tag!=null}function nS(n){return n.style!=null}class mo{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(tS(s))this.tags.push(s);else if(nS(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new $p(this,t,!1);return r.addAll(e,En.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new $p(this,t,!0);return r.addAll(e,En.none,t.from,t.to),He.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(iS(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let c=o.getAttrs(t);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Bp(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Bp(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new mo(e,mo.schemaRules(e)))}}const Bv={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},rS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},zv={ol:!0,ul:!0},Ol=1,tf=2,yl=4;function Dp(n,e,t){return e!=null?(e?Ol:0)|(e==="full"?tf:0):n&&n.whitespace=="pre"?Ol|tf:t&~yl}class lc{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=En.none,this.match=i||(o&yl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(_e.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ol)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=_e.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(_e.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Bv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class $p{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Dp(null,t.preserveWhitespace,0)|(r?yl:0);s?i=new lc(s.type,s.attrs,En.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new lc(null,null,En.none,!0,null,o):i=new lc(e.schema.topNodeType,null,En.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&tf?"full":this.localPreserveWS||(s.options&Ol)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
6
6
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let c=0;c<a.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[c]&&this.insertNode(o.text(a[c]),t,!/\S/.test(a[c]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],c=e.previousSibling;(!a||c&&c.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;zv.hasOwnProperty(o)&&this.parser.normalizeLists&&sS(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:rS.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let u,d=this.needsBlock;if(Bv.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,c,u,c.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
7
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let c=this.parser.matchStyle(i,o,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(u=>!c.clearMark(u)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(o,t.attrs||null,r,t.preserveWhitespace);c&&(i=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}i&&this.sync(a)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let c=this.nodes[o],u=c.findWrapping(e);if(u&&(!s||s.length>u.length+a)&&(s=u,i=c,!u.length))break;if(c.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=En.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):zp(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Dp(e,i,o.options);o.options&yl&&o.content.length==0&&(a|=yl);let c=En.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):zp(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new lc(e,t,c,s,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ol)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,c)=>{for(;a>=0;a--){let u=t[a];if(u==""){if(a==t.length-1||a==0)continue;for(;c>=i;c--)if(o(a-1,c))return!0;return!1}else{let d=c>0||c==0&&s?this.nodes[c].type:r&&c>=i?r.node(c-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;c--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function sS(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&zv.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function iS(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Bp(n){let e={};for(let t in n)e[t]=n[t];return e}function zp(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=a=>{i.push(a);for(let c=0;c<a.edgeCount;c++){let{type:u,next:d}=a.edge(c);if(u==e||i.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class aa{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=cc(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,c=0;for(;a<i.length&&c<o.marks.length;){let u=o.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(i[a][0])||u.type.spec.spanning===!1)break;a++,c++}for(;a<i.length;)s=i.pop()[1];for(;c<o.marks.length;){let u=o.marks[c++],d=this.serializeMark(u,o.isInline,t);d&&(i.push([u,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){if(e.isText)return cc(t).createTextNode(e.text);let{dom:r,contentDOM:s}=Ac(cc(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Ac(cc(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return typeof t=="string"?{dom:e.createTextNode(t)}:Ac(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new aa(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Fp(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Fp(e.marks)}}function Fp(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function cc(n){return n.document||window.document}const Hp=new WeakMap;function oS(n){let e=Hp.get(n);return e===void 0&&Hp.set(n,e=aS(n)),e}function aS(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Ac(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=oS(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let a,c=t?n.createElementNS(t,s):n.createElement(s),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let h=f.indexOf(" ");h>0?c.setAttributeNS(f.slice(0,h),f.slice(h+1),u[f]):f=="style"&&c.style?c.style.cssText=u[f]:c.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else if(typeof h=="string")c.appendChild(n.createTextNode(h));else{let{dom:p,contentDOM:g}=Ac(n,h,t,r);if(c.appendChild(p),g){if(a)throw new RangeError("Multiple content holes");a=g}}}return{dom:c,contentDOM:a}}const Fv=65535,Hv=Math.pow(2,16);function lS(n,e){return n+e*Hv}function Up(n){return n&Fv}function cS(n){return(n-(n&Fv))/Hv}const Uv=1,Vv=2,Rc=4,Wv=8;class nf{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Wv)>0}get deletedBefore(){return(this.delInfo&(Uv|Rc))>0}get deletedAfter(){return(this.delInfo&(Vv|Rc))>0}get deletedAcross(){return(this.delInfo&Rc)>0}}class Os{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Os.empty)return Os.empty}recover(e){let t=0,r=Up(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+cS(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?s:0);if(c>e)break;let u=this.ranges[a+i],d=this.ranges[a+o],f=c+u;if(e<=f){let h=u?e==c?-1:e==f?1:t:t,p=c+s+(h<0?0:d);if(r)return p;let g=e==(t<0?c:f)?null:lS(a/3,e-c),v=0;return u&&(v|=e==c?Vv:e==f?Uv:Rc,(t<0?e!=c:e!=f)&&(v|=Wv)),new nf(p,v,g)}s+=d-u}return r?e+s:new nf(e+s,0,null)}touches(e,t){let r=0,s=Up(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[a+i],d=c+u;if(e<=d&&a==s*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),c=o+(this.inverted?0:i),u=this.ranges[s+t],d=this.ranges[s+r];e(a,a+u,c,c+d),i+=d-u}}invert(){return new Os(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Os.empty:new Os(e<0?[0,-e,0]:[0,0,e])}}Os.empty=new Os([]);class Nl{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Nl(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new Nl;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,t);if(a.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new nf(e,s,null)}}const fd=Object.create(null);class Zr{getMap(){return Os.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=fd[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in fd)throw new RangeError("Duplicate use of step JSON ID "+e);return fd[e]=t,t.prototype.jsonID=e,t}}class hr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new hr(e,null)}static fail(e){return new hr(null,e)}static fromReplace(e,t,r,s){try{return hr.ok(e.replace(t,r,s))}catch(i){if(i instanceof Il)return hr.fail(i.message);throw i}}}function sh(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(sh(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return _e.fromArray(r)}class ho extends Zr{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new He(sh(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return hr.fromReplace(e,this.from,this.to,i)}invert(){return new ai(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ho(t.pos,r.pos,this.mark)}merge(e){return e instanceof ho&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ho(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ho(t.from,t.to,e.markFromJSON(t.mark))}}Zr.jsonID("addMark",ho);class ai extends Zr{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new He(sh(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return hr.fromReplace(e,this.from,this.to,r)}invert(){return new ho(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ai(t.pos,r.pos,this.mark)}merge(e){return e instanceof ai&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ai(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ai(t.from,t.to,e.markFromJSON(t.mark))}}Zr.jsonID("removeMark",ai);class po extends Zr{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return hr.fromReplace(e,this.pos,this.pos+1,new He(_e.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new po(this.pos,t.marks[s]);return new po(this.pos,this.mark)}}return new ta(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new po(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new po(t.pos,e.markFromJSON(t.mark))}}Zr.jsonID("addNodeMark",po);class ta extends Zr{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return hr.fromReplace(e,this.pos,this.pos+1,new He(_e.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new po(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ta(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ta(t.pos,e.markFromJSON(t.mark))}}Zr.jsonID("removeNodeMark",ta);class sr extends Zr{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&rf(e,this.from,this.to)?hr.fail("Structure replace would overwrite content"):hr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Os([this.from,this.to-this.from,this.slice.size])}invert(e){return new sr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&sr.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new sr(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof sr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?He.empty:new He(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new sr(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?He.empty:new He(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new sr(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new sr(t.from,t.to,He.fromJSON(e,t.slice),!!t.structure)}}sr.MAP_BIAS=1;Zr.jsonID("replace",sr);class Pr extends Zr{constructor(e,t,r,s,i,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(rf(e,this.from,this.gapFrom)||rf(e,this.gapTo,this.to)))return hr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return hr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?hr.fromReplace(e,this.from,this.to,r):hr.fail("Content does not fit in gap")}getMap(){return new Os([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Pr(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new Pr(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Pr(t.from,t.to,t.gapFrom,t.gapTo,He.fromJSON(e,t.slice),t.insert,!!t.structure)}}Zr.jsonID("replaceAround",Pr);function rf(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function uS(n,e,t,r){let s=[],i=[],o,a;n.doc.nodesBetween(e,t,(c,u,d)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+c.nodeSize,t),g=r.addToSet(f);for(let v=0;v<f.length;v++)f[v].isInSet(g)||(o&&o.to==h&&o.mark.eq(f[v])?o.to=p:s.push(o=new ai(h,p,f[v])));a&&a.to==h?a.to=p:i.push(a=new ho(h,p,r))}}),s.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function dS(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;i++;let c=null;if(r instanceof Ru){let u=o.marks,d;for(;d=r.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let u=Math.min(a+o.nodeSize,t);for(let d=0;d<c.length;d++){let f=c[d],h;for(let p=0;p<s.length;p++){let g=s[p];g.step==i-1&&f.eq(s[p].style)&&(h=g)}h?(h.to=u,h.step=i):s.push({style:f,from:Math.max(a,e),to:u,step:i})}}}),s.forEach(o=>n.step(new ai(o.from,o.to,o.style)))}function ih(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],a=e+1;for(let c=0;c<i.childCount;c++){let u=i.child(c),d=a+u.nodeSize,f=r.matchType(u.type);if(!f)o.push(new sr(a,d,He.empty));else{r=f;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new ai(a,d,u.marks[h]));if(s&&u.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,g;for(;h=p.exec(u.text);)g||(g=new He(_e.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new sr(a+h.index,a+h.index+h[0].length,g))}}a=d}if(!r.validEnd){let c=r.fillBefore(_e.empty,!0);n.replace(a,a,new He(c,0,0))}for(let c=o.length-1;c>=0;c--)n.step(o[c])}function fS(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function qa(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+s,c=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(a,c,t))return r;if(r==0||o.type.spec.isolating||!fS(o,a,c))break;a&&(s=1),c<o.childCount&&(i=1)}return null}function hS(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),c=o,u=a,d=_e.empty,f=0;for(let g=i,v=!1;g>t;g--)v||r.index(g)>0?(v=!0,d=_e.from(r.node(g).copy(d)),f++):c--;let h=_e.empty,p=0;for(let g=i,v=!1;g>t;g--)v||s.after(g+1)<s.end(g)?(v=!0,h=_e.from(s.node(g).copy(h)),p++):u++;n.step(new Pr(c,u,o,a,new He(d.append(h),f,p),d.size-f,!0))}function oh(n,e,t=null,r=n){let s=pS(n,e),i=s&&gS(r,e);return i?s.map(Vp).concat({type:e,attrs:t}).concat(i.map(Vp)):null}function Vp(n){return{type:n,attrs:null}}function pS(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function gS(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;c&&u<s;u++)c=c.matchType(t.child(u).type);return!c||!c.validEnd?null:o}function mS(n,e,t){let r=_e.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=_e.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new Pr(s,i,s,i,new He(r,0,0),t.length,!0))}function vS(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let c=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,c)&&bS(n.doc,n.mapping.slice(i).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",g=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!g?u=!1:!p&&g&&(u=!0)}u===!1&&jv(n,o,a,i),ih(n,n.mapping.slice(i).map(a,1),r,void 0,u===null);let d=n.mapping.slice(i),f=d.map(a,1),h=d.map(a+o.nodeSize,1);return n.step(new Pr(f,h,f+1,h-1,new He(_e.from(r.create(c,null,o.marks)),0,0),1,!0)),u===!0&&Kv(n,o,a,i),!1}})}function Kv(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let c=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function jv(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
8
- `))}})}function bS(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function yS(n,e,t,r,s){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let o=t.create(r,null,s||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,o);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Pr(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new He(_e.from(o),0,0),1,!0))}function Bi(n,e,t=1,r){let s=n.resolve(e),i=s.depth-t,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,d=t-2;u>i;u--,d--){let f=s.node(u),h=s.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),g=r&&r[d+1];g&&(p=p.replaceChild(0,g.type.create(g.attrs)));let v=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!v.type.validContent(p))return!1}let a=s.indexAfter(i),c=r&&r[0];return s.node(i).canReplaceWith(a,a,c?c.type:s.node(i+1).type)}function wS(n,e,t=1,r){let s=n.doc.resolve(e),i=_e.empty,o=_e.empty;for(let a=s.depth,c=s.depth-t,u=t-1;a>c;a--,u--){i=_e.from(s.node(a).copy(i));let d=r&&r[u];o=_e.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}n.step(new sr(e,e,new He(i.append(o),t,t),!0))}function Co(n,e){let t=n.resolve(e),r=t.index();return Gv(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function xS(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Gv(n,e){return!!(n&&e&&!n.isLeaf&&xS(n,e))}function Pu(n,e,t=-1){let r=n.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):t>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&Gv(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=t<0?r.before(s):r.after(s)}}function kS(n,e,t){let r=null,{linebreakReplacement:s}=n.doc.type.schema,i=n.doc.resolve(e-t),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",f=!!o.contentMatch.matchType(s);d&&!f?r=!1:!d&&f&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);jv(n,d.node(),d.before(),a)}o.inlineContent&&ih(n,e+t-1,o,i.node().contentMatchAt(i.index()),r==null);let c=n.mapping.slice(a),u=c.map(e-t);if(n.step(new sr(u,c.map(e+t,-1),He.empty,!0)),r===!0){let d=n.doc.resolve(u);Kv(n,d.node(),d.before(),n.steps.length)}return n}function _S(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,t))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,t))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function qv(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(a>0?1:0),u=r.node(o),d=!1;if(i==1)d=u.canReplace(c,c,s);else{let f=u.contentMatchAt(c).findWrapping(s.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Iu(n,e,t=e,r=He.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return Jv(s,i,r)?new sr(e,t,r):new SS(s,i,r).fit()}function Jv(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class SS{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=_e.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=_e.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let c=new He(i,o,a);return e>-1?new Pr(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new sr(r.pos,s.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=Wp(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:u}=this.frontier[a],d,f=null;if(t==1&&(o?u.matchType(o.type)||(f=u.fillBefore(_e.from(o),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:f};if(t==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced;return Kp(e,-1)<=t?!1:(this.unplaced.size>1&&Kp(e,1)>r&&r++,this.unplaced=new He(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=Wp(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new He(ul(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new He(ul(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:s,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let v=0;v<i.length;v++)this.openFrontierNode(i[v]);let o=this.unplaced,a=r?r.content:o.content,c=o.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(s){for(let v=0;v<s.childCount;v++)d.push(s.child(v));f=f.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let v=a.child(u),m=f.matchType(v.type);if(!m)break;u++,(u>1||c==0||v.content.size)&&(f=m,d.push(Xv(v.mark(h.allowedMarks(v.marks)),u==1?c:0,u==a.childCount?p:-1)))}let g=u==a.childCount;g||(p=-1),this.placed=dl(this.placed,t,_e.from(d)),this.frontier[t].match=f,g&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,m=a;v<p;v++){let S=m.lastChild;this.frontier.push({type:S.type,match:S.contentMatchAt(S.childCount)}),m=S.content}this.unplaced=g?e==0?He.empty:new He(ul(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new He(ul(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!hd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:s}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=hd(e,t,s,r,i);if(o){for(let a=t-1;a>=0;a--){let{match:c,type:u}=this.frontier[a],d=hd(e,a,u,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=dl(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,t=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=dl(this.placed,this.depth,_e.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(_e.empty,!0);t.childCount&&(this.placed=dl(this.placed,this.frontier.length,t))}}function ul(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ul(n.firstChild.content,e-1,t)))}function dl(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(dl(n.lastChild.content,e-1,t)))}function Wp(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Xv(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Xv(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(_e.empty,!0)))),n.copy(r)}function hd(n,e,t,r,s){let i=n.node(e),o=s?n.indexAfter(e):n.index(e);if(o==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!CS(t,i.content,o)?a:null}function CS(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function MS(n){return n.spec.defining||n.spec.definingForContent}function Kp(n,e){for(let t=0;;t++){let r=e<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return t;n=r.content}}function TS(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(Jv(s,i,r))return n.step(new sr(e,t,r));let o=Yv(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,p=s.pos-1;h>0;h--,p--){let g=s.node(h).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==p&&o.splice(1,0,-h)}let c=o.indexOf(a),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let g=h.firstChild;if(u.push(g),p==r.openStart)break;h=g.content}for(let h=d-1;h>=0;h--){let p=u[h],g=MS(p.type);if(g&&!p.sameMarkup(s.node(Math.abs(a)-1)))d=h;else if(g||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),g=u[p];if(g)for(let v=0;v<o.length;v++){let m=o[(v+c)%o.length],S=!0;m<0&&(S=!1,m=-m);let I=s.node(m-1),C=s.index(m-1);if(I.canReplaceWith(C,C,g.type,g.marks))return n.replace(s.before(m),S?i.after(m):t,new He(Qv(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=o[h];p<0||(e=s.before(p),t=i.after(p))}}function Qv(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Qv(i.content,e+1,t,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(n).append(n);n=o.append(i.matchFragment(o).fillBefore(_e.empty,!0))}return n}function ES(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=_S(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new He(_e.from(r),0,0))}function AS(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(t),a=!1;for(let c=r.depth;c>o;c--)r.node(c).type.spec.isolating&&(a=!0);for(let c=s.depth;c>o;c--)s.node(c).type.spec.isolating&&(a=!0);if(!a){for(let c=r.depth;c>0&&e==r.start(c);c--)e=r.before(c);for(let c=s.depth;c>0&&t==s.start(c);c--)t=s.before(c);r=n.doc.resolve(e),s=n.doc.resolve(t)}}let i=Yv(r,s);for(let o=0;o<i.length;o++){let a=i[o],c=o==i.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),s.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return n.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&s.end(o)-t!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function Yv(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let i=n.start(s);if(i<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&t.push(s)}return t}class La extends Zr{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return hr.fromReplace(e,this.pos,this.pos+1,new He(_e.from(s),0,t.isLeaf?0:1))}getMap(){return Os.empty}invert(e){return new La(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new La(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new La(t.pos,t.attr,t.value)}}Zr.jsonID("attr",La);class Dl extends Zr{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return hr.ok(r)}getMap(){return Os.empty}invert(e){return new Dl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Dl(t.attr,t.value)}}Zr.jsonID("docAttr",Dl);let za=class extends Error{};za=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};za.prototype=Object.create(Error.prototype);za.prototype.constructor=za;za.prototype.name="TransformError";class Zv{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Nl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new za(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),t=s.map(t,-1)),s.forEach((i,o,a,c)=>{e=Math.min(e,a),t=Math.max(t,c)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=He.empty){let s=Iu(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new He(_e.from(r),0,0))}delete(e,t){return this.replace(e,t,He.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return TS(this,e,t,r),this}replaceRangeWith(e,t,r){return ES(this,e,t,r),this}deleteRange(e,t){return AS(this,e,t),this}lift(e,t){return hS(this,e,t),this}join(e,t=1){return kS(this,e,t),this}wrap(e,t){return mS(this,e,t),this}setBlockType(e,t=e,r,s=null){return vS(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return yS(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new La(e,t,r)),this}setDocAttribute(e,t){return this.step(new Dl(e,t)),this}addNodeMark(e,t){return this.step(new po(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof En)t.isInSet(r.marks)&&this.step(new ta(e,t));else{let s=r.marks,i,o=[];for(;i=t.isInSet(s);)o.push(new ta(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return wS(this,e,t,r),this}addMark(e,t,r){return uS(this,e,t,r),this}removeMark(e,t,r){return dS(this,e,t,r),this}clearIncompatible(e,t,r){return ih(this,e,t,r),this}}const pd=Object.create(null);class jt{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new RS(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=He.empty){let r=t.content.lastChild,s=null;for(let a=0;a<t.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:c,$to:u}=o[a],d=e.mapping.slice(i);e.replaceRange(d.map(c.pos),d.map(u.pos),a?He.empty:t),a==0&&qp(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],c=e.mapping.slice(r),u=c.map(o.pos),d=c.map(a.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),qp(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new et(e):Ea(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?Ea(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Ea(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ns(e.node(0))}static atStart(e){return Ea(e,e,0,0,1)||new Ns(e)}static atEnd(e){return Ea(e,e,e.content.size,e.childCount,-1)||new Ns(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=pd[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in pd)throw new RangeError("Duplicate use of selection JSON ID "+e);return pd[e]=t,t.prototype.jsonID=e,t}getBookmark(){return et.between(this.$anchor,this.$head).getBookmark()}}jt.prototype.visible=!0;class RS{constructor(e,t){this.$from=e,this.$to=t}}let jp=!1;function Gp(n){!jp&&!n.parent.inlineContent&&(jp=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class et extends jt{constructor(e,t=e){Gp(e),Gp(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return jt.near(r);let s=e.resolve(t.map(this.anchor));return new et(s.parent.inlineContent?s:r,r)}replace(e,t=He.empty){if(super.replace(e,t),t==He.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof et&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Lu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new et(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=jt.findFrom(t,r,!0)||jt.findFrom(t,-r,!0);if(i)t=i.$head;else return jt.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(jt.findFrom(e,-r,!0)||jt.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new et(e,t)}}jt.jsonID("text",et);class Lu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Lu(e.map(this.anchor),e.map(this.head))}resolve(e){return et.between(e.resolve(this.anchor),e.resolve(this.head))}}class vt extends jt{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?jt.near(i):new vt(i)}content(){return new He(_e.from(this.node),0,0)}eq(e){return e instanceof vt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ah(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new vt(e.resolve(t.anchor))}static create(e,t){return new vt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}vt.prototype.visible=!1;jt.jsonID("node",vt);class ah{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Lu(r,r):new ah(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&vt.isSelectable(r)?new vt(t):jt.near(t)}}class Ns extends jt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=He.empty){if(t==He.empty){e.delete(0,e.doc.content.size);let r=jt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ns(e)}map(e){return new Ns(e)}eq(e){return e instanceof Ns}getBookmark(){return PS}}jt.jsonID("all",Ns);const PS={map(){return this},resolve(n){return new Ns(n)}};function Ea(n,e,t,r,s,i=!1){if(e.inlineContent)return et.create(n,t);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&vt.isSelectable(a))return vt.create(n,t-(s<0?a.nodeSize:0))}else{let c=Ea(n,a,t+s,s<0?a.childCount:0,s,i);if(c)return c}t+=a.nodeSize*s}return null}function qp(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof sr||s instanceof Pr))return;let i=n.mapping.maps[r],o;i.forEach((a,c,u,d)=>{o==null&&(o=d)}),n.setSelection(jt.near(n.doc.resolve(o),t))}const Jp=1,uc=2,Xp=4;class IS extends Zv{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Jp)&~uc,this.storedMarks=null,this}get selectionSet(){return(this.updated&Jp)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=uc,this}ensureMarks(e){return En.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&uc)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~uc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||En.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(t);i=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(jt.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Xp,this}get scrolledIntoView(){return(this.updated&Xp)>0}}function Qp(n,e){return!e||!n?n:n.bind(e)}class fl{constructor(e,t,r){this.name=e,this.init=Qp(t.init,r),this.apply=Qp(t.apply,r)}}const LS=[new fl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new fl("selection",{init(n,e){return n.selection||jt.atStart(e.doc)},apply(n){return n.selection}}),new fl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new fl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class gd{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=LS.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new fl(r.key,r.spec.state,r))})}}class Uo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let c=s?s[o].n:0,u=s?s[o].state:this,d=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let f=0;f<this.config.plugins.length;f++)s.push(f<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),i=!0}s&&(s[o]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Uo(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new IS(this)}static create(e){let t=new gd(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Uo(t);for(let s=0;s<t.fields.length;s++)r[t.fields[s].name]=t.fields[s].init(e,r);return r}reconfigure(e){let t=new gd(this.schema,e.plugins),r=t.fields,s=new Uo(t);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new gd(e.schema,e.plugins),i=new Uo(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=go.fromJSON(e.schema,t.doc);else if(o.name=="selection")i.selection=jt.fromJSON(i.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[o.name]=u.fromJSON.call(c,e,t[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function eb(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=eb(s,e,{})),t[r]=s}return t}class kn{constructor(e){this.spec=e,this.props={},e.props&&eb(e.props,this,this.props),this.key=e.key?e.key.key:tb("plugin")}getState(e){return e[this.key]}}const md=Object.create(null);function tb(n){return n in md?n+"$"+ ++md[n]:(md[n]=0,n+"$")}class Dn{constructor(e="key"){this.key=tb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const nb=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function rb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const sb=(n,e,t)=>{let r=rb(n,t);if(!r)return!1;let s=lh(r);if(!s){let o=r.blockRange(),a=o&&qa(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(hb(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Fa(i,"end")||vt.isSelectable(i)))for(let o=r.depth;;o--){let a=Iu(n.doc,r.before(o),r.after(o),He.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Fa(i,"end")?jt.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):vt.create(c.doc,s.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},OS=(n,e,t)=>{let r=rb(n,t);if(!r)return!1;let s=lh(r);return s?ib(n,s,e):!1},NS=(n,e,t)=>{let r=ab(n,t);if(!r)return!1;let s=ch(r);return s?ib(n,s,e):!1};function ib(n,e,t){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,a=o,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let u=Iu(n.doc,i,c,He.empty);if(!u||u.from!=i||u instanceof sr&&u.slice.size>=c-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(et.create(d.doc,i)),t(d.scrollIntoView())}return!0}function Fa(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const ob=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=lh(r)}let o=i&&i.nodeBefore;return!o||!vt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(vt.create(n.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function lh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function ab(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const lb=(n,e,t)=>{let r=ab(n,t);if(!r)return!1;let s=ch(r);if(!s)return!1;let i=s.nodeAfter;if(hb(n,s,e,1))return!0;if(r.parent.content.size==0&&(Fa(i,"start")||vt.isSelectable(i))){let o=Iu(n.doc,r.before(),r.after(),He.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Fa(i,"start")?jt.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):vt.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},cb=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=ch(r)}let o=i&&i.nodeAfter;return!o||!vt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(vt.create(n.doc,i.pos)).scrollIntoView()),!0)};function ch(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const DS=(n,e)=>{let t=n.selection,r=t instanceof vt,s;if(r){if(t.node.isTextblock||!Co(n.doc,t.from))return!1;s=t.from}else if(s=Pu(n.doc,t.from,-1),s==null)return!1;if(e){let i=n.tr.join(s);r&&i.setSelection(vt.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},$S=(n,e)=>{let t=n.selection,r;if(t instanceof vt){if(t.node.isTextblock||!Co(n.doc,t.to))return!1;r=t.to}else if(r=Pu(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},BS=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&qa(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},ub=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
9
- `).scrollIntoView()),!0)};function uh(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const zS=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let s=t.node(-1),i=t.indexAfter(-1),o=uh(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,o.createAndFill());c.setSelection(jt.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},db=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof Ns||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=uh(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=n.tr.insert(o,i.createAndFill());a.setSelection(et.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},fb=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Bi(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&qa(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function FS(n){return(e,t)=>{if(e.selection instanceof vt&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!Bi(e.doc,p.pos)?!1:(t&&t(e.tr.split(p.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof et||e.selection instanceof Ns)&&r.deleteSelection();let{$from:s}=r.selection,i=r.steps.length,o=[],a,c,u=!1,d=!1;for(let p=s.depth;;p--)if(s.node(p).isBlock){u=s.end(p)==s.pos+(s.depth-p),d=s.start(p)==s.pos-(s.depth-p),c=uh(s.node(p-1).contentMatchAt(s.indexAfter(p-1))),o.unshift(u&&c?{type:c}:null),a=p;break}else{if(p==1)return!1;o.unshift(null)}let f=s.pos,h=Bi(r.doc,f,o.length,o);if(h||(o[0]=c?{type:c}:null,h=Bi(r.doc,f,o.length,o)),!h)return!1;if(r.split(f,o.length,o),!u&&d&&s.node(a).type!=c){let p=r.mapping.slice(i),g=p.map(s.before(a)),v=r.doc.resolve(g);c&&s.node(a-1).canReplaceWith(v.index(),v.index()+1,c)&&r.setNodeMarkup(p.map(s.before(a)),c)}return t&&t(r.scrollIntoView()),!0}}const HS=FS(),US=(n,e)=>{let{$from:t,to:r}=n.selection,s,i=t.sharedDepth(r);return i==0?!1:(s=t.before(i),e&&e(n.tr.setSelection(vt.create(n.doc,s))),!0)};function VS(n,e,t){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Co(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function hb(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,c=s.type.spec.isolating||i.type.spec.isolating;if(!c&&VS(n,e,t))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(t){let p=e.pos+i.nodeSize,g=_e.empty;for(let S=o.length-1;S>=0;S--)g=_e.from(o[S].create(null,g));g=_e.from(s.copy(g));let v=n.tr.step(new Pr(e.pos-1,p,e.pos,p,new He(g,1,0),o.length,!0)),m=v.doc.resolve(p+2*o.length);m.nodeAfter&&m.nodeAfter.type==s.type&&Co(v.doc,m.pos)&&v.join(m.pos),t(v.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&c?null:jt.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&qa(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&Fa(i,"start",!0)&&Fa(s,"end")){let p=s,g=[];for(;g.push(p),!p.isTextblock;)p=p.lastChild;let v=i,m=1;for(;!v.isTextblock;v=v.firstChild)m++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(t){let S=_e.empty;for(let C=g.length-1;C>=0;C--)S=_e.from(g[C].copy(S));let I=n.tr.step(new Pr(e.pos-g.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new He(S,g.length,0),0,!0));t(I.scrollIntoView())}return!0}}return!1}function pb(n){return function(e,t){let r=e.selection,s=n<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(t&&t(e.tr.setSelection(et.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const WS=pb(-1),KS=pb(1);function jS(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i),a=o&&oh(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Yp(n,e=null){return function(t,r){let s=!1;for(let i=0;i<t.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[i];t.doc.nodesBetween(o,a,(c,u)=>{if(s)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)s=!0;else{let d=t.doc.resolve(u),f=d.index();s=d.parent.canReplaceWith(f,f+1,n)}})}if(!s)return!1;if(r){let i=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[o];i.setBlockType(a,c,n,e)}r(i.scrollIntoView())}return!0}}function dh(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}dh(nb,sb,ob);dh(nb,lb,cb);dh(ub,db,fb,HS);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function GS(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i);if(!o)return!1;let a=r?t.tr:null;return qS(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function qS(n,e,t,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=o.resolve(e.start-2);i=new Vc(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Vc(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=oh(i,t,r,e);return a?(n&&JS(n,e,a,s,t),!0):!1}function JS(n,e,t,r,s){let i=_e.empty;for(let d=t.length-1;d>=0;d--)i=_e.from(t[d].type.create(t[d].attrs,i));n.step(new Pr(e.start-(r?2:0),e.end,e.start,e.end,new He(i,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==s&&(o=d+1);let a=t.length-o,c=e.start+t.length-(r?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&Bi(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return n}function XS(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?QS(e,t,n,i):YS(e,t,i):!0:!1}}function QS(n,e,t,r){let s=n.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Pr(i-1,o,i,o,new He(_e.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Vc(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=qa(r);if(a==null)return!1;s.lift(r,a);let c=s.doc.resolve(s.mapping.map(i,-1)-1);return Co(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),e(s.scrollIntoView()),!0}function YS(n,e,t){let r=n.tr,s=t.parent;for(let p=t.end,g=t.endIndex-1,v=t.startIndex;g>v;g--)p-=s.child(g).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(t.start),o=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==s.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(a?0:1),d+1,o.content.append(c?_e.empty:_e.from(s))))return!1;let f=i.pos,h=f+o.nodeSize;return r.step(new Pr(f-(a?1:0),h+(c?1:0),f+1,h-1,new He((a?_e.empty:_e.from(s.copy(_e.empty))).append(c?_e.empty:_e.from(s.copy(_e.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function ZS(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==n);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,c=a.child(o-1);if(c.type!=n)return!1;if(t){let u=c.lastChild&&c.lastChild.type==a.type,d=_e.from(u?n.create():null),f=new He(_e.from(n.create(null,_e.from(a.type.create(null,d)))),u?3:1,0),h=i.start,p=i.end;t(e.tr.step(new Pr(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const Vr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ha=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let sf=null;const Ni=function(n,e,t){let r=sf||(sf=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},eC=function(){sf=null},na=function(n,e,t,r){return t&&(Zp(n,e,t,r,-1)||Zp(n,e,t,r,1))},tC=/^(img|br|input|textarea|hr)$/i;function Zp(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:Qr(n))){let o=n.parentNode;if(!o||!kt(o)||Xl(n)||tC.test(n.nodeName)||n.contentEditable=="false")return!1;e=Vr(n)+(s<0?0:1),n=o}else if(kt(n)){let o=n.childNodes[e+(s<0?-1:0)];if(kt(o)&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?Qr(n):0}else return!1}}function Qr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function kt(n){return n.nodeType==1}function wr(n){return n.nodeType==3}function ra(n,e){return e?n.contains(kt(e)?e:e.parentNode):!1}function nC(n,e){for(;;){if(wr(n)&&e)return n;if(kt(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Qr(n)}else if(n.parentNode&&!Xl(n))e=Vr(n),n=n.parentNode;else return null}}function rC(n,e){for(;;){if(wr(n)&&e<n.nodeValue.length)return n;if(kt(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Xl(n))e=Vr(n)+1,n=n.parentNode;else return null}}function sC(n,e,t){for(let r=e==0,s=e==Qr(n);r||s;){if(n==t)return!0;let i=Vr(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==Qr(n)}}function Xl(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ou=function(n){return n.focusNode&&na(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function zo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function iC(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function oC(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Qr(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Qr(r.startContainer),r.startOffset)}}}const wi=typeof navigator<"u"?navigator:null,eg=typeof document<"u"?document:null,Mo=wi&&wi.userAgent||"",of=/Edge\/(\d+)/.exec(Mo),gb=/MSIE \d/.exec(Mo),af=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mo),Ts=!!(gb||af||of),vo=gb?document.documentMode:af?+af[1]:of?+of[1]:0,Ds=!Ts&&/gecko\/(\d+)/i.test(Mo);Ds&&+(/Firefox\/(\d+)/.exec(Mo)||[0,0])[1];const lf=!Ts&&/Chrome\/(\d+)/.exec(Mo),jr=!!lf,mb=lf?+lf[1]:0,Yr=!Ts&&!!wi&&/Apple Computer/.test(wi.vendor),Ua=Yr&&(/Mobile\/\w+/.test(Mo)||!!wi&&wi.maxTouchPoints>2),qs=Ua||(wi?/Mac/.test(wi.platform):!1),vb=wi?/Win/.test(wi.platform):!1,Di=/Android \d/.test(Mo),Nu=!!eg&&"webkitFontSmoothing"in eg.documentElement.style,aC=Nu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function lC(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ai(n,e){return typeof n=="number"?n:n[e]}function cC(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function tg(n,e,t){if(!cf(e)&&e.left==0)return;let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(!kt(o)){o=Ha(o);continue}let a=o==i.body,c=a?lC(i):cC(o),u=0,d=0;if(e.top<c.top+Ai(r,"top")?d=-(c.top-e.top+Ai(s,"top")):e.bottom>c.bottom-Ai(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ai(s,"top")-c.top:e.bottom-c.bottom+Ai(s,"bottom")),e.left<c.left+Ai(r,"left")?u=-(c.left-e.left+Ai(s,"left")):e.right>c.right-Ai(r,"right")&&(u=e.right-c.right+Ai(s,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=o.scrollLeft,p=o.scrollTop;d&&(o.scrollTop+=d),u&&(o.scrollLeft+=u);let g=o.scrollLeft-h,v=o.scrollTop-p;e={left:e.left-g,top:e.top-v,right:e.right-g,bottom:e.bottom-v}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Ha(o)}}function uC(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(i,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,s=c.top;break}}return{refDOM:r,refTop:s,stack:bb(n.dom)}}function bb(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Ha(r));return e}function dC({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;yb(t,r==0?0:r-e)}function yb(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:i}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let ka=null;function fC(n){if(n.setActive)return n.setActive();if(ka)return n.focus(ka);let e=bb(n);n.focus(ka==null?{get preventScroll(){return ka={preventScroll:!0},!0}}:void 0),ka||(ka=!1,yb(e,0))}function wb(n,e){let t,r=2e8,s,i=0,o=e.top,a=e.top,c,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(kt(d))h=d.getClientRects();else if(wr(d))h=Ni(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let g=h[p];if(g.top<=o&&g.bottom>=a){o=Math.max(g.bottom,o),a=Math.min(g.top,a);let v=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(v<r){t=d,r=v,s=v&&wr(t)?{left:g.right<e.left?g.right:g.left,top:e.top}:e,kt(d)&&v&&(i=f+(e.left>=(g.left+g.right)/2?1:0));continue}}else g.top>e.top&&!c&&g.left<=e.left&&g.right>=e.left&&(c=d,u={left:Math.max(g.left,Math.min(g.right,e.left)),top:g.top});!t&&(e.left>=g.right&&e.top>=g.top||e.left>=g.left&&e.top>=g.bottom)&&(i=f+1)}}return!t&&c&&(t=c,s=u,r=0),t&&wr(t)?hC(t,s):!t||r?{node:n,offset:i}:wb(t,s)}function hC(n,e){let t=n.nodeValue.length,r=document.createRange(),s;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=so(r,1);if(o.top!=o.bottom&&fh(e,o)){s={node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:n,offset:0}}function fh(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function pC(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function gC(n,e,t){let{node:r,offset:s}=wb(e,t),i=-1;if(kt(r)&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,s,i)}function mC(n,e,t,r){let s=-1;for(let i=e,o=!1;i!=n.dom;){let a=n.docView.nearestDesc(i,!0),c;if(!a)return null;if(kt(a.dom)&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&c.left>r.left||c.top>r.top?s=a.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function xb(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=s;;){let o=n.childNodes[i];if(kt(o)){let a=o.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(fh(e,u))return xb(o,e,u)}}if((i=(i+1)%r)==s)break}return n}function vC(n,e){let t=n.dom.ownerDocument,r,s=0,i=oC(t,e.left,e.top);i&&({node:r,offset:s}=i);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o)){let u=n.dom.getBoundingClientRect();if(!fh(e,u)||(o=xb(n.dom,e,u),!o))return null}if(Yr)for(let u=o;r&&u;u=Ha(u))u.draggable&&(r=void 0);if(o=pC(o,e),r){if(Ds&&kt(r)&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let d=r.childNodes[s],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&s++}let u;Nu&&s&&kt(r)&&kt(u=r.childNodes[s-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&kt(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(s==0||!kt(r)||r.childNodes[s-1].nodeName!="BR")&&(a=mC(n,r,s,e))}a==null&&(a=gC(n,o,e));let c=n.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function cf(n){return n.top<n.bottom||n.left<n.right}function so(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(cf(r))return r}return Array.prototype.find.call(t,cf)||n.getBoundingClientRect()}const bC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kb(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),o=Nu||Ds;if(wr(r))if(o&&(bC.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let c=so(Ni(r,s,s),t);if(Ds&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=so(Ni(r,s-1,s-1),-1);if(u.top==c.top){let d=so(Ni(r,s,s+1),-1);if(d.top!=c.top)return il(d,d.left<u.left)}}return c}else{let c=s,u=s,d=t<0?1:-1;return t<0&&!s?(u++,d=-1):t>=0&&s==r.nodeValue.length?(c--,d=1):t<0?c--:u++,il(so(Ni(r,c,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==Qr(r))){let c=r.childNodes[s-1];if(kt(c))return vd(c.getBoundingClientRect(),!1)}if(i==null&&s<Qr(r)){let c=r.childNodes[s];if(kt(c))return vd(c.getBoundingClientRect(),!0)}return vd(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==Qr(r))){let c=r.childNodes[s-1],u=wr(c)?Ni(c,Qr(c)-(o?0:1)):kt(c)&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return il(so(u,1),!1)}if(i==null&&s<Qr(r)){let c=r.childNodes[s];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?wr(c)?Ni(c,0,o?0:1):kt(c)?c:null:null;if(u)return il(so(u,-1),!0)}return il(so(wr(r)?Ni(r):r,-t),t>=0)}function il(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function vd(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function _b(n,e,t){let r=n.state,s=n.root.activeElement;r!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),s!=n.dom&&s&&s.focus()}}function yC(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return _b(n,e,()=>{let{node:i}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=kb(n,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let c;if(kt(a))c=a.getClientRects();else if(wr(a))c=Ni(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const wC=/[\u0590-\u08ac]/;function xC(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=n.domSelection();return a?!wC.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:o:_b(n,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:g,focusOffset:v}=n.domSelectionRange(),m=g&&!ra(p,g)||c==g&&u==v;try{a.collapse(d,f),c&&(c!=d||u!=f)&&a.extend&&a.extend(c,u)}catch{}return h!=null&&(a.caretBidiLevel=h),m}):r.pos==r.start()||r.pos==r.end()}let ng=null,rg=null,sg=!1;function kC(n,e,t){return ng==e&&rg==t?sg:(ng=e,rg=t,sg=t=="up"||t=="down"?yC(n,e,t):xC(n,e,t))}const Xs=0,ig=1,Vo=2,ci=3;class Ql{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=Xs,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let s=this.children[t];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&ra(this.contentDOM,e))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>Vr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!t||i.node))if(r&&(o=i.nodeDOM)&&!(kt(o)?ra(o,e):o==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let s=this.children[t],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,t);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof Cb||i instanceof Sb&&i.side>=0))break}if(t<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&t&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Vr(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Vr(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let c=this.children[a],u=o+c.size;if(s==-1&&e<=u){let d=o+c.border;if(e>=d&&t<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,d);e=o;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=Vr(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(u>t||a==this.children.length-1)){t=u;for(let d=a+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Vr(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(!kt(t)||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,s=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let p=0,g=0;p<this.children.length;p++){let v=this.children[p],m=g+v.size;if(i>g&&o<m)return v.setSelection(e-g-v.border,t-g-v.border,r,s);g=m}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),f=!1;if((Ds||Yr)&&e==t){let{node:p,offset:g}=a;if(wr(p)){if(f=!!(g&&p.nodeValue[g-1]==`
10
- `),f&&g==p.nodeValue.length)for(let v=p,m;v;v=v.parentNode){if(m=v.nextSibling){m.nodeName=="BR"&&(a=c={node:m.parentNode,offset:Vr(m)+1});break}let S=v.pmViewDesc;if(S&&S.node&&S.node.isBlock)break}}else{let v=p.childNodes[g-1];f=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Ds&&d.focusNode&&d.focusNode!=c.node&&kt(d.focusNode)){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||f&&Yr)&&na(a.node,a.offset,d.anchorNode,d.anchorOffset)&&na(c.node,c.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==t)&&!(f&&Ds)){u.collapse(a.node,a.offset);try{e!=t&&u.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>t){let g=a;a=c,c=g}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+i.border,c=o-i.border;if(e>=a&&t<=c){this.dirty=e==r||t==o?Vo:ig,e==a&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ci:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Vo:ci}r=o}this.dirty=Vo}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Vo:ig;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Sb extends Ql{constructor(e,t,r,s){let i,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let a=kt(o)?o:document.createElement("span");a!=o&&a.appendChild(o),a.hasAttribute("contenteditable")||(a.contentEditable="false"),a.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Xs&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class _C extends Ql{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class bo extends Ql{constructor(e,t,r,s,i){super(e,[],r,s),this.mark=t,this.spec=i}static create(e,t,r,s){let i=s.nodeViews[t.type.name],o=i&&i(t,s,r);return(!o||!o.dom)&&(o=aa.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new bo(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ci||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ci&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Xs){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xs}}slice(e,t,r){let s=bo.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;t<o&&(i=df(i,t,o,r)),e>0&&(i=df(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class yo extends Ql{constructor(e,t,r,s,i,o,a){super(e,[],i,o),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,t,r,s,i,o){let a=i.nodeViews[t.type.name],c,u=a&&a(t,i,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,s),d=u&&u.dom,f=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(!wr(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=aa.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Eb(d,r,t),u?c=new SC(e,t,r,s,d,f||null,h,u):t.isText?new Du(e,t,r,s,d,h):new yo(e,t,r,s,d,f||null,h)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){t.contentElement=s.dom.parentNode;break}}if(!t.contentElement){let r=e&&e.find(s=>kt(s)&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?t.contentElement=r:t.getContent=()=>_e.empty}}return t}matchesNode(e,t,r){return this.dirty==Xs&&e.eq(this.node)&&Kc(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,s=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,c=new MC(this,o&&o.node,e),u=this.node.inlineContent,d=u&&this.node.isBlock;AC(this.node,this.innerDeco,(f,h,p)=>{f.spec.marks?c.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!p&&c.syncToMarks(h==this.node.childCount?En.none:this.node.child(h).marks,r,e,h),c.placeWidget(f,e,s)},(f,h,p,g)=>{c.syncToMarks(f.marks,r,e,g),d&&f.isAtom&&!f.isText&&c.addHackNode("IMG",c.top);let v;c.findNodeMatch(f,h,p,g)||a&&e.state.selection.from>s&&e.state.selection.to<s+f.nodeSize&&(v=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(f,h,p,v,e)||c.updateNextNode(f,h,p,e,g,s)||c.addNode(f,h,p,e,s),s+=f.nodeSize,u&&(d=f.isAtom&&!f.isText)}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Vo)&&(o&&this.protectLocalComposition(e,o),Mb(this.contentDOM,this.children,e),Ua&&RC(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof et)||r<t||s>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=PC(this.node.content,o,r-t,s-t);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new _C(this,i,t,s);e.input.compositionNodes.push(o),this.children=df(this.children,r,r+s.length,e,o)}update(e,t,r,s){return this.dirty==ci||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Xs}updateOuterDeco(e){if(Kc(e,this.outerDeco))return;let t=!kt(this.nodeDOM),r=this.dom;this.dom=Tb(this.dom,this.nodeDOM,uf(this.outerDeco,this.node,t),uf(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){kt(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){kt(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function og(n,e,t,r,s){Eb(r,e,n);let i=new yo(void 0,n,e,t,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class Du extends yo{constructor(e,t,r,s,i,o){super(e,t,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,s){return this.dirty==ci||this.dirty!=Xs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Xs||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Xs,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let s=this.node.cut(e,t),i=document.createTextNode(s.text);return new Du(this.parent,s,this.outerDeco,this.innerDeco,i,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ci)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Cb extends Ql{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class SC extends yo{constructor(e,t,r,s,i,o,a,c){super(e,t,r,s,i,o,a),this.spec=c}update(e,t,r,s){if(this.dirty==ci)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Mb(n,e,t){let r=n.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=ag(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(a,r);if(o instanceof bo){let c=r?r.previousSibling:n.lastChild;Mb(o.contentDOM,o.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=ag(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const wl=function(n){n&&(this.nodeName=n)};wl.prototype=Object.create(null);const Wo=[new wl];function uf(n,e,t){if(n.length==0)return Wo;let r=t?Wo[0]:new wl,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new wl(o.nodeName));for(let a in o){let c=o[a];c!=null&&(t&&s.length==1&&s.push(r=new wl(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return s}function Tb(n,e,t,r){if(t==Wo&&r==Wo)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=t[i];if(i){let c;a&&a.nodeName==o.nodeName&&s!=n&&(c=s.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(s),a=Wo[0]),s=c}CC(s,a||Wo[0],o)}return s}function CC(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&n.classList.add(s[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function Eb(n,e,t){return Tb(n,n,Wo,uf(e,t,!kt(n)))}function Kc(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function ag(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class MC{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=TC(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,s){let i=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Xs,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,u=this.top.children.length;s<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){c=d;break}}if(c<0&&this.index<this.top.children.length){let d=this.top.children[this.index];d instanceof bo&&d.dirty!=ci&&d.mark.type==e[o].type&&d.spec.update&&!this.isLocked(d.dom)&&d.spec.update(e[o])&&(d.mark=e[o],c=this.index,this.changed=!0)}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=bo.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let u=this.top.children[a];if(u.matchesNode(e,t,r)&&!this.preMatch.matched.has(u)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,s,i){let o=this.top.children[s];return o.dirty==ci&&o.dom==o.contentDOM&&(o.dirty=Vo),o.update(e,t,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=t}}updateNextNode(e,t,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof yo){let u=this.preMatch.matched.get(c);if(u!=null&&u!=i)return!1;let d=c.dom,f,h=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=ci&&Kc(t,c.outerDeco));if(!h&&c.update(e,t,r,s))return this.destroyBetween(this.index,a),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,t,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Vo,f.updateChildren(s,o+1),f.dirty=Xs),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Kc(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=yo.create(this.top,t,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,t,r,s,i){let o=yo.create(this.top,e,t,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new Sb(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof bo;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Du)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Yr||jr)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new Cb(this.top,[],r,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||kt(e)&&e.contains(this.lock.parentNode))}}function TC(n,e){let t=e,r=t.children.length,s=n.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let u=t.children[r-1];if(u instanceof bo)t=u,r=u.children.length;else{a=u,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function EC(n,e){return n.type.side-e.type.side}function AC(n,e,t,r){let s=e.locals(n),i=0;if(s.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);r(d,s,e.forChild(i,d),u),i+=d.nodeSize}return}let o=0,a=[],c=null;for(let u=0;;){let d,f;for(;o<s.length&&s[o].to==i;){let m=s[o++];m.widget&&(d?(f||(f=[d])).push(m):d=m)}if(d)if(f){f.sort(EC);for(let m=0;m<f.length;m++)t(f[m],u,!!c)}else t(d,u,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(u<n.childCount)p=u,h=n.child(u++);else break;for(let m=0;m<a.length;m++)a[m].to<=i&&a.splice(m--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let g=i+h.nodeSize;if(h.isText){let m=g;o<s.length&&s[o].from<m&&(m=s[o].from);for(let S=0;S<a.length;S++)a[S].to<m&&(m=a[S].to);m<g&&(c=h.cut(m-i),h=h.cut(0,m-i),g=m,p=-1)}else for(;o<s.length&&s[o].to<g;)o++;let v=h.isInline&&!h.isLeaf?a.filter(m=>!m.inline):a.slice();r(h,v,e.forChild(i,h),p),i=g}}function RC(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function PC(n,e,t,r){for(let s=0,i=0;s<n.childCount&&i<=r;){let o=n.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let c=o.text;for(;s<n.childCount;){let u=n.child(s++);if(i+=u.nodeSize,!u.isText)break;c+=u.text}if(i>=t){if(i>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?c.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=t)return a+u;if(t==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function df(n,e,t,r,s){let i=[];for(let o=0,a=0;o<n.length;o++){let c=n[o],u=a,d=a+=c.size;u>=t||d<=e?i.push(c):(u<e&&i.push(c.slice(0,e-u,r)),s&&(i.push(s),s=void 0),d>t&&i.push(c.slice(t-u,c.size,r)))}return i}function hh(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),c,u;if(Ou(t)){for(c=o;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&vt.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&sC(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;u=new vt(o==f?a:r.resolve(f))}else if(Ds&&e=="key"&&o>n.state.selection.to&&kt(t.focusNode)&&t.focusOffset==t.focusNode.childNodes.length&&s&&s.posAtStart>n.state.selection.to)for(let f=t.focusNode;;f=f.parentNode){if(getComputedStyle(f).overflow!="visible"){u=jt.findFrom(r.resolve(s.posAtStart),1);break}if(f==s.dom||f.nextSibling||!f.parentNode||!kt(f.parentNode))break}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,h=o;for(let p=0;p<t.rangeCount;p++){let g=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(g.startContainer,g.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(f<0)return null;[c,o]=h==n.state.selection.anchor?[h,f]:[f,h],a=r.resolve(o)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!u){let f=e=="pointer"||n.state.selection.head<a.pos&&!i?1:-1;u=ph(n,d,a,f)}return u}function Ab(n){return n.editable?n.hasFocus():Pb(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function zi(n,e=!1){let t=n.state.selection;if(Rb(n,t),!Ab(n))return;let r=n.input.mouseDown;if(!e&&jr&&r){let s=n.domSelectionRange(),i=n.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&na(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)LC(n);else{let{anchor:s,head:i}=t,o,a;lg&&!(t instanceof et)&&(t.$from.parent.inlineContent||(o=cg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=cg(n,t.to))),n.docView.setSelection(s,i,n,e),lg&&(o&&ug(o),a&&ug(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&IC(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const lg=Yr||jr&&mb<63;function cg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Yr&&s&&s.contentEditable=="false")return bd(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return bd(s);if(i)return bd(i)}}function bd(n){return n.contentEditable="true",Yr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function ug(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function IC(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Ab(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function LC(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Vr(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Ts&&vo<=11&&(t.disabled=!0,t.disabled=!1)}function Rb(n,e){if(e instanceof vt){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(dg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else dg(n)}function dg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ph(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||et.between(e,t,r)}function fg(n){return n.editable&&!n.hasFocus()?!1:Pb(n)}function Pb(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return ra(n.dom,e.anchorNode)&&(n.editable||ra(n.dom,e.focusNode))}catch{return!1}}function OC(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return na(e.node,e.offset,t.anchorNode,t.anchorOffset)}function ff(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&jt.findFrom(i,e)}function oo(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function hg(n,e,t){let r=n.state.selection;if(r instanceof et)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return oo(n,new et(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=ff(n.state,e);return s&&s instanceof vt?oo(n,s):!1}else if(!(qs&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?vt.isSelectable(i)?oo(n,new vt(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):oo(n,new et(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof vt&&r.node.isInline)return oo(n,new et(e>0?r.$to:r.$from));{let s=ff(n.state,e);return s?oo(n,s):!1}}}function xl(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):kt(n)&&n.contentEditable=="false"}function _a(n,e){return e<0?NC(n):DC(n)}function NC(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Ds&&kt(t)&&r<Qr(t)&&xl(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!kt(t))break;let a=t.childNodes[r-1];if(xl(a,-1))s=t,i=--r;else if(wr(a))t=a,r=t.nodeValue.length;else break}else{if(Ib(t))break;{let a=t.previousSibling;for(;a&&xl(a,-1);)s=t.parentNode,i=Vr(a),a=a.previousSibling;if(a)t=a,r=Qr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?hf(n,t,r):s&&hf(n,s,i)}function DC(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Qr(t),i,o;for(;;)if(r<s){if(!kt(t))break;let a=t.childNodes[r];if(xl(a,1))i=t,o=++r;else break}else{if(Ib(t))break;{let a=t.nextSibling;for(;a&&xl(a,1);)i=a.parentNode,o=Vr(a)+1,a=a.nextSibling;if(a)t=a,r=0,s=Qr(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&hf(n,i,o)}function Ib(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function $C(n,e){for(;n&&e==n.childNodes.length&&!Xl(n);)e=Vr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(wr(t))return t;if(kt(t)&&t.contentEditable=="false")break;n=t,e=0}}function BC(n,e){for(;n&&!e&&!Xl(n);)e=Vr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(wr(t))return t;if(kt(t)&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function hf(n,e,t){if(!wr(e)){let i,o;(o=$C(e,t))?(e=o,t=0):(i=BC(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ou(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&zi(n)},50)}function pg(n,e){let t=n.state.doc.resolve(e);if(!(jr||vb)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function gg(n,e,t){let r=n.state.selection;if(r instanceof et&&!r.empty||t.indexOf("s")>-1||qs&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=ff(n.state,e);if(o&&o instanceof vt)return oo(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Ns?jt.near(o,e):jt.findFrom(o,e);return a?oo(n,a):!1}return!1}function mg(n,e){if(!(n.state.selection instanceof et))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function vg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function zC(n){if(!Yr||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&kt(e)&&t==0&&e.firstChild&&kt(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;vg(n,r,"true"),setTimeout(()=>vg(n,r,"false"),20)}return!1}function FC(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function HC(n,e){let t=e.keyCode,r=FC(e);if(t==8||qs&&t==72&&r=="c")return mg(n,-1)||_a(n,-1);if(t==46&&!e.shiftKey||qs&&t==68&&r=="c")return mg(n,1)||_a(n,1);if(t==13||t==27)return!0;if(t==37||qs&&t==66&&r=="c"){let s=t==37?pg(n,n.state.selection.from)=="ltr"?-1:1:-1;return hg(n,s,r)||_a(n,s)}else if(t==39||qs&&t==70&&r=="c"){let s=t==39?pg(n,n.state.selection.from)=="ltr"?1:-1:1;return hg(n,s,r)||_a(n,s)}else{if(t==38||qs&&t==80&&r=="c")return gg(n,-1,r)||_a(n,-1);if(t==40||qs&&t==78&&r=="c")return zC(n)||gg(n,1,r)||_a(n,1);if(r==(qs?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function gh(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||aa.fromSchema(n.state.schema),a=Bb(),c=a.createElement("div");c.appendChild(o.serializeFragment(r,{document:a}));let u=c.firstChild,d,f=0;for(;u&&kt(u)&&(d=$b[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let g=a.createElement(d[p]);for(;c.firstChild;)g.appendChild(c.firstChild);c.appendChild(g),f++}u=c.firstChild}u&&kt(u)&&u.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
8
+ `))}})}function bS(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function yS(n,e,t,r,s){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let o=t.create(r,null,s||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,o);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Pr(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new He(_e.from(o),0,0),1,!0))}function Bi(n,e,t=1,r){let s=n.resolve(e),i=s.depth-t,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,d=t-2;u>i;u--,d--){let f=s.node(u),h=s.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),g=r&&r[d+1];g&&(p=p.replaceChild(0,g.type.create(g.attrs)));let v=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!v.type.validContent(p))return!1}let a=s.indexAfter(i),c=r&&r[0];return s.node(i).canReplaceWith(a,a,c?c.type:s.node(i+1).type)}function wS(n,e,t=1,r){let s=n.doc.resolve(e),i=_e.empty,o=_e.empty;for(let a=s.depth,c=s.depth-t,u=t-1;a>c;a--,u--){i=_e.from(s.node(a).copy(i));let d=r&&r[u];o=_e.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}n.step(new sr(e,e,new He(i.append(o),t,t),!0))}function Co(n,e){let t=n.resolve(e),r=t.index();return Gv(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function xS(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Gv(n,e){return!!(n&&e&&!n.isLeaf&&xS(n,e))}function Pu(n,e,t=-1){let r=n.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):t>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&Gv(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=t<0?r.before(s):r.after(s)}}function kS(n,e,t){let r=null,{linebreakReplacement:s}=n.doc.type.schema,i=n.doc.resolve(e-t),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",f=!!o.contentMatch.matchType(s);d&&!f?r=!1:!d&&f&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);jv(n,d.node(),d.before(),a)}o.inlineContent&&ih(n,e+t-1,o,i.node().contentMatchAt(i.index()),r==null);let c=n.mapping.slice(a),u=c.map(e-t);if(n.step(new sr(u,c.map(e+t,-1),He.empty,!0)),r===!0){let d=n.doc.resolve(u);Kv(n,d.node(),d.before(),n.steps.length)}return n}function _S(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,t))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,t))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function qv(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(a>0?1:0),u=r.node(o),d=!1;if(i==1)d=u.canReplace(c,c,s);else{let f=u.contentMatchAt(c).findWrapping(s.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Iu(n,e,t=e,r=He.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return Jv(s,i,r)?new sr(e,t,r):new SS(s,i,r).fit()}function Jv(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class SS{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=_e.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=_e.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let c=new He(i,o,a);return e>-1?new Pr(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new sr(r.pos,s.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=Wp(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:u}=this.frontier[a],d,f=null;if(t==1&&(o?u.matchType(o.type)||(f=u.fillBefore(_e.from(o),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:f};if(t==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced;return Kp(e,-1)<=t?!1:(this.unplaced.size>1&&Kp(e,1)>r&&r++,this.unplaced=new He(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=Wp(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new He(ul(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new He(ul(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:s,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let v=0;v<i.length;v++)this.openFrontierNode(i[v]);let o=this.unplaced,a=r?r.content:o.content,c=o.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(s){for(let v=0;v<s.childCount;v++)d.push(s.child(v));f=f.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let v=a.child(u),m=f.matchType(v.type);if(!m)break;u++,(u>1||c==0||v.content.size)&&(f=m,d.push(Xv(v.mark(h.allowedMarks(v.marks)),u==1?c:0,u==a.childCount?p:-1)))}let g=u==a.childCount;g||(p=-1),this.placed=dl(this.placed,t,_e.from(d)),this.frontier[t].match=f,g&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,m=a;v<p;v++){let S=m.lastChild;this.frontier.push({type:S.type,match:S.contentMatchAt(S.childCount)}),m=S.content}this.unplaced=g?e==0?He.empty:new He(ul(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new He(ul(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!hd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:s}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=hd(e,t,s,r,i);if(o){for(let a=t-1;a>=0;a--){let{match:c,type:u}=this.frontier[a],d=hd(e,a,u,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=dl(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,t=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=dl(this.placed,this.depth,_e.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(_e.empty,!0);t.childCount&&(this.placed=dl(this.placed,this.frontier.length,t))}}function ul(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ul(n.firstChild.content,e-1,t)))}function dl(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(dl(n.lastChild.content,e-1,t)))}function Wp(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Xv(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Xv(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(_e.empty,!0)))),n.copy(r)}function hd(n,e,t,r,s){let i=n.node(e),o=s?n.indexAfter(e):n.index(e);if(o==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!CS(t,i.content,o)?a:null}function CS(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function MS(n){return n.spec.defining||n.spec.definingForContent}function Kp(n,e){for(let t=0;;t++){let r=e<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return t;n=r.content}}function TS(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(Jv(s,i,r))return n.step(new sr(e,t,r));let o=Qv(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,p=s.pos-1;h>0;h--,p--){let g=s.node(h).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==p&&o.splice(1,0,-h)}let c=o.indexOf(a),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let g=h.firstChild;if(u.push(g),p==r.openStart)break;h=g.content}for(let h=d-1;h>=0;h--){let p=u[h],g=MS(p.type);if(g&&!p.sameMarkup(s.node(Math.abs(a)-1)))d=h;else if(g||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),g=u[p];if(g)for(let v=0;v<o.length;v++){let m=o[(v+c)%o.length],S=!0;m<0&&(S=!1,m=-m);let I=s.node(m-1),C=s.index(m-1);if(I.canReplaceWith(C,C,g.type,g.marks))return n.replace(s.before(m),S?i.after(m):t,new He(Yv(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=o[h];p<0||(e=s.before(p),t=i.after(p))}}function Yv(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Yv(i.content,e+1,t,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(n).append(n);n=o.append(i.matchFragment(o).fillBefore(_e.empty,!0))}return n}function ES(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=_S(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new He(_e.from(r),0,0))}function AS(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(t),a=!1;for(let c=r.depth;c>o;c--)r.node(c).type.spec.isolating&&(a=!0);for(let c=s.depth;c>o;c--)s.node(c).type.spec.isolating&&(a=!0);if(!a){for(let c=r.depth;c>0&&e==r.start(c);c--)e=r.before(c);for(let c=s.depth;c>0&&t==s.start(c);c--)t=s.before(c);r=n.doc.resolve(e),s=n.doc.resolve(t)}}let i=Qv(r,s);for(let o=0;o<i.length;o++){let a=i[o],c=o==i.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),s.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return n.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&s.end(o)-t!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function Qv(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let i=n.start(s);if(i<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&t.push(s)}return t}class La extends Zr{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return hr.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return hr.fromReplace(e,this.pos,this.pos+1,new He(_e.from(s),0,t.isLeaf?0:1))}getMap(){return Os.empty}invert(e){return new La(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new La(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new La(t.pos,t.attr,t.value)}}Zr.jsonID("attr",La);class Dl extends Zr{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return hr.ok(r)}getMap(){return Os.empty}invert(e){return new Dl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Dl(t.attr,t.value)}}Zr.jsonID("docAttr",Dl);let za=class extends Error{};za=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};za.prototype=Object.create(Error.prototype);za.prototype.constructor=za;za.prototype.name="TransformError";class Zv{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Nl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new za(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),t=s.map(t,-1)),s.forEach((i,o,a,c)=>{e=Math.min(e,a),t=Math.max(t,c)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=He.empty){let s=Iu(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new He(_e.from(r),0,0))}delete(e,t){return this.replace(e,t,He.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return TS(this,e,t,r),this}replaceRangeWith(e,t,r){return ES(this,e,t,r),this}deleteRange(e,t){return AS(this,e,t),this}lift(e,t){return hS(this,e,t),this}join(e,t=1){return kS(this,e,t),this}wrap(e,t){return mS(this,e,t),this}setBlockType(e,t=e,r,s=null){return vS(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return yS(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new La(e,t,r)),this}setDocAttribute(e,t){return this.step(new Dl(e,t)),this}addNodeMark(e,t){return this.step(new po(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof En)t.isInSet(r.marks)&&this.step(new ta(e,t));else{let s=r.marks,i,o=[];for(;i=t.isInSet(s);)o.push(new ta(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return wS(this,e,t,r),this}addMark(e,t,r){return uS(this,e,t,r),this}removeMark(e,t,r){return dS(this,e,t,r),this}clearIncompatible(e,t,r){return ih(this,e,t,r),this}}const pd=Object.create(null);class jt{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new RS(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=He.empty){let r=t.content.lastChild,s=null;for(let a=0;a<t.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:c,$to:u}=o[a],d=e.mapping.slice(i);e.replaceRange(d.map(c.pos),d.map(u.pos),a?He.empty:t),a==0&&qp(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],c=e.mapping.slice(r),u=c.map(o.pos),d=c.map(a.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),qp(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new et(e):Ea(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?Ea(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Ea(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ns(e.node(0))}static atStart(e){return Ea(e,e,0,0,1)||new Ns(e)}static atEnd(e){return Ea(e,e,e.content.size,e.childCount,-1)||new Ns(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=pd[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in pd)throw new RangeError("Duplicate use of selection JSON ID "+e);return pd[e]=t,t.prototype.jsonID=e,t}getBookmark(){return et.between(this.$anchor,this.$head).getBookmark()}}jt.prototype.visible=!0;class RS{constructor(e,t){this.$from=e,this.$to=t}}let jp=!1;function Gp(n){!jp&&!n.parent.inlineContent&&(jp=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class et extends jt{constructor(e,t=e){Gp(e),Gp(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return jt.near(r);let s=e.resolve(t.map(this.anchor));return new et(s.parent.inlineContent?s:r,r)}replace(e,t=He.empty){if(super.replace(e,t),t==He.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof et&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Lu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new et(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=jt.findFrom(t,r,!0)||jt.findFrom(t,-r,!0);if(i)t=i.$head;else return jt.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(jt.findFrom(e,-r,!0)||jt.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new et(e,t)}}jt.jsonID("text",et);class Lu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Lu(e.map(this.anchor),e.map(this.head))}resolve(e){return et.between(e.resolve(this.anchor),e.resolve(this.head))}}class vt extends jt{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?jt.near(i):new vt(i)}content(){return new He(_e.from(this.node),0,0)}eq(e){return e instanceof vt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ah(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new vt(e.resolve(t.anchor))}static create(e,t){return new vt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}vt.prototype.visible=!1;jt.jsonID("node",vt);class ah{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Lu(r,r):new ah(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&vt.isSelectable(r)?new vt(t):jt.near(t)}}class Ns extends jt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=He.empty){if(t==He.empty){e.delete(0,e.doc.content.size);let r=jt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ns(e)}map(e){return new Ns(e)}eq(e){return e instanceof Ns}getBookmark(){return PS}}jt.jsonID("all",Ns);const PS={map(){return this},resolve(n){return new Ns(n)}};function Ea(n,e,t,r,s,i=!1){if(e.inlineContent)return et.create(n,t);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&vt.isSelectable(a))return vt.create(n,t-(s<0?a.nodeSize:0))}else{let c=Ea(n,a,t+s,s<0?a.childCount:0,s,i);if(c)return c}t+=a.nodeSize*s}return null}function qp(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof sr||s instanceof Pr))return;let i=n.mapping.maps[r],o;i.forEach((a,c,u,d)=>{o==null&&(o=d)}),n.setSelection(jt.near(n.doc.resolve(o),t))}const Jp=1,uc=2,Xp=4;class IS extends Zv{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Jp)&~uc,this.storedMarks=null,this}get selectionSet(){return(this.updated&Jp)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=uc,this}ensureMarks(e){return En.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&uc)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~uc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||En.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(t);i=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(jt.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Xp,this}get scrolledIntoView(){return(this.updated&Xp)>0}}function Yp(n,e){return!e||!n?n:n.bind(e)}class fl{constructor(e,t,r){this.name=e,this.init=Yp(t.init,r),this.apply=Yp(t.apply,r)}}const LS=[new fl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new fl("selection",{init(n,e){return n.selection||jt.atStart(e.doc)},apply(n){return n.selection}}),new fl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new fl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class gd{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=LS.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new fl(r.key,r.spec.state,r))})}}class Uo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let c=s?s[o].n:0,u=s?s[o].state:this,d=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,u,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let f=0;f<this.config.plugins.length;f++)s.push(f<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),i=!0}s&&(s[o]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Uo(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new IS(this)}static create(e){let t=new gd(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Uo(t);for(let s=0;s<t.fields.length;s++)r[t.fields[s].name]=t.fields[s].init(e,r);return r}reconfigure(e){let t=new gd(this.schema,e.plugins),r=t.fields,s=new Uo(t);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new gd(e.schema,e.plugins),i=new Uo(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=go.fromJSON(e.schema,t.doc);else if(o.name=="selection")i.selection=jt.fromJSON(i.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[o.name]=u.fromJSON.call(c,e,t[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function eb(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=eb(s,e,{})),t[r]=s}return t}class kn{constructor(e){this.spec=e,this.props={},e.props&&eb(e.props,this,this.props),this.key=e.key?e.key.key:tb("plugin")}getState(e){return e[this.key]}}const md=Object.create(null);function tb(n){return n in md?n+"$"+ ++md[n]:(md[n]=0,n+"$")}class Dn{constructor(e="key"){this.key=tb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const nb=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function rb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const sb=(n,e,t)=>{let r=rb(n,t);if(!r)return!1;let s=lh(r);if(!s){let o=r.blockRange(),a=o&&qa(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(hb(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Fa(i,"end")||vt.isSelectable(i)))for(let o=r.depth;;o--){let a=Iu(n.doc,r.before(o),r.after(o),He.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Fa(i,"end")?jt.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):vt.create(c.doc,s.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},OS=(n,e,t)=>{let r=rb(n,t);if(!r)return!1;let s=lh(r);return s?ib(n,s,e):!1},NS=(n,e,t)=>{let r=ab(n,t);if(!r)return!1;let s=ch(r);return s?ib(n,s,e):!1};function ib(n,e,t){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,a=o,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let u=Iu(n.doc,i,c,He.empty);if(!u||u.from!=i||u instanceof sr&&u.slice.size>=c-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(et.create(d.doc,i)),t(d.scrollIntoView())}return!0}function Fa(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const ob=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=lh(r)}let o=i&&i.nodeBefore;return!o||!vt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(vt.create(n.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function lh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function ab(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const lb=(n,e,t)=>{let r=ab(n,t);if(!r)return!1;let s=ch(r);if(!s)return!1;let i=s.nodeAfter;if(hb(n,s,e,1))return!0;if(r.parent.content.size==0&&(Fa(i,"start")||vt.isSelectable(i))){let o=Iu(n.doc,r.before(),r.after(),He.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Fa(i,"start")?jt.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):vt.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},cb=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=ch(r)}let o=i&&i.nodeAfter;return!o||!vt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(vt.create(n.doc,i.pos)).scrollIntoView()),!0)};function ch(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const DS=(n,e)=>{let t=n.selection,r=t instanceof vt,s;if(r){if(t.node.isTextblock||!Co(n.doc,t.from))return!1;s=t.from}else if(s=Pu(n.doc,t.from,-1),s==null)return!1;if(e){let i=n.tr.join(s);r&&i.setSelection(vt.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},$S=(n,e)=>{let t=n.selection,r;if(t instanceof vt){if(t.node.isTextblock||!Co(n.doc,t.to))return!1;r=t.to}else if(r=Pu(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},BS=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&qa(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},ub=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
9
+ `).scrollIntoView()),!0)};function uh(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const zS=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let s=t.node(-1),i=t.indexAfter(-1),o=uh(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,o.createAndFill());c.setSelection(jt.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},db=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof Ns||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=uh(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=n.tr.insert(o,i.createAndFill());a.setSelection(et.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},fb=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Bi(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&qa(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function FS(n){return(e,t)=>{if(e.selection instanceof vt&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!Bi(e.doc,p.pos)?!1:(t&&t(e.tr.split(p.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof et||e.selection instanceof Ns)&&r.deleteSelection();let{$from:s}=r.selection,i=r.steps.length,o=[],a,c,u=!1,d=!1;for(let p=s.depth;;p--)if(s.node(p).isBlock){u=s.end(p)==s.pos+(s.depth-p),d=s.start(p)==s.pos-(s.depth-p),c=uh(s.node(p-1).contentMatchAt(s.indexAfter(p-1))),o.unshift(u&&c?{type:c}:null),a=p;break}else{if(p==1)return!1;o.unshift(null)}let f=s.pos,h=Bi(r.doc,f,o.length,o);if(h||(o[0]=c?{type:c}:null,h=Bi(r.doc,f,o.length,o)),!h)return!1;if(r.split(f,o.length,o),!u&&d&&s.node(a).type!=c){let p=r.mapping.slice(i),g=p.map(s.before(a)),v=r.doc.resolve(g);c&&s.node(a-1).canReplaceWith(v.index(),v.index()+1,c)&&r.setNodeMarkup(p.map(s.before(a)),c)}return t&&t(r.scrollIntoView()),!0}}const HS=FS(),US=(n,e)=>{let{$from:t,to:r}=n.selection,s,i=t.sharedDepth(r);return i==0?!1:(s=t.before(i),e&&e(n.tr.setSelection(vt.create(n.doc,s))),!0)};function VS(n,e,t){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Co(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function hb(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,c=s.type.spec.isolating||i.type.spec.isolating;if(!c&&VS(n,e,t))return!0;let u=!c&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(t){let p=e.pos+i.nodeSize,g=_e.empty;for(let S=o.length-1;S>=0;S--)g=_e.from(o[S].create(null,g));g=_e.from(s.copy(g));let v=n.tr.step(new Pr(e.pos-1,p,e.pos,p,new He(g,1,0),o.length,!0)),m=v.doc.resolve(p+2*o.length);m.nodeAfter&&m.nodeAfter.type==s.type&&Co(v.doc,m.pos)&&v.join(m.pos),t(v.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&c?null:jt.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&qa(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&Fa(i,"start",!0)&&Fa(s,"end")){let p=s,g=[];for(;g.push(p),!p.isTextblock;)p=p.lastChild;let v=i,m=1;for(;!v.isTextblock;v=v.firstChild)m++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(t){let S=_e.empty;for(let C=g.length-1;C>=0;C--)S=_e.from(g[C].copy(S));let I=n.tr.step(new Pr(e.pos-g.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new He(S,g.length,0),0,!0));t(I.scrollIntoView())}return!0}}return!1}function pb(n){return function(e,t){let r=e.selection,s=n<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(t&&t(e.tr.setSelection(et.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const WS=pb(-1),KS=pb(1);function jS(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i),a=o&&oh(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Qp(n,e=null){return function(t,r){let s=!1;for(let i=0;i<t.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[i];t.doc.nodesBetween(o,a,(c,u)=>{if(s)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)s=!0;else{let d=t.doc.resolve(u),f=d.index();s=d.parent.canReplaceWith(f,f+1,n)}})}if(!s)return!1;if(r){let i=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[o];i.setBlockType(a,c,n,e)}r(i.scrollIntoView())}return!0}}function dh(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}dh(nb,sb,ob);dh(nb,lb,cb);dh(ub,db,fb,HS);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function GS(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i);if(!o)return!1;let a=r?t.tr:null;return qS(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function qS(n,e,t,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=o.resolve(e.start-2);i=new Vc(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Vc(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=oh(i,t,r,e);return a?(n&&JS(n,e,a,s,t),!0):!1}function JS(n,e,t,r,s){let i=_e.empty;for(let d=t.length-1;d>=0;d--)i=_e.from(t[d].type.create(t[d].attrs,i));n.step(new Pr(e.start-(r?2:0),e.end,e.start,e.end,new He(i,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==s&&(o=d+1);let a=t.length-o,c=e.start+t.length-(r?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&Bi(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return n}function XS(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?YS(e,t,n,i):QS(e,t,i):!0:!1}}function YS(n,e,t,r){let s=n.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Pr(i-1,o,i,o,new He(_e.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Vc(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=qa(r);if(a==null)return!1;s.lift(r,a);let c=s.doc.resolve(s.mapping.map(i,-1)-1);return Co(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),e(s.scrollIntoView()),!0}function QS(n,e,t){let r=n.tr,s=t.parent;for(let p=t.end,g=t.endIndex-1,v=t.startIndex;g>v;g--)p-=s.child(g).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(t.start),o=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==s.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(a?0:1),d+1,o.content.append(c?_e.empty:_e.from(s))))return!1;let f=i.pos,h=f+o.nodeSize;return r.step(new Pr(f-(a?1:0),h+(c?1:0),f+1,h-1,new He((a?_e.empty:_e.from(s.copy(_e.empty))).append(c?_e.empty:_e.from(s.copy(_e.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function ZS(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==n);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,c=a.child(o-1);if(c.type!=n)return!1;if(t){let u=c.lastChild&&c.lastChild.type==a.type,d=_e.from(u?n.create():null),f=new He(_e.from(n.create(null,_e.from(a.type.create(null,d)))),u?3:1,0),h=i.start,p=i.end;t(e.tr.step(new Pr(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const Vr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ha=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let sf=null;const Ni=function(n,e,t){let r=sf||(sf=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},eC=function(){sf=null},na=function(n,e,t,r){return t&&(Zp(n,e,t,r,-1)||Zp(n,e,t,r,1))},tC=/^(img|br|input|textarea|hr)$/i;function Zp(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:Yr(n))){let o=n.parentNode;if(!o||!kt(o)||Xl(n)||tC.test(n.nodeName)||n.contentEditable=="false")return!1;e=Vr(n)+(s<0?0:1),n=o}else if(kt(n)){let o=n.childNodes[e+(s<0?-1:0)];if(kt(o)&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?Yr(n):0}else return!1}}function Yr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function kt(n){return n.nodeType==1}function wr(n){return n.nodeType==3}function ra(n,e){return e?n.contains(kt(e)?e:e.parentNode):!1}function nC(n,e){for(;;){if(wr(n)&&e)return n;if(kt(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Yr(n)}else if(n.parentNode&&!Xl(n))e=Vr(n),n=n.parentNode;else return null}}function rC(n,e){for(;;){if(wr(n)&&e<n.nodeValue.length)return n;if(kt(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Xl(n))e=Vr(n)+1,n=n.parentNode;else return null}}function sC(n,e,t){for(let r=e==0,s=e==Yr(n);r||s;){if(n==t)return!0;let i=Vr(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==Yr(n)}}function Xl(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ou=function(n){return n.focusNode&&na(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function zo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function iC(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function oC(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Yr(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Yr(r.startContainer),r.startOffset)}}}const wi=typeof navigator<"u"?navigator:null,eg=typeof document<"u"?document:null,Mo=wi&&wi.userAgent||"",of=/Edge\/(\d+)/.exec(Mo),gb=/MSIE \d/.exec(Mo),af=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mo),Ts=!!(gb||af||of),vo=gb?document.documentMode:af?+af[1]:of?+of[1]:0,Ds=!Ts&&/gecko\/(\d+)/i.test(Mo);Ds&&+(/Firefox\/(\d+)/.exec(Mo)||[0,0])[1];const lf=!Ts&&/Chrome\/(\d+)/.exec(Mo),jr=!!lf,mb=lf?+lf[1]:0,Qr=!Ts&&!!wi&&/Apple Computer/.test(wi.vendor),Ua=Qr&&(/Mobile\/\w+/.test(Mo)||!!wi&&wi.maxTouchPoints>2),qs=Ua||(wi?/Mac/.test(wi.platform):!1),vb=wi?/Win/.test(wi.platform):!1,Di=/Android \d/.test(Mo),Nu=!!eg&&"webkitFontSmoothing"in eg.documentElement.style,aC=Nu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function lC(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ai(n,e){return typeof n=="number"?n:n[e]}function cC(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function tg(n,e,t){if(!cf(e)&&e.left==0)return;let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(!kt(o)){o=Ha(o);continue}let a=o==i.body,c=a?lC(i):cC(o),u=0,d=0;if(e.top<c.top+Ai(r,"top")?d=-(c.top-e.top+Ai(s,"top")):e.bottom>c.bottom-Ai(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ai(s,"top")-c.top:e.bottom-c.bottom+Ai(s,"bottom")),e.left<c.left+Ai(r,"left")?u=-(c.left-e.left+Ai(s,"left")):e.right>c.right-Ai(r,"right")&&(u=e.right-c.right+Ai(s,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=o.scrollLeft,p=o.scrollTop;d&&(o.scrollTop+=d),u&&(o.scrollLeft+=u);let g=o.scrollLeft-h,v=o.scrollTop-p;e={left:e.left-g,top:e.top-v,right:e.right-g,bottom:e.bottom-v}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Ha(o)}}function uC(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(i,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,s=c.top;break}}return{refDOM:r,refTop:s,stack:bb(n.dom)}}function bb(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Ha(r));return e}function dC({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;yb(t,r==0?0:r-e)}function yb(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:i}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let ka=null;function fC(n){if(n.setActive)return n.setActive();if(ka)return n.focus(ka);let e=bb(n);n.focus(ka==null?{get preventScroll(){return ka={preventScroll:!0},!0}}:void 0),ka||(ka=!1,yb(e,0))}function wb(n,e){let t,r=2e8,s,i=0,o=e.top,a=e.top,c,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(kt(d))h=d.getClientRects();else if(wr(d))h=Ni(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let g=h[p];if(g.top<=o&&g.bottom>=a){o=Math.max(g.bottom,o),a=Math.min(g.top,a);let v=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(v<r){t=d,r=v,s=v&&wr(t)?{left:g.right<e.left?g.right:g.left,top:e.top}:e,kt(d)&&v&&(i=f+(e.left>=(g.left+g.right)/2?1:0));continue}}else g.top>e.top&&!c&&g.left<=e.left&&g.right>=e.left&&(c=d,u={left:Math.max(g.left,Math.min(g.right,e.left)),top:g.top});!t&&(e.left>=g.right&&e.top>=g.top||e.left>=g.left&&e.top>=g.bottom)&&(i=f+1)}}return!t&&c&&(t=c,s=u,r=0),t&&wr(t)?hC(t,s):!t||r?{node:n,offset:i}:wb(t,s)}function hC(n,e){let t=n.nodeValue.length,r=document.createRange(),s;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=so(r,1);if(o.top!=o.bottom&&fh(e,o)){s={node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:n,offset:0}}function fh(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function pC(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function gC(n,e,t){let{node:r,offset:s}=wb(e,t),i=-1;if(kt(r)&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,s,i)}function mC(n,e,t,r){let s=-1;for(let i=e,o=!1;i!=n.dom;){let a=n.docView.nearestDesc(i,!0),c;if(!a)return null;if(kt(a.dom)&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&c.left>r.left||c.top>r.top?s=a.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function xb(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=s;;){let o=n.childNodes[i];if(kt(o)){let a=o.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(fh(e,u))return xb(o,e,u)}}if((i=(i+1)%r)==s)break}return n}function vC(n,e){let t=n.dom.ownerDocument,r,s=0,i=oC(t,e.left,e.top);i&&({node:r,offset:s}=i);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o)){let u=n.dom.getBoundingClientRect();if(!fh(e,u)||(o=xb(n.dom,e,u),!o))return null}if(Qr)for(let u=o;r&&u;u=Ha(u))u.draggable&&(r=void 0);if(o=pC(o,e),r){if(Ds&&kt(r)&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let d=r.childNodes[s],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&s++}let u;Nu&&s&&kt(r)&&kt(u=r.childNodes[s-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&kt(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(s==0||!kt(r)||r.childNodes[s-1].nodeName!="BR")&&(a=mC(n,r,s,e))}a==null&&(a=gC(n,o,e));let c=n.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function cf(n){return n.top<n.bottom||n.left<n.right}function so(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(cf(r))return r}return Array.prototype.find.call(t,cf)||n.getBoundingClientRect()}const bC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kb(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),o=Nu||Ds;if(wr(r))if(o&&(bC.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let c=so(Ni(r,s,s),t);if(Ds&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=so(Ni(r,s-1,s-1),-1);if(u.top==c.top){let d=so(Ni(r,s,s+1),-1);if(d.top!=c.top)return il(d,d.left<u.left)}}return c}else{let c=s,u=s,d=t<0?1:-1;return t<0&&!s?(u++,d=-1):t>=0&&s==r.nodeValue.length?(c--,d=1):t<0?c--:u++,il(so(Ni(r,c,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==Yr(r))){let c=r.childNodes[s-1];if(kt(c))return vd(c.getBoundingClientRect(),!1)}if(i==null&&s<Yr(r)){let c=r.childNodes[s];if(kt(c))return vd(c.getBoundingClientRect(),!0)}return vd(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==Yr(r))){let c=r.childNodes[s-1],u=wr(c)?Ni(c,Yr(c)-(o?0:1)):kt(c)&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return il(so(u,1),!1)}if(i==null&&s<Yr(r)){let c=r.childNodes[s];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?wr(c)?Ni(c,0,o?0:1):kt(c)?c:null:null;if(u)return il(so(u,-1),!0)}return il(so(wr(r)?Ni(r):r,-t),t>=0)}function il(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function vd(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function _b(n,e,t){let r=n.state,s=n.root.activeElement;r!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),s!=n.dom&&s&&s.focus()}}function yC(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return _b(n,e,()=>{let{node:i}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=kb(n,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let c;if(kt(a))c=a.getClientRects();else if(wr(a))c=Ni(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const wC=/[\u0590-\u08ac]/;function xC(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=n.domSelection();return a?!wC.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:o:_b(n,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:g,focusOffset:v}=n.domSelectionRange(),m=g&&!ra(p,g)||c==g&&u==v;try{a.collapse(d,f),c&&(c!=d||u!=f)&&a.extend&&a.extend(c,u)}catch{}return h!=null&&(a.caretBidiLevel=h),m}):r.pos==r.start()||r.pos==r.end()}let ng=null,rg=null,sg=!1;function kC(n,e,t){return ng==e&&rg==t?sg:(ng=e,rg=t,sg=t=="up"||t=="down"?yC(n,e,t):xC(n,e,t))}const Xs=0,ig=1,Vo=2,ci=3;class Yl{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=Xs,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let s=this.children[t];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&ra(this.contentDOM,e))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>Vr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!t||i.node))if(r&&(o=i.nodeDOM)&&!(kt(o)?ra(o,e):o==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let s=this.children[t],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,t);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof Cb||i instanceof Sb&&i.side>=0))break}if(t<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&t&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Vr(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Vr(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let c=this.children[a],u=o+c.size;if(s==-1&&e<=u){let d=o+c.border;if(e>=d&&t<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,d);e=o;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=Vr(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(u>t||a==this.children.length-1)){t=u;for(let d=a+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Vr(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(!kt(t)||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,s=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let p=0,g=0;p<this.children.length;p++){let v=this.children[p],m=g+v.size;if(i>g&&o<m)return v.setSelection(e-g-v.border,t-g-v.border,r,s);g=m}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),u=r.root.getSelection(),d=r.domSelectionRange(),f=!1;if((Ds||Qr)&&e==t){let{node:p,offset:g}=a;if(wr(p)){if(f=!!(g&&p.nodeValue[g-1]==`
10
+ `),f&&g==p.nodeValue.length)for(let v=p,m;v;v=v.parentNode){if(m=v.nextSibling){m.nodeName=="BR"&&(a=c={node:m.parentNode,offset:Vr(m)+1});break}let S=v.pmViewDesc;if(S&&S.node&&S.node.isBlock)break}}else{let v=p.childNodes[g-1];f=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Ds&&d.focusNode&&d.focusNode!=c.node&&kt(d.focusNode)){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||f&&Qr)&&na(a.node,a.offset,d.anchorNode,d.anchorOffset)&&na(c.node,c.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==t)&&!(f&&Ds)){u.collapse(a.node,a.offset);try{e!=t&&u.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>t){let g=a;a=c,c=g}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+i.border,c=o-i.border;if(e>=a&&t<=c){this.dirty=e==r||t==o?Vo:ig,e==a&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ci:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Vo:ci}r=o}this.dirty=Vo}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Vo:ig;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Sb extends Yl{constructor(e,t,r,s){let i,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let a=kt(o)?o:document.createElement("span");a!=o&&a.appendChild(o),a.hasAttribute("contenteditable")||(a.contentEditable="false"),a.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Xs&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class _C extends Yl{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class bo extends Yl{constructor(e,t,r,s,i){super(e,[],r,s),this.mark=t,this.spec=i}static create(e,t,r,s){let i=s.nodeViews[t.type.name],o=i&&i(t,s,r);return(!o||!o.dom)&&(o=aa.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new bo(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ci||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ci&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Xs){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xs}}slice(e,t,r){let s=bo.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;t<o&&(i=df(i,t,o,r)),e>0&&(i=df(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class yo extends Yl{constructor(e,t,r,s,i,o,a){super(e,[],i,o),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,t,r,s,i,o){let a=i.nodeViews[t.type.name],c,u=a&&a(t,i,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,s),d=u&&u.dom,f=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(!wr(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=aa.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Eb(d,r,t),u?c=new SC(e,t,r,s,d,f||null,h,u):t.isText?new Du(e,t,r,s,d,h):new yo(e,t,r,s,d,f||null,h)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){t.contentElement=s.dom.parentNode;break}}if(!t.contentElement){let r=e&&e.find(s=>kt(s)&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?t.contentElement=r:t.getContent=()=>_e.empty}}return t}matchesNode(e,t,r){return this.dirty==Xs&&e.eq(this.node)&&Kc(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,s=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,c=new MC(this,o&&o.node,e),u=this.node.inlineContent,d=u&&this.node.isBlock;AC(this.node,this.innerDeco,(f,h,p)=>{f.spec.marks?c.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!p&&c.syncToMarks(h==this.node.childCount?En.none:this.node.child(h).marks,r,e,h),c.placeWidget(f,e,s)},(f,h,p,g)=>{c.syncToMarks(f.marks,r,e,g),d&&f.isAtom&&!f.isText&&c.addHackNode("IMG",c.top);let v;c.findNodeMatch(f,h,p,g)||a&&e.state.selection.from>s&&e.state.selection.to<s+f.nodeSize&&(v=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(f,h,p,v,e)||c.updateNextNode(f,h,p,e,g,s)||c.addNode(f,h,p,e,s),s+=f.nodeSize,u&&(d=f.isAtom&&!f.isText)}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Vo)&&(o&&this.protectLocalComposition(e,o),Mb(this.contentDOM,this.children,e),Ua&&RC(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof et)||r<t||s>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=PC(this.node.content,o,r-t,s-t);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new _C(this,i,t,s);e.input.compositionNodes.push(o),this.children=df(this.children,r,r+s.length,e,o)}update(e,t,r,s){return this.dirty==ci||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Xs}updateOuterDeco(e){if(Kc(e,this.outerDeco))return;let t=!kt(this.nodeDOM),r=this.dom;this.dom=Tb(this.dom,this.nodeDOM,uf(this.outerDeco,this.node,t),uf(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){kt(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){kt(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function og(n,e,t,r,s){Eb(r,e,n);let i=new yo(void 0,n,e,t,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class Du extends yo{constructor(e,t,r,s,i,o){super(e,t,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,s){return this.dirty==ci||this.dirty!=Xs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Xs||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Xs,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let s=this.node.cut(e,t),i=document.createTextNode(s.text);return new Du(this.parent,s,this.outerDeco,this.innerDeco,i,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ci)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Cb extends Yl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class SC extends yo{constructor(e,t,r,s,i,o,a,c){super(e,t,r,s,i,o,a),this.spec=c}update(e,t,r,s){if(this.dirty==ci)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Mb(n,e,t){let r=n.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=ag(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(a,r);if(o instanceof bo){let c=r?r.previousSibling:n.lastChild;Mb(o.contentDOM,o.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=ag(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const wl=function(n){n&&(this.nodeName=n)};wl.prototype=Object.create(null);const Wo=[new wl];function uf(n,e,t){if(n.length==0)return Wo;let r=t?Wo[0]:new wl,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new wl(o.nodeName));for(let a in o){let c=o[a];c!=null&&(t&&s.length==1&&s.push(r=new wl(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return s}function Tb(n,e,t,r){if(t==Wo&&r==Wo)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=t[i];if(i){let c;a&&a.nodeName==o.nodeName&&s!=n&&(c=s.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(s),a=Wo[0]),s=c}CC(s,a||Wo[0],o)}return s}function CC(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&n.classList.add(s[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function Eb(n,e,t){return Tb(n,n,Wo,uf(e,t,!kt(n)))}function Kc(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function ag(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class MC{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=TC(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,s){let i=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Xs,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,u=this.top.children.length;s<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){c=d;break}}if(c<0&&this.index<this.top.children.length){let d=this.top.children[this.index];d instanceof bo&&d.dirty!=ci&&d.mark.type==e[o].type&&d.spec.update&&!this.isLocked(d.dom)&&d.spec.update(e[o])&&(d.mark=e[o],c=this.index,this.changed=!0)}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=bo.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let u=this.top.children[a];if(u.matchesNode(e,t,r)&&!this.preMatch.matched.has(u)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,s,i){let o=this.top.children[s];return o.dirty==ci&&o.dom==o.contentDOM&&(o.dirty=Vo),o.update(e,t,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=t}}updateNextNode(e,t,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof yo){let u=this.preMatch.matched.get(c);if(u!=null&&u!=i)return!1;let d=c.dom,f,h=this.isLocked(d)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=ci&&Kc(t,c.outerDeco));if(!h&&c.update(e,t,r,s))return this.destroyBetween(this.index,a),c.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,t,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Vo,f.updateChildren(s,o+1),f.dirty=Xs),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Kc(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=yo.create(this.top,t,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,t,r,s,i){let o=yo.create(this.top,e,t,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new Sb(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof bo;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Du)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Qr||jr)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new Cb(this.top,[],r,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||kt(e)&&e.contains(this.lock.parentNode))}}function TC(n,e){let t=e,r=t.children.length,s=n.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let u=t.children[r-1];if(u instanceof bo)t=u,r=u.children.length;else{a=u,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function EC(n,e){return n.type.side-e.type.side}function AC(n,e,t,r){let s=e.locals(n),i=0;if(s.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);r(d,s,e.forChild(i,d),u),i+=d.nodeSize}return}let o=0,a=[],c=null;for(let u=0;;){let d,f;for(;o<s.length&&s[o].to==i;){let m=s[o++];m.widget&&(d?(f||(f=[d])).push(m):d=m)}if(d)if(f){f.sort(EC);for(let m=0;m<f.length;m++)t(f[m],u,!!c)}else t(d,u,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(u<n.childCount)p=u,h=n.child(u++);else break;for(let m=0;m<a.length;m++)a[m].to<=i&&a.splice(m--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let g=i+h.nodeSize;if(h.isText){let m=g;o<s.length&&s[o].from<m&&(m=s[o].from);for(let S=0;S<a.length;S++)a[S].to<m&&(m=a[S].to);m<g&&(c=h.cut(m-i),h=h.cut(0,m-i),g=m,p=-1)}else for(;o<s.length&&s[o].to<g;)o++;let v=h.isInline&&!h.isLeaf?a.filter(m=>!m.inline):a.slice();r(h,v,e.forChild(i,h),p),i=g}}function RC(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function PC(n,e,t,r){for(let s=0,i=0;s<n.childCount&&i<=r;){let o=n.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let c=o.text;for(;s<n.childCount;){let u=n.child(s++);if(i+=u.nodeSize,!u.isText)break;c+=u.text}if(i>=t){if(i>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?c.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=t)return a+u;if(t==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function df(n,e,t,r,s){let i=[];for(let o=0,a=0;o<n.length;o++){let c=n[o],u=a,d=a+=c.size;u>=t||d<=e?i.push(c):(u<e&&i.push(c.slice(0,e-u,r)),s&&(i.push(s),s=void 0),d>t&&i.push(c.slice(t-u,c.size,r)))}return i}function hh(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),c,u;if(Ou(t)){for(c=o;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&vt.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&sC(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;u=new vt(o==f?a:r.resolve(f))}else if(Ds&&e=="key"&&o>n.state.selection.to&&kt(t.focusNode)&&t.focusOffset==t.focusNode.childNodes.length&&s&&s.posAtStart>n.state.selection.to)for(let f=t.focusNode;;f=f.parentNode){if(getComputedStyle(f).overflow!="visible"){u=jt.findFrom(r.resolve(s.posAtStart),1);break}if(f==s.dom||f.nextSibling||!f.parentNode||!kt(f.parentNode))break}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,h=o;for(let p=0;p<t.rangeCount;p++){let g=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(g.startContainer,g.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(f<0)return null;[c,o]=h==n.state.selection.anchor?[h,f]:[f,h],a=r.resolve(o)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let d=r.resolve(c);if(!u){let f=e=="pointer"||n.state.selection.head<a.pos&&!i?1:-1;u=ph(n,d,a,f)}return u}function Ab(n){return n.editable?n.hasFocus():Pb(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function zi(n,e=!1){let t=n.state.selection;if(Rb(n,t),!Ab(n))return;let r=n.input.mouseDown;if(!e&&jr&&r){let s=n.domSelectionRange(),i=n.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&na(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)LC(n);else{let{anchor:s,head:i}=t,o,a;lg&&!(t instanceof et)&&(t.$from.parent.inlineContent||(o=cg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=cg(n,t.to))),n.docView.setSelection(s,i,n,e),lg&&(o&&ug(o),a&&ug(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&IC(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const lg=Qr||jr&&mb<63;function cg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Qr&&s&&s.contentEditable=="false")return bd(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return bd(s);if(i)return bd(i)}}function bd(n){return n.contentEditable="true",Qr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function ug(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function IC(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Ab(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function LC(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Vr(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Ts&&vo<=11&&(t.disabled=!0,t.disabled=!1)}function Rb(n,e){if(e instanceof vt){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(dg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else dg(n)}function dg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ph(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||et.between(e,t,r)}function fg(n){return n.editable&&!n.hasFocus()?!1:Pb(n)}function Pb(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return ra(n.dom,e.anchorNode)&&(n.editable||ra(n.dom,e.focusNode))}catch{return!1}}function OC(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return na(e.node,e.offset,t.anchorNode,t.anchorOffset)}function ff(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&jt.findFrom(i,e)}function oo(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function hg(n,e,t){let r=n.state.selection;if(r instanceof et)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return oo(n,new et(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=ff(n.state,e);return s&&s instanceof vt?oo(n,s):!1}else if(!(qs&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?vt.isSelectable(i)?oo(n,new vt(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):oo(n,new et(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof vt&&r.node.isInline)return oo(n,new et(e>0?r.$to:r.$from));{let s=ff(n.state,e);return s?oo(n,s):!1}}}function xl(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):kt(n)&&n.contentEditable=="false"}function _a(n,e){return e<0?NC(n):DC(n)}function NC(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Ds&&kt(t)&&r<Yr(t)&&xl(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!kt(t))break;let a=t.childNodes[r-1];if(xl(a,-1))s=t,i=--r;else if(wr(a))t=a,r=t.nodeValue.length;else break}else{if(Ib(t))break;{let a=t.previousSibling;for(;a&&xl(a,-1);)s=t.parentNode,i=Vr(a),a=a.previousSibling;if(a)t=a,r=Yr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?hf(n,t,r):s&&hf(n,s,i)}function DC(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Yr(t),i,o;for(;;)if(r<s){if(!kt(t))break;let a=t.childNodes[r];if(xl(a,1))i=t,o=++r;else break}else{if(Ib(t))break;{let a=t.nextSibling;for(;a&&xl(a,1);)i=a.parentNode,o=Vr(a)+1,a=a.nextSibling;if(a)t=a,r=0,s=Yr(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&hf(n,i,o)}function Ib(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function $C(n,e){for(;n&&e==n.childNodes.length&&!Xl(n);)e=Vr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(wr(t))return t;if(kt(t)&&t.contentEditable=="false")break;n=t,e=0}}function BC(n,e){for(;n&&!e&&!Xl(n);)e=Vr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(wr(t))return t;if(kt(t)&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function hf(n,e,t){if(!wr(e)){let i,o;(o=$C(e,t))?(e=o,t=0):(i=BC(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ou(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&zi(n)},50)}function pg(n,e){let t=n.state.doc.resolve(e);if(!(jr||vb)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function gg(n,e,t){let r=n.state.selection;if(r instanceof et&&!r.empty||t.indexOf("s")>-1||qs&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=ff(n.state,e);if(o&&o instanceof vt)return oo(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Ns?jt.near(o,e):jt.findFrom(o,e);return a?oo(n,a):!1}return!1}function mg(n,e){if(!(n.state.selection instanceof et))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function vg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function zC(n){if(!Qr||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&kt(e)&&t==0&&e.firstChild&&kt(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;vg(n,r,"true"),setTimeout(()=>vg(n,r,"false"),20)}return!1}function FC(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function HC(n,e){let t=e.keyCode,r=FC(e);if(t==8||qs&&t==72&&r=="c")return mg(n,-1)||_a(n,-1);if(t==46&&!e.shiftKey||qs&&t==68&&r=="c")return mg(n,1)||_a(n,1);if(t==13||t==27)return!0;if(t==37||qs&&t==66&&r=="c"){let s=t==37?pg(n,n.state.selection.from)=="ltr"?-1:1:-1;return hg(n,s,r)||_a(n,s)}else if(t==39||qs&&t==70&&r=="c"){let s=t==39?pg(n,n.state.selection.from)=="ltr"?1:-1:1;return hg(n,s,r)||_a(n,s)}else{if(t==38||qs&&t==80&&r=="c")return gg(n,-1,r)||_a(n,-1);if(t==40||qs&&t==78&&r=="c")return zC(n)||gg(n,1,r)||_a(n,1);if(r==(qs?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function gh(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||aa.fromSchema(n.state.schema),a=Bb(),c=a.createElement("div");c.appendChild(o.serializeFragment(r,{document:a}));let u=c.firstChild,d,f=0;for(;u&&kt(u)&&(d=$b[u.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let g=a.createElement(d[p]);for(;c.firstChild;)g.appendChild(c.firstChild);c.appendChild(g),f++}u=c.firstChild}u&&kt(u)&&u.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
11
11
 
12
12
  `);return{dom:c,text:h,slice:e}}function Lb(n,e,t,r,s){let i=s.parent.type.spec.code,o,a;if(!t&&!e)return null;let c=!!e&&(r||i||!t);if(c){if(n.someProp("transformPastedText",h=>{e=h(e,i||r,n)}),i)return a=new He(_e.from(n.state.schema.text(e.replace(/\r\n?/g,`
13
- `))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let f=n.someProp("clipboardTextParser",h=>h(e,s,r,n));if(f)a=f;else{let h=s.marks(),{schema:p}=n.state,g=aa.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let m=o.appendChild(document.createElement("p"));v&&m.appendChild(g.serializeNode(p.text(v,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=KC(t),Nu&&jC(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=o.firstChild;for(;h&&!kt(h);)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||mo.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!UC.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=GC(bg(a,+d[1],+d[2]),d[4]);else if(a=He.maxOpen(VC(a.content,s),!0),a.openStart||a.openEnd){let f=0,h=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=bg(a,f,h)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const UC=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function VC(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(a=>{if(!o)return;let c=s.findWrapping(a.type),u;if(!c)return o=null;if(u=o.length&&i.length&&Nb(c,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Db(o[o.length-1],i.length));let d=Ob(a,c);o.push(d),s=s.matchType(d.type),i=c}}),o)return _e.from(o)}return n}function Ob(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,_e.from(n));return n}function Nb(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=Nb(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(_e.from(Ob(t,n,s+1))))}}function Db(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Db(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(_e.empty,!0);return n.copy(t.append(r))}function pf(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(i=0),s<r-1&&(a=pf(a,e,t,r,s+1,i)),s>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(_e.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function bg(n,e,t){return e<n.openStart&&(n=new He(pf(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new He(pf(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const $b={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Bb(){return document.implementation.createHTMLDocument("title")}let ol=null;function WC(n){let e=window.trustedTypes;if(!e)return n;if(!ol){if(ol=e.defaultPolicy)try{return ol.createHTML(n)}catch{}ol=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return ol.createHTML(n)}function KC(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Bb(),r=t.body,s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&$b[s[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=WC(n),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<t.styleSheets.length;o++){let a=t.styleSheets[o];for(let c=0;c<a.rules.length;c++){let u=a.rules[c];if(u instanceof CSSStyleRule){let d=r.querySelectorAll(u.selectorText);for(let f=0;f<d.length;f++)d[f].style.cssText+=u.style.cssText}}}return r}function jC(n){let e=n.querySelectorAll(jr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function GC(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let c=t.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;try{s=_e.from(c.create(r[a+1],s))}catch{break}i++,o++}return new He(s,i,o)}const ds={},fs={},qC={touchstart:!0,touchmove:!0};class JC{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function XC(n){for(let e in ds){let t=ds[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{YC(n,r)&&!mh(n,r)&&(n.editable||!(r.type in fs))&&t(n,r)},qC[e]?{passive:!0}:void 0)}Yr&&n.dom.addEventListener("input",()=>null),gf(n)}function $i(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function QC(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function gf(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>mh(n,r))})}function mh(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function YC(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function ZC(n,e){!mh(n,e)&&ds[e.type]&&(n.editable||!(e.type in fs))&&ds[e.type](n,e)}fs.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Ub(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Di&&jr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ua&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,zo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||HC(n,t)?t.preventDefault():$i(n,"key")};fs.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};fs.keypress=(n,e)=>{let t=e;if(Ub(n)||!t.charCode||t.ctrlKey&&!t.altKey||qs&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof et)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function Yl(n){return{left:n.clientX,top:n.clientY}}function eM(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function vh(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,a=>o>i.depth?a(n,t,i.nodeAfter,i.before(o),s,!0):a(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function Zl(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function tM(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&vt.isSelectable(r)?(Zl(n,new vt(t)),!0):!1}function nM(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof vt&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(vt.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(Zl(n,vt.create(n.state.doc,s)),!0):!1}function rM(n,e,t,r,s){return vh(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?nM(n,t):tM(n,t))}function sM(n,e,t,r){return vh(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function iM(n,e,t,r){return vh(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||oM(n,t,r)}function oM(n,e,t){if(t.button!=0)return!1;let r=zb(n,e,!0),s=n.state.doc;return r?(Zl(n,r),r instanceof et&&s.eq(n.state.doc)&&(n.input.mouseDown=new lM(n,r)),!0):!1}function zb(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?et.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)return et.create(r,a+1,a+1+o.content.size);if(t&&vt.isSelectable(o))return vt.create(r,a)}return null}function bh(n){return jc(n)}const Fb=qs?"metaKey":"ctrlKey";ds.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=bh(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&eM(t,n.input.lastClick)&&!t[Fb]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let o=n.posAtCoords(Yl(t));o&&(i=="singleClick"?n.input.mouseDown=new aM(n,o,t,!!r):(i=="doubleClick"?sM:iM)(n,o.pos,o.inside,t)?t.preventDefault():$i(n,"pointer"))};class Hb{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class aM extends Hb{constructor(e,t,r,s){super(e),this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Fb],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,o=d.depth?d.before():0}const a=s?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&kt(c.nodeDOM)?c.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof vt&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ds&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),$i(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||zi(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Yl(e))),this.updateAllowDefault(e),this.allowDefault||!t?$i(this.view,"pointer"):rM(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Yr&&this.mightDrag&&!this.mightDrag.node.isAtom||jr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Zl(this.view,jt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):$i(this.view,"pointer")}move(e){this.updateAllowDefault(e),$i(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class lM extends Hb{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),$i(this.view,"pointer");let t=this.view.posAtCoords(Yl(e)),r=t&&zb(this.view,t.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,a]=r.from<i.from?[i.to,r.from]:[i.from,r.to];Zl(this.view,et.create(s,o,a))}}ds.touchstart=n=>{n.input.lastTouch=Date.now(),bh(n),$i(n,"pointer")};ds.touchmove=n=>{n.input.lastTouch=Date.now(),$i(n,"pointer")};ds.contextmenu=n=>bh(n);function Ub(n,e){return n.composing?!0:Yr&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const cM=Di?5e3:-1;fs.compositionstart=fs.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof et&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||jr&&vb&&uM(n)))n.markCursor=n.state.storedMarks||t.marks(),jc(n,!0),n.markCursor=null;else if(jc(n,!e.selection.empty),Ds&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&kt(s)&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(wr(o)){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}Vb(n,cM)};function uM(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||!kt(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return kt(r)&&r.contentEditable=="false"}fs.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Vb(n,20))};function Vb(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>jc(n),e))}function Wb(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function dM(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=nC(e.focusNode,e.focusOffset),r=rC(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function jc(n,e=!1){if(!(Di&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Wb(n),e||n.docView&&n.docView.dirty){let t=hh(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function fM(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const $l=Ts&&vo<15||Ua&&aC<604;ds.copy=fs.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=$l?null:t.clipboardData,o=r.content(),{dom:a,text:c}=gh(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):fM(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hM(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function pM(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Bl(n,r.value,null,s,e):Bl(n,r.textContent,r.innerHTML,s,e)},50)}function Bl(n,e,t,r,s){let i=Lb(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,s,i||He.empty)))return!0;if(!i)return!1;let o=hM(i),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Kb(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}fs.paste=(n,e)=>{let t=e;if(n.composing&&!Di)return;let r=$l?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Bl(n,Kb(r),r.getData("text/html"),s,t)?t.preventDefault():pM(n,t)};class jb{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const gM=qs?"altKey":"ctrlKey";function Gb(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[gM]}ds.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(Yl(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof vt?s.to-1:s.to))){if(r&&r.mightDrag)o=vt.create(n.state.doc,r.mightDrag.pos);else if(t.target&&kt(t.target)){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=vt.create(n.state.doc,f.posBefore))}}let a=(o||n.state.selection).content(),{dom:c,text:u,slice:d}=gh(n,a);(!t.dataTransfer.files.length||!jr||mb>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData($l?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",$l||t.dataTransfer.setData("text/plain",u),n.dragging=new jb(d,Gb(n,t),o)};ds.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};fs.dragover=fs.dragenter=(n,e)=>e.preventDefault();fs.drop=(n,e)=>{try{mM(n,e,n.dragging)}finally{n.dragging=null}};function mM(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Yl(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=Lb(n,Kb(e.dataTransfer),$l?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&Gb(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||He.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?qv(n.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(o){let{node:p}=t;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&vt.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new vt(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,v,m,S)=>p=S),c.setSelection(ph(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}ds.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&zi(n)},20))};ds.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};ds.beforeinput=(n,e)=>{if(Di&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,zo(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in fs)ds[n]=fs[n];function zl(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Gc{constructor(e,t){this.toDOM=e,this.spec=t||Qo,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new Rr(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&zl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wo{constructor(e,t){this.attrs=e,this.spec=t||Qo}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Rr(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof wo&&zl(this.attrs,e.attrs)&&zl(this.spec,e.spec)}static is(e){return e.type instanceof wo}destroy(){}}class yh{constructor(e,t){this.attrs=e,this.spec=t||Qo}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Rr(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof yh&&zl(this.attrs,e.attrs)&&zl(this.spec,e.spec)}destroy(){}}class Rr{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Rr(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Rr(e,e,new Gc(t,r))}static inline(e,t,r,s){return new Rr(e,t,new wo(r,s))}static node(e,t,r,s){return new Rr(e,t,new yh(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof wo}get widget(){return this.type instanceof Gc}}const Aa=[],Qo={};class Yt{constructor(e,t){this.local=e.length?e:Aa,this.children=t.length?t:Aa}static create(e,t){return t.length?qc(t,e,0,Qo):Jr}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,s+a,i)}}map(e,t,r){return this==Jr||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Qo)}mapInner(e,t,r,s,i){let o;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,s);c&&c.type.valid(t,c)?(o||(o=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?vM(this.children,o||[],e,t,r,s,i):o?new Yt(o.sort(Yo),Aa):Jr}add(e,t){return t.length?this==Jr?Yt.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((a,c)=>{let u=c+r,d;if(d=Jb(t,a,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<c;)i+=3;s[i]==c?s[i+2]=s[i+2].addInner(a,d,u+1):s.splice(i,0,c,c+a.nodeSize,qc(d,a,u+1,Qo)),i+=3}});let o=qb(i?Xb(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Yt(o.length?this.local.concat(o).sort(Yo):this.local,s||this.children)}remove(e){return e.length==0||this==Jr?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+t,c=r[i+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>a&&f.to<c&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,a+1);u!=Jr?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Yt(s,r):Jr}forChild(e,t){if(this==Jr)return this;if(t.isLeaf)return Yt.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+t.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<o&&c.to>i&&c.type instanceof wo){let u=Math.max(i,c.from)-i,d=Math.min(o,c.to)-i;u<d&&(s||(s=[])).push(c.copy(u,d))}}if(s){let a=new Yt(s.sort(Yo),Aa);return r?new co([a,r]):a}return r||Jr}eq(e){if(this==e)return!0;if(!(e instanceof Yt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return wh(this.localsInner(e))}localsInner(e){if(this==Jr)return Aa;if(e.inlineContent||!this.local.some(wo.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof wo||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Yt.empty=new Yt([],[]);Yt.removeOverlap=wh;const Jr=Yt.empty;class co{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Qo));return co.from(r)}forChild(e,t){if(t.isLeaf)return Yt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=Jr&&(i instanceof co?r=r.concat(i.members):r.push(i))}return co.from(r)}eq(e){if(!(e instanceof co)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?wh(r?t:t.sort(Yo)):Aa}static from(e){switch(e.length){case 0:return Jr;case 1:return e[0];default:return new co(e.every(t=>t instanceof Yt)?e:e.reduce((t,r)=>t.concat(r instanceof Yt?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function vM(n,e,t,r,s,i,o){let a=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((h,p,g,v)=>{let m=v-g-(p-h);for(let S=0;S<a.length;S+=3){let I=a[S+1];if(I<0||h>I+d-f)continue;let C=a[S]+d-f;p>=C?a[S+1]=h<=C?-2:-1:h>=d&&m&&(a[S]+=m,a[S+1]+=m)}f+=m}),d=t.maps[u].map(d,-1)}let c=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){c=!0,a[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-s;if(f<0||f>=r.content.size){c=!0;continue}let h=t.map(n[u+1]+i,-1),p=h-s,{index:g,offset:v}=r.content.findIndex(f),m=r.maybeChild(g);if(m&&v==f&&v+m.nodeSize==p){let S=a[u+2].mapInner(t,m,d+1,n[u]+i+1,o);S!=Jr?(a[u]=f,a[u+1]=p,a[u+2]=S):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=bM(a,n,e,t,s,i,o),d=qc(u,r,0,o);e=d.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new Yt(e.sort(Yo),a)}function qb(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new Rr(s.from+e,s.to+e,s.type))}return t}function bM(n,e,t,r,s,i,o){function a(c,u){for(let d=0;d<c.local.length;d++){let f=c.local[d].map(r,s,u);f?t.push(f):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)a(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+i+1);return t}function Jb(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Xb(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function qc(n,e,t,r){let s=[],i=!1;e.forEach((a,c)=>{let u=Jb(n,a,c+t);if(u){i=!0;let d=qc(u,a,t+c+1,r);d!=Jr&&s.push(c,c+a.nodeSize,d)}});let o=qb(i?Xb(n):n,-t).sort(Yo);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new Yt(o,s):Jr}function Yo(n,e){return n.from-e.from||n.to-e.to}function wh(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),yg(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),yg(e,s,r.copy(i.from,r.to)));break}}}return e}function yg(n,e,t){for(;e<n.length&&Yo(t,n[e])>0;)e++;n.splice(e,0,t)}function yd(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Jr&&e.push(r)}),n.cursorWrapper&&e.push(Yt.create(n.state.doc,[n.cursorWrapper.deco])),co.from(e)}const yM={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},wM=Ts&&vo<=11;class xM{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class kM{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new xM,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Ts&&vo<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Yr&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),wM&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yM)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(fg(this.view)){if(this.suppressingSelectionUpdates)return zi(this.view);if(Ts&&vo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&na(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=Ha(i))t.add(i);for(let i=e.anchorNode;i;i=Ha(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:wr(r)?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&fg(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,c=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],c);f&&(i=i<0?f.from:Math.min(f.from,i),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||jr&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;for(;f&&kt(f);){if(f.contentEditable=="false"){d.parentNode.removeChild(d);break}f=f.firstChild}}}else if(Ds&&c.length){let d=c.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||CM(e,f)!=p)&&h.remove()}}}let u=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ou(r)&&(u=hh(e))&&u.eq(jt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,zi(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),_M(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,MM(e,c)),this.handleDOMChange(i,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||zi(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),wr(f)&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Ts&&vo<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?Vr(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),c=i&&i.parentNode==e.target?Vr(i):e.target.childNodes.length,u=r.localPosFromDOM(e.target,c,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let wg=new WeakMap,xg=!1;function _M(n){if(!wg.has(n)&&(wg.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ds,xg)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),xg=!0}}function kg(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return na(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function SM(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return kg(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?kg(n,t):null}function CM(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function MM(n,e){var t;let{focusNode:r,focusOffset:s}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let c=a.firstChild;if(!c||!kt(c)||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;a=c}a.insertBefore(i,a.firstChild),r==i&&n.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function TM(n,e,t,r){let{node:s,fromOffset:i,toOffset:o,from:a,to:c}=n.docView.parseRange(e,t),u=n.domSelectionRange(),d,f=u.anchorNode;if(f&&ra(n.dom,f)&&(d=[{node:f,offset:u.anchorOffset}],Ou(u)||d.push({node:u.focusNode,offset:u.focusOffset})),jr&&n.input.lastKeyCode===8)for(let S=o;S>i;S--){let I=s.childNodes[S-1],C=I.pmViewDesc;if(I.nodeName=="BR"&&!C){o=S;break}if(!C||C.size)break}let h=n.state.doc,p=n.someProp("domParser")||mo.fromSchema(n.state.schema),g=h.resolve(a),v=null,m=p.parse(s,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:o,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:EM(r),context:g});if(d&&d[0].pos!=null){let S=d[0].pos,I=d[1]&&d[1].pos;I==null&&(I=S),v={anchor:S+a,head:I+a}}return{doc:m,sel:v,from:a,to:c}}const EM=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(Yr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Yr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},AM=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function RM(n,e,t,r,s){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,z=hh(n,E);if(z&&!n.state.selection.eq(z)){if(jr&&Di&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",J=>J(n,zo(13,"Enter"))))return;let G=n.state.tr.setSelection(z);E=="pointer"?G.setMeta("pointer",!0):E=="key"&&G.scrollIntoView(),i&&G.setMeta("composition",i),n.dispatch(G)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,u=TM(n,e,t,s),d=n.state.doc,f=d.slice(u.from,u.to),h,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,p="end"):(h=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let g=OM(f.content,u.doc.content,u.from,h,p);if(g&&n.input.domChangeCount++,(Ua&&n.input.lastIOSEnter>Date.now()-225||Di)&&s.some(E=>kt(E)&&!AM.test(E.nodeName))&&(!g||g.endA>=g.endB)&&n.someProp("handleKeyDown",E=>E(n,zo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!g)if(r&&c instanceof et&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))g={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let E=_g(n,n.state.doc,u.sel);if(E&&!E.eq(n.state.selection)){let z=n.state.tr.setSelection(E);i&&z.setMeta("composition",i),n.dispatch(z)}}return}n.state.selection.from<n.state.selection.to&&g.start==g.endB&&n.state.selection instanceof et&&(g.start>n.state.selection.from&&g.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?g.start=n.state.selection.from:g.endA<n.state.selection.to&&g.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(g.endB+=n.state.selection.to-g.endA,g.endA=n.state.selection.to)),Ts&&vo<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>u.from&&u.doc.textBetween(g.start-u.from-1,g.start-u.from+1)=="  "&&(g.start--,g.endA--,g.endB--);let v=u.doc.resolveNoCache(g.start-u.from),m=u.doc.resolveNoCache(g.endB-u.from),S=d.resolve(g.start),I=v.sameParent(m)&&v.parent.inlineContent&&S.end()>=g.endA;if((Ua&&n.input.lastIOSEnter>Date.now()-225&&(!I||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!I&&LM(u.doc,v.pos,m.pos))&&n.someProp("handleKeyDown",E=>E(n,zo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>g.start&&IM(d,g.start,g.endA,v,m)&&n.someProp("handleKeyDown",E=>E(n,zo(8,"Backspace")))){Di&&jr&&n.domObserver.suppressSelectionUpdates();return}jr&&g.endB==g.start&&(n.input.lastChromeDelete=Date.now()),Di&&!I&&v.start()!=m.start()&&m.parentOffset==0&&v.depth==m.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,m=u.doc.resolveNoCache(g.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,zo(13,"Enter"))})},20));let C=g.start,M=g.endA,O=E=>{let z=E||n.state.tr.replace(C,M,u.doc.slice(g.start-u.from,g.endB-u.from));if(u.sel){let G=_g(n,z.doc,u.sel);G&&!(jr&&n.composing&&G.empty&&(g.start!=g.endB||n.input.lastChromeDelete<Date.now()-100)&&(G.head==C||G.head==z.mapping.map(M)-1)||Ts&&G.empty&&G.head==C)&&z.setSelection(G)}return i&&z.setMeta("composition",i),z.scrollIntoView()},P;if(I)if(v.pos==m.pos){Ts&&vo<=11&&v.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>zi(n),20));let E=O(n.state.tr.delete(C,M)),z=d.resolve(g.start).marksAcross(d.resolve(g.endA));z&&E.ensureMarks(z),n.dispatch(E)}else if(g.endA==g.endB&&(P=PM(v.parent.content.cut(v.parentOffset,m.parentOffset),S.parent.content.cut(S.parentOffset,g.endA-S.start())))){let E=O(n.state.tr);P.type=="add"?E.addMark(C,M,P.mark):E.removeMark(C,M,P.mark),n.dispatch(E)}else if(v.parent.child(v.index()).isText&&v.index()==m.index()-(m.textOffset?0:1)){let E=v.parent.textBetween(v.parentOffset,m.parentOffset),z=()=>O(n.state.tr.insertText(E,C,M));n.someProp("handleTextInput",G=>G(n,C,M,E,z))||n.dispatch(z())}else n.dispatch(O());else n.dispatch(O())}function _g(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ph(n,e.resolve(t.anchor),e.resolve(t.head))}function PM(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,i=r,o,a,c;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",c=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",c=d=>d.mark(a.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(_e.from(u).eq(n))return{mark:a,type:o}}function IM(n,e,t,r,s){if(t-e<=s.pos-r.pos||wd(r,!0,!1)<s.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&t==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=n.resolve(wd(i,!0,!0));return!o.parent.isTextblock||o.pos>t||wd(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function LM(n,e,t){let r=0,s=0;return n.nodesBetween(e,t,(i,o)=>{i.isTextblock&&o>=e&&o<t?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-o),Math.min(i.nodeSize,t-o))):i.isLeaf)&&s++}),s==0&&r==1}function wd(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function OM(n,e,t,r,s){let i=n.findDiffStart(e,t),o=t+n.size,a=t+e.size;if(i==null)return null;let{a:c,b:u}=n.findDiffEnd(e,o,a);if(s=="end"){let d=Math.max(0,i-Math.min(c,u));r-=c+d-i}if(c<i&&o<a){let d=r<=i&&r>=c?i-r:0;i-=d,u=i+(u-c),c=i}else if(u<i){let d=r<=i&&r>=u?i-r:0;i-=d,c=i+(c-u),u=i}return{start:i,endA:c,endB:u}}class Qb{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new JC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Eg),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Mg(this),Cg(this),this.nodeViews=Tg(this),this.docView=og(this.state.doc,Sg(this),yd(this),this.dom,this),this.domObserver=new kM(this,(r,s,i,o)=>RM(this,r,s,i,o)),this.domObserver.start(),XC(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&gf(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Eg),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(Wb(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Tg(this);DM(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&gf(this),this.editable=Mg(this),Cg(this);let c=yd(this),u=Sg(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,c);(f||!e.selection.eq(s.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&uC(this);if(o){this.domObserver.stop();let p=f&&(Ts||jr)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&NM(s.selection,e.selection);if(f){let v=jr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=dM(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=og(e.doc,u,c,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let g=this.input.mouseDown;p||!(g&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&OC(this)&&g.delaySelUpdate())?zi(this,p):(Rb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&dC(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!ra(this.dom,e))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof vt){let t=this.docView.domAfterPos(this.state.selection.from);kt(t)&&tg(this,t.getBoundingClientRect(),e)}else tg(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new jb(e.slice,e.move,s<0?void 0:vt.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=t?t(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=t?t(a):a))return s}}hasFocus(){if(Ts){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&fC(this.dom),zi(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return vC(this,e)}coordsAtPos(e,t=1){return kb(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return kC(this,t||this.state,e)}pasteHTML(e,t){return Bl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Bl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return gh(this,e)}destroy(){this.docView&&(QC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,eC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ZC(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?Yr&&this.root.nodeType===11&&iC(this.dom.ownerDocument)==this.dom&&SM(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Qb.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Sg(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Rr.node(0,n.state.doc.content.size,e)]}function Cg(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Rr.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Mg(n){return!n.someProp("editable",e=>e(n.state)===!1)}function NM(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Tg(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function DM(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function Eg(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ko={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Jc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$M=typeof navigator<"u"&&/Mac/.test(navigator.platform),BM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wr=0;Wr<10;Wr++)ko[48+Wr]=ko[96+Wr]=String(Wr);for(var Wr=1;Wr<=24;Wr++)ko[Wr+111]="F"+Wr;for(var Wr=65;Wr<=90;Wr++)ko[Wr]=String.fromCharCode(Wr+32),Jc[Wr]=String.fromCharCode(Wr);for(var xd in ko)Jc.hasOwnProperty(xd)||(Jc[xd]=ko[xd]);function zM(n){var e=$M&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||BM&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Jc:ko)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const FM=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),HM=typeof navigator<"u"&&/Win/.test(navigator.platform);function UM(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))FM?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function VM(n){let e=Object.create(null);for(let t in n)e[UM(t)]=n[t];return e}function kd(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function WM(n){return new kn({props:{handleKeyDown:Yb(n)}})}function Yb(n){let e=VM(n);return function(t,r){let s=zM(r),i,o=e[kd(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[kd(s,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(HM&&r.ctrlKey&&r.altKey)&&(i=ko[r.keyCode])&&i!=s){let a=e[kd(i,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}function $u(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}}var Oa=class Zb{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:s}=t,{tr:i}=r,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...d)=>{const f=c(...d)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(i),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a=[],c=!!e,u=e||i.tr,d=()=>(!c&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...v)=>{const m=this.buildProps(u,t),S=p(...v)(m);return a.push(S),f}])),run:d};return f}static createFakeChain(){const e=new Proxy({},{get:(t,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:t,state:r}=this,s=!1,i=e||r.tr,o=this.buildProps(i,s);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,s)}}static createFallbackCan(){const e=Zb.createFakeChain();return new Proxy({chain:()=>e},{get:(t,r)=>{if(r!=="then")return r==="chain"?t.chain:()=>!1}})}buildProps(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a={tr:e,editor:s,view:o,state:$u({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([c,u])=>[c,(...d)=>u(...d)(a)]))}};return a}};const KM=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{if(!n.isDestroyed){var t;e.dom.blur(),(t=window)===null||t===void 0||(t=t.getSelection())===null||t===void 0||t.removeAllRanges()}}),!0),jM=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),GM=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:i,$to:o})=>{n.doc.nodesBetween(i.pos,o.pos,(a,c)=>{if(a.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(c)),h=u.resolve(d.map(c+a.nodeSize)),p=f.blockRange(h);if(!p)return;const g=qa(p);if(a.type.isTextblock){const{defaultType:v}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,v)}(g||g===0)&&e.lift(p,g)})}),!0},qM=n=>e=>n(e),JM=()=>({state:n,dispatch:e})=>db(n,e),XM=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,i=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new et(r.doc.resolve(Math.max(o-1,0)))),!0},QM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const o=s.before(i),a=s.after(i);n.delete(o,a).scrollIntoView()}return!0}return!1};function xr(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}const YM=n=>({tr:e,state:t,dispatch:r})=>{const s=xr(n,t.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),c=i.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},ZM=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},e2=n=>n.content?/^text(\*|\+)/.test(n.content):!1,Ag=(n,e,t)=>{if(!n.parent.isInline||t==="left"&&n.pos>n.start()||t==="right"&&n.pos<n.end())return n.pos;const r=e.nodes[n.parent.type.name].spec;return e2(r)?t==="left"?n.start()-1:n.end()+1:n.pos},t2=(n,e,t)=>({from:Ag(n,t,"left"),to:Ag(e,t,"right")}),n2=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,s=t.steps.length;r.forEach(i=>{const o=t.mapping.slice(s),a=t.doc.resolve(o.map(i.$from.pos)),c=t.doc.resolve(o.map(i.$to.pos)),{from:u,to:d}=t2(a,c,n.schema);t.deleteRange(u,d)}),t.selection.empty||t.setSelection(et.near(t.doc.resolve(t.selection.from))),t.scrollIntoView(),e(t)}return!0},r2=()=>({commands:n})=>n.keyboardShortcut("Enter"),s2=()=>({state:n,dispatch:e})=>zS(n,e);function xh(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Xc(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:xh(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function ey(n,e,t={}){return n.find(r=>r.type===e&&Xc(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Rg(n,e,t={}){return!!ey(n,e,t)}function kh(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!t){const c=r.node.marks.find(u=>u.type===e);c&&(t=c.attrs)}if(!ey([...r.node.marks],e,t))return;let s=r.index,i=n.start()+r.offset,o=s+1,a=i+r.node.nodeSize;for(;s>0&&Rg([...n.parent.child(s-1).marks],e,t);)s-=1,i-=n.parent.child(s).nodeSize;for(;o<n.parent.childCount&&Rg([...n.parent.child(o).marks],e,t);)a+=n.parent.child(o).nodeSize,o+=1;return{from:i,to:a}}function Ki(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const i2=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=Ki(n,r.schema),{doc:o,selection:a}=t,{$from:c,from:u,to:d}=a;if(s){const f=kh(c,i,e);if(f&&f.from<=u&&f.to>=d){const h=et.create(o,f.from,f.to);t.setSelection(h)}}return!0},o2=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function ty(n){return n instanceof et}function Ko(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function mf(n,e=null){if(!e)return null;const t=jt.atStart(n),r=jt.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?et.create(n,Ko(0,s,i),Ko(n.content.size,s,i)):et.create(n,Ko(e,s,i),Ko(e,s,i))}function vf(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Fl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function a2(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const l2=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Fl()||vf())&&r.dom.focus(),a2()&&!Fl()&&!vf()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!ty(t.state.selection))return o(),!0;const a=mf(s.doc,n)||t.state.selection,c=t.state.selection.eq(a);return i&&(c||s.setSelection(a),c&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},c2=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),u2=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),ny=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&ny(r)}return n};function dc(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return ny(t)}function ry(n){return typeof n?.nodesBetween=="function"}function Va(n,e,t){if(ry(n))return n;const r=typeof n=="object"&&n!==null;t={slice:!0,parseOptions:{},...t};const s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return _e.fromArray(n.map(o=>e.nodeFromJSON(o)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Va("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const c=new $v({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?mo.fromSchema(c).parseSlice(dc(n),t.parseOptions):mo.fromSchema(c).parse(dc(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=mo.fromSchema(e);return t.slice?i.parseSlice(dc(n),t.parseOptions).content:i.parse(dc(n),t.parseOptions)}return Va("",e,t)}function sy(n){return!("type"in n)}function iy(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof sr||s instanceof Pr))return;const i=n.mapping.maps[r];let o=0;i.forEach((a,c,u,d)=>{o===0&&(o=d)}),n.setSelection(jt.near(n.doc.resolve(o),t))}const d2=(n,e,t)=>({tr:r,dispatch:s,editor:i})=>{if(s){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=m=>{i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Va(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(m){c(m)}try{var o;a=Va(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(m){return c(m),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;const g=sy(a)?a.content:[a];if(g.forEach(m=>{m.check(),h=h?m.isText&&m.marks.length===0:!1,p=p?m.isBlock:!1}),d===f&&p){const{parent:m}=r.doc.resolve(d);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(d-=1,f+=1)}let v;if(h)Array.isArray(e)?v=e.map(m=>m.text||"").join(""):ry(e)?v=g.map(m=>{var S;return(S=m.text)!==null&&S!==void 0?S:""}).join(""):typeof e=="object"&&e&&e.text?v=e.text:v=e,r.insertText(v,d,f);else{v=_e.from(g);const m=r.doc.resolve(d),S=m.node(),I=m.parentOffset===0,C=S.isText||S.isTextblock,M=S.content.size>0;I&&C&&M&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}t.updateSelection&&iy(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:v}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:v})}return!0};function oy(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const f2=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:a=!0}=n;let c;typeof s=="number"?c=e.doc.resolve(s):s?c=s:c=e.selection.$from;const u=oy(c.parent.contentMatchAt(c.index()));if(!u)return!1;const d=Object.keys(u.spec.attrs||{}),f=i?Object.fromEntries(Object.entries(i).filter(([p])=>d.includes(p))):{};let h;if(o){const p=Va(o,r.schema);h=u.createAndFill(f,p)}else h=u.createAndFill(f);return h?(t&&(e.insert(c.pos,h),a&&iy(e,e.steps.length-1,-1)),!0):!1},h2=()=>({state:n,dispatch:e})=>DS(n,e),p2=()=>({state:n,dispatch:e})=>$S(n,e),g2=()=>({state:n,dispatch:e})=>sb(n,e),m2=()=>({state:n,dispatch:e})=>lb(n,e),v2=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Pu(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},b2=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Pu(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},y2=()=>({state:n,dispatch:e})=>OS(n,e),w2=()=>({state:n,dispatch:e})=>NS(n,e);function ay(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function x2(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))Fl()||ay()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}const k2=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=x2(n).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,a))});return c?.steps.forEach(u=>{const d=u.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function Ui(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?xr(e,n.schema):null,a=[];n.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(s,f+d.nodeSize);a.push({node:d,from:h,to:p})});const c=s-r,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Xc(d.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=c}const _2=(n,e={})=>({state:t,dispatch:r})=>Ui(t,xr(n,t.schema),e)?BS(t,r):!1,S2=()=>({state:n,dispatch:e})=>fb(n,e),C2=n=>({state:e,dispatch:t})=>{const r=xr(n,e.schema);return XS(r)(e,t)},M2=()=>({state:n,dispatch:e})=>ub(n,e);function Bu(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Pg(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}const T2=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=Bu(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=xr(n,r.schema)),a==="mark"&&(o=Ki(n,r.schema));let c=!1;return t.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(c=!0,s&&t.setNodeMarkup(f,void 0,Pg(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(h=>{o===h.type&&(c=!0,s&&t.addMark(f,f+d.nodeSize,o.create(Pg(h.attrs,e))))})})}),c},E2=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),A2=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ns(n.doc);n.setSelection(t)}return!0},R2=()=>({state:n,dispatch:e})=>ob(n,e),P2=()=>({state:n,dispatch:e})=>cb(n,e),I2=()=>({state:n,dispatch:e})=>US(n,e),L2=()=>({state:n,dispatch:e})=>KS(n,e),O2=()=>({state:n,dispatch:e})=>WS(n,e);function Qc(n,e,t={},r={}){return Va(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const N2=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:c}=i;if(r.preserveWhitespace!=="full"){const u=Qc(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});if(o){const d=sy(u)?u.content:[u];i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t)}return!0}return o&&i.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function ly(n,e){const t=Ki(e,n.schema),{from:r,to:s,empty:i}=n.selection,o=[];i?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,c=>{o.push(...c.marks)});const a=o.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function cy(n,e){const t=new Zv(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function u$(n,e){const t=[];return n.descendants((r,s)=>{e(r)&&t.push({node:r,pos:s})}),t}function D2(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function $2(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function zu(n){return e=>$2(e.$from,n)}function ct(n,e,t){return n.config[e]===void 0&&n.parent?ct(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ct(n.parent,e,t):null}):n.config[e]}function _h(n){return n.map(e=>{const t=ct(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,..._h(t())]:e}).flat(10)}function Sh(n,e){const t=aa.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function uy(n){return typeof n=="function"}function hn(n,e=void 0,...t){return uy(n)?e?n.bind(e)(...t):n(...t):n}function B2(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Wa(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function dy(n){const e=[],{nodeExtensions:t,markExtensions:r}=Wa(n),s=[...t,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),c=[...o,...a];return n.forEach(u=>{const d=ct(u,"addGlobalAttributes",{name:u.name,options:u.options,storage:u.storage,extensions:s});d&&d().forEach(f=>{let h;Array.isArray(f.types)?h=f.types:f.types==="*"?h=c:f.types==="nodes"?h=o:f.types==="marks"?h=a:h=[],h.forEach(p=>{Object.entries(f.attributes).forEach(([g,v])=>{e.push({type:p,name:g,attribute:{...i,...v}})})})})}),s.forEach(u=>{const d=ct(u,"addAttributes",{name:u.name,options:u.options,storage:u.storage});if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const g={...i,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:u.name,name:h,attribute:g})})}),e}function z2(n){const e=[];let t="",r=!1,s=!1,i=0;const o=n.length;for(let a=0;a<o;a+=1){const c=n[a];if(c==="'"&&!s){r=!r,t+=c;continue}if(c==='"'&&!r){s=!s,t+=c;continue}if(!r&&!s){if(c==="("){i+=1,t+=c;continue}if(c===")"&&i>0){i-=1,t+=c;continue}if(c===";"&&i===0){e.push(t),t="";continue}}t+=c}return t&&e.push(t),e}function Ig(n){const e=[],t=z2(n||""),r=t.length;for(let s=0;s<r;s+=1){const i=t[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),c=i.slice(o+1).trim();a&&c&&e.push([a,c])}return e}function pn(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,i])=>{if(s==="__proto__"){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[s]){r[s]=i;return}if(s==="class"){const o=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],c=o.filter(u=>!a.includes(u));r[s]=[...a,...c].join(" ")}else if(s==="style"){const o=new Map([...Ig(r[s]),...Ig(i)]);r[s]=Array.from(o.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[s]=i}),r},{})}function sa(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>pn(t,r),{})}function F2(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Lg(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):F2(t.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function Og(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&B2(t)?!1:t!=null))}function Ng(n){var e,t;const r={};return!(!(n==null||(e=n.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),(n==null||(t=n.attribute)===null||t===void 0?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function H2(n,e){var t;const r=dy(n),{nodeExtensions:s,markExtensions:i}=Wa(n),o=(t=s.find(u=>ct(u,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(s.map(u=>{const d=r.filter(m=>m.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=Og({...n.reduce((m,S)=>{const I=ct(S,"extendNodeSchema",f);return{...m,...I?I(u):{}}},{}),content:hn(ct(u,"content",f)),marks:hn(ct(u,"marks",f)),group:hn(ct(u,"group",f)),inline:hn(ct(u,"inline",f)),atom:hn(ct(u,"atom",f)),selectable:hn(ct(u,"selectable",f)),draggable:hn(ct(u,"draggable",f)),code:hn(ct(u,"code",f)),whitespace:hn(ct(u,"whitespace",f)),linebreakReplacement:hn(ct(u,"linebreakReplacement",f)),defining:hn(ct(u,"defining",f)),isolating:hn(ct(u,"isolating",f)),attrs:Object.fromEntries(d.map(Ng))}),p=hn(ct(u,"parseHTML",f));p&&(h.parseDOM=p.map(m=>Lg(m,d)));const g=ct(u,"renderHTML",f);g&&(h.toDOM=m=>g({node:m,HTMLAttributes:sa(m,d)}));const v=ct(u,"renderText",f);return v&&(h.toText=v),[u.name,h]})),c=Object.fromEntries(i.map(u=>{const d=r.filter(v=>v.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=Og({...n.reduce((v,m)=>{const S=ct(m,"extendMarkSchema",f);return{...v,...S?S(u):{}}},{}),inclusive:hn(ct(u,"inclusive",f)),excludes:hn(ct(u,"excludes",f)),group:hn(ct(u,"group",f)),spanning:hn(ct(u,"spanning",f)),code:hn(ct(u,"code",f)),attrs:Object.fromEntries(d.map(Ng))}),p=hn(ct(u,"parseHTML",f));p&&(h.parseDOM=p.map(v=>Lg(v,d)));const g=ct(u,"renderHTML",f);return g&&(h.toDOM=v=>g({mark:v,HTMLAttributes:sa(v,d)})),[u.name,h]}));return new $v({topNode:o,nodes:a,marks:c})}function U2(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function kl(n){return n.sort((t,r)=>{const s=ct(t,"priority")||100,i=ct(r,"priority")||100;return s>i?-1:s<i?1:0})}function fy(n){const e=kl(_h(n)),t=U2(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Ch(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=`
13
+ `))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let f=n.someProp("clipboardTextParser",h=>h(e,s,r,n));if(f)a=f;else{let h=s.marks(),{schema:p}=n.state,g=aa.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let m=o.appendChild(document.createElement("p"));v&&m.appendChild(g.serializeNode(p.text(v,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=KC(t),Nu&&jC(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=o.firstChild;for(;h&&!kt(h);)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||mo.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!UC.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=GC(bg(a,+d[1],+d[2]),d[4]);else if(a=He.maxOpen(VC(a.content,s),!0),a.openStart||a.openEnd){let f=0,h=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=bg(a,f,h)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const UC=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function VC(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(a=>{if(!o)return;let c=s.findWrapping(a.type),u;if(!c)return o=null;if(u=o.length&&i.length&&Nb(c,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Db(o[o.length-1],i.length));let d=Ob(a,c);o.push(d),s=s.matchType(d.type),i=c}}),o)return _e.from(o)}return n}function Ob(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,_e.from(n));return n}function Nb(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=Nb(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(_e.from(Ob(t,n,s+1))))}}function Db(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Db(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(_e.empty,!0);return n.copy(t.append(r))}function pf(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(i=0),s<r-1&&(a=pf(a,e,t,r,s+1,i)),s>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(_e.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function bg(n,e,t){return e<n.openStart&&(n=new He(pf(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new He(pf(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const $b={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Bb(){return document.implementation.createHTMLDocument("title")}let ol=null;function WC(n){let e=window.trustedTypes;if(!e)return n;if(!ol){if(ol=e.defaultPolicy)try{return ol.createHTML(n)}catch{}ol=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return ol.createHTML(n)}function KC(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Bb(),r=t.body,s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&$b[s[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=WC(n),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<t.styleSheets.length;o++){let a=t.styleSheets[o];for(let c=0;c<a.rules.length;c++){let u=a.rules[c];if(u instanceof CSSStyleRule){let d=r.querySelectorAll(u.selectorText);for(let f=0;f<d.length;f++)d[f].style.cssText+=u.style.cssText}}}return r}function jC(n){let e=n.querySelectorAll(jr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function GC(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let c=t.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;try{s=_e.from(c.create(r[a+1],s))}catch{break}i++,o++}return new He(s,i,o)}const ds={},fs={},qC={touchstart:!0,touchmove:!0};class JC{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function XC(n){for(let e in ds){let t=ds[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{QC(n,r)&&!mh(n,r)&&(n.editable||!(r.type in fs))&&t(n,r)},qC[e]?{passive:!0}:void 0)}Qr&&n.dom.addEventListener("input",()=>null),gf(n)}function $i(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function YC(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function gf(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>mh(n,r))})}function mh(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function QC(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function ZC(n,e){!mh(n,e)&&ds[e.type]&&(n.editable||!(e.type in fs))&&ds[e.type](n,e)}fs.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Ub(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Di&&jr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ua&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,zo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||HC(n,t)?t.preventDefault():$i(n,"key")};fs.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};fs.keypress=(n,e)=>{let t=e;if(Ub(n)||!t.charCode||t.ctrlKey&&!t.altKey||qs&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof et)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function Ql(n){return{left:n.clientX,top:n.clientY}}function eM(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function vh(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,a=>o>i.depth?a(n,t,i.nodeAfter,i.before(o),s,!0):a(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function Zl(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function tM(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&vt.isSelectable(r)?(Zl(n,new vt(t)),!0):!1}function nM(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof vt&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(vt.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(Zl(n,vt.create(n.state.doc,s)),!0):!1}function rM(n,e,t,r,s){return vh(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?nM(n,t):tM(n,t))}function sM(n,e,t,r){return vh(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function iM(n,e,t,r){return vh(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||oM(n,t,r)}function oM(n,e,t){if(t.button!=0)return!1;let r=zb(n,e,!0),s=n.state.doc;return r?(Zl(n,r),r instanceof et&&s.eq(n.state.doc)&&(n.input.mouseDown=new lM(n,r)),!0):!1}function zb(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?et.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)return et.create(r,a+1,a+1+o.content.size);if(t&&vt.isSelectable(o))return vt.create(r,a)}return null}function bh(n){return jc(n)}const Fb=qs?"metaKey":"ctrlKey";ds.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=bh(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&eM(t,n.input.lastClick)&&!t[Fb]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let o=n.posAtCoords(Ql(t));o&&(i=="singleClick"?n.input.mouseDown=new aM(n,o,t,!!r):(i=="doubleClick"?sM:iM)(n,o.pos,o.inside,t)?t.preventDefault():$i(n,"pointer"))};class Hb{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class aM extends Hb{constructor(e,t,r,s){super(e),this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Fb],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,o=d.depth?d.before():0}const a=s?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&kt(c.nodeDOM)?c.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof vt&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ds&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),$i(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||zi(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ql(e))),this.updateAllowDefault(e),this.allowDefault||!t?$i(this.view,"pointer"):rM(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qr&&this.mightDrag&&!this.mightDrag.node.isAtom||jr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Zl(this.view,jt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):$i(this.view,"pointer")}move(e){this.updateAllowDefault(e),$i(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class lM extends Hb{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),$i(this.view,"pointer");let t=this.view.posAtCoords(Ql(e)),r=t&&zb(this.view,t.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,a]=r.from<i.from?[i.to,r.from]:[i.from,r.to];Zl(this.view,et.create(s,o,a))}}ds.touchstart=n=>{n.input.lastTouch=Date.now(),bh(n),$i(n,"pointer")};ds.touchmove=n=>{n.input.lastTouch=Date.now(),$i(n,"pointer")};ds.contextmenu=n=>bh(n);function Ub(n,e){return n.composing?!0:Qr&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const cM=Di?5e3:-1;fs.compositionstart=fs.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof et&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||jr&&vb&&uM(n)))n.markCursor=n.state.storedMarks||t.marks(),jc(n,!0),n.markCursor=null;else if(jc(n,!e.selection.empty),Ds&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&kt(s)&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(wr(o)){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}Vb(n,cM)};function uM(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||!kt(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return kt(r)&&r.contentEditable=="false"}fs.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Vb(n,20))};function Vb(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>jc(n),e))}function Wb(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function dM(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=nC(e.focusNode,e.focusOffset),r=rC(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function jc(n,e=!1){if(!(Di&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Wb(n),e||n.docView&&n.docView.dirty){let t=hh(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function fM(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const $l=Ts&&vo<15||Ua&&aC<604;ds.copy=fs.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=$l?null:t.clipboardData,o=r.content(),{dom:a,text:c}=gh(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):fM(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hM(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function pM(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Bl(n,r.value,null,s,e):Bl(n,r.textContent,r.innerHTML,s,e)},50)}function Bl(n,e,t,r,s){let i=Lb(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,s,i||He.empty)))return!0;if(!i)return!1;let o=hM(i),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Kb(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}fs.paste=(n,e)=>{let t=e;if(n.composing&&!Di)return;let r=$l?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Bl(n,Kb(r),r.getData("text/html"),s,t)?t.preventDefault():pM(n,t)};class jb{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const gM=qs?"altKey":"ctrlKey";function Gb(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[gM]}ds.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(Ql(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof vt?s.to-1:s.to))){if(r&&r.mightDrag)o=vt.create(n.state.doc,r.mightDrag.pos);else if(t.target&&kt(t.target)){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=vt.create(n.state.doc,f.posBefore))}}let a=(o||n.state.selection).content(),{dom:c,text:u,slice:d}=gh(n,a);(!t.dataTransfer.files.length||!jr||mb>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData($l?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",$l||t.dataTransfer.setData("text/plain",u),n.dragging=new jb(d,Gb(n,t),o)};ds.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};fs.dragover=fs.dragenter=(n,e)=>e.preventDefault();fs.drop=(n,e)=>{try{mM(n,e,n.dragging)}finally{n.dragging=null}};function mM(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Ql(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=Lb(n,Kb(e.dataTransfer),$l?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&Gb(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||He.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?qv(n.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(o){let{node:p}=t;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&vt.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new vt(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,v,m,S)=>p=S),c.setSelection(ph(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}ds.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&zi(n)},20))};ds.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};ds.beforeinput=(n,e)=>{if(Di&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,zo(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in fs)ds[n]=fs[n];function zl(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Gc{constructor(e,t){this.toDOM=e,this.spec=t||Yo,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new Rr(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&zl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wo{constructor(e,t){this.attrs=e,this.spec=t||Yo}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Rr(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof wo&&zl(this.attrs,e.attrs)&&zl(this.spec,e.spec)}static is(e){return e.type instanceof wo}destroy(){}}class yh{constructor(e,t){this.attrs=e,this.spec=t||Yo}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Rr(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof yh&&zl(this.attrs,e.attrs)&&zl(this.spec,e.spec)}destroy(){}}class Rr{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Rr(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Rr(e,e,new Gc(t,r))}static inline(e,t,r,s){return new Rr(e,t,new wo(r,s))}static node(e,t,r,s){return new Rr(e,t,new yh(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof wo}get widget(){return this.type instanceof Gc}}const Aa=[],Yo={};class Qt{constructor(e,t){this.local=e.length?e:Aa,this.children=t.length?t:Aa}static create(e,t){return t.length?qc(t,e,0,Yo):Jr}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,s+a,i)}}map(e,t,r){return this==Jr||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Yo)}mapInner(e,t,r,s,i){let o;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,s);c&&c.type.valid(t,c)?(o||(o=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?vM(this.children,o||[],e,t,r,s,i):o?new Qt(o.sort(Qo),Aa):Jr}add(e,t){return t.length?this==Jr?Qt.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((a,c)=>{let u=c+r,d;if(d=Jb(t,a,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<c;)i+=3;s[i]==c?s[i+2]=s[i+2].addInner(a,d,u+1):s.splice(i,0,c,c+a.nodeSize,qc(d,a,u+1,Yo)),i+=3}});let o=qb(i?Xb(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Qt(o.length?this.local.concat(o).sort(Qo):this.local,s||this.children)}remove(e){return e.length==0||this==Jr?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+t,c=r[i+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>a&&f.to<c&&(e[d]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,a+1);u!=Jr?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Qt(s,r):Jr}forChild(e,t){if(this==Jr)return this;if(t.isLeaf)return Qt.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+t.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<o&&c.to>i&&c.type instanceof wo){let u=Math.max(i,c.from)-i,d=Math.min(o,c.to)-i;u<d&&(s||(s=[])).push(c.copy(u,d))}}if(s){let a=new Qt(s.sort(Qo),Aa);return r?new co([a,r]):a}return r||Jr}eq(e){if(this==e)return!0;if(!(e instanceof Qt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return wh(this.localsInner(e))}localsInner(e){if(this==Jr)return Aa;if(e.inlineContent||!this.local.some(wo.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof wo||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Qt.empty=new Qt([],[]);Qt.removeOverlap=wh;const Jr=Qt.empty;class co{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,Yo));return co.from(r)}forChild(e,t){if(t.isLeaf)return Qt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=Jr&&(i instanceof co?r=r.concat(i.members):r.push(i))}return co.from(r)}eq(e){if(!(e instanceof co)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?wh(r?t:t.sort(Qo)):Aa}static from(e){switch(e.length){case 0:return Jr;case 1:return e[0];default:return new co(e.every(t=>t instanceof Qt)?e:e.reduce((t,r)=>t.concat(r instanceof Qt?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function vM(n,e,t,r,s,i,o){let a=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((h,p,g,v)=>{let m=v-g-(p-h);for(let S=0;S<a.length;S+=3){let I=a[S+1];if(I<0||h>I+d-f)continue;let C=a[S]+d-f;p>=C?a[S+1]=h<=C?-2:-1:h>=d&&m&&(a[S]+=m,a[S+1]+=m)}f+=m}),d=t.maps[u].map(d,-1)}let c=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){c=!0,a[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-s;if(f<0||f>=r.content.size){c=!0;continue}let h=t.map(n[u+1]+i,-1),p=h-s,{index:g,offset:v}=r.content.findIndex(f),m=r.maybeChild(g);if(m&&v==f&&v+m.nodeSize==p){let S=a[u+2].mapInner(t,m,d+1,n[u]+i+1,o);S!=Jr?(a[u]=f,a[u+1]=p,a[u+2]=S):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=bM(a,n,e,t,s,i,o),d=qc(u,r,0,o);e=d.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new Qt(e.sort(Qo),a)}function qb(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new Rr(s.from+e,s.to+e,s.type))}return t}function bM(n,e,t,r,s,i,o){function a(c,u){for(let d=0;d<c.local.length;d++){let f=c.local[d].map(r,s,u);f?t.push(f):o.onRemove&&o.onRemove(c.local[d].spec)}for(let d=0;d<c.children.length;d+=3)a(c.children[d+2],c.children[d]+u+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+i+1);return t}function Jb(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Xb(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function qc(n,e,t,r){let s=[],i=!1;e.forEach((a,c)=>{let u=Jb(n,a,c+t);if(u){i=!0;let d=qc(u,a,t+c+1,r);d!=Jr&&s.push(c,c+a.nodeSize,d)}});let o=qb(i?Xb(n):n,-t).sort(Qo);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new Qt(o,s):Jr}function Qo(n,e){return n.from-e.from||n.to-e.to}function wh(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),yg(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),yg(e,s,r.copy(i.from,r.to)));break}}}return e}function yg(n,e,t){for(;e<n.length&&Qo(t,n[e])>0;)e++;n.splice(e,0,t)}function yd(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Jr&&e.push(r)}),n.cursorWrapper&&e.push(Qt.create(n.state.doc,[n.cursorWrapper.deco])),co.from(e)}const yM={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},wM=Ts&&vo<=11;class xM{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class kM{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new xM,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Ts&&vo<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Qr&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),wM&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yM)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(fg(this.view)){if(this.suppressingSelectionUpdates)return zi(this.view);if(Ts&&vo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&na(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=Ha(i))t.add(i);for(let i=e.anchorNode;i;i=Ha(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:wr(r)?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&fg(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,c=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],c);f&&(i=i<0?f.from:Math.min(f.from,i),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(c.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||jr&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of c)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;for(;f&&kt(f);){if(f.contentEditable=="false"){d.parentNode.removeChild(d);break}f=f.firstChild}}}else if(Ds&&c.length){let d=c.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||CM(e,f)!=p)&&h.remove()}}}let u=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ou(r)&&(u=hh(e))&&u.eq(jt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,zi(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),_M(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,MM(e,c)),this.handleDOMChange(i,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||zi(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),wr(f)&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Ts&&vo<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?Vr(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),c=i&&i.parentNode==e.target?Vr(i):e.target.childNodes.length,u=r.localPosFromDOM(e.target,c,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let wg=new WeakMap,xg=!1;function _M(n){if(!wg.has(n)&&(wg.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ds,xg)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),xg=!0}}function kg(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return na(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function SM(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return kg(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?kg(n,t):null}function CM(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function MM(n,e){var t;let{focusNode:r,focusOffset:s}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let c=a.firstChild;if(!c||!kt(c)||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;a=c}a.insertBefore(i,a.firstChild),r==i&&n.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function TM(n,e,t,r){let{node:s,fromOffset:i,toOffset:o,from:a,to:c}=n.docView.parseRange(e,t),u=n.domSelectionRange(),d,f=u.anchorNode;if(f&&ra(n.dom,f)&&(d=[{node:f,offset:u.anchorOffset}],Ou(u)||d.push({node:u.focusNode,offset:u.focusOffset})),jr&&n.input.lastKeyCode===8)for(let S=o;S>i;S--){let I=s.childNodes[S-1],C=I.pmViewDesc;if(I.nodeName=="BR"&&!C){o=S;break}if(!C||C.size)break}let h=n.state.doc,p=n.someProp("domParser")||mo.fromSchema(n.state.schema),g=h.resolve(a),v=null,m=p.parse(s,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:o,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:EM(r),context:g});if(d&&d[0].pos!=null){let S=d[0].pos,I=d[1]&&d[1].pos;I==null&&(I=S),v={anchor:S+a,head:I+a}}return{doc:m,sel:v,from:a,to:c}}const EM=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(Qr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Qr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},AM=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function RM(n,e,t,r,s){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,z=hh(n,E);if(z&&!n.state.selection.eq(z)){if(jr&&Di&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",J=>J(n,zo(13,"Enter"))))return;let G=n.state.tr.setSelection(z);E=="pointer"?G.setMeta("pointer",!0):E=="key"&&G.scrollIntoView(),i&&G.setMeta("composition",i),n.dispatch(G)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,u=TM(n,e,t,s),d=n.state.doc,f=d.slice(u.from,u.to),h,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,p="end"):(h=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let g=OM(f.content,u.doc.content,u.from,h,p);if(g&&n.input.domChangeCount++,(Ua&&n.input.lastIOSEnter>Date.now()-225||Di)&&s.some(E=>kt(E)&&!AM.test(E.nodeName))&&(!g||g.endA>=g.endB)&&n.someProp("handleKeyDown",E=>E(n,zo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!g)if(r&&c instanceof et&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))g={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let E=_g(n,n.state.doc,u.sel);if(E&&!E.eq(n.state.selection)){let z=n.state.tr.setSelection(E);i&&z.setMeta("composition",i),n.dispatch(z)}}return}n.state.selection.from<n.state.selection.to&&g.start==g.endB&&n.state.selection instanceof et&&(g.start>n.state.selection.from&&g.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?g.start=n.state.selection.from:g.endA<n.state.selection.to&&g.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(g.endB+=n.state.selection.to-g.endA,g.endA=n.state.selection.to)),Ts&&vo<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>u.from&&u.doc.textBetween(g.start-u.from-1,g.start-u.from+1)=="  "&&(g.start--,g.endA--,g.endB--);let v=u.doc.resolveNoCache(g.start-u.from),m=u.doc.resolveNoCache(g.endB-u.from),S=d.resolve(g.start),I=v.sameParent(m)&&v.parent.inlineContent&&S.end()>=g.endA;if((Ua&&n.input.lastIOSEnter>Date.now()-225&&(!I||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!I&&LM(u.doc,v.pos,m.pos))&&n.someProp("handleKeyDown",E=>E(n,zo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>g.start&&IM(d,g.start,g.endA,v,m)&&n.someProp("handleKeyDown",E=>E(n,zo(8,"Backspace")))){Di&&jr&&n.domObserver.suppressSelectionUpdates();return}jr&&g.endB==g.start&&(n.input.lastChromeDelete=Date.now()),Di&&!I&&v.start()!=m.start()&&m.parentOffset==0&&v.depth==m.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,m=u.doc.resolveNoCache(g.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,zo(13,"Enter"))})},20));let C=g.start,M=g.endA,O=E=>{let z=E||n.state.tr.replace(C,M,u.doc.slice(g.start-u.from,g.endB-u.from));if(u.sel){let G=_g(n,z.doc,u.sel);G&&!(jr&&n.composing&&G.empty&&(g.start!=g.endB||n.input.lastChromeDelete<Date.now()-100)&&(G.head==C||G.head==z.mapping.map(M)-1)||Ts&&G.empty&&G.head==C)&&z.setSelection(G)}return i&&z.setMeta("composition",i),z.scrollIntoView()},P;if(I)if(v.pos==m.pos){Ts&&vo<=11&&v.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>zi(n),20));let E=O(n.state.tr.delete(C,M)),z=d.resolve(g.start).marksAcross(d.resolve(g.endA));z&&E.ensureMarks(z),n.dispatch(E)}else if(g.endA==g.endB&&(P=PM(v.parent.content.cut(v.parentOffset,m.parentOffset),S.parent.content.cut(S.parentOffset,g.endA-S.start())))){let E=O(n.state.tr);P.type=="add"?E.addMark(C,M,P.mark):E.removeMark(C,M,P.mark),n.dispatch(E)}else if(v.parent.child(v.index()).isText&&v.index()==m.index()-(m.textOffset?0:1)){let E=v.parent.textBetween(v.parentOffset,m.parentOffset),z=()=>O(n.state.tr.insertText(E,C,M));n.someProp("handleTextInput",G=>G(n,C,M,E,z))||n.dispatch(z())}else n.dispatch(O());else n.dispatch(O())}function _g(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ph(n,e.resolve(t.anchor),e.resolve(t.head))}function PM(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,i=r,o,a,c;for(let d=0;d<r.length;d++)s=r[d].removeFromSet(s);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",c=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",c=d=>d.mark(a.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(c(e.child(d)));if(_e.from(u).eq(n))return{mark:a,type:o}}function IM(n,e,t,r,s){if(t-e<=s.pos-r.pos||wd(r,!0,!1)<s.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&t==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=n.resolve(wd(i,!0,!0));return!o.parent.isTextblock||o.pos>t||wd(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function LM(n,e,t){let r=0,s=0;return n.nodesBetween(e,t,(i,o)=>{i.isTextblock&&o>=e&&o<t?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-o),Math.min(i.nodeSize,t-o))):i.isLeaf)&&s++}),s==0&&r==1}function wd(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function OM(n,e,t,r,s){let i=n.findDiffStart(e,t),o=t+n.size,a=t+e.size;if(i==null)return null;let{a:c,b:u}=n.findDiffEnd(e,o,a);if(s=="end"){let d=Math.max(0,i-Math.min(c,u));r-=c+d-i}if(c<i&&o<a){let d=r<=i&&r>=c?i-r:0;i-=d,u=i+(u-c),c=i}else if(u<i){let d=r<=i&&r>=u?i-r:0;i-=d,c=i+(c-u),u=i}return{start:i,endA:c,endB:u}}class Yb{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new JC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Eg),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Mg(this),Cg(this),this.nodeViews=Tg(this),this.docView=og(this.state.doc,Sg(this),yd(this),this.dom,this),this.domObserver=new kM(this,(r,s,i,o)=>RM(this,r,s,i,o)),this.domObserver.start(),XC(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&gf(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Eg),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(Wb(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Tg(this);DM(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&gf(this),this.editable=Mg(this),Cg(this);let c=yd(this),u=Sg(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,c);(f||!e.selection.eq(s.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&uC(this);if(o){this.domObserver.stop();let p=f&&(Ts||jr)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&NM(s.selection,e.selection);if(f){let v=jr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=dM(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=og(e.doc,u,c,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let g=this.input.mouseDown;p||!(g&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&OC(this)&&g.delaySelUpdate())?zi(this,p):(Rb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&dC(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!ra(this.dom,e))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof vt){let t=this.docView.domAfterPos(this.state.selection.from);kt(t)&&tg(this,t.getBoundingClientRect(),e)}else tg(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new jb(e.slice,e.move,s<0?void 0:vt.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=t?t(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=t?t(a):a))return s}}hasFocus(){if(Ts){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&fC(this.dom),zi(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return vC(this,e)}coordsAtPos(e,t=1){return kb(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return kC(this,t||this.state,e)}pasteHTML(e,t){return Bl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Bl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return gh(this,e)}destroy(){this.docView&&(YC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,eC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ZC(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?Qr&&this.root.nodeType===11&&iC(this.dom.ownerDocument)==this.dom&&SM(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Yb.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Sg(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Rr.node(0,n.state.doc.content.size,e)]}function Cg(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Rr.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Mg(n){return!n.someProp("editable",e=>e(n.state)===!1)}function NM(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Tg(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function DM(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function Eg(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ko={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Jc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$M=typeof navigator<"u"&&/Mac/.test(navigator.platform),BM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wr=0;Wr<10;Wr++)ko[48+Wr]=ko[96+Wr]=String(Wr);for(var Wr=1;Wr<=24;Wr++)ko[Wr+111]="F"+Wr;for(var Wr=65;Wr<=90;Wr++)ko[Wr]=String.fromCharCode(Wr+32),Jc[Wr]=String.fromCharCode(Wr);for(var xd in ko)Jc.hasOwnProperty(xd)||(Jc[xd]=ko[xd]);function zM(n){var e=$M&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||BM&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Jc:ko)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const FM=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),HM=typeof navigator<"u"&&/Win/.test(navigator.platform);function UM(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))FM?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function VM(n){let e=Object.create(null);for(let t in n)e[UM(t)]=n[t];return e}function kd(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function WM(n){return new kn({props:{handleKeyDown:Qb(n)}})}function Qb(n){let e=VM(n);return function(t,r){let s=zM(r),i,o=e[kd(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[kd(s,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(HM&&r.ctrlKey&&r.altKey)&&(i=ko[r.keyCode])&&i!=s){let a=e[kd(i,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}function $u(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}}var Oa=class Zb{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:s}=t,{tr:i}=r,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...d)=>{const f=c(...d)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(i),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a=[],c=!!e,u=e||i.tr,d=()=>(!c&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...v)=>{const m=this.buildProps(u,t),S=p(...v)(m);return a.push(S),f}])),run:d};return f}static createFakeChain(){const e=new Proxy({},{get:(t,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:t,state:r}=this,s=!1,i=e||r.tr,o=this.buildProps(i,s);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,s)}}static createFallbackCan(){const e=Zb.createFakeChain();return new Proxy({chain:()=>e},{get:(t,r)=>{if(r!=="then")return r==="chain"?t.chain:()=>!1}})}buildProps(e,t=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a={tr:e,editor:s,view:o,state:$u({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([c,u])=>[c,(...d)=>u(...d)(a)]))}};return a}};const KM=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{if(!n.isDestroyed){var t;e.dom.blur(),(t=window)===null||t===void 0||(t=t.getSelection())===null||t===void 0||t.removeAllRanges()}}),!0),jM=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),GM=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:i,$to:o})=>{n.doc.nodesBetween(i.pos,o.pos,(a,c)=>{if(a.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(c)),h=u.resolve(d.map(c+a.nodeSize)),p=f.blockRange(h);if(!p)return;const g=qa(p);if(a.type.isTextblock){const{defaultType:v}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,v)}(g||g===0)&&e.lift(p,g)})}),!0},qM=n=>e=>n(e),JM=()=>({state:n,dispatch:e})=>db(n,e),XM=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,i=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new et(r.doc.resolve(Math.max(o-1,0)))),!0},YM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const o=s.before(i),a=s.after(i);n.delete(o,a).scrollIntoView()}return!0}return!1};function xr(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}const QM=n=>({tr:e,state:t,dispatch:r})=>{const s=xr(n,t.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),c=i.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},ZM=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},e2=n=>n.content?/^text(\*|\+)/.test(n.content):!1,Ag=(n,e,t)=>{if(!n.parent.isInline||t==="left"&&n.pos>n.start()||t==="right"&&n.pos<n.end())return n.pos;const r=e.nodes[n.parent.type.name].spec;return e2(r)?t==="left"?n.start()-1:n.end()+1:n.pos},t2=(n,e,t)=>({from:Ag(n,t,"left"),to:Ag(e,t,"right")}),n2=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,s=t.steps.length;r.forEach(i=>{const o=t.mapping.slice(s),a=t.doc.resolve(o.map(i.$from.pos)),c=t.doc.resolve(o.map(i.$to.pos)),{from:u,to:d}=t2(a,c,n.schema);t.deleteRange(u,d)}),t.selection.empty||t.setSelection(et.near(t.doc.resolve(t.selection.from))),t.scrollIntoView(),e(t)}return!0},r2=()=>({commands:n})=>n.keyboardShortcut("Enter"),s2=()=>({state:n,dispatch:e})=>zS(n,e);function xh(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Xc(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:xh(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function ey(n,e,t={}){return n.find(r=>r.type===e&&Xc(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Rg(n,e,t={}){return!!ey(n,e,t)}function kh(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!t){const c=r.node.marks.find(u=>u.type===e);c&&(t=c.attrs)}if(!ey([...r.node.marks],e,t))return;let s=r.index,i=n.start()+r.offset,o=s+1,a=i+r.node.nodeSize;for(;s>0&&Rg([...n.parent.child(s-1).marks],e,t);)s-=1,i-=n.parent.child(s).nodeSize;for(;o<n.parent.childCount&&Rg([...n.parent.child(o).marks],e,t);)a+=n.parent.child(o).nodeSize,o+=1;return{from:i,to:a}}function Ki(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const i2=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=Ki(n,r.schema),{doc:o,selection:a}=t,{$from:c,from:u,to:d}=a;if(s){const f=kh(c,i,e);if(f&&f.from<=u&&f.to>=d){const h=et.create(o,f.from,f.to);t.setSelection(h)}}return!0},o2=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function ty(n){return n instanceof et}function Ko(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function mf(n,e=null){if(!e)return null;const t=jt.atStart(n),r=jt.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?et.create(n,Ko(0,s,i),Ko(n.content.size,s,i)):et.create(n,Ko(e,s,i),Ko(e,s,i))}function vf(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Fl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function a2(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const l2=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Fl()||vf())&&r.dom.focus(),a2()&&!Fl()&&!vf()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!ty(t.state.selection))return o(),!0;const a=mf(s.doc,n)||t.state.selection,c=t.state.selection.eq(a);return i&&(c||s.setSelection(a),c&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},c2=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),u2=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),ny=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&ny(r)}return n};function dc(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return ny(t)}function ry(n){return typeof n?.nodesBetween=="function"}function Va(n,e,t){if(ry(n))return n;const r=typeof n=="object"&&n!==null;t={slice:!0,parseOptions:{},...t};const s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return _e.fromArray(n.map(o=>e.nodeFromJSON(o)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Va("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const c=new $v({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?mo.fromSchema(c).parseSlice(dc(n),t.parseOptions):mo.fromSchema(c).parse(dc(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=mo.fromSchema(e);return t.slice?i.parseSlice(dc(n),t.parseOptions).content:i.parse(dc(n),t.parseOptions)}return Va("",e,t)}function sy(n){return!("type"in n)}function iy(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof sr||s instanceof Pr))return;const i=n.mapping.maps[r];let o=0;i.forEach((a,c,u,d)=>{o===0&&(o=d)}),n.setSelection(jt.near(n.doc.resolve(o),t))}const d2=(n,e,t)=>({tr:r,dispatch:s,editor:i})=>{if(s){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=m=>{i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Va(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(m){c(m)}try{var o;a=Va(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(m){return c(m),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,p=!0;const g=sy(a)?a.content:[a];if(g.forEach(m=>{m.check(),h=h?m.isText&&m.marks.length===0:!1,p=p?m.isBlock:!1}),d===f&&p){const{parent:m}=r.doc.resolve(d);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(d-=1,f+=1)}let v;if(h)Array.isArray(e)?v=e.map(m=>m.text||"").join(""):ry(e)?v=g.map(m=>{var S;return(S=m.text)!==null&&S!==void 0?S:""}).join(""):typeof e=="object"&&e&&e.text?v=e.text:v=e,r.insertText(v,d,f);else{v=_e.from(g);const m=r.doc.resolve(d),S=m.node(),I=m.parentOffset===0,C=S.isText||S.isTextblock,M=S.content.size>0;I&&C&&M&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}t.updateSelection&&iy(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:v}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:v})}return!0};function oy(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const f2=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:a=!0}=n;let c;typeof s=="number"?c=e.doc.resolve(s):s?c=s:c=e.selection.$from;const u=oy(c.parent.contentMatchAt(c.index()));if(!u)return!1;const d=Object.keys(u.spec.attrs||{}),f=i?Object.fromEntries(Object.entries(i).filter(([p])=>d.includes(p))):{};let h;if(o){const p=Va(o,r.schema);h=u.createAndFill(f,p)}else h=u.createAndFill(f);return h?(t&&(e.insert(c.pos,h),a&&iy(e,e.steps.length-1,-1)),!0):!1},h2=()=>({state:n,dispatch:e})=>DS(n,e),p2=()=>({state:n,dispatch:e})=>$S(n,e),g2=()=>({state:n,dispatch:e})=>sb(n,e),m2=()=>({state:n,dispatch:e})=>lb(n,e),v2=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Pu(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},b2=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Pu(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},y2=()=>({state:n,dispatch:e})=>OS(n,e),w2=()=>({state:n,dispatch:e})=>NS(n,e);function ay(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function x2(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))Fl()||ay()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}const k2=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=x2(n).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,a))});return c?.steps.forEach(u=>{const d=u.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function Ui(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?xr(e,n.schema):null,a=[];n.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(s,f+d.nodeSize);a.push({node:d,from:h,to:p})});const c=s-r,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Xc(d.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=c}const _2=(n,e={})=>({state:t,dispatch:r})=>Ui(t,xr(n,t.schema),e)?BS(t,r):!1,S2=()=>({state:n,dispatch:e})=>fb(n,e),C2=n=>({state:e,dispatch:t})=>{const r=xr(n,e.schema);return XS(r)(e,t)},M2=()=>({state:n,dispatch:e})=>ub(n,e);function Bu(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Pg(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}const T2=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=Bu(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=xr(n,r.schema)),a==="mark"&&(o=Ki(n,r.schema));let c=!1;return t.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(c=!0,s&&t.setNodeMarkup(f,void 0,Pg(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(h=>{o===h.type&&(c=!0,s&&t.addMark(f,f+d.nodeSize,o.create(Pg(h.attrs,e))))})})}),c},E2=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),A2=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ns(n.doc);n.setSelection(t)}return!0},R2=()=>({state:n,dispatch:e})=>ob(n,e),P2=()=>({state:n,dispatch:e})=>cb(n,e),I2=()=>({state:n,dispatch:e})=>US(n,e),L2=()=>({state:n,dispatch:e})=>KS(n,e),O2=()=>({state:n,dispatch:e})=>WS(n,e);function Yc(n,e,t={},r={}){return Va(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const N2=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:c}=i;if(r.preserveWhitespace!=="full"){const u=Yc(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});if(o){const d=sy(u)?u.content:[u];i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t)}return!0}return o&&i.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function ly(n,e){const t=Ki(e,n.schema),{from:r,to:s,empty:i}=n.selection,o=[];i?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,c=>{o.push(...c.marks)});const a=o.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function cy(n,e){const t=new Zv(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function u$(n,e){const t=[];return n.descendants((r,s)=>{e(r)&&t.push({node:r,pos:s})}),t}function D2(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function $2(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function zu(n){return e=>$2(e.$from,n)}function ct(n,e,t){return n.config[e]===void 0&&n.parent?ct(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ct(n.parent,e,t):null}):n.config[e]}function _h(n){return n.map(e=>{const t=ct(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,..._h(t())]:e}).flat(10)}function Sh(n,e){const t=aa.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function uy(n){return typeof n=="function"}function hn(n,e=void 0,...t){return uy(n)?e?n.bind(e)(...t):n(...t):n}function B2(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Wa(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function dy(n){const e=[],{nodeExtensions:t,markExtensions:r}=Wa(n),s=[...t,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),c=[...o,...a];return n.forEach(u=>{const d=ct(u,"addGlobalAttributes",{name:u.name,options:u.options,storage:u.storage,extensions:s});d&&d().forEach(f=>{let h;Array.isArray(f.types)?h=f.types:f.types==="*"?h=c:f.types==="nodes"?h=o:f.types==="marks"?h=a:h=[],h.forEach(p=>{Object.entries(f.attributes).forEach(([g,v])=>{e.push({type:p,name:g,attribute:{...i,...v}})})})})}),s.forEach(u=>{const d=ct(u,"addAttributes",{name:u.name,options:u.options,storage:u.storage});if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const g={...i,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:u.name,name:h,attribute:g})})}),e}function z2(n){const e=[];let t="",r=!1,s=!1,i=0;const o=n.length;for(let a=0;a<o;a+=1){const c=n[a];if(c==="'"&&!s){r=!r,t+=c;continue}if(c==='"'&&!r){s=!s,t+=c;continue}if(!r&&!s){if(c==="("){i+=1,t+=c;continue}if(c===")"&&i>0){i-=1,t+=c;continue}if(c===";"&&i===0){e.push(t),t="";continue}}t+=c}return t&&e.push(t),e}function Ig(n){const e=[],t=z2(n||""),r=t.length;for(let s=0;s<r;s+=1){const i=t[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),c=i.slice(o+1).trim();a&&c&&e.push([a,c])}return e}function pn(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,i])=>{if(s==="__proto__"){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[s]){r[s]=i;return}if(s==="class"){const o=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],c=o.filter(u=>!a.includes(u));r[s]=[...a,...c].join(" ")}else if(s==="style"){const o=new Map([...Ig(r[s]),...Ig(i)]);r[s]=Array.from(o.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[s]=i}),r},{})}function sa(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>pn(t,r),{})}function F2(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Lg(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):F2(t.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function Og(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&B2(t)?!1:t!=null))}function Ng(n){var e,t;const r={};return!(!(n==null||(e=n.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),(n==null||(t=n.attribute)===null||t===void 0?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function H2(n,e){var t;const r=dy(n),{nodeExtensions:s,markExtensions:i}=Wa(n),o=(t=s.find(u=>ct(u,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(s.map(u=>{const d=r.filter(m=>m.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=Og({...n.reduce((m,S)=>{const I=ct(S,"extendNodeSchema",f);return{...m,...I?I(u):{}}},{}),content:hn(ct(u,"content",f)),marks:hn(ct(u,"marks",f)),group:hn(ct(u,"group",f)),inline:hn(ct(u,"inline",f)),atom:hn(ct(u,"atom",f)),selectable:hn(ct(u,"selectable",f)),draggable:hn(ct(u,"draggable",f)),code:hn(ct(u,"code",f)),whitespace:hn(ct(u,"whitespace",f)),linebreakReplacement:hn(ct(u,"linebreakReplacement",f)),defining:hn(ct(u,"defining",f)),isolating:hn(ct(u,"isolating",f)),attrs:Object.fromEntries(d.map(Ng))}),p=hn(ct(u,"parseHTML",f));p&&(h.parseDOM=p.map(m=>Lg(m,d)));const g=ct(u,"renderHTML",f);g&&(h.toDOM=m=>g({node:m,HTMLAttributes:sa(m,d)}));const v=ct(u,"renderText",f);return v&&(h.toText=v),[u.name,h]})),c=Object.fromEntries(i.map(u=>{const d=r.filter(v=>v.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},h=Og({...n.reduce((v,m)=>{const S=ct(m,"extendMarkSchema",f);return{...v,...S?S(u):{}}},{}),inclusive:hn(ct(u,"inclusive",f)),excludes:hn(ct(u,"excludes",f)),group:hn(ct(u,"group",f)),spanning:hn(ct(u,"spanning",f)),code:hn(ct(u,"code",f)),attrs:Object.fromEntries(d.map(Ng))}),p=hn(ct(u,"parseHTML",f));p&&(h.parseDOM=p.map(v=>Lg(v,d)));const g=ct(u,"renderHTML",f);return g&&(h.toDOM=v=>g({mark:v,HTMLAttributes:sa(v,d)})),[u.name,h]}));return new $v({topNode:o,nodes:a,marks:c})}function U2(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function kl(n){return n.sort((t,r)=>{const s=ct(t,"priority")||100,i=ct(r,"priority")||100;return s>i?-1:s<i?1:0})}function fy(n){const e=kl(_h(n)),t=U2(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Ch(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=`
14
14
 
15
- `,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,s,(c,u,d,f)=>{c.isBlock&&u>r&&(a+=i);const h=o?.[c.type.name];if(h)return d&&(a+=h({node:c,pos:u,parent:d,index:f,range:e})),!1;if(c.isText){var p;a+=c==null||(p=c.text)===null||p===void 0?void 0:p.slice(Math.max(r,u)-u,s-u)}}),a}function V2(n,e){return Ch(n,{from:0,to:n.content.size},e)}function Mh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function W2(n,e){const t=xr(e,n.schema),{from:r,to:s}=n.selection,i=[];n.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function hy(n,e){const t=Bu(typeof e=="string"?e:e.name,n.schema);return t==="node"?W2(n,e):t==="mark"?ly(n,e):{}}function K2(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function j2(n){const e=K2(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,i)=>i!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Fu(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,c)=>{o.push({from:a,to:c})});else{const{from:a,to:c}=t[i];if(a===void 0||c===void 0)return;o.push({from:a,to:c})}o.forEach(({from:a,to:c})=>{const u=e.slice(i).map(a,-1),d=e.slice(i).map(c),f=e.invert().map(u,-1),h=e.invert().map(d);r.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),j2(r)}function Th(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=kh(t.resolve(n),s.type);i&&r.push({mark:s,...i})}):t.nodesBetween(n,e,(s,i)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}const G2=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);a?.type.name===e?o=a:i-=1}return[o,i]},q2=n=>{const e=n.depth-1;if(e<0)return null;const t=n.index(e);return t===0?null:n.node(e).child(t-1)};function Sa(n,e){return e.nodes[n]||e.marks[n]||null}function Pc(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}const J2=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var c,u;const d=((c=(u=s.type.spec).toText)===null||c===void 0?void 0:c.call(u,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),t};function bf(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?Ki(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Xc(d.attrs,t,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(g,v)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const m=Math.max(h,v),S=Math.min(p,v+g.nodeSize),I=S-m;o+=I,a.push(...g.marks.map(C=>({mark:C,from:m,to:S})))})}),o===0)return!1;const c=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Xc(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(c>0?c+u:c)>=o}function X2(n,e,t={}){if(!e)return Ui(n,null,t)||bf(n,null,t);const r=Bu(e,n.schema);return r==="node"?Ui(n,e,t):r==="mark"?bf(n,e,t):!1}const Q2=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=zu(a=>a.type.name===e)(n.selection);if(!i)return!1;const o=n.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Y2=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Dg(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function _d(n,e){const{nodeExtensions:t}=Wa(e),r=t.find(i=>i.name===n);if(!r)return!1;const s=hn(ct(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function ec(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){if(t){if(n.type.name==="hardBreak")return!0;if(n.isText){var r;return!/\S/.test((r=n.text)!==null&&r!==void 0?r:"")}}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(i=>{s!==!1&&(ec(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function py(n){return n instanceof vt}var gy=class my{constructor(e){this.position=e}static fromJSON(e){return new my(e.position)}toJSON(){return{position:this.position}}};function Z2(n,e){const t=e.mapping.mapResult(n.position);return{position:new gy(t.pos),mapResult:t}}function eT(n){return new gy(n)}function tT(n,e,t){const{selection:r}=e;let s=null;if(ty(r)&&(s=r.$cursor),s){var i;const a=(i=n.storedMarks)!==null&&i!==void 0?i:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=r;return o.some(({$from:a,$to:c})=>{let u=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(t),g=!!t.isInSet(d.marks)||!d.marks.some(v=>v.type.excludes(t));u=p&&g}return!u}),u})}const nT=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:a}=i,c=Ki(n,r.schema);if(s)if(o){const u=ly(r,c);t.addStoredMark(c.create({...u,...e}))}else a.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(d,f,(h,p)=>{const g=Math.max(p,d),v=Math.min(p+h.nodeSize,f);h.marks.find(m=>m.type===c)?h.marks.forEach(m=>{c===m.type&&t.addMark(g,v,c.create({...m.attrs,...e}))}):t.addMark(g,v,c.create(e))})});return tT(r,t,c)},rT=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),sT=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=xr(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>Yp(i,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Yp(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},iT=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Ko(n,0,r.content.size),i=vt.create(r,s);e.setSelection(i)}return!0},oT=(n,e)=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&t.doc.nodesBetween(o,a,(c,u)=>{c.isText||t.setNodeMarkup(u,void 0,{...c.attrs,dir:n})}),!0},aT=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=et.atStart(r).from,a=et.atEnd(r).to,c=Ko(s,o,a),u=Ko(i,o,a),d=et.create(r,c,u);e.setSelection(d)}return!0},lT=n=>({state:e,dispatch:t})=>{const r=xr(n,e.schema);return ZS(r)(e,t)};function $g(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e?.includes(s.type.name));n.tr.ensureMarks(r)}}const cT=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:c}=i,u=s.extensionManager.attributes,d=Pc(u,a.node().type.name,a.node().attrs);if(i instanceof vt&&i.node.isBlock)return!a.parentOffset||!Bi(o,a.pos)?!1:(r&&(n&&$g(t,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,h=a.depth===0?void 0:oy(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,g=Bi(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!g&&Bi(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(g=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(g&&(i instanceof et&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const v=e.mapping.map(a.before()),m=e.doc.resolve(v);a.node(-1).canReplaceWith(m.index(),m.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&$g(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return g},uT=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{const o=xr(n,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==o)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){var h;let S=_e.empty;const I=a.index(-1)?1:a.index(-2)?2:3;for(let z=a.depth-I;z>=a.depth-3;z-=1)S=_e.from(a.node(z).copy(S));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,M={...Pc(f,a.node().type.name,a.node().attrs),...e},O=((h=o.contentMatch.defaultType)===null||h===void 0?void 0:h.createAndFill(M))||void 0;S=S.append(_e.from(o.createAndFill(null,O)||void 0));const P=a.before(a.depth-(I-1));t.replace(P,a.after(-C),new He(S,4-I,0));let E=-1;t.doc.nodesBetween(P,t.doc.content.size,(z,G)=>{if(E>-1)return!1;z.isTextblock&&z.content.size===0&&(E=G+1)}),E>-1&&t.setSelection(et.near(t.doc.resolve(E))),t.scrollIntoView()}return!0}const p=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,g={...Pc(f,d.type.name,d.attrs),...e},v={...Pc(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const m=p?[{type:o,attrs:g},{type:p,attrs:v}]:[{type:o,attrs:g}];if(!Bi(t.doc,a.pos,2))return!1;if(s){const{selection:S,storedMarks:I}=r,{splittableMarks:C}=i.extensionManager,M=I||S.$to.parentOffset&&S.$from.marks();if(t.split(a.pos,2,m).scrollIntoView(),!M||!s)return!0;const O=M.filter(P=>C.includes(P.type.name));t.ensureMarks(O)}return!0};function Bg(n){return!n||n==="1"?null:n}function vy(n,e){return Bg(n)===Bg(e)}const Sd=(n,e)=>{const t=zu(i=>i.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Co(n.doc,t.pos))||!vy(t.node.attrs.type,s?.attrs.type)||n.join(t.pos),!0},Cd=(n,e)=>{const t=zu(i=>i.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Co(n.doc,r))||!vy(t.node.attrs.type,s?.attrs.type)||n.join(r),!0};function dT(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return et.between(r,s)}const fT=(n,e,t,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:c,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=s.extensionManager,p=xr(n,o.schema),g=xr(e,o.schema),{selection:v,storedMarks:m}=o,{$from:S,$to:I}=v,C=S.blockRange(I),M=m||v.$to.parentOffset&&v.$from.marks();if(!C)return!1;const O=zu($=>_d($.type.name,f))(v),P=v.from===0&&v.to===o.doc.content.size,E=o.doc.content.content,z=E.length===1?E[0]:null,G=P&&z&&_d(z.type.name,f)?{node:z,pos:0}:null,J=O??G,K=!!O&&C.depth>=1&&C.depth-O.depth<=1,Q=!!G;if((K||Q)&&J){if(J.node.type===p)return P&&Q?c().command(({tr:$,dispatch:X})=>{const de=dT($);return de?($.setSelection(de),X&&X($),!0):!1}).liftListItem(g).run():u.liftListItem(g);if(_d(J.node.type.name,f)&&p.validContent(J.node.content))return c().command(()=>(i.setNodeMarkup(J.pos,p),!0)).command(()=>Sd(i,p)).command(()=>Cd(i,p)).run()}return!t||!M||!a?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Sd(i,p)).command(()=>Cd(i,p)).run():c().command(()=>{const $=d().wrapInList(p,r),X=M.filter(de=>h.includes(de.type.name));return i.ensureMarks(X),$?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Sd(i,p)).command(()=>Cd(i,p)).run()},hT=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=Ki(n,r.schema);return bf(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},pT=(n,e,t={})=>({state:r,commands:s})=>{const i=xr(n,r.schema),o=xr(e,r.schema),a=Ui(r,i,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?s.setNode(o,c):s.setNode(i,{...c,...t})},gT=(n,e={})=>({state:t,commands:r})=>{const s=xr(n,t.schema);return Ui(t,s,e)?r.lift(s):r.wrapIn(s,e)},mT=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let i;if(s.spec.isInputRules&&(i=s.getState(n))){if(e){const o=n.tr,a=i.transform;for(let c=a.steps.length-1;c>=0;c-=1)o.step(a.steps[c].invert(a.docs[c]));if(i.text){const c=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,n.schema.text(i.text,c))}else o.delete(i.from,i.to)}return!0}}return!1},vT=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{ignoreClearable:s=!1}=n,{selection:i}=e,{empty:o,ranges:a}=i;if(o)return!0;const{nonClearableMarks:c}=r.extensionManager;if(t){const u=Object.values(r.schema.marks).filter(d=>s||!c.includes(d.name));a.forEach(d=>{for(const f of u)e.removeMark(d.$from.pos,d.$to.pos,f)})}return!0},bT=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=t,a=Ki(n,r.schema),{$from:c,empty:u,ranges:d}=o;if(!s)return!0;if(u&&i){var f;let{from:h,to:p}=o;const g=kh(c,a,(f=c.marks().find(v=>v.type===a))===null||f===void 0?void 0:f.attrs);g&&(h=g.from,p=g.to),t.removeMark(h,p,a)}else d.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,a)});return t.removeStoredMark(a),!0},yT=n=>({tr:e,state:t,dispatch:r})=>{const{selection:s}=t;let i,o;return typeof n=="number"?(i=n,o=n):n&&"from"in n&&"to"in n?(i=n.from,o=n.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,c)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(c,void 0,u)}),!0},wT=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=Bu(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=xr(n,r.schema)),a==="mark"&&(o=Ki(n,r.schema));let c=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let h,p,g,v;t.selection.empty?r.doc.nodesBetween(d,f,(m,S)=>{i&&i===m.type&&(c=!0,g=Math.max(S,d),v=Math.min(S+m.nodeSize,f),h=S,p=m)}):r.doc.nodesBetween(d,f,(m,S)=>{S<d&&i&&i===m.type&&(c=!0,g=Math.max(S,d),v=Math.min(S+m.nodeSize,f),h=S,p=m),S>=d&&S<=f&&(i&&i===m.type&&(c=!0,s&&t.setNodeMarkup(S,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(I=>{if(o===I.type&&(c=!0,s)){const C=Math.max(S,d),M=Math.min(S+m.nodeSize,f);t.addMark(C,M,o.create({...I.attrs,...e}))}}))}),p&&(h!==void 0&&s&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(m=>{o===m.type&&s&&t.addMark(g,v,o.create({...m.attrs,...e}))}))}),c},Ra=new Dn("__tiptap_decorations__"),xT=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(Ra,{type:"force",name:n}),!0),kT=(n,e={})=>({state:t,dispatch:r})=>{const s=xr(n,t.schema);return jS(s,e)(t,r)},_T=(n,e={})=>({state:t,dispatch:r})=>{const s=xr(n,t.schema);return GS(s,e)(t,r)};var ST=B_({blur:()=>KM,clearContent:()=>jM,clearNodes:()=>GM,command:()=>qM,createParagraphNear:()=>JM,cut:()=>XM,deleteCurrentNode:()=>QM,deleteNode:()=>YM,deleteRange:()=>ZM,deleteSelection:()=>n2,enter:()=>r2,exitCode:()=>s2,extendMarkRange:()=>i2,first:()=>o2,focus:()=>l2,forEach:()=>c2,insertContent:()=>u2,insertContentAt:()=>d2,insertDefaultBlock:()=>f2,joinBackward:()=>g2,joinDown:()=>p2,joinForward:()=>m2,joinItemBackward:()=>v2,joinItemForward:()=>b2,joinTextblockBackward:()=>y2,joinTextblockForward:()=>w2,joinUp:()=>h2,keyboardShortcut:()=>k2,lift:()=>_2,liftEmptyBlock:()=>S2,liftListItem:()=>C2,newlineInCode:()=>M2,resetAttributes:()=>T2,scrollIntoView:()=>E2,selectAll:()=>A2,selectNodeBackward:()=>R2,selectNodeForward:()=>P2,selectParentNode:()=>I2,selectTextblockEnd:()=>L2,selectTextblockStart:()=>O2,setContent:()=>N2,setMark:()=>nT,setMeta:()=>rT,setNode:()=>sT,setNodeSelection:()=>iT,setTextDirection:()=>oT,setTextSelection:()=>aT,sinkListItem:()=>lT,splitBlock:()=>cT,splitListItem:()=>uT,toggleList:()=>fT,toggleMark:()=>hT,toggleNode:()=>pT,toggleWrap:()=>gT,undoInputRule:()=>mT,unsetAllMarks:()=>vT,unsetMark:()=>bT,unsetTextDirection:()=>yT,updateAttributes:()=>wT,updateDecorations:()=>xT,wrapIn:()=>kT,wrapInList:()=>_T});const al=new WeakMap;function CT(n,e){var t;al.set(n,((t=al.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const s=((r=al.get(n))!==null&&r!==void 0?r:1)-1;s>0?al.set(n,s):al.delete(n)}}var MT=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function TT(n){return n.kind==="widget"}function by(n,e){const t=[],r=new Set;for(const s of n)s.kind==="widget"&&TT(s)&&r.add(s.key),t.push(s.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function ET(n,e,t){const{decorations:r,widgetKeys:s}=by(e,t);return{set:Yt.create(n,r),widgetKeys:s}}function yy({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function AT({decorations:n,from:e,to:t,docSize:r,extensionName:s,warnedExtensions:i}){return n.filter(o=>yy({position:o.anchor,from:e,to:t,docSize:r})?!0:(o.anchor===t||i.has(s)||(i.add(s),console.warn(`[tiptap warn]: Extension "${s}" returned a decoration outside the requested range [${e}, ${t}). It was ignored.`)),!1))}function RT(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function wy(n){return n.jsonID==="attr"}function PT(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||wy(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function IT(n,e){let t=null,r=0,s=0;for(let i=0;i<n.childCount&&!(s>e.to);i+=1){const o=s+n.child(i).nodeSize;o>=e.from&&(t===null&&(t=s),r=o),s=o}return t===null?null:{from:t,to:r}}function LT(n,e){if(n.steps.some(i=>!PT(i)))return{type:"full"};const t=Fu(n).map(({newRange:i})=>i);n.steps.forEach((i,o)=>{if(!wy(i))return;const a=n.mapping.slice(o);t.push({from:a.map(i.pos,-1),to:a.map(i.pos+1)})});const r=[];for(const i of t){const o=IT(e,i);o&&r.push(o)}r.sort((i,o)=>i.from-o.from);const s=[];for(const i of r){const o=s[s.length-1];o&&i.from<=o.to?o.to=Math.max(o.to,i.to):s.push({...i})}return{type:"ranges",ranges:s}}function xy(n,e,t,r){return n.map(e,t,{onRemove:s=>{const i=s?.key;typeof i=="string"&&r.delete(i)}})}function OT(n,e,t){var r,s;const i=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:Yt.empty,o=new Set((s=e.widgetKeysByExtension[n])!==null&&s!==void 0?s:[]);return{set:xy(i,t.mapping,t.doc,o),widgetKeys:o}}function zg(n,e){const t=Object.values(e).flatMap(r=>r.find());return Yt.create(n,t)}function Fg(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function NT(n,e){var t;switch((t=e.update)!==null&&t!==void 0?t:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${n}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${n}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function DT(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const $T=new Set;var BT=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=Ra.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>NT(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,e;return(n=(e=Ra.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:$T}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(n){const e=[];for(const{name:t,addDecorations:r}of n){const s=r();s&&e.push({name:t,spec:s})}return e}createPlugin(){const{editor:n,entries:e}=this;return new kn({key:Ra,state:{init:(t,r)=>{const s={},i={};for(const{name:a,spec:c}of e){const{set:u,widgetKeys:d}=this.buildFullSet(a,c,r);s[a]=u,i[a]=d}const o={decorationSetsByExtension:s,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:Fg(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,s,i)=>{const o=t.getMeta(Ra),a=o?.type==="force"&&!o.name,c=o?.type==="force"?o.name:void 0,u={},d={},f=new Set;return CT(n,()=>{for(const{name:h,spec:p}of e){const g=a||c===h;if(DT(p,{editor:n,tr:t,oldState:s,newState:i},g))if(p.update==="changedRanges"&&t.docChanged&&!g){const v=this.applyChangedRangesRecompute(h,p,r,t,i);u[h]=v.set,d[h]=v.widgetKeys,f.add(h)}else{const{set:v,widgetKeys:m}=this.buildFullSet(h,p,i);u[h]=v,d[h]=m,f.add(h)}else{const v=OT(h,r,t);u[h]=v.set,d[h]=v.widgetKeys}}}),f.size===0&&!t.docChanged?r:{decorationSetsByExtension:u,widgetKeysByExtension:d,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:t,decorationSetsByExtension:u,recomputedNames:f}),widgetKeys:Fg(d)}}},props:{decorations(t){var r,s;return(r=(s=Ra.getState(t))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:Yt.empty}}})}applyChangedRangesRecompute(n,e,t,r,s){const i=LT(r,s.doc);return i.type==="full"?this.buildFullSet(n,e,s):this.rebuildRanges(n,e,t,r,s,i.ranges)}rebuildRanges(n,e,t,r,s,i){var o,a;const c=(o=t.decorationSetsByExtension[n])!==null&&o!==void 0?o:Yt.empty,u=new Set((a=t.widgetKeysByExtension[n])!==null&&a!==void 0?a:[]);let d=xy(c,r.mapping,r.doc,u);const f=s.doc.content.size;for(const{from:h,to:p}of i){const g=d.find(h,p).filter(S=>yy({position:S.from,from:h,to:p,docSize:f}));for(const S of g){const I=RT(S);I&&u.delete(I)}d=d.remove(g);const{decorations:v,widgetKeys:m}=by(AT({decorations:this.runCreate(n,"createInRange",()=>e.createInRange({editor:this.editor,state:s,view:this.mountedView,from:h,to:p})),from:h,to:p,docSize:f,extensionName:n,warnedExtensions:this.warnedOutOfRangeExtensions}),n);d=d.add(s.doc,v);for(const S of m)u.add(S)}return{set:d,widgetKeys:u}}buildFullSet(n,e,t){const r=this.runCreate(n,"create",()=>e.create({editor:this.editor,state:t,view:this.mountedView}));return ET(t.doc,r,n)}runCreate(n,e,t){try{return t()}catch(r){return console.error(`[tiptap error]: Extension "${n}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(n){}buildMergedSet(n,e){const t=Object.keys(e);return t.length===1?e[t[0]]:zg(n,e)}mergeAfterApply({entries:n,previous:e,tr:t,decorationSetsByExtension:r,recomputedNames:s}){return n.length===1?r[n[0].name]:s.size===0?e.mergedDecorationSet.map(t.mapping,t.doc):zg(t.doc,r)}};function zT(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof vt){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function FT(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}function HT(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function UT(n){return typeof n=="number"}function VT(n){return Object.prototype.toString.call(n).slice(8,-1)}function fc(n){return VT(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Eh(n){return/\s/.test(n)}function ky(n){return/^\w$/.test(n)}function WT(n,e){for(;e<n.length&&Eh(n[e]);)e+=1;return e}function Hu(n,e){for(;e<n.length&&!Eh(n[e]);)e+=1;return e}function KT(n,e,t){for(;e<n.length&&(ky(n[e])||t);)e+=1;return e}function jT(n,e){const t=n.indexOf(n[e],e+1);return{nextIndex:Hu(n,t===-1?e:t+1)}}function GT(n,e,t,r){let s=t;if(n[s]!=="=")return;s=s+1;const i=n[s];if(i!=='"'&&i!=="'")return;const o=n.indexOf(i,s+1);if(o!==-1)return{token:{type:"keyValue",name:e,value:n.slice(s+1,o)},nextIndex:Hu(n,o+1)}}function qT(n,e,t){const r=t==="pandoc",s=KT(n,e+1,r),i=n.slice(e,s),o=GT(n,i,s);if(o)return o;const a=s===n.length||Eh(n[s]);return{token:r&&a?{type:"boolean",name:i}:void 0,nextIndex:t==="shortcode"?Hu(n,s):s}}function JT(n,e,t){const r=n[e];return r==='"'||r==="'"?jT(n,e):ky(r)?qT(n,e,t):{nextIndex:Hu(n,e)}}function XT(n,e){const t=[];let r=0;for(;r<n.length&&(r=WT(n,r),!(r>=n.length));){const s=JT(n,r,e);s.token&&t.push(s.token),r=s.nextIndex}return t}function QT(n){const e={};return XT(n,"shortcode").forEach(t=>{t.type==="keyValue"&&(e[t.name]=t.value)}),e}function YT(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function ZT(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=QT,serializeAttributes:i=YT,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:c}=n,u=t||e,d=h=>{if(!c)return h;const p={};return c.forEach(g=>{const v=typeof g=="string"?g:g.name,m=typeof g=="string"?void 0:g.skipIfDefault;if(v in h){const S=h[v];if(m!==void 0&&S===m)return;p[v]=S}}),p},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const g={...o,...h.attributes};if(a)return p.createNode(e,g);const v=r?r(h):h.content||"";return v?p.createNode(e,g,[p.createTextNode(v)]):p.createNode(e,g,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),g=h.match(p),v=g?.index;return v!==void 0?v:-1},tokenize(h,p,g){const v=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),m=h.match(v);if(!m)return;let S="",I="";if(a){const[,M]=m;I=M}else{const[,M,O]=m;I=M,S=O||""}const C=s(I.trim());return{type:e,raw:m[0],content:S.trim(),attributes:C}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(S=>S.type==="text").map(S=>S.text).join(""));const g=d(h.attrs||{}),v=i(g),m=v?` ${v}`:"";return a?`[${u}${m}]`:`[${u}${m}]${p}[/${u}]`}}}function Hg(n,e,t){const r=n.split(`
15
+ `,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,s,(c,u,d,f)=>{c.isBlock&&u>r&&(a+=i);const h=o?.[c.type.name];if(h)return d&&(a+=h({node:c,pos:u,parent:d,index:f,range:e})),!1;if(c.isText){var p;a+=c==null||(p=c.text)===null||p===void 0?void 0:p.slice(Math.max(r,u)-u,s-u)}}),a}function V2(n,e){return Ch(n,{from:0,to:n.content.size},e)}function Mh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function W2(n,e){const t=xr(e,n.schema),{from:r,to:s}=n.selection,i=[];n.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function hy(n,e){const t=Bu(typeof e=="string"?e:e.name,n.schema);return t==="node"?W2(n,e):t==="mark"?ly(n,e):{}}function K2(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function j2(n){const e=K2(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,i)=>i!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Fu(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,c)=>{o.push({from:a,to:c})});else{const{from:a,to:c}=t[i];if(a===void 0||c===void 0)return;o.push({from:a,to:c})}o.forEach(({from:a,to:c})=>{const u=e.slice(i).map(a,-1),d=e.slice(i).map(c),f=e.invert().map(u,-1),h=e.invert().map(d);r.push({oldRange:{from:f,to:h},newRange:{from:u,to:d}})})}),j2(r)}function Th(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=kh(t.resolve(n),s.type);i&&r.push({mark:s,...i})}):t.nodesBetween(n,e,(s,i)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}const G2=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);a?.type.name===e?o=a:i-=1}return[o,i]},q2=n=>{const e=n.depth-1;if(e<0)return null;const t=n.index(e);return t===0?null:n.node(e).child(t-1)};function Sa(n,e){return e.nodes[n]||e.marks[n]||null}function Pc(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}const J2=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var c,u;const d=((c=(u=s.type.spec).toText)===null||c===void 0?void 0:c.call(u,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),t};function bf(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?Ki(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Xc(d.attrs,t,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(g,v)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const m=Math.max(h,v),S=Math.min(p,v+g.nodeSize),I=S-m;o+=I,a.push(...g.marks.map(C=>({mark:C,from:m,to:S})))})}),o===0)return!1;const c=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Xc(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(c>0?c+u:c)>=o}function X2(n,e,t={}){if(!e)return Ui(n,null,t)||bf(n,null,t);const r=Bu(e,n.schema);return r==="node"?Ui(n,e,t):r==="mark"?bf(n,e,t):!1}const Y2=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=zu(a=>a.type.name===e)(n.selection);if(!i)return!1;const o=n.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Q2=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Dg(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function _d(n,e){const{nodeExtensions:t}=Wa(e),r=t.find(i=>i.name===n);if(!r)return!1;const s=hn(ct(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function ec(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){if(t){if(n.type.name==="hardBreak")return!0;if(n.isText){var r;return!/\S/.test((r=n.text)!==null&&r!==void 0?r:"")}}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(i=>{s!==!1&&(ec(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function py(n){return n instanceof vt}var gy=class my{constructor(e){this.position=e}static fromJSON(e){return new my(e.position)}toJSON(){return{position:this.position}}};function Z2(n,e){const t=e.mapping.mapResult(n.position);return{position:new gy(t.pos),mapResult:t}}function eT(n){return new gy(n)}function tT(n,e,t){const{selection:r}=e;let s=null;if(ty(r)&&(s=r.$cursor),s){var i;const a=(i=n.storedMarks)!==null&&i!==void 0?i:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=r;return o.some(({$from:a,$to:c})=>{let u=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(d,f,h)=>{if(u)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(t),g=!!t.isInSet(d.marks)||!d.marks.some(v=>v.type.excludes(t));u=p&&g}return!u}),u})}const nT=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:a}=i,c=Ki(n,r.schema);if(s)if(o){const u=ly(r,c);t.addStoredMark(c.create({...u,...e}))}else a.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(d,f,(h,p)=>{const g=Math.max(p,d),v=Math.min(p+h.nodeSize,f);h.marks.find(m=>m.type===c)?h.marks.forEach(m=>{c===m.type&&t.addMark(g,v,c.create({...m.attrs,...e}))}):t.addMark(g,v,c.create(e))})});return tT(r,t,c)},rT=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),sT=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=xr(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>Qp(i,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Qp(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},iT=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Ko(n,0,r.content.size),i=vt.create(r,s);e.setSelection(i)}return!0},oT=(n,e)=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&t.doc.nodesBetween(o,a,(c,u)=>{c.isText||t.setNodeMarkup(u,void 0,{...c.attrs,dir:n})}),!0},aT=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=et.atStart(r).from,a=et.atEnd(r).to,c=Ko(s,o,a),u=Ko(i,o,a),d=et.create(r,c,u);e.setSelection(d)}return!0},lT=n=>({state:e,dispatch:t})=>{const r=xr(n,e.schema);return ZS(r)(e,t)};function $g(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e?.includes(s.type.name));n.tr.ensureMarks(r)}}const cT=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:c}=i,u=s.extensionManager.attributes,d=Pc(u,a.node().type.name,a.node().attrs);if(i instanceof vt&&i.node.isBlock)return!a.parentOffset||!Bi(o,a.pos)?!1:(r&&(n&&$g(t,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,h=a.depth===0?void 0:oy(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,g=Bi(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!g&&Bi(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(g=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(g&&(i instanceof et&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const v=e.mapping.map(a.before()),m=e.doc.resolve(v);a.node(-1).canReplaceWith(m.index(),m.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&$g(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return g},uT=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{const o=xr(n,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==o)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){var h;let S=_e.empty;const I=a.index(-1)?1:a.index(-2)?2:3;for(let z=a.depth-I;z>=a.depth-3;z-=1)S=_e.from(a.node(z).copy(S));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,M={...Pc(f,a.node().type.name,a.node().attrs),...e},O=((h=o.contentMatch.defaultType)===null||h===void 0?void 0:h.createAndFill(M))||void 0;S=S.append(_e.from(o.createAndFill(null,O)||void 0));const P=a.before(a.depth-(I-1));t.replace(P,a.after(-C),new He(S,4-I,0));let E=-1;t.doc.nodesBetween(P,t.doc.content.size,(z,G)=>{if(E>-1)return!1;z.isTextblock&&z.content.size===0&&(E=G+1)}),E>-1&&t.setSelection(et.near(t.doc.resolve(E))),t.scrollIntoView()}return!0}const p=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,g={...Pc(f,d.type.name,d.attrs),...e},v={...Pc(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const m=p?[{type:o,attrs:g},{type:p,attrs:v}]:[{type:o,attrs:g}];if(!Bi(t.doc,a.pos,2))return!1;if(s){const{selection:S,storedMarks:I}=r,{splittableMarks:C}=i.extensionManager,M=I||S.$to.parentOffset&&S.$from.marks();if(t.split(a.pos,2,m).scrollIntoView(),!M||!s)return!0;const O=M.filter(P=>C.includes(P.type.name));t.ensureMarks(O)}return!0};function Bg(n){return!n||n==="1"?null:n}function vy(n,e){return Bg(n)===Bg(e)}const Sd=(n,e)=>{const t=zu(i=>i.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Co(n.doc,t.pos))||!vy(t.node.attrs.type,s?.attrs.type)||n.join(t.pos),!0},Cd=(n,e)=>{const t=zu(i=>i.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return!(t.node.type===s?.type&&Co(n.doc,r))||!vy(t.node.attrs.type,s?.attrs.type)||n.join(r),!0};function dT(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return et.between(r,s)}const fT=(n,e,t,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:c,commands:u,can:d})=>{const{extensions:f,splittableMarks:h}=s.extensionManager,p=xr(n,o.schema),g=xr(e,o.schema),{selection:v,storedMarks:m}=o,{$from:S,$to:I}=v,C=S.blockRange(I),M=m||v.$to.parentOffset&&v.$from.marks();if(!C)return!1;const O=zu($=>_d($.type.name,f))(v),P=v.from===0&&v.to===o.doc.content.size,E=o.doc.content.content,z=E.length===1?E[0]:null,G=P&&z&&_d(z.type.name,f)?{node:z,pos:0}:null,J=O??G,K=!!O&&C.depth>=1&&C.depth-O.depth<=1,Y=!!G;if((K||Y)&&J){if(J.node.type===p)return P&&Y?c().command(({tr:$,dispatch:X})=>{const de=dT($);return de?($.setSelection(de),X&&X($),!0):!1}).liftListItem(g).run():u.liftListItem(g);if(_d(J.node.type.name,f)&&p.validContent(J.node.content))return c().command(()=>(i.setNodeMarkup(J.pos,p),!0)).command(()=>Sd(i,p)).command(()=>Cd(i,p)).run()}return!t||!M||!a?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Sd(i,p)).command(()=>Cd(i,p)).run():c().command(()=>{const $=d().wrapInList(p,r),X=M.filter(de=>h.includes(de.type.name));return i.ensureMarks(X),$?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Sd(i,p)).command(()=>Cd(i,p)).run()},hT=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=Ki(n,r.schema);return bf(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},pT=(n,e,t={})=>({state:r,commands:s})=>{const i=xr(n,r.schema),o=xr(e,r.schema),a=Ui(r,i,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?s.setNode(o,c):s.setNode(i,{...c,...t})},gT=(n,e={})=>({state:t,commands:r})=>{const s=xr(n,t.schema);return Ui(t,s,e)?r.lift(s):r.wrapIn(s,e)},mT=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let i;if(s.spec.isInputRules&&(i=s.getState(n))){if(e){const o=n.tr,a=i.transform;for(let c=a.steps.length-1;c>=0;c-=1)o.step(a.steps[c].invert(a.docs[c]));if(i.text){const c=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,n.schema.text(i.text,c))}else o.delete(i.from,i.to)}return!0}}return!1},vT=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{ignoreClearable:s=!1}=n,{selection:i}=e,{empty:o,ranges:a}=i;if(o)return!0;const{nonClearableMarks:c}=r.extensionManager;if(t){const u=Object.values(r.schema.marks).filter(d=>s||!c.includes(d.name));a.forEach(d=>{for(const f of u)e.removeMark(d.$from.pos,d.$to.pos,f)})}return!0},bT=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=t,a=Ki(n,r.schema),{$from:c,empty:u,ranges:d}=o;if(!s)return!0;if(u&&i){var f;let{from:h,to:p}=o;const g=kh(c,a,(f=c.marks().find(v=>v.type===a))===null||f===void 0?void 0:f.attrs);g&&(h=g.from,p=g.to),t.removeMark(h,p,a)}else d.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,a)});return t.removeStoredMark(a),!0},yT=n=>({tr:e,state:t,dispatch:r})=>{const{selection:s}=t;let i,o;return typeof n=="number"?(i=n,o=n):n&&"from"in n&&"to"in n?(i=n.from,o=n.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,c)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(c,void 0,u)}),!0},wT=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=Bu(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=xr(n,r.schema)),a==="mark"&&(o=Ki(n,r.schema));let c=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let h,p,g,v;t.selection.empty?r.doc.nodesBetween(d,f,(m,S)=>{i&&i===m.type&&(c=!0,g=Math.max(S,d),v=Math.min(S+m.nodeSize,f),h=S,p=m)}):r.doc.nodesBetween(d,f,(m,S)=>{S<d&&i&&i===m.type&&(c=!0,g=Math.max(S,d),v=Math.min(S+m.nodeSize,f),h=S,p=m),S>=d&&S<=f&&(i&&i===m.type&&(c=!0,s&&t.setNodeMarkup(S,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach(I=>{if(o===I.type&&(c=!0,s)){const C=Math.max(S,d),M=Math.min(S+m.nodeSize,f);t.addMark(C,M,o.create({...I.attrs,...e}))}}))}),p&&(h!==void 0&&s&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(m=>{o===m.type&&s&&t.addMark(g,v,o.create({...m.attrs,...e}))}))}),c},Ra=new Dn("__tiptap_decorations__"),xT=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(Ra,{type:"force",name:n}),!0),kT=(n,e={})=>({state:t,dispatch:r})=>{const s=xr(n,t.schema);return jS(s,e)(t,r)},_T=(n,e={})=>({state:t,dispatch:r})=>{const s=xr(n,t.schema);return GS(s,e)(t,r)};var ST=B_({blur:()=>KM,clearContent:()=>jM,clearNodes:()=>GM,command:()=>qM,createParagraphNear:()=>JM,cut:()=>XM,deleteCurrentNode:()=>YM,deleteNode:()=>QM,deleteRange:()=>ZM,deleteSelection:()=>n2,enter:()=>r2,exitCode:()=>s2,extendMarkRange:()=>i2,first:()=>o2,focus:()=>l2,forEach:()=>c2,insertContent:()=>u2,insertContentAt:()=>d2,insertDefaultBlock:()=>f2,joinBackward:()=>g2,joinDown:()=>p2,joinForward:()=>m2,joinItemBackward:()=>v2,joinItemForward:()=>b2,joinTextblockBackward:()=>y2,joinTextblockForward:()=>w2,joinUp:()=>h2,keyboardShortcut:()=>k2,lift:()=>_2,liftEmptyBlock:()=>S2,liftListItem:()=>C2,newlineInCode:()=>M2,resetAttributes:()=>T2,scrollIntoView:()=>E2,selectAll:()=>A2,selectNodeBackward:()=>R2,selectNodeForward:()=>P2,selectParentNode:()=>I2,selectTextblockEnd:()=>L2,selectTextblockStart:()=>O2,setContent:()=>N2,setMark:()=>nT,setMeta:()=>rT,setNode:()=>sT,setNodeSelection:()=>iT,setTextDirection:()=>oT,setTextSelection:()=>aT,sinkListItem:()=>lT,splitBlock:()=>cT,splitListItem:()=>uT,toggleList:()=>fT,toggleMark:()=>hT,toggleNode:()=>pT,toggleWrap:()=>gT,undoInputRule:()=>mT,unsetAllMarks:()=>vT,unsetMark:()=>bT,unsetTextDirection:()=>yT,updateAttributes:()=>wT,updateDecorations:()=>xT,wrapIn:()=>kT,wrapInList:()=>_T});const al=new WeakMap;function CT(n,e){var t;al.set(n,((t=al.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const s=((r=al.get(n))!==null&&r!==void 0?r:1)-1;s>0?al.set(n,s):al.delete(n)}}var MT=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function TT(n){return n.kind==="widget"}function by(n,e){const t=[],r=new Set;for(const s of n)s.kind==="widget"&&TT(s)&&r.add(s.key),t.push(s.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function ET(n,e,t){const{decorations:r,widgetKeys:s}=by(e,t);return{set:Qt.create(n,r),widgetKeys:s}}function yy({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function AT({decorations:n,from:e,to:t,docSize:r,extensionName:s,warnedExtensions:i}){return n.filter(o=>yy({position:o.anchor,from:e,to:t,docSize:r})?!0:(o.anchor===t||i.has(s)||(i.add(s),console.warn(`[tiptap warn]: Extension "${s}" returned a decoration outside the requested range [${e}, ${t}). It was ignored.`)),!1))}function RT(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function wy(n){return n.jsonID==="attr"}function PT(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||wy(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function IT(n,e){let t=null,r=0,s=0;for(let i=0;i<n.childCount&&!(s>e.to);i+=1){const o=s+n.child(i).nodeSize;o>=e.from&&(t===null&&(t=s),r=o),s=o}return t===null?null:{from:t,to:r}}function LT(n,e){if(n.steps.some(i=>!PT(i)))return{type:"full"};const t=Fu(n).map(({newRange:i})=>i);n.steps.forEach((i,o)=>{if(!wy(i))return;const a=n.mapping.slice(o);t.push({from:a.map(i.pos,-1),to:a.map(i.pos+1)})});const r=[];for(const i of t){const o=IT(e,i);o&&r.push(o)}r.sort((i,o)=>i.from-o.from);const s=[];for(const i of r){const o=s[s.length-1];o&&i.from<=o.to?o.to=Math.max(o.to,i.to):s.push({...i})}return{type:"ranges",ranges:s}}function xy(n,e,t,r){return n.map(e,t,{onRemove:s=>{const i=s?.key;typeof i=="string"&&r.delete(i)}})}function OT(n,e,t){var r,s;const i=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:Qt.empty,o=new Set((s=e.widgetKeysByExtension[n])!==null&&s!==void 0?s:[]);return{set:xy(i,t.mapping,t.doc,o),widgetKeys:o}}function zg(n,e){const t=Object.values(e).flatMap(r=>r.find());return Qt.create(n,t)}function Fg(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function NT(n,e){var t;switch((t=e.update)!==null&&t!==void 0?t:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${n}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${n}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function DT(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const $T=new Set;var BT=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=Ra.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>NT(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,e;return(n=(e=Ra.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:$T}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(n){const e=[];for(const{name:t,addDecorations:r}of n){const s=r();s&&e.push({name:t,spec:s})}return e}createPlugin(){const{editor:n,entries:e}=this;return new kn({key:Ra,state:{init:(t,r)=>{const s={},i={};for(const{name:a,spec:c}of e){const{set:u,widgetKeys:d}=this.buildFullSet(a,c,r);s[a]=u,i[a]=d}const o={decorationSetsByExtension:s,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:Fg(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,s,i)=>{const o=t.getMeta(Ra),a=o?.type==="force"&&!o.name,c=o?.type==="force"?o.name:void 0,u={},d={},f=new Set;return CT(n,()=>{for(const{name:h,spec:p}of e){const g=a||c===h;if(DT(p,{editor:n,tr:t,oldState:s,newState:i},g))if(p.update==="changedRanges"&&t.docChanged&&!g){const v=this.applyChangedRangesRecompute(h,p,r,t,i);u[h]=v.set,d[h]=v.widgetKeys,f.add(h)}else{const{set:v,widgetKeys:m}=this.buildFullSet(h,p,i);u[h]=v,d[h]=m,f.add(h)}else{const v=OT(h,r,t);u[h]=v.set,d[h]=v.widgetKeys}}}),f.size===0&&!t.docChanged?r:{decorationSetsByExtension:u,widgetKeysByExtension:d,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:t,decorationSetsByExtension:u,recomputedNames:f}),widgetKeys:Fg(d)}}},props:{decorations(t){var r,s;return(r=(s=Ra.getState(t))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:Qt.empty}}})}applyChangedRangesRecompute(n,e,t,r,s){const i=LT(r,s.doc);return i.type==="full"?this.buildFullSet(n,e,s):this.rebuildRanges(n,e,t,r,s,i.ranges)}rebuildRanges(n,e,t,r,s,i){var o,a;const c=(o=t.decorationSetsByExtension[n])!==null&&o!==void 0?o:Qt.empty,u=new Set((a=t.widgetKeysByExtension[n])!==null&&a!==void 0?a:[]);let d=xy(c,r.mapping,r.doc,u);const f=s.doc.content.size;for(const{from:h,to:p}of i){const g=d.find(h,p).filter(S=>yy({position:S.from,from:h,to:p,docSize:f}));for(const S of g){const I=RT(S);I&&u.delete(I)}d=d.remove(g);const{decorations:v,widgetKeys:m}=by(AT({decorations:this.runCreate(n,"createInRange",()=>e.createInRange({editor:this.editor,state:s,view:this.mountedView,from:h,to:p})),from:h,to:p,docSize:f,extensionName:n,warnedExtensions:this.warnedOutOfRangeExtensions}),n);d=d.add(s.doc,v);for(const S of m)u.add(S)}return{set:d,widgetKeys:u}}buildFullSet(n,e,t){const r=this.runCreate(n,"create",()=>e.create({editor:this.editor,state:t,view:this.mountedView}));return ET(t.doc,r,n)}runCreate(n,e,t){try{return t()}catch(r){return console.error(`[tiptap error]: Extension "${n}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(n){}buildMergedSet(n,e){const t=Object.keys(e);return t.length===1?e[t[0]]:zg(n,e)}mergeAfterApply({entries:n,previous:e,tr:t,decorationSetsByExtension:r,recomputedNames:s}){return n.length===1?r[n[0].name]:s.size===0?e.mergedDecorationSet.map(t.mapping,t.doc):zg(t.doc,r)}};function zT(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof vt){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function FT(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}function HT(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function UT(n){return typeof n=="number"}function VT(n){return Object.prototype.toString.call(n).slice(8,-1)}function fc(n){return VT(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Eh(n){return/\s/.test(n)}function ky(n){return/^\w$/.test(n)}function WT(n,e){for(;e<n.length&&Eh(n[e]);)e+=1;return e}function Hu(n,e){for(;e<n.length&&!Eh(n[e]);)e+=1;return e}function KT(n,e,t){for(;e<n.length&&(ky(n[e])||t);)e+=1;return e}function jT(n,e){const t=n.indexOf(n[e],e+1);return{nextIndex:Hu(n,t===-1?e:t+1)}}function GT(n,e,t,r){let s=t;if(n[s]!=="=")return;s=s+1;const i=n[s];if(i!=='"'&&i!=="'")return;const o=n.indexOf(i,s+1);if(o!==-1)return{token:{type:"keyValue",name:e,value:n.slice(s+1,o)},nextIndex:Hu(n,o+1)}}function qT(n,e,t){const r=t==="pandoc",s=KT(n,e+1,r),i=n.slice(e,s),o=GT(n,i,s);if(o)return o;const a=s===n.length||Eh(n[s]);return{token:r&&a?{type:"boolean",name:i}:void 0,nextIndex:t==="shortcode"?Hu(n,s):s}}function JT(n,e,t){const r=n[e];return r==='"'||r==="'"?jT(n,e):ky(r)?qT(n,e,t):{nextIndex:Hu(n,e)}}function XT(n,e){const t=[];let r=0;for(;r<n.length&&(r=WT(n,r),!(r>=n.length));){const s=JT(n,r,e);s.token&&t.push(s.token),r=s.nextIndex}return t}function YT(n){const e={};return XT(n,"shortcode").forEach(t=>{t.type==="keyValue"&&(e[t.name]=t.value)}),e}function QT(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function ZT(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=YT,serializeAttributes:i=QT,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:c}=n,u=t||e,d=h=>{if(!c)return h;const p={};return c.forEach(g=>{const v=typeof g=="string"?g:g.name,m=typeof g=="string"?void 0:g.skipIfDefault;if(v in h){const S=h[v];if(m!==void 0&&S===m)return;p[v]=S}}),p},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const g={...o,...h.attributes};if(a)return p.createNode(e,g);const v=r?r(h):h.content||"";return v?p.createNode(e,g,[p.createTextNode(v)]):p.createNode(e,g,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),g=h.match(p),v=g?.index;return v!==void 0?v:-1},tokenize(h,p,g){const v=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),m=h.match(v);if(!m)return;let S="",I="";if(a){const[,M]=m;I=M}else{const[,M,O]=m;I=M,S=O||""}const C=s(I.trim());return{type:e,raw:m[0],content:S.trim(),attributes:C}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(S=>S.type==="text").map(S=>S.text).join(""));const g=d(h.attrs||{}),v=i(g),m=v?` ${v}`:"";return a?`[${u}${m}]`:`[${u}${m}]${p}[/${u}]`}}}function Hg(n,e,t){const r=n.split(`
16
16
  `),s=[];let i="",o=0;const a=e.baseIndentSize||2;for(;o<r.length;){const d=r[o],f=d.match(e.itemPattern);if(!f){if(s.length>0)break;if(d.trim()===""){o+=1,i=`${i}${d}
17
17
  `;continue}else return}const h=e.extractItemData(f),{indentLevel:p,mainContent:g}=h;i=`${i}${d}
18
18
  `;const v=[g];for(o+=1;o<r.length;){var c;const C=r[o];if(C.trim()===""){var u;const M=r.slice(o+1).findIndex(O=>O.trim()!=="");if(M===-1)break;if((((u=r[o+1+M].match(/^(\s*)/))===null||u===void 0||(u=u[1])===null||u===void 0?void 0:u.length)||0)>p){v.push(C),i=`${i}${C}
@@ -96,13 +96,13 @@ img.ProseMirror-separator {
96
96
 
97
97
  .ProseMirror-focused .ProseMirror-gapcursor {
98
98
  display: block;
99
- }`;var xE=class extends MT{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Z2,createMappablePosition:eT},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const r=mf(t,this.options.autofocus);this.editorState=Uo.create({doc:t,schema:this.schema,selection:r||void 0})}bE(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Oa.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Oa.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=FT(wE,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=uy(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;r=r.filter(a=>!a.key.startsWith(o))}),t.length===r.length)return;const s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[dE,aE.configure({blockSeparator:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),lE,hE,pE,mE.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),uE,gE,cE,vE.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Uu(r,this)}createCommandManager(){this.commandManager=new Oa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Qc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;const r=Qc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Uo.create({doc:r,schema:this.schema,selection:mf(r,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:r}=this.options,s=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=r?this.extensionManager.dispatchTransaction(s):s,o=t.transformPastedHTML,a=this.extensionManager.transformPastedHTML(o);this.editorView=new Qb(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var f;return(f=this.capturedTransaction)===null||f===void 0?void 0:f.step(d)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),s=!this.state.selection.eq(t.selection),i=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),s&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),c=a?.getMeta("focus"),u=a?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),u&&this.emit("blur",{editor:this,event:u.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(d=>d.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return hy(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,s=typeof e=="string"?t:e;return X2(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Sh(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
99
+ }`;var xE=class extends MT{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Z2,createMappablePosition:eT},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const r=mf(t,this.options.autofocus);this.editorState=Uo.create({doc:t,schema:this.schema,selection:r||void 0})}bE(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Oa.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Oa.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=FT(wE,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=uy(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;r=r.filter(a=>!a.key.startsWith(o))}),t.length===r.length)return;const s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[dE,aE.configure({blockSeparator:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),lE,hE,pE,mE.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),uE,gE,cE,vE.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Uu(r,this)}createCommandManager(){this.commandManager=new Oa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Yc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;const r=Yc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Uo.create({doc:r,schema:this.schema,selection:mf(r,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:r}=this.options,s=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=r?this.extensionManager.dispatchTransaction(s):s,o=t.transformPastedHTML,a=this.extensionManager.transformPastedHTML(o);this.editorView=new Yb(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var f;return(f=this.capturedTransaction)===null||f===void 0?void 0:f.step(d)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),s=!this.state.selection.eq(t.selection),i=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),s&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),c=a?.getMeta("focus"),u=a?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),u&&this.emit("blur",{editor:this,event:u.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(d=>d.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return hy(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,s=typeof e=="string"?t:e;return X2(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Sh(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
100
100
 
101
- `,textSerializers:r={}}=e||{};return V2(this.state.doc,{blockSeparator:t,textSerializers:{...Mh(this.schema),...r}})}get isEmpty(){return ec(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(e=(t=this.editorView)===null||t===void 0?void 0:t.isDestroyed)!==null&&e!==void 0?e:!0}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e),r=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new yE(t,this,!1,r)}get $doc(){return this.$pos(0)}};function ia(n){return new tc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=hn(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const c=a.search(/\S/),u=t.from+a.indexOf(o),d=u+o.length;if(Th(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===n.type&&p!==h.mark.type)).filter(h=>h.to>u).length)return null;d<t.to&&i.delete(d,t.to),u>t.from&&i.delete(t.from+c,u);const f=t.from+c+o.length;i.addMark(t.from+c,f,n.type.create(s||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function Ey(n){return new tc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=hn(n.getAttributes,void 0,r)||{},{tr:i}=e,o=t.from;let a=t.to;const c=n.type.create(s);if(r[1]){let u=o+r[0].lastIndexOf(r[1]);u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,c)}else if(r[0]){const u=n.type.isInline?o:o-1;i.insert(u,n.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:n.undoable})}function yf(n){return new tc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=hn(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function Ka(n){return new tc({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=hn(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&oh(a,n.type,i);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(v=>h.includes(v.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Co(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)},undoable:n.undoable})}const kE=n=>"touches"in n;var _E=class{constructor(n){var e,t,r,s,i,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=a=>{if(!this.isResizing||!this.activeHandle)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const c=a.touches[0];if(!c)return;const u=c.clientX-this.startX,d=c.clientY-this.startY;this.handleResize(u,d)},this.handleMouseUp=()=>{if(!this.isResizing)return;const a=this.element.offsetWidth,c=this.element.offsetHeight;this.onCommit(a,c),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=n.node,this.editor=n.editor,this.element=n.element,this.element.draggable=!1,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,!((e=n.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...n.options.min}),!((t=n.options)===null||t===void 0)&&t.max&&(this.maxSize=n.options.max),!(n==null||(r=n.options)===null||r===void 0)&&r.directions&&(this.directions=n.options.directions),!((s=n.options)===null||s===void 0)&&s.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),!((i=n.options)===null||i===void 0)&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),!((o=n.options)===null||o===void 0)&&o.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!==null&&n!==void 0?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),r&&(n.style.bottom="0"),s&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,kE(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(r,s,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let r=this.startWidth,s=this.startHeight;const i=n.includes("right"),o=n.includes("left"),a=n.includes("bottom"),c=n.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),a?s=this.startHeight+t:c&&(s=this.startHeight-t),(n==="right"||n==="left")&&(r=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(s=this.startHeight+(a?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,n):{width:r,height:s}}applyConstraints(n,e,t){var r,s;if(!t){var i,o;let u=Math.max(this.minSize.width,n),d=Math.max(this.minSize.height,e);return!((i=this.maxSize)===null||i===void 0)&&i.width&&(u=Math.min(this.maxSize.width,u)),!((o=this.maxSize)===null||o===void 0)&&o.height&&(d=Math.min(this.maxSize.height,d)),{width:u,height:d}}let a=n,c=e;return a<this.minSize.width&&(a=this.minSize.width,c=a/this.aspectRatio),c<this.minSize.height&&(c=this.minSize.height,a=c*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&a>this.maxSize.width&&(a=this.maxSize.width,c=a/this.aspectRatio),!((s=this.maxSize)===null||s===void 0)&&s.height&&c>this.maxSize.height&&(c=this.maxSize.height,a=c*this.aspectRatio),{width:a,height:c}}applyAspectRatio(n,e,t){const r=t==="left"||t==="right",s=t==="top"||t==="bottom";return r?{width:n,height:n/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}},pr=class Ay extends Ah{constructor(...e){super(...e),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Ay(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},SE=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t;const{view:r}=this.editor,s=n.target,i=s.nodeType===3?(e=s.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):s.closest("[data-drag-handle]");if(!this.dom||!((t=this.contentDOM)===null||t===void 0)&&t.contains(s)||!i)return;let o=0,a=0;if(this.dom!==i){var c,u,d,f;const I=this.dom.getBoundingClientRect(),C=i.getBoundingClientRect(),M=(c=n.offsetX)!==null&&c!==void 0?c:(u=n.nativeEvent)===null||u===void 0?void 0:u.offsetX,O=(d=n.offsetY)!==null&&d!==void 0?d:(f=n.nativeEvent)===null||f===void 0?void 0:f.offsetY;o=C.x-I.x+M,a=C.y-I.y+O}const h=this.dom.cloneNode(!0);try{const I=this.dom.getBoundingClientRect();h.style.width=`${Math.round(I.width)}px`,h.style.height=`${Math.round(I.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{var g;p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(g=n.dataTransfer)===null||g===void 0||g.setDragImage(h,o,a)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const v=this.getPos();if(typeof v!="number")return;const m=vt.create(r.state.doc,v),S=r.state.tr.setSelection(m);r.dispatch(S)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!(!((e=this.contentDOM)===null||e===void 0)&&e.contains(t))))return!1;const r=n.type.startsWith("drag"),s=n.type==="dragover"||n.type==="dragenter",i=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!i&&!r)return!0;const{isEditable:o}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,u=vt.isSelectable(this.node),d=n.type==="copy",f=n.type==="paste",h=n.type==="cut",p=n.type==="mousedown";if(!c&&u&&r&&n.target===this.dom&&n.preventDefault(),c&&r&&!a&&n.target===this.dom)return n.preventDefault(),!1;if(c&&o&&!a&&p){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||s||i||d||f||h||p&&u)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.contentDOM.contains(n.target)&&n.type==="childList"&&(Fl()||vf())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function _o(n){return new My({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=hn(n.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],c=r[0];let u=t.to;if(a){const d=c.search(/\S/),f=t.from+c.indexOf(a),h=f+a.length;if(Th(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>f).length)return null;h<t.to&&o.delete(h,t.to),f>t.from&&o.delete(t.from+d,f),u=t.from+d+a.length,o.addMark(t.from+d,u,n.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}const Ry=new WeakSet,Py=new WeakSet;function $o(n){const e=n;return Ry.add(e),e}function wf(n){return Array.isArray(n)&&Ry.has(n)}function Iy(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&Py.has(e)&&!wf(e)?Iy(e):[e])}function CE(n,e){if(n==="slot")return 0;if(n instanceof Function){const s=n(e);return Array.isArray(s)&&!wf(s)&&!Py.has(s)?$o(s):s}const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(t)){if(wf(t))return $o([n,r,t]);if(t.length===0)return $o([n,r]);const s=Iy(t);return s.length===0?$o([n,r]):$o([n,r,...s])}return t!=null?$o([n,r,t]):$o([n,r])}const Yc=(n,e)=>CE(n,e),ME=(n,e)=>{var t;const{state:r}=n,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0)return!1;const o=i.depth-1;if(o<0)return!1;const a=i.node(o),c=i.index(o);if(c===0)return!1;if(a.type===e)return n.commands.lift(e.name);const u=a.child(c-1);if(u.type!==e||!(!((t=u.lastChild)===null||t===void 0)&&t.isTextblock))return!1;const d=i.before()-1-1;return n.commands.command(({tr:f,dispatch:h})=>{if(!h)return!0;const p=i.parent.content,g=new He(p,0,0);return f.replace(d,i.after(),g),f.setSelection(et.create(f.doc,d+p.size)),f.scrollIntoView(),h(f),!0})},TE=/^\s*>\s$/,EE=pr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Yc("blockquote",{...pn(this.options.HTMLAttributes,n),children:Yc("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((s,i)=>{var o,a;const c=((o=(a=e.renderChild)===null||a===void 0?void 0:a.call(e,s,i))!==null&&o!==void 0?o:e.renderChildren([s])).split(`
101
+ `,textSerializers:r={}}=e||{};return V2(this.state.doc,{blockSeparator:t,textSerializers:{...Mh(this.schema),...r}})}get isEmpty(){return ec(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(e=(t=this.editorView)===null||t===void 0?void 0:t.isDestroyed)!==null&&e!==void 0?e:!0}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e),r=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new yE(t,this,!1,r)}get $doc(){return this.$pos(0)}};function ia(n){return new tc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=hn(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const c=a.search(/\S/),u=t.from+a.indexOf(o),d=u+o.length;if(Th(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===n.type&&p!==h.mark.type)).filter(h=>h.to>u).length)return null;d<t.to&&i.delete(d,t.to),u>t.from&&i.delete(t.from+c,u);const f=t.from+c+o.length;i.addMark(t.from+c,f,n.type.create(s||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function Ey(n){return new tc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=hn(n.getAttributes,void 0,r)||{},{tr:i}=e,o=t.from;let a=t.to;const c=n.type.create(s);if(r[1]){let u=o+r[0].lastIndexOf(r[1]);u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,c)}else if(r[0]){const u=n.type.isInline?o:o-1;i.insert(u,n.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:n.undoable})}function yf(n){return new tc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=hn(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function Ka(n){return new tc({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=hn(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&oh(a,n.type,i);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(v=>h.includes(v.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Co(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)},undoable:n.undoable})}const kE=n=>"touches"in n;var _E=class{constructor(n){var e,t,r,s,i,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=a=>{if(!this.isResizing||!this.activeHandle)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const c=a.touches[0];if(!c)return;const u=c.clientX-this.startX,d=c.clientY-this.startY;this.handleResize(u,d)},this.handleMouseUp=()=>{if(!this.isResizing)return;const a=this.element.offsetWidth,c=this.element.offsetHeight;this.onCommit(a,c),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=n.node,this.editor=n.editor,this.element=n.element,this.element.draggable=!1,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,!((e=n.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...n.options.min}),!((t=n.options)===null||t===void 0)&&t.max&&(this.maxSize=n.options.max),!(n==null||(r=n.options)===null||r===void 0)&&r.directions&&(this.directions=n.options.directions),!((s=n.options)===null||s===void 0)&&s.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),!((i=n.options)===null||i===void 0)&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),!((o=n.options)===null||o===void 0)&&o.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!==null&&n!==void 0?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),r&&(n.style.bottom="0"),s&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,kE(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(r,s,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let r=this.startWidth,s=this.startHeight;const i=n.includes("right"),o=n.includes("left"),a=n.includes("bottom"),c=n.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),a?s=this.startHeight+t:c&&(s=this.startHeight-t),(n==="right"||n==="left")&&(r=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(s=this.startHeight+(a?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,n):{width:r,height:s}}applyConstraints(n,e,t){var r,s;if(!t){var i,o;let u=Math.max(this.minSize.width,n),d=Math.max(this.minSize.height,e);return!((i=this.maxSize)===null||i===void 0)&&i.width&&(u=Math.min(this.maxSize.width,u)),!((o=this.maxSize)===null||o===void 0)&&o.height&&(d=Math.min(this.maxSize.height,d)),{width:u,height:d}}let a=n,c=e;return a<this.minSize.width&&(a=this.minSize.width,c=a/this.aspectRatio),c<this.minSize.height&&(c=this.minSize.height,a=c*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&a>this.maxSize.width&&(a=this.maxSize.width,c=a/this.aspectRatio),!((s=this.maxSize)===null||s===void 0)&&s.height&&c>this.maxSize.height&&(c=this.maxSize.height,a=c*this.aspectRatio),{width:a,height:c}}applyAspectRatio(n,e,t){const r=t==="left"||t==="right",s=t==="top"||t==="bottom";return r?{width:n,height:n/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}},pr=class Ay extends Ah{constructor(...e){super(...e),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Ay(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},SE=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t;const{view:r}=this.editor,s=n.target,i=s.nodeType===3?(e=s.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):s.closest("[data-drag-handle]");if(!this.dom||!((t=this.contentDOM)===null||t===void 0)&&t.contains(s)||!i)return;let o=0,a=0;if(this.dom!==i){var c,u,d,f;const I=this.dom.getBoundingClientRect(),C=i.getBoundingClientRect(),M=(c=n.offsetX)!==null&&c!==void 0?c:(u=n.nativeEvent)===null||u===void 0?void 0:u.offsetX,O=(d=n.offsetY)!==null&&d!==void 0?d:(f=n.nativeEvent)===null||f===void 0?void 0:f.offsetY;o=C.x-I.x+M,a=C.y-I.y+O}const h=this.dom.cloneNode(!0);try{const I=this.dom.getBoundingClientRect();h.style.width=`${Math.round(I.width)}px`,h.style.height=`${Math.round(I.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{var g;p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(g=n.dataTransfer)===null||g===void 0||g.setDragImage(h,o,a)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const v=this.getPos();if(typeof v!="number")return;const m=vt.create(r.state.doc,v),S=r.state.tr.setSelection(m);r.dispatch(S)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!(!((e=this.contentDOM)===null||e===void 0)&&e.contains(t))))return!1;const r=n.type.startsWith("drag"),s=n.type==="dragover"||n.type==="dragenter",i=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!i&&!r)return!0;const{isEditable:o}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,u=vt.isSelectable(this.node),d=n.type==="copy",f=n.type==="paste",h=n.type==="cut",p=n.type==="mousedown";if(!c&&u&&r&&n.target===this.dom&&n.preventDefault(),c&&r&&!a&&n.target===this.dom)return n.preventDefault(),!1;if(c&&o&&!a&&p){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||s||i||d||f||h||p&&u)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.contentDOM.contains(n.target)&&n.type==="childList"&&(Fl()||vf())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function _o(n){return new My({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=hn(n.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],c=r[0];let u=t.to;if(a){const d=c.search(/\S/),f=t.from+c.indexOf(a),h=f+a.length;if(Th(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>f).length)return null;h<t.to&&o.delete(h,t.to),f>t.from&&o.delete(t.from+d,f),u=t.from+d+a.length,o.addMark(t.from+d,u,n.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}const Ry=new WeakSet,Py=new WeakSet;function $o(n){const e=n;return Ry.add(e),e}function wf(n){return Array.isArray(n)&&Ry.has(n)}function Iy(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&Py.has(e)&&!wf(e)?Iy(e):[e])}function CE(n,e){if(n==="slot")return 0;if(n instanceof Function){const s=n(e);return Array.isArray(s)&&!wf(s)&&!Py.has(s)?$o(s):s}const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(t)){if(wf(t))return $o([n,r,t]);if(t.length===0)return $o([n,r]);const s=Iy(t);return s.length===0?$o([n,r]):$o([n,r,...s])}return t!=null?$o([n,r,t]):$o([n,r])}const Qc=(n,e)=>CE(n,e),ME=(n,e)=>{var t;const{state:r}=n,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0)return!1;const o=i.depth-1;if(o<0)return!1;const a=i.node(o),c=i.index(o);if(c===0)return!1;if(a.type===e)return n.commands.lift(e.name);const u=a.child(c-1);if(u.type!==e||!(!((t=u.lastChild)===null||t===void 0)&&t.isTextblock))return!1;const d=i.before()-1-1;return n.commands.command(({tr:f,dispatch:h})=>{if(!h)return!0;const p=i.parent.content,g=new He(p,0,0);return f.replace(d,i.after(),g),f.setSelection(et.create(f.doc,d+p.size)),f.scrollIntoView(),h(f),!0})},TE=/^\s*>\s$/,EE=pr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Qc("blockquote",{...pn(this.options.HTMLAttributes,n),children:Qc("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((s,i)=>{var o,a;const c=((o=(a=e.renderChild)===null||a===void 0?void 0:a.call(e,s,i))!==null&&o!==void 0?o:e.renderChildren([s])).split(`
102
102
  `).map(u=>u.trim()===""?t:`${t} ${u}`);r.push(c.join(`
103
103
  `))}),r.join(`
104
104
  ${t}
105
- `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>ME(this.editor,this.type)}},addInputRules(){return[Ka({find:TE,type:this.type})]}}),AE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,RE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,PE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,IE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,LE=la.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Yc("strong",{...pn(this.options.HTMLAttributes,n),children:Yc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ia({find:AE,type:this.type}),ia({find:PE,type:this.type})]},addPasteRules(){return[_o({find:RE,type:this.type}),_o({find:IE,type:this.type})]}}),OE=n=>{const e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},NE=n=>{const e=/`([^`]+)`(?!`)/g,t=[];let r;for(;(r=e.exec(n))!==null;)r.index>0&&n[r.index-1]==="`"||t.push({index:r.index,text:r[0],replaceWith:r[1]});return t},DE=la.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ia({find:OE,type:this.type})]},addPasteRules(){return[_o({find:NE,type:this.type})]}}),Md=4,$E=/^```([a-z]+)?[\s\n]$/,BE=/^~~~([a-z]+)?[\s\n]$/,zE=pr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Md,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const r=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",pn(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t,r;return((t=n.raw)===null||t===void 0?void 0:t.startsWith("```"))===!1&&((r=n.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const s=((t=n.attrs)===null||t===void 0?void 0:t.language)||"";return n.content?r=[`\`\`\`${s}`,e.renderChildren(n.content),"```"].join(`
105
+ `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>ME(this.editor,this.type)}},addInputRules(){return[Ka({find:TE,type:this.type})]}}),AE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,RE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,PE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,IE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,LE=la.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Qc("strong",{...pn(this.options.HTMLAttributes,n),children:Qc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ia({find:AE,type:this.type}),ia({find:PE,type:this.type})]},addPasteRules(){return[_o({find:RE,type:this.type}),_o({find:IE,type:this.type})]}}),OE=n=>{const e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},NE=n=>{const e=/`([^`]+)`(?!`)/g,t=[];let r;for(;(r=e.exec(n))!==null;)r.index>0&&n[r.index-1]==="`"||t.push({index:r.index,text:r[0],replaceWith:r[1]});return t},DE=la.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ia({find:OE,type:this.type})]},addPasteRules(){return[_o({find:NE,type:this.type})]}}),Md=4,$E=/^```([a-z]+)?[\s\n]$/,BE=/^~~~([a-z]+)?[\s\n]$/,zE=pr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Md,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const r=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",pn(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t,r;return((t=n.raw)===null||t===void 0?void 0:t.startsWith("```"))===!1&&((r=n.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const s=((t=n.attrs)===null||t===void 0?void 0:t.language)||"";return n.content?r=[`\`\`\`${s}`,e.renderChildren(n.content),"```"].join(`
106
106
  `):r=`\`\`\`${s}
107
107
 
108
108
  \`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!==null&&e!==void 0?e:Md,{state:r}=n,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:c})=>{const{from:u,to:d}=s,f=r.doc.textBetween(u,d,`
@@ -123,45 +123,45 @@ ${t}
123
123
 
124
124
  `):""}),HE=pr.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",pn(this.options.HTMLAttributes,n)]},renderText(){return`
125
125
  `},renderMarkdown:()=>`
126
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,c=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&o){const f=c.filter(h=>a.includes(h.type.name));u.ensureMarks(f)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),UE=pr.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,pn(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=!((t=n.attrs)===null||t===void 0)&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>yf({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),VE=pr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",pn(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!zT(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return py(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(et.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(vt.create(o.doc,c.pos)):o.setSelection(et.create(o.doc,c.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=d?.create();f&&(o.insert(u,f),o.setSelection(et.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Ey({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),WE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,KE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,qE=la.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",pn(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ia({find:WE,type:this.type}),ia({find:jE,type:this.type})]},addPasteRules(){return[_o({find:KE,type:this.type}),_o({find:GE,type:this.type})]}}),JE="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",XE="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",xf="numeric",kf="ascii",_f="alpha",_l="asciinumeric",pl="alphanumeric",Sf="domain",Ly="emoji",QE="scheme",YE="slashscheme",Td="whitespace";function ZE(n,e){return n in e||(e[n]=[]),e[n]}function jo(n,e,t){e[xf]&&(e[_l]=!0,e[pl]=!0),e[kf]&&(e[_l]=!0,e[_f]=!0),e[_l]&&(e[pl]=!0),e[_f]&&(e[pl]=!0),e[pl]&&(e[Sf]=!0),e[Ly]&&(e[Sf]=!0);for(const r in e){const s=ZE(r,t);s.indexOf(n)<0&&s.push(n)}}function eA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ms(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ms.groups={};Ms.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let s=0;s<n.length;s++)this.tt(n[s],e,t,r)},tr(n,e,t,r){r=r||Ms.groups;let s;return e&&e.j?s=e:(s=new Ms(e),t&&r&&jo(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const i=n.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(n[o]);return s.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||Ms.groups;const s=this;if(e&&e.j)return s.j[n]=e,e;const i=e;let o,a=s.go(n);if(a?(o=new Ms,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Ms,i){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(eA(o.t,r),t);jo(i,c,r)}else t&&jo(i,t,r);o.t=i}return s.j[n]=o,o}};const Jt=(n,e,t,r,s)=>n.ta(e,t,r,s),qn=(n,e,t,r,s)=>n.tr(e,t,r,s),Kg=(n,e,t,r,s)=>n.ts(e,t,r,s),Te=(n,e,t,r,s)=>n.tt(e,t,r,s),Li="WORD",Cf="UWORD",Oy="ASCIINUMERICAL",Ny="ALPHANUMERICAL",Hl="LOCALHOST",Mf="TLD",Tf="UTLD",Ic="SCHEME",Pa="SLASH_SCHEME",Rh="NUM",Ef="WS",Ph="NL",Sl="OPENBRACE",Cl="CLOSEBRACE",Zc="OPENBRACKET",eu="CLOSEBRACKET",tu="OPENPAREN",nu="CLOSEPAREN",ru="OPENANGLEBRACKET",su="CLOSEANGLEBRACKET",iu="FULLWIDTHLEFTPAREN",ou="FULLWIDTHRIGHTPAREN",au="LEFTCORNERBRACKET",lu="RIGHTCORNERBRACKET",cu="LEFTWHITECORNERBRACKET",uu="RIGHTWHITECORNERBRACKET",du="FULLWIDTHLESSTHAN",fu="FULLWIDTHGREATERTHAN",hu="AMPERSAND",pu="APOSTROPHE",gu="ASTERISK",ao="AT",mu="BACKSLASH",vu="BACKTICK",bu="CARET",Go="COLON",Ih="COMMA",yu="DOLLAR",vi="DOT",wu="EQUALS",Lh="EXCLAMATION",Gs="HYPHEN",Ml="PERCENT",xu="PIPE",ku="PLUS",_u="POUND",Tl="QUERY",Oh="QUOTE",Dy="FULLWIDTHMIDDLEDOT",Nh="SEMI",bi="SLASH",El="TILDE",Su="UNDERSCORE",$y="EMOJI",Cu="SYM";var By=Object.freeze({__proto__:null,ALPHANUMERICAL:Ny,AMPERSAND:hu,APOSTROPHE:pu,ASCIINUMERICAL:Oy,ASTERISK:gu,AT:ao,BACKSLASH:mu,BACKTICK:vu,CARET:bu,CLOSEANGLEBRACKET:su,CLOSEBRACE:Cl,CLOSEBRACKET:eu,CLOSEPAREN:nu,COLON:Go,COMMA:Ih,DOLLAR:yu,DOT:vi,EMOJI:$y,EQUALS:wu,EXCLAMATION:Lh,FULLWIDTHGREATERTHAN:fu,FULLWIDTHLEFTPAREN:iu,FULLWIDTHLESSTHAN:du,FULLWIDTHMIDDLEDOT:Dy,FULLWIDTHRIGHTPAREN:ou,HYPHEN:Gs,LEFTCORNERBRACKET:au,LEFTWHITECORNERBRACKET:cu,LOCALHOST:Hl,NL:Ph,NUM:Rh,OPENANGLEBRACKET:ru,OPENBRACE:Sl,OPENBRACKET:Zc,OPENPAREN:tu,PERCENT:Ml,PIPE:xu,PLUS:ku,POUND:_u,QUERY:Tl,QUOTE:Oh,RIGHTCORNERBRACKET:lu,RIGHTWHITECORNERBRACKET:uu,SCHEME:Ic,SEMI:Nh,SLASH:bi,SLASH_SCHEME:Pa,SYM:Cu,TILDE:El,TLD:Mf,UNDERSCORE:Su,UTLD:Tf,UWORD:Cf,WORD:Li,WS:Ef});const Ri=/[a-z]/,ll=/\p{L}/u,Ed=/\p{Emoji}/u,Pi=/\d/,Ad=/\s/,jg="\r",Rd=`
127
- `,tA="️",nA="‍",Pd="";let gc=null,mc=null;function rA(n=[]){const e={};Ms.groups=e;const t=new Ms;gc==null&&(gc=Gg(JE)),mc==null&&(mc=Gg(XE)),Te(t,"'",pu),Te(t,"{",Sl),Te(t,"}",Cl),Te(t,"[",Zc),Te(t,"]",eu),Te(t,"(",tu),Te(t,")",nu),Te(t,"<",ru),Te(t,">",su),Te(t,"(",iu),Te(t,")",ou),Te(t,"「",au),Te(t,"」",lu),Te(t,"『",cu),Te(t,"』",uu),Te(t,"<",du),Te(t,">",fu),Te(t,"&",hu),Te(t,"*",gu),Te(t,"@",ao),Te(t,"`",vu),Te(t,"^",bu),Te(t,":",Go),Te(t,",",Ih),Te(t,"$",yu),Te(t,".",vi),Te(t,"=",wu),Te(t,"!",Lh),Te(t,"-",Gs),Te(t,"%",Ml),Te(t,"|",xu),Te(t,"+",ku),Te(t,"#",_u),Te(t,"?",Tl),Te(t,'"',Oh),Te(t,"/",bi),Te(t,";",Nh),Te(t,"~",El),Te(t,"_",Su),Te(t,"\\",mu),Te(t,"・",Dy);const r=qn(t,Pi,Rh,{[xf]:!0});qn(r,Pi,r);const s=qn(r,Ri,Oy,{[_l]:!0}),i=qn(r,ll,Ny,{[pl]:!0}),o=qn(t,Ri,Li,{[kf]:!0});qn(o,Pi,s),qn(o,Ri,o),qn(s,Pi,s),qn(s,Ri,s);const a=qn(t,ll,Cf,{[_f]:!0});qn(a,Ri),qn(a,Pi,i),qn(a,ll,a),qn(i,Pi,i),qn(i,Ri),qn(i,ll,i);const c=Te(t,Rd,Ph,{[Td]:!0}),u=Te(t,jg,Ef,{[Td]:!0}),d=qn(t,Ad,Ef,{[Td]:!0});Te(t,Pd,d),Te(u,Rd,c),Te(u,Pd,d),qn(u,Ad,d),Te(d,jg),Te(d,Rd),qn(d,Ad,d),Te(d,Pd,d);const f=qn(t,Ed,$y,{[Ly]:!0});Te(f,"#"),qn(f,Ed,f),Te(f,tA,f);const h=Te(f,nA);Te(h,"#"),qn(h,Ed,f);const p=[[Ri,o],[Pi,s]],g=[[Ri,null],[ll,a],[Pi,i]];for(let v=0;v<gc.length;v++)ro(t,gc[v],Mf,Li,p);for(let v=0;v<mc.length;v++)ro(t,mc[v],Tf,Cf,g);jo(Mf,{tld:!0,ascii:!0},e),jo(Tf,{utld:!0,alpha:!0},e),ro(t,"file",Ic,Li,p),ro(t,"mailto",Ic,Li,p),ro(t,"http",Pa,Li,p),ro(t,"https",Pa,Li,p),ro(t,"ftp",Pa,Li,p),ro(t,"ftps",Pa,Li,p),jo(Ic,{scheme:!0,ascii:!0},e),jo(Pa,{slashscheme:!0,ascii:!0},e),n=n.sort((v,m)=>v[0]>m[0]?1:-1);for(let v=0;v<n.length;v++){const m=n[v][0],I=n[v][1]?{[QE]:!0}:{[YE]:!0};m.indexOf("-")>=0?I[Sf]=!0:Ri.test(m)?Pi.test(m)?I[_l]=!0:I[kf]=!0:I[xf]=!0,Kg(t,m,m,I)}return Kg(t,"localhost",Hl,{ascii:!0}),t.jd=new Ms(Cu),{start:t,tokens:Object.assign({groups:e},By)}}function zy(n,e){const t=sA(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o<r;){let a=n,c=null,u=0,d=null,f=-1,h=-1;for(;o<r&&(c=a.go(t[o]));)a=c,a.accepts()?(f=0,h=0,d=a):f>=0&&(f+=t[o].length,h++),u+=t[o].length,i+=t[o].length,o++;i-=f,o-=h,u-=f,s.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return s}function sA(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,o=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function ro(n,e,t,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const c=e[a];n.j[c]?i=n.j[c]:(i=new Ms(r),i.jr=s.slice(),n.j[c]=i),n=i}return i=new Ms(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function Gg(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const Ul={defaultProtocol:"http",events:null,format:qg,formatHref:qg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Dh(n,e=null){let t=Object.assign({},Ul);n&&(t=Object.assign(t,n instanceof Dh?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}Dh.prototype={o:Ul,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:Ul[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function qg(n){return n}function Fy(n,e){this.t="token",this.v=n,this.tk=e}Fy.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Ul.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),c=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),c&&(o.target=c),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:s,attributes:o,content:i,eventListeners:f}}};function Vu(n,e){class t extends Fy{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const iA=Vu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Jg=Vu("text"),oA=Vu("nl"),vc=Vu("url",{isLink:!0,toHref(n=Ul.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Hl&&n[1].t===Go}}),Ks=n=>new Ms(n);function aA({groups:n}){const e=n.domain.concat([hu,gu,ao,mu,vu,bu,yu,wu,Gs,Rh,Ml,xu,ku,_u,bi,Cu,El,Su]),t=[pu,Go,Ih,vi,Lh,Ml,Tl,Oh,Nh,ru,su,Sl,Cl,eu,Zc,tu,nu,iu,ou,au,lu,cu,uu,du,fu],r=[hu,pu,gu,mu,vu,bu,yu,wu,Gs,Sl,Cl,Ml,xu,ku,_u,Tl,bi,Cu,El,Su],s=Ks(),i=Te(s,El);Jt(i,r,i),Jt(i,n.domain,i);const o=Ks(),a=Ks(),c=Ks();Jt(s,n.domain,o),Jt(s,n.scheme,a),Jt(s,n.slashscheme,c),Jt(o,r,i),Jt(o,n.domain,o);const u=Te(o,ao);Te(i,ao,u),Te(a,ao,u),Te(c,ao,u);const d=Te(i,vi);Jt(d,r,i),Jt(d,n.domain,i);const f=Ks();Jt(u,n.domain,f),Jt(f,n.domain,f);const h=Te(f,vi);Jt(h,n.domain,f);const p=Ks(iA);Jt(h,n.tld,p),Jt(h,n.utld,p),Te(u,Hl,p);const g=Te(f,Gs);Te(g,Gs,g),Jt(g,n.domain,f),Jt(p,n.domain,f),Te(p,vi,h),Te(p,Gs,g);const v=Te(o,Gs),m=Te(o,vi);Te(v,Gs,v),Jt(v,n.domain,o),Jt(m,r,i),Jt(m,n.domain,o);const S=Ks(vc);Jt(m,n.tld,S),Jt(m,n.utld,S),Jt(S,n.domain,o),Jt(S,r,i),Te(S,vi,m),Te(S,Gs,v),Te(S,ao,u);const I=Te(S,Go),C=Ks(vc);Jt(I,n.numeric,C);const M=Ks(vc),O=Ks();Jt(M,e,M),Jt(M,t,O),Jt(O,e,M),Jt(O,t,O),Te(S,bi,M),Te(C,bi,M);const P=Te(a,Go),E=Te(c,Go),z=Te(E,bi),G=Te(z,bi);Jt(a,n.domain,o),Te(a,vi,m),Te(a,Gs,v),Jt(c,n.domain,o),Te(c,vi,m),Te(c,Gs,v),Jt(P,n.domain,M),Te(P,bi,M),Te(P,Tl,M),Jt(G,n.domain,M),Jt(G,e,M),Te(G,bi,M);const J=[[Sl,Cl],[Zc,eu],[tu,nu],[ru,su],[iu,ou],[au,lu],[cu,uu],[du,fu]];for(let K=0;K<J.length;K++){const[Q,$]=J[K],X=Te(M,Q);Te(O,Q,X);const de=Ks(vc);Jt(X,e,de);const me=Ks();Jt(X,t,me),Te(X,$,M),Jt(de,e,de),Jt(de,t,me),Jt(me,e,de),Jt(me,t,me),Te(de,$,M),Te(me,$,M)}return Te(s,Hl,S),Te(s,Ph,oA),{start:s,tokens:By}}function lA(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s<r;){let a=n,c=null,u=null,d=0,f=null,h=-1;for(;s<r&&!(c=a.go(t[s].t));)o.push(t[s++]);for(;s<r&&(u=c||a.go(t[s].t));)c=null,a=u,a.accepts()?(h=0,f=a):h>=0&&h++,s++,d++;if(h<0)s-=d,s<r&&(o.push(t[s]),s++);else{o.length>0&&(i.push(Id(Jg,e,o)),o=[]),s-=h,d-=h;const p=f.t,g=t.slice(s-d,s);i.push(Id(p,e,g))}}return o.length>0&&i.push(Id(Jg,e,o)),i}function Id(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const cA=typeof console<"u"&&console&&console.warn||(()=>{}),uA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ln={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function dA(){return Ms.groups={},Ln.scanner=null,Ln.parser=null,Ln.tokenQueue=[],Ln.pluginQueue=[],Ln.customSchemes=[],Ln.initialized=!1,Ln}function Xg(n,e=!1){if(Ln.initialized&&cA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${uA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
126
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,c=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&c&&o){const f=c.filter(h=>a.includes(h.type.name));u.ensureMarks(f)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),UE=pr.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,pn(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=!((t=n.attrs)===null||t===void 0)&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>yf({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),VE=pr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",pn(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!zT(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return py(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:c}=o.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(et.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(vt.create(o.doc,c.pos)):o.setSelection(et.create(o.doc,c.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,f=d?.create();f&&(o.insert(u,f),o.setSelection(et.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Ey({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),WE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,KE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,qE=la.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",pn(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ia({find:WE,type:this.type}),ia({find:jE,type:this.type})]},addPasteRules(){return[_o({find:KE,type:this.type}),_o({find:GE,type:this.type})]}}),JE="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",XE="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",xf="numeric",kf="ascii",_f="alpha",_l="asciinumeric",pl="alphanumeric",Sf="domain",Ly="emoji",YE="scheme",QE="slashscheme",Td="whitespace";function ZE(n,e){return n in e||(e[n]=[]),e[n]}function jo(n,e,t){e[xf]&&(e[_l]=!0,e[pl]=!0),e[kf]&&(e[_l]=!0,e[_f]=!0),e[_l]&&(e[pl]=!0),e[_f]&&(e[pl]=!0),e[pl]&&(e[Sf]=!0),e[Ly]&&(e[Sf]=!0);for(const r in e){const s=ZE(r,t);s.indexOf(n)<0&&s.push(n)}}function eA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ms(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ms.groups={};Ms.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let s=0;s<n.length;s++)this.tt(n[s],e,t,r)},tr(n,e,t,r){r=r||Ms.groups;let s;return e&&e.j?s=e:(s=new Ms(e),t&&r&&jo(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const i=n.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(n[o]);return s.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||Ms.groups;const s=this;if(e&&e.j)return s.j[n]=e,e;const i=e;let o,a=s.go(n);if(a?(o=new Ms,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Ms,i){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(eA(o.t,r),t);jo(i,c,r)}else t&&jo(i,t,r);o.t=i}return s.j[n]=o,o}};const Jt=(n,e,t,r,s)=>n.ta(e,t,r,s),qn=(n,e,t,r,s)=>n.tr(e,t,r,s),Kg=(n,e,t,r,s)=>n.ts(e,t,r,s),Te=(n,e,t,r,s)=>n.tt(e,t,r,s),Li="WORD",Cf="UWORD",Oy="ASCIINUMERICAL",Ny="ALPHANUMERICAL",Hl="LOCALHOST",Mf="TLD",Tf="UTLD",Ic="SCHEME",Pa="SLASH_SCHEME",Rh="NUM",Ef="WS",Ph="NL",Sl="OPENBRACE",Cl="CLOSEBRACE",Zc="OPENBRACKET",eu="CLOSEBRACKET",tu="OPENPAREN",nu="CLOSEPAREN",ru="OPENANGLEBRACKET",su="CLOSEANGLEBRACKET",iu="FULLWIDTHLEFTPAREN",ou="FULLWIDTHRIGHTPAREN",au="LEFTCORNERBRACKET",lu="RIGHTCORNERBRACKET",cu="LEFTWHITECORNERBRACKET",uu="RIGHTWHITECORNERBRACKET",du="FULLWIDTHLESSTHAN",fu="FULLWIDTHGREATERTHAN",hu="AMPERSAND",pu="APOSTROPHE",gu="ASTERISK",ao="AT",mu="BACKSLASH",vu="BACKTICK",bu="CARET",Go="COLON",Ih="COMMA",yu="DOLLAR",vi="DOT",wu="EQUALS",Lh="EXCLAMATION",Gs="HYPHEN",Ml="PERCENT",xu="PIPE",ku="PLUS",_u="POUND",Tl="QUERY",Oh="QUOTE",Dy="FULLWIDTHMIDDLEDOT",Nh="SEMI",bi="SLASH",El="TILDE",Su="UNDERSCORE",$y="EMOJI",Cu="SYM";var By=Object.freeze({__proto__:null,ALPHANUMERICAL:Ny,AMPERSAND:hu,APOSTROPHE:pu,ASCIINUMERICAL:Oy,ASTERISK:gu,AT:ao,BACKSLASH:mu,BACKTICK:vu,CARET:bu,CLOSEANGLEBRACKET:su,CLOSEBRACE:Cl,CLOSEBRACKET:eu,CLOSEPAREN:nu,COLON:Go,COMMA:Ih,DOLLAR:yu,DOT:vi,EMOJI:$y,EQUALS:wu,EXCLAMATION:Lh,FULLWIDTHGREATERTHAN:fu,FULLWIDTHLEFTPAREN:iu,FULLWIDTHLESSTHAN:du,FULLWIDTHMIDDLEDOT:Dy,FULLWIDTHRIGHTPAREN:ou,HYPHEN:Gs,LEFTCORNERBRACKET:au,LEFTWHITECORNERBRACKET:cu,LOCALHOST:Hl,NL:Ph,NUM:Rh,OPENANGLEBRACKET:ru,OPENBRACE:Sl,OPENBRACKET:Zc,OPENPAREN:tu,PERCENT:Ml,PIPE:xu,PLUS:ku,POUND:_u,QUERY:Tl,QUOTE:Oh,RIGHTCORNERBRACKET:lu,RIGHTWHITECORNERBRACKET:uu,SCHEME:Ic,SEMI:Nh,SLASH:bi,SLASH_SCHEME:Pa,SYM:Cu,TILDE:El,TLD:Mf,UNDERSCORE:Su,UTLD:Tf,UWORD:Cf,WORD:Li,WS:Ef});const Ri=/[a-z]/,ll=/\p{L}/u,Ed=/\p{Emoji}/u,Pi=/\d/,Ad=/\s/,jg="\r",Rd=`
127
+ `,tA="️",nA="‍",Pd="";let gc=null,mc=null;function rA(n=[]){const e={};Ms.groups=e;const t=new Ms;gc==null&&(gc=Gg(JE)),mc==null&&(mc=Gg(XE)),Te(t,"'",pu),Te(t,"{",Sl),Te(t,"}",Cl),Te(t,"[",Zc),Te(t,"]",eu),Te(t,"(",tu),Te(t,")",nu),Te(t,"<",ru),Te(t,">",su),Te(t,"(",iu),Te(t,")",ou),Te(t,"「",au),Te(t,"」",lu),Te(t,"『",cu),Te(t,"』",uu),Te(t,"<",du),Te(t,">",fu),Te(t,"&",hu),Te(t,"*",gu),Te(t,"@",ao),Te(t,"`",vu),Te(t,"^",bu),Te(t,":",Go),Te(t,",",Ih),Te(t,"$",yu),Te(t,".",vi),Te(t,"=",wu),Te(t,"!",Lh),Te(t,"-",Gs),Te(t,"%",Ml),Te(t,"|",xu),Te(t,"+",ku),Te(t,"#",_u),Te(t,"?",Tl),Te(t,'"',Oh),Te(t,"/",bi),Te(t,";",Nh),Te(t,"~",El),Te(t,"_",Su),Te(t,"\\",mu),Te(t,"・",Dy);const r=qn(t,Pi,Rh,{[xf]:!0});qn(r,Pi,r);const s=qn(r,Ri,Oy,{[_l]:!0}),i=qn(r,ll,Ny,{[pl]:!0}),o=qn(t,Ri,Li,{[kf]:!0});qn(o,Pi,s),qn(o,Ri,o),qn(s,Pi,s),qn(s,Ri,s);const a=qn(t,ll,Cf,{[_f]:!0});qn(a,Ri),qn(a,Pi,i),qn(a,ll,a),qn(i,Pi,i),qn(i,Ri),qn(i,ll,i);const c=Te(t,Rd,Ph,{[Td]:!0}),u=Te(t,jg,Ef,{[Td]:!0}),d=qn(t,Ad,Ef,{[Td]:!0});Te(t,Pd,d),Te(u,Rd,c),Te(u,Pd,d),qn(u,Ad,d),Te(d,jg),Te(d,Rd),qn(d,Ad,d),Te(d,Pd,d);const f=qn(t,Ed,$y,{[Ly]:!0});Te(f,"#"),qn(f,Ed,f),Te(f,tA,f);const h=Te(f,nA);Te(h,"#"),qn(h,Ed,f);const p=[[Ri,o],[Pi,s]],g=[[Ri,null],[ll,a],[Pi,i]];for(let v=0;v<gc.length;v++)ro(t,gc[v],Mf,Li,p);for(let v=0;v<mc.length;v++)ro(t,mc[v],Tf,Cf,g);jo(Mf,{tld:!0,ascii:!0},e),jo(Tf,{utld:!0,alpha:!0},e),ro(t,"file",Ic,Li,p),ro(t,"mailto",Ic,Li,p),ro(t,"http",Pa,Li,p),ro(t,"https",Pa,Li,p),ro(t,"ftp",Pa,Li,p),ro(t,"ftps",Pa,Li,p),jo(Ic,{scheme:!0,ascii:!0},e),jo(Pa,{slashscheme:!0,ascii:!0},e),n=n.sort((v,m)=>v[0]>m[0]?1:-1);for(let v=0;v<n.length;v++){const m=n[v][0],I=n[v][1]?{[YE]:!0}:{[QE]:!0};m.indexOf("-")>=0?I[Sf]=!0:Ri.test(m)?Pi.test(m)?I[_l]=!0:I[kf]=!0:I[xf]=!0,Kg(t,m,m,I)}return Kg(t,"localhost",Hl,{ascii:!0}),t.jd=new Ms(Cu),{start:t,tokens:Object.assign({groups:e},By)}}function zy(n,e){const t=sA(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o<r;){let a=n,c=null,u=0,d=null,f=-1,h=-1;for(;o<r&&(c=a.go(t[o]));)a=c,a.accepts()?(f=0,h=0,d=a):f>=0&&(f+=t[o].length,h++),u+=t[o].length,i+=t[o].length,o++;i-=f,o-=h,u-=f,s.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return s}function sA(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,o=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function ro(n,e,t,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const c=e[a];n.j[c]?i=n.j[c]:(i=new Ms(r),i.jr=s.slice(),n.j[c]=i),n=i}return i=new Ms(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function Gg(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const Ul={defaultProtocol:"http",events:null,format:qg,formatHref:qg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Dh(n,e=null){let t=Object.assign({},Ul);n&&(t=Object.assign(t,n instanceof Dh?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}Dh.prototype={o:Ul,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:Ul[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function qg(n){return n}function Fy(n,e){this.t="token",this.v=n,this.tk=e}Fy.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Ul.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),c=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),c&&(o.target=c),u&&(o.rel=u),d&&Object.assign(o,d),{tagName:s,attributes:o,content:i,eventListeners:f}}};function Vu(n,e){class t extends Fy{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const iA=Vu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Jg=Vu("text"),oA=Vu("nl"),vc=Vu("url",{isLink:!0,toHref(n=Ul.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Hl&&n[1].t===Go}}),Ks=n=>new Ms(n);function aA({groups:n}){const e=n.domain.concat([hu,gu,ao,mu,vu,bu,yu,wu,Gs,Rh,Ml,xu,ku,_u,bi,Cu,El,Su]),t=[pu,Go,Ih,vi,Lh,Ml,Tl,Oh,Nh,ru,su,Sl,Cl,eu,Zc,tu,nu,iu,ou,au,lu,cu,uu,du,fu],r=[hu,pu,gu,mu,vu,bu,yu,wu,Gs,Sl,Cl,Ml,xu,ku,_u,Tl,bi,Cu,El,Su],s=Ks(),i=Te(s,El);Jt(i,r,i),Jt(i,n.domain,i);const o=Ks(),a=Ks(),c=Ks();Jt(s,n.domain,o),Jt(s,n.scheme,a),Jt(s,n.slashscheme,c),Jt(o,r,i),Jt(o,n.domain,o);const u=Te(o,ao);Te(i,ao,u),Te(a,ao,u),Te(c,ao,u);const d=Te(i,vi);Jt(d,r,i),Jt(d,n.domain,i);const f=Ks();Jt(u,n.domain,f),Jt(f,n.domain,f);const h=Te(f,vi);Jt(h,n.domain,f);const p=Ks(iA);Jt(h,n.tld,p),Jt(h,n.utld,p),Te(u,Hl,p);const g=Te(f,Gs);Te(g,Gs,g),Jt(g,n.domain,f),Jt(p,n.domain,f),Te(p,vi,h),Te(p,Gs,g);const v=Te(o,Gs),m=Te(o,vi);Te(v,Gs,v),Jt(v,n.domain,o),Jt(m,r,i),Jt(m,n.domain,o);const S=Ks(vc);Jt(m,n.tld,S),Jt(m,n.utld,S),Jt(S,n.domain,o),Jt(S,r,i),Te(S,vi,m),Te(S,Gs,v),Te(S,ao,u);const I=Te(S,Go),C=Ks(vc);Jt(I,n.numeric,C);const M=Ks(vc),O=Ks();Jt(M,e,M),Jt(M,t,O),Jt(O,e,M),Jt(O,t,O),Te(S,bi,M),Te(C,bi,M);const P=Te(a,Go),E=Te(c,Go),z=Te(E,bi),G=Te(z,bi);Jt(a,n.domain,o),Te(a,vi,m),Te(a,Gs,v),Jt(c,n.domain,o),Te(c,vi,m),Te(c,Gs,v),Jt(P,n.domain,M),Te(P,bi,M),Te(P,Tl,M),Jt(G,n.domain,M),Jt(G,e,M),Te(G,bi,M);const J=[[Sl,Cl],[Zc,eu],[tu,nu],[ru,su],[iu,ou],[au,lu],[cu,uu],[du,fu]];for(let K=0;K<J.length;K++){const[Y,$]=J[K],X=Te(M,Y);Te(O,Y,X);const de=Ks(vc);Jt(X,e,de);const me=Ks();Jt(X,t,me),Te(X,$,M),Jt(de,e,de),Jt(de,t,me),Jt(me,e,de),Jt(me,t,me),Te(de,$,M),Te(me,$,M)}return Te(s,Hl,S),Te(s,Ph,oA),{start:s,tokens:By}}function lA(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s<r;){let a=n,c=null,u=null,d=0,f=null,h=-1;for(;s<r&&!(c=a.go(t[s].t));)o.push(t[s++]);for(;s<r&&(u=c||a.go(t[s].t));)c=null,a=u,a.accepts()?(h=0,f=a):h>=0&&h++,s++,d++;if(h<0)s-=d,s<r&&(o.push(t[s]),s++);else{o.length>0&&(i.push(Id(Jg,e,o)),o=[]),s-=h,d-=h;const p=f.t,g=t.slice(s-d,s);i.push(Id(p,e,g))}}return o.length>0&&i.push(Id(Jg,e,o)),i}function Id(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const cA=typeof console<"u"&&console&&console.warn||(()=>{}),uA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ln={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function dA(){return Ms.groups={},Ln.scanner=null,Ln.parser=null,Ln.tokenQueue=[],Ln.pluginQueue=[],Ln.customSchemes=[],Ln.initialized=!1,Ln}function Xg(n,e=!1){if(Ln.initialized&&cA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${uA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
128
128
  1. Must only contain digits, lowercase ASCII letters or "-"
129
129
  2. Cannot start or end with "-"
130
- 3. "-" cannot repeat`);Ln.customSchemes.push([n,e])}function fA(){Ln.scanner=rA(Ln.customSchemes);for(let n=0;n<Ln.tokenQueue.length;n++)Ln.tokenQueue[n][1]({scanner:Ln.scanner});Ln.parser=aA(Ln.scanner.tokens);for(let n=0;n<Ln.pluginQueue.length;n++)Ln.pluginQueue[n][1]({scanner:Ln.scanner,parser:Ln.parser});return Ln.initialized=!0,Ln}function $h(n){return Ln.initialized||fA(),lA(Ln.parser.start,n,zy(Ln.scanner.start,n))}$h.scan=zy;function Hy(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Dh(t),s=$h(n),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const Bh="[\0-   ᠎ -\u2029  ]",hA=new RegExp(Bh),pA=new RegExp(`${Bh}$`),gA=new RegExp(Bh,"g");function mA(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function vA(n){return new kn({key:new Dn("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=cy(t.doc,[...e]);if(Fu(a).forEach(({newRange:c})=>{const u=D2(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!pA.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(hA).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=d.pos+f.lastIndexOf(p);if(!p)return!1;const v=$h(p).map(m=>m.toObject(n.defaultProtocol));if(!mA(v))return!1;v.filter(m=>m.isLink).map(m=>({...m,from:g+m.start+1,to:g+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>n.validate(m.value)).filter(m=>n.shouldAutoLink(m.value)).forEach(m=>{Th(m.from,m.to,r.doc).some(S=>S.mark.type===n.type)||o.addMark(m.from,m.to,n.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function bA(n){return new kn({key:new Dn("handleClickLink"),props:{handleClick:(e,t,r)=>{if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const c=r.target;if(!c)return!1;const u=n.editor.view.dom;s=c.closest("a"),s&&!u.contains(s)&&(s=null)}if(!s)return!1;let i=!1;if(n.enableClickSelection&&(i=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){var o,a;const c=hy(e.state,n.type.name),u=(o=s.href)!==null&&o!==void 0?o:c.href,d=(a=s.target)!==null&&a!==void 0?a:c.target;u&&(window.open(u,d),i=!0)}return i}}})}const yA=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,wA=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Uy(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function xA(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&Uy(n,r)){r+=1;continue}let s=0;for(;r<e&&n[r]==="`";)s+=1,r+=1;t===0?t=s:s===t&&(t=0)}return t>0}function Vy(n,e,t){var r,s;const[,i,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||Uy(n,(r=e.index)!==null&&r!==void 0?r:0)||xA(n,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&t(o)}function Wy(n){var e,t;const[r,s,i,,o,a,c]=n,u=(e=o??a)!==null&&e!==void 0?e:c;return{index:(t=n.index)!==null&&t!==void 0?t:0,text:r,replaceWith:s,data:{href:i,title:u||null,markdown:!0}}}function kA(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function Ky(n){var e,t,r;return{href:(e=n.data)===null||e===void 0?void 0:e.href,title:(t=(r=n.data)===null||r===void 0?void 0:r.title)!==null&&t!==void 0?t:null}}function _A(n){const e=ia({find:t=>{const r=yA.exec(t);return!r||!Vy(t,r,n.isAllowedHref)?null:Wy(r)},type:n.type,getAttributes:Ky});return new tc({find:e.find,handler:t=>{const r=e.handler(t);return r!==null&&t.state.tr.steps.length&&t.state.tr.setMeta("preventAutolink",!0),r}})}function SA(n){const e=_o({find:t=>{var r,s;const i=[];for(const a of t.matchAll(wA))Vy(t,a,n.isAllowedHref)&&i.push(Wy(a));const o=((r=(s=n.findPlainUrls)===null||s===void 0?void 0:s.call(n,t))!==null&&r!==void 0?r:[]).filter(a=>!i.some(c=>kA(c,a)));return[...i,...o]},type:n.type,getAttributes:Ky});return new My({find:e.find,handler:t=>{var r;const s=e.handler(t);return s!==null&&t.state.tr.steps.length&&(!((r=t.match.data)===null||r===void 0)&&r.markdown)&&t.state.tr.setMeta("preventAutolink",!0),s}})}function CA(n){return new kn({key:new Dn("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const u=Hy(c,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!u||s!==void 0&&!s(u.value)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function Ii(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(gA,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const jy=la.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Xg(n);return}Xg(n.scheme,n.optionalSlashes)})},onDestroy(){dA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Ii(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var n,e,t;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(n=this.options.HTMLAttributes.target)!==null&&n!==void 0?n:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(t=this.options.HTMLAttributes.class)!==null&&t!==void 0?t:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Ii(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Ii(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",pn(this.options.HTMLAttributes,n),0]:["a",pn(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,s,i;const o=(t=(r=n.attrs)===null||r===void 0?void 0:r.href)!==null&&t!==void 0?t:"",a=(s=(i=n.attrs)===null||i===void 0?void 0:i.title)!==null&&s!==void 0?s:"",c=e.renderChildren(n);return a?`[${c}](${o} "${a}")`:`[${c}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Ii(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Ii(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[_A({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!Ii(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const n=e=>{const t=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;Hy(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Ii(o,r),protocols:r,defaultProtocol:s})).forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t};return this.options.markdownLinks?[SA({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!Ii(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:n})]:[_o({find:n,type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(vA({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Ii(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(bA({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(CA({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}});var MA=jy;const TA="listItem",Qg="textStyle",Yg=/^\s*([-+*])\s$/,Gy=pr.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
131
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(TA,this.editor.getAttributes(Qg)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ka({find:Yg,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ka({find:Yg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Qg),editor:this.editor})),[n]}}),EA=(n,e,t)=>{const{selection:r}=n;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let p=s.depth;p>0;p-=1)if(s.node(p).type.name===e){i=p;break}if(i<0)return null;const o=s.node(i),a=s.index(i);if(a+1>=o.childCount)return null;const c=o.child(a+1);if(!t.includes(c.type.name))return null;const u=n.schema.nodes[e];let d=!1;if(c.forEach(p=>{p.type===u&&p.childCount>1&&(d=!0)}),!d)return null;const f=n.doc.resolve(s.after()).nodeAfter;if(!f||!t.includes(f.type.name))return null;const h=[];return f.forEach(p=>{h.push(p)}),h.length===0?null:{listItemDepth:i,nestedList:f,nestedListPos:s.after(),insertPos:s.after(i),items:h}},AA=(n,e,t,r)=>{const s=EA(n,t,r);if(!s)return!1;const{selection:i}=n,{nestedList:o,nestedListPos:a,insertPos:c,items:u}=s,d=n.tr;d.delete(a,a+o.nodeSize);const f=d.mapping.map(c);return d.insert(f,_e.from(u)),d.setSelection(i.map(d.doc,d.mapping)),e&&e(d),!0},RA=(n,e,t)=>AA(n.state,n.view.dispatch,e,t),qy=(n,e)=>zn.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>RA(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),Jy=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],bc="abcdefghijklmnopqrstuvwxyz",Xy=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function Wu(n){let e=n,t="";for(const[r,s]of Jy)for(;e>=r;)t+=s,e-=r;return t}function zh(n){return Wu(n).toUpperCase()}function Qy(n){const e=n.toLowerCase();let t=0,r=0;for(;t<e.length;){let s=!1;for(const[i,o]of Jy)if(e.startsWith(o,t)){r+=i,t+=o.length,s=!0;break}if(!s)return 0}return r}function PA(n){if(!/^[ivxlcdmIVXLCDM]+$/.test(n))return!1;const e=Qy(n);return e<=0?!1:(n===n.toLowerCase()?Wu(e):zh(e))===n}function IA(n){const e=n.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const t=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(t+1)*26+r+1}return 0}function Mu(n){if(n<=26)return bc[n-1];const e=Math.floor((n-1)/26)-1,t=(n-1)%26;return e<0?bc[t]:bc[e]+bc[t]}function Ku(n){if(!(!n||/^\d+$/.test(n))){if(PA(n))return n===n.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(n))return"a";if(/^[A-Z]{1,2}$/.test(n))return"A"}}function Fh(n){if(/^\d+$/.test(n))return parseInt(n,10);const e=Ku(n);if(e==="i"||e==="I")return Qy(n);if(e==="a"||e==="A"){const r=IA(n);return r>0?r:1}const t=parseInt(n,10);return Number.isNaN(t)?1:t}function LA(n,e){if(n==="numeric")return String(e);switch(n){case"a":return Mu(e);case"A":return Mu(e).toUpperCase();case"i":return Wu(e);case"I":return zh(e);default:return String(e)}}function OA(n){var e;if(n.length===0)return!1;const t=(e=Ku(n[0]))!==null&&e!==void 0?e:"numeric",r=Fh(n[0]);if(r<1)return!1;for(let s=0;s<n.length;s++){const i=LA(t,r+s);if(n[s]!==i)return!1}return!0}function NA(n){return{type:Ku(n),start:Fh(n)}}function DA(n){const{type:e,start:t}=NA(n),r={};return e&&(r.type=e),t!==1&&(r.start=t),r}function $A(n,e,t=". "){const r=e+1;if(!n||n==="1")return`${r}${t}`;switch(n){case"a":return`${Mu(r)}${t}`;case"A":return`${Mu(r).toUpperCase()}${t}`;case"i":return`${Wu(r)}${t}`;case"I":return`${zh(r)}${t}`;default:return`${r}${t}`}}function BA(n){var e,t;const r=(e=n.tokens)===null||e===void 0?void 0:e[0];return!!(n.text&&((t=n.tokens)===null||t===void 0?void 0:t.length)===1&&r?.type==="list"&&r.ordered&&r.raw===n.text)}function zA(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}const Yy=pr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;let s=[];if(n.tokens&&n.tokens.length>0){if(BA(n))return{type:"listItem",content:[{type:"paragraph",content:zA(n.text||"",e)}]};if(n.tokens.some(i=>i.type==="paragraph"))s=r(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const o=r(n.tokens.slice(1));s.push(...o)}}else s=r(n.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(n,e,t)=>_y(n,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var s,i;const o=((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.start)||1;return $A((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.type,o-1+(r.index||0),". ")}return"- "},t,{alignNestedToPrefix:t?.parentType==="orderedList"}),addExtensions(){return[qy(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Hh=(n,e)=>{const{$from:t}=e.selection,r=xr(n,e.schema);let s=null,i=t.depth,o=t.pos,a=null;for(;i>0&&a===null;)s=t.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Zy=(n,e)=>{const t=Hh(n,e);if(!t)return!1;const[,r]=G2(e,n,t.$pos.pos+4);return r},FA=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),i=n.doc.resolve(s).node();return!(!i||!t.includes(i.type.name))},Zg=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Ui(n.state,e)&&FA(n.state,e,t)){const{$anchor:i}=n.state.selection,o=n.state.doc.resolve(i.before()-1),a=[];o.node().descendants((d,f)=>{d.type.name===e&&a.push({node:d,pos:f})});const c=a.at(-1);if(!c)return!1;const u=n.state.doc.resolve(o.start()+c.pos+1);return n.chain().cut({from:i.start()-1,to:i.end()+1},u.end()).joinForward().run()}if(!Ui(n.state,e)||!Y2(n.state))return!1;const{$from:r}=n.state.selection,s=r.depth-1;return r.node(s).type!==n.schema.nodes[e]||r.index(s)!==0?!1:n.chain().liftListItem(e).run()},HA=(n,e)=>{const t=Zy(n,e),r=Hh(n,e);return!r||!t?!1:t>r.depth},UA=(n,e)=>{const t=Zy(n,e),r=Hh(n,e);return!r||!t?!1:t<r.depth},em=(n,e)=>{if(!Ui(n.state,e)||!Q2(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:HA(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():UA(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},VA=(n,e,t)=>{const{state:r}=n,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0||!i.parent.isTextblock||Ui(r,e))return!1;const o=q2(i);if(!o||!t.includes(o.type.name))return!1;const a=o.lastChild;if(!a||a.type.name!==e)return!1;const c=i.parent;if(!a.canReplace(a.childCount,a.childCount,_e.from(c)))return!1;const u=i.before(),d=i.after(),f=u-2;return n.commands.command(({tr:h,dispatch:p})=>(p&&(h.delete(u,d).insert(f,_e.from(c)),h.setSelection(et.create(h.doc,f+1)),h.scrollIntoView()),!0))},e0=zn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&em(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&em(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Zg(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Zg(n,t,r)&&(e=!0)}),e},Tab:({editor:n})=>{for(const{itemName:e,wrapperNames:t}of this.options.listTypes)if(n.state.schema.nodes[e]!==void 0&&VA(n,e,t))return!0;return!1}}}}),Af=new RegExp(`^(\\s*)(${Xy})([.)])\\s+(.*)$`),WA=/^\s/,Ia={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function KA(n){return Af.test(n.trimStart())}function jA(n){const e=n.trimStart();return Ia.bulletItem.test(e)||KA(e)||Ia.heading.test(e)||Ia.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Ia.codeFence.test(e)||Ia.blockMath.test(e)}function GA(n){return Object.values(Ia).some(e=>e.test(n))}function qA(n){const e=[],t=[];let r=!1;return n.forEach(s=>{if(r){t.push(s);return}if(s.trim()===""){r=!0,t.push(s);return}if(e.length>0&&jA(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function JA(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],i=s.match(Af);if(!i)break;const[,o,a,c,u]=i,d=o.length,f=parseInt(a,10),h=isNaN(f)?Ku(a):void 0,p=isNaN(f)?Fh(a):f,g=[u];let v=t+1;const m=[s];let S=!1;for(;v<n.length;){const I=n[v];if(I.match(Af))break;if(I.trim()==="")m.push(I),g.push(""),S=!0,v+=1;else if(I.match(WA)){const C=I.length-I.trimStart().length,M=d+a.length+1;m.push(I),g.push(I.slice(Math.min(C,M))),v+=1}else{if(S||GA(I))break;m.push(I),g.push(I),v+=1}}e.push({indent:d,number:p,type:h,content:g.join(`
130
+ 3. "-" cannot repeat`);Ln.customSchemes.push([n,e])}function fA(){Ln.scanner=rA(Ln.customSchemes);for(let n=0;n<Ln.tokenQueue.length;n++)Ln.tokenQueue[n][1]({scanner:Ln.scanner});Ln.parser=aA(Ln.scanner.tokens);for(let n=0;n<Ln.pluginQueue.length;n++)Ln.pluginQueue[n][1]({scanner:Ln.scanner,parser:Ln.parser});return Ln.initialized=!0,Ln}function $h(n){return Ln.initialized||fA(),lA(Ln.parser.start,n,zy(Ln.scanner.start,n))}$h.scan=zy;function Hy(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Dh(t),s=$h(n),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const Bh="[\0-   ᠎ -\u2029  ]",hA=new RegExp(Bh),pA=new RegExp(`${Bh}$`),gA=new RegExp(Bh,"g");function mA(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function vA(n){return new kn({key:new Dn("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=cy(t.doc,[...e]);if(Fu(a).forEach(({newRange:c})=>{const u=D2(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!pA.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(hA).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=d.pos+f.lastIndexOf(p);if(!p)return!1;const v=$h(p).map(m=>m.toObject(n.defaultProtocol));if(!mA(v))return!1;v.filter(m=>m.isLink).map(m=>({...m,from:g+m.start+1,to:g+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>n.validate(m.value)).filter(m=>n.shouldAutoLink(m.value)).forEach(m=>{Th(m.from,m.to,r.doc).some(S=>S.mark.type===n.type)||o.addMark(m.from,m.to,n.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function bA(n){return new kn({key:new Dn("handleClickLink"),props:{handleClick:(e,t,r)=>{if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const c=r.target;if(!c)return!1;const u=n.editor.view.dom;s=c.closest("a"),s&&!u.contains(s)&&(s=null)}if(!s)return!1;let i=!1;if(n.enableClickSelection&&(i=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){var o,a;const c=hy(e.state,n.type.name),u=(o=s.href)!==null&&o!==void 0?o:c.href,d=(a=s.target)!==null&&a!==void 0?a:c.target;u&&(window.open(u,d),i=!0)}return i}}})}const yA=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,wA=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Uy(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function xA(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&Uy(n,r)){r+=1;continue}let s=0;for(;r<e&&n[r]==="`";)s+=1,r+=1;t===0?t=s:s===t&&(t=0)}return t>0}function Vy(n,e,t){var r,s;const[,i,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||Uy(n,(r=e.index)!==null&&r!==void 0?r:0)||xA(n,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&t(o)}function Wy(n){var e,t;const[r,s,i,,o,a,c]=n,u=(e=o??a)!==null&&e!==void 0?e:c;return{index:(t=n.index)!==null&&t!==void 0?t:0,text:r,replaceWith:s,data:{href:i,title:u||null,markdown:!0}}}function kA(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function Ky(n){var e,t,r;return{href:(e=n.data)===null||e===void 0?void 0:e.href,title:(t=(r=n.data)===null||r===void 0?void 0:r.title)!==null&&t!==void 0?t:null}}function _A(n){const e=ia({find:t=>{const r=yA.exec(t);return!r||!Vy(t,r,n.isAllowedHref)?null:Wy(r)},type:n.type,getAttributes:Ky});return new tc({find:e.find,handler:t=>{const r=e.handler(t);return r!==null&&t.state.tr.steps.length&&t.state.tr.setMeta("preventAutolink",!0),r}})}function SA(n){const e=_o({find:t=>{var r,s;const i=[];for(const a of t.matchAll(wA))Vy(t,a,n.isAllowedHref)&&i.push(Wy(a));const o=((r=(s=n.findPlainUrls)===null||s===void 0?void 0:s.call(n,t))!==null&&r!==void 0?r:[]).filter(a=>!i.some(c=>kA(c,a)));return[...i,...o]},type:n.type,getAttributes:Ky});return new My({find:e.find,handler:t=>{var r;const s=e.handler(t);return s!==null&&t.state.tr.steps.length&&(!((r=t.match.data)===null||r===void 0)&&r.markdown)&&t.state.tr.setMeta("preventAutolink",!0),s}})}function CA(n){return new kn({key:new Dn("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let c="";r.content.forEach(d=>{c+=d.textContent});const u=Hy(c,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===c);return!c||!u||s!==void 0&&!s(u.value)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function Ii(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(gA,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const jy=la.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Xg(n);return}Xg(n.scheme,n.optionalSlashes)})},onDestroy(){dA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Ii(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var n,e,t;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(n=this.options.HTMLAttributes.target)!==null&&n!==void 0?n:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(t=this.options.HTMLAttributes.class)!==null&&t!==void 0?t:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Ii(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Ii(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",pn(this.options.HTMLAttributes,n),0]:["a",pn(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,s,i;const o=(t=(r=n.attrs)===null||r===void 0?void 0:r.href)!==null&&t!==void 0?t:"",a=(s=(i=n.attrs)===null||i===void 0?void 0:i.title)!==null&&s!==void 0?s:"",c=e.renderChildren(n);return a?`[${c}](${o} "${a}")`:`[${c}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Ii(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Ii(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[_A({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!Ii(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const n=e=>{const t=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;Hy(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Ii(o,r),protocols:r,defaultProtocol:s})).forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t};return this.options.markdownLinks?[SA({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!Ii(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:n})]:[_o({find:n,type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(vA({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Ii(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(bA({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(CA({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}});var MA=jy;const TA="listItem",Yg="textStyle",Qg=/^\s*([-+*])\s$/,Gy=pr.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
131
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(TA,this.editor.getAttributes(Yg)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ka({find:Qg,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ka({find:Qg,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Yg),editor:this.editor})),[n]}}),EA=(n,e,t)=>{const{selection:r}=n;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let p=s.depth;p>0;p-=1)if(s.node(p).type.name===e){i=p;break}if(i<0)return null;const o=s.node(i),a=s.index(i);if(a+1>=o.childCount)return null;const c=o.child(a+1);if(!t.includes(c.type.name))return null;const u=n.schema.nodes[e];let d=!1;if(c.forEach(p=>{p.type===u&&p.childCount>1&&(d=!0)}),!d)return null;const f=n.doc.resolve(s.after()).nodeAfter;if(!f||!t.includes(f.type.name))return null;const h=[];return f.forEach(p=>{h.push(p)}),h.length===0?null:{listItemDepth:i,nestedList:f,nestedListPos:s.after(),insertPos:s.after(i),items:h}},AA=(n,e,t,r)=>{const s=EA(n,t,r);if(!s)return!1;const{selection:i}=n,{nestedList:o,nestedListPos:a,insertPos:c,items:u}=s,d=n.tr;d.delete(a,a+o.nodeSize);const f=d.mapping.map(c);return d.insert(f,_e.from(u)),d.setSelection(i.map(d.doc,d.mapping)),e&&e(d),!0},RA=(n,e,t)=>AA(n.state,n.view.dispatch,e,t),qy=(n,e)=>zn.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>RA(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),Jy=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],bc="abcdefghijklmnopqrstuvwxyz",Xy=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function Wu(n){let e=n,t="";for(const[r,s]of Jy)for(;e>=r;)t+=s,e-=r;return t}function zh(n){return Wu(n).toUpperCase()}function Yy(n){const e=n.toLowerCase();let t=0,r=0;for(;t<e.length;){let s=!1;for(const[i,o]of Jy)if(e.startsWith(o,t)){r+=i,t+=o.length,s=!0;break}if(!s)return 0}return r}function PA(n){if(!/^[ivxlcdmIVXLCDM]+$/.test(n))return!1;const e=Yy(n);return e<=0?!1:(n===n.toLowerCase()?Wu(e):zh(e))===n}function IA(n){const e=n.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const t=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(t+1)*26+r+1}return 0}function Mu(n){if(n<=26)return bc[n-1];const e=Math.floor((n-1)/26)-1,t=(n-1)%26;return e<0?bc[t]:bc[e]+bc[t]}function Ku(n){if(!(!n||/^\d+$/.test(n))){if(PA(n))return n===n.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(n))return"a";if(/^[A-Z]{1,2}$/.test(n))return"A"}}function Fh(n){if(/^\d+$/.test(n))return parseInt(n,10);const e=Ku(n);if(e==="i"||e==="I")return Yy(n);if(e==="a"||e==="A"){const r=IA(n);return r>0?r:1}const t=parseInt(n,10);return Number.isNaN(t)?1:t}function LA(n,e){if(n==="numeric")return String(e);switch(n){case"a":return Mu(e);case"A":return Mu(e).toUpperCase();case"i":return Wu(e);case"I":return zh(e);default:return String(e)}}function OA(n){var e;if(n.length===0)return!1;const t=(e=Ku(n[0]))!==null&&e!==void 0?e:"numeric",r=Fh(n[0]);if(r<1)return!1;for(let s=0;s<n.length;s++){const i=LA(t,r+s);if(n[s]!==i)return!1}return!0}function NA(n){return{type:Ku(n),start:Fh(n)}}function DA(n){const{type:e,start:t}=NA(n),r={};return e&&(r.type=e),t!==1&&(r.start=t),r}function $A(n,e,t=". "){const r=e+1;if(!n||n==="1")return`${r}${t}`;switch(n){case"a":return`${Mu(r)}${t}`;case"A":return`${Mu(r).toUpperCase()}${t}`;case"i":return`${Wu(r)}${t}`;case"I":return`${zh(r)}${t}`;default:return`${r}${t}`}}function BA(n){var e,t;const r=(e=n.tokens)===null||e===void 0?void 0:e[0];return!!(n.text&&((t=n.tokens)===null||t===void 0?void 0:t.length)===1&&r?.type==="list"&&r.ordered&&r.raw===n.text)}function zA(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}const Qy=pr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;let s=[];if(n.tokens&&n.tokens.length>0){if(BA(n))return{type:"listItem",content:[{type:"paragraph",content:zA(n.text||"",e)}]};if(n.tokens.some(i=>i.type==="paragraph"))s=r(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const o=r(n.tokens.slice(1));s.push(...o)}}else s=r(n.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(n,e,t)=>_y(n,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var s,i;const o=((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.start)||1;return $A((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.type,o-1+(r.index||0),". ")}return"- "},t,{alignNestedToPrefix:t?.parentType==="orderedList"}),addExtensions(){return[qy(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Hh=(n,e)=>{const{$from:t}=e.selection,r=xr(n,e.schema);let s=null,i=t.depth,o=t.pos,a=null;for(;i>0&&a===null;)s=t.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Zy=(n,e)=>{const t=Hh(n,e);if(!t)return!1;const[,r]=G2(e,n,t.$pos.pos+4);return r},FA=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),i=n.doc.resolve(s).node();return!(!i||!t.includes(i.type.name))},Zg=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Ui(n.state,e)&&FA(n.state,e,t)){const{$anchor:i}=n.state.selection,o=n.state.doc.resolve(i.before()-1),a=[];o.node().descendants((d,f)=>{d.type.name===e&&a.push({node:d,pos:f})});const c=a.at(-1);if(!c)return!1;const u=n.state.doc.resolve(o.start()+c.pos+1);return n.chain().cut({from:i.start()-1,to:i.end()+1},u.end()).joinForward().run()}if(!Ui(n.state,e)||!Q2(n.state))return!1;const{$from:r}=n.state.selection,s=r.depth-1;return r.node(s).type!==n.schema.nodes[e]||r.index(s)!==0?!1:n.chain().liftListItem(e).run()},HA=(n,e)=>{const t=Zy(n,e),r=Hh(n,e);return!r||!t?!1:t>r.depth},UA=(n,e)=>{const t=Zy(n,e),r=Hh(n,e);return!r||!t?!1:t<r.depth},em=(n,e)=>{if(!Ui(n.state,e)||!Y2(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:HA(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():UA(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},VA=(n,e,t)=>{const{state:r}=n,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0||!i.parent.isTextblock||Ui(r,e))return!1;const o=q2(i);if(!o||!t.includes(o.type.name))return!1;const a=o.lastChild;if(!a||a.type.name!==e)return!1;const c=i.parent;if(!a.canReplace(a.childCount,a.childCount,_e.from(c)))return!1;const u=i.before(),d=i.after(),f=u-2;return n.commands.command(({tr:h,dispatch:p})=>(p&&(h.delete(u,d).insert(f,_e.from(c)),h.setSelection(et.create(h.doc,f+1)),h.scrollIntoView()),!0))},e0=zn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&em(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&em(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Zg(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Zg(n,t,r)&&(e=!0)}),e},Tab:({editor:n})=>{for(const{itemName:e,wrapperNames:t}of this.options.listTypes)if(n.state.schema.nodes[e]!==void 0&&VA(n,e,t))return!0;return!1}}}}),Af=new RegExp(`^(\\s*)(${Xy})([.)])\\s+(.*)$`),WA=/^\s/,Ia={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function KA(n){return Af.test(n.trimStart())}function jA(n){const e=n.trimStart();return Ia.bulletItem.test(e)||KA(e)||Ia.heading.test(e)||Ia.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Ia.codeFence.test(e)||Ia.blockMath.test(e)}function GA(n){return Object.values(Ia).some(e=>e.test(n))}function qA(n){const e=[],t=[];let r=!1;return n.forEach(s=>{if(r){t.push(s);return}if(s.trim()===""){r=!0,t.push(s);return}if(e.length>0&&jA(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function JA(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],i=s.match(Af);if(!i)break;const[,o,a,c,u]=i,d=o.length,f=parseInt(a,10),h=isNaN(f)?Ku(a):void 0,p=isNaN(f)?Fh(a):f,g=[u];let v=t+1;const m=[s];let S=!1;for(;v<n.length;){const I=n[v];if(I.match(Af))break;if(I.trim()==="")m.push(I),g.push(""),S=!0,v+=1;else if(I.match(WA)){const C=I.length-I.trimStart().length,M=d+a.length+1;m.push(I),g.push(I.slice(Math.min(C,M))),v+=1}else{if(S||GA(I))break;m.push(I),g.push(I),v+=1}}e.push({indent:d,number:p,type:h,content:g.join(`
132
132
  `).trim(),contentLines:g,raw:m.join(`
133
- `)}),r=v,t=v}return[e,r]}const XA=new RegExp(`^(${Xy})([.)])\\s+(.+)$`);function QA(n){const e=n.split(`
133
+ `)}),r=v,t=v}return[e,r]}const XA=new RegExp(`^(${Xy})([.)])\\s+(.+)$`);function YA(n){const e=n.split(`
134
134
  `).filter(r=>r.trim().length>0);if(e.length===0)return null;const t=[];for(const r of e){const s=r.trim().match(XA);if(!s)return null;t.push({marker:s[1],content:s[3]})}return OA(t.map(r=>r.marker))?{type:"orderedList",attrs:DA(t[0].marker),content:t.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function t0(n,e,t){const r=[];let s=0;for(;s<n.length;){const i=n[s];if(i.indent===e){const{paragraphLines:o,blockLines:a}=qA(i.contentLines),c=o.join(`
135
135
  `).trim(),u=[];c&&u.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const d=a.join(`
136
136
  `).trim();if(d){const p=t.blockTokens(d);u.push(...p)}let f=s+1;const h=[];for(;f<n.length&&n[f].indent>e;)h.push(n[f]),f+=1;if(h.length>0){const p=t0(h,Math.min(...h.map(g=>g.indent)),t);u.push({type:"list",ordered:!0,start:h[0].number,typeMarker:h[0].type,items:p,raw:h.map(g=>g.raw).join(`
137
- `)})}r.push({type:"list_item",raw:i.raw,tokens:u}),s=f}else s+=1}return r}function YA(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}const ZA="listItem",tm="textStyle",nm=/^(\d+)\.\s$/;function rm(n){const e=n.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const n0=pr.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>{const e=n.getAttribute("type");if(e)return e;const t=n.getAttribute("style");if(t){const s=rm(t);if(s)return s}const r=n.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=rm(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,type:t,...r}=n,s=pn(this.options.HTMLAttributes,r);return e!==1&&(s.start=e),t&&t!=="1"&&(s.type=t),["ol",s,0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.typeMarker,s=n.items?YA(n.items,e):[],i={};return t!==1&&(i.start=t),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:s}:{type:"orderedList",content:s}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
137
+ `)})}r.push({type:"list_item",raw:i.raw,tokens:u}),s=f}else s+=1}return r}function QA(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}const ZA="listItem",tm="textStyle",nm=/^(\d+)\.\s$/;function rm(n){const e=n.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const n0=pr.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>{const e=n.getAttribute("type");if(e)return e;const t=n.getAttribute("style");if(t){const s=rm(t);if(s)return s}const r=n.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=rm(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,type:t,...r}=n,s=pn(this.options.HTMLAttributes,r);return e!==1&&(s.start=e),t&&t!=="1"&&(s.type=t),["ol",s,0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.typeMarker,s=n.items?QA(n.items,e):[],i={};return t!==1&&(i.start=t),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:s}:{type:"orderedList",content:s}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
138
138
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(n,e,t)=>{var r,s;const i=n.split(`
139
139
  `),[o,a]=JA(i);if(o.length===0)return;const c=t0(o,o[0].indent,t);if(c.length!==0)return{type:"list",ordered:!0,start:((r=o[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(s=o[0])===null||s===void 0?void 0:s.type,items:c,raw:i.slice(0,a).join(`
140
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ZA,this.editor.getAttributes(tm)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new kn({props:{handlePaste:(n,e)=>{var t,r;const s=(t=e.clipboardData)===null||t===void 0?void 0:t.getData("text/html");if(s?.trim())return!1;const i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;const o=QA(i);if(!o)return!1;try{const a=n.state.schema.nodeFromJSON(o),c=n.state.tr.replaceSelectionWith(a);return n.dispatch(c),!0}catch{return!1}}}})]},addInputRules(){const n=(t,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+t[1];let e=Ka({find:nm,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:n});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ka({find:nm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(tm)}),joinPredicate:n,editor:this.editor})),[e]}}),eR=/^\s*(\[([( |x])?\])\s$/,tR="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",nR=(n,e,t)=>{var r;return(t==null||(r=t.checkboxLabel)===null||r===void 0?void 0:r.call(t,n,e))||`Task item checkbox for ${n.textContent||"empty task item"}`},rR=pr.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:n=>{var e;return(e=n.querySelector("div"))!==null&&e!==void 0?e:n}}]},renderHTML({node:n,HTMLAttributes:e}){return["li",pn(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${!((t=n.attrs)===null||t===void 0)&&t.checked?"x":" "}] `;return _y(n,e,r)},addExtensions(){return this.options.nested?[qy(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div");o.style.cssText=tR;const u=f=>{const h=nR(f,f.attrs.checked,this.options.a11y);a.setAttribute("aria-label",h),o.textContent=h};u(n),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=f.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const g=t();if(typeof g!="number")return!1;const v=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...v?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{s.setAttribute(f,h)}),s.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,i.append(a,o),s.append(i,c),Object.entries(e).forEach(([f,h])=>{s.setAttribute(f,h)});let d=new Set(Object.keys(e));return{dom:s,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;s.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(f);const h=r.extensionManager.attributes,p=sa(f,h),g=new Set(Object.keys(p)),v=this.options.HTMLAttributes;return d.forEach(m=>{g.has(m)||(m in v?s.setAttribute(m,v[m]):s.removeAttribute(m))}),Object.entries(p).forEach(([m,S])=>{S==null?m in v?s.setAttribute(m,v[m]):s.removeAttribute(m):s.setAttribute(m,S)}),d=g,!0}}}},addInputRules(){return[Ka({find:eR,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),sR=pr.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",pn(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
141
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=i=>{const o=Hg(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,c)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:c}),customNestedParser:r},t);if(o){const a={type:"taskList",raw:o.raw,items:o.items},c=i.slice(o.raw.length);return c.trim()?[a,...t.blockTokens(c)]:[a]}return t.blockTokens(i)},s=Hg(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});zn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Gy.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Yy.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(e0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(n0.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(rR.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(sR.configure(this.options.taskList)),n}});const yc="&nbsp;",Ld=" ",iR=pr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",pn(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===yc||t[0].text===yc||t[0].raw===Ld||t[0].text===Ld)&&r.length===1&&r[0].type==="text"&&(r[0].text===yc||r[0].text===Ld)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{if(!n)return"";const r=Array.isArray(n.content)?n.content:[];if(r.length===0){var s,i;const o=Array.isArray(t==null||(s=t.previousNode)===null||s===void 0?void 0:s.content)?t.previousNode.content:[];return(t==null||(i=t.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&o.length===0?yc:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),oR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lR=la.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ia({find:oR,type:this.type})]},addPasteRules(){return[_o({find:aR,type:this.type})]}}),cR=pr.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),uR=la.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",pn(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!r)return;const s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function dR(n={}){return new kn({view(e){return new fR(e,n)}})}class fR{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let g=p.getBoundingClientRect(),v=f?g.bottom:g.top;f&&h&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*a;r={left:g.left,right:g.right,top:v-m,bottom:v+m}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,d;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=c.getBoundingClientRect(),h=f.width/c.offsetWidth,p=f.height/c.offsetHeight;u=f.left-c.scrollLeft*h,d=f.top-c.scrollTop*p}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(!t||i)return null;let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=qv(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Jn extends jt{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Jn.valid(r)?new Jn(r):jt.near(r)}content(){return He.empty}eq(e){return e instanceof Jn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Jn(e.resolve(t.pos))}getBookmark(){return new Uh(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!hR(e)||!pR(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Jn.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let c=e.doc.resolve(s);if(Jn.valid(c))return c}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!vt.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let a=e.doc.resolve(s);if(Jn.valid(a))return a}return null}}}Jn.prototype.visible=!1;Jn.findFrom=Jn.findGapCursorFrom;jt.jsonID("gapcursor",Jn);class Uh{constructor(e){this.pos=e}map(e){return new Uh(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Jn.valid(t)?new Jn(t):jt.near(t)}}function r0(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function hR(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||r0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function pR(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||r0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function gR(){return new kn({props:{decorations:yR,createSelectionBetween(n,e,t){return e.pos==t.pos&&Jn.valid(t)?new Jn(t):null},handleClick:vR,handleKeyDown:mR,handleDOMEvents:{beforeinput:bR}}})}const mR=Yb({ArrowLeft:wc("horiz",-1),ArrowRight:wc("horiz",1),ArrowUp:wc("vert",-1),ArrowDown:wc("vert",1)});function wc(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,c=o.empty;if(o instanceof et){if(!i.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=Jn.findGapCursorFrom(a,e,c);return u?(s&&s(r.tr.setSelection(new Jn(u))),!0):!1}}function vR(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Jn.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&vt.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Jn(r))),!0)}function bR(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Jn))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=_e.empty;for(let o=r.length-1;o>=0;o--)s=_e.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new He(s,0,0));return i.setSelection(et.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function yR(n){if(!(n.selection instanceof Jn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Yt.create(n.doc,[Rr.widget(n.selection.head,e,{key:"gapcursor"})])}var Tu=200,Ir=function(){};Ir.prototype.append=function(e){return e.length?(e=Ir.from(e),!this.length&&e||e.length<Tu&&this.leafAppend(e)||this.length<Tu&&e.leafPrepend(this)||this.appendInner(e)):this};Ir.prototype.prepend=function(e){return e.length?Ir.from(e).append(this):this};Ir.prototype.appendInner=function(e){return new wR(this,e)};Ir.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ir.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Ir.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ir.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};Ir.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};Ir.from=function(e){return e instanceof Ir?e:e&&e.length?new s0(e):Ir.empty};var s0=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var c=i;c<o;c++)if(s(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var c=i-1;c>=o;c--)if(s(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Tu)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Tu)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ir);Ir.empty=new s0([]);var wR=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ir);const xR=500;class oi{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,c,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,d.push(f);return}if(s){d.push(new yi(f.map));let p=f.step.map(s.slice(i)),g;p&&o.maybeStep(p).doc&&(g=o.mapping.maps[o.mapping.maps.length-1],u.push(new yi(g,void 0,void 0,u.length+d.length))),i--,g&&s.appendMap(g,i)}else o.maybeStep(f.step);if(f.selection)return a=s?f.selection.map(s.slice(i)):f.selection,c=new oi(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:a}}addTransform(e,t,r,s){let i=[],o=this.eventCount,a=this.items,c=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new yi(e.mapping.maps[d],f,t),p;(p=c&&c.merge(h))&&(h=p,d?i.pop():a=a.slice(0,a.length-1)),i.push(h),t&&(o++,t=void 0),s||(c=h)}let u=o-r.depth;return u>_R&&(a=kR(a,u),o-=u),new oi(a.append(i),o)}remapping(e,t){let r=new Nl;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new oi(this.items.append(e.map(t=>new yi(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;t=Math.min(this.items.length,t);let r=[],s=this.items.length-t,i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let c=t;this.items.forEach(h=>{let p=i.getMirror(--c);if(p==null)return;o=Math.min(o,p);let g=i.maps[p];if(h.step){let v=e.steps[p].invert(e.docs[p]),m=h.selection&&h.selection.map(i.slice(c+1,p));m&&a++,r.push(new yi(g,v,m))}else r.push(new yi(g))},s);let u=[];for(let h=t;h<o;h++)u.push(new yi(i.maps[h]));let d=this.items.slice(0,s).append(u).append(r),f=new oi(d,a);return f.emptyItemCount()>xR&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let c=o.step.map(t.slice(r)),u=c&&c.getMap();if(r--,u&&t.appendMap(u,r),c){let d=o.selection&&o.selection.map(t.slice(r));d&&i++;let f=new yi(u.invert(),c,d),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else o.map&&r--},this.items.length,0),new oi(Ir.from(s.reverse()),i)}}oi.empty=new oi(Ir.empty,0);function kR(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class yi{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new yi(t.getMap().invert(),t,this.selection)}}}class lo{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const _R=20;function SR(n,e,t,r){let s=t.getMeta(Zo),i;if(s)return s.historyState;t.getMeta(TR)&&(n=new lo(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Zo))return o.getMeta(Zo).redo?new lo(n.done.addTransform(t,void 0,r,Lc(e)),n.undone,sm(t.mapping.maps),n.prevTime,n.prevComposition):new lo(n.done,n.undone.addTransform(t,void 0,r,Lc(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!CR(t,n.prevRanges)),u=o?Od(n.prevRanges,t.mapping):sm(t.mapping.maps);return new lo(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Lc(e)),oi.empty,u,t.time,a??n.prevComposition)}else return(i=t.getMeta("rebased"))?new lo(n.done.rebased(t,i),n.undone.rebased(t,i),Od(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new lo(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Od(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function CR(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function sm(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function Od(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function MR(n,e,t){let r=Lc(e),s=Zo.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),c=new lo(t?a:i.remaining,t?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(Zo,{redo:t,historyState:c})}let Nd=!1,im=null;function Lc(n){let e=n.plugins;if(im!=e){Nd=!1,im=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Nd=!0;break}}return Nd}const Zo=new Dn("history"),TR=new Dn("closeHistory");function ER(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new kn({key:Zo,state:{init(){return new lo(oi.empty,oi.empty,null,0,-1)},apply(e,t,r){return SR(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?o0:r=="historyRedo"?a0:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function i0(n,e){return(t,r)=>{let s=Zo.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=MR(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const o0=i0(!1,!0),a0=i0(!0,!0);zn.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new kn({key:new Dn("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const a=o-s,c=0,u=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,u);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,a=o-(i-r),c=o;return e.deleteRange(a,c),!(this.storage.characters({node:e.doc})>r)}})]}});const AR=zn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[dR(this.options)]}});zn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new kn({key:new Dn("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return Yt.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((c,u)=>{if(!c.isText){if(!(s>=u&&s<=u+c.nodeSize-1))return!1;o+=1}});let a=0;return n.descendants((c,u)=>{if(c.isText||!(s>=u&&s<=u+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Rr.node(u,u+c.nodeSize,{class:this.options.className}))}),Yt.create(n,i)}}})]}});const RR=zn.create({name:"gapCursor",addProseMirrorPlugins(){return[gR()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=hn(ct(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),l0="placeholder",om=new Dn("tiptap__placeholder");function c0(n){const{editor:e,placeholder:t,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:c,emptyEditor:u}}=n,d=[c];return o&&d.push(u),Rr.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:a}):t})}function u0(n,e){return typeof n=="function"?n(e):n}function d0({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:i,to:o}){const{anchor:a}=s,c=[],u=n.isEmpty;return r.nodesBetween(i,o,(d,f)=>{const h=a>=f&&a<=f+d.nodeSize,p=!d.isLeaf&&ec(d);return d.type.isTextblock&&(h||!e.showOnlyCurrent)&&p&&c.push(c0({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:u0(e.emptyNodeClass,{editor:n,node:d,pos:f,hasAnchor:h})},node:d,pos:f})),e.includeChildren}),c}function f0({editor:n,options:e,dataAttribute:t,doc:r,selection:s}){if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:i}=s,o=[],a=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const c=r.resolve(i),u=c.depth>0?c.node(1):c.nodeAfter,d=c.depth>0?c.before(1):i;if(u&&u.type.isTextblock&&ec(u)){const f=i>=d&&i<=d+u.nodeSize;o.push(c0({editor:n,isEmptyDoc:a,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:u0(e.emptyNodeClass,{editor:n,node:u,pos:d,hasAnchor:f})},node:u,pos:d}))}}else o.push(...d0({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:0,to:r.content.size}));return Yt.create(r,o)}function Al(n,e){const t=n.resolve(e);if(t.depth===0){var r;const i=(r=t.nodeAfter)!==null&&r!==void 0?r:t.nodeBefore;if(!i)return{from:e,to:e};const o=t.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}const s=t.before(1);return{from:s,to:s+t.node(1).nodeSize}}function Rl(n,e){return{from:Math.max(0,e.from-1),to:Math.min(n.content.size,e.to-1)}}function PR(n,e,t){const r=[];return n.forEach((s,i)=>{const o=i,a=o+s.nodeSize,c=o+1,u=a+1;c<t&&u>e&&r.push({from:o,to:a})}),r}function IR(n){if(n.length===0)return[];const e=[...n].sort((r,s)=>r.from-s.from),t=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=t[t.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):t.push({...i})}return t}function LR(n,e){const t=PR(n,e.from,e.to);return t.push(Rl(n,Al(n,e.from))),e.to>e.from?t.push(Rl(n,Al(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(Rl(n,Al(n,Math.min(e.from+1,n.content.size)))),t}function OR(n,e,t){const r=[];if(n.docChanged){const s=Fu(n);for(const i of s)r.push(...LR(t.doc,i.newRange))}return n.selectionSet&&(r.push(Rl(t.doc,Al(t.doc,n.mapping.map(e.selection.anchor)))),r.push(Rl(t.doc,Al(t.doc,t.selection.anchor)))),IR(r)}function NR(n,e,t){const r=Math.max(0,Math.min(n,t.content.size));return{from:r,to:Math.max(r,Math.min(e,t.content.size))}}function DR({decorations:n,ranges:e,editor:t,options:r,dataAttribute:s,doc:i,selection:o}){let a=n;for(const c of e){const{from:u,to:d}=NR(c.from,c.to,i),f=a.find(u,d).filter(p=>p.from>=u&&p.to<=d);f.length&&(a=a.remove(f));const h=d0({editor:t,options:r,dataAttribute:s,doc:i,selection:o,from:u,to:d});h.length&&(a=a.add(i,h))}return a}function $R({editor:n,options:e,dataAttribute:t}){return{init(r,s){const i=f0({editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection});return i??Yt.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:DR({decorations:s.map(r.mapping,r.doc),ranges:OR(r,i,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function BR(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function zR({editor:n,options:e}){const t=e.dataAttribute?`data-${BR(e.dataAttribute)}`:`data-${l0}`,r=e.showOnlyCurrent&&!e.includeChildren;return new kn({key:om,...r?{}:{state:$R({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:s,selection:i})=>f0({editor:n,options:e,dataAttribute:t,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?Yt.empty:(i=om.getState(s))!==null&&i!==void 0?i:Yt.empty}}})}const FR=zn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:l0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[zR({editor:this.editor,options:this.options})]}});function Rf(n,e){return!n.selection.empty&&!py(n.selection)&&e.isEditable}function HR(n,e){return Rf(n,e)&&!e.isFocused&&!e.view.dragging}function UR(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function VR(n){n.focus()}zn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new kn({key:new Dn("selection"),props:{decorations(t){return HR(t,n)?Yt.create(t.doc,[Rr.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return Rf(t.state,n)&&UR(),!1},focus(t){return Rf(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&VR(t)}),!1}}}})]}});function am({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const WR=zn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Dn(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)===null||n===void 0?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new kn({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:c,schema:u}=o,d=e.getState(o),f=a.content.size,h=u.nodes[t];if(!s.some(p=>p.getMeta("skipTrailingNode"))&&d)return c.insert(f,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!am({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!am({node:o,types:r})}}})]}}),KR=zn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>o0(n,e),redo:()=>({state:n,dispatch:e})=>a0(n,e)}},addProseMirrorPlugins(){return[ER(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),jR=zn.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(LE.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(EE.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(Gy.configure(this.options.bulletList)),this.options.code!==!1&&n.push(DE.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(zE.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(FE.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(AR.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(RR.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(HE.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(UE.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(KR.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(VE.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(qE.configure(this.options.italic)),this.options.listItem!==!1&&n.push(Yy.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push(e0.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(jy.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(n0.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(iR.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(lR.configure(this.options.strike)),this.options.text!==!1&&n.push(cR.configure(this.options.text)),this.options.underline!==!1){var r;n.push(uR.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;n.push(WR.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return n}});var GR=jR,qR=FR;function JR(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:a}=n,c=r&&!s,u=HT(t),d=new RegExp(`\\s${u}$`),f=o?"^":"",h=s?"":u,p=c?new RegExp(`${f}${u}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${h}]*`,"gm"),g=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!g)return null;const v=a.pos-g.length,m=Array.from(g.matchAll(p)).pop();if(!m||m.input===void 0||m.index===void 0)return null;const S=m.input.slice(Math.max(0,m.index-1),m.index),I=new RegExp(`^[${i?.join("")}\0]?$`).test(S);if(i!==null&&!I)return null;const C=v+m.index;let M=C+m[0].length;return c&&d.test(g.slice(M-1,M+1))&&(m[0]+=" ",M+=1),C<a.pos&&M>=a.pos?{range:{from:C,to:M},query:m[0].slice(t.length),text:m[0]}:null}function XR(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const r=t.content.textBetween(0,t.content.size,`
142
- `);return/\s/.test(r)}):!1}function QR(n){return()=>{const e=n.state.selection.$anchor.pos,{top:t,right:r,bottom:s,left:i}=n.view.coordsAtPos(e);try{return new DOMRect(i,t,r-i,s-t)}catch{return null}}}function YR(n,e,t,r){return t?()=>{const s=r.getState(n.state),i=s?.decorationId,o=e.dom.querySelector(`[data-decoration-id="${i}"]`);return o?.getBoundingClientRect()||null}:QR(n)}function ZR({match:n,dismissedRange:e,state:t,transaction:r,editor:s,shouldResetDismissed:i,effectiveAllowSpaces:o}){return i?.({editor:s,state:t,range:e,match:n,transaction:r,allowSpaces:o})?!1:o?n.range.from===e.from:n.range.from===e.from&&!XR(r)}function eP({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function tP({pluginKey:n,decorationTag:e,decorationClass:t,decorationContent:r,decorationEmptyClass:s,renderer:i,dispatchExit:o}){return{handleKeyDown(a,c){var u;const d=n.getState(a.state);if(!d.active)return!1;if(c.key==="Escape"||c.key==="Esc"){var f;return i==null||(f=i.onKeyDown)===null||f===void 0||f.call(i,{view:a,event:c,range:d.range}),o(a),!0}return(i==null||(u=i.onKeyDown)===null||u===void 0?void 0:u.call(i,{view:a,event:c,range:d.range}))||!1},decorations(a){const{active:c,range:u,decorationId:d,query:f}=n.getState(a);if(!c)return null;const h=!f?.length,p=[t];return h&&p.push(s),Yt.create(a.doc,[Rr.inline(u.from,u.to,{nodeName:e,class:p.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":r})])}}}function nP({editor:n,char:e,effectiveAllowSpaces:t,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,findSuggestionMatch:o,allow:a,shouldShow:c,shouldKeepDismissed:u,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(f,h,p,g){const{isEditable:v}=n,{composing:m}=n.view,{selection:S}=f,{empty:I,from:C}=S,M={...h},O=f.getMeta(d);if(O&&O.exit)return M.active=!1,M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null,M.dismissedRange=h.active?{...h.range}:h.dismissedRange,M;if(M.composing=m,f.docChanged&&M.dismissedRange!==null&&(M.dismissedRange={from:f.mapping.map(M.dismissedRange.from),to:f.mapping.map(M.dismissedRange.to)}),v&&(I||n.view.composing)){(C<h.range.from||C>h.range.to)&&!m&&!h.composing&&(M.active=!1);const P=o({char:e,allowSpaces:t,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:S.$from}),E=`id_${Math.floor(Math.random()*4294967295)}`;P&&a({editor:n,state:g,range:P.range,isActive:h.active})&&(!c||c({editor:n,range:P.range,query:P.query,text:P.text,transaction:f}))?(M.dismissedRange!==null&&!u({match:P,dismissedRange:M.dismissedRange,state:g,transaction:f})&&(M.dismissedRange=null),M.dismissedRange===null?(M.active=!0,M.decorationId=h.decorationId||E,M.range=P.range,M.query=P.query,M.text=P.text):M.active=!1):(P||(M.dismissedRange=null),M.active=!1)}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}}}function rP({editor:n,items:e}){let t=null,r=null,s=null;const i=()=>{r!==null&&(clearTimeout(r),r=null),s?.(),s=null},o=u=>new Promise(d=>{s=d,r=setTimeout(()=>{r=null;const f=s;s=null,f?.()},u)}),a=()=>{t?.abort(),i(),t=null};return{abort:a,fetch:async(u,d)=>{a(),t=new AbortController;const f=t;if(d>0&&await o(d),t!==f||f.signal.aborted)return{status:"aborted"};try{const h=await e({editor:n,query:u,signal:f.signal});return t!==f||f.signal.aborted?{status:"aborted"}:{status:"resolved",items:h}}catch{return t!==f||f.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function sP({placement:n,offset:e,flip:t,floatingUi:r}){var s,i,o,a;const c=[Z1({mainAxis:(s=e.mainAxis)!==null&&s!==void 0?s:4,crossAxis:(i=e.crossAxis)!==null&&i!==void 0?i:0})];return t&&c.push(ex()),!(r==null||(o=r.middleware)===null||o===void 0)&&o.length&&c.push(...r.middleware),{placement:n,strategy:(a=r?.strategy)!==null&&a!==void 0?a:"absolute",middleware:c}}function iP(n){if(n instanceof HTMLElement)return n;if(typeof n=="string")try{const e=document.querySelector(n);if(e)return e}catch{return document.body}return document.body}function oP({getReferenceRect:n,contextElement:e,config:t,container:r,dismissOnOutsideClick:s,dismiss:i}){return(o,a={})=>{const c={getBoundingClientRect:()=>{var g;return(g=n())!==null&&g!==void 0?g:new DOMRect},contextElement:e};let u=!1;const d=!o.isConnected;d&&iP(r).appendChild(o),a.onPosition||(o.style.visibility="hidden",o.style.width="max-content");const h=tx(c,o,()=>{nx(c,o,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:g,y:v,placement:m,strategy:S})=>{if(a.onPosition){a.onPosition({x:g,y:v,placement:m,strategy:S});return}Object.assign(o.style,{position:S,left:`${g}px`,top:`${v}px`}),u||(u=!0,o.style.visibility="")})},a.autoUpdate);let p;return s&&(p=g=>{const v=g.target;!(v instanceof Node)||o.contains(v)||e.contains(v)||i()},document.addEventListener("pointerdown",p,!0)),()=>{h(),p&&document.removeEventListener("pointerdown",p,!0),d&&o.remove()}}}function aP({editor:n,pluginKey:e,items:t,renderer:r,minQueryLength:s,debounce:i,initialItems:o,placement:a,offset:c,container:u,flip:d,floatingUi:f,dismissOnOutsideClick:h,command:p,clientRectFor:g,dispatchExit:v}){let m;const S=rP({editor:n,items:t}),I=sP({placement:a,offset:c,flip:d,floatingUi:f});function C(M,O){switch(M){case"started":var P;r==null||(P=r.onStart)===null||P===void 0||P.call(r,O);break;case"updated":var E;r==null||(E=r.onUpdate)===null||E===void 0||E.call(r,O);break;case"stopped":var z;r==null||(z=r.onExit)===null||z===void 0||z.call(r,O)}}return{update:async(M,O)=>{var P,E;const z=e.getState(O),G=e.getState(M.state);if(!z||!G)return;let J=null;const K=z.query!==G.query,Q=z.text!==G.text,$=z.range.from!==G.range.from||z.range.to!==G.range.to,X=K||Q||$;if(!z.active&&G.active)J="started";else if(z.active&&!G.active)J="stopped";else if(G.active&&X)J="updated";else return;const de=J==="stopped"?z:G,me=M.dom.querySelector(`[data-decoration-id="${de.decorationId}"]`),ie=g(M,me),q=s===0||(de.query?de.query.length>=s:!1),j=(J==="started"||J==="updated")&&q;if(m={editor:n,range:de.range,query:de.query||"",text:de.text||"",items:o??[],command:be=>p({editor:n,range:de.range,props:be}),decorationNode:me,clientRect:ie,loading:j,placement:a,offset:{mainAxis:(P=c.mainAxis)!==null&&P!==void 0?P:4,crossAxis:(E=c.crossAxis)!==null&&E!==void 0?E:0},container:u,flip:d,floatingUi:I,mount:oP({getReferenceRect:ie,contextElement:M.dom,config:I,container:u,dismissOnOutsideClick:h,dismiss:()=>v(n.view)})},J==="started"){var ne;r==null||(ne=r.onBeforeStart)===null||ne===void 0||ne.call(r,m)}if(J==="updated"){var we;r==null||(we=r.onBeforeUpdate)===null||we===void 0||we.call(r,m)}if(J==="started"&&C(J,m),J==="started"||J==="updated")if(!j)S.abort(),m={...m,items:o??[],loading:!1};else{m={...m,items:o??[],loading:!0},J="updated",C(J,m);const be=await S.fetch(de.query||"",i);if(be.status==="aborted")return;const Se=e.getState(M.state);if(!Se?.active){S.abort();return}m=be.status==="resolved"?{...m,items:be.items,loading:!1}:{...m,loading:!1}}if(J==="stopped"){S.abort(),C(J,m),m=void 0;return}J==="updated"&&C(J,m)},destroy:()=>{var M;S.abort(),m&&(r==null||(M=r.onExit)===null||M===void 0||M.call(r,m))}}}const lP=new Dn("suggestion");function cP({pluginKey:n=lP,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:h=()=>[],minQueryLength:p=0,debounce:g=0,initialItems:v,placement:m="bottom-start",offset:S={},container:I,flip:C=!0,floatingUi:M,dismissOnOutsideClick:O=!0,render:P=()=>({}),allow:E=()=>!0,findSuggestionMatch:z=JR,shouldShow:G,shouldResetDismissed:J}){const K=P?.(),Q=r&&!s,$=(me,ie)=>YR(e,me,ie,n);function X(me){return ZR({...me,editor:e,shouldResetDismissed:J,effectiveAllowSpaces:Q})}const de=me=>eP({view:me,pluginKeyRef:n});return new kn({key:n,view:()=>aP({editor:e,pluginKey:n,items:h,renderer:K,minQueryLength:p,debounce:g,initialItems:v,placement:m,offset:S,container:I,flip:C,floatingUi:M,dismissOnOutsideClick:O,command:f,clientRectFor:$,dispatchExit:de}),state:nP({editor:e,char:t,effectiveAllowSpaces:Q,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:z,allow:E,shouldShow:G,shouldKeepDismissed:X,pluginKey:n}),props:tP({pluginKey:n,decorationTag:a,decorationClass:c,decorationContent:u,decorationEmptyClass:d,renderer:K,dispatchExit:de})})}function uP({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){return{editor:n,char:r,pluginKey:new Dn,command:({editor:s,range:i,props:o})=>{var a,c;const u=s.view.state.selection.$to.nodeAfter;!(u==null||(a=u.text)===null||a===void 0)&&a.startsWith(" ")&&(i.to+=1),s.chain().focus().insertContentAt(i,[{type:t,attrs:{...o,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(c=s.view.dom.ownerDocument.defaultView)===null||c===void 0||(c=c.getSelection())===null||c===void 0||c.collapseToEnd()},allow:({state:s,range:i})=>{const o=s.doc.resolve(i.from),a=s.schema.nodes[t];return!!o.parent.type.contentMatch.matchType(a)},...e}}function h0(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>uP({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function lm(n,e){const t=h0(n),r=t.find(s=>s.char===e);return r||(t.length?t[0]:null)}const dP=pr.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,r;return`${(t=e?.char)!==null&&t!==void 0?t:"@"}${(r=n.attrs.label)!==null&&r!==void 0?r:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var r,s;return["span",pn(this.HTMLAttributes,n.HTMLAttributes),`${(r=t?.char)!==null&&r!==void 0?r:"@"}${(s=e.attrs.label)!==null&&s!==void 0?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=lm(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",pn({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=pn({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof s=="string"?["span",pn({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...ZT({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(?:^|\s)(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,i,o]=r;e[s==="char"?"mentionSuggestionChar":s]=i??o,r=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:lm(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:s,anchor:i}=r;if(!s)return!1;let o=new go,a=0;return e.doc.nodesBetween(i-1,i,(c,u)=>{if(c.type.name===this.name)return t=!0,o=c,a=u,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,a,a+o.nodeSize),t})}},addProseMirrorPlugins(){return h0(this).map(cP)}});var fP=dP;const hP=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,pP=pr.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",pn(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,r,s,i,o;const a=(e=(t=n.attrs)===null||t===void 0?void 0:t.src)!==null&&e!==void 0?e:"",c=(r=(s=n.attrs)===null||s===void 0?void 0:s.alt)!==null&&r!==void 0?r:"",u=(i=(o=n.attrs)===null||o===void 0?void 0:o.title)!==null&&i!==void 0?i:"";return u?`![${c}](${a} "${u}")`:`![${c}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:r}=this.options.resize,s=new Set(["src","width","height"]);return({node:i,getPos:o,HTMLAttributes:a,editor:c})=>{const u=document.createElement("img");u.draggable=!1;const d=pn(this.options.HTMLAttributes,a);Object.entries(d).forEach(([S,I])=>{if(I!=null)switch(S){case"src":case"width":case"height":break;default:u.setAttribute(S,I)}}),d.src!==null&&(u.src=d.src);let f={...a};const h=S=>{if(typeof S=="string"&&S!==""){u.getAttribute("src")!==S&&(u.src=S);return}u.hasAttribute("src")&&u.removeAttribute("src"),u.src!==""&&(u.src="")};h(a.src);const p=S=>{if(S.type!==i.type)return!1;const I=c.extensionManager.attributes.filter(M=>M.type===S.type.name),C=sa(S,I);return Object.keys(f).forEach(M=>{!s.has(M)&&!(M in C)&&u.removeAttribute(M)}),Object.entries(C).forEach(([M,O])=>{s.has(M)||(O!=null?u.setAttribute(M,O):u.removeAttribute(M))}),h(C.src),f=C,!0},g=new _E({element:u,editor:c,node:i,getPos:o,onResize:(S,I)=>{u.style.width=`${S}px`,u.style.height=`${I}px`},onCommit:(S,I)=>{const C=o();C!==void 0&&this.editor.chain().setNodeSelection(C).updateAttributes(this.name,{width:S,height:I}).run()},onUpdate:p,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),v=g.dom,m=()=>{v.style.visibility="",v.style.pointerEvents=""};return v.style.visibility="hidden",v.style.pointerEvents="none",u.complete&&u.naturalWidth>0?m():(u.onload=m,u.onerror=m),g}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Ey({find:hP,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var gP=pP;const p0="TipTapNodeView";class mP{constructor(e,{element:t,props:r}){nt(this,"component");nt(this,"props");nt(this,"dom");this.component=e,this.props=r,this.dom=t,this.dom.classList.add("svelte-renderer")}updateProps(e){Object.assign(this.props,e)}updateAttributes(e){Object.keys(e).forEach(t=>{this.dom.setAttribute(t,e[t])})}destroy(){io(this.component)}}class vP extends SE{mount(){const e=this.component,t=Ar({editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode()});this.contentDOMElement=this.node.isLeaf?null:document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit");const r=this.options.context||new rx;r.set(p0,{onDragStart:this.onDragStart.bind(this),contentDOMElement:this.contentDOMElement});const s=this.options.as??(this.node.isInline?"span":"div"),i=document.createElement(s);i.classList.add(`node-${this.node.type.name}`),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate);const o=vl(e,{target:i,props:t,context:r});this.renderer=new mP(o,{element:i,props:t}),this.appendContentDOM(),this.updateElementAttributes()}appendContentDOM(){const e=this.dom.querySelector("[data-node-view-content]");this.contentDOMElement&&e&&!e.contains(this.contentDOMElement)&&e.appendChild(this.contentDOMElement)}scheduleAppendContentDOM(){this.appendContentDOM(),queueMicrotask(()=>{this.contentDOMElement&&this.appendContentDOM()})}get dom(){return this.renderer.dom.firstElementChild?.hasAttribute("data-node-view-wrapper")||console.warn("Please use the NodeViewWrapper component for your node view."),this.renderer.dom}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const s=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(typeof this.options.update=="function"){const i=this.node,o=this.decorations,a=this.innerDecorations;this.node=e,this.decorations=t,this.innerDecorations=r;const c=this.options.update({oldNode:i,oldDecorations:o,oldInnerDecorations:a,newNode:e,newDecorations:t,newInnerDecorations:r,updateProps:()=>s({node:e,decorations:t,innerDecorations:r})});return this.scheduleAppendContentDOM(),c}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,s({node:e,decorations:t,innerDecorations:r}),this.scheduleAppendContentDOM()),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.dom.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.dom.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=sa(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function Vh(n,e){return t=>new vP(n,t,e)}var bP=new Set(["$$slots","$$events","$$legacy","as","children"]);function ju(n,e){if(new.target)return Nt({component:ju,...n});Lt(e,!0);const t=y(e,"as",7,"div"),r=y(e,"children",7),s=ui(e,bP),i=ow(p0);let o;Lf(async()=>{await qo(),o.style.whiteSpace="normal"});var a={get as(){return t()},set as(d="div"){t(d),b()},get children(){return r()},set children(d){r(d),b()},$set:Dt,$on:(d,f)=>$t(e,d,f)},c=Je(),u=ce(c);return vx(u,t,!1,(d,f)=>{Qn(d,v=>o=v,()=>o),oa(d,()=>({"data-node-view-wrapper":"",role:"none",...s,ondragstart:i?.onDragStart}));var h=Je(),p=ce(h);{var g=v=>{var m=Je(),S=ce(m);On(S,r),k(v,m)};V(p,v=>{r()&&v(g)})}k(f,h)}),k(n,c),Ot(a)}var yP=N('<div class="flex items-center gap-2" contenteditable="false"><!> <!></div>'),wP=N('<video controls="" preload="metadata" playsinline="" class="markdown-video max-w-full rounded-md" draggable="true"></video> <div class="absolute right-1.5 top-1.5 flex gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100" contenteditable="false"><!> <!></div>',3),xP=N('<div class="group relative inline-block max-w-full"><!></div>'),kP=N("<!> <!>",1);function g0(n,e){if(new.target)return Nt({component:g0,...n});Lt(e,!0);let t=y(e,"node",7),r=y(e,"selected",7),s=y(e,"editor",7),i=y(e,"extension",7),o=w(()=>t().attrs.src??""),a=w(()=>t().attrs.name||_.chat_videoBlock_fromAgent_label()),c=fe(!1),u=fe(null),d=fe(null),f=w(()=>i().options.workspaceId),h=w(()=>x1(l(o),l(f))?.mimeType),p=w(()=>Au(l(o))),g=w(()=>k1(l(o),l(f))),v=w(()=>l(p)?.path??l(g)?.path),m=w(()=>l(p)?.workspaceId??l(g)?.workspaceId??l(f));function S(P){P.preventDefault(),P.stopPropagation(),x(u,P.currentTarget instanceof HTMLElement?P.currentTarget:s().view.dom,!0),x(c,!0)}var I={get node(){return t()},set node(P){t(P),b()},get selected(){return r()},set selected(P){r(P),b()},get editor(){return s()},set editor(P){s(P),b()},get extension(){return i()},set extension(P){i(P),b()},$set:Dt,$on:(P,E)=>$t(e,P,E)},C=kP(),M=ce(C);{let P=w(()=>`note-video-node${r()?" selected":""}`);ju(M,{get class(){return l(P)},children:(E,z)=>{var G=xP(),J=te(G);{var K=$=>{var X=yP(),de=te(X);wv(de,{get name(){return l(a)},reason:"load-failed",get path(){return l(v)},get workspaceId(){return l(m)}});var me=R(de,2);Fc(me,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Y(X),k($,X)},Q=$=>{var X=wP(),de=ce(X),me=R(de,2),ie=te(me);{let j=w(()=>_.chat_videoBlock_play_ariaLabel({name:l(a)}));Ze(ie,{type:"button",variant:"ghost",size:"icon-xs",class:"flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white hover:bg-black/75 focus-visible:ring-2 focus-visible:ring-ring",onclick:S,get"aria-label"(){return l(j)},children:(ne,we)=>{ut(ne,{get icon(){return Iw},size:"sm"})},$$slots:{default:!0}})}var q=R(ie,2);Fc(q,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Y(me),L(()=>{xt(de,"src",l(o)),xt(de,"aria-label",l(a))}),xo("error",de,()=>x(d,l(o),!0)),k($,X)};V(J,$=>{l(d)===l(o)?$(K):$(Q,-1)})}Y(G),k(E,G)},$$slots:{default:!0}})}var O=R(M,2);return yv(O,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace",get openerElement(){return l(u)},get open(){return l(c)},set open(P){x(c,P,!0)}}),k(n,C),Ot(I)}const _P=pr.create({name:"video",group:"block",atom:!0,selectable:!0,addOptions(){return{workspaceId:void 0}},addAttributes(){return{src:{default:null},name:{default:null,parseHTML:n=>n.getAttribute("data-name"),renderHTML:n=>n.name?{"data-name":n.name}:{}}}},parseHTML(){return[{tag:"video.markdown-video"}]},renderHTML({HTMLAttributes:n}){return["video",pn(n,{class:"markdown-video",controls:"",preload:"metadata",playsinline:""})]},addNodeView(){return Vh(g0)}}),SP={note:"internal","linear-issue":"linear","github-issue":"github","github-pr":"github","sentry-issue":"sentry","browser-url":"browser"};var cm=N("<span><!></span>");function Pf(n,e){if(new.target)return Nt({component:Pf,...n});Lt(e,!0);let t=y(e,"provider",7),r=y(e,"itemType",7),s=y(e,"size",7,16),i=y(e,"class",7,"");const o=w(()=>t()??(r()?SP[r()]:"internal"));var a={get provider(){return t()},set provider(v){t(v),b()},get itemType(){return r()},set itemType(v){r(v),b()},get size(){return s()},set size(v=16){s(v),b()},get class(){return i()},set class(v=""){i(v),b()},$set:Dt,$on:(v,m)=>$t(e,v,m)},c=Je(),u=ce(c);{var d=v=>{zx(v,{get size(){return s()},get class(){return i()}})},f=v=>{nh(v,{get size(){return s()},get class(){return i()}})},h=v=>{Fx(v,{get size(){return s()},get class(){return i()}})},p=v=>{var m=cm(),S=te(m);ut(S,{get icon(){return zf},get size(){return`${s()??""}px`}}),Y(m),L(()=>{wt(m,1,Xn(i())),Hi(m,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),k(v,m)},g=v=>{var m=cm(),S=te(m);ut(S,{get icon(){return Ff},get size(){return`${s()??""}px`}}),Y(m),L(()=>{wt(m,1,Xn(i())),Hi(m,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),k(v,m)};V(u,v=>{l(o)==="linear"?v(d):l(o)==="github"?v(f,1):l(o)==="sentry"?v(h,2):l(o)==="browser"?v(p,3):v(g,-1)})}return k(n,c),Ot(a)}function uo(n,e){if(new.target)return Nt({component:uo,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(i=16){t(i),b()},get class(){return r()},set class(i=""){r(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return Lw(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Ot(s)}var CP=N('<span class="text-subtle shrink-0"> </span>'),MP=N('<span><!> <!> <span class="max-w-[180px] truncate"> </span></span>'),TP=N('<span class="text-ui font-medium text-subtle">·</span> <span class="text-ui font-medium text-subtle"> </span>',1),EP=N('<div class="text-sm font-medium text-foreground leading-snug"> </div>'),xc=N("<span> </span>"),AP=N('<span class="text-ui"> </span>'),kc=N('<span class="text-ui text-subtle"> </span>'),RP=N('<div class="flex flex-wrap items-center gap-1.5"><!> <!> <!> <!></div>'),PP=N('<span class="px-1.5 py-0.5 rounded-full text-ui font-medium bg-muted/50 text-subtle"> </span>'),IP=N('<div class="flex flex-wrap gap-1"><!> <!></div>'),LP=N('<div class="flex items-center gap-3 text-ui text-subtle"><!> <!></div>'),OP=N('<div class="text-xs text-subtle line-clamp-6"> </div>'),NP=N('<span class="text-ui text-subtle ml-auto"> </span>'),DP=N('<div class="flex items-center gap-2 pt-1 border-t border-border"><!> <!> <!></div>'),$P=N('<div class="space-y-2.5 max-w-80 min-w-56"><div class="flex items-center gap-1.5"><!> <span class="text-ui font-medium text-muted-foreground"> </span> <!></div> <!> <!> <!> <!> <!> <!></div>'),BP=Wi('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-3 h-3 text-muted-foreground hover:text-foreground"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>'),zP=N('<span class="context-mention-wrapper group/pill relative inline-flex items-center svelte-1qhjkt1"><!> <!></span> <!>',1);function m0(n,e){if(new.target)return Nt({component:m0,...n});Lt(e,!0);const t=bx()?.workspaceId??void 0;let r=y(e,"node",7),s=y(e,"selected",7),i=y(e,"deleteNode",7),o=fe(null),a=fe(!1);ft(()=>{const $=X=>{x(o,X.detail.branch,!0),x(a,!0)};return document.addEventListener("initializer-branch-updated",$),()=>{document.removeEventListener("initializer-branch-updated",$)}});function c($){$.preventDefault(),$.stopPropagation(),i()()}const u=w(()=>r().attrs.provider),d=w(()=>r().attrs.itemType),f=w(()=>r().attrs.title),h=w(()=>r().attrs.identifier),p=w(()=>r().attrs.url),g=w(()=>r().attrs.description),v=w(()=>()=>{const $=r().attrs.metadata;if(!$)return null;try{return JSON.parse($)}catch{return null}}),m=w(()=>()=>{if(l(u)==="github"&&l(h)){const $=l(h).match(/^([^/]+)\/([^#]+)#(\d+)$/);if($){const[,X,de,me]=$,q=!!l(v)()?.sourceBranch?"pull":"issues";return`https://github.com/${X}/${de}/${q}/${me}`}}return l(p)}),S=w(()=>()=>{const $=l(v)()?.sourceBranch;return $&&$.length>0?$:null}),I=w(()=>l(u)==="github"&&(l(d)==="github-pr"||l(d)==="github-issue")&&l(S)()!==null),C=w(()=>l(a)&&l(I)&&l(S)()&&l(S)()!==l(o));function M($){$.preventDefault(),$.stopPropagation();const X=l(S)();if(X){const de=new CustomEvent("switch-to-pr-branch",{detail:{branch:X,prIdentifier:l(h)},bubbles:!0});document.dispatchEvent(de)}}function O($){return $?xw($,{style:"narrow"}):""}function P($){if(!$)return"bg-muted text-subtle";const X=$.toLowerCase();return X.includes("progress")||X.includes("active")||X.includes("open")?"bg-blue-500/15 text-blue-500":X.includes("done")||X.includes("resolved")||X.includes("closed")||X.includes("complete")?"bg-green-500/15 text-green-500":X.includes("backlog")||X.includes("todo")||X.includes("triage")?"bg-muted text-subtle":X.includes("block")||X.includes("error")||X.includes("cancel")?"bg-red-500/15 text-red-500":"bg-muted text-subtle"}function E($){if(!$)return null;const X=$.toLowerCase();return X.includes("urgent")||X==="1"?{color:"bg-red-500",label:"🔴"}:X.includes("high")||X==="2"?{color:"bg-orange-500",label:"🟠"}:X.includes("medium")||X==="3"?{color:"bg-warning",label:"🟡"}:X.includes("low")||X==="4"?{color:"bg-blue-500",label:"🔵"}:null}function z($){if(!$)return"";const X=$.toLowerCase();return X==="error"||X==="fatal"?"text-danger":X==="warning"?"text-warning-ink":"text-subtle"}const G=w(()=>()=>l(d)==="browser-url"?l(f)||l(m)():l(h)&&l(f)?l(f):l(h)||l(f)),J=w(()=>()=>{switch(l(u)){case"linear":return"Linear";case"github":return"GitHub";case"sentry":return"Sentry";case"browser":return _.tiptap_contextMention_providerUrl_label();case"internal":return _.tiptap_contextMention_providerInternal_label();default:return l(u)}});async function K($){$.preventDefault(),$.stopPropagation();const X=l(m)();X&&t&&await jf(X,{workspaceId:Xm(t),event:$})}var Q={get node(){return r()},set node($){r($),b()},get selected(){return s()},set selected($){s($),b()},get deleteNode(){return i()},set deleteNode($){i($),b()},$set:Dt,$on:($,X)=>$t(e,$,X)};return ju(n,{as:"span",class:"inline",children:($,X)=>{var de=zP(),me=ce(de),ie=te(me);Zf(ie,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"20rem",trigger:Se=>{var se=MP(),oe=te(se);Pf(oe,{get provider(){return l(u)},size:12,class:"shrink-0 opacity-30"});var H=R(oe,2);{var W=ge=>{var ue=CP(),pe=re(ue,!0);L(()=>B(pe,l(h))),k(ge,ue)};V(H,ge=>{l(h)&&l(d)!=="browser-url"&&ge(W)})}var D=R(H,2),ae=re(D,!0);Y(se),L(ge=>{wt(se,1,`context-mention-pill inline-flex items-center gap-1 rounded-md px-1.5 py-1 pr-5 font-medium transition-colors
143
- ${s()?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-muted/60 text-foreground/80 hover:bg-muted hover:text-foreground"}`,"svelte-1qhjkt1"),B(ae,ge)},[()=>l(G)()]),k(Se,se)},content:Se=>{const se=w(()=>l(v)()),oe=w(()=>l(se)?E(l(se).priority):null);var H=$P(),W=te(H),D=te(W);Pf(D,{get provider(){return l(u)},size:10,class:"opacity-40"});var ae=R(D,2),ge=re(ae,!0),ue=R(ae,2);{var pe=Be=>{var he=TP(),Ne=R(ce(he),2),je=re(Ne,!0);L(()=>B(je,l(h))),k(Be,he)};V(ue,Be=>{l(h)&&l(d)!=="browser-url"&&Be(pe)})}Y(W);var ke=R(W,2);{var ye=Be=>{var he=EP(),Ne=re(he,!0);L(()=>B(Ne,l(f))),k(Be,he)};V(ke,Be=>{l(f)&&Be(ye)})}var Z=R(ke,2);{var $e=Be=>{var he=RP(),Ne=te(he);{var je=Mt=>{var Ue=xc(),Ke=re(Ue,!0);L(Me=>{wt(Ue,1,`px-1.5 py-0.5 rounded text-ui font-medium ${Me??""}`,"svelte-1qhjkt1"),B(Ke,l(se).state)},[()=>P(l(se).state)]),k(Mt,Ue)};V(Ne,Mt=>{l(se).state&&Mt(je)})}var Tt=R(Ne,2);{var ee=Mt=>{var Ue=AP(),Ke=re(Ue,!0);L(()=>B(Ke,l(oe).label)),k(Mt,Ue)};V(Tt,Mt=>{l(oe)&&Mt(ee)})}var Ge=R(Tt,2);{var it=Mt=>{var Ue=xc(),Ke=re(Ue,!0);L(Me=>{wt(Ue,1,`text-ui font-medium ${Me??""}`,"svelte-1qhjkt1"),B(Ke,l(se).level)},[()=>z(l(se).level)]),k(Mt,Ue)};V(Ge,Mt=>{l(se).level&&l(u)==="sentry"&&Mt(it)})}var Xe=R(Ge,2);{var mt=Mt=>{var Ue=kc(),Ke=re(Ue);L(()=>B(Ke,`→ ${l(se).assignee??""}`)),k(Mt,Ue)};V(Xe,Mt=>{l(se).assignee&&Mt(mt)})}Y(he),k(Be,he)};V(Z,Be=>{l(se)&&(l(se).state||l(oe)||l(se).assignee)&&Be($e)})}var lt=R(Z,2);{var St=Be=>{var he=IP(),Ne=te(he);Cs(Ne,17,()=>l(se).labels.split(",").map(Ge=>Ge.trim()).filter(Boolean).slice(0,5),Tc,(Ge,it)=>{var Xe=PP(),mt=re(Xe,!0);L(()=>B(mt,l(it))),k(Ge,Xe)});var je=R(Ne,2);{var Tt=Ge=>{var it=kc(),Xe=re(it);L(mt=>B(Xe,`+${mt??""}`),[()=>l(se).labels.split(",").length-5]),k(Ge,it)},ee=w(()=>l(se).labels.split(",").length>5);V(je,Ge=>{l(ee)&&Ge(Tt)})}Y(he),k(Be,he)};V(lt,Be=>{l(se)?.labels&&Be(St)})}var De=R(lt,2);{var Le=Be=>{var he=LP(),Ne=te(he);{var je=Ge=>{var it=xc(),Xe=re(it,!0);L(mt=>B(Xe,mt),[()=>_.tiptap_contextMention_events_label({count:l(se).count})]),k(Ge,it)};V(Ne,Ge=>{l(se).count&&Ge(je)})}var Tt=R(Ne,2);{var ee=Ge=>{var it=xc(),Xe=re(it,!0);L(mt=>B(Xe,mt),[()=>_.tiptap_contextMention_users_label({count:l(se).userCount})]),k(Ge,it)};V(Tt,Ge=>{l(se).userCount&&Ge(ee)})}Y(he),k(Be,he)};V(De,Be=>{l(se)&&l(u)==="sentry"&&(l(se).count||l(se).userCount)&&Be(Le)})}var Qe=R(De,2);{var Ct=Be=>{var he=OP(),Ne=re(he,!0);L(()=>B(Ne,l(g))),k(Be,he)};V(Qe,Be=>{l(g)&&Be(Ct)})}var bt=R(Qe,2);{var sn=Be=>{var he=DP(),Ne=te(he);{var je=Xe=>{var mt=kc(),Mt=re(mt,!0);L(()=>B(Mt,l(se).project)),k(Xe,mt)};V(Ne,Xe=>{l(se).project&&Xe(je)})}var Tt=R(Ne,2);{var ee=Xe=>{var mt=kc(),Mt=re(mt,!0);L(Ue=>B(Mt,Ue),[()=>_.tiptap_contextMention_byAuthor_label({author:l(se).author})]),k(Xe,mt)};V(Tt,Xe=>{l(se).author&&Xe(ee)})}var Ge=R(Tt,2);{var it=Xe=>{var mt=NP(),Mt=re(mt,!0);L(Ue=>B(Mt,Ue),[()=>O(l(se).createdAt)]),k(Xe,mt)};V(Ge,Xe=>{l(se).createdAt&&Xe(it)})}Y(he),k(Be,he)};V(bt,Be=>{l(se)&&(l(se).project||l(se).createdAt||l(se).author)&&Be(sn)})}Y(H),L(Be=>B(ge,Be),[()=>l(J)()]),k(Se,H)},$$slots:{trigger:!0,content:!0}});var q=R(ie,2);{let we=w(()=>s()?"bg-primary/20 hover:bg-primary/30":"bg-muted/60 hover:bg-muted"),be=w(()=>_.tiptap_contextMention_remove_ariaLabel());Ze(q,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,onclick:c,get class(){return`delete-btn absolute right-0 top-0 bottom-0 w-5 h-auto rounded-r-md cursor-pointer
140
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ZA,this.editor.getAttributes(tm)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new kn({props:{handlePaste:(n,e)=>{var t,r;const s=(t=e.clipboardData)===null||t===void 0?void 0:t.getData("text/html");if(s?.trim())return!1;const i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;const o=YA(i);if(!o)return!1;try{const a=n.state.schema.nodeFromJSON(o),c=n.state.tr.replaceSelectionWith(a);return n.dispatch(c),!0}catch{return!1}}}})]},addInputRules(){const n=(t,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+t[1];let e=Ka({find:nm,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:n});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ka({find:nm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(tm)}),joinPredicate:n,editor:this.editor})),[e]}}),eR=/^\s*(\[([( |x])?\])\s$/,tR="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",nR=(n,e,t)=>{var r;return(t==null||(r=t.checkboxLabel)===null||r===void 0?void 0:r.call(t,n,e))||`Task item checkbox for ${n.textContent||"empty task item"}`},rR=pr.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:n=>{var e;return(e=n.querySelector("div"))!==null&&e!==void 0?e:n}}]},renderHTML({node:n,HTMLAttributes:e}){return["li",pn(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${!((t=n.attrs)===null||t===void 0)&&t.checked?"x":" "}] `;return _y(n,e,r)},addExtensions(){return this.options.nested?[qy(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div");o.style.cssText=tR;const u=f=>{const h=nR(f,f.attrs.checked,this.options.a11y);a.setAttribute("aria-label",h),o.textContent=h};u(n),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=f.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const g=t();if(typeof g!="number")return!1;const v=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...v?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{s.setAttribute(f,h)}),s.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,i.append(a,o),s.append(i,c),Object.entries(e).forEach(([f,h])=>{s.setAttribute(f,h)});let d=new Set(Object.keys(e));return{dom:s,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;s.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(f);const h=r.extensionManager.attributes,p=sa(f,h),g=new Set(Object.keys(p)),v=this.options.HTMLAttributes;return d.forEach(m=>{g.has(m)||(m in v?s.setAttribute(m,v[m]):s.removeAttribute(m))}),Object.entries(p).forEach(([m,S])=>{S==null?m in v?s.setAttribute(m,v[m]):s.removeAttribute(m):s.setAttribute(m,S)}),d=g,!0}}}},addInputRules(){return[Ka({find:eR,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),sR=pr.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",pn(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
141
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=i=>{const o=Hg(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,c)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:c}),customNestedParser:r},t);if(o){const a={type:"taskList",raw:o.raw,items:o.items},c=i.slice(o.raw.length);return c.trim()?[a,...t.blockTokens(c)]:[a]}return t.blockTokens(i)},s=Hg(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});zn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Gy.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Qy.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(e0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(n0.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(rR.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(sR.configure(this.options.taskList)),n}});const yc="&nbsp;",Ld=" ",iR=pr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",pn(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===yc||t[0].text===yc||t[0].raw===Ld||t[0].text===Ld)&&r.length===1&&r[0].type==="text"&&(r[0].text===yc||r[0].text===Ld)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{if(!n)return"";const r=Array.isArray(n.content)?n.content:[];if(r.length===0){var s,i;const o=Array.isArray(t==null||(s=t.previousNode)===null||s===void 0?void 0:s.content)?t.previousNode.content:[];return(t==null||(i=t.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&o.length===0?yc:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),oR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lR=la.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",pn(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ia({find:oR,type:this.type})]},addPasteRules(){return[_o({find:aR,type:this.type})]}}),cR=pr.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),uR=la.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",pn(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!r)return;const s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function dR(n={}){return new kn({view(e){return new fR(e,n)}})}class fR{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let g=p.getBoundingClientRect(),v=f?g.bottom:g.top;f&&h&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*a;r={left:g.left,right:g.right,top:v-m,bottom:v+m}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,d;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=c.getBoundingClientRect(),h=f.width/c.offsetWidth,p=f.height/c.offsetHeight;u=f.left-c.scrollLeft*h,d=f.top-c.scrollTop*p}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(!t||i)return null;let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=qv(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Jn extends jt{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Jn.valid(r)?new Jn(r):jt.near(r)}content(){return He.empty}eq(e){return e instanceof Jn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Jn(e.resolve(t.pos))}getBookmark(){return new Uh(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!hR(e)||!pR(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Jn.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let c=e.doc.resolve(s);if(Jn.valid(c))return c}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!vt.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let a=e.doc.resolve(s);if(Jn.valid(a))return a}return null}}}Jn.prototype.visible=!1;Jn.findFrom=Jn.findGapCursorFrom;jt.jsonID("gapcursor",Jn);class Uh{constructor(e){this.pos=e}map(e){return new Uh(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Jn.valid(t)?new Jn(t):jt.near(t)}}function r0(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function hR(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||r0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function pR(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||r0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function gR(){return new kn({props:{decorations:yR,createSelectionBetween(n,e,t){return e.pos==t.pos&&Jn.valid(t)?new Jn(t):null},handleClick:vR,handleKeyDown:mR,handleDOMEvents:{beforeinput:bR}}})}const mR=Qb({ArrowLeft:wc("horiz",-1),ArrowRight:wc("horiz",1),ArrowUp:wc("vert",-1),ArrowDown:wc("vert",1)});function wc(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,c=o.empty;if(o instanceof et){if(!i.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=Jn.findGapCursorFrom(a,e,c);return u?(s&&s(r.tr.setSelection(new Jn(u))),!0):!1}}function vR(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Jn.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&vt.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Jn(r))),!0)}function bR(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Jn))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=_e.empty;for(let o=r.length-1;o>=0;o--)s=_e.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new He(s,0,0));return i.setSelection(et.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function yR(n){if(!(n.selection instanceof Jn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Qt.create(n.doc,[Rr.widget(n.selection.head,e,{key:"gapcursor"})])}var Tu=200,Ir=function(){};Ir.prototype.append=function(e){return e.length?(e=Ir.from(e),!this.length&&e||e.length<Tu&&this.leafAppend(e)||this.length<Tu&&e.leafPrepend(this)||this.appendInner(e)):this};Ir.prototype.prepend=function(e){return e.length?Ir.from(e).append(this):this};Ir.prototype.appendInner=function(e){return new wR(this,e)};Ir.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ir.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Ir.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ir.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};Ir.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};Ir.from=function(e){return e instanceof Ir?e:e&&e.length?new s0(e):Ir.empty};var s0=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var c=i;c<o;c++)if(s(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var c=i-1;c>=o;c--)if(s(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Tu)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Tu)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ir);Ir.empty=new s0([]);var wR=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ir);const xR=500;class oi{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,c,u=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,d.push(f);return}if(s){d.push(new yi(f.map));let p=f.step.map(s.slice(i)),g;p&&o.maybeStep(p).doc&&(g=o.mapping.maps[o.mapping.maps.length-1],u.push(new yi(g,void 0,void 0,u.length+d.length))),i--,g&&s.appendMap(g,i)}else o.maybeStep(f.step);if(f.selection)return a=s?f.selection.map(s.slice(i)):f.selection,c=new oi(this.items.slice(0,r).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:a}}addTransform(e,t,r,s){let i=[],o=this.eventCount,a=this.items,c=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new yi(e.mapping.maps[d],f,t),p;(p=c&&c.merge(h))&&(h=p,d?i.pop():a=a.slice(0,a.length-1)),i.push(h),t&&(o++,t=void 0),s||(c=h)}let u=o-r.depth;return u>_R&&(a=kR(a,u),o-=u),new oi(a.append(i),o)}remapping(e,t){let r=new Nl;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new oi(this.items.append(e.map(t=>new yi(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;t=Math.min(this.items.length,t);let r=[],s=this.items.length-t,i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let c=t;this.items.forEach(h=>{let p=i.getMirror(--c);if(p==null)return;o=Math.min(o,p);let g=i.maps[p];if(h.step){let v=e.steps[p].invert(e.docs[p]),m=h.selection&&h.selection.map(i.slice(c+1,p));m&&a++,r.push(new yi(g,v,m))}else r.push(new yi(g))},s);let u=[];for(let h=t;h<o;h++)u.push(new yi(i.maps[h]));let d=this.items.slice(0,s).append(u).append(r),f=new oi(d,a);return f.emptyItemCount()>xR&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let c=o.step.map(t.slice(r)),u=c&&c.getMap();if(r--,u&&t.appendMap(u,r),c){let d=o.selection&&o.selection.map(t.slice(r));d&&i++;let f=new yi(u.invert(),c,d),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else o.map&&r--},this.items.length,0),new oi(Ir.from(s.reverse()),i)}}oi.empty=new oi(Ir.empty,0);function kR(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class yi{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new yi(t.getMap().invert(),t,this.selection)}}}class lo{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const _R=20;function SR(n,e,t,r){let s=t.getMeta(Zo),i;if(s)return s.historyState;t.getMeta(TR)&&(n=new lo(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Zo))return o.getMeta(Zo).redo?new lo(n.done.addTransform(t,void 0,r,Lc(e)),n.undone,sm(t.mapping.maps),n.prevTime,n.prevComposition):new lo(n.done,n.undone.addTransform(t,void 0,r,Lc(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!CR(t,n.prevRanges)),u=o?Od(n.prevRanges,t.mapping):sm(t.mapping.maps);return new lo(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Lc(e)),oi.empty,u,t.time,a??n.prevComposition)}else return(i=t.getMeta("rebased"))?new lo(n.done.rebased(t,i),n.undone.rebased(t,i),Od(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new lo(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Od(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function CR(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function sm(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function Od(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function MR(n,e,t){let r=Lc(e),s=Zo.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),c=new lo(t?a:i.remaining,t?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(Zo,{redo:t,historyState:c})}let Nd=!1,im=null;function Lc(n){let e=n.plugins;if(im!=e){Nd=!1,im=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Nd=!0;break}}return Nd}const Zo=new Dn("history"),TR=new Dn("closeHistory");function ER(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new kn({key:Zo,state:{init(){return new lo(oi.empty,oi.empty,null,0,-1)},apply(e,t,r){return SR(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?o0:r=="historyRedo"?a0:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function i0(n,e){return(t,r)=>{let s=Zo.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=MR(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const o0=i0(!1,!0),a0=i0(!0,!0);zn.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new kn({key:new Dn("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const a=o-s,c=0,u=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(c,u);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,a=o-(i-r),c=o;return e.deleteRange(a,c),!(this.storage.characters({node:e.doc})>r)}})]}});const AR=zn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[dR(this.options)]}});zn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new kn({key:new Dn("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return Qt.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((c,u)=>{if(!c.isText){if(!(s>=u&&s<=u+c.nodeSize-1))return!1;o+=1}});let a=0;return n.descendants((c,u)=>{if(c.isText||!(s>=u&&s<=u+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Rr.node(u,u+c.nodeSize,{class:this.options.className}))}),Qt.create(n,i)}}})]}});const RR=zn.create({name:"gapCursor",addProseMirrorPlugins(){return[gR()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=hn(ct(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),l0="placeholder",om=new Dn("tiptap__placeholder");function c0(n){const{editor:e,placeholder:t,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:c,emptyEditor:u}}=n,d=[c];return o&&d.push(u),Rr.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:a}):t})}function u0(n,e){return typeof n=="function"?n(e):n}function d0({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:i,to:o}){const{anchor:a}=s,c=[],u=n.isEmpty;return r.nodesBetween(i,o,(d,f)=>{const h=a>=f&&a<=f+d.nodeSize,p=!d.isLeaf&&ec(d);return d.type.isTextblock&&(h||!e.showOnlyCurrent)&&p&&c.push(c0({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:u0(e.emptyNodeClass,{editor:n,node:d,pos:f,hasAnchor:h})},node:d,pos:f})),e.includeChildren}),c}function f0({editor:n,options:e,dataAttribute:t,doc:r,selection:s}){if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:i}=s,o=[],a=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const c=r.resolve(i),u=c.depth>0?c.node(1):c.nodeAfter,d=c.depth>0?c.before(1):i;if(u&&u.type.isTextblock&&ec(u)){const f=i>=d&&i<=d+u.nodeSize;o.push(c0({editor:n,isEmptyDoc:a,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:u0(e.emptyNodeClass,{editor:n,node:u,pos:d,hasAnchor:f})},node:u,pos:d}))}}else o.push(...d0({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:0,to:r.content.size}));return Qt.create(r,o)}function Al(n,e){const t=n.resolve(e);if(t.depth===0){var r;const i=(r=t.nodeAfter)!==null&&r!==void 0?r:t.nodeBefore;if(!i)return{from:e,to:e};const o=t.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}const s=t.before(1);return{from:s,to:s+t.node(1).nodeSize}}function Rl(n,e){return{from:Math.max(0,e.from-1),to:Math.min(n.content.size,e.to-1)}}function PR(n,e,t){const r=[];return n.forEach((s,i)=>{const o=i,a=o+s.nodeSize,c=o+1,u=a+1;c<t&&u>e&&r.push({from:o,to:a})}),r}function IR(n){if(n.length===0)return[];const e=[...n].sort((r,s)=>r.from-s.from),t=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=t[t.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):t.push({...i})}return t}function LR(n,e){const t=PR(n,e.from,e.to);return t.push(Rl(n,Al(n,e.from))),e.to>e.from?t.push(Rl(n,Al(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(Rl(n,Al(n,Math.min(e.from+1,n.content.size)))),t}function OR(n,e,t){const r=[];if(n.docChanged){const s=Fu(n);for(const i of s)r.push(...LR(t.doc,i.newRange))}return n.selectionSet&&(r.push(Rl(t.doc,Al(t.doc,n.mapping.map(e.selection.anchor)))),r.push(Rl(t.doc,Al(t.doc,t.selection.anchor)))),IR(r)}function NR(n,e,t){const r=Math.max(0,Math.min(n,t.content.size));return{from:r,to:Math.max(r,Math.min(e,t.content.size))}}function DR({decorations:n,ranges:e,editor:t,options:r,dataAttribute:s,doc:i,selection:o}){let a=n;for(const c of e){const{from:u,to:d}=NR(c.from,c.to,i),f=a.find(u,d).filter(p=>p.from>=u&&p.to<=d);f.length&&(a=a.remove(f));const h=d0({editor:t,options:r,dataAttribute:s,doc:i,selection:o,from:u,to:d});h.length&&(a=a.add(i,h))}return a}function $R({editor:n,options:e,dataAttribute:t}){return{init(r,s){const i=f0({editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection});return i??Qt.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:DR({decorations:s.map(r.mapping,r.doc),ranges:OR(r,i,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function BR(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function zR({editor:n,options:e}){const t=e.dataAttribute?`data-${BR(e.dataAttribute)}`:`data-${l0}`,r=e.showOnlyCurrent&&!e.includeChildren;return new kn({key:om,...r?{}:{state:$R({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:s,selection:i})=>f0({editor:n,options:e,dataAttribute:t,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?Qt.empty:(i=om.getState(s))!==null&&i!==void 0?i:Qt.empty}}})}const FR=zn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:l0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[zR({editor:this.editor,options:this.options})]}});function Rf(n,e){return!n.selection.empty&&!py(n.selection)&&e.isEditable}function HR(n,e){return Rf(n,e)&&!e.isFocused&&!e.view.dragging}function UR(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function VR(n){n.focus()}zn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new kn({key:new Dn("selection"),props:{decorations(t){return HR(t,n)?Qt.create(t.doc,[Rr.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return Rf(t.state,n)&&UR(),!1},focus(t){return Rf(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&VR(t)}),!1}}}})]}});function am({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const WR=zn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Dn(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)===null||n===void 0?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new kn({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:c,schema:u}=o,d=e.getState(o),f=a.content.size,h=u.nodes[t];if(!s.some(p=>p.getMeta("skipTrailingNode"))&&d)return c.insert(f,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!am({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!am({node:o,types:r})}}})]}}),KR=zn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>o0(n,e),redo:()=>({state:n,dispatch:e})=>a0(n,e)}},addProseMirrorPlugins(){return[ER(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),jR=zn.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(LE.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(EE.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(Gy.configure(this.options.bulletList)),this.options.code!==!1&&n.push(DE.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(zE.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(FE.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(AR.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(RR.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(HE.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(UE.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(KR.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(VE.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(qE.configure(this.options.italic)),this.options.listItem!==!1&&n.push(Qy.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push(e0.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(jy.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(n0.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(iR.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(lR.configure(this.options.strike)),this.options.text!==!1&&n.push(cR.configure(this.options.text)),this.options.underline!==!1){var r;n.push(uR.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;n.push(WR.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return n}});var GR=jR,qR=FR;function JR(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:a}=n,c=r&&!s,u=HT(t),d=new RegExp(`\\s${u}$`),f=o?"^":"",h=s?"":u,p=c?new RegExp(`${f}${u}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${h}]*`,"gm"),g=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!g)return null;const v=a.pos-g.length,m=Array.from(g.matchAll(p)).pop();if(!m||m.input===void 0||m.index===void 0)return null;const S=m.input.slice(Math.max(0,m.index-1),m.index),I=new RegExp(`^[${i?.join("")}\0]?$`).test(S);if(i!==null&&!I)return null;const C=v+m.index;let M=C+m[0].length;return c&&d.test(g.slice(M-1,M+1))&&(m[0]+=" ",M+=1),C<a.pos&&M>=a.pos?{range:{from:C,to:M},query:m[0].slice(t.length),text:m[0]}:null}function XR(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const r=t.content.textBetween(0,t.content.size,`
142
+ `);return/\s/.test(r)}):!1}function YR(n){return()=>{const e=n.state.selection.$anchor.pos,{top:t,right:r,bottom:s,left:i}=n.view.coordsAtPos(e);try{return new DOMRect(i,t,r-i,s-t)}catch{return null}}}function QR(n,e,t,r){return t?()=>{const s=r.getState(n.state),i=s?.decorationId,o=e.dom.querySelector(`[data-decoration-id="${i}"]`);return o?.getBoundingClientRect()||null}:YR(n)}function ZR({match:n,dismissedRange:e,state:t,transaction:r,editor:s,shouldResetDismissed:i,effectiveAllowSpaces:o}){return i?.({editor:s,state:t,range:e,match:n,transaction:r,allowSpaces:o})?!1:o?n.range.from===e.from:n.range.from===e.from&&!XR(r)}function eP({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function tP({pluginKey:n,decorationTag:e,decorationClass:t,decorationContent:r,decorationEmptyClass:s,renderer:i,dispatchExit:o}){return{handleKeyDown(a,c){var u;const d=n.getState(a.state);if(!d.active)return!1;if(c.key==="Escape"||c.key==="Esc"){var f;return i==null||(f=i.onKeyDown)===null||f===void 0||f.call(i,{view:a,event:c,range:d.range}),o(a),!0}return(i==null||(u=i.onKeyDown)===null||u===void 0?void 0:u.call(i,{view:a,event:c,range:d.range}))||!1},decorations(a){const{active:c,range:u,decorationId:d,query:f}=n.getState(a);if(!c)return null;const h=!f?.length,p=[t];return h&&p.push(s),Qt.create(a.doc,[Rr.inline(u.from,u.to,{nodeName:e,class:p.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":r})])}}}function nP({editor:n,char:e,effectiveAllowSpaces:t,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,findSuggestionMatch:o,allow:a,shouldShow:c,shouldKeepDismissed:u,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(f,h,p,g){const{isEditable:v}=n,{composing:m}=n.view,{selection:S}=f,{empty:I,from:C}=S,M={...h},O=f.getMeta(d);if(O&&O.exit)return M.active=!1,M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null,M.dismissedRange=h.active?{...h.range}:h.dismissedRange,M;if(M.composing=m,f.docChanged&&M.dismissedRange!==null&&(M.dismissedRange={from:f.mapping.map(M.dismissedRange.from),to:f.mapping.map(M.dismissedRange.to)}),v&&(I||n.view.composing)){(C<h.range.from||C>h.range.to)&&!m&&!h.composing&&(M.active=!1);const P=o({char:e,allowSpaces:t,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:S.$from}),E=`id_${Math.floor(Math.random()*4294967295)}`;P&&a({editor:n,state:g,range:P.range,isActive:h.active})&&(!c||c({editor:n,range:P.range,query:P.query,text:P.text,transaction:f}))?(M.dismissedRange!==null&&!u({match:P,dismissedRange:M.dismissedRange,state:g,transaction:f})&&(M.dismissedRange=null),M.dismissedRange===null?(M.active=!0,M.decorationId=h.decorationId||E,M.range=P.range,M.query=P.query,M.text=P.text):M.active=!1):(P||(M.dismissedRange=null),M.active=!1)}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}}}function rP({editor:n,items:e}){let t=null,r=null,s=null;const i=()=>{r!==null&&(clearTimeout(r),r=null),s?.(),s=null},o=u=>new Promise(d=>{s=d,r=setTimeout(()=>{r=null;const f=s;s=null,f?.()},u)}),a=()=>{t?.abort(),i(),t=null};return{abort:a,fetch:async(u,d)=>{a(),t=new AbortController;const f=t;if(d>0&&await o(d),t!==f||f.signal.aborted)return{status:"aborted"};try{const h=await e({editor:n,query:u,signal:f.signal});return t!==f||f.signal.aborted?{status:"aborted"}:{status:"resolved",items:h}}catch{return t!==f||f.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function sP({placement:n,offset:e,flip:t,floatingUi:r}){var s,i,o,a;const c=[Z1({mainAxis:(s=e.mainAxis)!==null&&s!==void 0?s:4,crossAxis:(i=e.crossAxis)!==null&&i!==void 0?i:0})];return t&&c.push(ex()),!(r==null||(o=r.middleware)===null||o===void 0)&&o.length&&c.push(...r.middleware),{placement:n,strategy:(a=r?.strategy)!==null&&a!==void 0?a:"absolute",middleware:c}}function iP(n){if(n instanceof HTMLElement)return n;if(typeof n=="string")try{const e=document.querySelector(n);if(e)return e}catch{return document.body}return document.body}function oP({getReferenceRect:n,contextElement:e,config:t,container:r,dismissOnOutsideClick:s,dismiss:i}){return(o,a={})=>{const c={getBoundingClientRect:()=>{var g;return(g=n())!==null&&g!==void 0?g:new DOMRect},contextElement:e};let u=!1;const d=!o.isConnected;d&&iP(r).appendChild(o),a.onPosition||(o.style.visibility="hidden",o.style.width="max-content");const h=tx(c,o,()=>{nx(c,o,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:g,y:v,placement:m,strategy:S})=>{if(a.onPosition){a.onPosition({x:g,y:v,placement:m,strategy:S});return}Object.assign(o.style,{position:S,left:`${g}px`,top:`${v}px`}),u||(u=!0,o.style.visibility="")})},a.autoUpdate);let p;return s&&(p=g=>{const v=g.target;!(v instanceof Node)||o.contains(v)||e.contains(v)||i()},document.addEventListener("pointerdown",p,!0)),()=>{h(),p&&document.removeEventListener("pointerdown",p,!0),d&&o.remove()}}}function aP({editor:n,pluginKey:e,items:t,renderer:r,minQueryLength:s,debounce:i,initialItems:o,placement:a,offset:c,container:u,flip:d,floatingUi:f,dismissOnOutsideClick:h,command:p,clientRectFor:g,dispatchExit:v}){let m;const S=rP({editor:n,items:t}),I=sP({placement:a,offset:c,flip:d,floatingUi:f});function C(M,O){switch(M){case"started":var P;r==null||(P=r.onStart)===null||P===void 0||P.call(r,O);break;case"updated":var E;r==null||(E=r.onUpdate)===null||E===void 0||E.call(r,O);break;case"stopped":var z;r==null||(z=r.onExit)===null||z===void 0||z.call(r,O)}}return{update:async(M,O)=>{var P,E;const z=e.getState(O),G=e.getState(M.state);if(!z||!G)return;let J=null;const K=z.query!==G.query,Y=z.text!==G.text,$=z.range.from!==G.range.from||z.range.to!==G.range.to,X=K||Y||$;if(!z.active&&G.active)J="started";else if(z.active&&!G.active)J="stopped";else if(G.active&&X)J="updated";else return;const de=J==="stopped"?z:G,me=M.dom.querySelector(`[data-decoration-id="${de.decorationId}"]`),ie=g(M,me),q=s===0||(de.query?de.query.length>=s:!1),j=(J==="started"||J==="updated")&&q;if(m={editor:n,range:de.range,query:de.query||"",text:de.text||"",items:o??[],command:be=>p({editor:n,range:de.range,props:be}),decorationNode:me,clientRect:ie,loading:j,placement:a,offset:{mainAxis:(P=c.mainAxis)!==null&&P!==void 0?P:4,crossAxis:(E=c.crossAxis)!==null&&E!==void 0?E:0},container:u,flip:d,floatingUi:I,mount:oP({getReferenceRect:ie,contextElement:M.dom,config:I,container:u,dismissOnOutsideClick:h,dismiss:()=>v(n.view)})},J==="started"){var ne;r==null||(ne=r.onBeforeStart)===null||ne===void 0||ne.call(r,m)}if(J==="updated"){var we;r==null||(we=r.onBeforeUpdate)===null||we===void 0||we.call(r,m)}if(J==="started"&&C(J,m),J==="started"||J==="updated")if(!j)S.abort(),m={...m,items:o??[],loading:!1};else{m={...m,items:o??[],loading:!0},J="updated",C(J,m);const be=await S.fetch(de.query||"",i);if(be.status==="aborted")return;const Se=e.getState(M.state);if(!Se?.active){S.abort();return}m=be.status==="resolved"?{...m,items:be.items,loading:!1}:{...m,loading:!1}}if(J==="stopped"){S.abort(),C(J,m),m=void 0;return}J==="updated"&&C(J,m)},destroy:()=>{var M;S.abort(),m&&(r==null||(M=r.onExit)===null||M===void 0||M.call(r,m))}}}const lP=new Dn("suggestion");function cP({pluginKey:n=lP,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:h=()=>[],minQueryLength:p=0,debounce:g=0,initialItems:v,placement:m="bottom-start",offset:S={},container:I,flip:C=!0,floatingUi:M,dismissOnOutsideClick:O=!0,render:P=()=>({}),allow:E=()=>!0,findSuggestionMatch:z=JR,shouldShow:G,shouldResetDismissed:J}){const K=P?.(),Y=r&&!s,$=(me,ie)=>QR(e,me,ie,n);function X(me){return ZR({...me,editor:e,shouldResetDismissed:J,effectiveAllowSpaces:Y})}const de=me=>eP({view:me,pluginKeyRef:n});return new kn({key:n,view:()=>aP({editor:e,pluginKey:n,items:h,renderer:K,minQueryLength:p,debounce:g,initialItems:v,placement:m,offset:S,container:I,flip:C,floatingUi:M,dismissOnOutsideClick:O,command:f,clientRectFor:$,dispatchExit:de}),state:nP({editor:e,char:t,effectiveAllowSpaces:Y,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:z,allow:E,shouldShow:G,shouldKeepDismissed:X,pluginKey:n}),props:tP({pluginKey:n,decorationTag:a,decorationClass:c,decorationContent:u,decorationEmptyClass:d,renderer:K,dispatchExit:de})})}function uP({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){return{editor:n,char:r,pluginKey:new Dn,command:({editor:s,range:i,props:o})=>{var a,c;const u=s.view.state.selection.$to.nodeAfter;!(u==null||(a=u.text)===null||a===void 0)&&a.startsWith(" ")&&(i.to+=1),s.chain().focus().insertContentAt(i,[{type:t,attrs:{...o,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(c=s.view.dom.ownerDocument.defaultView)===null||c===void 0||(c=c.getSelection())===null||c===void 0||c.collapseToEnd()},allow:({state:s,range:i})=>{const o=s.doc.resolve(i.from),a=s.schema.nodes[t];return!!o.parent.type.contentMatch.matchType(a)},...e}}function h0(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>uP({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function lm(n,e){const t=h0(n),r=t.find(s=>s.char===e);return r||(t.length?t[0]:null)}const dP=pr.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,r;return`${(t=e?.char)!==null&&t!==void 0?t:"@"}${(r=n.attrs.label)!==null&&r!==void 0?r:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var r,s;return["span",pn(this.HTMLAttributes,n.HTMLAttributes),`${(r=t?.char)!==null&&r!==void 0?r:"@"}${(s=e.attrs.label)!==null&&s!==void 0?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=lm(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",pn({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=pn({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof s=="string"?["span",pn({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...ZT({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(?:^|\s)(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,i,o]=r;e[s==="char"?"mentionSuggestionChar":s]=i??o,r=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:lm(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:s,anchor:i}=r;if(!s)return!1;let o=new go,a=0;return e.doc.nodesBetween(i-1,i,(c,u)=>{if(c.type.name===this.name)return t=!0,o=c,a=u,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,a,a+o.nodeSize),t})}},addProseMirrorPlugins(){return h0(this).map(cP)}});var fP=dP;const hP=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,pP=pr.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",pn(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,r,s,i,o;const a=(e=(t=n.attrs)===null||t===void 0?void 0:t.src)!==null&&e!==void 0?e:"",c=(r=(s=n.attrs)===null||s===void 0?void 0:s.alt)!==null&&r!==void 0?r:"",u=(i=(o=n.attrs)===null||o===void 0?void 0:o.title)!==null&&i!==void 0?i:"";return u?`![${c}](${a} "${u}")`:`![${c}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:r}=this.options.resize,s=new Set(["src","width","height"]);return({node:i,getPos:o,HTMLAttributes:a,editor:c})=>{const u=document.createElement("img");u.draggable=!1;const d=pn(this.options.HTMLAttributes,a);Object.entries(d).forEach(([S,I])=>{if(I!=null)switch(S){case"src":case"width":case"height":break;default:u.setAttribute(S,I)}}),d.src!==null&&(u.src=d.src);let f={...a};const h=S=>{if(typeof S=="string"&&S!==""){u.getAttribute("src")!==S&&(u.src=S);return}u.hasAttribute("src")&&u.removeAttribute("src"),u.src!==""&&(u.src="")};h(a.src);const p=S=>{if(S.type!==i.type)return!1;const I=c.extensionManager.attributes.filter(M=>M.type===S.type.name),C=sa(S,I);return Object.keys(f).forEach(M=>{!s.has(M)&&!(M in C)&&u.removeAttribute(M)}),Object.entries(C).forEach(([M,O])=>{s.has(M)||(O!=null?u.setAttribute(M,O):u.removeAttribute(M))}),h(C.src),f=C,!0},g=new _E({element:u,editor:c,node:i,getPos:o,onResize:(S,I)=>{u.style.width=`${S}px`,u.style.height=`${I}px`},onCommit:(S,I)=>{const C=o();C!==void 0&&this.editor.chain().setNodeSelection(C).updateAttributes(this.name,{width:S,height:I}).run()},onUpdate:p,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),v=g.dom,m=()=>{v.style.visibility="",v.style.pointerEvents=""};return v.style.visibility="hidden",v.style.pointerEvents="none",u.complete&&u.naturalWidth>0?m():(u.onload=m,u.onerror=m),g}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Ey({find:hP,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var gP=pP;const p0="TipTapNodeView";class mP{constructor(e,{element:t,props:r}){nt(this,"component");nt(this,"props");nt(this,"dom");this.component=e,this.props=r,this.dom=t,this.dom.classList.add("svelte-renderer")}updateProps(e){Object.assign(this.props,e)}updateAttributes(e){Object.keys(e).forEach(t=>{this.dom.setAttribute(t,e[t])})}destroy(){io(this.component)}}class vP extends SE{mount(){const e=this.component,t=Ar({editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode()});this.contentDOMElement=this.node.isLeaf?null:document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit");const r=this.options.context||new rx;r.set(p0,{onDragStart:this.onDragStart.bind(this),contentDOMElement:this.contentDOMElement});const s=this.options.as??(this.node.isInline?"span":"div"),i=document.createElement(s);i.classList.add(`node-${this.node.type.name}`),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate);const o=vl(e,{target:i,props:t,context:r});this.renderer=new mP(o,{element:i,props:t}),this.appendContentDOM(),this.updateElementAttributes()}appendContentDOM(){const e=this.dom.querySelector("[data-node-view-content]");this.contentDOMElement&&e&&!e.contains(this.contentDOMElement)&&e.appendChild(this.contentDOMElement)}scheduleAppendContentDOM(){this.appendContentDOM(),queueMicrotask(()=>{this.contentDOMElement&&this.appendContentDOM()})}get dom(){return this.renderer.dom.firstElementChild?.hasAttribute("data-node-view-wrapper")||console.warn("Please use the NodeViewWrapper component for your node view."),this.renderer.dom}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const s=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(typeof this.options.update=="function"){const i=this.node,o=this.decorations,a=this.innerDecorations;this.node=e,this.decorations=t,this.innerDecorations=r;const c=this.options.update({oldNode:i,oldDecorations:o,oldInnerDecorations:a,newNode:e,newDecorations:t,newInnerDecorations:r,updateProps:()=>s({node:e,decorations:t,innerDecorations:r})});return this.scheduleAppendContentDOM(),c}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,s({node:e,decorations:t,innerDecorations:r}),this.scheduleAppendContentDOM()),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.dom.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.dom.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=sa(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function Vh(n,e){return t=>new vP(n,t,e)}var bP=new Set(["$$slots","$$events","$$legacy","as","children"]);function ju(n,e){if(new.target)return Nt({component:ju,...n});Lt(e,!0);const t=y(e,"as",7,"div"),r=y(e,"children",7),s=ui(e,bP),i=ow(p0);let o;Lf(async()=>{await qo(),o.style.whiteSpace="normal"});var a={get as(){return t()},set as(d="div"){t(d),b()},get children(){return r()},set children(d){r(d),b()},$set:Dt,$on:(d,f)=>$t(e,d,f)},c=Je(),u=ce(c);return vx(u,t,!1,(d,f)=>{Yn(d,v=>o=v,()=>o),oa(d,()=>({"data-node-view-wrapper":"",role:"none",...s,ondragstart:i?.onDragStart}));var h=Je(),p=ce(h);{var g=v=>{var m=Je(),S=ce(m);On(S,r),k(v,m)};V(p,v=>{r()&&v(g)})}k(f,h)}),k(n,c),Ot(a)}var yP=N('<div class="flex items-center gap-2" contenteditable="false"><!> <!></div>'),wP=N('<video controls="" preload="metadata" playsinline="" class="markdown-video max-w-full rounded-md" draggable="true"></video> <div class="absolute right-1.5 top-1.5 flex gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100" contenteditable="false"><!> <!></div>',3),xP=N('<div class="group relative inline-block max-w-full"><!></div>'),kP=N("<!> <!>",1);function g0(n,e){if(new.target)return Nt({component:g0,...n});Lt(e,!0);let t=y(e,"node",7),r=y(e,"selected",7),s=y(e,"editor",7),i=y(e,"extension",7),o=w(()=>t().attrs.src??""),a=w(()=>t().attrs.name||_.chat_videoBlock_fromAgent_label()),c=fe(!1),u=fe(null),d=fe(null),f=w(()=>i().options.workspaceId),h=w(()=>x1(l(o),l(f))?.mimeType),p=w(()=>Au(l(o))),g=w(()=>k1(l(o),l(f))),v=w(()=>l(p)?.path??l(g)?.path),m=w(()=>l(p)?.workspaceId??l(g)?.workspaceId??l(f));function S(P){P.preventDefault(),P.stopPropagation(),x(u,P.currentTarget instanceof HTMLElement?P.currentTarget:s().view.dom,!0),x(c,!0)}var I={get node(){return t()},set node(P){t(P),b()},get selected(){return r()},set selected(P){r(P),b()},get editor(){return s()},set editor(P){s(P),b()},get extension(){return i()},set extension(P){i(P),b()},$set:Dt,$on:(P,E)=>$t(e,P,E)},C=kP(),M=ce(C);{let P=w(()=>`note-video-node${r()?" selected":""}`);ju(M,{get class(){return l(P)},children:(E,z)=>{var G=xP(),J=te(G);{var K=$=>{var X=yP(),de=te(X);wv(de,{get name(){return l(a)},reason:"load-failed",get path(){return l(v)},get workspaceId(){return l(m)}});var me=R(de,2);Fc(me,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Q(X),k($,X)},Y=$=>{var X=wP(),de=ce(X),me=R(de,2),ie=te(me);{let j=w(()=>_.chat_videoBlock_play_ariaLabel({name:l(a)}));Ze(ie,{type:"button",variant:"ghost",size:"icon-xs",class:"flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white hover:bg-black/75 focus-visible:ring-2 focus-visible:ring-ring",onclick:S,get"aria-label"(){return l(j)},children:(ne,we)=>{ut(ne,{get icon(){return Iw},size:"sm"})},$$slots:{default:!0}})}var q=R(ie,2);Fc(q,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Q(me),L(()=>{xt(de,"src",l(o)),xt(de,"aria-label",l(a))}),xo("error",de,()=>x(d,l(o),!0)),k($,X)};V(J,$=>{l(d)===l(o)?$(K):$(Y,-1)})}Q(G),k(E,G)},$$slots:{default:!0}})}var O=R(M,2);return yv(O,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace",get openerElement(){return l(u)},get open(){return l(c)},set open(P){x(c,P,!0)}}),k(n,C),Ot(I)}const _P=pr.create({name:"video",group:"block",atom:!0,selectable:!0,addOptions(){return{workspaceId:void 0}},addAttributes(){return{src:{default:null},name:{default:null,parseHTML:n=>n.getAttribute("data-name"),renderHTML:n=>n.name?{"data-name":n.name}:{}}}},parseHTML(){return[{tag:"video.markdown-video"}]},renderHTML({HTMLAttributes:n}){return["video",pn(n,{class:"markdown-video",controls:"",preload:"metadata",playsinline:""})]},addNodeView(){return Vh(g0)}}),SP={note:"internal","linear-issue":"linear","github-issue":"github","github-pr":"github","sentry-issue":"sentry","browser-url":"browser"};var cm=N("<span><!></span>");function Pf(n,e){if(new.target)return Nt({component:Pf,...n});Lt(e,!0);let t=y(e,"provider",7),r=y(e,"itemType",7),s=y(e,"size",7,16),i=y(e,"class",7,"");const o=w(()=>t()??(r()?SP[r()]:"internal"));var a={get provider(){return t()},set provider(v){t(v),b()},get itemType(){return r()},set itemType(v){r(v),b()},get size(){return s()},set size(v=16){s(v),b()},get class(){return i()},set class(v=""){i(v),b()},$set:Dt,$on:(v,m)=>$t(e,v,m)},c=Je(),u=ce(c);{var d=v=>{zx(v,{get size(){return s()},get class(){return i()}})},f=v=>{nh(v,{get size(){return s()},get class(){return i()}})},h=v=>{Fx(v,{get size(){return s()},get class(){return i()}})},p=v=>{var m=cm(),S=te(m);ut(S,{get icon(){return zf},get size(){return`${s()??""}px`}}),Q(m),L(()=>{wt(m,1,Xn(i())),Hi(m,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),k(v,m)},g=v=>{var m=cm(),S=te(m);ut(S,{get icon(){return Ff},get size(){return`${s()??""}px`}}),Q(m),L(()=>{wt(m,1,Xn(i())),Hi(m,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),k(v,m)};V(u,v=>{l(o)==="linear"?v(d):l(o)==="github"?v(f,1):l(o)==="sentry"?v(h,2):l(o)==="browser"?v(p,3):v(g,-1)})}return k(n,c),Ot(a)}function uo(n,e){if(new.target)return Nt({component:uo,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(i=16){t(i),b()},get class(){return r()},set class(i=""){r(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return Lw(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Ot(s)}var CP=N('<span class="text-subtle shrink-0"> </span>'),MP=N('<span><!> <!> <span class="max-w-[180px] truncate"> </span></span>'),TP=N('<span class="text-ui font-medium text-subtle">·</span> <span class="text-ui font-medium text-subtle"> </span>',1),EP=N('<div class="text-sm font-medium text-foreground leading-snug"> </div>'),xc=N("<span> </span>"),AP=N('<span class="text-ui"> </span>'),kc=N('<span class="text-ui text-subtle"> </span>'),RP=N('<div class="flex flex-wrap items-center gap-1.5"><!> <!> <!> <!></div>'),PP=N('<span class="px-1.5 py-0.5 rounded-full text-ui font-medium bg-muted/50 text-subtle"> </span>'),IP=N('<div class="flex flex-wrap gap-1"><!> <!></div>'),LP=N('<div class="flex items-center gap-3 text-ui text-subtle"><!> <!></div>'),OP=N('<div class="text-xs text-subtle line-clamp-6"> </div>'),NP=N('<span class="text-ui text-subtle ml-auto"> </span>'),DP=N('<div class="flex items-center gap-2 pt-1 border-t border-border"><!> <!> <!></div>'),$P=N('<div class="space-y-2.5 max-w-80 min-w-56"><div class="flex items-center gap-1.5"><!> <span class="text-ui font-medium text-muted-foreground"> </span> <!></div> <!> <!> <!> <!> <!> <!></div>'),BP=Wi('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-3 h-3 text-muted-foreground hover:text-foreground"><path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"></path></svg>'),zP=N('<span class="context-mention-wrapper group/pill relative inline-flex items-center svelte-1qhjkt1"><!> <!></span> <!>',1);function m0(n,e){if(new.target)return Nt({component:m0,...n});Lt(e,!0);const t=bx()?.workspaceId??void 0;let r=y(e,"node",7),s=y(e,"selected",7),i=y(e,"deleteNode",7),o=fe(null),a=fe(!1);ft(()=>{const $=X=>{x(o,X.detail.branch,!0),x(a,!0)};return document.addEventListener("initializer-branch-updated",$),()=>{document.removeEventListener("initializer-branch-updated",$)}});function c($){$.preventDefault(),$.stopPropagation(),i()()}const u=w(()=>r().attrs.provider),d=w(()=>r().attrs.itemType),f=w(()=>r().attrs.title),h=w(()=>r().attrs.identifier),p=w(()=>r().attrs.url),g=w(()=>r().attrs.description),v=w(()=>()=>{const $=r().attrs.metadata;if(!$)return null;try{return JSON.parse($)}catch{return null}}),m=w(()=>()=>{if(l(u)==="github"&&l(h)){const $=l(h).match(/^([^/]+)\/([^#]+)#(\d+)$/);if($){const[,X,de,me]=$,q=!!l(v)()?.sourceBranch?"pull":"issues";return`https://github.com/${X}/${de}/${q}/${me}`}}return l(p)}),S=w(()=>()=>{const $=l(v)()?.sourceBranch;return $&&$.length>0?$:null}),I=w(()=>l(u)==="github"&&(l(d)==="github-pr"||l(d)==="github-issue")&&l(S)()!==null),C=w(()=>l(a)&&l(I)&&l(S)()&&l(S)()!==l(o));function M($){$.preventDefault(),$.stopPropagation();const X=l(S)();if(X){const de=new CustomEvent("switch-to-pr-branch",{detail:{branch:X,prIdentifier:l(h)},bubbles:!0});document.dispatchEvent(de)}}function O($){return $?xw($,{style:"narrow"}):""}function P($){if(!$)return"bg-muted text-subtle";const X=$.toLowerCase();return X.includes("progress")||X.includes("active")||X.includes("open")?"bg-blue-500/15 text-blue-500":X.includes("done")||X.includes("resolved")||X.includes("closed")||X.includes("complete")?"bg-green-500/15 text-green-500":X.includes("backlog")||X.includes("todo")||X.includes("triage")?"bg-muted text-subtle":X.includes("block")||X.includes("error")||X.includes("cancel")?"bg-red-500/15 text-red-500":"bg-muted text-subtle"}function E($){if(!$)return null;const X=$.toLowerCase();return X.includes("urgent")||X==="1"?{color:"bg-red-500",label:"🔴"}:X.includes("high")||X==="2"?{color:"bg-orange-500",label:"🟠"}:X.includes("medium")||X==="3"?{color:"bg-warning",label:"🟡"}:X.includes("low")||X==="4"?{color:"bg-blue-500",label:"🔵"}:null}function z($){if(!$)return"";const X=$.toLowerCase();return X==="error"||X==="fatal"?"text-danger":X==="warning"?"text-warning-ink":"text-subtle"}const G=w(()=>()=>l(d)==="browser-url"?l(f)||l(m)():l(h)&&l(f)?l(f):l(h)||l(f)),J=w(()=>()=>{switch(l(u)){case"linear":return"Linear";case"github":return"GitHub";case"sentry":return"Sentry";case"browser":return _.tiptap_contextMention_providerUrl_label();case"internal":return _.tiptap_contextMention_providerInternal_label();default:return l(u)}});async function K($){$.preventDefault(),$.stopPropagation();const X=l(m)();X&&t&&await jf(X,{workspaceId:Xm(t),event:$})}var Y={get node(){return r()},set node($){r($),b()},get selected(){return s()},set selected($){s($),b()},get deleteNode(){return i()},set deleteNode($){i($),b()},$set:Dt,$on:($,X)=>$t(e,$,X)};return ju(n,{as:"span",class:"inline",children:($,X)=>{var de=zP(),me=ce(de),ie=te(me);Zf(ie,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"20rem",trigger:Se=>{var se=MP(),oe=te(se);Pf(oe,{get provider(){return l(u)},size:12,class:"shrink-0 opacity-30"});var H=R(oe,2);{var W=ge=>{var ue=CP(),pe=re(ue,!0);L(()=>B(pe,l(h))),k(ge,ue)};V(H,ge=>{l(h)&&l(d)!=="browser-url"&&ge(W)})}var D=R(H,2),ae=re(D,!0);Q(se),L(ge=>{wt(se,1,`context-mention-pill inline-flex items-center gap-1 rounded-md px-1.5 py-1 pr-5 font-medium transition-colors
143
+ ${s()?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-muted/60 text-foreground/80 hover:bg-muted hover:text-foreground"}`,"svelte-1qhjkt1"),B(ae,ge)},[()=>l(G)()]),k(Se,se)},content:Se=>{const se=w(()=>l(v)()),oe=w(()=>l(se)?E(l(se).priority):null);var H=$P(),W=te(H),D=te(W);Pf(D,{get provider(){return l(u)},size:10,class:"opacity-40"});var ae=R(D,2),ge=re(ae,!0),ue=R(ae,2);{var pe=Be=>{var he=TP(),Ne=R(ce(he),2),je=re(Ne,!0);L(()=>B(je,l(h))),k(Be,he)};V(ue,Be=>{l(h)&&l(d)!=="browser-url"&&Be(pe)})}Q(W);var ke=R(W,2);{var ye=Be=>{var he=EP(),Ne=re(he,!0);L(()=>B(Ne,l(f))),k(Be,he)};V(ke,Be=>{l(f)&&Be(ye)})}var Z=R(ke,2);{var $e=Be=>{var he=RP(),Ne=te(he);{var je=Mt=>{var Ue=xc(),Ke=re(Ue,!0);L(Me=>{wt(Ue,1,`px-1.5 py-0.5 rounded text-ui font-medium ${Me??""}`,"svelte-1qhjkt1"),B(Ke,l(se).state)},[()=>P(l(se).state)]),k(Mt,Ue)};V(Ne,Mt=>{l(se).state&&Mt(je)})}var Tt=R(Ne,2);{var ee=Mt=>{var Ue=AP(),Ke=re(Ue,!0);L(()=>B(Ke,l(oe).label)),k(Mt,Ue)};V(Tt,Mt=>{l(oe)&&Mt(ee)})}var Ge=R(Tt,2);{var it=Mt=>{var Ue=xc(),Ke=re(Ue,!0);L(Me=>{wt(Ue,1,`text-ui font-medium ${Me??""}`,"svelte-1qhjkt1"),B(Ke,l(se).level)},[()=>z(l(se).level)]),k(Mt,Ue)};V(Ge,Mt=>{l(se).level&&l(u)==="sentry"&&Mt(it)})}var Xe=R(Ge,2);{var mt=Mt=>{var Ue=kc(),Ke=re(Ue);L(()=>B(Ke,`→ ${l(se).assignee??""}`)),k(Mt,Ue)};V(Xe,Mt=>{l(se).assignee&&Mt(mt)})}Q(he),k(Be,he)};V(Z,Be=>{l(se)&&(l(se).state||l(oe)||l(se).assignee)&&Be($e)})}var lt=R(Z,2);{var St=Be=>{var he=IP(),Ne=te(he);Cs(Ne,17,()=>l(se).labels.split(",").map(Ge=>Ge.trim()).filter(Boolean).slice(0,5),Tc,(Ge,it)=>{var Xe=PP(),mt=re(Xe,!0);L(()=>B(mt,l(it))),k(Ge,Xe)});var je=R(Ne,2);{var Tt=Ge=>{var it=kc(),Xe=re(it);L(mt=>B(Xe,`+${mt??""}`),[()=>l(se).labels.split(",").length-5]),k(Ge,it)},ee=w(()=>l(se).labels.split(",").length>5);V(je,Ge=>{l(ee)&&Ge(Tt)})}Q(he),k(Be,he)};V(lt,Be=>{l(se)?.labels&&Be(St)})}var De=R(lt,2);{var Le=Be=>{var he=LP(),Ne=te(he);{var je=Ge=>{var it=xc(),Xe=re(it,!0);L(mt=>B(Xe,mt),[()=>_.tiptap_contextMention_events_label({count:l(se).count})]),k(Ge,it)};V(Ne,Ge=>{l(se).count&&Ge(je)})}var Tt=R(Ne,2);{var ee=Ge=>{var it=xc(),Xe=re(it,!0);L(mt=>B(Xe,mt),[()=>_.tiptap_contextMention_users_label({count:l(se).userCount})]),k(Ge,it)};V(Tt,Ge=>{l(se).userCount&&Ge(ee)})}Q(he),k(Be,he)};V(De,Be=>{l(se)&&l(u)==="sentry"&&(l(se).count||l(se).userCount)&&Be(Le)})}var Ye=R(De,2);{var Ct=Be=>{var he=OP(),Ne=re(he,!0);L(()=>B(Ne,l(g))),k(Be,he)};V(Ye,Be=>{l(g)&&Be(Ct)})}var bt=R(Ye,2);{var sn=Be=>{var he=DP(),Ne=te(he);{var je=Xe=>{var mt=kc(),Mt=re(mt,!0);L(()=>B(Mt,l(se).project)),k(Xe,mt)};V(Ne,Xe=>{l(se).project&&Xe(je)})}var Tt=R(Ne,2);{var ee=Xe=>{var mt=kc(),Mt=re(mt,!0);L(Ue=>B(Mt,Ue),[()=>_.tiptap_contextMention_byAuthor_label({author:l(se).author})]),k(Xe,mt)};V(Tt,Xe=>{l(se).author&&Xe(ee)})}var Ge=R(Tt,2);{var it=Xe=>{var mt=NP(),Mt=re(mt,!0);L(Ue=>B(Mt,Ue),[()=>O(l(se).createdAt)]),k(Xe,mt)};V(Ge,Xe=>{l(se).createdAt&&Xe(it)})}Q(he),k(Be,he)};V(bt,Be=>{l(se)&&(l(se).project||l(se).createdAt||l(se).author)&&Be(sn)})}Q(H),L(Be=>B(ge,Be),[()=>l(J)()]),k(Se,H)},$$slots:{trigger:!0,content:!0}});var q=R(ie,2);{let we=w(()=>s()?"bg-primary/20 hover:bg-primary/30":"bg-muted/60 hover:bg-muted"),be=w(()=>_.tiptap_contextMention_remove_ariaLabel());Ze(q,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,onclick:c,get class(){return`delete-btn absolute right-0 top-0 bottom-0 w-5 h-auto rounded-r-md cursor-pointer
144
144
  opacity-0 group-hover/pill:opacity-100 transition-opacity
145
- ${l(we)??""}`},get"aria-label"(){return l(be)},children:(Se,se)=>{var oe=BP();k(Se,oe)},$$slots:{default:!0}})}Y(me);var j=R(me,2);{var ne=we=>{{let be=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Eu(we,{get content(){return l(be)},side:"top",delayDuration:200,children:(Se,se)=>{{let oe=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Ze(Se,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,onclick:M,class:"branch-switch-btn size-5 ml-1 rounded cursor-pointer transition-colors hover:bg-primary/20",get"aria-label"(){return l(oe)},children:(H,W)=>{uo(H,{size:12,class:"text-primary-ink hover:text-primary-ink/80"})},$$slots:{default:!0}})}},$$slots:{default:!0}})}};V(j,we=>{l(C)&&we(ne)})}Kr("click",me,K),k($,de)},$$slots:{default:!0}}),Ot(Q)}So(["click"]);const FP=pr.create({name:"contextMention",inline:!0,group:"inline",atom:!0,selectable:!0,addAttributes(){return{itemType:{default:"browser-url",parseHTML:n=>n.getAttribute("data-item-type"),renderHTML:n=>({"data-item-type":n.itemType})},provider:{default:"browser",parseHTML:n=>n.getAttribute("data-provider"),renderHTML:n=>({"data-provider":n.provider})},title:{default:"",parseHTML:n=>n.getAttribute("data-title")||n.textContent,renderHTML:n=>({"data-title":n.title})},url:{default:"",parseHTML:n=>n.getAttribute("data-url")||n.getAttribute("href"),renderHTML:n=>({"data-url":n.url})},identifier:{default:"",parseHTML:n=>n.getAttribute("data-identifier"),renderHTML:n=>({"data-identifier":n.identifier})},contextId:{default:null,parseHTML:n=>n.getAttribute("data-context-id"),renderHTML:n=>n.contextId?{"data-context-id":n.contextId}:{}},description:{default:"",parseHTML:n=>n.getAttribute("data-description"),renderHTML:n=>n.description?{"data-description":n.description}:{}},metadata:{default:"",parseHTML:n=>n.getAttribute("data-metadata"),renderHTML:n=>n.metadata?{"data-metadata":n.metadata}:{}}}},parseHTML(){return[{tag:'span[data-type="context-mention"]'}]},renderHTML({HTMLAttributes:n}){return["span",pn(n,{"data-type":"context-mention",class:"context-mention"}),n.title||n.identifier||_.tiptap_contextMention_link_fallback()]},addNodeView(){return Vh(m0)},addCommands(){return{insertContextMention:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});var HP=N('<span><!> <span class="whitespace-nowrap"> </span></span>'),UP=N('<div class="space-y-1.5 max-w-96 min-w-48"><div class="flex items-center gap-1.5"><!> <span class="text-ui font-medium text-muted-foreground"> </span> <span class="text-ui text-subtle"> </span></div> <div class="text-xs text-subtle whitespace-pre-wrap break-words leading-relaxed line-clamp-[12]"> </div></div>'),VP=N('<span class="paste-chip-wrapper group/pill relative inline-flex items-center svelte-15bxrq3"><!> <div class="absolute right-0.5 flex items-center"><!> <!></div></span>');function v0(n,e){if(new.target)return Nt({component:v0,...n});Lt(e,!0);let t=y(e,"node",7),r=y(e,"selected",7),s=y(e,"deleteNode",7),i=y(e,"editor",7),o=y(e,"getPos",7);const a=w(()=>t().attrs.content),c=w(()=>t().attrs.lineCount),u=w(()=>l(a).length>500?l(a).slice(0,500)+"...":l(a));function d(p){p.preventDefault(),p.stopPropagation(),s()()}function f(p){if(p.preventDefault(),p.stopPropagation(),!i()||!o())return;const g=o()();typeof g=="number"&&i().chain().focus().command(({tr:v})=>(l(a)?v.replaceWith(g,g+t().nodeSize,i().schema.text(l(a))):v.delete(g,g+t().nodeSize),!0)).run()}var h={get node(){return t()},set node(p){t(p),b()},get selected(){return r()},set selected(p){r(p),b()},get deleteNode(){return s()},set deleteNode(p){s(p),b()},get editor(){return i()},set editor(p){i(p),b()},get getPos(){return o()},set getPos(p){o(p),b()},$set:Dt,$on:(p,g)=>$t(e,p,g)};return ju(n,{as:"span",class:"inline",children:(p,g)=>{var v=VP(),m=te(v);Zf(m,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"24rem",trigger:P=>{var E=HP(),z=te(E);ut(z,{get icon(){return up},size:"xs",class:"shrink-0 opacity-40"});var G=R(z,2),J=re(G,!0);Y(E),L(K=>{wt(E,1,`paste-chip-pill inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 pr-9 text-xs font-medium transition-colors
146
- ${r()?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-muted/60 text-foreground/80 hover:bg-muted hover:text-foreground"}`,"svelte-15bxrq3"),B(J,K)},[()=>_.tiptap_pasteChip_pastedLines_label({count:as(l(c))})]),k(P,E)},content:P=>{var E=UP(),z=te(E),G=te(z);ut(G,{get icon(){return up},size:"xs",class:"opacity-40"});var J=R(G,2),K=re(J,!0),Q=R(J,2),$=re(Q);Y(z);var X=R(z,2),de=re(X,!0);Y(E),L((me,ie)=>{B(K,me),B($,`· ${ie??""}`),B(de,l(u))},[()=>_.tiptap_pasteChip_pastedText_label(),()=>_.tiptap_pasteChip_lines_label({count:as(l(c))})]),k(P,E)},$$slots:{trigger:!0,content:!0}});var S=R(m,2),I=te(S);{let M=w(()=>(r(),"")),O=w(()=>_.tiptap_pasteChip_expand_label()),P=w(()=>_.tiptap_pasteChip_expand_label());Ze(I,{variant:"ghost-light",size:"icon-xs",onclick:f,get class(){return`expand-btn px-0.5! w-auto! hover:z-20 text-muted-foreground hover:text-foreground!
145
+ ${l(we)??""}`},get"aria-label"(){return l(be)},children:(Se,se)=>{var oe=BP();k(Se,oe)},$$slots:{default:!0}})}Q(me);var j=R(me,2);{var ne=we=>{{let be=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Eu(we,{get content(){return l(be)},side:"top",delayDuration:200,children:(Se,se)=>{{let oe=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Ze(Se,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,onclick:M,class:"branch-switch-btn size-5 ml-1 rounded cursor-pointer transition-colors hover:bg-primary/20",get"aria-label"(){return l(oe)},children:(H,W)=>{uo(H,{size:12,class:"text-primary-ink hover:text-primary-ink/80"})},$$slots:{default:!0}})}},$$slots:{default:!0}})}};V(j,we=>{l(C)&&we(ne)})}Kr("click",me,K),k($,de)},$$slots:{default:!0}}),Ot(Y)}So(["click"]);const FP=pr.create({name:"contextMention",inline:!0,group:"inline",atom:!0,selectable:!0,addAttributes(){return{itemType:{default:"browser-url",parseHTML:n=>n.getAttribute("data-item-type"),renderHTML:n=>({"data-item-type":n.itemType})},provider:{default:"browser",parseHTML:n=>n.getAttribute("data-provider"),renderHTML:n=>({"data-provider":n.provider})},title:{default:"",parseHTML:n=>n.getAttribute("data-title")||n.textContent,renderHTML:n=>({"data-title":n.title})},url:{default:"",parseHTML:n=>n.getAttribute("data-url")||n.getAttribute("href"),renderHTML:n=>({"data-url":n.url})},identifier:{default:"",parseHTML:n=>n.getAttribute("data-identifier"),renderHTML:n=>({"data-identifier":n.identifier})},contextId:{default:null,parseHTML:n=>n.getAttribute("data-context-id"),renderHTML:n=>n.contextId?{"data-context-id":n.contextId}:{}},description:{default:"",parseHTML:n=>n.getAttribute("data-description"),renderHTML:n=>n.description?{"data-description":n.description}:{}},metadata:{default:"",parseHTML:n=>n.getAttribute("data-metadata"),renderHTML:n=>n.metadata?{"data-metadata":n.metadata}:{}}}},parseHTML(){return[{tag:'span[data-type="context-mention"]'}]},renderHTML({HTMLAttributes:n}){return["span",pn(n,{"data-type":"context-mention",class:"context-mention"}),n.title||n.identifier||_.tiptap_contextMention_link_fallback()]},addNodeView(){return Vh(m0)},addCommands(){return{insertContextMention:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});var HP=N('<span><!> <span class="whitespace-nowrap"> </span></span>'),UP=N('<div class="space-y-1.5 max-w-96 min-w-48"><div class="flex items-center gap-1.5"><!> <span class="text-ui font-medium text-muted-foreground"> </span> <span class="text-ui text-subtle"> </span></div> <div class="text-xs text-subtle whitespace-pre-wrap break-words leading-relaxed line-clamp-[12]"> </div></div>'),VP=N('<span class="paste-chip-wrapper group/pill relative inline-flex items-center svelte-15bxrq3"><!> <div class="absolute right-0.5 flex items-center"><!> <!></div></span>');function v0(n,e){if(new.target)return Nt({component:v0,...n});Lt(e,!0);let t=y(e,"node",7),r=y(e,"selected",7),s=y(e,"deleteNode",7),i=y(e,"editor",7),o=y(e,"getPos",7);const a=w(()=>t().attrs.content),c=w(()=>t().attrs.lineCount),u=w(()=>l(a).length>500?l(a).slice(0,500)+"...":l(a));function d(p){p.preventDefault(),p.stopPropagation(),s()()}function f(p){if(p.preventDefault(),p.stopPropagation(),!i()||!o())return;const g=o()();typeof g=="number"&&i().chain().focus().command(({tr:v})=>(l(a)?v.replaceWith(g,g+t().nodeSize,i().schema.text(l(a))):v.delete(g,g+t().nodeSize),!0)).run()}var h={get node(){return t()},set node(p){t(p),b()},get selected(){return r()},set selected(p){r(p),b()},get deleteNode(){return s()},set deleteNode(p){s(p),b()},get editor(){return i()},set editor(p){i(p),b()},get getPos(){return o()},set getPos(p){o(p),b()},$set:Dt,$on:(p,g)=>$t(e,p,g)};return ju(n,{as:"span",class:"inline",children:(p,g)=>{var v=VP(),m=te(v);Zf(m,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"24rem",trigger:P=>{var E=HP(),z=te(E);ut(z,{get icon(){return up},size:"xs",class:"shrink-0 opacity-40"});var G=R(z,2),J=re(G,!0);Q(E),L(K=>{wt(E,1,`paste-chip-pill inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 pr-9 text-xs font-medium transition-colors
146
+ ${r()?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-muted/60 text-foreground/80 hover:bg-muted hover:text-foreground"}`,"svelte-15bxrq3"),B(J,K)},[()=>_.tiptap_pasteChip_pastedLines_label({count:as(l(c))})]),k(P,E)},content:P=>{var E=UP(),z=te(E),G=te(z);ut(G,{get icon(){return up},size:"xs",class:"opacity-40"});var J=R(G,2),K=re(J,!0),Y=R(J,2),$=re(Y);Q(z);var X=R(z,2),de=re(X,!0);Q(E),L((me,ie)=>{B(K,me),B($,`· ${ie??""}`),B(de,l(u))},[()=>_.tiptap_pasteChip_pastedText_label(),()=>_.tiptap_pasteChip_lines_label({count:as(l(c))})]),k(P,E)},$$slots:{trigger:!0,content:!0}});var S=R(m,2),I=te(S);{let M=w(()=>(r(),"")),O=w(()=>_.tiptap_pasteChip_expand_label()),P=w(()=>_.tiptap_pasteChip_expand_label());Ze(I,{variant:"ghost-light",size:"icon-xs",onclick:f,get class(){return`expand-btn px-0.5! w-auto! hover:z-20 text-muted-foreground hover:text-foreground!
147
147
  ${l(M)??""}`},get"aria-label"(){return l(O)},get tooltip(){return l(P)},children:(E,z)=>{ut(E,{get icon(){return Ow},size:10,class:""})},$$slots:{default:!0}})}var C=R(I,2);{let M=w(()=>(r(),"")),O=w(()=>_.tiptap_pasteChip_remove_ariaLabel());Ze(C,{variant:"ghost-light",size:"icon-xs",onclick:d,get class(){return`delete-btn px-0.5! -ml-px w-auto! hover:z-20 text-muted-foreground hover:text-foreground!
148
- ${l(M)??""}`},get"aria-label"(){return l(O)},children:(P,E)=>{ut(P,{get icon(){return Fi},size:10,class:""})},$$slots:{default:!0}})}Y(S),Y(v),k(p,v)},$$slots:{default:!0}}),Ot(h)}const WP=pr.create({name:"pasteChip",inline:!0,group:"inline",atom:!0,selectable:!0,addAttributes(){return{content:{default:"",parseHTML:n=>n.getAttribute("data-content"),renderHTML:n=>({"data-content":n.content})},lineCount:{default:0,parseHTML:n=>Number(n.getAttribute("data-line-count"))||0,renderHTML:n=>({"data-line-count":String(n.lineCount)})}}},parseHTML(){return[{tag:'span[data-type="paste-chip"]'}]},renderHTML({HTMLAttributes:n}){return["span",pn(n,{"data-type":"paste-chip",class:"paste-chip"}),_.tiptap_pasteChip_pastedLines_label({count:n["data-line-count"]||0})]},renderText({node:n}){return n.attrs.content||""},addNodeView(){return Vh(v0)},addCommands(){return{insertPasteChip:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function b0(n,e,t){const r=n.resolve(e),s=n.resolve(t),i=c=>c.type.name==="hardBreak"?`
148
+ ${l(M)??""}`},get"aria-label"(){return l(O)},children:(P,E)=>{ut(P,{get icon(){return Fi},size:10,class:""})},$$slots:{default:!0}})}Q(S),Q(v),k(p,v)},$$slots:{default:!0}}),Ot(h)}const WP=pr.create({name:"pasteChip",inline:!0,group:"inline",atom:!0,selectable:!0,addAttributes(){return{content:{default:"",parseHTML:n=>n.getAttribute("data-content"),renderHTML:n=>({"data-content":n.content})},lineCount:{default:0,parseHTML:n=>Number(n.getAttribute("data-line-count"))||0,renderHTML:n=>({"data-line-count":String(n.lineCount)})}}},parseHTML(){return[{tag:'span[data-type="paste-chip"]'}]},renderHTML({HTMLAttributes:n}){return["span",pn(n,{"data-type":"paste-chip",class:"paste-chip"}),_.tiptap_pasteChip_pastedLines_label({count:n["data-line-count"]||0})]},renderText({node:n}){return n.attrs.content||""},addNodeView(){return Vh(v0)},addCommands(){return{insertPasteChip:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function b0(n,e,t){const r=n.resolve(e),s=n.resolve(t),i=c=>c.type.name==="hardBreak"?`
149
149
  `:"",o=e>r.start()?n.textBetween(e-1,e,`
150
150
  `,i):`
151
151
  `,a=t<s.end()?n.textBetween(t,t+1,`
152
152
  `,i):`
153
153
  `;return a===" "&&(o===" "||o===`
154
154
  `)?[e,t+1]:o===" "&&a===`
155
- `?[e-1,t]:[e,t]}const KP=pr.create({name:"screenReference",inline:!0,group:"inline",atom:!0,selectable:!0,draggable:!1,addOptions(){return{references:()=>[]}},addAttributes(){return{id:{default:"",renderHTML:()=>({})},number:{default:0,renderHTML:()=>({})},label:{default:"",renderHTML:()=>({})},kind:{default:null,renderHTML:()=>({})}}},parseHTML(){return[{tag:"span[data-screen-reference]",getAttrs:n=>{const e=n.getAttribute("data-screen-reference"),t=this.options.references().find(r=>r.id===e);return t?{...t}:!1}}]},renderHTML({node:n,HTMLAttributes:e}){const{id:t,number:r,label:s,kind:i}=n.attrs,o=as(r);return["span",pn(e,{"data-screen-reference":t,"data-reference-number":r,...i?{"data-reference-kind":i}:{},class:"screen-reference-chip",contenteditable:"false",role:"img","aria-label":i?s:_.chat_screenReference_ariaLabel({number:o,label:s})}),i?s:o]},renderText({node:n}){const{number:e,kind:t}=n.attrs;return t==="clip-start"?`[[clip:${e}]]`:t==="clip-end"?`[[clip:${e}:end]]`:`[[mark:${e}]]`},addKeyboardShortcuts(){const n=e=>{const{state:t,view:r}=this.editor;if(r.composing||!t.selection.empty)return!1;const{$from:s,from:i}=t.selection,o=e==="before"?s.nodeBefore:s.nodeAfter;if(o?.type!==this.type)return!1;const a=e==="before"?i-o.nodeSize:i;return r.dispatch(t.tr.delete(...b0(t.doc,a,a+o.nodeSize))),!0};return{Backspace:()=>n("before"),Delete:()=>n("after")}}}),fo=new Dn("screenInterim"),jP=zn.create({name:"screenInterim",addProseMirrorPlugins(){return[new kn({key:fo,state:{init:()=>null,apply(n,e){const t=n.getMeta(fo);return t!==void 0?t:e?{...e,anchor:n.mapping.map(e.anchor,1)}:null}},props:{decorations(n){const e=fo.getState(n);if(!e?.parts.length)return Yt.empty;const t=new Map(e.references.map(r=>[r.id,r]));return Yt.create(n.doc,[Rr.widget(Math.max(0,Math.min(e.anchor,n.doc.content.size)),()=>{const r=document.createElement("span");r.className="screen-interim",r.contentEditable="false",r.setAttribute("role","status"),r.setAttribute("aria-label",e.ariaLabel),r.setAttribute("data-screen-interim","");for(const s of e.parts)if(s.kind==="text")r.append(document.createTextNode(s.text));else{const i=t.get(s.markId);if(!i)continue;const o=document.createElement("span");o.className="screen-reference-chip",o.textContent=i.kind?i.label:as(i.number),i.kind&&(o.dataset.referenceKind=i.kind),o.setAttribute("aria-label",i.label),r.append(o)}return r.append(document.createTextNode("…")),r},{key:JSON.stringify([e.parts,e.references]),side:-1,ignoreSelection:!0})])}}})]}}),Gu="screen-reference-sync",Wh="screen-evidence-insertion";function y0(n){return n.kind==="clip-start"?`[[clip:${n.number}]]`:n.kind==="clip-end"?`[[clip:${n.number}:end]]`:`[[mark:${n.number}]]`}function GP(n,e){if(e.length===0||!/\[\[(mark|clip):/.test(n))return n;const t=new Map(e.map(o=>[y0(o),o])),r=document.createElement("template");r.innerHTML=n;const s=document.createTreeWalker(r.content,NodeFilter.SHOW_TEXT),i=[];for(;s.nextNode();)i.push(s.currentNode);for(const o of i){if(o.parentElement?.closest('[contenteditable="false"]'))continue;const a=o.data,c=[...a.matchAll(/\[\[(?:mark:[1-9]\d*|clip:[1-9]\d*(?::end)?)\]\]/g)];if(!c.some(f=>t.has(f[0])))continue;const u=document.createDocumentFragment();let d=0;for(const f of c){const h=t.get(f[0]);if(!h)continue;u.append(a.slice(d,f.index));const p=document.createElement("span");p.dataset.screenReference=h.id,p.textContent=h.kind?h.label:String(h.number),u.append(p),d=f.index+f[0].length}u.append(a.slice(d)),o.replaceWith(u)}return r.innerHTML}function qP(n,e){if(n.isDestroyed||n.view.composing)return!1;const t=new Map(e.map(s=>[s.id,s])),r=n.state.tr;return n.state.doc.descendants((s,i)=>{if(s.type.name!=="screenReference")return;const o=t.get(s.attrs.id),a=r.mapping.map(i);o?(s.attrs.number!==o.number||s.attrs.label!==o.label||(s.attrs.kind??null)!==(o.kind??null))&&r.setNodeMarkup(a,void 0,{kind:null,...o}):r.delete(...b0(r.doc,a,a+s.nodeSize))}),r.docChanged?(r.setMeta("addToHistory",!1).setMeta(Gu,!0),n.view.dispatch(r),!0):!1}function JP(n,e){const t=n.schema.nodes.screenReference;if(n.isDestroyed||n.view.composing||!t||e.length===0)return!1;const r=new Map(e.map(o=>[y0(o),o])),s=[];if(n.state.doc.descendants((o,a)=>{if(!(!o.isText||!o.text||!o.text.includes("[[")))for(const c of o.text.matchAll(/\[\[(?:mark:[1-9]\d*|clip:[1-9]\d*(?::end)?)\]\]/g)){const u=r.get(c[0]);u&&s.push({from:a+c.index,to:a+c.index+c[0].length,reference:u})}}),s.length===0)return!1;const i=n.state.tr;for(const{from:o,to:a,reference:c}of s.reverse())i.replaceWith(o,a,t.create({kind:null,...c}));return i.setMeta("addToHistory",!1).setMeta(Gu,!0),n.view.dispatch(i),!0}function XP(n,e,t,r){if(n.isDestroyed||n.view.composing||!n.isEditable)return!1;const s=new Map(t.map(u=>[u.id,u]));if(e.parts.some(u=>u.kind==="mark"&&!s.has(u.markId)))return!1;const i=e.parts.flatMap(u=>{if(u.kind==="mark"){const h=s.get(u.markId);return h?[n.schema.nodes.screenReference.create({kind:null,...h})]:[]}const d=[],f=u.text.replace(/\r\n?/g,`
155
+ `?[e-1,t]:[e,t]}const KP=pr.create({name:"screenReference",inline:!0,group:"inline",atom:!0,selectable:!0,draggable:!1,addOptions(){return{references:()=>[]}},addAttributes(){return{id:{default:"",renderHTML:()=>({})},number:{default:0,renderHTML:()=>({})},label:{default:"",renderHTML:()=>({})},kind:{default:null,renderHTML:()=>({})}}},parseHTML(){return[{tag:"span[data-screen-reference]",getAttrs:n=>{const e=n.getAttribute("data-screen-reference"),t=this.options.references().find(r=>r.id===e);return t?{...t}:!1}}]},renderHTML({node:n,HTMLAttributes:e}){const{id:t,number:r,label:s,kind:i}=n.attrs,o=as(r);return["span",pn(e,{"data-screen-reference":t,"data-reference-number":r,...i?{"data-reference-kind":i}:{},class:"screen-reference-chip",contenteditable:"false",role:"img","aria-label":i?s:_.chat_screenReference_ariaLabel({number:o,label:s})}),i?s:o]},renderText({node:n}){const{number:e,kind:t}=n.attrs;return t==="clip-start"?`[[clip:${e}]]`:t==="clip-end"?`[[clip:${e}:end]]`:`[[mark:${e}]]`},addKeyboardShortcuts(){const n=e=>{const{state:t,view:r}=this.editor;if(r.composing||!t.selection.empty)return!1;const{$from:s,from:i}=t.selection,o=e==="before"?s.nodeBefore:s.nodeAfter;if(o?.type!==this.type)return!1;const a=e==="before"?i-o.nodeSize:i;return r.dispatch(t.tr.delete(...b0(t.doc,a,a+o.nodeSize))),!0};return{Backspace:()=>n("before"),Delete:()=>n("after")}}}),fo=new Dn("screenInterim"),jP=zn.create({name:"screenInterim",addProseMirrorPlugins(){return[new kn({key:fo,state:{init:()=>null,apply(n,e){const t=n.getMeta(fo);return t!==void 0?t:e?{...e,anchor:n.mapping.map(e.anchor,1)}:null}},props:{decorations(n){const e=fo.getState(n);if(!e?.parts.length)return Qt.empty;const t=new Map(e.references.map(r=>[r.id,r]));return Qt.create(n.doc,[Rr.widget(Math.max(0,Math.min(e.anchor,n.doc.content.size)),()=>{const r=document.createElement("span");r.className="screen-interim",r.contentEditable="false",r.setAttribute("role","status"),r.setAttribute("aria-label",e.ariaLabel),r.setAttribute("data-screen-interim","");for(const s of e.parts)if(s.kind==="text")r.append(document.createTextNode(s.text));else{const i=t.get(s.markId);if(!i)continue;const o=document.createElement("span");o.className="screen-reference-chip",o.textContent=i.kind?i.label:as(i.number),i.kind&&(o.dataset.referenceKind=i.kind),o.setAttribute("aria-label",i.label),r.append(o)}return r.append(document.createTextNode("…")),r},{key:JSON.stringify([e.parts,e.references]),side:-1,ignoreSelection:!0})])}}})]}}),Gu="screen-reference-sync",Wh="screen-evidence-insertion";function y0(n){return n.kind==="clip-start"?`[[clip:${n.number}]]`:n.kind==="clip-end"?`[[clip:${n.number}:end]]`:`[[mark:${n.number}]]`}function GP(n,e){if(e.length===0||!/\[\[(mark|clip):/.test(n))return n;const t=new Map(e.map(o=>[y0(o),o])),r=document.createElement("template");r.innerHTML=n;const s=document.createTreeWalker(r.content,NodeFilter.SHOW_TEXT),i=[];for(;s.nextNode();)i.push(s.currentNode);for(const o of i){if(o.parentElement?.closest('[contenteditable="false"]'))continue;const a=o.data,c=[...a.matchAll(/\[\[(?:mark:[1-9]\d*|clip:[1-9]\d*(?::end)?)\]\]/g)];if(!c.some(f=>t.has(f[0])))continue;const u=document.createDocumentFragment();let d=0;for(const f of c){const h=t.get(f[0]);if(!h)continue;u.append(a.slice(d,f.index));const p=document.createElement("span");p.dataset.screenReference=h.id,p.textContent=h.kind?h.label:String(h.number),u.append(p),d=f.index+f[0].length}u.append(a.slice(d)),o.replaceWith(u)}return r.innerHTML}function qP(n,e){if(n.isDestroyed||n.view.composing)return!1;const t=new Map(e.map(s=>[s.id,s])),r=n.state.tr;return n.state.doc.descendants((s,i)=>{if(s.type.name!=="screenReference")return;const o=t.get(s.attrs.id),a=r.mapping.map(i);o?(s.attrs.number!==o.number||s.attrs.label!==o.label||(s.attrs.kind??null)!==(o.kind??null))&&r.setNodeMarkup(a,void 0,{kind:null,...o}):r.delete(...b0(r.doc,a,a+s.nodeSize))}),r.docChanged?(r.setMeta("addToHistory",!1).setMeta(Gu,!0),n.view.dispatch(r),!0):!1}function JP(n,e){const t=n.schema.nodes.screenReference;if(n.isDestroyed||n.view.composing||!t||e.length===0)return!1;const r=new Map(e.map(o=>[y0(o),o])),s=[];if(n.state.doc.descendants((o,a)=>{if(!(!o.isText||!o.text||!o.text.includes("[[")))for(const c of o.text.matchAll(/\[\[(?:mark:[1-9]\d*|clip:[1-9]\d*(?::end)?)\]\]/g)){const u=r.get(c[0]);u&&s.push({from:a+c.index,to:a+c.index+c[0].length,reference:u})}}),s.length===0)return!1;const i=n.state.tr;for(const{from:o,to:a,reference:c}of s.reverse())i.replaceWith(o,a,t.create({kind:null,...c}));return i.setMeta("addToHistory",!1).setMeta(Gu,!0),n.view.dispatch(i),!0}function XP(n,e,t,r){if(n.isDestroyed||n.view.composing||!n.isEditable)return!1;const s=new Map(t.map(u=>[u.id,u]));if(e.parts.some(u=>u.kind==="mark"&&!s.has(u.markId)))return!1;const i=e.parts.flatMap(u=>{if(u.kind==="mark"){const h=s.get(u.markId);return h?[n.schema.nodes.screenReference.create({kind:null,...h})]:[]}const d=[],f=u.text.replace(/\r\n?/g,`
156
156
  `).split(`
157
- `);for(let h=0;h<f.length;h++)h>0&&d.push(n.schema.nodes.hardBreak.create()),f[h]&&d.push(n.schema.text(f[h]));return d});if(i.length===0)return!0;const o=i.map(u=>u.toJSON()),a=n.state.doc,c=r===void 0?void 0:et.near(a.resolve(Math.max(0,Math.min(r,a.content.size)))).from;return n.chain().setMeta(Wh,e.id).command(({commands:u})=>c===void 0?u.insertContent(o,{updateSelection:!0}):u.insertContentAt(c,o,{updateSelection:!0})).scrollIntoView().run()}function um(n){const e=[];return n.descendants(t=>{t.type.name==="screenReference"&&t.attrs.id&&e.push(t.attrs.id)}),e}function QP(n){if(!n.docChanged||n.getMeta(Gu)||n.getMeta(Wh))return null;const e=um(n.before),t=um(n.doc),r=e.filter(i=>!t.includes(i)),s=t.filter(i=>!e.includes(i));return r.length||s.length?{removed:r,restored:s}:null}const YP=pr.create({name:"skillCommand",inline:!0,group:"inline",atom:!0,selectable:!0,addAttributes(){return{name:{default:"",parseHTML:n=>n.getAttribute("data-skill-name")||"",renderHTML:n=>({"data-skill-name":n.name})}}},parseHTML(){return[{tag:'span[data-type="skill-command"]'}]},renderHTML({node:n,HTMLAttributes:e}){const t=`/${n.attrs.name||""}`;return["span",pn(e,{"data-type":"skill-command",class:"skill-command-chip type-code",role:"code","aria-label":t,contenteditable:"false"}),t]},renderText({node:n}){return`/${n.attrs.name||""}`},addCommands(){return{insertSkillCommand:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addKeyboardShortcuts(){return{Backspace:()=>{const{selection:n,doc:e}=this.editor.state;if(!n.empty)return!1;const{$from:t}=n,r=t.nodeBefore;if(r?.type.name===this.name)return this.editor.commands.deleteRange({from:t.pos-r.nodeSize,to:t.pos});if(r?.isText&&r.text?.endsWith(" ")){const s=e.resolve(t.pos-1).nodeBefore;if(s?.type.name===this.name)return this.editor.commands.deleteRange({from:t.pos-1-s.nodeSize,to:t.pos})}return!1},Delete:()=>{const{selection:n,doc:e}=this.editor.state;if(!n.empty)return!1;const{$from:t}=n,r=t.nodeAfter;if(r?.type.name!==this.name)return!1;const s=e.resolve(t.pos+r.nodeSize).nodeAfter,i=s?.isText&&s.text?.startsWith(" ")?1:0;return this.editor.commands.deleteRange({from:t.pos,to:t.pos+r.nodeSize+i})}}}});function ZP(n){return n.dataTransfer?.types.includes("Files")??!1}function eI(n){return n.clipboardData?.types?.includes("Files")??!1}var tI=N('<span class="path svelte-1ycni0y"> </span>'),nI=N('<div class="mention-hover-preview svelte-1ycni0y" role="tooltip"><div class="preview-content svelte-1ycni0y"><div class="preview-icon svelte-1ycni0y"><!></div> <div class="preview-text svelte-1ycni0y"><span class="filename svelte-1ycni0y"> </span> <!></div></div></div>');function w0(n,e){if(new.target)return Nt({component:w0,...n});Lt(e,!0);let t=y(e,"mention",7),r=y(e,"position",7),s=y(e,"onClose",7),i=fe(void 0);const o={file:Fo,"file-range":Fo,folder:Js,"source-folder":Js,note:Hd,"note-range":Hd,task:Fm,rule:Dw,command:zm,"external-source":zf,agent:Bm,member:Nw,personality:$m,workspace:Js,symbol:Fo};function a(){return o[t().type]||Fo}function c(){if(t().type==="member")return uw(t());const E=t().meta;return E?.relativePath||E?.fullPath||E?.path||""}function u(E){E.relatedTarget?.closest("[data-mention]")||s()?.()}function d(){let{x:z,y:G}=r();return z+250>window.innerWidth&&(z=window.innerWidth-250-10),G+30>window.innerHeight&&(G=r().y-30-10),{x:z,y:G}}const f=d(),h=c();var p={get mention(){return t()},set mention(E){t(E),b()},get position(){return r()},set position(E){r(E),b()},get onClose(){return s()},set onClose(E){s(E),b()},$set:Dt,$on:(E,z)=>$t(e,E,z)},g=nI(),v=te(g),m=te(v),S=te(m);{let E=w(a);ut(S,{get icon(){return l(E)}})}Y(m);var I=R(m,2),C=te(I),M=re(C,!0),O=R(C,2);{var P=E=>{var z=tI(),G=re(z,!0);L(()=>B(G,h)),k(E,z)};V(O,E=>{h&&E(P)})}return Y(I),Y(v),Y(g),Qn(g,E=>x(i,E),()=>l(i)),L((E,z)=>{Hi(g,`left: ${f.x??""}px; top: ${f.y??""}px`),xt(g,"aria-label",E),B(M,z)},[()=>_.chat_mentionPreview_ariaLabel(),()=>t().type==="member"?Of(t().label):t().label]),Kr("mouseout",g,u),Ss(1,g,()=>Ud,()=>({tier:"fast",y:0,scale:1})),Ss(2,g,()=>Vd,()=>({tier:"fast"})),k(n,g),Ot(p)}So(["mouseout"]);const dm={USE_DEFAULT_CONTEXT:{id:"use-default-context",type:"command",get label(){return _.chat_mentions_useDefaultContext_label()},get description(){return _.chat_mentions_useDefaultContext_description()},icon:"🔄",uri:"devspace://command/use-default-context"},CLEAR_CONTEXT:{id:"clear-context",type:"command",get label(){return _.chat_mentions_clearContext_label()},get description(){return _.chat_mentions_clearContext_description()},icon:"🗑️",uri:"devspace://command/clear-context"}};function Oi(n){return"items"in n||"subgroups"in n}function rI(n){if(!n||typeof n!="object")return!1;const e=n;return!(typeof e.id!="string"||typeof e.label!="string"||typeof e.uri!="string"||typeof e.type!="string"||e.subtitle!==void 0&&typeof e.subtitle!="string"||e.description!==void 0&&typeof e.description!="string"||e.icon!==void 0&&typeof e.icon!="string"||e.score!==void 0&&typeof e.score!="number"||e.group!==void 0&&typeof e.group!="string")}const x0={member:_.chat_mentionList_peopleSection_label,note:_.chat_mentionList_notesSection_label,agent:_.chat_mentionList_agentsSection_label,file:_.chat_mentionList_filesSection_label,folder:_.chat_mentionList_foldersSection_label,script:_.chat_mentionList_scriptsSection_label,terminal:_.chat_mentionList_terminalsSection_label,specialist:_.chat_mentionList_specialistsSection_label},fm="other";function sI(n){return Oi(n)?fm:n.type in x0?n.type:fm}function iI(n){const e=new Map;for(const t of n){const r=sI(t),s=e.get(r)??[];e.set(r,s),s.push(t)}return Array.from(e,([t,r])=>({key:t,label:(x0[t]??_.chat_mentionList_otherSection_label)(),items:r}))}const _c=Ga("BreadcrumbController");var Kl,jl,Gl;class k0{constructor(){ba(this,Kl,fe(Ar([])));ba(this,jl,fe(null));ba(this,Gl,fe(Ar([])));nt(this,"groupStack",[])}get _breadcrumbs(){return l(ri(this,Kl))}set _breadcrumbs(e){x(ri(this,Kl),e,!0)}get _currentGroup(){return l(ri(this,jl))}set _currentGroup(e){x(ri(this,jl),e,!0)}get _currentItems(){return l(ri(this,Gl))}set _currentItems(e){x(ri(this,Gl),e,!0)}get breadcrumbs(){return this._breadcrumbs}get currentGroup(){return this._currentGroup}get currentItems(){return this._currentItems}push(e){this._breadcrumbs=[...this._breadcrumbs,{id:e.id,label:e.label,icon:e.icon}],this._currentGroup=e.id,this.groupStack.push(e),e.items&&(this._currentItems=e.items),_c.debug("[BreadcrumbController] Pushed group:",e.label)}pop(){if(this._breadcrumbs.length===0)return!1;const e=this._breadcrumbs.slice(0,-1);if(this._breadcrumbs=e,e.length>0){const t=e[e.length-1];this._currentGroup=t.id;const r=this.groupStack[e.length-1];r?.items&&(this._currentItems=r.items)}else this._currentGroup=null,this._currentItems=[];return this.groupStack.pop(),_c.debug("[BreadcrumbController] Popped to:",this._currentGroup),!0}navigateToRoot(){this._breadcrumbs=[],this._currentGroup=null,this._currentItems=[],this.groupStack=[],_c.debug("[BreadcrumbController] Navigated to root")}navigateToBreadcrumb(e){if(e<0||e>=this._breadcrumbs.length)return;const t=this._breadcrumbs.slice(0,e+1);this._breadcrumbs=t;const r=t[e];this._currentGroup=r.id,this.groupStack=this.groupStack.slice(0,e+1);const s=this.groupStack[e];s?.items&&(this._currentItems=s.items),_c.debug("[BreadcrumbController] Navigated to breadcrumb:",r.label)}handleKeyboard(e){switch(e.key){case"ArrowLeft":if(this._breadcrumbs.length>0)return e.preventDefault(),e.stopPropagation(),this.pop();break;case"Escape":if(this._breadcrumbs.length>0)return e.preventDefault(),e.stopPropagation(),this.navigateToRoot(),!0;break}return!1}isInGroup(){return this._breadcrumbs.length>0}getCurrentPath(){return this._breadcrumbs.map(e=>e.label).join(" › ")}subscribeToBreadcrumbs(e){let t=this._breadcrumbs;return()=>{this._breadcrumbs!==t&&(t=this._breadcrumbs,e(this._breadcrumbs))}}subscribeToCurrentGroup(e){let t=this._currentGroup;return()=>{this._currentGroup!==t&&(t=this._currentGroup,e(this._currentGroup))}}subscribeToCurrentItems(e){let t=this._currentItems;return()=>{this._currentItems!==t&&(t=this._currentItems,e(this._currentItems))}}destroy(){this.navigateToRoot()}}Kl=new WeakMap,jl=new WeakMap,Gl=new WeakMap;const cl={file:"file","file-ts":"file-code","file-tsx":"file-code","file-js":"file-code","file-jsx":"file-code","file-svelte":"file-code","file-vue":"file-code","file-py":"file-code","file-rs":"file-code","file-go":"file-code","file-java":"file-code","file-cpp":"file-code","file-c":"file-code","file-h":"file-code","file-md":"file-text","file-json":"file-json","file-yaml":"file-json","file-yml":"file-json","file-toml":"file-json","file-xml":"file-json","file-html":"globe","file-css":"palette","file-scss":"palette","file-sass":"palette","file-less":"palette","file-sh":"terminal","file-bash":"terminal","file-zsh":"terminal","file-fish":"terminal","file-ps1":"terminal","file-bat":"terminal","file-cmd":"terminal","file-sql":"database","file-db":"database","file-sqlite":"database","file-env":"settings","file-config":"settings","file-ini":"settings","file-cfg":"settings","file-conf":"settings","file-lock":"lock","file-gitignore":"git-branch","file-dockerfile":"box","file-docker":"box","file-makefile":"wrench","file-cmake":"wrench","file-gradle":"wrench","file-maven":"wrench","file-package":"package","file-default":"file",folder:"folder","folder-open":"folder-open","folder-src":"folder-code","folder-lib":"folder-code","folder-components":"folder-code","folder-pages":"folder-code","folder-api":"folder-code","folder-utils":"folder-code","folder-helpers":"folder-code","folder-services":"folder-code","folder-models":"folder-code","folder-controllers":"folder-code","folder-views":"folder-code","folder-public":"folder-open","folder-static":"folder-open","folder-assets":"image","folder-images":"image","folder-img":"image","folder-icons":"image","folder-styles":"palette","folder-css":"palette","folder-scss":"palette","folder-tests":"test-tube","folder-test":"test-tube","folder-spec":"test-tube","folder-docs":"book-open","folder-documentation":"book-open","folder-config":"settings","folder-configuration":"settings","folder-settings":"settings","folder-node_modules":"package","folder-vendor":"package","folder-packages":"package","folder-dist":"package-check","folder-build":"package-check","folder-out":"package-check","folder-output":"package-check",note:"sticky-note","note-spec":"file-text","note-todo":"list-todo","note-meeting":"users","note-idea":"lightbulb","note-draft":"pen-tool",task:"check-square","task-bug":"bug","task-feature":"sparkles","task-improvement":"trending-up","task-refactor":"refresh-cw","task-test":"test-tube","task-docs":"book-open",rule:"shield","rule-lint":"shield-check","rule-format":"align-left","rule-security":"shield-alert",terminal:"terminal",script:"play","script-running":"play","script-stopped":"square","script-failed":"circle-exclamation",command:"terminal","command-run":"play","command-build":"hammer","command-test":"test-tube","command-deploy":"rocket",external:"external-link","external-docs":"book-open","external-api":"globe","external-github":"github","external-gitlab":"gitlab",personality:"user-tie","personality-senior":"user-graduate","personality-mentor":"chalkboard-teacher","personality-concise":"bolt","personality-creative":"palette","personality-analytical":"chart-line",member:"users",agent:"robot","agent-active":"robot","agent-idle":"robot","agent-busy":"robot",specialist:"user-tie","specialist-coordinator":"chalkboard-teacher","specialist-implementor":"hammer","specialist-verifier":"shield-check","specialist-pr-reviewer":"shield-check","specialist-ui-designer":"palette","specialist-developer":"wrench",group:"folder","group-files":"files","group-folders":"folders","group-notes":"sticky-note","group-tasks":"list-todo","group-rules":"shield","group-commands":"terminal","group-external":"external-link","group-personalities":"users","group-agents":"robot","group-specialists":"user-tie",default:"file"};function oI(n,e){if(e){const r=`${n}-${e}`;if(r in cl)return cl[r]}const t=n;return t in cl?cl[t]:cl.default}function _0(n,e){if(new.target)return Nt({component:_0,...n});Lt(e,!0);const t=()=>rn(o,"$session$",r),[r,s]=Jl();let i=y(e,"agentId",7);const o=dw(i()),a=w(()=>Zk(t()));var c={get agentId(){return i()},set agentId(d){i(d),b()},$set:Dt,$on:(d,f)=>$t(e,d,f)};uv(n,{get agentId(){return i()},variant:"compact",get state(){return l(a)}});var u=Ot(c);return s(),u}var aI=N('<span class="mention-agent-avatar svelte-myc5g6"><!></span>'),lI=N("<span><!></span>"),cI=N('<span class="mention-subtitle svelte-myc5g6"> </span>'),uI=N('<span class="group-arrow svelte-myc5g6"><!></span>'),dI=N('<!> <div class="mention-content svelte-myc5g6"><div class="mention-label-line svelte-myc5g6"><span class="mention-label svelte-myc5g6"> </span></div> <!></div> <!>',1),fI=N('<span class="breadcrumb-icon svelte-myc5g6"> </span>'),hI=N("<!> ",1),pI=N('<span class="breadcrumb-separator svelte-myc5g6">›</span> <!>',1),gI=N('<div class="breadcrumbs svelte-myc5g6"><!> <!></div>'),mI=N('<div class="mention-skeleton svelte-myc5g6"><div class="skeleton-icon svelte-myc5g6"></div> <div class="skeleton-text svelte-myc5g6"></div></div>'),vI=N('<div class="mention-loading svelte-myc5g6" role="status"></div>'),bI=N('<div class="mention-section-heading type-caption px-2 pt-2 pb-1 font-medium text-muted-foreground svelte-myc5g6" role="presentation"> </div>'),yI=N('<div class="mention-section svelte-myc5g6"><!> <!></div>'),wI=N('<div class="mention-items svelte-myc5g6" role="listbox" tabindex="-1"></div>'),xI=N('<div class="mention-empty svelte-myc5g6" role="status"> </div>'),kI=N('<div class="enhanced-mention-list svelte-myc5g6"><div class="mention-container svelte-myc5g6"><div class="mention-list-section svelte-myc5g6"><!> <!></div></div></div>');function Oc(n,e){const t=Vi();if(new.target)return Nt({component:Oc,...n});Lt(e,!0);const r=(W,D=ls)=>{const ae=w(()=>l(Q).indexOf(D())),ge=w(()=>S(D())),ue=w(()=>l(ae)===l(d)),pe=w(()=>!Oi(D())&&D().type==="agent"),ke=w(()=>!Oi(D())&&D().type==="member"),ye=w(()=>l(ke)?Of(D().label):D().label);{let Z=w(Jf),$e=w(()=>l(ue)?"selected":""),lt=w(()=>de(D())),St=w(()=>l(ke)&&D().subtitle?`${l(ye)} · ${D().subtitle}`:l(ye));Ze(W,{variant:"plain",wrapContent:!1,get class(){return`${l(Z)??""} mention-item ${l($e)??""}`},get id(){return l(lt)},role:"option",get"aria-selected"(){return l(ue)},get"aria-label"(){return l(St)},tabindex:-1,onpointerdown:De=>De.preventDefault(),onmousedown:De=>De.preventDefault(),onclick:()=>z(l(ae)),onmouseenter:()=>{l(v)||x(d,l(ae),!0)},children:(De,Le)=>{var Qe=dI(),Ct=ce(Qe);{var bt=Ue=>{{let Ke=w(()=>D().meta?.avatarUrl);Qm(Ue,{get avatarUrl(){return l(Ke)},get label(){return D().label},size:18})}},sn=Ue=>{var Ke=aI(),Me=te(Ke);_0(Me,{get agentId(){return D().id}}),Y(Ke),k(Ue,Ke)},Be=Ue=>{var Ke=lI();let Me;var Xt=te(Ke);ut(Xt,{get icon(){return l(ge)}}),Y(Ke),L(()=>Me=wt(Ke,1,"mention-icon svelte-myc5g6",null,Me,{selected:l(ue)})),k(Ue,Ke)};V(Ct,Ue=>{l(ke)?Ue(bt):l(pe)?Ue(sn,1):Ue(Be,-1)})}var he=R(Ct,2),Ne=te(he),je=te(Ne),Tt=re(je,!0);Y(Ne);var ee=R(Ne,2);{var Ge=Ue=>{var Ke=cI(),Me=re(Ke,!0);L(()=>B(Me,D().subtitle)),k(Ue,Ke)},it=w(()=>!Oi(D())&&D().subtitle);V(ee,Ue=>{l(it)&&Ue(Ge)})}Y(he);var Xe=R(he,2);{var mt=Ue=>{var Ke=uI(),Me=te(Ke);ut(Me,{get icon(){return dp},size:"xs"}),Y(Ke),k(Ue,Ke)},Mt=w(()=>Oi(D()));V(Xe,Ue=>{l(Mt)&&Ue(mt)})}L(()=>B(Tt,l(ye))),k(De,Qe)},$$slots:{default:!0}})}};let s=y(e,"items",23,()=>[]),i=y(e,"command",7),o=y(e,"onClose",7),a=y(e,"loading",7,!1),c=y(e,"listboxId",23,()=>`${t}-listbox`),u=y(e,"onActiveOptionChange",7),d=fe(0);const f=new k0,h=w(()=>f.breadcrumbs),p=w(()=>f.isInGroup()?f.currentItems:s());let g,v=fe(!0);const m=w(()=>typeof l(Q)<"u"&&l(Q).length>0?l(Q)[l(d)]||null:l(p)[l(d)]||null);function S(W){const D=Oi(W)?"group":W.type,ae=oI(D,W.subtype);return{file:Fo,"file-code":Wd,"file-text":Ff,"file-json":Wd,folder:Js,"folder-open":d1,"folder-code":Js,"sticky-note":Hd,"list-todo":u1,"check-square":c1,shield:l1,terminal:zm,"external-link":a1,globe:zf,palette:o1,database:i1,settings:s1,lock:r1,"git-branch":id,box:n1,wrench:t1,package:e1,image:Dc,"test-tube":Zw,"book-open":Yw,"package-check":Fm,users:Qw,lightbulb:Xw,"pen-tool":Jw,bug:qw,sparkles:Gw,"trending-up":jw,"refresh-cw":Kw,"shield-check":fp,"align-left":Ww,"shield-alert":fp,play:Vw,hammer:Uw,rocket:Hw,github:id,gitlab:id,files:Nm,folders:Js,"chevron-right":dp,"user-tie":$m,"user-graduate":Fw,"chalkboard-teacher":zw,bolt:Bw,robot:Bm,brain:$w}[ae]||Fo}ql(()=>f.destroy());function I(W){if(f?.handleKeyboard(W))return W.preventDefault(),W.stopPropagation(),!0;switch(W.key){case"ArrowUp":return W.preventDefault(),W.stopPropagation(),M(),!0;case"ArrowDown":return W.preventDefault(),W.stopPropagation(),O(),!0;case"ArrowRight":return!l(m)||!Oi(l(m))?!1:(W.preventDefault(),W.stopPropagation(),P(),!0);case"Enter":return W.preventDefault(),W.stopPropagation(),P(),!0;case"Escape":return W.preventDefault(),W.stopPropagation(),l(h).length>0?f.navigateToRoot():o()?.(),!0;default:return!1}}function C({event:W}){return I(W)}function M(){const W=l(Q).length;W!==0&&(x(d,(l(d)+W-1)%W),E())}function O(){const W=l(Q).length;W!==0&&(x(d,(l(d)+1)%W),E())}function P(){z(l(d))}async function E(){if(await qo(),!g)return;const W=g.querySelector(".mention-item.selected");if(!W)return;const D=l(K)?l(J).find(ae=>ae.items[0]===l(Q)[l(d)]):void 0;D&&document.getElementById(X(D))?.scrollIntoView?.({block:"nearest",behavior:"instant"}),W.scrollIntoView?.({block:"nearest",behavior:"instant"})}function z(W){const D=l(Q)[W];D&&(Oi(D)?(f.push(D),x(d,0)):i()(D))}function G(W){f.navigateToBreadcrumb(W),x(d,0)}ft(()=>{l(p),x(d,0),x(v,!0)});const J=w(()=>iI(Array.isArray(l(p))?l(p):[])),K=w(()=>l(J).length>1),Q=w(()=>l(J).flatMap(W=>W.items));function $(W){W.target instanceof Element&&W.target.closest(".mention-section-heading")&&W.preventDefault()}function X(W){return`${t}-section-${W.key}`}function de(W){return`${t}-option-${encodeURIComponent(`${Oi(W)?"group":W.type}:${W.id}`)}`}const me=w(()=>l(m)?de(l(m)):void 0);ft(()=>u()?.(l(me)));var ie={onKeyDown:C,get items(){return s()},set items(W=[]){s(W),b()},get command(){return i()},set command(W){i(W),b()},get onClose(){return o()},set onClose(W){o(W),b()},get loading(){return a()},set loading(W=!1){a(W),b()},get listboxId(){return c()},set listboxId(W=`${t}-listbox`){c(W),b()},get onActiveOptionChange(){return u()},set onActiveOptionChange(W){u(W),b()},$set:Dt,$on:(W,D)=>$t(e,W,D)},q=kI(),j=te(q),ne=te(j),we=te(ne);{var be=W=>{var D=gI(),ae=te(D);Ze(ae,{variant:"plain",class:"breadcrumb-item",onmousedown:ue=>ue.preventDefault(),onclick:()=>f.navigateToRoot(),children:(ue,pe)=>{Ht();var ke=Vt();L(ye=>B(ke,ye),[()=>_.chat_mentionList_all_label()]),k(ue,ke)},$$slots:{default:!0}});var ge=R(ae,2);Cs(ge,19,()=>l(h),(ue,pe)=>ue.id||`crumb-${pe}`,(ue,pe,ke)=>{var ye=pI(),Z=R(ce(ye),2);Ze(Z,{variant:"plain",class:"breadcrumb-item",onmousedown:$e=>$e.preventDefault(),onclick:()=>G(l(ke)),children:($e,lt)=>{var St=hI(),De=ce(St);{var Le=Ct=>{var bt=fI(),sn=re(bt,!0);L(()=>B(sn,l(pe).icon)),k(Ct,bt)};V(De,Ct=>{l(pe).icon&&Ct(Le)})}var Qe=R(De);L(()=>B(Qe,` ${l(pe).label??""}`)),k($e,St)},$$slots:{default:!0}}),k(ue,ye)}),Y(D),k(W,D)};V(we,W=>{l(h).length>0&&W(be)})}var Se=R(we,2);{var se=W=>{var D=vI();Cs(D,20,()=>[0,1,2,3],ae=>ae,(ae,ge)=>{var ue=mI(),pe=R(te(ue),2);Y(ue),L(()=>Hi(pe,`width: ${55+ge*12}%`)),k(ae,ue)}),Y(D),L(ae=>xt(D,"aria-label",ae),[()=>_.ui_combobox_loadingOptions_message()]),k(W,D)},oe=W=>{var D=wI();Cs(D,21,()=>l(J),ae=>ae.key,(ae,ge)=>{var ue=yI(),pe=te(ue);{var ke=Z=>{var $e=bI(),lt=re($e,!0);L(St=>{xt($e,"id",St),B(lt,l(ge).label)},[()=>X(l(ge))]),k(Z,$e)};V(pe,Z=>{l(K)&&Z(ke)})}var ye=R(pe,2);Cs(ye,17,()=>l(ge).items,Z=>de(Z),(Z,$e)=>{r(Z,()=>l($e))}),Y(ue),L(Z=>{xt(ue,"role",l(K)?"group":void 0),xt(ue,"aria-labelledby",Z)},[()=>l(K)?X(l(ge)):void 0]),k(ae,ue)}),Y(D),L(ae=>{xt(D,"id",c()),xt(D,"aria-label",ae),xt(D,"aria-activedescendant",l(me)),xt(D,"aria-busy",a())},[()=>_.chat_mentionList_ariaLabel()]),Kr("keydown",D,I),Kr("mousemove",D,()=>x(v,!1)),Kr("pointerdown",D,$),Kr("mousedown",D,$),k(W,D)},H=W=>{var D=xI(),ae=re(D,!0);L(ge=>B(ae,ge),[()=>_.chat_mentionList_noResults_label()]),k(W,D)};V(Se,W=>{a()&&l(p).length===0?W(se):l(p).length>0?W(oe,1):W(H,-1)})}return Y(ne),Y(j),Y(q),Qn(q,W=>g=W,()=>g),k(n,q),Ot(ie)}So(["keydown","mousemove","pointerdown","mousedown"]);class _I{constructor(e){nt(this,"unregisterPopup");nt(this,"component",null);nt(this,"popup",null);nt(this,"editorElement",null);nt(this,"inputContainer",null);nt(this,"listboxId",`mention-listbox-${crypto.randomUUID()}`);nt(this,"previousAria",new Map);nt(this,"generation",0);this.owner=e}attachPopup(){this.popup&&((this.owner?.target()??document.body).appendChild(this.popup),this.unregisterPopup=this.owner?.register(this.popup,()=>this.onExit()))}attachEditor(e){if(this.editorElement!==e){this.editorElement=e;for(const t of["aria-controls","aria-activedescendant","aria-haspopup"])this.previousAria.set(t,e.getAttribute(t))}}accessibilityProps(){return{listboxId:this.listboxId,onClose:()=>this.onExit(),onActiveOptionChange:e=>{!this.editorElement||!this.popup||(this.editorElement.setAttribute("aria-haspopup","listbox"),e?(this.editorElement.setAttribute("aria-controls",this.listboxId),this.editorElement.setAttribute("aria-activedescendant",e)):(this.editorElement.removeAttribute("aria-controls"),this.editorElement.removeAttribute("aria-activedescendant")))}}}onBeforeStart(e){this.owner&&!this.owner.active()||(this.generation++,this.cleanup(),e.editor?.view?.dom&&this.attachEditor(e.editor.view.dom),this.popup=document.createElement("div"),this.popup.className="mention-popup",this.attachPopup(),this.positionPopup(e),this.component=vl(Oc,{target:this.popup,props:{items:[],command:()=>{},loading:!0,...this.accessibilityProps()}}))}onStart(e){if(!(this.owner&&!this.owner.active())&&this.generation!==0){if(this.component&&this.popup){this.component.$set({items:e.items,command:e.command,loading:!1}),this.positionPopup(e);return}e.editor?.view?.dom&&this.attachEditor(e.editor.view.dom),this.popup=document.createElement("div"),this.popup.className="mention-popup",this.attachPopup(),this.positionPopup(e),this.component=vl(Oc,{target:this.popup,props:{items:e.items,command:e.command,loading:!1,...this.accessibilityProps()}})}}findInputContainer(){if(!this.editorElement)return null;let e=this.editorElement.closest(".rich-input-container");return e?(_t.info("[MentionSuggestionRenderer] Found .rich-input-container"),e):(e=this.editorElement.closest(".rich-textarea"),e?(_t.info("[MentionSuggestionRenderer] Found .rich-textarea"),e):(e=this.editorElement.closest('[style*="position"]'),e?(_t.info("[MentionSuggestionRenderer] Found positioned ancestor"),e):(_t.warn("[MentionSuggestionRenderer] Could not find input container"),null)))}positionPopup(e){if(!this.popup)return;if(!this.inputContainer&&this.editorElement&&(this.inputContainer=this.findInputContainer()),!this.inputContainer){_t.warn("[MentionSuggestionRenderer] No input container found, cannot position popup");return}const t=this.inputContainer.getBoundingClientRect(),r=window.innerHeight,s=window.innerWidth,i=8,o=4;this.popup.style.position="fixed",this.popup.style.width=`${Math.min(t.width,s-i*2)}px`;const a=this.popup.getBoundingClientRect().width;this.popup.style.left=`${Math.max(i,Math.min(t.left,s-a-i))}px`,this.popup.style.zIndex="1000";const c=r-t.bottom,u=t.top,f=c<300&&u>c;this.popup.style.setProperty("--mention-available-height",`${Math.max(0,(f?u:c)-o-i)}px`),f?(this.popup.style.top="auto",this.popup.style.bottom=`${r-t.top+o}px`):(this.popup.style.bottom="auto",this.popup.style.top=`${t.bottom+o}px`),_t.info("[MentionSuggestionRenderer] Popup positioned at:",{left:this.popup.style.left,width:this.popup.style.width,top:this.popup.style.top,bottom:this.popup.style.bottom,zIndex:this.popup.style.zIndex,spaceBelow:c,spaceAbove:u,positionedAbove:f})}onUpdate(e){if(this.generation!==0){if(_t.info("[MentionSuggestionRenderer] onUpdate called",{hasComponent:!!this.component,hasPopup:!!this.popup,itemsCount:e.items?.length}),!this.editorElement&&e.editor?.view?.dom&&this.attachEditor(e.editor.view.dom),!this.popup&&!this.component){_t.info("[MentionSuggestionRenderer] Initializing popup and component in onUpdate (onStart was skipped)"),this.onStart(e);return}this.component&&this.popup?(_t.info("[MentionSuggestionRenderer] Updating component props without remounting"),this.component.$set({items:e.items,command:e.command,loading:!1})):!this.component&&this.popup&&(_t.info("[MentionSuggestionRenderer] Creating component in onUpdate"),this.component=vl(Oc,{target:this.popup,props:{items:e.items,command:e.command,loading:!1,...this.accessibilityProps()}})),this.positionPopup(e)}}onKeyDown(e){return this.component?.onKeyDown?.(e)||!1}cleanup(){if(this.unregisterPopup?.(),this.unregisterPopup=void 0,this.editorElement)for(const[e,t]of this.previousAria)t===null?this.editorElement.removeAttribute(e):this.editorElement.setAttribute(e,t);this.previousAria.clear(),this.editorElement=null,this.inputContainer=null,this.popup&&this.popup.parentNode&&this.popup.parentNode.removeChild(this.popup),this.component&&io(this.component),this.popup=null,this.component=null}onExit(){this.generation=0,this.cleanup()}}function SI(n){const e=new _I(n);return{onBeforeStart:t=>e.onBeforeStart(t),onStart:t=>e.onStart(t),onUpdate:t=>e.onUpdate(t),onKeyDown:t=>e.onKeyDown(t),onExit:()=>e.onExit()}}function Nn(n,e){if(!n||!e)return null;const t=n.toLowerCase(),r=e.toLowerCase();let s=0;for(let a=0;a<r.length&&s<t.length;a++)r[a]===t[s]&&s++;if(s!==t.length)return null;const i=CI(t,r);return i?{score:MI(t,r,i),matches:i}:null}function CI(n,e){const t=[];let r=0;for(let s=0;s<n.length;s++){const i=n[s];let o=!1;for(let a=r;a<e.length;a++)if(e[a]===i){t.push(a),r=a+1,o=!0;break}if(!o)return null}return t}function MI(n,e,t){let r=0;r+=1;let s=0;for(let u=1;u<t.length;u++)t[u]===t[u-1]+1&&(s+=.1);r+=s;let i=0;for(const u of t)(u===0||TI(e,u))&&(i+=.15);r+=i,t[0]===0&&(r+=.2);const a=(t[t.length-1]-t[0])/e.length*.3;return r-=a,Math.min(r/2.5,1)}function TI(n,e){if(e===0)return!0;const t=n[e],r=n[e-1];return t===t.toUpperCase()&&r===r.toLowerCase()||!/[a-z0-9]/i.test(r)}function EI(n,e){if(!n||!e)return null;if(!n.includes("/"))return Nn(n,e);const t=n.split("/").filter(o=>o.length>0),r=e.split("/").filter(o=>o.length>0);if(t.length===0||r.length===0)return null;const s=AI(t,r);return s?{score:RI(t,r,s),matches:[]}:null}function AI(n,e){const t=[];let r=0;for(let s=0;s<n.length;s++){const i=n[s];let o=!1;const a=s===n.length-1;for(let c=r;c<e.length;c++){const u=e[c];if(Nn(i,u)){t.push(c),r=c+1,o=!0;break}if(a){const d=u.split(".")[0],f=u.includes(".")?u.split(".").pop():"";if(f&&Nn(i,f)){t.push(c),r=c+1,o=!0;break}if(d&&Nn(i,d)){t.push(c),r=c+1,o=!0;break}}}if(!o)return null}return t}function RI(n,e,t){let r=0;r+=1,r+=t.length*.2;let s=0;for(let o=1;o<t.length;o++)t[o]===t[o-1]+1&&(s+=.15);r+=s,t.length>0&&t[t.length-1]===e.length-1&&(r+=.3);for(let o=0;o<n.length&&o<t.length;o++){const a=n[o],c=e[t[o]];a.toLowerCase()===c.toLowerCase()&&(r+=.2)}return Math.min(r/3,1)}function Na(n,e,t){return JSON.stringify({query:n,workspaceId:t.workspaceId,repoPath:t.repoPath,currentFile:t.currentFile,currentNote:t.currentNote,providers:e.map(r=>[r.id,r.getCacheKey?.(t)])})}const S0="*",PI=["member","note","agent","file","folder","script","terminal",S0,"specialist"];function C0(n,e){if(e.length===0)return[...n].sort((s,i)=>(i.score??0)-(s.score??0));const t=new Map(e.map((s,i)=>[s,i])),r=t.get(S0)??e.length;return n.map(s=>({candidate:s,rank:t.get(s.type)??r})).sort((s,i)=>s.rank-i.rank||(i.candidate.score??0)-(s.candidate.score??0)).map(({candidate:s})=>s)}function II(n,e){const t=new Map;return n.filter(r=>{const s=t.get(r.type)??0;return t.set(r.type,s+1),s<e})}class LI{constructor(e={}){nt(this,"searchDebounceTimer",null);nt(this,"currentAbortController",null);nt(this,"cache",new Map);nt(this,"config");nt(this,"isSearching",!1);this.config={debounceMs:e.debounceMs??100,maxResults:e.maxResults??50,cacheMaxAge:e.cacheMaxAge??3e4,enableSemantic:e.enableSemantic??!1,enableLivePreview:e.enableLivePreview??!0,enableCollaboration:e.enableCollaboration??!1,typeOrder:e.typeOrder??[],maxResultsPerKind:e.maxResultsPerKind??20}}async search(e,t,r){this.cancelPendingSearch();const s=Na(e,t,r),i=this.cache.get(s);if(i&&!this.isCacheExpired(i))return _t.debug("[SearchService] Returning cached results for:",e),i.results;const o=new AbortController;this.currentAbortController=o;const a=o.signal;return new Promise((c,u)=>{this.isSearching=!0;let d=!1;const f=()=>{a.removeEventListener("abort",g),this.currentAbortController===o&&(this.currentAbortController=null,this.searchDebounceTimer=null,this.isSearching=!1)},h=m=>{d||(d=!0,f(),c(m))},p=m=>{d||(d=!0,f(),u(m))},g=()=>p(new DOMException("Search cancelled","AbortError"));a.addEventListener("abort",g,{once:!0});const v=async()=>{try{if(a.aborted){p(new DOMException("Search cancelled","AbortError"));return}_t.debug("[SearchService] Searching with providers:",t.map(E=>E.id));const m=Na(e,t,r),S=await Promise.all(t.map(E=>this.searchWithProvider(E,e,r,a)));if(a.aborted)return;if(m!==Na(e,t,r)){h([]);return}const C=this.combineResults(S.flat()).filter(E=>rI(E)),M=this.applyFuzzyMatching(e,C),O=C0(M,this.config.typeOrder),P=this.config.typeOrder.length>0?II(O,this.config.maxResultsPerKind):O.slice(0,this.config.maxResults);this.cache.set(m,{results:P,timestamp:Date.now()}),_t.debug(`[SearchService] Found ${P.length} results`),h(P)}catch(m){a.aborted?p(new DOMException("Search cancelled","AbortError")):(_t.error("[SearchService] Search error:",m),p(m instanceof Error?m:new Error(String(m))))}};e?this.searchDebounceTimer=setTimeout(v,this.config.debounceMs):v()})}async searchWithProvider(e,t,r,s){try{const i={...r,signal:s},o=await e.search(t,i),a=e.scoreRelevance?.bind(e);return a?o.map(c=>({...c,score:a(c,r)})):o}catch(i){return s.aborted||_t.error(`[SearchService] Provider ${e.id} search failed:`,i),[]}}combineResults(e){const t=new Set,r=[];for(const s of e){const i=`${s.type}:${s.uri}`;t.has(i)||(t.add(i),r.push(s))}return r}applyFuzzyMatching(e,t){if(!e||e.length===0)return t;const s=t.map(i=>{let o=0;const a=i.meta?.path||i.meta?.fullPath||(i.subtitle?`${i.subtitle}/${i.label}`:i.label);if(a){const u=EI(e,a);u&&(o=Math.max(o,u.score*1.8))}const c=Nn(e,i.label);if(c&&(o=Math.max(o,c.score*1.5)),i.subtitle){const u=Nn(e,i.subtitle);u&&(o=Math.max(o,u.score))}if(i.description){const u=Nn(e,i.description);u&&(o=Math.max(o,u.score*.5))}return{...i,score:o>0?o:i.score??0}}).filter(i=>i.score>0);return s.length>0?s:t}cancelPendingSearch(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=null),this.currentAbortController&&(this.currentAbortController.abort(),this.currentAbortController=null)}isCacheExpired(e){return Date.now()-e.timestamp>this.config.cacheMaxAge}clearCache(){this.cache.clear()}isLoading(){return this.isSearching}destroy(){this.cancelPendingSearch(),this.clearCache()}}class OI{constructor(){nt(this,"id","file");nt(this,"triggers",["@file","@f"]);nt(this,"default",!0);nt(this,"supportsRanges",!0);nt(this,"supportsLivePreview",!0);nt(this,"recentFiles",new Set);nt(this,"fileIconMap",{ts:"📘",tsx:"⚛️",js:"📜",jsx:"⚛️",svelte:"🔥",vue:"💚",py:"🐍",rs:"🦀",go:"🐹",java:"☕",cpp:"⚙️",c:"⚙️",h:"📎",md:"📝",json:"📋",yaml:"📋",yml:"📋",toml:"📋",xml:"📋",html:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sql:"🗃️",sh:"🖥️",bash:"🖥️",zsh:"🖥️",fish:"🖥️",dockerfile:"🐳",docker:"🐳",gitignore:"🚫",env:"🔐",lock:"🔒",test:"🧪",spec:"🧪"})}async search(e,t){_t.debug("[FileProvider] Searching for:",{query:e,context:{workspaceId:t.workspaceId}});const r=t.workspaceId;if(!r)return[];try{const s=await Wm("search.fileNames",{workspaceId:r,pattern:e||"",limit:10}),o=(Array.isArray(s?.files)?s.files:[]).map(a=>{const c=a.split("/").pop()||a,u=c.split(".").pop()||"";return{id:`file-${a}`,label:c,type:"file",uri:`file:${a}`,description:a,subtitle:a,score:.5,meta:{path:a,fullPath:a,relativePath:a,extension:u,language:this.getLanguageFromExtension(u)}}});return this.deduplicateAndDistinguish(o)}catch(s){return _t.error("[FileProvider] Search failed:",s),[]}}async searchRecent(e,t){if(!t.recentFiles||t.recentFiles.length===0)return[];const r=await Promise.all(t.recentFiles.filter(s=>e?Nn(e,s)!==null:!0).slice(0,3).map(s=>{const i=s.split("/").pop()||s,o=i.split(".").pop()||"";return this.fileToCandidate({path:s,name:i,extension:o})}));return r.forEach(s=>{this.recentFiles.add(s.uri)}),r}async searchContextual(e,t){return t.currentFile?[]:[]}async fileToCandidate(e){const t=this.getFileIcon(e.extension),r=e.path,s=this.formatPath(r);return{id:`file-${e.path}`,type:"file",label:e.name,subtitle:s,description:r,icon:t,uri:`devspace://file/${encodeURIComponent(e.path)}`,meta:{path:r,fullPath:e.path,lastModified:e.lastModified,size:e.size,language:e.language||this.getLanguageFromExtension(e.extension)}}}combineResults(...e){const t=new Set,r=[];for(const s of e)for(const i of s)t.has(i.uri)||(t.add(i.uri),r.push(i));return this.deduplicateAndDistinguish(r)}deduplicateAndDistinguish(e){const t=new Map;for(const s of e){const i=s.label;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(s)}const r=[];for(const[s,i]of t.entries())if(i.length===1)r.push(i[0]);else{const o=this.distinguishDuplicates(i);r.push(...o)}return r}distinguishDuplicates(e){const t=e.map(s=>s.description||s.meta?.path||"");return e.map((s,i)=>{const o=t[i],a=t.filter((d,f)=>f!==i),c=o.split("/");let u="";for(let d=c.length;d>0;d--){const f=c.slice(-d).join("/");if(!a.some(p=>p.split("/").slice(-d).join("/")===f)||d===1){u=f;break}}return{...s,subtitle:u}})}groupResults(e){const t={recent:[],relevant:[],other:[]};for(const s of e)this.recentFiles.has(s.uri)?t.recent.push(s):(s.score??0)>.7?t.relevant.push(s):t.other.push(s);const r=[];return t.recent.length>0&&r.push(...t.recent.slice(0,3).map(s=>({...s,group:_.chat_mentions_recentFiles_group()}))),t.relevant.length>0&&r.push(...t.relevant.slice(0,5).map(s=>({...s,group:_.chat_mentions_mostRelevant_group()}))),t.other.length>0&&r.push(...t.other.slice(0,10).map(s=>({...s,group:_.chat_mentions_otherFiles_group()}))),r}scoreRelevance(e,t){let r=.5;if(this.recentFiles.has(e.uri)&&(r+=.2),t.currentFile&&e.meta?.path){const s=t.currentFile.substring(0,t.currentFile.lastIndexOf("/")),i=e.meta.path.substring(0,e.meta.path.lastIndexOf("/"));s===i&&(r+=.15)}return t.imports?.includes(e.meta?.path||"")&&(r+=.25),t.currentFile?.includes(".test.")&&e.meta?.path?.includes(".test.")&&(r+=.1),Math.min(r,1)}getGroups(){return[{id:"files-recent",label:_.chat_mentions_recentFiles_group(),icon:"🕐"},{id:"files-all",label:_.chat_mentions_allFiles_group(),icon:"📁"},{id:"files-tests",label:_.chat_mentions_testFiles_group(),icon:"🧪"}]}getFileIcon(e){return this.fileIconMap[e.toLowerCase()]||"📄"}formatPath(e){if(e.length>40){const t=e.split("/");if(t.length>2)return`.../${t.slice(-2).join("/")}`}return e}getLanguageFromExtension(e){return{ts:"typescript",tsx:"typescriptreact",js:"javascript",jsx:"javascriptreact",py:"python",rs:"rust",go:"go",java:"java",cpp:"cpp",c:"c",svelte:"svelte",vue:"vue",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",html:"html",css:"css",scss:"scss",sql:"sql",sh:"shellscript"}[e.toLowerCase()]||"plaintext"}}class NI{constructor(){nt(this,"id","member")}getCacheKey(e){const t=It.state;return JSON.stringify({backendId:uk.select(t),ownPrincipalId:t.presence.ownPrincipalId,members:e.workspaceId?pp.select(t,e.workspaceId):[]})}async search(e,t){const{workspaceId:r}=t;if(!r)return[];const s=e.replace(/^@/,"").toLowerCase();return pp.select(It.state,r).filter(i=>i.login.toLowerCase().includes(s)).map(i=>({id:`member-${i.principalId}`,type:"member",label:i.login,subtitle:i.identity?`${i.identity.provider==="github"?"GitHub":"GitLab"} · ${i.identity.host}`:void 0,description:i.displayName??void 0,icon:"👤",uri:`devspace://member/${encodeURIComponent(i.principalId)}?workspaceId=${encodeURIComponent(r)}`,score:.8,meta:{workspaceId:r,principalId:i.principalId,identity:i.identity,avatarUrl:i.avatarUrl??void 0}}))}}class DI{constructor(){nt(this,"id","folder");nt(this,"triggers",["@folder","@dir"])}async search(e,t){const r=t.workspaceId;if(!r)return[];try{const{backendRequest:s}=await cs(async()=>{const{backendRequest:c}=await import("./Bgegixo2.js").then(u=>u.az);return{backendRequest:c}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url),i=await s("search.fileNames",{workspaceId:r,pattern:e||"",limit:200}),o=Array.isArray(i?.files)?i.files:[],a=new Set;for(const c of o){const u=c.split("/");for(let d=1;d<u.length;d++)a.add(u.slice(0,d).join("/"))}return[...a].filter(c=>e?Nn(e,c.split("/").pop()||c)!==null:!0).slice(0,10).map(c=>({id:`folder-${c}`,type:"folder",label:c.split("/").pop()||c,description:c,icon:"📁",uri:`devspace://folder/${encodeURIComponent(c)}`,meta:{path:c,fullPath:c,relativePath:c}}))}catch(s){return _t.debug("[FolderProvider] Failed to get folders:",s),[]}}}const $I=10,BI=.3;function zI(n){const e=n.toLowerCase().split(/\s+/).filter(Boolean);return(t,r)=>{const s=t?Nn(n,t):null;if(s)return 1+s.score;if(r){const i=r.toLowerCase();if(e.every(o=>i.includes(o)))return BI}return 0}}class FI{constructor(){nt(this,"id","note");nt(this,"triggers",["@note","@n"]);nt(this,"supportsRanges",!0);nt(this,"cachedNotes",[]);nt(this,"lastCacheUpdate",0);nt(this,"cacheTimeout",5e3)}async getSiblingWorkspaces(e){if(!e)return[];try{const[{store:t},{selectWorkspaceItems:r}]=await Promise.all([cs(()=>import("./i-jR1dYx.js"),__vite__mapDeps([13,14,15,2,16,17,11,5,3,1,9,18,19]),import.meta.url),cs(()=>import("./KQTrHxko.js").then(o=>o.dR),__vite__mapDeps([20,11,5,1,2,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24]),import.meta.url)]),s=r.select(t.state),i=s.find(o=>o.id===e);return!i||!i.repositoryPath?[]:s.filter(o=>o.id!==e&&o.repositoryPath===i.repositoryPath)}catch(t){return _t.debug("[NoteProvider] Failed to get sibling workspaces:",t),[]}}async fetchNotesFromWorkspace(e,t){try{const[{store:r},{listSlimNotesRequested:s}]=await Promise.all([cs(()=>import("./i-jR1dYx.js"),__vite__mapDeps([13,14,15,2,16,17,11,5,3,1,9,18,19]),import.meta.url),cs(()=>import("./CRwmdgt6.js").then(o=>o.Kw),__vite__mapDeps([14,15,2,16,17,11,5,3,1,9]),import.meta.url)]);return(await r.dispatch(s(e))).map(o=>({note:o,workspaceId:e,workspaceTitle:t}))}catch(r){_t.debug(`[NoteProvider] Failed to fetch notes from workspace ${e}:`,r)}return[]}async search(e,t){if(!t.workspaceId)return[];const r=e.trim(),s=r?zI(r):null;try{const i=await this.fetchNotesFromWorkspace(t.workspaceId),a=(await this.getSiblingWorkspaces(t.workspaceId)).map(p=>this.fetchNotesFromWorkspace(p.id,p.title)),u=(await Promise.all(a)).flat(),d=[...i,...u],h=(s?d.map(p=>({entry:p,score:s(p.note.title,p.note.content||p.note.contentPreview)})).filter(({score:p})=>p>0).sort((p,g)=>g.score-p.score):d.map(p=>({entry:p,score:void 0}))).slice(0,$I).map(({entry:{note:p,workspaceId:g,workspaceTitle:v},score:m})=>{const S=g===t.workspaceId,I=S?void 0:_.chat_mentions_fromWorkspace_subtitle({workspace:v||g}),C=p.content||p.contentPreview;return{candidate:{id:p.id,type:"note",label:p.title||p.id||_.chat_mentions_untitledNote_label(),subtitle:I,description:C?`${C.substring(0,100)}...`:"",icon:"📝",uri:`devspace://note/${p.id}`,meta:{preview:C?.substring(0,200)||"",workspaceId:g,...S?{}:{isExternalLink:!0}}},score:m}});if(this.cachedNotes=h.map(({candidate:p})=>p),this.lastCacheUpdate=Date.now(),h.length>0)return h.map(({candidate:p,score:g})=>g!==void 0?{...p,score:g}:p)}catch(i){_t.debug("[NoteProvider] Failed to fetch notes:",i)}return this.cachedNotes.length>0?s?this.cachedNotes.map(i=>({...i,score:s(i.label,i.meta?.preview)})).filter(i=>i.score>0).sort((i,o)=>o.score-i.score):this.cachedNotes:[]}getCachedNotes(){return Date.now()-this.lastCacheUpdate>this.cacheTimeout?[]:this.cachedNotes}}class HI{constructor(){nt(this,"id","external");nt(this,"triggers",["@docs","@external"])}async search(e,t){return[{id:"react-docs",label:"React Documentation",url:"https://react.dev",description:"Official React documentation"},{id:"mdn",label:"MDN Web Docs",url:"https://developer.mozilla.org",description:"Web technology documentation"},{id:"typescript",label:"TypeScript Handbook",url:"https://www.typescriptlang.org/docs/",description:"TypeScript documentation"}].filter(s=>!e||Nn(e,s.label)!==null).map(s=>({id:`external-${s.id}`,type:"external-source",label:s.label,description:s.description,icon:"📚",uri:`devspace://external/${s.id}`,meta:{url:s.url}}))}}class UI{constructor(){nt(this,"id","rule");nt(this,"triggers",["@rule","@intent"])}async search(e,t){return[{path:".intent/rules/cli.md",label:"CLI Rules"},{path:".intent/rules/frontend.md",label:"Frontend Rules"},{path:".intent/rules/python.md",label:"Python Rules"},{path:".intent/rules/sidecar.md",label:"Sidecar Rules"},{path:".intent/rules/systems.md",label:"Systems Rules"}].filter(s=>!e||Nn(e,s.label)!==null).map(s=>({id:s.path,type:"rule",label:s.label,subtitle:s.path,icon:"📚",uri:`devspace://rule/${encodeURIComponent(s.path)}`,meta:{path:s.path}}))}}class VI{constructor(){nt(this,"id","task");nt(this,"triggers",["@task","@todo"])}async search(e,t){return[{id:"task-1",label:"Implement authentication",status:"in_progress",assignee:"John Doe"},{id:"task-2",label:"Write tests",status:"not_started",assignee:"Jane Smith"},{id:"task-3",label:"Deploy to production",status:"completed",assignee:"Bob Johnson"}].filter(s=>!e||Nn(e,s.label)!==null).map(s=>({id:`task-${s.id}`,type:"task",label:s.label,subtitle:`${s.status} • ${s.assignee}`,icon:"📋",uri:`devspace://task/${s.id}`,meta:{taskStatus:s.status,assignee:s.assignee}}))}}class WI{constructor(){nt(this,"id","personality");nt(this,"triggers",["@personality","@persona"]);nt(this,"personalities",[{id:"auggie-personality-agent-default",name:"Agent Auggie",description:"Default helpful AI assistant",icon:"🤖",temperature:.7,model:"default",promptToken:"auggie-personality-agent-default"},{id:"auggie-personality-prototyper",name:"Prototyper Auggie",description:"Specialized in rapid prototyping",icon:"⚡",temperature:.7,model:"default",promptToken:"auggie-personality-prototyper"},{id:"auggie-personality-brainstorm",name:"Brainstorm Auggie",description:"Creative ideation and exploration",icon:"💡",temperature:.7,model:"default",promptToken:"auggie-personality-brainstorm"},{id:"auggie-personality-reviewer",name:"Reviewer Auggie",description:"Code review and feedback",icon:"🔍",temperature:.7,model:"default",promptToken:"auggie-personality-reviewer"}])}async search(e,t){return this.personalities.filter(r=>!e||Nn(e,r.name)!==null).map(r=>({id:r.id,type:"personality",label:r.name,subtitle:`${r.model}`,description:r.description,icon:r.icon,uri:`devspace://personality/${r.id}`,meta:{promptToken:r.promptToken}}))}}class KI{constructor(){nt(this,"id","command");nt(this,"triggers",["@cmd","@command"])}async search(e,t){return[dm.USE_DEFAULT_CONTEXT,dm.CLEAR_CONTEXT].filter(s=>!e||s.label.toLowerCase().includes(e.toLowerCase()))}}class jI{constructor(){nt(this,"id","terminal");nt(this,"triggers",["@terminal","@term"])}async search(e,t){try{const{terminalManager:r}=await cs(async()=>{const{terminalManager:v}=await import("./B2KJmqK3.js").then(m=>m.c);return{terminalManager:v}},__vite__mapDeps([25,2,1,26,27,9,5,28,29,14,15,16,17,11,3,0,4,6,7,8,10,12,22,30,31,32,33,34,35,36,23,37,38]),import.meta.url),{selectTerminals:s,selectTerminalDisplayName:i}=await cs(async()=>{const{selectTerminals:v,selectTerminalDisplayName:m}=await import("./DQ5DxPhl.js").then(S=>S.i);return{selectTerminals:v,selectTerminalDisplayName:m}},__vite__mapDeps([37,14,15,2,16,17,11,5,3,1,9]),import.meta.url),a=It.state;if(!t.workspaceId)return[];const c=s.select(a,t.workspaceId),u=r.loadTerminalMetadata(t.workspaceId),d=new Set,f=[];for(const v of c)d.add(v.id),f.push({id:v.id,name:i.select(a,t.workspaceId,v.id)});for(const v of u)d.has(v.terminalId)||(d.add(v.terminalId),f.push({id:v.terminalId,name:v.title||_.terminal_quakeOverlay_terminal_fallback()}));if(f.length===0)return[];const p=e?["terminal","term"].some(v=>v.startsWith(e.toLowerCase())||e.toLowerCase().startsWith(v)):!1;return(e&&!p?f.filter(v=>Nn(e,v.name)!==null):f).slice(0,10).map((v,m)=>({id:v.id,type:"terminal",label:v.name,subtitle:_.chat_mentions_terminalIndex_subtitle({index:m+1}),description:_.chat_mentions_terminalOutput_description(),icon:"💻",uri:`devspace://terminal/${encodeURIComponent(v.id)}`,meta:{workspaceId:t.workspaceId}}))}catch(r){return _t.debug("[TerminalProvider] Failed to get terminals:",r),[]}}}class GI{constructor(){nt(this,"id","script");nt(this,"triggers",["@script","@scripts"])}async search(e,t){try{const{selectScriptEntries:r}=await cs(async()=>{const{selectScriptEntries:c}=await import("./zXW6V5sa.js");return{selectScriptEntries:c}},__vite__mapDeps([39,14,15,2,16,17,11,5,3,1,9,40,20,21,8,4,6,22,0,7,10,12,23,24,41,27,26,42,43,44,30,29,45,46]),import.meta.url);if(!t.workspaceId)return[];const s=r.select(It.state,t.workspaceId);if(s.length===0)return[];const o=e?["script","scripts"].some(c=>c.startsWith(e.toLowerCase())||e.toLowerCase().startsWith(c)):!1;return(e&&!o?s.filter(c=>Nn(e,c.name)!==null||Nn(e,wp(c))!==null):s).slice(0,10).map(c=>{const u=c.runtime.status,d=Cp(u)?_.chat_mentions_scriptRunning_label():u==="exited"?_.chat_mentions_scriptExited_label():_.chat_mentions_scriptIdle_label();return{id:c.id,type:"script",label:c.name,subtitle:`${d} · ${wp(c)}`,description:_.chat_mentions_scriptOutput_description(),icon:"▶️",uri:`devspace://script/${encodeURIComponent(c.id)}`,meta:{workspaceId:t.workspaceId,command:c.command,status:Cp(u)?"ok":u==="exited"?"warning":void 0}}})}catch(r){return _t.debug("[ScriptProvider] Failed to get scripts:",r),[]}}}class qI{constructor(){nt(this,"id","specialist");nt(this,"triggers",["@specialist","@spec"])}async search(e,t){try{const r=sk.select(It.state);return!r||r.length===0?[]:r.filter(s=>e?Nn(e,s.name)!==null||Nn(e,s.id)!==null||Nn(e,s.description)!==null||Nn(e,"specialist")!==null:!0).map(s=>({id:`specialist-${s.id}`,type:"specialist",label:s.name,subtitle:s.description,description:s.description,icon:"👤",uri:`devspace://specialist/${encodeURIComponent(s.id)}`,group:"Specialists",score:.8,meta:{promptToken:`specialist/${s.id}`}})).slice(0,10)}catch(r){return _t.debug("[SpecialistProvider] Failed to get specialists:",r),[]}}}class JI{constructor(){nt(this,"id","agent");nt(this,"triggers",["@agent"])}async search(e,t){try{const{selectAllWorkspaceAgents:r}=await cs(async()=>{const{selectAllWorkspaceAgents:a}=await import("./KQTrHxko.js").then(c=>c.dQ);return{selectAllWorkspaceAgents:a}},__vite__mapDeps([20,11,5,1,2,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24]),import.meta.url),s=t.workspaceId;if(!s)return[];const i=r.select(It.state,s);if(i.length===0)return[];const o=[];for(const a of i){const c=a.id,u=a.name||c,d=a.metadata?.specialist||"";let f=a.metadata?.specialistName||"";if(d&&!f){const m=rk.select(It.state,d);m&&(f=m.name)}if(e){const m=Nn(e,u)!==null,S=Nn(e,"agent")!==null,I=f&&Nn(e,f)!==null,C=d&&Nn(e,d)!==null;if(!m&&!S&&!I&&!C)continue}const h=a.isStreaming?"responding":a.status||"active",p=[];f?p.push(f):p.push("Agent"),p.push(h);const g=a.messages?.length||0;g>0&&p.push(`${g} msg${g!==1?"s":""}`);const v=a.lastActivity||a.lastModified;v&&!a.isStreaming&&p.push(Hx(new Date(v))),o.push({id:c,type:"agent",label:u,subtitle:p.join(" · "),description:f?_.chat_mentions_specialistAgentInWorkspace_description({specialist:f}):_.chat_mentions_agentInWorkspace_description(),icon:"🤖",uri:`devspace://agent/${encodeURIComponent(c)}`,group:_.chat_mentions_agents_group(),score:.7,meta:{workspaceId:s}})}return o.slice(0,10)}catch(r){return _t.debug("[AgentProvider] Failed to get agents:",r),[]}}}class XI{constructor(){nt(this,"providers",new Map);nt(this,"defaultProviders",[]);this.register(new OI),this.register(new DI),this.register(new FI),this.register(new HI),this.register(new UI),this.register(new VI),this.register(new WI),this.register(new KI),this.register(new jI),this.register(new GI),this.register(new JI),this.register(new qI),this.register(new NI),this.defaultProviders=["file","folder","note","terminal","script","agent","specialist","member"]}register(e){this.providers.set(e.id,e),_t.debug("[ProviderRegistry] Registered provider:",e.id)}unregister(e){this.providers.delete(e)}get(e){return this.providers.get(e)}getAll(){return Array.from(this.providers.values())}getDefault(){return this.defaultProviders.map(e=>this.providers.get(e)).filter(Boolean)}getByTrigger(e){return Array.from(this.providers.values()).filter(t=>t.triggers?.includes(e))}async searchAll(e,t){const r=e.startsWith("@")?this.getByTrigger(e.split(" ")[0]):this.getDefault();return(await Promise.all(r.map(i=>i.search(e,t)))).flat()}}const Ca=new XI,QI=5e3,YI=8,ZI=100,eL=50,tL=/^devspace:\/\/[^\/]+\/([^\/]+)/,nL=[{id:"spec",label:"spec",type:"note",uri:"note:spec",score:1,get description(){return _.chat_mentions_specNote_description()}},{id:"plan",label:"plan",type:"note",uri:"note:plan",score:.95,get description(){return _.chat_mentions_planNote_description()}}],rL=[{id:"readme",label:"README.md",type:"file",uri:"file:README.md",score:.9},{id:"package",label:"package.json",type:"file",uri:"file:package.json",score:.85},{id:"tsconfig",label:"tsconfig.json",type:"file",uri:"file:tsconfig.json",score:.8},{id:"gitignore",label:".gitignore",type:"file",uri:"file:.gitignore",score:.75}],sL=[{id:"src",label:"src",type:"folder",uri:"folder:src",score:.7},{id:"lib",label:"lib",type:"folder",uri:"folder:lib",score:.65},{id:"components",label:"components",type:"folder",uri:"folder:components",score:.6}];function iL(n){return typeof n.getCachedNotes=="function"}class oL{constructor(e={}){nt(this,"searchService");nt(this,"breadcrumbController");nt(this,"resolvers",new Map);nt(this,"config");nt(this,"cachedResults",new Map);this.config={...e,typeOrder:e.typeOrder??PI},this.searchService=new LI(this.config),this.breadcrumbController=new k0}async search(e,t){if(!t?.workspaceId&&!t?.repoPath)return _t.error("[MentionSystem] search called without valid context (no workspaceId or repoPath)"),[];const r=(e||"").trim(),s=this.getProvidersForQuery(r);if(s.length===0)return _t.debug("[MentionSystem] No providers available for query:",r),[];try{return await this.searchService.search(r,s,t)}catch(i){return i instanceof DOMException&&i.name==="AbortError"||_t.error("[MentionSystem] Search failed:",i),[]}}searchSync(e,t){const r=e.toLowerCase();if(!t?.workspaceId&&!t?.repoPath)return _t.debug("[MentionSystem] searchSync called without workspaceId or repoPath - returning empty results"),[];const s=Na(e,this.getProvidersForQuery(e),t),i=Date.now();if(this.cachedResults.has(s)){const a=this.cachedResults.get(s);if(a&&i-a.timestamp<QI)return this.cachedResults.delete(s),this.cachedResults.set(s,a),a.results}this.updateCache(e,t).catch(a=>{_t.warn("[MentionSystem] Background cache update failed:",a)});const o=[];return o.push(...this.getNoteCandidates(r)),o.push(...this.filterCandidates(rL,r,3)),o.push(...this.filterCandidates(sL,r,2)),C0(o,this.config.typeOrder??[]).slice(0,YI)}getNoteCandidates(e){const t=Ca.get("note");if(t&&iL(t))try{return(t.getCachedNotes()||[]).filter(s=>!e||s.label&&typeof s.label=="string"&&s.label.toLowerCase().includes(e)).slice(0,3)}catch(r){_t.warn("[MentionSystem] Failed to get cached notes:",r)}return this.filterCandidates(nL,e,3)}filterCandidates(e,t,r){return t?e.filter(s=>s.label.toLowerCase().includes(t)).slice(0,r):e.slice(0,r)}async updateCache(e,t){try{const r=Na(e,this.getProvidersForQuery(e),t),s=await this.search(e,t);if(r!==Na(e,this.getProvidersForQuery(e),t))return;const i={results:s,timestamp:Date.now()};this.cachedResults.delete(r),this.cachedResults.set(r,i);const o=Ca.get("note");if(o&&await o.search(e,t),this.cachedResults.size>ZI){const a=this.cachedResults.size-eL,c=Array.from(this.cachedResults.keys()).slice(0,a);for(const u of c)this.cachedResults.delete(u);_t.debug(`[MentionSystem] Cache cleanup: removed ${a} entries`)}}catch(r){_t.warn("[MentionSystem] Cache update failed:",r)}}getProvidersForQuery(e){if(!e)return Ca.getDefault();if(e.startsWith("@")){const r=e.indexOf(" "),s=r>0?e.substring(0,r):e,i=Ca.getByTrigger(s);if(i.length>0)return _t.debug("[MentionSystem] Using triggered providers for:",s),i}const t=Ca.getDefault();return _t.debug("[MentionSystem] Using default providers, count:",t.length),t}async resolve(e){if(!e||typeof e!="string")return _t.warn("[MentionSystem] Invalid URI provided to resolve:",e),{exists:!1,type:"file",label:"Invalid URI",error:"Invalid URI provided"};const t=this.findResolver(e);if(!t)return _t.debug("[MentionSystem] No resolver found for URI:",e),{exists:!1,type:"file",label:"Unknown",error:`No resolver found for URI: ${e}`};try{return await t.resolve(e)}catch(r){const s=r instanceof Error?r.message:String(r);return _t.error("[MentionSystem] Resolution error:",{uri:e,error:s}),{exists:!1,type:"file",label:"Error",error:s}}}async getPreview(e){if(!e||typeof e!="string")return _t.warn("[MentionSystem] Invalid URI provided to getPreview:",e),null;try{return(await this.resolve(e)).preview||null}catch(t){return _t.error("[MentionSystem] Failed to get preview:",t),null}}registerProvider(e){if(!e){_t.error("[MentionSystem] Cannot register null/undefined provider");return}if(!e.id){_t.error("[MentionSystem] Cannot register provider without id");return}try{Ca.register(e),_t.debug(`[MentionSystem] Registered provider: ${e.id}`)}catch(t){_t.error("[MentionSystem] Failed to register provider:",t)}}registerResolver(e,t){if(!e||!t){_t.error("[MentionSystem] Cannot register resolver with invalid type or resolver");return}this.resolvers.has(e)&&_t.warn(`[MentionSystem] Overwriting existing resolver for type: ${e}`),this.resolvers.set(e,t),_t.debug(`[MentionSystem] Registered resolver for type: ${e}`)}findResolver(e){if(!e||typeof e!="string")return;const t=e.match(tL);if(t&&t[1]){const s=t[1];return this.resolvers.get(s)}const r=e.indexOf(":");if(r>0&&r<e.length-1){const s=e.substring(0,r).toLowerCase();if(/^[a-z0-9]+$/.test(s))return this.resolvers.get(s)}_t.debug(`[MentionSystem] No resolver found for URI pattern: ${e}`)}getBreadcrumbController(){return this.breadcrumbController}clearCache(){this.searchService.clearCache(),this.cachedResults.clear(),_t.debug("[MentionSystem] All caches cleared")}destroy(){try{this.searchService.destroy(),this.breadcrumbController.destroy(),this.cachedResults.clear(),this.resolvers.clear(),_t.debug("[MentionSystem] System destroyed successfully")}catch(e){_t.error("[MentionSystem] Error during destroy:",e)}}}let Dd=null;function aL(n){return Dd||(Dd=new oL(n),_t.debug("[MentionSystem] Created new instance with config:",n)),Dd}const lL=MA.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])',getAttrs:n=>n.getAttribute("href")?null:!1}]},renderHTML({HTMLAttributes:n}){return["a",n,0]},addAttributes(){return{href:{default:null,parseHTML:n=>n.getAttribute("href"),renderHTML:n=>n.href?{href:n.href}:{}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},addCommands(){return{setLink:n=>({commands:e})=>n.href===null||n.href===void 0?e.unsetMark(this.name):e.setMark(this.name,n)}}});function M0(n={}){return lL.configure({validate:void 0,...n})}const f$=M0,hm=n=>n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),cL={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},uL=n=>n.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(e,t)=>{if(t[0]==="#"){const r=t[1]==="x"||t[1]==="X"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(r)&&r<=1114111?String.fromCodePoint(r):e}return cL[t]??e});function dL(n){const e=[];let t=0;for(const r of fw(n,"markdown",{decode:uL})){r.index>t&&e.push(n.slice(t,r.index));const s=r.parsed?hw(r.parsed):null;if(s){const i=s.attributes.map(([o,a])=>` ${o}="${hm(a)}"`).join("");e.push(`<span${i} class="${s.className}">${hm(s.text)}</span>`)}else e.push(r.text);t=r.index+r.text.length}return t<n.length&&e.push(n.slice(t)),e.join("")}const fL=new Set(["code","pre","script","style","a"]);function hL(n){const e=[];let t=0;const r=[];for(;t<n.length;)if(n[t]==="<"){const s=n.indexOf(">",t);if(s===-1){e.push(n.slice(t));break}const i=n.slice(t,s+1),o=i.match(/^<\/\s*([a-zA-Z][a-zA-Z0-9]*)/);if(o){const c=o[1].toLowerCase();r.length>0&&r[r.length-1]===c&&r.pop(),e.push(i),t=s+1;continue}const a=i.match(/^<\s*([a-zA-Z][a-zA-Z0-9]*)/);if(a){const c=a[1].toLowerCase(),u=i.endsWith("/>");(fL.has(c)||i.includes("data-mention")||i.includes("data-math-source"))&&!u&&r.push(c)}e.push(i),t=s+1}else{const s=n.indexOf("<",t),i=s===-1?n.length:s,o=n.slice(t,i);r.length===0&&o.length>0?e.push(dL(o)):e.push(o),t=i}return e.join("")}function pL(n){return n.replace(/^ +| +$/g,e=>" ".repeat(e.length)).replace(/ {2,}/g,e=>` ${" ".repeat(e.length-1)}`)}function gL(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mL(n,e){const t=[...new Set(e.filter(Boolean))].map(s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")).sort((s,i)=>i.length-s.length);if(t.length===0)return n;const r=new RegExp(`(^|[\\s\\u00A0])/(${t.map(gL).join("|")})(?=$|[\\s\\u00A0])`,"gu");return n.replace(r,(s,i,o)=>{const a=o.replace(/"/g,"&quot;");return`${i}<span data-type="skill-command" data-skill-name="${a}" class="skill-command-chip type-code" role="code" aria-label="/${a}" contenteditable="false">/${o}</span>`})}function vL(n,e=[]){if(!n)return"";const t=n.trim();if(t.startsWith("<")&&!t.startsWith("<!--anchor:"))return n;const s=`<p>${n.split(`
157
+ `);for(let h=0;h<f.length;h++)h>0&&d.push(n.schema.nodes.hardBreak.create()),f[h]&&d.push(n.schema.text(f[h]));return d});if(i.length===0)return!0;const o=i.map(u=>u.toJSON()),a=n.state.doc,c=r===void 0?void 0:et.near(a.resolve(Math.max(0,Math.min(r,a.content.size)))).from;return n.chain().setMeta(Wh,e.id).command(({commands:u})=>c===void 0?u.insertContent(o,{updateSelection:!0}):u.insertContentAt(c,o,{updateSelection:!0})).scrollIntoView().run()}function um(n){const e=[];return n.descendants(t=>{t.type.name==="screenReference"&&t.attrs.id&&e.push(t.attrs.id)}),e}function YP(n){if(!n.docChanged||n.getMeta(Gu)||n.getMeta(Wh))return null;const e=um(n.before),t=um(n.doc),r=e.filter(i=>!t.includes(i)),s=t.filter(i=>!e.includes(i));return r.length||s.length?{removed:r,restored:s}:null}const QP=pr.create({name:"skillCommand",inline:!0,group:"inline",atom:!0,selectable:!0,addAttributes(){return{name:{default:"",parseHTML:n=>n.getAttribute("data-skill-name")||"",renderHTML:n=>({"data-skill-name":n.name})}}},parseHTML(){return[{tag:'span[data-type="skill-command"]'}]},renderHTML({node:n,HTMLAttributes:e}){const t=`/${n.attrs.name||""}`;return["span",pn(e,{"data-type":"skill-command",class:"skill-command-chip type-code",role:"code","aria-label":t,contenteditable:"false"}),t]},renderText({node:n}){return`/${n.attrs.name||""}`},addCommands(){return{insertSkillCommand:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addKeyboardShortcuts(){return{Backspace:()=>{const{selection:n,doc:e}=this.editor.state;if(!n.empty)return!1;const{$from:t}=n,r=t.nodeBefore;if(r?.type.name===this.name)return this.editor.commands.deleteRange({from:t.pos-r.nodeSize,to:t.pos});if(r?.isText&&r.text?.endsWith(" ")){const s=e.resolve(t.pos-1).nodeBefore;if(s?.type.name===this.name)return this.editor.commands.deleteRange({from:t.pos-1-s.nodeSize,to:t.pos})}return!1},Delete:()=>{const{selection:n,doc:e}=this.editor.state;if(!n.empty)return!1;const{$from:t}=n,r=t.nodeAfter;if(r?.type.name!==this.name)return!1;const s=e.resolve(t.pos+r.nodeSize).nodeAfter,i=s?.isText&&s.text?.startsWith(" ")?1:0;return this.editor.commands.deleteRange({from:t.pos,to:t.pos+r.nodeSize+i})}}}});function ZP(n){return n.dataTransfer?.types.includes("Files")??!1}function eI(n){return n.clipboardData?.types?.includes("Files")??!1}var tI=N('<span class="path svelte-1ycni0y"> </span>'),nI=N('<div class="mention-hover-preview svelte-1ycni0y" role="tooltip"><div class="preview-content svelte-1ycni0y"><div class="preview-icon svelte-1ycni0y"><!></div> <div class="preview-text svelte-1ycni0y"><span class="filename svelte-1ycni0y"> </span> <!></div></div></div>');function w0(n,e){if(new.target)return Nt({component:w0,...n});Lt(e,!0);let t=y(e,"mention",7),r=y(e,"position",7),s=y(e,"onClose",7),i=fe(void 0);const o={file:Fo,"file-range":Fo,folder:Js,"source-folder":Js,note:Hd,"note-range":Hd,task:Fm,rule:Dw,command:zm,"external-source":zf,agent:Bm,member:Nw,personality:$m,workspace:Js,symbol:Fo};function a(){return o[t().type]||Fo}function c(){if(t().type==="member")return uw(t());const E=t().meta;return E?.relativePath||E?.fullPath||E?.path||""}function u(E){E.relatedTarget?.closest("[data-mention]")||s()?.()}function d(){let{x:z,y:G}=r();return z+250>window.innerWidth&&(z=window.innerWidth-250-10),G+30>window.innerHeight&&(G=r().y-30-10),{x:z,y:G}}const f=d(),h=c();var p={get mention(){return t()},set mention(E){t(E),b()},get position(){return r()},set position(E){r(E),b()},get onClose(){return s()},set onClose(E){s(E),b()},$set:Dt,$on:(E,z)=>$t(e,E,z)},g=nI(),v=te(g),m=te(v),S=te(m);{let E=w(a);ut(S,{get icon(){return l(E)}})}Q(m);var I=R(m,2),C=te(I),M=re(C,!0),O=R(C,2);{var P=E=>{var z=tI(),G=re(z,!0);L(()=>B(G,h)),k(E,z)};V(O,E=>{h&&E(P)})}return Q(I),Q(v),Q(g),Yn(g,E=>x(i,E),()=>l(i)),L((E,z)=>{Hi(g,`left: ${f.x??""}px; top: ${f.y??""}px`),xt(g,"aria-label",E),B(M,z)},[()=>_.chat_mentionPreview_ariaLabel(),()=>t().type==="member"?Of(t().label):t().label]),Kr("mouseout",g,u),Ss(1,g,()=>Ud,()=>({tier:"fast",y:0,scale:1})),Ss(2,g,()=>Vd,()=>({tier:"fast"})),k(n,g),Ot(p)}So(["mouseout"]);const dm={USE_DEFAULT_CONTEXT:{id:"use-default-context",type:"command",get label(){return _.chat_mentions_useDefaultContext_label()},get description(){return _.chat_mentions_useDefaultContext_description()},icon:"🔄",uri:"devspace://command/use-default-context"},CLEAR_CONTEXT:{id:"clear-context",type:"command",get label(){return _.chat_mentions_clearContext_label()},get description(){return _.chat_mentions_clearContext_description()},icon:"🗑️",uri:"devspace://command/clear-context"}};function Oi(n){return"items"in n||"subgroups"in n}function rI(n){if(!n||typeof n!="object")return!1;const e=n;return!(typeof e.id!="string"||typeof e.label!="string"||typeof e.uri!="string"||typeof e.type!="string"||e.subtitle!==void 0&&typeof e.subtitle!="string"||e.description!==void 0&&typeof e.description!="string"||e.icon!==void 0&&typeof e.icon!="string"||e.score!==void 0&&typeof e.score!="number"||e.group!==void 0&&typeof e.group!="string")}const x0={member:_.chat_mentionList_peopleSection_label,note:_.chat_mentionList_notesSection_label,agent:_.chat_mentionList_agentsSection_label,file:_.chat_mentionList_filesSection_label,folder:_.chat_mentionList_foldersSection_label,script:_.chat_mentionList_scriptsSection_label,terminal:_.chat_mentionList_terminalsSection_label,specialist:_.chat_mentionList_specialistsSection_label},fm="other";function sI(n){return Oi(n)?fm:n.type in x0?n.type:fm}function iI(n){const e=new Map;for(const t of n){const r=sI(t),s=e.get(r)??[];e.set(r,s),s.push(t)}return Array.from(e,([t,r])=>({key:t,label:(x0[t]??_.chat_mentionList_otherSection_label)(),items:r}))}const _c=Ga("BreadcrumbController");var Kl,jl,Gl;class k0{constructor(){ba(this,Kl,fe(Ar([])));ba(this,jl,fe(null));ba(this,Gl,fe(Ar([])));nt(this,"groupStack",[])}get _breadcrumbs(){return l(ri(this,Kl))}set _breadcrumbs(e){x(ri(this,Kl),e,!0)}get _currentGroup(){return l(ri(this,jl))}set _currentGroup(e){x(ri(this,jl),e,!0)}get _currentItems(){return l(ri(this,Gl))}set _currentItems(e){x(ri(this,Gl),e,!0)}get breadcrumbs(){return this._breadcrumbs}get currentGroup(){return this._currentGroup}get currentItems(){return this._currentItems}push(e){this._breadcrumbs=[...this._breadcrumbs,{id:e.id,label:e.label,icon:e.icon}],this._currentGroup=e.id,this.groupStack.push(e),e.items&&(this._currentItems=e.items),_c.debug("[BreadcrumbController] Pushed group:",e.label)}pop(){if(this._breadcrumbs.length===0)return!1;const e=this._breadcrumbs.slice(0,-1);if(this._breadcrumbs=e,e.length>0){const t=e[e.length-1];this._currentGroup=t.id;const r=this.groupStack[e.length-1];r?.items&&(this._currentItems=r.items)}else this._currentGroup=null,this._currentItems=[];return this.groupStack.pop(),_c.debug("[BreadcrumbController] Popped to:",this._currentGroup),!0}navigateToRoot(){this._breadcrumbs=[],this._currentGroup=null,this._currentItems=[],this.groupStack=[],_c.debug("[BreadcrumbController] Navigated to root")}navigateToBreadcrumb(e){if(e<0||e>=this._breadcrumbs.length)return;const t=this._breadcrumbs.slice(0,e+1);this._breadcrumbs=t;const r=t[e];this._currentGroup=r.id,this.groupStack=this.groupStack.slice(0,e+1);const s=this.groupStack[e];s?.items&&(this._currentItems=s.items),_c.debug("[BreadcrumbController] Navigated to breadcrumb:",r.label)}handleKeyboard(e){switch(e.key){case"ArrowLeft":if(this._breadcrumbs.length>0)return e.preventDefault(),e.stopPropagation(),this.pop();break;case"Escape":if(this._breadcrumbs.length>0)return e.preventDefault(),e.stopPropagation(),this.navigateToRoot(),!0;break}return!1}isInGroup(){return this._breadcrumbs.length>0}getCurrentPath(){return this._breadcrumbs.map(e=>e.label).join(" › ")}subscribeToBreadcrumbs(e){let t=this._breadcrumbs;return()=>{this._breadcrumbs!==t&&(t=this._breadcrumbs,e(this._breadcrumbs))}}subscribeToCurrentGroup(e){let t=this._currentGroup;return()=>{this._currentGroup!==t&&(t=this._currentGroup,e(this._currentGroup))}}subscribeToCurrentItems(e){let t=this._currentItems;return()=>{this._currentItems!==t&&(t=this._currentItems,e(this._currentItems))}}destroy(){this.navigateToRoot()}}Kl=new WeakMap,jl=new WeakMap,Gl=new WeakMap;const cl={file:"file","file-ts":"file-code","file-tsx":"file-code","file-js":"file-code","file-jsx":"file-code","file-svelte":"file-code","file-vue":"file-code","file-py":"file-code","file-rs":"file-code","file-go":"file-code","file-java":"file-code","file-cpp":"file-code","file-c":"file-code","file-h":"file-code","file-md":"file-text","file-json":"file-json","file-yaml":"file-json","file-yml":"file-json","file-toml":"file-json","file-xml":"file-json","file-html":"globe","file-css":"palette","file-scss":"palette","file-sass":"palette","file-less":"palette","file-sh":"terminal","file-bash":"terminal","file-zsh":"terminal","file-fish":"terminal","file-ps1":"terminal","file-bat":"terminal","file-cmd":"terminal","file-sql":"database","file-db":"database","file-sqlite":"database","file-env":"settings","file-config":"settings","file-ini":"settings","file-cfg":"settings","file-conf":"settings","file-lock":"lock","file-gitignore":"git-branch","file-dockerfile":"box","file-docker":"box","file-makefile":"wrench","file-cmake":"wrench","file-gradle":"wrench","file-maven":"wrench","file-package":"package","file-default":"file",folder:"folder","folder-open":"folder-open","folder-src":"folder-code","folder-lib":"folder-code","folder-components":"folder-code","folder-pages":"folder-code","folder-api":"folder-code","folder-utils":"folder-code","folder-helpers":"folder-code","folder-services":"folder-code","folder-models":"folder-code","folder-controllers":"folder-code","folder-views":"folder-code","folder-public":"folder-open","folder-static":"folder-open","folder-assets":"image","folder-images":"image","folder-img":"image","folder-icons":"image","folder-styles":"palette","folder-css":"palette","folder-scss":"palette","folder-tests":"test-tube","folder-test":"test-tube","folder-spec":"test-tube","folder-docs":"book-open","folder-documentation":"book-open","folder-config":"settings","folder-configuration":"settings","folder-settings":"settings","folder-node_modules":"package","folder-vendor":"package","folder-packages":"package","folder-dist":"package-check","folder-build":"package-check","folder-out":"package-check","folder-output":"package-check",note:"sticky-note","note-spec":"file-text","note-todo":"list-todo","note-meeting":"users","note-idea":"lightbulb","note-draft":"pen-tool",task:"check-square","task-bug":"bug","task-feature":"sparkles","task-improvement":"trending-up","task-refactor":"refresh-cw","task-test":"test-tube","task-docs":"book-open",rule:"shield","rule-lint":"shield-check","rule-format":"align-left","rule-security":"shield-alert",terminal:"terminal",script:"play","script-running":"play","script-stopped":"square","script-failed":"circle-exclamation",command:"terminal","command-run":"play","command-build":"hammer","command-test":"test-tube","command-deploy":"rocket",external:"external-link","external-docs":"book-open","external-api":"globe","external-github":"github","external-gitlab":"gitlab",personality:"user-tie","personality-senior":"user-graduate","personality-mentor":"chalkboard-teacher","personality-concise":"bolt","personality-creative":"palette","personality-analytical":"chart-line",member:"users",agent:"robot","agent-active":"robot","agent-idle":"robot","agent-busy":"robot",specialist:"user-tie","specialist-coordinator":"chalkboard-teacher","specialist-implementor":"hammer","specialist-verifier":"shield-check","specialist-pr-reviewer":"shield-check","specialist-ui-designer":"palette","specialist-developer":"wrench",group:"folder","group-files":"files","group-folders":"folders","group-notes":"sticky-note","group-tasks":"list-todo","group-rules":"shield","group-commands":"terminal","group-external":"external-link","group-personalities":"users","group-agents":"robot","group-specialists":"user-tie",default:"file"};function oI(n,e){if(e){const r=`${n}-${e}`;if(r in cl)return cl[r]}const t=n;return t in cl?cl[t]:cl.default}function _0(n,e){if(new.target)return Nt({component:_0,...n});Lt(e,!0);const t=()=>rn(o,"$session$",r),[r,s]=Jl();let i=y(e,"agentId",7);const o=dw(i()),a=w(()=>Zk(t()));var c={get agentId(){return i()},set agentId(d){i(d),b()},$set:Dt,$on:(d,f)=>$t(e,d,f)};uv(n,{get agentId(){return i()},variant:"compact",get state(){return l(a)}});var u=Ot(c);return s(),u}var aI=N('<span class="mention-agent-avatar svelte-myc5g6"><!></span>'),lI=N("<span><!></span>"),cI=N('<span class="mention-subtitle svelte-myc5g6"> </span>'),uI=N('<span class="group-arrow svelte-myc5g6"><!></span>'),dI=N('<!> <div class="mention-content svelte-myc5g6"><div class="mention-label-line svelte-myc5g6"><span class="mention-label svelte-myc5g6"> </span></div> <!></div> <!>',1),fI=N('<span class="breadcrumb-icon svelte-myc5g6"> </span>'),hI=N("<!> ",1),pI=N('<span class="breadcrumb-separator svelte-myc5g6">›</span> <!>',1),gI=N('<div class="breadcrumbs svelte-myc5g6"><!> <!></div>'),mI=N('<div class="mention-skeleton svelte-myc5g6"><div class="skeleton-icon svelte-myc5g6"></div> <div class="skeleton-text svelte-myc5g6"></div></div>'),vI=N('<div class="mention-loading svelte-myc5g6" role="status"></div>'),bI=N('<div class="mention-section-heading type-caption px-2 pt-2 pb-1 font-medium text-muted-foreground svelte-myc5g6" role="presentation"> </div>'),yI=N('<div class="mention-section svelte-myc5g6"><!> <!></div>'),wI=N('<div class="mention-items svelte-myc5g6" role="listbox" tabindex="-1"></div>'),xI=N('<div class="mention-empty svelte-myc5g6" role="status"> </div>'),kI=N('<div class="enhanced-mention-list svelte-myc5g6"><div class="mention-container svelte-myc5g6"><div class="mention-list-section svelte-myc5g6"><!> <!></div></div></div>');function Oc(n,e){const t=Vi();if(new.target)return Nt({component:Oc,...n});Lt(e,!0);const r=(W,D=ls)=>{const ae=w(()=>l(Y).indexOf(D())),ge=w(()=>S(D())),ue=w(()=>l(ae)===l(d)),pe=w(()=>!Oi(D())&&D().type==="agent"),ke=w(()=>!Oi(D())&&D().type==="member"),ye=w(()=>l(ke)?Of(D().label):D().label);{let Z=w(Jf),$e=w(()=>l(ue)?"selected":""),lt=w(()=>de(D())),St=w(()=>l(ke)&&D().subtitle?`${l(ye)} · ${D().subtitle}`:l(ye));Ze(W,{variant:"plain",wrapContent:!1,get class(){return`${l(Z)??""} mention-item ${l($e)??""}`},get id(){return l(lt)},role:"option",get"aria-selected"(){return l(ue)},get"aria-label"(){return l(St)},tabindex:-1,onpointerdown:De=>De.preventDefault(),onmousedown:De=>De.preventDefault(),onclick:()=>z(l(ae)),onmouseenter:()=>{l(v)||x(d,l(ae),!0)},children:(De,Le)=>{var Ye=dI(),Ct=ce(Ye);{var bt=Ue=>{{let Ke=w(()=>D().meta?.avatarUrl);Ym(Ue,{get avatarUrl(){return l(Ke)},get label(){return D().label},size:18})}},sn=Ue=>{var Ke=aI(),Me=te(Ke);_0(Me,{get agentId(){return D().id}}),Q(Ke),k(Ue,Ke)},Be=Ue=>{var Ke=lI();let Me;var Xt=te(Ke);ut(Xt,{get icon(){return l(ge)}}),Q(Ke),L(()=>Me=wt(Ke,1,"mention-icon svelte-myc5g6",null,Me,{selected:l(ue)})),k(Ue,Ke)};V(Ct,Ue=>{l(ke)?Ue(bt):l(pe)?Ue(sn,1):Ue(Be,-1)})}var he=R(Ct,2),Ne=te(he),je=te(Ne),Tt=re(je,!0);Q(Ne);var ee=R(Ne,2);{var Ge=Ue=>{var Ke=cI(),Me=re(Ke,!0);L(()=>B(Me,D().subtitle)),k(Ue,Ke)},it=w(()=>!Oi(D())&&D().subtitle);V(ee,Ue=>{l(it)&&Ue(Ge)})}Q(he);var Xe=R(he,2);{var mt=Ue=>{var Ke=uI(),Me=te(Ke);ut(Me,{get icon(){return dp},size:"xs"}),Q(Ke),k(Ue,Ke)},Mt=w(()=>Oi(D()));V(Xe,Ue=>{l(Mt)&&Ue(mt)})}L(()=>B(Tt,l(ye))),k(De,Ye)},$$slots:{default:!0}})}};let s=y(e,"items",23,()=>[]),i=y(e,"command",7),o=y(e,"onClose",7),a=y(e,"loading",7,!1),c=y(e,"listboxId",23,()=>`${t}-listbox`),u=y(e,"onActiveOptionChange",7),d=fe(0);const f=new k0,h=w(()=>f.breadcrumbs),p=w(()=>f.isInGroup()?f.currentItems:s());let g,v=fe(!0);const m=w(()=>typeof l(Y)<"u"&&l(Y).length>0?l(Y)[l(d)]||null:l(p)[l(d)]||null);function S(W){const D=Oi(W)?"group":W.type,ae=oI(D,W.subtype);return{file:Fo,"file-code":Wd,"file-text":Ff,"file-json":Wd,folder:Js,"folder-open":d1,"folder-code":Js,"sticky-note":Hd,"list-todo":u1,"check-square":c1,shield:l1,terminal:zm,"external-link":a1,globe:zf,palette:o1,database:i1,settings:s1,lock:r1,"git-branch":id,box:n1,wrench:t1,package:e1,image:Dc,"test-tube":Zw,"book-open":Qw,"package-check":Fm,users:Yw,lightbulb:Xw,"pen-tool":Jw,bug:qw,sparkles:Gw,"trending-up":jw,"refresh-cw":Kw,"shield-check":fp,"align-left":Ww,"shield-alert":fp,play:Vw,hammer:Uw,rocket:Hw,github:id,gitlab:id,files:Nm,folders:Js,"chevron-right":dp,"user-tie":$m,"user-graduate":Fw,"chalkboard-teacher":zw,bolt:Bw,robot:Bm,brain:$w}[ae]||Fo}ql(()=>f.destroy());function I(W){if(f?.handleKeyboard(W))return W.preventDefault(),W.stopPropagation(),!0;switch(W.key){case"ArrowUp":return W.preventDefault(),W.stopPropagation(),M(),!0;case"ArrowDown":return W.preventDefault(),W.stopPropagation(),O(),!0;case"ArrowRight":return!l(m)||!Oi(l(m))?!1:(W.preventDefault(),W.stopPropagation(),P(),!0);case"Enter":return W.preventDefault(),W.stopPropagation(),P(),!0;case"Escape":return W.preventDefault(),W.stopPropagation(),l(h).length>0?f.navigateToRoot():o()?.(),!0;default:return!1}}function C({event:W}){return I(W)}function M(){const W=l(Y).length;W!==0&&(x(d,(l(d)+W-1)%W),E())}function O(){const W=l(Y).length;W!==0&&(x(d,(l(d)+1)%W),E())}function P(){z(l(d))}async function E(){if(await qo(),!g)return;const W=g.querySelector(".mention-item.selected");if(!W)return;const D=l(K)?l(J).find(ae=>ae.items[0]===l(Y)[l(d)]):void 0;D&&document.getElementById(X(D))?.scrollIntoView?.({block:"nearest",behavior:"instant"}),W.scrollIntoView?.({block:"nearest",behavior:"instant"})}function z(W){const D=l(Y)[W];D&&(Oi(D)?(f.push(D),x(d,0)):i()(D))}function G(W){f.navigateToBreadcrumb(W),x(d,0)}ft(()=>{l(p),x(d,0),x(v,!0)});const J=w(()=>iI(Array.isArray(l(p))?l(p):[])),K=w(()=>l(J).length>1),Y=w(()=>l(J).flatMap(W=>W.items));function $(W){W.target instanceof Element&&W.target.closest(".mention-section-heading")&&W.preventDefault()}function X(W){return`${t}-section-${W.key}`}function de(W){return`${t}-option-${encodeURIComponent(`${Oi(W)?"group":W.type}:${W.id}`)}`}const me=w(()=>l(m)?de(l(m)):void 0);ft(()=>u()?.(l(me)));var ie={onKeyDown:C,get items(){return s()},set items(W=[]){s(W),b()},get command(){return i()},set command(W){i(W),b()},get onClose(){return o()},set onClose(W){o(W),b()},get loading(){return a()},set loading(W=!1){a(W),b()},get listboxId(){return c()},set listboxId(W=`${t}-listbox`){c(W),b()},get onActiveOptionChange(){return u()},set onActiveOptionChange(W){u(W),b()},$set:Dt,$on:(W,D)=>$t(e,W,D)},q=kI(),j=te(q),ne=te(j),we=te(ne);{var be=W=>{var D=gI(),ae=te(D);Ze(ae,{variant:"plain",class:"breadcrumb-item",onmousedown:ue=>ue.preventDefault(),onclick:()=>f.navigateToRoot(),children:(ue,pe)=>{Ht();var ke=Vt();L(ye=>B(ke,ye),[()=>_.chat_mentionList_all_label()]),k(ue,ke)},$$slots:{default:!0}});var ge=R(ae,2);Cs(ge,19,()=>l(h),(ue,pe)=>ue.id||`crumb-${pe}`,(ue,pe,ke)=>{var ye=pI(),Z=R(ce(ye),2);Ze(Z,{variant:"plain",class:"breadcrumb-item",onmousedown:$e=>$e.preventDefault(),onclick:()=>G(l(ke)),children:($e,lt)=>{var St=hI(),De=ce(St);{var Le=Ct=>{var bt=fI(),sn=re(bt,!0);L(()=>B(sn,l(pe).icon)),k(Ct,bt)};V(De,Ct=>{l(pe).icon&&Ct(Le)})}var Ye=R(De);L(()=>B(Ye,` ${l(pe).label??""}`)),k($e,St)},$$slots:{default:!0}}),k(ue,ye)}),Q(D),k(W,D)};V(we,W=>{l(h).length>0&&W(be)})}var Se=R(we,2);{var se=W=>{var D=vI();Cs(D,20,()=>[0,1,2,3],ae=>ae,(ae,ge)=>{var ue=mI(),pe=R(te(ue),2);Q(ue),L(()=>Hi(pe,`width: ${55+ge*12}%`)),k(ae,ue)}),Q(D),L(ae=>xt(D,"aria-label",ae),[()=>_.ui_combobox_loadingOptions_message()]),k(W,D)},oe=W=>{var D=wI();Cs(D,21,()=>l(J),ae=>ae.key,(ae,ge)=>{var ue=yI(),pe=te(ue);{var ke=Z=>{var $e=bI(),lt=re($e,!0);L(St=>{xt($e,"id",St),B(lt,l(ge).label)},[()=>X(l(ge))]),k(Z,$e)};V(pe,Z=>{l(K)&&Z(ke)})}var ye=R(pe,2);Cs(ye,17,()=>l(ge).items,Z=>de(Z),(Z,$e)=>{r(Z,()=>l($e))}),Q(ue),L(Z=>{xt(ue,"role",l(K)?"group":void 0),xt(ue,"aria-labelledby",Z)},[()=>l(K)?X(l(ge)):void 0]),k(ae,ue)}),Q(D),L(ae=>{xt(D,"id",c()),xt(D,"aria-label",ae),xt(D,"aria-activedescendant",l(me)),xt(D,"aria-busy",a())},[()=>_.chat_mentionList_ariaLabel()]),Kr("keydown",D,I),Kr("mousemove",D,()=>x(v,!1)),Kr("pointerdown",D,$),Kr("mousedown",D,$),k(W,D)},H=W=>{var D=xI(),ae=re(D,!0);L(ge=>B(ae,ge),[()=>_.chat_mentionList_noResults_label()]),k(W,D)};V(Se,W=>{a()&&l(p).length===0?W(se):l(p).length>0?W(oe,1):W(H,-1)})}return Q(ne),Q(j),Q(q),Yn(q,W=>g=W,()=>g),k(n,q),Ot(ie)}So(["keydown","mousemove","pointerdown","mousedown"]);class _I{constructor(e){nt(this,"unregisterPopup");nt(this,"component",null);nt(this,"popup",null);nt(this,"editorElement",null);nt(this,"inputContainer",null);nt(this,"listboxId",`mention-listbox-${crypto.randomUUID()}`);nt(this,"previousAria",new Map);nt(this,"generation",0);this.owner=e}attachPopup(){this.popup&&((this.owner?.target()??document.body).appendChild(this.popup),this.unregisterPopup=this.owner?.register(this.popup,()=>this.onExit()))}attachEditor(e){if(this.editorElement!==e){this.editorElement=e;for(const t of["aria-controls","aria-activedescendant","aria-haspopup"])this.previousAria.set(t,e.getAttribute(t))}}accessibilityProps(){return{listboxId:this.listboxId,onClose:()=>this.onExit(),onActiveOptionChange:e=>{!this.editorElement||!this.popup||(this.editorElement.setAttribute("aria-haspopup","listbox"),e?(this.editorElement.setAttribute("aria-controls",this.listboxId),this.editorElement.setAttribute("aria-activedescendant",e)):(this.editorElement.removeAttribute("aria-controls"),this.editorElement.removeAttribute("aria-activedescendant")))}}}onBeforeStart(e){this.owner&&!this.owner.active()||(this.generation++,this.cleanup(),e.editor?.view?.dom&&this.attachEditor(e.editor.view.dom),this.popup=document.createElement("div"),this.popup.className="mention-popup",this.attachPopup(),this.positionPopup(e),this.component=vl(Oc,{target:this.popup,props:{items:[],command:()=>{},loading:!0,...this.accessibilityProps()}}))}onStart(e){if(!(this.owner&&!this.owner.active())&&this.generation!==0){if(this.component&&this.popup){this.component.$set({items:e.items,command:e.command,loading:!1}),this.positionPopup(e);return}e.editor?.view?.dom&&this.attachEditor(e.editor.view.dom),this.popup=document.createElement("div"),this.popup.className="mention-popup",this.attachPopup(),this.positionPopup(e),this.component=vl(Oc,{target:this.popup,props:{items:e.items,command:e.command,loading:!1,...this.accessibilityProps()}})}}findInputContainer(){if(!this.editorElement)return null;let e=this.editorElement.closest(".rich-input-container");return e?(_t.info("[MentionSuggestionRenderer] Found .rich-input-container"),e):(e=this.editorElement.closest(".rich-textarea"),e?(_t.info("[MentionSuggestionRenderer] Found .rich-textarea"),e):(e=this.editorElement.closest('[style*="position"]'),e?(_t.info("[MentionSuggestionRenderer] Found positioned ancestor"),e):(_t.warn("[MentionSuggestionRenderer] Could not find input container"),null)))}positionPopup(e){if(!this.popup)return;if(!this.inputContainer&&this.editorElement&&(this.inputContainer=this.findInputContainer()),!this.inputContainer){_t.warn("[MentionSuggestionRenderer] No input container found, cannot position popup");return}const t=this.inputContainer.getBoundingClientRect(),r=window.innerHeight,s=window.innerWidth,i=8,o=4;this.popup.style.position="fixed",this.popup.style.width=`${Math.min(t.width,s-i*2)}px`;const a=this.popup.getBoundingClientRect().width;this.popup.style.left=`${Math.max(i,Math.min(t.left,s-a-i))}px`,this.popup.style.zIndex="1000";const c=r-t.bottom,u=t.top,f=c<300&&u>c;this.popup.style.setProperty("--mention-available-height",`${Math.max(0,(f?u:c)-o-i)}px`),f?(this.popup.style.top="auto",this.popup.style.bottom=`${r-t.top+o}px`):(this.popup.style.bottom="auto",this.popup.style.top=`${t.bottom+o}px`),_t.info("[MentionSuggestionRenderer] Popup positioned at:",{left:this.popup.style.left,width:this.popup.style.width,top:this.popup.style.top,bottom:this.popup.style.bottom,zIndex:this.popup.style.zIndex,spaceBelow:c,spaceAbove:u,positionedAbove:f})}onUpdate(e){if(this.generation!==0){if(_t.info("[MentionSuggestionRenderer] onUpdate called",{hasComponent:!!this.component,hasPopup:!!this.popup,itemsCount:e.items?.length}),!this.editorElement&&e.editor?.view?.dom&&this.attachEditor(e.editor.view.dom),!this.popup&&!this.component){_t.info("[MentionSuggestionRenderer] Initializing popup and component in onUpdate (onStart was skipped)"),this.onStart(e);return}this.component&&this.popup?(_t.info("[MentionSuggestionRenderer] Updating component props without remounting"),this.component.$set({items:e.items,command:e.command,loading:!1})):!this.component&&this.popup&&(_t.info("[MentionSuggestionRenderer] Creating component in onUpdate"),this.component=vl(Oc,{target:this.popup,props:{items:e.items,command:e.command,loading:!1,...this.accessibilityProps()}})),this.positionPopup(e)}}onKeyDown(e){return this.component?.onKeyDown?.(e)||!1}cleanup(){if(this.unregisterPopup?.(),this.unregisterPopup=void 0,this.editorElement)for(const[e,t]of this.previousAria)t===null?this.editorElement.removeAttribute(e):this.editorElement.setAttribute(e,t);this.previousAria.clear(),this.editorElement=null,this.inputContainer=null,this.popup&&this.popup.parentNode&&this.popup.parentNode.removeChild(this.popup),this.component&&io(this.component),this.popup=null,this.component=null}onExit(){this.generation=0,this.cleanup()}}function SI(n){const e=new _I(n);return{onBeforeStart:t=>e.onBeforeStart(t),onStart:t=>e.onStart(t),onUpdate:t=>e.onUpdate(t),onKeyDown:t=>e.onKeyDown(t),onExit:()=>e.onExit()}}function Nn(n,e){if(!n||!e)return null;const t=n.toLowerCase(),r=e.toLowerCase();let s=0;for(let a=0;a<r.length&&s<t.length;a++)r[a]===t[s]&&s++;if(s!==t.length)return null;const i=CI(t,r);return i?{score:MI(t,r,i),matches:i}:null}function CI(n,e){const t=[];let r=0;for(let s=0;s<n.length;s++){const i=n[s];let o=!1;for(let a=r;a<e.length;a++)if(e[a]===i){t.push(a),r=a+1,o=!0;break}if(!o)return null}return t}function MI(n,e,t){let r=0;r+=1;let s=0;for(let u=1;u<t.length;u++)t[u]===t[u-1]+1&&(s+=.1);r+=s;let i=0;for(const u of t)(u===0||TI(e,u))&&(i+=.15);r+=i,t[0]===0&&(r+=.2);const a=(t[t.length-1]-t[0])/e.length*.3;return r-=a,Math.min(r/2.5,1)}function TI(n,e){if(e===0)return!0;const t=n[e],r=n[e-1];return t===t.toUpperCase()&&r===r.toLowerCase()||!/[a-z0-9]/i.test(r)}function EI(n,e){if(!n||!e)return null;if(!n.includes("/"))return Nn(n,e);const t=n.split("/").filter(o=>o.length>0),r=e.split("/").filter(o=>o.length>0);if(t.length===0||r.length===0)return null;const s=AI(t,r);return s?{score:RI(t,r,s),matches:[]}:null}function AI(n,e){const t=[];let r=0;for(let s=0;s<n.length;s++){const i=n[s];let o=!1;const a=s===n.length-1;for(let c=r;c<e.length;c++){const u=e[c];if(Nn(i,u)){t.push(c),r=c+1,o=!0;break}if(a){const d=u.split(".")[0],f=u.includes(".")?u.split(".").pop():"";if(f&&Nn(i,f)){t.push(c),r=c+1,o=!0;break}if(d&&Nn(i,d)){t.push(c),r=c+1,o=!0;break}}}if(!o)return null}return t}function RI(n,e,t){let r=0;r+=1,r+=t.length*.2;let s=0;for(let o=1;o<t.length;o++)t[o]===t[o-1]+1&&(s+=.15);r+=s,t.length>0&&t[t.length-1]===e.length-1&&(r+=.3);for(let o=0;o<n.length&&o<t.length;o++){const a=n[o],c=e[t[o]];a.toLowerCase()===c.toLowerCase()&&(r+=.2)}return Math.min(r/3,1)}function Na(n,e,t){return JSON.stringify({query:n,workspaceId:t.workspaceId,repoPath:t.repoPath,currentFile:t.currentFile,currentNote:t.currentNote,providers:e.map(r=>[r.id,r.getCacheKey?.(t)])})}const S0="*",PI=["member","note","agent","file","folder","script","terminal",S0,"specialist"];function C0(n,e){if(e.length===0)return[...n].sort((s,i)=>(i.score??0)-(s.score??0));const t=new Map(e.map((s,i)=>[s,i])),r=t.get(S0)??e.length;return n.map(s=>({candidate:s,rank:t.get(s.type)??r})).sort((s,i)=>s.rank-i.rank||(i.candidate.score??0)-(s.candidate.score??0)).map(({candidate:s})=>s)}function II(n,e){const t=new Map;return n.filter(r=>{const s=t.get(r.type)??0;return t.set(r.type,s+1),s<e})}class LI{constructor(e={}){nt(this,"searchDebounceTimer",null);nt(this,"currentAbortController",null);nt(this,"cache",new Map);nt(this,"config");nt(this,"isSearching",!1);this.config={debounceMs:e.debounceMs??100,maxResults:e.maxResults??50,cacheMaxAge:e.cacheMaxAge??3e4,enableSemantic:e.enableSemantic??!1,enableLivePreview:e.enableLivePreview??!0,enableCollaboration:e.enableCollaboration??!1,typeOrder:e.typeOrder??[],maxResultsPerKind:e.maxResultsPerKind??20}}async search(e,t,r){this.cancelPendingSearch();const s=Na(e,t,r),i=this.cache.get(s);if(i&&!this.isCacheExpired(i))return _t.debug("[SearchService] Returning cached results for:",e),i.results;const o=new AbortController;this.currentAbortController=o;const a=o.signal;return new Promise((c,u)=>{this.isSearching=!0;let d=!1;const f=()=>{a.removeEventListener("abort",g),this.currentAbortController===o&&(this.currentAbortController=null,this.searchDebounceTimer=null,this.isSearching=!1)},h=m=>{d||(d=!0,f(),c(m))},p=m=>{d||(d=!0,f(),u(m))},g=()=>p(new DOMException("Search cancelled","AbortError"));a.addEventListener("abort",g,{once:!0});const v=async()=>{try{if(a.aborted){p(new DOMException("Search cancelled","AbortError"));return}_t.debug("[SearchService] Searching with providers:",t.map(E=>E.id));const m=Na(e,t,r),S=await Promise.all(t.map(E=>this.searchWithProvider(E,e,r,a)));if(a.aborted)return;if(m!==Na(e,t,r)){h([]);return}const C=this.combineResults(S.flat()).filter(E=>rI(E)),M=this.applyFuzzyMatching(e,C),O=C0(M,this.config.typeOrder),P=this.config.typeOrder.length>0?II(O,this.config.maxResultsPerKind):O.slice(0,this.config.maxResults);this.cache.set(m,{results:P,timestamp:Date.now()}),_t.debug(`[SearchService] Found ${P.length} results`),h(P)}catch(m){a.aborted?p(new DOMException("Search cancelled","AbortError")):(_t.error("[SearchService] Search error:",m),p(m instanceof Error?m:new Error(String(m))))}};e?this.searchDebounceTimer=setTimeout(v,this.config.debounceMs):v()})}async searchWithProvider(e,t,r,s){try{const i={...r,signal:s},o=await e.search(t,i),a=e.scoreRelevance?.bind(e);return a?o.map(c=>({...c,score:a(c,r)})):o}catch(i){return s.aborted||_t.error(`[SearchService] Provider ${e.id} search failed:`,i),[]}}combineResults(e){const t=new Set,r=[];for(const s of e){const i=`${s.type}:${s.uri}`;t.has(i)||(t.add(i),r.push(s))}return r}applyFuzzyMatching(e,t){if(!e||e.length===0)return t;const s=t.map(i=>{let o=0;const a=i.meta?.path||i.meta?.fullPath||(i.subtitle?`${i.subtitle}/${i.label}`:i.label);if(a){const u=EI(e,a);u&&(o=Math.max(o,u.score*1.8))}const c=Nn(e,i.label);if(c&&(o=Math.max(o,c.score*1.5)),i.subtitle){const u=Nn(e,i.subtitle);u&&(o=Math.max(o,u.score))}if(i.description){const u=Nn(e,i.description);u&&(o=Math.max(o,u.score*.5))}return{...i,score:o>0?o:i.score??0}}).filter(i=>i.score>0);return s.length>0?s:t}cancelPendingSearch(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=null),this.currentAbortController&&(this.currentAbortController.abort(),this.currentAbortController=null)}isCacheExpired(e){return Date.now()-e.timestamp>this.config.cacheMaxAge}clearCache(){this.cache.clear()}isLoading(){return this.isSearching}destroy(){this.cancelPendingSearch(),this.clearCache()}}class OI{constructor(){nt(this,"id","file");nt(this,"triggers",["@file","@f"]);nt(this,"default",!0);nt(this,"supportsRanges",!0);nt(this,"supportsLivePreview",!0);nt(this,"recentFiles",new Set);nt(this,"fileIconMap",{ts:"📘",tsx:"⚛️",js:"📜",jsx:"⚛️",svelte:"🔥",vue:"💚",py:"🐍",rs:"🦀",go:"🐹",java:"☕",cpp:"⚙️",c:"⚙️",h:"📎",md:"📝",json:"📋",yaml:"📋",yml:"📋",toml:"📋",xml:"📋",html:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sql:"🗃️",sh:"🖥️",bash:"🖥️",zsh:"🖥️",fish:"🖥️",dockerfile:"🐳",docker:"🐳",gitignore:"🚫",env:"🔐",lock:"🔒",test:"🧪",spec:"🧪"})}async search(e,t){_t.debug("[FileProvider] Searching for:",{query:e,context:{workspaceId:t.workspaceId}});const r=t.workspaceId;if(!r)return[];try{const s=await Wm("search.fileNames",{workspaceId:r,pattern:e||"",limit:10}),o=(Array.isArray(s?.files)?s.files:[]).map(a=>{const c=a.split("/").pop()||a,u=c.split(".").pop()||"";return{id:`file-${a}`,label:c,type:"file",uri:`file:${a}`,description:a,subtitle:a,score:.5,meta:{path:a,fullPath:a,relativePath:a,extension:u,language:this.getLanguageFromExtension(u)}}});return this.deduplicateAndDistinguish(o)}catch(s){return _t.error("[FileProvider] Search failed:",s),[]}}async searchRecent(e,t){if(!t.recentFiles||t.recentFiles.length===0)return[];const r=await Promise.all(t.recentFiles.filter(s=>e?Nn(e,s)!==null:!0).slice(0,3).map(s=>{const i=s.split("/").pop()||s,o=i.split(".").pop()||"";return this.fileToCandidate({path:s,name:i,extension:o})}));return r.forEach(s=>{this.recentFiles.add(s.uri)}),r}async searchContextual(e,t){return t.currentFile?[]:[]}async fileToCandidate(e){const t=this.getFileIcon(e.extension),r=e.path,s=this.formatPath(r);return{id:`file-${e.path}`,type:"file",label:e.name,subtitle:s,description:r,icon:t,uri:`devspace://file/${encodeURIComponent(e.path)}`,meta:{path:r,fullPath:e.path,lastModified:e.lastModified,size:e.size,language:e.language||this.getLanguageFromExtension(e.extension)}}}combineResults(...e){const t=new Set,r=[];for(const s of e)for(const i of s)t.has(i.uri)||(t.add(i.uri),r.push(i));return this.deduplicateAndDistinguish(r)}deduplicateAndDistinguish(e){const t=new Map;for(const s of e){const i=s.label;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(s)}const r=[];for(const[s,i]of t.entries())if(i.length===1)r.push(i[0]);else{const o=this.distinguishDuplicates(i);r.push(...o)}return r}distinguishDuplicates(e){const t=e.map(s=>s.description||s.meta?.path||"");return e.map((s,i)=>{const o=t[i],a=t.filter((d,f)=>f!==i),c=o.split("/");let u="";for(let d=c.length;d>0;d--){const f=c.slice(-d).join("/");if(!a.some(p=>p.split("/").slice(-d).join("/")===f)||d===1){u=f;break}}return{...s,subtitle:u}})}groupResults(e){const t={recent:[],relevant:[],other:[]};for(const s of e)this.recentFiles.has(s.uri)?t.recent.push(s):(s.score??0)>.7?t.relevant.push(s):t.other.push(s);const r=[];return t.recent.length>0&&r.push(...t.recent.slice(0,3).map(s=>({...s,group:_.chat_mentions_recentFiles_group()}))),t.relevant.length>0&&r.push(...t.relevant.slice(0,5).map(s=>({...s,group:_.chat_mentions_mostRelevant_group()}))),t.other.length>0&&r.push(...t.other.slice(0,10).map(s=>({...s,group:_.chat_mentions_otherFiles_group()}))),r}scoreRelevance(e,t){let r=.5;if(this.recentFiles.has(e.uri)&&(r+=.2),t.currentFile&&e.meta?.path){const s=t.currentFile.substring(0,t.currentFile.lastIndexOf("/")),i=e.meta.path.substring(0,e.meta.path.lastIndexOf("/"));s===i&&(r+=.15)}return t.imports?.includes(e.meta?.path||"")&&(r+=.25),t.currentFile?.includes(".test.")&&e.meta?.path?.includes(".test.")&&(r+=.1),Math.min(r,1)}getGroups(){return[{id:"files-recent",label:_.chat_mentions_recentFiles_group(),icon:"🕐"},{id:"files-all",label:_.chat_mentions_allFiles_group(),icon:"📁"},{id:"files-tests",label:_.chat_mentions_testFiles_group(),icon:"🧪"}]}getFileIcon(e){return this.fileIconMap[e.toLowerCase()]||"📄"}formatPath(e){if(e.length>40){const t=e.split("/");if(t.length>2)return`.../${t.slice(-2).join("/")}`}return e}getLanguageFromExtension(e){return{ts:"typescript",tsx:"typescriptreact",js:"javascript",jsx:"javascriptreact",py:"python",rs:"rust",go:"go",java:"java",cpp:"cpp",c:"c",svelte:"svelte",vue:"vue",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",html:"html",css:"css",scss:"scss",sql:"sql",sh:"shellscript"}[e.toLowerCase()]||"plaintext"}}class NI{constructor(){nt(this,"id","member")}getCacheKey(e){const t=It.state;return JSON.stringify({backendId:uk.select(t),ownPrincipalId:t.presence.ownPrincipalId,members:e.workspaceId?pp.select(t,e.workspaceId):[]})}async search(e,t){const{workspaceId:r}=t;if(!r)return[];const s=e.replace(/^@/,"").toLowerCase();return pp.select(It.state,r).filter(i=>i.login.toLowerCase().includes(s)).map(i=>({id:`member-${i.principalId}`,type:"member",label:i.login,subtitle:i.identity?`${i.identity.provider==="github"?"GitHub":"GitLab"} · ${i.identity.host}`:void 0,description:i.displayName??void 0,icon:"👤",uri:`devspace://member/${encodeURIComponent(i.principalId)}?workspaceId=${encodeURIComponent(r)}`,score:.8,meta:{workspaceId:r,principalId:i.principalId,identity:i.identity,avatarUrl:i.avatarUrl??void 0}}))}}class DI{constructor(){nt(this,"id","folder");nt(this,"triggers",["@folder","@dir"])}async search(e,t){const r=t.workspaceId;if(!r)return[];try{const{backendRequest:s}=await cs(async()=>{const{backendRequest:c}=await import("./Bgegixo2.js").then(u=>u.az);return{backendRequest:c}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url),i=await s("search.fileNames",{workspaceId:r,pattern:e||"",limit:200}),o=Array.isArray(i?.files)?i.files:[],a=new Set;for(const c of o){const u=c.split("/");for(let d=1;d<u.length;d++)a.add(u.slice(0,d).join("/"))}return[...a].filter(c=>e?Nn(e,c.split("/").pop()||c)!==null:!0).slice(0,10).map(c=>({id:`folder-${c}`,type:"folder",label:c.split("/").pop()||c,description:c,icon:"📁",uri:`devspace://folder/${encodeURIComponent(c)}`,meta:{path:c,fullPath:c,relativePath:c}}))}catch(s){return _t.debug("[FolderProvider] Failed to get folders:",s),[]}}}const $I=10,BI=.3;function zI(n){const e=n.toLowerCase().split(/\s+/).filter(Boolean);return(t,r)=>{const s=t?Nn(n,t):null;if(s)return 1+s.score;if(r){const i=r.toLowerCase();if(e.every(o=>i.includes(o)))return BI}return 0}}class FI{constructor(){nt(this,"id","note");nt(this,"triggers",["@note","@n"]);nt(this,"supportsRanges",!0);nt(this,"cachedNotes",[]);nt(this,"lastCacheUpdate",0);nt(this,"cacheTimeout",5e3)}async getSiblingWorkspaces(e){if(!e)return[];try{const[{store:t},{selectWorkspaceItems:r}]=await Promise.all([cs(()=>import("./i-jR1dYx.js"),__vite__mapDeps([13,14,15,2,16,17,11,5,3,1,9,18,19]),import.meta.url),cs(()=>import("./KQTrHxko.js").then(o=>o.dR),__vite__mapDeps([20,11,5,1,2,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24]),import.meta.url)]),s=r.select(t.state),i=s.find(o=>o.id===e);return!i||!i.repositoryPath?[]:s.filter(o=>o.id!==e&&o.repositoryPath===i.repositoryPath)}catch(t){return _t.debug("[NoteProvider] Failed to get sibling workspaces:",t),[]}}async fetchNotesFromWorkspace(e,t){try{const[{store:r},{listSlimNotesRequested:s}]=await Promise.all([cs(()=>import("./i-jR1dYx.js"),__vite__mapDeps([13,14,15,2,16,17,11,5,3,1,9,18,19]),import.meta.url),cs(()=>import("./CRwmdgt6.js").then(o=>o.Kw),__vite__mapDeps([14,15,2,16,17,11,5,3,1,9]),import.meta.url)]);return(await r.dispatch(s(e))).map(o=>({note:o,workspaceId:e,workspaceTitle:t}))}catch(r){_t.debug(`[NoteProvider] Failed to fetch notes from workspace ${e}:`,r)}return[]}async search(e,t){if(!t.workspaceId)return[];const r=e.trim(),s=r?zI(r):null;try{const i=await this.fetchNotesFromWorkspace(t.workspaceId),a=(await this.getSiblingWorkspaces(t.workspaceId)).map(p=>this.fetchNotesFromWorkspace(p.id,p.title)),u=(await Promise.all(a)).flat(),d=[...i,...u],h=(s?d.map(p=>({entry:p,score:s(p.note.title,p.note.content||p.note.contentPreview)})).filter(({score:p})=>p>0).sort((p,g)=>g.score-p.score):d.map(p=>({entry:p,score:void 0}))).slice(0,$I).map(({entry:{note:p,workspaceId:g,workspaceTitle:v},score:m})=>{const S=g===t.workspaceId,I=S?void 0:_.chat_mentions_fromWorkspace_subtitle({workspace:v||g}),C=p.content||p.contentPreview;return{candidate:{id:p.id,type:"note",label:p.title||p.id||_.chat_mentions_untitledNote_label(),subtitle:I,description:C?`${C.substring(0,100)}...`:"",icon:"📝",uri:`devspace://note/${p.id}`,meta:{preview:C?.substring(0,200)||"",workspaceId:g,...S?{}:{isExternalLink:!0}}},score:m}});if(this.cachedNotes=h.map(({candidate:p})=>p),this.lastCacheUpdate=Date.now(),h.length>0)return h.map(({candidate:p,score:g})=>g!==void 0?{...p,score:g}:p)}catch(i){_t.debug("[NoteProvider] Failed to fetch notes:",i)}return this.cachedNotes.length>0?s?this.cachedNotes.map(i=>({...i,score:s(i.label,i.meta?.preview)})).filter(i=>i.score>0).sort((i,o)=>o.score-i.score):this.cachedNotes:[]}getCachedNotes(){return Date.now()-this.lastCacheUpdate>this.cacheTimeout?[]:this.cachedNotes}}class HI{constructor(){nt(this,"id","external");nt(this,"triggers",["@docs","@external"])}async search(e,t){return[{id:"react-docs",label:"React Documentation",url:"https://react.dev",description:"Official React documentation"},{id:"mdn",label:"MDN Web Docs",url:"https://developer.mozilla.org",description:"Web technology documentation"},{id:"typescript",label:"TypeScript Handbook",url:"https://www.typescriptlang.org/docs/",description:"TypeScript documentation"}].filter(s=>!e||Nn(e,s.label)!==null).map(s=>({id:`external-${s.id}`,type:"external-source",label:s.label,description:s.description,icon:"📚",uri:`devspace://external/${s.id}`,meta:{url:s.url}}))}}class UI{constructor(){nt(this,"id","rule");nt(this,"triggers",["@rule","@intent"])}async search(e,t){return[{path:".intent/rules/cli.md",label:"CLI Rules"},{path:".intent/rules/frontend.md",label:"Frontend Rules"},{path:".intent/rules/python.md",label:"Python Rules"},{path:".intent/rules/sidecar.md",label:"Sidecar Rules"},{path:".intent/rules/systems.md",label:"Systems Rules"}].filter(s=>!e||Nn(e,s.label)!==null).map(s=>({id:s.path,type:"rule",label:s.label,subtitle:s.path,icon:"📚",uri:`devspace://rule/${encodeURIComponent(s.path)}`,meta:{path:s.path}}))}}class VI{constructor(){nt(this,"id","task");nt(this,"triggers",["@task","@todo"])}async search(e,t){return[{id:"task-1",label:"Implement authentication",status:"in_progress",assignee:"John Doe"},{id:"task-2",label:"Write tests",status:"not_started",assignee:"Jane Smith"},{id:"task-3",label:"Deploy to production",status:"completed",assignee:"Bob Johnson"}].filter(s=>!e||Nn(e,s.label)!==null).map(s=>({id:`task-${s.id}`,type:"task",label:s.label,subtitle:`${s.status} • ${s.assignee}`,icon:"📋",uri:`devspace://task/${s.id}`,meta:{taskStatus:s.status,assignee:s.assignee}}))}}class WI{constructor(){nt(this,"id","personality");nt(this,"triggers",["@personality","@persona"]);nt(this,"personalities",[{id:"auggie-personality-agent-default",name:"Agent Auggie",description:"Default helpful AI assistant",icon:"🤖",temperature:.7,model:"default",promptToken:"auggie-personality-agent-default"},{id:"auggie-personality-prototyper",name:"Prototyper Auggie",description:"Specialized in rapid prototyping",icon:"⚡",temperature:.7,model:"default",promptToken:"auggie-personality-prototyper"},{id:"auggie-personality-brainstorm",name:"Brainstorm Auggie",description:"Creative ideation and exploration",icon:"💡",temperature:.7,model:"default",promptToken:"auggie-personality-brainstorm"},{id:"auggie-personality-reviewer",name:"Reviewer Auggie",description:"Code review and feedback",icon:"🔍",temperature:.7,model:"default",promptToken:"auggie-personality-reviewer"}])}async search(e,t){return this.personalities.filter(r=>!e||Nn(e,r.name)!==null).map(r=>({id:r.id,type:"personality",label:r.name,subtitle:`${r.model}`,description:r.description,icon:r.icon,uri:`devspace://personality/${r.id}`,meta:{promptToken:r.promptToken}}))}}class KI{constructor(){nt(this,"id","command");nt(this,"triggers",["@cmd","@command"])}async search(e,t){return[dm.USE_DEFAULT_CONTEXT,dm.CLEAR_CONTEXT].filter(s=>!e||s.label.toLowerCase().includes(e.toLowerCase()))}}class jI{constructor(){nt(this,"id","terminal");nt(this,"triggers",["@terminal","@term"])}async search(e,t){try{const{terminalManager:r}=await cs(async()=>{const{terminalManager:v}=await import("./B2KJmqK3.js").then(m=>m.c);return{terminalManager:v}},__vite__mapDeps([25,2,1,26,27,9,5,28,29,14,15,16,17,11,3,0,4,6,7,8,10,12,22,30,31,32,33,34,35,36,23,37,38]),import.meta.url),{selectTerminals:s,selectTerminalDisplayName:i}=await cs(async()=>{const{selectTerminals:v,selectTerminalDisplayName:m}=await import("./DQ5DxPhl.js").then(S=>S.i);return{selectTerminals:v,selectTerminalDisplayName:m}},__vite__mapDeps([37,14,15,2,16,17,11,5,3,1,9]),import.meta.url),a=It.state;if(!t.workspaceId)return[];const c=s.select(a,t.workspaceId),u=r.loadTerminalMetadata(t.workspaceId),d=new Set,f=[];for(const v of c)d.add(v.id),f.push({id:v.id,name:i.select(a,t.workspaceId,v.id)});for(const v of u)d.has(v.terminalId)||(d.add(v.terminalId),f.push({id:v.terminalId,name:v.title||_.terminal_quakeOverlay_terminal_fallback()}));if(f.length===0)return[];const p=e?["terminal","term"].some(v=>v.startsWith(e.toLowerCase())||e.toLowerCase().startsWith(v)):!1;return(e&&!p?f.filter(v=>Nn(e,v.name)!==null):f).slice(0,10).map((v,m)=>({id:v.id,type:"terminal",label:v.name,subtitle:_.chat_mentions_terminalIndex_subtitle({index:m+1}),description:_.chat_mentions_terminalOutput_description(),icon:"💻",uri:`devspace://terminal/${encodeURIComponent(v.id)}`,meta:{workspaceId:t.workspaceId}}))}catch(r){return _t.debug("[TerminalProvider] Failed to get terminals:",r),[]}}}class GI{constructor(){nt(this,"id","script");nt(this,"triggers",["@script","@scripts"])}async search(e,t){try{const{selectScriptEntries:r}=await cs(async()=>{const{selectScriptEntries:c}=await import("./BENBNSN7.js");return{selectScriptEntries:c}},__vite__mapDeps([39,14,15,2,16,17,11,5,3,1,9,40,20,21,8,4,6,22,0,7,10,12,23,24,41,27,26,42,43,44,30,29,45,46]),import.meta.url);if(!t.workspaceId)return[];const s=r.select(It.state,t.workspaceId);if(s.length===0)return[];const o=e?["script","scripts"].some(c=>c.startsWith(e.toLowerCase())||e.toLowerCase().startsWith(c)):!1;return(e&&!o?s.filter(c=>Nn(e,c.name)!==null||Nn(e,wp(c))!==null):s).slice(0,10).map(c=>{const u=c.runtime.status,d=Cp(u)?_.chat_mentions_scriptRunning_label():u==="exited"?_.chat_mentions_scriptExited_label():_.chat_mentions_scriptIdle_label();return{id:c.id,type:"script",label:c.name,subtitle:`${d} · ${wp(c)}`,description:_.chat_mentions_scriptOutput_description(),icon:"▶️",uri:`devspace://script/${encodeURIComponent(c.id)}`,meta:{workspaceId:t.workspaceId,command:c.command,status:Cp(u)?"ok":u==="exited"?"warning":void 0}}})}catch(r){return _t.debug("[ScriptProvider] Failed to get scripts:",r),[]}}}class qI{constructor(){nt(this,"id","specialist");nt(this,"triggers",["@specialist","@spec"])}async search(e,t){try{const r=sk.select(It.state);return!r||r.length===0?[]:r.filter(s=>e?Nn(e,s.name)!==null||Nn(e,s.id)!==null||Nn(e,s.description)!==null||Nn(e,"specialist")!==null:!0).map(s=>({id:`specialist-${s.id}`,type:"specialist",label:s.name,subtitle:s.description,description:s.description,icon:"👤",uri:`devspace://specialist/${encodeURIComponent(s.id)}`,group:"Specialists",score:.8,meta:{promptToken:`specialist/${s.id}`}})).slice(0,10)}catch(r){return _t.debug("[SpecialistProvider] Failed to get specialists:",r),[]}}}class JI{constructor(){nt(this,"id","agent");nt(this,"triggers",["@agent"])}async search(e,t){try{const{selectAllWorkspaceAgents:r}=await cs(async()=>{const{selectAllWorkspaceAgents:a}=await import("./KQTrHxko.js").then(c=>c.dQ);return{selectAllWorkspaceAgents:a}},__vite__mapDeps([20,11,5,1,2,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24]),import.meta.url),s=t.workspaceId;if(!s)return[];const i=r.select(It.state,s);if(i.length===0)return[];const o=[];for(const a of i){const c=a.id,u=a.name||c,d=a.metadata?.specialist||"";let f=a.metadata?.specialistName||"";if(d&&!f){const m=rk.select(It.state,d);m&&(f=m.name)}if(e){const m=Nn(e,u)!==null,S=Nn(e,"agent")!==null,I=f&&Nn(e,f)!==null,C=d&&Nn(e,d)!==null;if(!m&&!S&&!I&&!C)continue}const h=a.isStreaming?"responding":a.status||"active",p=[];f?p.push(f):p.push("Agent"),p.push(h);const g=a.messages?.length||0;g>0&&p.push(`${g} msg${g!==1?"s":""}`);const v=a.lastActivity||a.lastModified;v&&!a.isStreaming&&p.push(Hx(new Date(v))),o.push({id:c,type:"agent",label:u,subtitle:p.join(" · "),description:f?_.chat_mentions_specialistAgentInWorkspace_description({specialist:f}):_.chat_mentions_agentInWorkspace_description(),icon:"🤖",uri:`devspace://agent/${encodeURIComponent(c)}`,group:_.chat_mentions_agents_group(),score:.7,meta:{workspaceId:s}})}return o.slice(0,10)}catch(r){return _t.debug("[AgentProvider] Failed to get agents:",r),[]}}}class XI{constructor(){nt(this,"providers",new Map);nt(this,"defaultProviders",[]);this.register(new OI),this.register(new DI),this.register(new FI),this.register(new HI),this.register(new UI),this.register(new VI),this.register(new WI),this.register(new KI),this.register(new jI),this.register(new GI),this.register(new JI),this.register(new qI),this.register(new NI),this.defaultProviders=["file","folder","note","terminal","script","agent","specialist","member"]}register(e){this.providers.set(e.id,e),_t.debug("[ProviderRegistry] Registered provider:",e.id)}unregister(e){this.providers.delete(e)}get(e){return this.providers.get(e)}getAll(){return Array.from(this.providers.values())}getDefault(){return this.defaultProviders.map(e=>this.providers.get(e)).filter(Boolean)}getByTrigger(e){return Array.from(this.providers.values()).filter(t=>t.triggers?.includes(e))}async searchAll(e,t){const r=e.startsWith("@")?this.getByTrigger(e.split(" ")[0]):this.getDefault();return(await Promise.all(r.map(i=>i.search(e,t)))).flat()}}const Ca=new XI,YI=5e3,QI=8,ZI=100,eL=50,tL=/^devspace:\/\/[^\/]+\/([^\/]+)/,nL=[{id:"spec",label:"spec",type:"note",uri:"note:spec",score:1,get description(){return _.chat_mentions_specNote_description()}},{id:"plan",label:"plan",type:"note",uri:"note:plan",score:.95,get description(){return _.chat_mentions_planNote_description()}}],rL=[{id:"readme",label:"README.md",type:"file",uri:"file:README.md",score:.9},{id:"package",label:"package.json",type:"file",uri:"file:package.json",score:.85},{id:"tsconfig",label:"tsconfig.json",type:"file",uri:"file:tsconfig.json",score:.8},{id:"gitignore",label:".gitignore",type:"file",uri:"file:.gitignore",score:.75}],sL=[{id:"src",label:"src",type:"folder",uri:"folder:src",score:.7},{id:"lib",label:"lib",type:"folder",uri:"folder:lib",score:.65},{id:"components",label:"components",type:"folder",uri:"folder:components",score:.6}];function iL(n){return typeof n.getCachedNotes=="function"}class oL{constructor(e={}){nt(this,"searchService");nt(this,"breadcrumbController");nt(this,"resolvers",new Map);nt(this,"config");nt(this,"cachedResults",new Map);this.config={...e,typeOrder:e.typeOrder??PI},this.searchService=new LI(this.config),this.breadcrumbController=new k0}async search(e,t){if(!t?.workspaceId&&!t?.repoPath)return _t.error("[MentionSystem] search called without valid context (no workspaceId or repoPath)"),[];const r=(e||"").trim(),s=this.getProvidersForQuery(r);if(s.length===0)return _t.debug("[MentionSystem] No providers available for query:",r),[];try{return await this.searchService.search(r,s,t)}catch(i){return i instanceof DOMException&&i.name==="AbortError"||_t.error("[MentionSystem] Search failed:",i),[]}}searchSync(e,t){const r=e.toLowerCase();if(!t?.workspaceId&&!t?.repoPath)return _t.debug("[MentionSystem] searchSync called without workspaceId or repoPath - returning empty results"),[];const s=Na(e,this.getProvidersForQuery(e),t),i=Date.now();if(this.cachedResults.has(s)){const a=this.cachedResults.get(s);if(a&&i-a.timestamp<YI)return this.cachedResults.delete(s),this.cachedResults.set(s,a),a.results}this.updateCache(e,t).catch(a=>{_t.warn("[MentionSystem] Background cache update failed:",a)});const o=[];return o.push(...this.getNoteCandidates(r)),o.push(...this.filterCandidates(rL,r,3)),o.push(...this.filterCandidates(sL,r,2)),C0(o,this.config.typeOrder??[]).slice(0,QI)}getNoteCandidates(e){const t=Ca.get("note");if(t&&iL(t))try{return(t.getCachedNotes()||[]).filter(s=>!e||s.label&&typeof s.label=="string"&&s.label.toLowerCase().includes(e)).slice(0,3)}catch(r){_t.warn("[MentionSystem] Failed to get cached notes:",r)}return this.filterCandidates(nL,e,3)}filterCandidates(e,t,r){return t?e.filter(s=>s.label.toLowerCase().includes(t)).slice(0,r):e.slice(0,r)}async updateCache(e,t){try{const r=Na(e,this.getProvidersForQuery(e),t),s=await this.search(e,t);if(r!==Na(e,this.getProvidersForQuery(e),t))return;const i={results:s,timestamp:Date.now()};this.cachedResults.delete(r),this.cachedResults.set(r,i);const o=Ca.get("note");if(o&&await o.search(e,t),this.cachedResults.size>ZI){const a=this.cachedResults.size-eL,c=Array.from(this.cachedResults.keys()).slice(0,a);for(const u of c)this.cachedResults.delete(u);_t.debug(`[MentionSystem] Cache cleanup: removed ${a} entries`)}}catch(r){_t.warn("[MentionSystem] Cache update failed:",r)}}getProvidersForQuery(e){if(!e)return Ca.getDefault();if(e.startsWith("@")){const r=e.indexOf(" "),s=r>0?e.substring(0,r):e,i=Ca.getByTrigger(s);if(i.length>0)return _t.debug("[MentionSystem] Using triggered providers for:",s),i}const t=Ca.getDefault();return _t.debug("[MentionSystem] Using default providers, count:",t.length),t}async resolve(e){if(!e||typeof e!="string")return _t.warn("[MentionSystem] Invalid URI provided to resolve:",e),{exists:!1,type:"file",label:"Invalid URI",error:"Invalid URI provided"};const t=this.findResolver(e);if(!t)return _t.debug("[MentionSystem] No resolver found for URI:",e),{exists:!1,type:"file",label:"Unknown",error:`No resolver found for URI: ${e}`};try{return await t.resolve(e)}catch(r){const s=r instanceof Error?r.message:String(r);return _t.error("[MentionSystem] Resolution error:",{uri:e,error:s}),{exists:!1,type:"file",label:"Error",error:s}}}async getPreview(e){if(!e||typeof e!="string")return _t.warn("[MentionSystem] Invalid URI provided to getPreview:",e),null;try{return(await this.resolve(e)).preview||null}catch(t){return _t.error("[MentionSystem] Failed to get preview:",t),null}}registerProvider(e){if(!e){_t.error("[MentionSystem] Cannot register null/undefined provider");return}if(!e.id){_t.error("[MentionSystem] Cannot register provider without id");return}try{Ca.register(e),_t.debug(`[MentionSystem] Registered provider: ${e.id}`)}catch(t){_t.error("[MentionSystem] Failed to register provider:",t)}}registerResolver(e,t){if(!e||!t){_t.error("[MentionSystem] Cannot register resolver with invalid type or resolver");return}this.resolvers.has(e)&&_t.warn(`[MentionSystem] Overwriting existing resolver for type: ${e}`),this.resolvers.set(e,t),_t.debug(`[MentionSystem] Registered resolver for type: ${e}`)}findResolver(e){if(!e||typeof e!="string")return;const t=e.match(tL);if(t&&t[1]){const s=t[1];return this.resolvers.get(s)}const r=e.indexOf(":");if(r>0&&r<e.length-1){const s=e.substring(0,r).toLowerCase();if(/^[a-z0-9]+$/.test(s))return this.resolvers.get(s)}_t.debug(`[MentionSystem] No resolver found for URI pattern: ${e}`)}getBreadcrumbController(){return this.breadcrumbController}clearCache(){this.searchService.clearCache(),this.cachedResults.clear(),_t.debug("[MentionSystem] All caches cleared")}destroy(){try{this.searchService.destroy(),this.breadcrumbController.destroy(),this.cachedResults.clear(),this.resolvers.clear(),_t.debug("[MentionSystem] System destroyed successfully")}catch(e){_t.error("[MentionSystem] Error during destroy:",e)}}}let Dd=null;function aL(n){return Dd||(Dd=new oL(n),_t.debug("[MentionSystem] Created new instance with config:",n)),Dd}const lL=MA.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])',getAttrs:n=>n.getAttribute("href")?null:!1}]},renderHTML({HTMLAttributes:n}){return["a",n,0]},addAttributes(){return{href:{default:null,parseHTML:n=>n.getAttribute("href"),renderHTML:n=>n.href?{href:n.href}:{}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},addCommands(){return{setLink:n=>({commands:e})=>n.href===null||n.href===void 0?e.unsetMark(this.name):e.setMark(this.name,n)}}});function M0(n={}){return lL.configure({validate:void 0,...n})}const f$=M0,hm=n=>n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),cL={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},uL=n=>n.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(e,t)=>{if(t[0]==="#"){const r=t[1]==="x"||t[1]==="X"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(r)&&r<=1114111?String.fromCodePoint(r):e}return cL[t]??e});function dL(n){const e=[];let t=0;for(const r of fw(n,"markdown",{decode:uL})){r.index>t&&e.push(n.slice(t,r.index));const s=r.parsed?hw(r.parsed):null;if(s){const i=s.attributes.map(([o,a])=>` ${o}="${hm(a)}"`).join("");e.push(`<span${i} class="${s.className}">${hm(s.text)}</span>`)}else e.push(r.text);t=r.index+r.text.length}return t<n.length&&e.push(n.slice(t)),e.join("")}const fL=new Set(["code","pre","script","style","a"]);function hL(n){const e=[];let t=0;const r=[];for(;t<n.length;)if(n[t]==="<"){const s=n.indexOf(">",t);if(s===-1){e.push(n.slice(t));break}const i=n.slice(t,s+1),o=i.match(/^<\/\s*([a-zA-Z][a-zA-Z0-9]*)/);if(o){const c=o[1].toLowerCase();r.length>0&&r[r.length-1]===c&&r.pop(),e.push(i),t=s+1;continue}const a=i.match(/^<\s*([a-zA-Z][a-zA-Z0-9]*)/);if(a){const c=a[1].toLowerCase(),u=i.endsWith("/>");(fL.has(c)||i.includes("data-mention")||i.includes("data-math-source"))&&!u&&r.push(c)}e.push(i),t=s+1}else{const s=n.indexOf("<",t),i=s===-1?n.length:s,o=n.slice(t,i);r.length===0&&o.length>0?e.push(dL(o)):e.push(o),t=i}return e.join("")}function pL(n){return n.replace(/^ +| +$/g,e=>" ".repeat(e.length)).replace(/ {2,}/g,e=>` ${" ".repeat(e.length-1)}`)}function gL(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mL(n,e){const t=[...new Set(e.filter(Boolean))].map(s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")).sort((s,i)=>i.length-s.length);if(t.length===0)return n;const r=new RegExp(`(^|[\\s\\u00A0])/(${t.map(gL).join("|")})(?=$|[\\s\\u00A0])`,"gu");return n.replace(r,(s,i,o)=>{const a=o.replace(/"/g,"&quot;");return`${i}<span data-type="skill-command" data-skill-name="${a}" class="skill-command-chip type-code" role="code" aria-label="/${a}" contenteditable="false">/${o}</span>`})}function vL(n,e=[]){if(!n)return"";const t=n.trim();if(t.startsWith("<")&&!t.startsWith("<!--anchor:"))return n;const s=`<p>${n.split(`
158
158
  `).map(i=>{if(i==="")return"";const o=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return mL(pL(o),e)}).join("<br>")}</p>`;return hL(s)}function Ma(n){return(n?.getText({blockSeparator:`
159
159
 
160
160
  `,textSerializers:{hardBreak:()=>`
161
161
  `}})??"").replace(/\u00A0/g," ")}function bL(n,e){const t=e.replace(/\r\n?/g,`
162
162
  `),r=[];return t.split(`
163
- `).forEach((s,i)=>{i>0&&r.push(n.nodes.hardBreak.create()),s!==""&&r.push(n.text(s))}),[n.nodes.paragraph.create(null,r)]}const yL={dismiss:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z",undo:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"},gl=new Dn("trailingHint");function pm(n,e){n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),e.onActivate()})}function gm(n,e){let t=null,r=null;const s=()=>{t&&clearTimeout(t),t=null,r?.remove(),r=null},i=()=>{s(),t=setTimeout(()=>{if(!n.isConnected)return;const o=n.getBoundingClientRect();r=document.createElement("div"),r.className="prompt-trailing-hint-tooltip",r.role="tooltip",r.textContent=e,document.body.append(r);const a=r.getBoundingClientRect(),c=a.width/2,u=o.left+o.width/2,d=Math.min(window.innerWidth-c-8,Math.max(c+8,u)),f=o.top>=a.height+8;r.dataset.side=f?"top":"bottom",r.style.left=`${d}px`,r.style.top=`${f?o.top-8:o.bottom+8}px`},300)};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("mousedown",s),n.addEventListener("blur",s)}function wL(n,e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 256 256"),t.setAttribute("aria-hidden","true");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",yL[e]),t.append(r),n.append(t)}function xL(n){const e=document.createElement(n.icon?"span":"button");if(e.contentEditable="false",e.className="prompt-trailing-hint",e.dataset.state=n.kind,e instanceof HTMLButtonElement&&(e.type="button",e.tabIndex=-1,e.setAttribute("aria-label",n.ariaLabel),gm(e,n.ariaLabel),pm(e,n)),n.label){const t=document.createElement("span");t.textContent=n.label,e.append(t)}if(n.icon){const t=document.createElement("button");t.type="button",t.tabIndex=-1,t.contentEditable="false",t.className="prompt-trailing-hint-action",t.setAttribute("aria-label",n.ariaLabel),gm(t,n.ariaLabel),wL(t,n.icon),pm(t,n),e.append(t)}if(n.shortcut){const t=document.createElement("kbd");t.textContent=n.shortcut,e.append(t)}return e}function kL(n){let e=1;return n.descendants((t,r)=>{t.isText&&t.textContent.trim()&&(e=r+t.nodeSize)}),e}const _L=zn.create({name:"trailingHint",addProseMirrorPlugins(){return[new kn({key:gl,state:{init:()=>null,apply(n,e){const t=n.getMeta(gl);return t===void 0?e:t}},props:{handleKeyDown(n,e){const t=gl.getState(n.state),{selection:r,doc:s}=n.state,i=e.key==="ArrowRight"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey,o=r.empty&&r.to>=s.content.size-1;return t?.shortcut!=="→"||!i||!o?!1:(e.preventDefault(),t.onActivate(),!0)},decorations(n){const e=gl.getState(n);if(!e)return Yt.empty;const t=kL(n.doc);return Yt.create(n.doc,[Rr.widget(t,()=>xL(e),{key:`prompt-trailing-hint-${e.kind}`,side:1,ignoreSelection:!0,stopEvent:r=>r.type==="mousedown"||r.type==="click"})])}}})]}});var SL=N('<div class="slash-skill-state svelte-m8tzng" role="status" aria-live="polite"> </div>'),CL=N('<div class="slash-skill-state svelte-m8tzng" role="alert"> <!></div>'),ML=N('<div class="slash-skill-state svelte-m8tzng" role="status"> </div>'),TL=N('<span class="type-body"> </span>'),EL=N('<div class="slash-skill-notice svelte-m8tzng" role="note"> </div>'),AL=N('<div class="slash-skill-options svelte-m8tzng" role="listbox" tabindex="-1"></div> <!>',1),RL=N('<div class="slash-skill-suggestion-list w-full max-w-72 overflow-hidden rounded-(--radius-medium) border border-border bg-popover text-popover-foreground shadow-(--elevation-overlay)"><!></div>');function T0(n,e){const t=Vi();if(new.target)return Nt({component:T0,...n});Lt(e,!0);let r=y(e,"items",23,()=>[]),s=y(e,"loading",7,!1),i=y(e,"error",7,null),o=y(e,"listboxId",23,()=>`${t}-listbox`),a=y(e,"emptyLabel",7),c=y(e,"notice",7),u=y(e,"onSelect",7),d=y(e,"onDismiss",7),f=y(e,"onRetry",7),h=y(e,"onActiveOptionChange",7),p=fe(0),g=fe(void 0);const v=w(()=>!s()&&!i()&&r()[l(p)]?m(r()[l(p)]):void 0);function m($){return`${t}-option-${encodeURIComponent(`${$.name}:${$.location}`)}`}ft(()=>{r(),s(),i(),x(p,0)}),ft(()=>{h()?.(l(v))});function S(){l(g)?.querySelector('[role="option"][aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})}function I($){r().length!==0&&(x(p,(l(p)+$+r().length)%r().length),S())}function C($){const X=r()[$];X&&!s()&&!i()&&u()(X)}function M($){if((s()||i())&&$.key!=="Escape")return!1;switch($.key){case"ArrowUp":return r().length===0?!1:($.preventDefault(),$.stopPropagation(),I(-1),!0);case"ArrowDown":return r().length===0?!1:($.preventDefault(),$.stopPropagation(),I(1),!0);case"Enter":return r().length===0?!1:($.preventDefault(),$.stopPropagation(),C(l(p)),!0);case"Escape":return $.preventDefault(),$.stopPropagation(),d()?.(),!0;default:return!1}}function O({event:$}){return M($)}var P={onKeyDown:O,get items(){return r()},set items($=[]){r($),b()},get loading(){return s()},set loading($=!1){s($),b()},get error(){return i()},set error($=null){i($),b()},get listboxId(){return o()},set listboxId($=`${t}-listbox`){o($),b()},get emptyLabel(){return a()},set emptyLabel($){a($),b()},get notice(){return c()},set notice($){c($),b()},get onSelect(){return u()},set onSelect($){u($),b()},get onDismiss(){return d()},set onDismiss($){d($),b()},get onRetry(){return f()},set onRetry($){f($),b()},get onActiveOptionChange(){return h()},set onActiveOptionChange($){h($),b()},$set:Dt,$on:($,X)=>$t(e,$,X)},E=RL(),z=te(E);{var G=$=>{var X=SL(),de=re(X,!0);L(me=>B(de,me),[()=>_.chat_slashSkillSuggestionList_loading_label()]),k($,X)},J=$=>{var X=CL(),de=te(X),me=R(de);{var ie=q=>{Ze(q,{variant:"ghost",size:"sm",onpointerdown:j=>j.preventDefault(),get onclick(){return f()},children:(j,ne)=>{Ht();var we=Vt();L(be=>B(we,be),[()=>_.ui_errorToast_retry_label()]),k(j,we)},$$slots:{default:!0}})};V(me,q=>{f()&&q(ie)})}Y(X),L(q=>B(de,`${q??""} `),[()=>_.chat_slashSkillSuggestionList_loadFailed_label()]),k($,X)},K=$=>{var X=ML(),de=re(X,!0);L(me=>B(de,me),[()=>a()??_.chat_slashSkillSuggestionList_noResults_label()]),k($,X)},Q=$=>{var X=AL(),de=ce(X);Cs(de,23,r,q=>`${q.name}:${q.location}`,(q,j,ne)=>{Eu(q,{get content(){return l(j).description},side:"right",align:"start",size:"sm",class:"w-full",children:(we,be)=>{{let Se=w(()=>m(l(j))),se=w(()=>br(Jf(),"slash-skill-option h-auto rounded-none border-0 bg-transparent py-1.5 text-inherit shadow-none hover:border-0 hover:text-inherit focus-visible:border-0 active:border-0",l(p)===l(ne)&&"active")),oe=w(()=>l(p)===l(ne));Ze(we,{type:"button",get id(){return l(Se)},variant:"ghost",size:"sm",labelClass:"type-body",get class(){return l(se)},role:"option",tabindex:-1,get"aria-label"(){return l(j).name},get"aria-selected"(){return l(oe)},onpointerenter:()=>x(p,l(ne),!0),onpointerdown:H=>H.preventDefault(),onclick:()=>C(l(ne)),children:(H,W)=>{var D=TL(),ae=re(D,!0);L(()=>B(ae,l(j).name)),k(H,D)},$$slots:{default:!0}})}},$$slots:{default:!0}})}),Y(de),Qn(de,q=>x(g,q),()=>l(g));var me=R(de,2);{var ie=q=>{var j=EL(),ne=re(j,!0);L(()=>B(ne,c())),k(q,j)};V(me,q=>{c()&&q(ie)})}L(q=>{xt(de,"id",o()),xt(de,"aria-label",q),xt(de,"aria-activedescendant",l(v))},[()=>_.chat_slashSkillSuggestionList_ariaLabel()]),Kr("keydown",de,M),k($,X)};V(z,$=>{s()?$(G):i()?$(J,1):r().length===0?$(K,2):$(Q,-1)})}return Y(E),k(n,E),Ot(P)}So(["keydown"]);const mm=/\s/u;function PL(n,e=n.length){if(e<0||e>n.length)return null;let t=e-1;for(;t>=0&&!mm.test(n[t]);)t-=1;if(t+=1,n[t]!=="/"||e<t+1)return null;let r=t+1;for(;r<n.length&&!mm.test(n[r]);)r+=1;return e>r?null:{query:n.slice(t+1,e),from:t,to:r}}function IL(n,e){if(!e)return 0;const t=n.name.toLowerCase(),r=n.description.toLowerCase();return t===e?0:t.startsWith(e)?1:t.includes(e)?2:r.includes(e)?3:null}function $d(n,e){const t=n.toLowerCase(),r=e.toLowerCase();return t<r?-1:t>r?1:n<e?-1:n>e?1:0}function LL(n,e){const t=e.toLowerCase();return n.map(r=>({skill:r,rank:IL(r,t)})).filter(r=>r.rank!==null).sort((r,s)=>r.rank-s.rank||$d(r.skill.name,s.skill.name)||$d(r.skill.location,s.skill.location)||$d(r.skill.description,s.skill.description)).map(({skill:r})=>r)}var OL=N('<div class="tiptap-root svelte-bv9i3d"><!> <div></div></div>');function NL(n,e){const t=Vi();if(new.target)return Nt({component:NL,...n});Lt(e,!0);const r=fP.extend({parseHTML(){return[{tag:"span[data-mention]",getAttrs:A=>{const ve=A.getAttribute("data-meta");let Ee={};if(ve)try{Ee=JSON.parse(ve)}catch{Ee={}}return{id:A.getAttribute("data-id")||A.textContent?.replace(/^@/,"")||null,label:A.getAttribute("data-label")||A.textContent?.replace(/^@/,"")||null,type:A.getAttribute("data-type")||"file",uri:A.getAttribute("data-uri")||"",meta:Ee}}}]},addAttributes(){return{id:{default:null,parseHTML:A=>A.getAttribute?.("data-id")||A.textContent?.replace(/^@/,"")||null,renderHTML:A=>A.id?{"data-id":A.id}:{}},label:{default:null,parseHTML:A=>A.getAttribute?.("data-label")||A.textContent?.replace(/^@/,"")||null,renderHTML:A=>A.label?{"data-label":A.label}:{}},type:{default:"file",parseHTML:A=>A.getAttribute?.("data-type")||"file",renderHTML:A=>({"data-type":A.type||"file"})},uri:{default:"",parseHTML:A=>A.getAttribute?.("data-uri")||"",renderHTML:A=>A.uri?{"data-uri":A.uri}:{}},meta:{default:{},parseHTML:A=>{const ve=A.getAttribute?.("data-meta");if(!ve)return{};try{return JSON.parse(ve)}catch{return{}}},renderHTML:A=>({"data-meta":JSON.stringify(A.meta||{})})}}}}),s=Ga("TipTapEditor"),i=aL();let o=y(e,"value",7,""),a=y(e,"ariaLabel",23,()=>_.chat_richInput_editor_ariaLabel()),c=y(e,"placeholder",23,()=>_.chat_richInput_askAnything_placeholder()),u=y(e,"reactivePlaceholder",7,!1),d=y(e,"disabled",7,!1),f=y(e,"editableWhileDisabled",7,!1),h=y(e,"inputLocked",7,!1),p=y(e,"class",7,""),g=y(e,"editorClassName",7,""),v=y(e,"workspace",7),m=y(e,"repoPath",7),S=y(e,"autoFocus",7,!1),I=y(e,"onUpdate",7),C=y(e,"onSubmit",7),M=y(e,"onForceSubmit",7),O=y(e,"onEscape",7),P=y(e,"onHistoryPrev",7),E=y(e,"onHistoryNext",7),z=y(e,"onMentionStart",7),G=y(e,"onMentionSelect",7),J=y(e,"onSelectionChange",7),K=y(e,"contextItems",23,()=>[]),Q=y(e,"trailingHint",7,null),$=y(e,"skills",23,()=>[]),X=y(e,"skillsLoading",7,!1),de=y(e,"skillsError",7,null),me=y(e,"onSkillsRetry",7),ie=y(e,"slashEmptyLabel",7),q=y(e,"slashNotice",7),j=y(e,"unavailableSkillTitle",7),ne=y(e,"screenReferences",7),we=y(e,"screenInsertions",23,()=>[]),be=y(e,"screenInterim",23,()=>[]),Se=y(e,"screenSpeechActive",7,!1),se=y(e,"onScreenInsertionApplied",7),oe=y(e,"onCompositionChange",7),H=y(e,"onUserTextInput",7),W=y(e,"onScreenReferencesEdited",7),D=y(e,"minHeight",7,80),ae=y(e,"maxHeight",7,300);const ge=qm();let ue=fe(null);ft(()=>{if(!(!l(ue)||!ge))return ge.register(l(ue),()=>Xt())});const pe=w(()=>(!d()||f())&&!h()),ke=w(()=>!l(pe)&&!h());let ye=fe(void 0),Z=fe(null),$e=fe(!1);const lt=new Set;function St(){const A=l(Z);if(!A||l($e)||A.view.composing)return!1;if(!ne())return!0;qP(A,ne()),JP(A,ne());for(const ve of we().slice(0,1)){if(lt.has(ve.id)){if(!se())return!1;se()(ve.id,Ma(A));continue}const Ee=fo.getState(A.state)?.anchor;if(!se()||!XP(A,ve,ne(),Ee))return!1;lt.add(ve.id),se()(ve.id,Ma(A))}return we().length<=1}ft(()=>{c();const A=l(Z);!u()||!A||A.isDestroyed||ii(()=>A.view.dispatch(A.state.tr.setMeta("placeholder-refresh",!0)))}),ft(()=>{ne(),we(),!(!l(Z)||l($e)||!l(pe))&&ii(()=>St())}),ft(()=>{const A=l(Z),ve=be(),Ee=ne(),gt=Se()||we().length>0;!A||!Ee||l($e)||A.view.composing||ii(()=>{const Ie=fo.getState(A.state),xe=A.state.tr.setMeta(fo,ve.length||gt?{parts:ve,references:Ee,anchor:Ie?.anchor??A.state.selection.from,ariaLabel:_.hardwareConsole_ptt_listening_label()}:null);A.view.dispatch(ve.length?xe.scrollIntoView():xe);const on=A.view.dom.querySelector("[data-screen-interim]"),{selection:gn}=A.state;if(on?.parentNode&&A.view.hasFocus()&&gn.empty&&gn.from===fo.getState(A.state)?.anchor){const Fe=Array.prototype.indexOf.call(on.parentNode.childNodes,on);window.getSelection()?.collapse(on.parentNode,Fe+1)}})});let De=null,Le=null,Qe;function Ct(){Qe?.(),Qe=void 0,De&&io(De),Le?.remove(),De=null,Le=null}let bt=!1;ft(()=>{l(Z)&&l(Z).view.dom.setAttribute("aria-label",a())});let sn=fe(!1),Be=fe(null),he=fe(null),Ne=fe(null),je=fe(null);const Tt=`slash-skill-listbox-${t}`;let ee=fe(void 0);const Ge=w(()=>l(Be)?LL($(),l(Be).query):[]),it=w(()=>l(Be)?`${l(Be).from}:${l(Be).to}:${l(Be).query}`:null),Xe=w(()=>l(sn)&&l(Be)!==null&&l(it)!==l(he)&&l(Be).from!==l(Ne)&&(l(Ge).length>0||ie()!==void 0&&l(Be).query===""&&!X())&&l(pe));ft(()=>{const A=l(Z),ve=l(ye),Ee=j();if(!A||!ve)return;const gt=()=>{for(const Ie of ve.querySelectorAll('[data-type="skill-command"]')){const xe=Ee?.(Ie.dataset.skillName??"");Ie.classList.toggle("skill-command-chip--unavailable",xe!==void 0),xe?Ie.title=xe:Ie.removeAttribute("title")}};return gt(),A.on("update",gt),()=>{A.off("update",gt)}}),ft(()=>{if(l(Xe))return ja(Xt)});function mt(A){return{...Mh(A.schema),hardBreak:()=>`
163
+ `).forEach((s,i)=>{i>0&&r.push(n.nodes.hardBreak.create()),s!==""&&r.push(n.text(s))}),[n.nodes.paragraph.create(null,r)]}const yL={dismiss:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z",undo:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"},gl=new Dn("trailingHint");function pm(n,e){n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),e.onActivate()})}function gm(n,e){let t=null,r=null;const s=()=>{t&&clearTimeout(t),t=null,r?.remove(),r=null},i=()=>{s(),t=setTimeout(()=>{if(!n.isConnected)return;const o=n.getBoundingClientRect();r=document.createElement("div"),r.className="prompt-trailing-hint-tooltip",r.role="tooltip",r.textContent=e,document.body.append(r);const a=r.getBoundingClientRect(),c=a.width/2,u=o.left+o.width/2,d=Math.min(window.innerWidth-c-8,Math.max(c+8,u)),f=o.top>=a.height+8;r.dataset.side=f?"top":"bottom",r.style.left=`${d}px`,r.style.top=`${f?o.top-8:o.bottom+8}px`},300)};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("mousedown",s),n.addEventListener("blur",s)}function wL(n,e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 256 256"),t.setAttribute("aria-hidden","true");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",yL[e]),t.append(r),n.append(t)}function xL(n){const e=document.createElement(n.icon?"span":"button");if(e.contentEditable="false",e.className="prompt-trailing-hint",e.dataset.state=n.kind,e instanceof HTMLButtonElement&&(e.type="button",e.tabIndex=-1,e.setAttribute("aria-label",n.ariaLabel),gm(e,n.ariaLabel),pm(e,n)),n.label){const t=document.createElement("span");t.textContent=n.label,e.append(t)}if(n.icon){const t=document.createElement("button");t.type="button",t.tabIndex=-1,t.contentEditable="false",t.className="prompt-trailing-hint-action",t.setAttribute("aria-label",n.ariaLabel),gm(t,n.ariaLabel),wL(t,n.icon),pm(t,n),e.append(t)}if(n.shortcut){const t=document.createElement("kbd");t.textContent=n.shortcut,e.append(t)}return e}function kL(n){let e=1;return n.descendants((t,r)=>{t.isText&&t.textContent.trim()&&(e=r+t.nodeSize)}),e}const _L=zn.create({name:"trailingHint",addProseMirrorPlugins(){return[new kn({key:gl,state:{init:()=>null,apply(n,e){const t=n.getMeta(gl);return t===void 0?e:t}},props:{handleKeyDown(n,e){const t=gl.getState(n.state),{selection:r,doc:s}=n.state,i=e.key==="ArrowRight"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey,o=r.empty&&r.to>=s.content.size-1;return t?.shortcut!=="→"||!i||!o?!1:(e.preventDefault(),t.onActivate(),!0)},decorations(n){const e=gl.getState(n);if(!e)return Qt.empty;const t=kL(n.doc);return Qt.create(n.doc,[Rr.widget(t,()=>xL(e),{key:`prompt-trailing-hint-${e.kind}`,side:1,ignoreSelection:!0,stopEvent:r=>r.type==="mousedown"||r.type==="click"})])}}})]}});var SL=N('<div class="slash-skill-state svelte-m8tzng" role="status" aria-live="polite"> </div>'),CL=N('<div class="slash-skill-state svelte-m8tzng" role="alert"> <!></div>'),ML=N('<div class="slash-skill-state svelte-m8tzng" role="status"> </div>'),TL=N('<span class="type-body"> </span>'),EL=N('<div class="slash-skill-notice svelte-m8tzng" role="note"> </div>'),AL=N('<div class="slash-skill-options svelte-m8tzng" role="listbox" tabindex="-1"></div> <!>',1),RL=N('<div class="slash-skill-suggestion-list w-full max-w-72 overflow-hidden rounded-(--radius-medium) border border-border bg-popover text-popover-foreground shadow-(--elevation-overlay)"><!></div>');function T0(n,e){const t=Vi();if(new.target)return Nt({component:T0,...n});Lt(e,!0);let r=y(e,"items",23,()=>[]),s=y(e,"loading",7,!1),i=y(e,"error",7,null),o=y(e,"listboxId",23,()=>`${t}-listbox`),a=y(e,"emptyLabel",7),c=y(e,"notice",7),u=y(e,"onSelect",7),d=y(e,"onDismiss",7),f=y(e,"onRetry",7),h=y(e,"onActiveOptionChange",7),p=fe(0),g=fe(void 0);const v=w(()=>!s()&&!i()&&r()[l(p)]?m(r()[l(p)]):void 0);function m($){return`${t}-option-${encodeURIComponent(`${$.name}:${$.location}`)}`}ft(()=>{r(),s(),i(),x(p,0)}),ft(()=>{h()?.(l(v))});function S(){l(g)?.querySelector('[role="option"][aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})}function I($){r().length!==0&&(x(p,(l(p)+$+r().length)%r().length),S())}function C($){const X=r()[$];X&&!s()&&!i()&&u()(X)}function M($){if((s()||i())&&$.key!=="Escape")return!1;switch($.key){case"ArrowUp":return r().length===0?!1:($.preventDefault(),$.stopPropagation(),I(-1),!0);case"ArrowDown":return r().length===0?!1:($.preventDefault(),$.stopPropagation(),I(1),!0);case"Enter":return r().length===0?!1:($.preventDefault(),$.stopPropagation(),C(l(p)),!0);case"Escape":return $.preventDefault(),$.stopPropagation(),d()?.(),!0;default:return!1}}function O({event:$}){return M($)}var P={onKeyDown:O,get items(){return r()},set items($=[]){r($),b()},get loading(){return s()},set loading($=!1){s($),b()},get error(){return i()},set error($=null){i($),b()},get listboxId(){return o()},set listboxId($=`${t}-listbox`){o($),b()},get emptyLabel(){return a()},set emptyLabel($){a($),b()},get notice(){return c()},set notice($){c($),b()},get onSelect(){return u()},set onSelect($){u($),b()},get onDismiss(){return d()},set onDismiss($){d($),b()},get onRetry(){return f()},set onRetry($){f($),b()},get onActiveOptionChange(){return h()},set onActiveOptionChange($){h($),b()},$set:Dt,$on:($,X)=>$t(e,$,X)},E=RL(),z=te(E);{var G=$=>{var X=SL(),de=re(X,!0);L(me=>B(de,me),[()=>_.chat_slashSkillSuggestionList_loading_label()]),k($,X)},J=$=>{var X=CL(),de=te(X),me=R(de);{var ie=q=>{Ze(q,{variant:"ghost",size:"sm",onpointerdown:j=>j.preventDefault(),get onclick(){return f()},children:(j,ne)=>{Ht();var we=Vt();L(be=>B(we,be),[()=>_.ui_errorToast_retry_label()]),k(j,we)},$$slots:{default:!0}})};V(me,q=>{f()&&q(ie)})}Q(X),L(q=>B(de,`${q??""} `),[()=>_.chat_slashSkillSuggestionList_loadFailed_label()]),k($,X)},K=$=>{var X=ML(),de=re(X,!0);L(me=>B(de,me),[()=>a()??_.chat_slashSkillSuggestionList_noResults_label()]),k($,X)},Y=$=>{var X=AL(),de=ce(X);Cs(de,23,r,q=>`${q.name}:${q.location}`,(q,j,ne)=>{Eu(q,{get content(){return l(j).description},side:"right",align:"start",size:"sm",class:"w-full",children:(we,be)=>{{let Se=w(()=>m(l(j))),se=w(()=>br(Jf(),"slash-skill-option h-auto rounded-none border-0 bg-transparent py-1.5 text-inherit shadow-none hover:border-0 hover:text-inherit focus-visible:border-0 active:border-0",l(p)===l(ne)&&"active")),oe=w(()=>l(p)===l(ne));Ze(we,{type:"button",get id(){return l(Se)},variant:"ghost",size:"sm",labelClass:"type-body",get class(){return l(se)},role:"option",tabindex:-1,get"aria-label"(){return l(j).name},get"aria-selected"(){return l(oe)},onpointerenter:()=>x(p,l(ne),!0),onpointerdown:H=>H.preventDefault(),onclick:()=>C(l(ne)),children:(H,W)=>{var D=TL(),ae=re(D,!0);L(()=>B(ae,l(j).name)),k(H,D)},$$slots:{default:!0}})}},$$slots:{default:!0}})}),Q(de),Yn(de,q=>x(g,q),()=>l(g));var me=R(de,2);{var ie=q=>{var j=EL(),ne=re(j,!0);L(()=>B(ne,c())),k(q,j)};V(me,q=>{c()&&q(ie)})}L(q=>{xt(de,"id",o()),xt(de,"aria-label",q),xt(de,"aria-activedescendant",l(v))},[()=>_.chat_slashSkillSuggestionList_ariaLabel()]),Kr("keydown",de,M),k($,X)};V(z,$=>{s()?$(G):i()?$(J,1):r().length===0?$(K,2):$(Y,-1)})}return Q(E),k(n,E),Ot(P)}So(["keydown"]);const mm=/\s/u;function PL(n,e=n.length){if(e<0||e>n.length)return null;let t=e-1;for(;t>=0&&!mm.test(n[t]);)t-=1;if(t+=1,n[t]!=="/"||e<t+1)return null;let r=t+1;for(;r<n.length&&!mm.test(n[r]);)r+=1;return e>r?null:{query:n.slice(t+1,e),from:t,to:r}}function IL(n,e){if(!e)return 0;const t=n.name.toLowerCase(),r=n.description.toLowerCase();return t===e?0:t.startsWith(e)?1:t.includes(e)?2:r.includes(e)?3:null}function $d(n,e){const t=n.toLowerCase(),r=e.toLowerCase();return t<r?-1:t>r?1:n<e?-1:n>e?1:0}function LL(n,e){const t=e.toLowerCase();return n.map(r=>({skill:r,rank:IL(r,t)})).filter(r=>r.rank!==null).sort((r,s)=>r.rank-s.rank||$d(r.skill.name,s.skill.name)||$d(r.skill.location,s.skill.location)||$d(r.skill.description,s.skill.description)).map(({skill:r})=>r)}var OL=N('<div class="tiptap-root svelte-bv9i3d"><!> <div></div></div>');function NL(n,e){const t=Vi();if(new.target)return Nt({component:NL,...n});Lt(e,!0);const r=fP.extend({parseHTML(){return[{tag:"span[data-mention]",getAttrs:A=>{const ve=A.getAttribute("data-meta");let Ee={};if(ve)try{Ee=JSON.parse(ve)}catch{Ee={}}return{id:A.getAttribute("data-id")||A.textContent?.replace(/^@/,"")||null,label:A.getAttribute("data-label")||A.textContent?.replace(/^@/,"")||null,type:A.getAttribute("data-type")||"file",uri:A.getAttribute("data-uri")||"",meta:Ee}}}]},addAttributes(){return{id:{default:null,parseHTML:A=>A.getAttribute?.("data-id")||A.textContent?.replace(/^@/,"")||null,renderHTML:A=>A.id?{"data-id":A.id}:{}},label:{default:null,parseHTML:A=>A.getAttribute?.("data-label")||A.textContent?.replace(/^@/,"")||null,renderHTML:A=>A.label?{"data-label":A.label}:{}},type:{default:"file",parseHTML:A=>A.getAttribute?.("data-type")||"file",renderHTML:A=>({"data-type":A.type||"file"})},uri:{default:"",parseHTML:A=>A.getAttribute?.("data-uri")||"",renderHTML:A=>A.uri?{"data-uri":A.uri}:{}},meta:{default:{},parseHTML:A=>{const ve=A.getAttribute?.("data-meta");if(!ve)return{};try{return JSON.parse(ve)}catch{return{}}},renderHTML:A=>({"data-meta":JSON.stringify(A.meta||{})})}}}}),s=Ga("TipTapEditor"),i=aL();let o=y(e,"value",7,""),a=y(e,"ariaLabel",23,()=>_.chat_richInput_editor_ariaLabel()),c=y(e,"placeholder",23,()=>_.chat_richInput_askAnything_placeholder()),u=y(e,"reactivePlaceholder",7,!1),d=y(e,"disabled",7,!1),f=y(e,"editableWhileDisabled",7,!1),h=y(e,"inputLocked",7,!1),p=y(e,"class",7,""),g=y(e,"editorClassName",7,""),v=y(e,"workspace",7),m=y(e,"repoPath",7),S=y(e,"autoFocus",7,!1),I=y(e,"onUpdate",7),C=y(e,"onSubmit",7),M=y(e,"onForceSubmit",7),O=y(e,"onEscape",7),P=y(e,"onHistoryPrev",7),E=y(e,"onHistoryNext",7),z=y(e,"onMentionStart",7),G=y(e,"onMentionSelect",7),J=y(e,"onSelectionChange",7),K=y(e,"contextItems",23,()=>[]),Y=y(e,"trailingHint",7,null),$=y(e,"skills",23,()=>[]),X=y(e,"skillsLoading",7,!1),de=y(e,"skillsError",7,null),me=y(e,"onSkillsRetry",7),ie=y(e,"slashEmptyLabel",7),q=y(e,"slashNotice",7),j=y(e,"unavailableSkillTitle",7),ne=y(e,"screenReferences",7),we=y(e,"screenInsertions",23,()=>[]),be=y(e,"screenInterim",23,()=>[]),Se=y(e,"screenSpeechActive",7,!1),se=y(e,"onScreenInsertionApplied",7),oe=y(e,"onCompositionChange",7),H=y(e,"onUserTextInput",7),W=y(e,"onScreenReferencesEdited",7),D=y(e,"minHeight",7,80),ae=y(e,"maxHeight",7,300);const ge=qm();let ue=fe(null);ft(()=>{if(!(!l(ue)||!ge))return ge.register(l(ue),()=>Xt())});const pe=w(()=>(!d()||f())&&!h()),ke=w(()=>!l(pe)&&!h());let ye=fe(void 0),Z=fe(null),$e=fe(!1);const lt=new Set;function St(){const A=l(Z);if(!A||l($e)||A.view.composing)return!1;if(!ne())return!0;qP(A,ne()),JP(A,ne());for(const ve of we().slice(0,1)){if(lt.has(ve.id)){if(!se())return!1;se()(ve.id,Ma(A));continue}const Ee=fo.getState(A.state)?.anchor;if(!se()||!XP(A,ve,ne(),Ee))return!1;lt.add(ve.id),se()(ve.id,Ma(A))}return we().length<=1}ft(()=>{c();const A=l(Z);!u()||!A||A.isDestroyed||ii(()=>A.view.dispatch(A.state.tr.setMeta("placeholder-refresh",!0)))}),ft(()=>{ne(),we(),!(!l(Z)||l($e)||!l(pe))&&ii(()=>St())}),ft(()=>{const A=l(Z),ve=be(),Ee=ne(),gt=Se()||we().length>0;!A||!Ee||l($e)||A.view.composing||ii(()=>{const Ie=fo.getState(A.state),xe=A.state.tr.setMeta(fo,ve.length||gt?{parts:ve,references:Ee,anchor:Ie?.anchor??A.state.selection.from,ariaLabel:_.hardwareConsole_ptt_listening_label()}:null);A.view.dispatch(ve.length?xe.scrollIntoView():xe);const on=A.view.dom.querySelector("[data-screen-interim]"),{selection:gn}=A.state;if(on?.parentNode&&A.view.hasFocus()&&gn.empty&&gn.from===fo.getState(A.state)?.anchor){const Fe=Array.prototype.indexOf.call(on.parentNode.childNodes,on);window.getSelection()?.collapse(on.parentNode,Fe+1)}})});let De=null,Le=null,Ye;function Ct(){Ye?.(),Ye=void 0,De&&io(De),Le?.remove(),De=null,Le=null}let bt=!1;ft(()=>{l(Z)&&l(Z).view.dom.setAttribute("aria-label",a())});let sn=fe(!1),Be=fe(null),he=fe(null),Ne=fe(null),je=fe(null);const Tt=`slash-skill-listbox-${t}`;let ee=fe(void 0);const Ge=w(()=>l(Be)?LL($(),l(Be).query):[]),it=w(()=>l(Be)?`${l(Be).from}:${l(Be).to}:${l(Be).query}`:null),Xe=w(()=>l(sn)&&l(Be)!==null&&l(it)!==l(he)&&l(Be).from!==l(Ne)&&(l(Ge).length>0||ie()!==void 0&&l(Be).query===""&&!X())&&l(pe));ft(()=>{const A=l(Z),ve=l(ye),Ee=j();if(!A||!ve)return;const gt=()=>{for(const Ie of ve.querySelectorAll('[data-type="skill-command"]')){const xe=Ee?.(Ie.dataset.skillName??"");Ie.classList.toggle("skill-command-chip--unavailable",xe!==void 0),xe?Ie.title=xe:Ie.removeAttribute("title")}};return gt(),A.on("update",gt),()=>{A.off("update",gt)}}),ft(()=>{if(l(Xe))return ja(Xt)});function mt(A){return{...Mh(A.schema),hardBreak:()=>`
164
164
  `,pasteChip:()=>" "}}function Mt(A,ve){return Ch(A.state.doc,{from:0,to:ve},{blockSeparator:`
165
165
 
166
- `,textSerializers:mt(A)}).replace(/\u00A0/g," ")}function Ue(A){return Mt(A,A.state.doc.content.size)}function Ke(A){return Mt(A,A.state.selection.from)}function Me(A,ve){const Ee=Ue(A),gt=PL(Ee,Ke(A).length);(!gt||gt.from!==l(Be)?.from)&&(x(he,null),x(Ne,null)),x(Be,gt,!0),gt&&ve?.dismissNewContext&&x(he,l(it),!0)}function Xt(){x(Ne,l(Be)?.from??null,!0)}function tn(A){A.preventDefault()}function es(A){if(!l(Z)||!l(Be))return;const ve=Ue(l(Z)),Ee=Ke(l(Z)).length,gt={from:l(Z).state.selection.from-l(Be).query.length-1,to:l(Z).state.selection.from+l(Be).to-Ee},Ie=l(Be).to===ve.length||!/^\s/u.test(ve.slice(l(Be).to)),xe=[{type:"skillCommand",attrs:{name:A.name}},...Ie?[{type:"text",text:" "}]:[]];l(Z).chain().focus().insertContentAt(gt,xe).setTextSelection(gt.from+2).run()}function le(A){const ve=vL(A,$().map(Ee=>Ee.name));return ne()?GP(ve,ne()):ve}function ot(A){if(!l(Xe)||!l(je))return!1;const ve=!A.shiftKey&&!A.metaKey&&!A.ctrlKey&&!A.altKey&&["ArrowUp","ArrowDown","Enter"].includes(A.key);return A.key!=="Escape"&&!ve?!1:l(je).onKeyDown({event:A})?!0:A.key==="Enter"?(A.preventDefault(),!0):!1}function At(){l(Z)&&l(Z).view&&l(Z).chain().focus().insertContent("@").run()}function Zt(A){return l(Z)&&l(Z).view?(l(Z).chain().focus().insertContent(A).run(),!0):!1}function Ve(){if(h())return!1;if(l(Z)&&l(Z).view)try{if(l(Z).view.hasFocus())return!0;const A=l(Z),ve=document.activeElement;return requestAnimationFrame(()=>{if(l(Z)!==A||A.isDestroyed||h()||A.view.hasFocus())return;const Ee=document.activeElement;Ee!==ve&&Ee instanceof HTMLElement&&Jm(Ee)&&!A.view.dom.contains(Ee)||(A.view.focus(),A.commands.scrollIntoView())}),typeof l(Z).view.hasFocus=="function"?l(Z).view.hasFocus():!0}catch(A){s.debug("[TipTapEditor] Editor not ready for focus:",A)}return!1}function ht(){if(h())return!1;if(l(Z)&&l(Z).view)try{return l(Z).chain().focus("end").run(),!0}catch(A){s.debug("[TipTapEditor] Editor not ready for focusEnd:",A)}return!1}function Et(){if(h())return!1;if(l(Z)&&l(Z).view)try{return l(Z).chain().focus().selectAll().run(),!0}catch(A){s.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",A)}return!1}function qe(){try{return l(Z)?.getHTML?.()??""}catch(A){return s.error("[TipTapEditor] Error getting HTML:",A),l(Z)?.getText?.()??""}}function yt(){l(Z)&&(bt=!0,l(Z).commands.clearContent(!0),bt=!1)}async function Re(A){if(!l(Z))return;const ve=le(A||"");Qc(ve,l(Z).schema).eq(l(Z).state.doc)||l(Z).chain().command(({tr:Ee})=>(Ee.setMeta("external-update",!0),!0)).setContent(ve).run()}function We(A,ve){l(Z)&&l(Z).view&&l(Z).chain().focus().setImage({src:A,alt:ve||""}).createParagraphNear().focus().run()}function Pt(){if(!l(Z))return s.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const A=[];return l(Z).state.doc.descendants(ve=>{if(ve.type.name==="image"){const Ee=ve.attrs.src;Ee&&Ee.startsWith("data:")&&A.push({src:Ee,alt:ve.attrs.alt||void 0})}return!0}),s.debug("TipTapEditor: Extracted inline images",{imageCount:A.length,imageSources:A.map(ve=>({alt:ve.alt,srcLength:ve.src?.length||0}))}),A}function Ye(){return Ma(l(Z))}function ze(A){if(s.debug("TipTapEditor: insertContextMention called",{hasEditor:!!l(Z),hasEditorView:!!l(Z)?.view,attrs:{itemType:A.itemType,identifier:A.identifier,title:A.title}}),l(Z)&&l(Z).view){const ve=l(Z).chain().focus().insertContextMention(A).run();return s.debug("TipTapEditor: insertContextMention result",{result:ve}),ve}return s.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function pt(A){if(!l(Z)||!l(Z).view)return s.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return l(Z).chain().focus().insertContent({type:"mention",attrs:{id:A.id,label:A.label,type:A.type,uri:A.uri,meta:A.meta||{}}}).insertContent(" ").run(),!0}catch(ve){return s.error("TipTapEditor: insertMention failed",ve),!1}}function at(){if(!l(Z))return s.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const A=[];return l(Z).state.doc.descendants(ve=>(ve.type.name==="mention"&&A.push({id:ve.attrs.id,label:ve.attrs.label,type:ve.attrs.type||"file",uri:ve.attrs.uri||"",meta:ve.attrs.meta||{}}),!0)),s.debug("TipTapEditor: Extracted mentions",{mentionCount:A.length,types:A.map(ve=>ve.type)}),A}function Bt(){if(!l(Z))return s.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const A=[];return l(Z).state.doc.descendants(ve=>{if(ve.type.name==="contextMention"){const Ee=ve.attrs;A.push({itemType:Ee.itemType,provider:Ee.provider,title:Ee.title,url:Ee.url,identifier:Ee.identifier,contextId:Ee.contextId,description:Ee.description,metadata:Ee.metadata})}return!0}),s.debug("TipTapEditor: Extracted context mentions",{mentionCount:A.length}),A}const rt={char:"@",pluginKey:new Dn("mention"),items:async({query:A})=>{if(s.debug("Mention query:",A),z()?.(A),!v()&&m()){s.debug("No workspace but repoPath available, using async search:",m());const Ee={workspaceId:void 0,repoPath:m(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const gt=await i.search(A,Ee);return s.debug("Mention search results from repoPath:",gt.length),gt}catch(gt){s.error("Failed to search mentions with repoPath:",gt);const Ie=i.searchSync(A,Ee);return s.debug("Fallback sync search results:",Ie.length),Ie}}if(!v())return s.debug("No workspace and no repoPath - returning empty results"),[];const ve={workspaceId:v().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Ee=await i.search(A,ve);return s.debug("Mention search results:",Ee.length),Ee}catch(Ee){return s.error("Failed to search mentions:",Ee),[]}},render:()=>SI(ge),command:({editor:A,range:ve,props:Ee})=>{const gt={id:Ee.id,label:Ee.label,type:Ee.type,uri:Ee.uri,meta:Ee.meta||{}};A.view&&A.chain().focus().deleteRange(ve).insertContent({type:"mention",attrs:gt}).run(),G()?.(Ee)}};Lf(()=>{let A=!1;return(async()=>{const ve=le(o()||"");if(A)return;const Ee=l(ye);if(!Ee)return;x(Z,new xE({element:Ee,extensions:[...ne()?[KP.configure({references:()=>ne()??[]}),jP]:[],GR.configure({heading:!1,codeBlock:!1,horizontalRule:!1,link:!1,bulletList:!1,orderedList:!1,listItem:!1,code:!1,bold:!1,italic:!1,strike:!1,blockquote:!1,dropcursor:!1}),M0({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:Ie=>/^https?:\/\//.test(Ie)||Ie.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),qR.configure({placeholder:u()?({editor:Ie})=>fo.getState(Ie.state)?.parts.length?"":c():c(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),gP.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),_P.configure({workspaceId:v()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:rt,renderHTML({node:Ie}){const xe=hv(Ie.attrs,v()?.id,l_);return["span",{"data-mention":"true","data-type":Ie.attrs.type||"file","data-uri":Ie.attrs.uri||"","data-meta":JSON.stringify(Ie.attrs.meta||{}),"data-id":Ie.attrs.id,"data-label":Ie.attrs.label,class:"mention-chip",tabindex:"0"},xe]},renderText:({node:Ie})=>{const xe=Ie.attrs||{};try{return pw({type:xe.type,id:xe.id,label:xe.label,meta:xe.meta})}catch{return`@${xe?.meta?.fullPath||xe?.meta?.path||xe?.label||xe?.id||"item"}`}}}),FP.extend({renderText:({node:Ie})=>{const xe=Ie.attrs||{},on=JSON.stringify({provider:xe.provider||"browser",identifier:xe.identifier||"",title:xe.title||"",url:xe.url||"",description:xe.description||"",metadata:xe.metadata||"",itemType:xe.itemType||""});return`@context[${btoa(unescape(encodeURIComponent(on)))}]`}}),WP,YP,_L],content:ve,editable:l(pe),enableCoreExtensions:{delete:!1},onCreate:({editor:Ie})=>{Me(Ie),S()&&requestAnimationFrame(()=>{if(Ie.isDestroyed)return;Ie.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:Ie})=>{Ie.docChanged&&De&&Le&&(io(De),Qe?.(),Qe=void 0,Le.remove(),De=null,Le=null)},onUpdate:({editor:Ie,transaction:xe})=>{if(xe.getMeta("external-update")||xe.getMeta(Wh)||bt)return;const on=W()?QP(xe):null;on&&W()?.(on);const gn=Ma(Ie);Me(Ie,{dismissNewContext:xe.getMeta("uiEvent")==="paste"}),xe.getMeta(Gu)?I()?.(gn,{programmatic:!0}):I()?.(gn)},onSelectionUpdate:({editor:Ie,transaction:xe})=>{Me(Ie,{dismissNewContext:xe.getMeta("uiEvent")==="paste"});const{from:on,to:gn,empty:Fe}=Ie.state.selection;if(Fe)J()?.(null);else{const Gt=Ie.state.doc.textBetween(on,gn," ");J()?.(Gt.trim()||null)}},onFocus:({editor:Ie})=>{ii(()=>{x(sn,!0),Me(Ie)})},onBlur:()=>{ii(()=>{x(sn,!1)})},editorProps:{handleDOMEvents:{compositionstart:()=>(ii(()=>{x($e,!0)}),oe()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!l(Z)||l(Z).isDestroyed||(ii(()=>{x($e,!1)}),oe()?.(!1),St())})}),!1),beforeinput:()=>(H()?.(),!1)},attributes:{class:`tiptap-editor ${g()}`,role:"textbox","aria-multiline":"true","aria-label":a(),autocomplete:"off",spellcheck:"false",autocorrect:"off",autocapitalize:"off"},handlePaste:(Ie,xe)=>{if(eI(xe))return!0;const on=xe.clipboardData?.getData("text/plain");if(on){const gn=on.split(`
167
- `);if(gn.length>=5){const{state:Fe,dispatch:Gt}=Ie,_n=Fe.schema.nodes.pasteChip.create({content:on,lineCount:gn.length}),Sn=Fe.tr.replaceSelectionWith(_n).setMeta("uiEvent","paste");return Gt(Sn),!0}if(/\r|\n/.test(on)){const{state:Fe,dispatch:Gt}=Ie,_n=bL(Fe.schema,on);if(_n.length>0){const Sn=new He(_e.from(_n),1,1);return Gt(Fe.tr.replaceSelection(Sn).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(Ie,xe)=>ZP(xe),handleKeyDown:(Ie,xe)=>{if(Ie.composing||xe.isComposing||xe.keyCode===229)return!1;if(ot(xe))return!0;if(xe.key==="Escape"&&O())return xe.preventDefault(),O()(),!0;const on=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),gn=Fe=>fk(xe,zc(Fe),on);if(gn("chat.mention-context")&&zc("chat.mention-context")!=="@")return xe.preventDefault(),l(Z)?.chain().focus().insertContent("@").run(),!0;if(on&&xe.ctrlKey&&!xe.metaKey){if(xe.key==="a"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,Sn=Fe.selection.$head.start();return Gt(Fe.tr.setSelection(et.create(Fe.doc,Sn))),!0}if(xe.key==="e"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,Sn=Fe.selection.$head.end();return Gt(Fe.tr.setSelection(et.create(Fe.doc,Sn))),!0}if(xe.key==="k"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,_n=Fe.selection.$head,Sn=_n.pos,gs=_n.end();return Sn<gs&&Gt(Fe.tr.delete(Sn,gs)),!0}if(xe.key==="p"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","backward","line"),!0}if(xe.key==="n"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","forward","line"),!0}if(xe.key==="f"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","forward","character"),!0}if(xe.key==="b"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","backward","character"),!0}}if(xe.metaKey&&!xe.ctrlKey&&!xe.altKey){if(xe.key==="ArrowLeft"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify(xe.shiftKey?"extend":"move","backward","lineboundary"),!0}if(xe.key==="ArrowRight"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify(xe.shiftKey?"extend":"move","forward","lineboundary"),!0}if(xe.key==="ArrowUp"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,_n=1;if(xe.shiftKey){const{from:Sn}=Fe.selection;Gt(Fe.tr.setSelection(et.create(Fe.doc,_n,Sn)))}else Gt(Fe.tr.setSelection(et.create(Fe.doc,_n)));return!0}if(xe.key==="ArrowDown"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,_n=Fe.doc.content.size-1;if(xe.shiftKey){const{to:Sn}=Fe.selection;Gt(Fe.tr.setSelection(et.create(Fe.doc,Sn,_n)))}else Gt(Fe.tr.setSelection(et.create(Fe.doc,_n)));return!0}}if(gn("chat.force-send"))return xe.preventDefault(),M()?.(),!0;if(gn("chat.new-line"))return xe.preventDefault(),l(Z)?.chain().setHardBreak().scrollIntoView().run(),!0;if(xe.key==="ArrowUp"&&P()&&!xe.shiftKey&&!xe.metaKey&&!xe.ctrlKey){if(rt.pluginKey.getState(Ie.state)?.active)return!1;const{state:Gt}=Ie,{from:_n}=Gt.selection,Sn=_n<=1,gs=Gt.doc.textContent.length===0;if(Sn||gs){const Bs=P()();if(Bs!==null)return xe.preventDefault(),l(Z)?.chain().setContent(le(Bs)).focus("end").run(),I()?.(Bs),!0}}if(xe.key==="ArrowDown"&&E()&&!xe.shiftKey&&!xe.metaKey&&!xe.ctrlKey){if(rt.pluginKey.getState(Ie.state)?.active)return!1;const{state:Gt}=Ie,{to:_n}=Gt.selection,Sn=Gt.doc.content.size-1,gs=_n>=Sn,Bs=Gt.doc.textContent.length===0;if(gs||Bs){const di=E()();if(di!==null)return xe.preventDefault(),l(Z)?.chain().setContent(le(di)).focus("end").run(),I()?.(di),!0}}return gn("chat.send")?rt.pluginKey.getState(Ie.state)?.active?!1:C()?(xe.preventDefault(),C()(),!0):!1:!1}}}),!0),Ee.addEventListener("mouseover",Qt),Ee.addEventListener("mouseout",Vn),Ee.addEventListener("click",Gr),l(Z).view.dom.addEventListener("keydown",hs)})(),()=>{A=!0}});function Qt(A){const ve=A.target,Ee=gp(ve);if(Ee){const gt=ve.getBoundingClientRect();if(!Le){Le=document.createElement("div"),(ge?.target()??document.body).appendChild(Le);const Ie=Ee.type||"file",xe=Ee.label||ve.textContent||"",on={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};De=vl(w0,{target:Le,props:{mention:{id:Ee.id,type:Ie,label:xe,uri:Ee.uri,meta:Ee.meta,icon:on[Ie]||"📄"},position:{x:gt.left,y:gt.bottom+5},onClose:()=>{De&&Le&&(io(De),Qe?.(),Qe=void 0,Le.remove(),De=null,Le=null)}}});const gn=Le.firstElementChild;gn instanceof HTMLElement&&(Qe=ge?.register(gn,Ct)),Le.addEventListener("mouseout",Yn)}}}function Vn(A){const ve=A.target;A.relatedTarget?.closest(".mention-hover-preview")||ve.hasAttribute("data-mention")&&De&&Le&&(io(De),Qe?.(),Qe=void 0,Le.remove(),De=null,Le=null)}function Yn(A){A.relatedTarget?.closest("[data-mention]")||De&&Le&&(io(De),Qe?.(),Qe=void 0,Le.remove(),De=null,Le=null)}async function Gr(A){const ve=gp(A.target);if(ve&&ve.type!=="member"){if(ve.intentUrl){A.preventDefault(),A.stopPropagation();const{handleIntentLink:Ee}=await cs(async()=>{const{handleIntentLink:gt}=await import("./BNg3GOxL.js");return{handleIntentLink:gt}},__vite__mapDeps([47,1,2,48,4,5,6,0,3,7,8,9,10,11,12,24,45,14,15,16,17,49,21,50,51,20,22,23,44,30]),import.meta.url);await Ee(ve.intentUrl);return}if(ve.type==="note"&&ve.note){if(A.preventDefault(),A.stopPropagation(),ve.note.workspaceId){const{handleIntentLink:Ee}=await cs(async()=>{const{handleIntentLink:gt}=await import("./BNg3GOxL.js");return{handleIntentLink:gt}},__vite__mapDeps([47,1,2,48,4,5,6,0,3,7,8,9,10,11,12,24,45,14,15,16,17,49,21,50,51,20,22,23,44,30]),import.meta.url);await Ee(gw(ve.note.id,ve.note.workspaceId))}else{const{navigateToNote:Ee}=await cs(async()=>{const{navigateToNote:gt}=await import("./C0Yks_oS.js").then(Ie=>Ie.h);return{navigateToNote:gt}},__vite__mapDeps([52,26,2,53,54,36,20,11,5,1,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24,30,42,55]),import.meta.url);await Ee(ve.note.id)}return}if(ve.type==="file"&&ve.filePath){A.preventDefault(),A.stopPropagation();const{navigateToFile:Ee}=await cs(async()=>{const{navigateToFile:gt}=await import("./C0Yks_oS.js").then(Ie=>Ie.h);return{navigateToFile:gt}},__vite__mapDeps([52,26,2,53,54,36,20,11,5,1,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24,30,42,55]),import.meta.url);await Ee(ve.filePath);return}}}function hs(A){if(!A.metaKey||A.ctrlKey||A.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(A.key)||!l(Z))return;const{state:ve,dispatch:Ee}=l(Z).view;if(A.key==="ArrowLeft"){A.preventDefault(),A.stopPropagation();const gt=window.getSelection();gt&&gt.rangeCount>0&&gt.modify(A.shiftKey?"extend":"move","backward","lineboundary")}else if(A.key==="ArrowRight"){A.preventDefault(),A.stopPropagation();const gt=window.getSelection();gt&&gt.rangeCount>0&&gt.modify(A.shiftKey?"extend":"move","forward","lineboundary")}else if(A.key==="ArrowUp"){A.preventDefault(),A.stopPropagation();const gt=1;if(A.shiftKey){const{from:Ie}=ve.selection;Ee(ve.tr.setSelection(et.create(ve.doc,gt,Ie)).scrollIntoView())}else Ee(ve.tr.setSelection(et.create(ve.doc,gt)).scrollIntoView())}else if(A.key==="ArrowDown"){A.preventDefault(),A.stopPropagation();const gt=ve.doc.content.size-1;if(A.shiftKey){const{to:Ie}=ve.selection;Ee(ve.tr.setSelection(et.create(ve.doc,Ie,gt)).scrollIntoView())}else Ee(ve.tr.setSelection(et.create(ve.doc,gt)).scrollIntoView())}}ql(()=>{l(Z)&&(l(Z).view.dom.removeEventListener("keydown",hs),l(Z).destroy()),l(ye)&&(l(ye).removeEventListener("mouseover",Qt),l(ye).removeEventListener("mouseout",Vn),l(ye).removeEventListener("click",Gr)),Le&&Le.removeEventListener("mouseout",Yn),De&&Le&&(io(De),Qe?.(),Qe=void 0,Le.remove())});let zt=0;ft(()=>{if(!l(Z))return;const A=Ma(l(Z));if(o()===A)return;if(l(Z).view.hasFocus()){zt+=1;return}const ve=l(Z).view.hasFocus(),{from:Ee}=l(Z).state.selection,gt=++zt;(async()=>{const Ie=le(o()||"");!l(Z)||gt!==zt||Ma(l(Z))===A&&l(Z).chain().command(({tr:xe})=>(xe.setMeta("external-update",!0),!0)).setContent(Ie).command(({tr:xe,state:on})=>{if(ve)try{const gn=on.doc.content.size,Fe=Math.min(Ee,gn);xe.setSelection(et.create(on.doc,Fe,Fe))}catch{}return!0}).run()})()}),ft(()=>{l(Z)&&l(Z).setEditable(l(pe),!1)}),ft(()=>{!l(Z)||l(Z).isDestroyed||l(Z).view.dispatch(l(Z).state.tr.setMeta(gl,Q()))}),ft(()=>{const A=l(Z)?.view.dom;A&&(A.setAttribute("aria-haspopup","listbox"),l(Xe)&&l(ee)?(A.setAttribute("aria-controls",Tt),A.setAttribute("aria-activedescendant",l(ee))):(A.removeAttribute("aria-controls"),A.removeAttribute("aria-activedescendant")))});var ps={flushScreenEvidence:St,insertAtSymbol:At,insertText:Zt,focus:Ve,focusEnd:ht,focusAndSelectAll:Et,getHTML:qe,clear:yt,setContent:Re,insertImage:We,getInlineImages:Pt,getTextContent:Ye,insertContextMention:ze,insertMention:pt,getMentions:at,getContextMentions:Bt,get value(){return o()},set value(A=""){o(A),b()},get ariaLabel(){return a()},set ariaLabel(A=_.chat_richInput_editor_ariaLabel()){a(A),b()},get placeholder(){return c()},set placeholder(A=_.chat_richInput_askAnything_placeholder()){c(A),b()},get reactivePlaceholder(){return u()},set reactivePlaceholder(A=!1){u(A),b()},get disabled(){return d()},set disabled(A=!1){d(A),b()},get editableWhileDisabled(){return f()},set editableWhileDisabled(A=!1){f(A),b()},get inputLocked(){return h()},set inputLocked(A=!1){h(A),b()},get class(){return p()},set class(A=""){p(A),b()},get editorClassName(){return g()},set editorClassName(A=""){g(A),b()},get workspace(){return v()},set workspace(A){v(A),b()},get repoPath(){return m()},set repoPath(A){m(A),b()},get autoFocus(){return S()},set autoFocus(A=!1){S(A),b()},get onUpdate(){return I()},set onUpdate(A){I(A),b()},get onSubmit(){return C()},set onSubmit(A){C(A),b()},get onForceSubmit(){return M()},set onForceSubmit(A){M(A),b()},get onEscape(){return O()},set onEscape(A){O(A),b()},get onHistoryPrev(){return P()},set onHistoryPrev(A){P(A),b()},get onHistoryNext(){return E()},set onHistoryNext(A){E(A),b()},get onMentionStart(){return z()},set onMentionStart(A){z(A),b()},get onMentionSelect(){return G()},set onMentionSelect(A){G(A),b()},get onSelectionChange(){return J()},set onSelectionChange(A){J(A),b()},get contextItems(){return K()},set contextItems(A=[]){K(A),b()},get trailingHint(){return Q()},set trailingHint(A=null){Q(A),b()},get skills(){return $()},set skills(A=[]){$(A),b()},get skillsLoading(){return X()},set skillsLoading(A=!1){X(A),b()},get skillsError(){return de()},set skillsError(A=null){de(A),b()},get onSkillsRetry(){return me()},set onSkillsRetry(A){me(A),b()},get slashEmptyLabel(){return ie()},set slashEmptyLabel(A){ie(A),b()},get slashNotice(){return q()},set slashNotice(A){q(A),b()},get unavailableSkillTitle(){return j()},set unavailableSkillTitle(A){j(A),b()},get screenReferences(){return ne()},set screenReferences(A){ne(A),b()},get screenInsertions(){return we()},set screenInsertions(A=[]){we(A),b()},get screenInterim(){return be()},set screenInterim(A=[]){be(A),b()},get screenSpeechActive(){return Se()},set screenSpeechActive(A=!1){Se(A),b()},get onScreenInsertionApplied(){return se()},set onScreenInsertionApplied(A){se(A),b()},get onCompositionChange(){return oe()},set onCompositionChange(A){oe(A),b()},get onUserTextInput(){return H()},set onUserTextInput(A){H(A),b()},get onScreenReferencesEdited(){return W()},set onScreenReferencesEdited(A){W(A),b()},get minHeight(){return D()},set minHeight(A=80){D(A),b()},get maxHeight(){return ae()},set maxHeight(A=300){ae(A),b()},$set:Dt,$on:(A,ve)=>$t(e,A,ve)},bn=OL(),$s=te(bn),ji=()=>l(Xe),Qs=A=>!A&&Xt();Rt($s,()=>Vx,(A,ve)=>{ve(A,{get open(){return ji()},set open(Ee){Qs(Ee)},children:(Ee,gt)=>{var Ie=Je(),xe=ce(Ie);{let on=w(()=>ge?.target());Rt(xe,()=>Vm,(gn,Fe)=>{Fe(gn,{get to(){return l(on)},children:(Gt,_n)=>{var Sn=Je(),gs=ce(Sn);{let Bs=w(()=>l(ye)??null);Rt(gs,()=>Ux,(di,Eo)=>{Eo(di,{get customAnchor(){return l(Bs)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:tn,onCloseAutoFocus:tn,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return l(ue)},set ref(xi){x(ue,xi,!0)},children:(xi,ir)=>{Qn(T0(xi,{get listboxId(){return Tt},get items(){return l(Ge)},get loading(){return X()},get error(){return de()},get emptyLabel(){return ie()},get notice(){return q()},get onRetry(){return me()},onSelect:es,onDismiss:Xt,onActiveOptionChange:ts=>x(ee,ts,!0)}),ts=>x(je,ts,!0),()=>l(je))},$$slots:{default:!0}})})}k(Gt,Sn)},$$slots:{default:!0}})})}k(Ee,Ie)},$$slots:{default:!0}})});var To=R($s,2);let ca;return Qn(To,A=>x(ye,A),()=>l(ye)),Y(bn),L(()=>{ca=wt(To,1,`tiptap-container ${p()??""}`,"svelte-bv9i3d",ca,{"placeholder-suppressed":l(ke)}),Hi(To,`--tt-min-height:${D()}px;--tt-max-height:${ae()}px`)}),k(n,bn),Ot(ps)}class DL extends Error{constructor(t){super(t);nt(this,"reason");this.name="EnhancePromptUnavailableError",this.reason=t}}function $L(n){return"available"in n&&n.available===!1}function h$(n){return n==="auggie"}function BL(n,e,{model:t,workspaceId:r}){return{prompt:n,mode:e,...t?{model:t}:{},...r?{workspaceId:r}:{}}}async function p$(n,e={}){const t=await Wm("agent.enhancePrompt",BL(n,"enhance",e));if($L(t))throw new DL(t.reason);return t}function Kh(n,e){if(new.target)return Nt({component:Kh,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(i=16){t(i),b()},get class(){return r()},set class(i=""){r(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return f1(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Ot(s)}var zL=new Set(["$$slots","$$events","$$legacy","ref","pressed","disabled","size","class","onclick","title","ariaLabel","ariaDescribedby","onChange","children"]);function E0(n,e){if(new.target)return Nt({component:E0,...n});Lt(e,!0);let t=y(e,"ref",15,null),r=y(e,"pressed",15,!1),s=y(e,"disabled",7,!1),i=y(e,"size",7,"default"),o=y(e,"class",7),a=y(e,"onclick",7),c=y(e,"title",7),u=y(e,"ariaLabel",7),d=y(e,"ariaDescribedby",7),f=y(e,"onChange",7),h=y(e,"children",7),p=ui(e,zL);function g(C){r(C),f()?.(C),e.onPressedChange?.(C)}const v={default:"h-(--control-height-medium) px-2.5",sm:"h-(--control-height-small) px-2",lg:"h-(--control-height-large) px-3",xs:"h-(--control-height-small) px-2"};var m={get ref(){return t()},set ref(C=null){t(C),b()},get pressed(){return r()},set pressed(C=!1){r(C),b()},get disabled(){return s()},set disabled(C=!1){s(C),b()},get size(){return i()},set size(C="default"){i(C),b()},get class(){return o()},set class(C){o(C),b()},get onclick(){return a()},set onclick(C){a(C),b()},get title(){return c()},set title(C){c(C),b()},get ariaLabel(){return u()},set ariaLabel(C){u(C),b()},get ariaDescribedby(){return d()},set ariaDescribedby(C){d(C),b()},get onChange(){return f()},set onChange(C){f(C),b()},get children(){return h()},set children(C){h(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},S=Je(),I=ce(S);{let C=w(()=>br("type-caption inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap rounded-(--radius-medium) border border-border bg-muted text-muted-foreground transition-[background-color,color,box-shadow] duration-spring-fast ease-spring-fast data-[state=off]:hover:bg-hover data-[state=off]:active:bg-active disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-selected data-[state=on]:shadow-(--elevation-raised) data-[state=on]:text-foreground data-[state=on]:hover:bg-selected motion-reduce:transition-none",v[i()],o()));Rt(I,()=>iv,(M,O)=>{O(M,us({get"aria-label"(){return u()},get"aria-describedby"(){return d()},get disabled(){return s()},get title(){return c()},get onclick(){return a()},get class(){return l(C)}},()=>p,{onPressedChange:g,get ref(){return t()},set ref(P){t(P)},get pressed(){return r()},set pressed(P){r(P)},children:(P,E)=>{var z=Je(),G=ce(z);On(G,()=>h()??ls),k(P,z)},$$slots:{default:!0}}))})}return k(n,S),Ot(m)}var FL=N('<span class="ml-auto shrink-0"> </span>'),HL=N('<span><!></span> <span class="min-w-0 truncate"> </span> <!> <!>',1),UL=N('<div role="status"> </div>'),vm=N("<!> <!>",1),Ta=N("<span> </span>"),VL=N('<div><!> <!> <span class="truncate"> </span></div>'),WL=N('<span class="text-orange-500"> </span>'),KL=N('<span> </span> <span class="text-sm opacity-75 ml-1"> </span>',1),jL=N('<!> <span class="sr-only"> </span>',1),GL=N('<span class="w-1.5 h-1.5 ml-0.5 rounded-full bg-warning cursor-help"></span>'),qL=N('<div class="flex-0 flex flex-col"><!></div>'),JL=N('<div><!> <!> <span class="flex-1 text-left truncate min-w-0"><!></span> <!> <!></div>'),XL=N('<div class="shrink-0 px-3 pt-3 pb-2"><h2 class="type-body font-semibold text-foreground"> </h2> <p class="type-caption mt-0.5 text-subtle"> </p></div>'),QL=N('<div class="shrink-0 px-2 pb-2"><p class="type-caption px-3 pt-1 pb-1.5 font-medium text-subtle"> </p> <div><!> <span class="min-w-0 flex-1 truncate"> </span> <span class="shrink-0 text-subtle"> </span></div></div>'),YL=N('<!> <span class="flex-1 min-w-0"><span class="text-subtle"> </span> <strong class="text-foreground ml-1 truncate"> </strong></span>',1),ZL=N('<span class="first-line-icon text-sm"><svg class="w-5 h-5 text-ghost" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"></path></svg></span> <div class="flex-1 min-w-0"><p class="text-sm font-medium text-foreground"> </p> <p class="text-sm text-subtle"> </p></div>',1),eO=N('<div><span class="first-line-icon text-sm"><!></span> <div class="flex-1 min-w-0"><p class="text-sm font-medium text-foreground"> </p> <p class="text-sm text-subtle"> </p></div></div>'),tO=N('<div><div class="text-sm text-danger"> </div> <div class="text-sm text-subtle mt-1"> </div></div>'),nO=N('<div class="text-sm text-subtle mt-1"> </div>'),rO=N('<div role="alert"><div class="text-sm text-danger"> </div> <!></div>'),sO=N("<!> ",1),iO=N('<div class="flex shrink-0 flex-wrap items-center gap-1 border-t border-border bg-popover px-2 py-1.5"><!> <!></div>'),oO=N('<!> <div class="min-h-16 overflow-hidden flex flex-1 flex-col" data-testid="branch-results"><!> <!></div> <!>',1),aO=N('<p class="type-caption mt-2 pl-6.5 text-muted-foreground"> </p>'),lO=N('<div class="shrink-0 border-t border-border p-2"><div class="px-3 py-2.5"><!> <!></div></div>'),cO=N("<!> <div><!></div> <!>",1),uO=N('<div class="relative min-w-0"><!></div>');function ml(n,e){const t=Vi();if(new.target)return Nt({component:ml,...n});Lt(e,!0);const r=()=>rn(S,"$branchByRepo$",o),s=()=>rn(h,"$connection$",o),i=()=>rn(f,"$hostMember$",o),[o,a]=Jl(),c=U=>{{let Pe=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel()),Oe=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());Ze(U,{onclick:ve,variant:"ghost",size:"icon-sm",class:"shrink-0 text-muted-foreground",get disabled(){return l(ke)},get"aria-label"(){return l(Pe)},get tooltip(){return l(Oe)},children:(dt,Ut)=>{var en=Je(),Cn=ce(en);{var ln=st=>{li(st,{size:14})},Ae=st=>{ut(st,{get icon(){return hp},class:"size-3.5!"})};V(Cn,st=>{l(ke)?st(ln):st(Ae,-1)})}k(dt,en)},$$slots:{default:!0}})}},u=U=>{var Pe=Je(),Oe=ce(Pe);{var dt=en=>{uo(en,{size:16,get class(){return yr.icon}})},Ut=en=>{uo(en,{size:14,class:"text-subtle"})};V(Oe,en=>{K()?en(dt):en(Ut,-1)})}k(U,Pe)},d=(U,Pe=ls)=>{const Oe=w(()=>Eo(Pe()));var dt=vm(),Ut=ce(dt);{let ln=w(()=>_.ui_groupedCombobox_toggleGroup_ariaLabel({group:Pe().label})),Ae=w(()=>K()?`w-full justify-start gap-2 ${yr.group} h-auto`:"w-full justify-start gap-2 px-2 text-subtle");Ze(Ut,{variant:"ghost",size:"sm",wrapContent:!1,get"aria-expanded"(){return l(Oe)},get"data-branch-group"(){return Pe().key},get"aria-label"(){return l(ln)},get class(){return l(Ae)},onclick:()=>xi(Pe()),children:(st,yn)=>{var mn=HL(),Pn=ce(mn),ms=te(Pn);{let or=w(()=>`${K()?"size-4!":"size-3.5!"} shrink-0 ${l(Oe)?"":"-rotate-90"}`);ut(ms,{get icon(){return Da},get class(){return l(or)}})}Y(Pn);var vs=R(Pn,2),hi=re(vs,!0),bs=R(vs,2);{var Ao=or=>{Kx(or,{size:"compact",class:"rounded-full px-1.5 font-normal text-subtle",children:(zs,pi)=>{Ht();var ys=Vt();L(qi=>B(ys,qi),[()=>as(Pe().options.length)]),k(zs,ys)},$$slots:{default:!0}})};V(bs,or=>{Pe().key!=="remote"&&or(Ao)})}var ki=R(bs,2);{var Gi=or=>{var zs=FL(),pi=re(zs,!0);L(ys=>{xt(zs,"role",Pe().key==="remote"&&l(ae)?"status":void 0),B(pi,ys)},[()=>l(ae)?_.ui_combobox_loadingOptions_message():_.workspace_branchSelector_groupLoad_label()]),k(or,zs)};V(ki,or=>{Pe().key==="remote"&&(l(ae)||!l(ge)&&l(W).length===0)&&or(Gi)})}L(()=>{wt(Pn,1,`first-line-icon ${K()?"w-4":"w-3.5"}`),B(hi,Pe().label)}),k(st,mn)},$$slots:{default:!0}})}var en=R(Ut,2);{var Cn=ln=>{var Ae=UL(),st=re(Ae,!0);L(yn=>{wt(Ae,1,`type-caption py-2 pr-3 text-muted-foreground ${K()?"pl-8":"pl-6"}`),B(st,yn)},[()=>_.workspace_branchSelector_noRemoteBranches_label()]),k(ln,Ae)};V(en,ln=>{Pe().key==="remote"&&l(Oe)&&!l(ae)&&l(ge)&&Pe().options.length===0&&ln(Cn)})}k(U,dt)},f=Nf(),h=rd();let p=null;const g=Ga("BranchSelector"),v=Xf(),m=new Yf,S=_1();let I=y(e,"variant",7,"underline"),C=y(e,"value",7,""),M=y(e,"repoPath",7),O=y(e,"repoType",7),P=y(e,"githubUrl",7),E=y(e,"disabled",7,!1),z=y(e,"dropUp",7,!1),G=y(e,"portal",7,!0),J=y(e,"triggerClass",7),K=y(e,"rowLabel",7),Q=y(e,"hasTriggerIcon",7,!0),$=y(e,"description",7),X=y(e,"skipIsolation",7,!1),de=y(e,"suggestedBranch",7),me=y(e,"onSkipIsolationChange",7),ie=y(e,"onGitHubAuthNeededChange",7),q=y(e,"onBranchStatusChange",7),j=y(e,"onBranchesLoaded",7),ne=y(e,"onchange",7),we=y(e,"showUncommittedIndicator",7,!1),be=y(e,"showTriggerChevron",7,!1),Se=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),se=y(e,"triggerContentClass",7,"gap-0.75"),oe=fe(""),H=fe(Ar([])),W=fe(Ar([])),D=fe(!1),ae=fe(!1),ge=fe(!1),ue=fe(""),pe=fe(""),ke=fe(!1),ye=fe(null),Z=fe(""),$e=null,lt=fe(Ar([])),St=0,De=0,Le=null,Qe=fe(null),Ct=fe(!1),bt=fe(!1),sn=fe(void 0),Be=fe(null),he=fe(void 0),Ne=fe(void 0),je=fe(null),Tt=fe(void 0),ee=fe(void 0);const Ge=w(()=>O()==="local"&&typeof me()=="function"&&!!l(pe));let it=fe(void 0);ft(()=>{l(Ct)||(x(it,void 0),x(ee,void 0))}),ft(()=>{if(l(Ct))return ja(U=>{U.isComposing||Qs()})});let Xe=fe("none"),mt=fe(!1);const Mt=_.workspace_isolationMode_worktree_label(),Ue=w(()=>X()&&O()==="local");let Ke=fe(0),Me=fe(!1),Xt=fe(!1),tn=fe(null),es=null;ft(()=>{if(typeof ie()=="function"&&l(Xe)!==es){es=l(Xe);try{ie()(l(Xe))}catch(U){g.error("Error in onGitHubAuthNeededChange callback",U)}}});const le=w(()=>C()||l(oe)),ot=w(()=>l(le)===l(pe)&&l(pe)!=="");ft(()=>{if(!l(Ue)||!l(pe)||l(le)===l(pe))return;const U=l(pe);ii(()=>$s(U,{keepSkipIsolation:!0,keepOpen:!0}))});let At=null;ft(()=>{if(typeof q()=="function"&&l(le)){const U=l(Ke),Pe=l(Me),Oe=l(pe),dt=l(ot),Ut=l(Xt);if(At&&At.behind===U&&At.hasUncommittedChanges===Pe&&At.currentBranch===Oe&&At.isCurrentBranch===dt&&At.isLoading===Ut)return;const en={behind:U,hasUncommittedChanges:Pe,currentBranch:Oe,isCurrentBranch:dt,isLoading:Ut};At=en;try{q()(en)}catch(Cn){g.error("Error in onBranchStatusChange callback",Cn)}}});const Zt=new Map,Ve=300*1e3;let ht="",Et="local",qe,yt=null;const Re=150;let We=null,Pt=0;function Ye(){const U=rd.select(It.state);return U&&M()?{connection:U,repoPath:M(),repoType:O(),githubUrl:P(),generation:Pt,cacheKey:JSON.stringify([U,M(),O(),P()])}:null}function ze(U){return U.generation===Pt&&U.connection===rd.select(It.state)&&U.repoPath===M()&&U.repoType===O()&&U.githubUrl===P()}function pt(){yt&&(clearTimeout(yt),yt=null),We?.abort(),We=null}ql(()=>{Pt++,St++,pt(),$e&&clearTimeout($e)});function at(U){return ya.get("enableFormPersistence")&&r()[U]||""}let Bt="";ft(()=>{g.debug("Value prop effect triggered",{value:C(),repoPath:M(),internalSelectedBranch:l(oe)});const U=M()!==Bt;Bt=M(),C()?(g.debug("Setting internalSelectedBranch from value prop",{value:C()}),x(oe,C())):U&&(g.debug("Repo changed and value is empty, clearing internalSelectedBranch"),x(oe,""))});function rt(){pt(),x(ke,!0),x(ye,null),yt=setTimeout(()=>{yt=null,Yn()},Re)}ft(()=>{const U=s(),Pe=U!==p;p=U;const Oe=M(),dt=O(),Ut=P(),en=Oe!==ht,Cn=dt!==Et,ln=Ut!==qe;Pe&&Zt.clear();const Ae=Pe||en||Oe&&(Cn||ln);ht=Oe,Et=dt,qe=Ut,Ae&&(Pt++,pt(),Le=null,x(W,[],!0),x(D,!1),x(ae,!1),x(ge,!1),x(pe,""),x(Xe,"none"),St++,x(lt,[],!0),x(ye,null),ps(),A(),Oe&&U?(g.debug("Repo changed - resetting branch",{previousRepoPath:ht,currentRepoPath:Oe,previousInternalBranch:l(oe)}),x(oe,""),x(ue,""),x(H,[],!0),rt()):(x(H,[],!0),x(oe,""),x(ue,""),x(ke,!1)))});function Qt(){if(typeof j()=="function")try{j()({branches:[...l(H)],remoteBranches:[...l(W)],defaultBranch:l(ue),currentBranch:l(pe)})}catch(U){g.error("Error in onBranchesLoaded callback",U)}}function Vn(){if(C()){bn(C());return}const U=at(M());U&&(l(H).includes(U)||l(W).includes(U))?bn(U):l(ue)?bn(l(ue)):bn(l(H)[0])}async function Yn(){const U=Ye();if(!U){x(ke,!1);return}We&&We.abort();const Pe=new AbortController;We=Pe;const Oe=()=>!Pe.signal.aborted&&ze(U);g.debug("fetchBranches called",{repoPath:M(),repoType:O(),githubUrl:P()}),mp.start(`fetchBranches-${M()}`,{repoType:O(),githubUrl:P()});let dt=O(),Ut=P();if(M()&&M().includes("/")&&!M().startsWith("/")&&!M().startsWith("~")&&!M().startsWith(".")&&!M().includes(":\\")&&M().split("/").length===2&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(M())&&(dt="github",Ut||(Ut=`https://github.com/${M()}`,g.debug("Reconstructed GitHub URL from shorthand",{repoPath:M(),effectiveGithubUrl:Ut}))),ya.get("enableBranchCaching")){const Ae=Zt.get(U.cacheKey);if(Ae&&Date.now()-Ae.timestamp<Ve){if(x(H,Ae.branches,!0),x(W,Ae.remoteBranches||[],!0),x(ue,Ae.default,!0),x(pe,Ae.current||"",!0),dt==="github")Vn();else if(C())bn(C());else{const st=at(M());st&&(l(H).includes(st)||l(W).includes(st))?bn(st):l(pe)&&l(H).includes(l(pe))?bn(l(pe)):l(ue)&&l(H).includes(l(ue))?bn(l(ue)):l(H).length>0&&bn(l(H)[0])}if(!Oe())return;Qt(),x(ke,!1);return}}x(ke,!0),x(ye,null);let Cn=!1,ln=!1;try{if(ya.get("simulateSlowNetwork")&&await new Promise(Ae=>setTimeout(Ae,ya.get("networkDelay")||0)),!Oe())return;if(dt==="local"){const Ae=await xa.git.getBranches(U.repoPath,!0);if(!Oe())return;if(Ae){if(x(H,Ae.branches,!0),x(W,Ae.remoteBranches,!0),x(ue,Ae.defaultBranch||"",!0),x(pe,Ae.currentBranch||"",!0),C())bn(C());else{const st=at(M());st&&(l(H).includes(st)||l(W).includes(st))?bn(st):l(pe)&&l(H).includes(l(pe))?bn(l(pe)):l(ue)&&l(H).includes(l(ue))?bn(l(ue)):l(H).length>0&&bn(l(H)[0])}Cn=!0}else throw new Error("Failed to fetch branches")}else if(dt==="github"&&Ut){const Ae=Mp(Ut);if(!Ae)throw new Error("Invalid GitHub URL format");const{owner:st,repo:yn}=Ae;xa.integrations.githubBranchesCached(st,yn).then(mn=>{if(!(!Oe()||ln)&&mn.branches.length!==0){if(x(H,mn.branches,!0),x(ue,mn.defaultBranch||"",!0),x(ke,!1),!Le){const Pn=at(M()),ms=C(),vs=De;if(Vn(),!Oe())return;Le={autoSelectedBranch:l(oe),valueBeforePaint:ms,savedBranchBeforePaint:Pn,explicitSelectionRevision:vs}}Qt(),g.debug("Rendered cached branches via github.branches.listCached",{owner:st,repo:yn,count:mn.branches.length,source:mn.source})}});try{const mn=await xa.integrations.githubBranches(st,yn);if(!Oe()){g.debug("Branch fetch aborted after response");return}ln=!0,x(H,mn.branches,!0),x(ue,mn.defaultBranch||"",!0),x(Xe,"none"),Cn=!0,g.debug("Fetched branches via daemon github.branches.list",{owner:st,repo:yn,count:l(H).length})}catch(mn){if(!Oe())return;if(ln=!0,i())throw mn;const Pn=mn instanceof Error?mn.message:String(mn);throw/not configured|not authenticated/i.test(Pn)?(x(Xe,"not-authenticated"),new Error("GITHUB_AUTH_REQUIRED")):/404|not found/i.test(Pn)?(x(Xe,"no-access"),new Error("GITHUB_NO_ACCESS")):mn}}if(!Oe())return;if(ya.get("enableBranchCaching")&&Zt.set(U.cacheKey,{branches:l(H),remoteBranches:l(W),default:l(ue),current:l(pe),timestamp:Date.now()}),dt==="github"&&l(H).length>0){const Ae=Le;if(Ae&&!Ae.valueBeforePaint){if(De===Ae.explicitSelectionRevision&&(!C()||C()===Ae.autoSelectedBranch)){const st=Ae.savedBranchBeforePaint,yn=st&&(l(H).includes(st)||l(W).includes(st))?st:l(ue)||l(H)[0];l(oe)!==yn&&bn(yn)}}else Vn()}Cn&&Oe()&&(Le=null,Qt())}catch(Ae){if(Ae instanceof Error&&Ae.name==="AbortError"){g.debug("Branch fetch aborted in outer catch (superseded by newer request)");return}if(!Oe()){g.debug("Branch fetch aborted; skipping error-state write");return}const st=Ae instanceof Error?Ae:new Error(String(Ae));if(g.error("Failed to fetch branches",st,{repoPath:M(),repoType:O(),githubUrl:P(),effectiveRepoType:dt,effectiveGithubUrl:Ut,githubAuthNeeded:l(Xe)}),Ae instanceof Error){if(Ae.message==="GITHUB_AUTH_REQUIRED"){x(ye,null);return}else if(Ae.message==="GITHUB_NO_ACCESS"){x(ye,_.workspace_branchSelector_noAccess_error(),!0),yp.error(l(ye));return}Ae.message.includes("private repo")||Ae.message.includes("authenticate with GitHub")||Ae.message.includes("access permissions")||Ae.message.includes("GitHub API error")?x(ye,Ae.message,!0):Ae.message.includes("Git is not installed")||Ae.message.includes("ENOENT")||Ae.message.includes("spawn git")?x(ye,_.workspace_branchSelector_gitNotInstalled_error(),!0):Ae.message.includes("rate limit")?x(ye,_.workspace_branchSelector_rateLimit_error(),!0):Ae.message.includes("404")||Ae.message.includes("not found")?dt==="github"?x(ye,_.workspace_branchSelector_repoNotFoundGithub_error(),!0):x(ye,_.workspace_branchSelector_repoNotFound_error(),!0):Ae.message.includes("network")||Ae.message.includes("fetch")?x(ye,_.workspace_branchSelector_network_error(),!0):Ae.message.includes("permission")||Ae.message.includes("denied")?x(ye,_.workspace_branchSelector_permissionDenied_error(),!0):x(ye,Ae.message||_.workspace_branchSelector_fetchBranchesFailed_error(),!0)}else x(ye,_.workspace_branchSelector_fetchBranchesFailedManual_error(),!0);X()&&dt==="local"||yp.error(l(ye)),x(H,[],!0)}finally{mp.end(`fetchBranches-${U.repoPath}`),We===Pe&&Oe()&&(x(ke,!1),We=null)}}async function Gr(){const U=Ye();if(!(!U||U.repoType!=="local")&&!(l(ae)||l(ge))){x(ae,!0),x(ge,!0),g.debug("Fetching remote branches for",{repoPath:M()});try{const Pe=await xa.git.getBranches(U.repoPath,!0);if(!ze(U))return;if(Pe){if(x(W,Pe.remoteBranches||[],!0),ya.get("enableBranchCaching")){const Oe=Zt.get(U.cacheKey);Oe&&Zt.set(U.cacheKey,{...Oe,remoteBranches:l(W)})}g.debug("Fetched remote branches",{count:l(W).length})}}catch(Pe){if(!ze(U))return;g.error("Failed to fetch remote branches",Pe)}finally{ze(U)&&x(ae,!1)}}}function hs(){x(D,!l(D)),l(D)&&l(W).length===0&&!l(ae)&&!l(ge)&&Gr()}async function zt(U){const Pe=Ye();if(!U||!Pe||Pe.repoType!=="local"){x(Ke,0),x(Me,!1),x(Xt,!1);return}x(tn,U,!0),x(Xt,!0),g.debug("Fetching branch status",{branchName:U});try{if(hk()){const Oe=await xa.git.branchStatus(Pe.repoPath,U);if(!ze(Pe)||l(tn)!==U){g.debug("Ignoring stale branch status response",{requested:U,current:l(tn)});return}Oe?(x(Ke,Oe.behind??0,!0),x(Me,U===l(pe)?Oe.hasUncommittedChanges??!1:!1,!0),g.debug("Branch status fetched",{branchName:U,behind:l(Ke),hasUncommittedChanges:l(Me),currentBranch:l(pe),isCurrentBranch:U===l(pe)})):(g.warn("Failed to get branch status",{branchName:U,repoPath:M()}),x(Ke,0),x(Me,!1))}}catch(Oe){if(!ze(Pe)||l(tn)!==U)return;g.error("Failed to fetch branch status",Oe),x(Ke,0),x(Me,!1)}finally{ze(Pe)&&l(tn)===U&&x(Xt,!1)}}function ps(){x(Ke,0),x(Me,!1),x(Xt,!1),x(tn,null)}function bn(U){const Pe=Ye();if(Pe){x(oe,U,!0),g.debug("setInternalBranch called",{branchName:U,hasOnchange:typeof ne()=="function"});try{typeof ne()=="function"&&(g.debug("Calling onchange with branch",{branchName:U}),ne()(new CustomEvent("change",{detail:{branch:U}})))}catch(Oe){g.error("Error in onchange callback",Oe)}ze(Pe)&&zt(U)}}function $s(U,{keepSkipIsolation:Pe=!1,keepOpen:Oe=!1}={}){De++,x(oe,U,!0),A();try{typeof ne()=="function"&&ne()(new CustomEvent("change",{detail:{branch:U}}))}catch(dt){g.error("Error in onchange callback",dt)}if(!Pe&&X()&&typeof me()=="function")try{me()(!1)}catch(dt){g.error("Error in onSkipIsolationChange callback",dt)}zt(U),Oe||Qs()}function ji(U){const Pe=l(je)?.closest('[role="dialog"]');if(!l(it)&&Pe&&l(Be)){x(ee,l(Tt)?.getBoundingClientRect().height||void 0,!0);const Oe=l(Be),dt=Oe.getBoundingClientRect(),Ut=Pe.getBoundingClientRect(),en=Ut.left-dt.left,Cn=Ut.top-dt.top;x(it,{contextElement:Oe,getBoundingClientRect:()=>{const ln=Oe.getBoundingClientRect(),Ae=Math.max(wa,Oe.ownerDocument.documentElement.clientHeight-wa-Ut.height),st=Math.min(Math.max(wa,ln.top+Cn),Ae),yn=Math.max(wa,Oe.ownerDocument.documentElement.clientWidth-wa-Ut.width),mn=Math.min(Math.max(wa,ln.left+en),yn);return new DOMRect(mn,st,0,0)}},!0)}try{me()?.(!U)}catch(Oe){g.error("Error in onSkipIsolationChange callback",Oe)}!U&&l(pe)&&$s(l(pe),{keepSkipIsolation:!0,keepOpen:!0})}function Qs(){const U=l(Ct);x(Ct,!1),U&&To()}async function To(){await qo(),!l(Ct)&&l(Be)?.isConnected&&l(Be).focus({preventScroll:!0})}function ca(U){$e&&clearTimeout($e),$e=setTimeout(()=>{x(Z,U,!0)},100)}function A(){$e&&(clearTimeout($e),$e=null),x(Z,"")}async function ve(){const U=Ye();U&&Zt.delete(U.cacheKey),x(Xe,"none"),await Yn()}async function Ee(){if(!i()){x(mt,!0),x(ye,null);try{const{initializeGitHubAuth:U,startGitHubAuth:Pe}=await cs(async()=>{const{initializeGitHubAuth:ln,startGitHubAuth:Ae}=await import("./CRwmdgt6.js").then(st=>st.nF);return{initializeGitHubAuth:ln,startGitHubAuth:Ae}},__vite__mapDeps([14,15,2,16,17,11,5,3,1,9]),import.meta.url),{selectGitHubAuthIsAuthenticated:Oe,selectGitHubAuthIsAuthenticating:dt,selectGitHubAuthError:Ut}=await cs(async()=>{const{selectGitHubAuthIsAuthenticated:ln,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:st}=await import("./DUkegami.js").then(yn=>yn.x);return{selectGitHubAuthIsAuthenticated:ln,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:st}},__vite__mapDeps([40,14,15,2,16,17,11,5,3,1,9,20,21,8,4,6,22,0,7,10,12,23,24,41,27,26,42,43,44,30,29,45,46]),import.meta.url),en=It;en.dispatch(U()),en.dispatch(Pe());const Cn=setInterval(async()=>{const ln=en.state;if(Oe.select(ln))clearInterval(Cn),x(mt,!1),x(Xe,"none"),await ve();else if(!dt.select(ln)){clearInterval(Cn),x(mt,!1);const Ae=Ut.select(ln);Ae&&x(ye,Ae,!0)}},1e3);setTimeout(()=>{l(mt)&&(clearInterval(Cn),x(mt,!1),x(ye,_.workspace_branchSelector_githubTimeout_error(),!0))},300*1e3)}catch(U){g.error("Failed to connect GitHub",U),x(mt,!1),x(ye,U instanceof Error?U.message:_.workspace_branchSelector_githubConnectFailed_error(),!0)}}}let gt=fe(!0),Ie=fe(!0),xe=!1;ft(()=>{if(l(Ct)){const U=!xe;U&&requestAnimationFrame(()=>{l(Ct)&&!l(Ue)&&l(Qe)&&(l(Qe).focus(),l(Qe).select())}),U&&(x(bt,!Ym(l(Be),360)),l(le)&&O()==="local"&&zt(l(le)))}xe=l(Ct)}),ft(()=>{l(Z)&&(l(gs).length>0&&x(gt,!1),l(Sn).length>0&&x(Ie,!1),l(Bs).length>0&&x(D,!0))});function on(){const U=P()||(M()&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(M())?`https://github.com/${M()}`:void 0);return U?Mp(U):null}ft(()=>{const U=s(),Pe=l(Z).trim();if(!U||O()!=="github"||!Pe){St++,x(lt,[],!0);return}const Oe=on();if(!Oe){St++,x(lt,[],!0);return}const dt=Ye();if(!dt)return;const Ut=++St;x(lt,[],!0),xa.integrations.githubBranches(Oe.owner,Oe.repo,Pe).then(en=>{!ze(dt)||Ut!==St||x(lt,en.branches,!0)}).catch(()=>{})});function gn(U){return U.startsWith("dependabot/")}function Fe(U){const Pe=U.trim(),Oe=Pe.startsWith("+ ")?Pe.substring(2):Pe;if(S1(Oe))return!0;if(U.startsWith("+ ")){const Ut=U.substring(2);if(Ut.startsWith("workspace")||Ut.startsWith("ws/")||Ut.startsWith("ws_"))return!0}return!!(Oe.startsWith("workspace-")||Oe.startsWith("workspace/")||Oe.startsWith("ws/")||Oe.startsWith("ws_")||/-\d{13}-[a-z0-9]+$/.test(Oe))}const Gt=w(()=>l(lt).length>0?[...l(H),...l(lt).filter(U=>!l(H).includes(U))]:l(H)),_n=w(()=>l(Gt).filter(U=>!Fe(U)&&!gn(U)&&U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>U===l(pe)?-1:Pe===l(pe)?1:U===l(ue)?-1:Pe===l(ue)?1:U.localeCompare(Pe))),Sn=w(()=>l(Gt).filter(U=>gn(U)&&U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>U.localeCompare(Pe))),gs=w(()=>l(Gt).filter(U=>Fe(U)&&U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>{const Oe=en=>{const Cn=en.match(/(\d{13})/);return Cn?parseInt(Cn[1]):null},dt=Oe(U),Ut=Oe(Pe);return dt&&Ut?Ut-dt:dt&&!Ut?-1:!dt&&Ut?1:U.localeCompare(Pe)})),Bs=w(()=>l(W).filter(U=>U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>U.localeCompare(Pe))),di=w(()=>{const U=(Pe,Oe=!1)=>Pe.map(dt=>({value:dt,label:dt,class:K()&&Oe?"pl-8":void 0,description:dt===l(ue)?_.workspace_branchSelector_default_label():dt===l(pe)?_.workspace_branchSelector_current_label():void 0}));return[{key:"regular",label:"",options:U(l(_n))},{key:"workspace",label:_.workspace_branchSelector_workspaceBranches_label(),options:U(l(gs),!0),collapsed:l(gt)},{key:"remote",label:_.workspace_branchSelector_remoteBranches_label(),options:U(l(Bs),!0),collapsed:!l(D),keepEmpty:O()==="local"},{key:"dependabot",label:_.workspace_branchSelector_dependabotBranches_label(),options:U(l(Sn),!0),collapsed:l(Ie)}].filter(Pe=>Pe.key!=="remote"||O()==="local")});function Eo(U){return!U.collapsed}function xi(U){U.key==="workspace"?x(gt,!l(gt)):U.key==="remote"?hs():U.key==="dependabot"&&x(Ie,!l(Ie))}var ir={get variant(){return I()},set variant(U="underline"){I(U),b()},get value(){return C()},set value(U=""){C(U),b()},get repoPath(){return M()},set repoPath(U){M(U),b()},get repoType(){return O()},set repoType(U){O(U),b()},get githubUrl(){return P()},set githubUrl(U){P(U),b()},get disabled(){return E()},set disabled(U=!1){E(U),b()},get dropUp(){return z()},set dropUp(U=!1){z(U),b()},get portal(){return G()},set portal(U=!0){G(U),b()},get triggerClass(){return J()},set triggerClass(U){J(U),b()},get rowLabel(){return K()},set rowLabel(U){K(U),b()},get hasTriggerIcon(){return Q()},set hasTriggerIcon(U=!0){Q(U),b()},get description(){return $()},set description(U){$(U),b()},get skipIsolation(){return X()},set skipIsolation(U=!1){X(U),b()},get suggestedBranch(){return de()},set suggestedBranch(U){de(U),b()},get onSkipIsolationChange(){return me()},set onSkipIsolationChange(U){me(U),b()},get onGitHubAuthNeededChange(){return ie()},set onGitHubAuthNeededChange(U){ie(U),b()},get onBranchStatusChange(){return q()},set onBranchStatusChange(U){q(U),b()},get onBranchesLoaded(){return j()},set onBranchesLoaded(U){j(U),b()},get onchange(){return ne()},set onchange(U){ne(U),b()},get showUncommittedIndicator(){return we()},set showUncommittedIndicator(U=!1){we(U),b()},get showTriggerChevron(){return be()},set showTriggerChevron(U=!1){be(U),b()},get triggerChevronClass(){return Se()},set triggerChevronClass(U="ml-2 opacity-50"){Se(U),b()},get triggerContentClass(){return se()},set triggerContentClass(U="gap-0.75"){se(U),b()},$set:Dt,$on:(U,Pe)=>$t(e,U,Pe)},ts=Je(),fi=ce(ts);{var Lr=U=>{var Pe=VL(),Oe=te(Pe);{var dt=Ae=>{var st=Ta(),yn=re(st,!0);L(()=>{wt(st,1,Xn(yr.fieldLabel)),B(yn,K())}),k(Ae,st)};V(Oe,Ae=>{K()&&Ae(dt)})}var Ut=R(Oe,2);{var en=Ae=>{{let st=w(()=>K()?16:12);uo(Ae,{get size(){return l(st)},class:"text-ghost shrink-0"})}};V(Ut,Ae=>{Q()&&Ae(en)})}var Cn=R(Ut,2),ln=re(Cn,!0);Y(Pe),L(Ae=>{wt(Pe,1,`flex min-w-0 items-center gap-2 text-subtle text-sm ${K()?"min-h-10 px-3 py-2":"py-1"}`),B(ln,Ae)},[()=>l(le)||C()||(l(Ue)?_.workspace_branchSelector_noIsolation_label({isolationLabel:Mt}):_.workspace_branchSelector_noBranchSelected_label())]),k(U,Pe)},qu=U=>{var Pe=uO(),Oe=te(Pe);Rt(Oe,()=>qf,(dt,Ut)=>{Ut(dt,{get open(){return l(Ct)},set open(en){x(Ct,en,!0)},children:(en,Cn)=>{var ln=vm(),Ae=ce(ln);{const yn=(mn,Pn)=>{let ms=()=>(Pn?.()).props;{let vs=w(()=>I()==="default"?"outline":I()),hi=w(()=>!K()),bs=w(()=>`${_.workspace_branchSelector_selectBranch_label()}: ${l(le)||C()}`),Ao=w(()=>`w-full text-muted-foreground ${J()} ${l(Xe)==="not-authenticated"?"ring-1 ring-orange-400 rounded-sm":de()&&de()!==l(oe)?"ring-1 ring-primary-ink rounded-sm":""}`);Ze(mn,us(ms,{get variant(){return l(vs)},get wrapContent(){return l(hi)},get"aria-label"(){return l(bs)},get class(){return l(Ao)},get ref(){return l(Be)},set ref(ki){x(Be,ki,!0)},children:(ki,Gi)=>{var or=JL(),zs=te(or);{var pi=tt=>{var Kt=Ta(),un=re(Kt,!0);L(()=>{wt(Kt,1,Xn(yr.fieldLabel)),B(un,K())}),k(tt,Kt)};V(zs,tt=>{K()&&tt(pi)})}var ys=R(zs,2);{var qi=tt=>{ut(tt,{get icon(){return h1},class:"text-orange-500",size:"xs"})},Fs=tt=>{{let Kt=w(()=>K()?16:12);uo(tt,{get size(){return l(Kt)},class:"text-ghost shrink-0"})}};V(ys,tt=>{l(Xe)==="not-authenticated"?tt(qi):Q()&&tt(Fs,1)})}var Ji=R(ys,2),_i=te(Ji);{var ua=tt=>{var Kt=WL(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_connectGithub_label()]),k(tt,Kt)},Ja=tt=>{var Kt=KL(),un=ce(Kt),Zn=re(un,!0),As=R(un,2),Rs=re(As,!0);L(nn=>{B(Zn,l(le)),B(Rs,nn)},[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:Mt})]),k(tt,Kt)},Xa=tt=>{var Kt=Ta(),un=re(Kt,!0);L(()=>B(un,l(le))),k(tt,Kt)},Qa=tt=>{var Kt=Ta(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:Mt})]),k(tt,Kt)},ar=tt=>{var Kt=Ta(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_selectRepoFirst_label()]),k(tt,Kt)},kr=tt=>{var Kt=jL(),un=ce(Kt);li(un,{size:14,class:"text-ghost"});var Zn=R(un,2),As=re(Zn,!0);L(Rs=>B(As,Rs),[()=>_.workspace_compactInitializer_waitingBranchSelection_label()]),k(tt,Kt)},lr=tt=>{var Kt=Ta(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_selectBranch_label()]),k(tt,Kt)};V(_i,tt=>{l(Xe)==="not-authenticated"?tt(ua):X()&&l(le)?tt(Ja,1):l(le)?tt(Xa,2):l(Ue)&&M()?tt(Qa,3):M()?l(ke)?tt(kr,5):tt(lr,-1):tt(ar,4)})}Y(Ji);var Es=R(Ji,2);{var ns=tt=>{var Kt=qL(),un=te(Kt);{let Zn=w(()=>_.workspace_branchSelector_uncommittedChanges_tooltip());Eu(un,{get content(){return l(Zn)},side:"bottom",delayDuration:200,children:(As,Rs)=>{var nn=GL();k(As,nn)},$$slots:{default:!0}})}Y(Kt),Ss(3,Kt,()=>Bo,()=>({axis:"x",tier:"moderate"})),k(tt,Kt)};V(Es,tt=>{we()&&!X()&&l(le)&&O()==="local"&&!l(Xt)&&l(Me)&&l(ot)&&tt(ns)})}var Fn=R(Es,2);{var _r=tt=>{ut(tt,{get icon(){return Da},size:10,get class(){return Se()}})};V(Fn,tt=>{be()&&tt(_r)})}Y(or),L(()=>wt(or,1,`flex items-center truncate min-w-0 ${se()}`)),k(ki,or)},$$slots:{default:!0}}))}};Rt(Ae,()=>eh,(mn,Pn)=>{Pn(mn,{child:yn,$$slots:{child:!0}})})}var st=R(Ae,2);{let yn=w(()=>K()??_.workspace_branchSelector_whichBranch_label()),mn=w(()=>K()?"w-[360px] pt-1 max-w-[calc(100vw-1rem)] min-w-0 max-h-[min(440px,var(--bits-popover-content-available-height,calc(100dvh-1rem)))] overflow-y-auto flex flex-col":"w-[400px] max-w-[calc(100vw-16px)] min-w-0 max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto flex flex-col"),Pn=w(()=>!l(it)),ms=w(()=>l(it)?"bottom":K()?m.current||l(bt)?"bottom":"left":z()?"top":"bottom"),vs=w(()=>l(it)?"start":K()?m.current||l(bt)?"end":"start":"center"),hi=w(()=>l(it)?0:K()?m.current||l(bt)?4:24:void 0),bs=w(()=>({to:v()})),Ao=w(()=>v()?"absolute":"fixed");Rt(st,()=>Gf,(ki,Gi)=>{Gi(ki,{role:"dialog",get"aria-label"(){return l(yn)},get class(){return l(mn)},get customAnchor(){return l(it)},get avoidCollisions(){return l(Pn)},get side(){return l(ms)},get align(){return l(vs)},get sideOffset(){return l(hi)},get portalProps(){return l(bs)},get strategy(){return l(Ao)},onOpenAutoFocus:or=>{or.preventDefault(),qo().then(()=>{l(Ct)&&(l(Ue)?l(je):l(Qe))?.focus()})},get portal(){return G()},children:(or,zs)=>{var pi=cO(),ys=ce(pi);{var qi=ar=>{var kr=XL(),lr=te(kr),Es=re(lr,!0),ns=R(lr,2),Fn=re(ns,!0);Y(kr),L((_r,tt)=>{B(Es,_r),B(Fn,tt)},[()=>_.workspace_branchSelector_whichBranch_label(),()=>$()||_.workspace_branchSelector_whichBranch_description()]),k(ar,kr)};V(ys,ar=>{K()||ar(qi)})}var Fs=R(ys,2);let Ji;var _i=te(Fs);{var ua=ar=>{var kr=QL(),lr=te(kr),Es=re(lr,!0),ns=R(lr,2),Fn=te(ns);u(Fn);var _r=R(Fn,2),tt=re(_r,!0),Kt=R(_r,2),un=re(Kt,!0);Y(ns),Y(kr),L((Zn,As)=>{B(Es,Zn),wt(ns,1,Xn(K()?yr.row+" flex min-w-0":"type-caption flex min-w-0 items-center gap-2 px-2 py-1")),B(tt,l(pe)),B(un,As)},[()=>_.workspace_branchSelector_folderBranch_label(),()=>_.workspace_branchSelector_currentBranch_label()]),k(ar,kr)},Ja=ar=>{var kr=oO(),lr=ce(kr);{var Es=nn=>{{let dn=w(()=>K()?"bg-sidebar hover:bg-hover":"bg-primary/10 hover:bg-primary/15 border border-primary/20");Ze(nn,{variant:"ghost",type:"button",get class(){return`mx-2 mb-2 px-3 py-2 flex items-center gap-2 text-sm text-left rounded-md transition-colors cursor-pointer ${l(dn)??""}`},onclick:()=>$s(de()),children:(Wn,Or)=>{var Wt=YL(),Mn=ce(Wt);uo(Mn,{size:14,class:"text-primary-ink shrink-0"});var Kn=R(Mn,2),Sr=te(Kn),Hs=re(Sr,!0),rs=R(Sr,2),qr=re(rs,!0);Y(Kn),L(Nr=>{B(Hs,Nr),B(qr,de())},[()=>_.workspace_branchSelector_usePrBranch_label()]),k(Wn,Wt)},$$slots:{default:!0}})}};V(lr,nn=>{de()&&de()!==l(oe)&&nn(Es)})}var ns=R(lr,2),Fn=te(ns);{var _r=nn=>{{let dn=w(()=>K()?"mx-2 rounded-(--radius-medium) bg-sidebar":"w-full border-l-2 border-primary bg-primary/5");Ze(nn,{variant:"ghost",type:"button",get class(){return`px-3 py-3 flex items-start gap-3 hover:bg-muted/50 transition-colors cursor-pointer text-left ${l(dn)??""}`},onclick:Ee,children:(Wn,Or)=>{var Wt=ZL(),Mn=R(ce(Wt),2),Kn=te(Mn),Sr=re(Kn,!0),Hs=R(Kn,2),rs=re(Hs,!0);Y(Mn),L((qr,Nr)=>{B(Sr,qr),B(rs,Nr)},[()=>_.workspace_branchSelector_connectWithGithub_label(),()=>_.workspace_branchSelector_connectWithGithub_description()]),k(Wn,Wt)},$$slots:{default:!0}})}},tt=nn=>{var dn=eO(),Wn=te(dn),Or=te(Wn);li(Or,{size:20,class:"text-ghost"}),Y(Wn);var Wt=R(Wn,2),Mn=te(Wt),Kn=re(Mn,!0),Sr=R(Mn,2),Hs=re(Sr,!0);Y(Wt),Y(dn),L((rs,qr)=>{wt(dn,1,`px-3 py-3 flex items-start gap-3 ${K()?"mx-2 rounded-(--radius-medium) bg-sidebar":"border-l-2 border-primary bg-primary/5"}`),B(Kn,rs),B(Hs,qr)},[()=>_.workspace_branchSelector_connectingGithub_label(),()=>_.workspace_branchSelector_completeAuth_description()]),k(nn,dn)},Kt=nn=>{var dn=tO(),Wn=te(dn),Or=re(Wn,!0),Wt=R(Wn,2),Mn=re(Wt,!0);Y(dn),L((Kn,Sr)=>{wt(dn,1,`py-2 bg-danger-background/10 ${K()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),B(Or,Kn),B(Mn,Sr)},[()=>_.workspace_branchSelector_noAccess_error(),()=>_.workspace_branchSelector_noAccess_description()]),k(nn,dn)},un=nn=>{var dn=rO(),Wn=te(dn),Or=re(Wn,!0),Wt=R(Wn,2);{var Mn=Kn=>{var Sr=nO(),Hs=re(Sr,!0);L(rs=>B(Hs,rs),[()=>_.workspace_branchSelector_typeManually_description()]),k(Kn,Sr)};V(Wt,Kn=>{O()==="github"&&Kn(Mn)})}Y(dn),L(()=>{wt(dn,1,`py-2 bg-danger-background/10 ${K()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),B(Or,l(ye))}),k(nn,dn)};V(Fn,nn=>{!i()&&l(Xe)==="not-authenticated"&&!l(mt)?nn(_r):l(mt)?nn(tt,1):l(Xe)==="no-access"?nn(Kt,2):l(ye)&&nn(un,3)})}var Zn=R(Fn,2);{let nn=w(()=>K()?yr.row:void 0),dn=w(()=>_.workspace_branchSelector_selectBranch_label()),Wn=w(()=>_.workspace_branchSelector_search_placeholder()),Or=w(()=>_.workspace_branchSelector_search_placeholder()),Wt=w(()=>_.workspace_branchSelector_noBranchesFound_label()),Mn=w(()=>l(ke)&&l(H).length===0),Kn=w(()=>K()?"flex min-h-0 flex-1 flex-col gap-1 px-2":"flex min-h-0 flex-1 flex-col px-2 pb-1"),Sr=w(()=>K()?"search":void 0),Hs=w(()=>K()?c:void 0),rs=w(()=>K()?"min-h-0 max-h-none flex-1 p-0 pb-2":"min-h-0 max-h-none flex-1"),qr=w(()=>K()?"flex min-h-0 max-h-none flex-col rounded-none border-0 shadow-none":"flex min-h-0 max-h-none flex-col border-0 shadow-none");Wx(Zn,{get open(){return l(Ct)},get value(){return l(oe)},get groups(){return l(di)},get groupHeader(){return d},get optionIcon(){return u},get rowClass(){return l(nn)},get ariaLabel(){return l(dn)},get placeholder(){return l(Wn)},get searchPlaceholder(){return l(Or)},get emptyText(){return l(Wt)},get loading(){return l(Mn)},staticPosition:!0,allowCustom:!0,onquerychange:ca,oncommit:Nr=>{typeof Nr=="string"&&$s(Nr)},oninteractoutside:Nr=>{Nr.target instanceof Node&&(l(he)?.contains(Nr.target)||l(Ne)?.contains(Nr.target))&&Nr.preventDefault()},get class(){return l(Kn)},get inputVariant(){return l(Sr)},get inputAction(){return l(Hs)},inputClass:"shrink-0",get viewportClass(){return l(rs)},size:"compact",get contentClass(){return l(qr)},get inputRef(){return l(Qe)},set inputRef(Nr){x(Qe,Nr,!0)}})}Y(ns);var As=R(ns,2);{var Rs=nn=>{var dn=iO(),Wn=te(dn);Cs(Wn,17,()=>l(di).filter(Wt=>Wt.key==="workspace"&&Wt.options.length>0||Wt.key==="remote"),Wt=>Wt.key,(Wt,Mn)=>{{let Kn=w(()=>Eo(l(Mn)));E0(Wt,{size:"sm",get pressed(){return l(Kn)},get ariaLabel(){return l(Mn).label},onChange:()=>xi(l(Mn)),class:"gap-1.5 border-transparent bg-transparent px-2.5 text-subtle data-[state=on]:border-border data-[state=on]:bg-hover data-[state=on]:font-medium data-[state=on]:shadow-none data-[state=on]:hover:bg-muted",children:(Sr,Hs)=>{var rs=sO(),qr=ce(rs);{var Nr=Ya=>{ut(Ya,{get icon(){return Hm},class:"size-3! text-primary-ink"})},Ju=w(()=>Eo(l(Mn)));V(qr,Ya=>{l(Ju)&&Ya(Nr)})}var rc=R(qr);L(()=>B(rc,` ${l(Mn).label??""}`)),k(Sr,rs)},$$slots:{default:!0}})}});var Or=R(Wn,2);{let Wt=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());Ze(Or,{onclick:ve,variant:"ghost",size:"icon-sm",class:"ml-auto shrink-0",get disabled(){return l(ke)},get"aria-label"(){return l(Wt)},children:(Mn,Kn)=>{ut(Mn,{get icon(){return hp},class:"size-3.5!"})},$$slots:{default:!0}})}Y(dn),Qn(dn,Wt=>x(he,Wt),()=>l(he)),k(nn,dn)};V(As,nn=>{K()||nn(Rs)})}k(ar,kr)};V(_i,ar=>{l(Ue)&&l(pe)?ar(ua):ar(Ja,-1)})}Y(Fs),Qn(Fs,ar=>x(Tt,ar),()=>l(Tt));var Xa=R(Fs,2);{var Qa=ar=>{var kr=lO(),lr=te(kr),Es=te(lr);{const _r=Rs=>{{let nn=w(()=>l(Ue)?Js:p1);ut(Rs,{get icon(){return l(nn)},class:"size-4! text-subtle"})}},tt=(Rs,nn)=>{let dn=()=>(nn?.()).labelId,Wn=()=>(nn?.()).descriptionId;{let Or=w(()=>`${t}-isolation`),Wt=w(()=>!X());Gm(Rs,{get id(){return l(Or)},get checked(){return l(Wt)},get ariaLabelledby(){return dn()},get ariaDescribedby(){return Wn()},class:"dark:[&_[data-switch-thumb][data-state=unchecked]]:bg-foreground",onCheckedChange:ji,get ref(){return l(je)},set ref(Mn){x(je,Mn,!0)}})}};let Kt=w(()=>`${t}-isolation-row`),un=w(()=>`${t}-isolation`),Zn=w(()=>_.workspace_branchSelector_isolation_label({isolationLabel:Mt})),As=w(()=>l(Ue)?_.workspace_branchSelector_isolationOff_description():_.workspace_branchSelector_isolationOn_description());ax(Es,{get id(){return l(Kt)},get htmlFor(){return l(un)},activateLabel:!0,get label(){return l(Zn)},get description(){return l(As)},class:"branch-isolation-row grid-cols-[minmax(0,1fr)_auto] items-start gap-2.5 py-0 first:pt-0 last:pb-0 md:grid-cols-[minmax(0,1fr)_auto] md:items-start md:gap-2.5 [&_[data-field-label]]:py-0 [&_[data-field-label]]:font-normal [&_[data-field-leading]]:mt-0 [&_[data-field-control]]:min-h-0 [&_[data-field-control]]:w-auto [&_.space-y-1]:space-y-0",leading:_r,control:tt,$$slots:{leading:!0,control:!0}})}var ns=R(Es,2);{var Fn=_r=>{var tt=aO(),Kt=re(tt,!0);L(un=>B(Kt,un),[()=>_.workspace_branchSelector_directWarning_description()]),k(_r,tt)};V(ns,_r=>{l(Ue)&&_r(Fn)})}Y(lr),Qn(lr,_r=>x(Ne,_r),()=>l(Ne)),Y(kr),k(ar,kr)};V(Xa,ar=>{O()==="local"&&typeof me()=="function"&&l(pe)&&ar(Qa)})}L(()=>{wt(Fs,1,`flex flex-col transition-none ${l(ee)?"shrink-0":"flex-1"} ${l(Ge)?"min-h-52":"min-h-0"}`),Ji=Hi(Fs,"",Ji,{height:l(ee)?`${l(ee)}px`:void 0})}),k(or,pi)},$$slots:{default:!0}})})}k(en,ln)},$$slots:{default:!0}})}),Y(Pe),Qn(Pe,dt=>x(sn,dt),()=>l(sn)),k(U,Pe)};V(fi,U=>{E()?U(Lr):U(qu,-1)})}k(n,ts);var nc=Ot(ir);return a(),nc}var dO=N('<p class="type-caption text-muted-foreground px-2 py-1" role="status"> </p>');function If(n,e){if(new.target)return Nt({component:If,...n});Lt(e,!0);const t=()=>rn(a,"$member$",s),r=()=>rn(c,"$execution$",s),[s,i]=Jl();let o=y(e,"kind",7,"git-policy");const a=Nf(),c=mw(),u=w(()=>t()?o()==="ai"?_.hostExecution_providerSetup_description():o()==="repository"?r()&&!r().repositoryConnections.some(v=>v.configured)?_.hostExecution_repositorySetup_description():null:r()?.gitCredentialPolicy.managedHelperEnabled===!1?_.hostExecution_disabledHelper_description({setting:r().gitCredentialPolicy.setting}):null:null);var d={get kind(){return o()},set kind(v="git-policy"){o(v),b()},$set:Dt,$on:(v,m)=>$t(e,v,m)},f=Je(),h=ce(f);{var p=v=>{var m=dO(),S=re(m,!0);L(()=>B(S,l(u))),k(v,m)};V(h,v=>{l(u)&&v(p)})}k(n,f);var g=Ot(d);return i(),g}var fO=N('<div class="grid grid-cols-[minmax(0,1fr)_5rem] gap-3"><div><!> <!></div> <div><!> <!></div></div>'),hO=N("<div><!> <!></div>"),pO=N("<!> <!> <!>",1),gO=N('<div class="space-y-3"><h3 class="text-sm font-medium"> </h3> <!> <!> <!></div>'),mO=N('<div class="type-caption text-subtle"><p> </p></div>'),vO=N('<div class="space-y-4"><div><!> <!></div> <div class="space-y-3"><h3 class="text-sm font-medium"> </h3> <div class="flex gap-2"><!> <!></div> <!> <div><!> <!></div></div> <!> <div><!> <!></div> <div><!> <!></div> <!></div>');function A0(n,e){if(new.target)return Nt({component:A0,...n});Lt(e,!0);let t=y(e,"isOpen",7),r=y(e,"onclose",7),s=y(e,"onsave",7),i=y(e,"inline",7,!1),o=y(e,"initialSetup",7);const a=Ga("AddRemoteSetupModal");let c=fe(Ar(o()?.name??"")),u=fe("ssh"),d=fe(Ar(o()?.host??"")),f=fe(Ar(o()?.port??22)),h=fe(Ar(o()?.wsUrl??"")),p=fe(Ar(o()?.username??"")),g=fe(""),v=fe(""),m=fe("agent"),S=fe(Ar(o()?.workspacePath??"")),I=fe(Ar(o()?.branch??"main")),C=fe("");const M=w(()=>l(c).trim()!==""&&(l(u)==="ssh"?l(d).trim()!==""&&l(f)>0&&l(f)<=65535:l(h).trim()!=="")&&l(p).trim()!==""&&l(S).trim()!==""&&(l(m)==="agent"||l(m)==="keyfile"&&l(v).trim()!==""||l(m)==="password"&&l(g).trim()!==""));function O(){if(!l(M)){x(C,_.workspace_addRemoteSetupModal_requiredFields_error(),!0);return}const Q={id:crypto.randomUUID(),name:l(c).trim(),host:l(u)==="ssh"?l(d).trim():"",port:l(u)==="ssh"?l(f):0,username:l(p).trim(),password:l(m)==="password"?l(g).trim():void 0,keyPath:l(m)==="keyfile"?l(v).trim():void 0,useAgent:l(m)==="agent",workspacePath:l(S).trim(),transport:l(u),wsUrl:l(u)==="websocket"?l(h).trim():void 0,branch:l(I).trim()||void 0};a.info("Saving new remote setup",{name:Q.name,transport:Q.transport}),s()(Q),P(),r()()}function P(){x(c,""),x(u,"ssh"),x(d,""),x(f,22),x(h,""),x(p,""),x(g,""),x(v,""),x(m,"agent"),x(S,""),x(I,"main"),x(C,"")}function E(){P(),r()()}var z={get isOpen(){return t()},set isOpen(Q){t(Q),b()},get onclose(){return r()},set onclose(Q){r(Q),b()},get onsave(){return s()},set onsave(Q){s(Q),b()},get inline(){return i()},set inline(Q=!1){i(Q),b()},get initialSetup(){return o()},set initialSetup(Q){o(Q),b()},$set:Dt,$on:(Q,$)=>$t(e,Q,$)},G=Je(),J=ce(G);{var K=Q=>{{let $=w(()=>_.workspace_addRemoteSetupModal_title()),X=w(()=>_.workspace_addRemoteSetupModal_close_ariaLabel()),de=w(()=>_.workspace_addRemoteSetupModal_addSetup_label()),me=w(()=>_.workspace_addRemoteSetupModal_cancel_label());jx(Q,{get open(){return t()},get static(){return i()},get title(){return l($)},get closeLabel(){return l(X)},get submitLabel(){return l(de)},get cancelLabel(){return l(me)},size:"lg",get canSubmit(){return l(M)},onSubmit:O,onCancel:E,children:(ie,q)=>{var j=vO(),ne=te(j),we=te(ne);Do(we,{for:"name",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_setupName_label()]),k(he,je)},$$slots:{default:!0}});var be=R(we,2);{let he=w(()=>_.workspace_addRemoteSetupModal_setupName_placeholder());Xr(be,{id:"name",get placeholder(){return l(he)},class:"mt-1",get value(){return l(c)},set value(Ne){x(c,Ne,!0)}})}Y(ne);var Se=R(ne,2),se=te(Se),oe=re(se,!0),H=R(se,2),W=te(H);{let he=w(()=>l(u)==="ssh"),Ne=w(()=>l(u)==="ssh"?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:bg-muted");Ze(W,{variant:"ghost",type:"button",get"aria-pressed"(){return l(he)},get class(){return`flex-1 px-3 py-1.5 text-sm rounded-md border transition-colors ${l(Ne)??""}`},onclick:()=>{l(u)!=="ssh"&&(P(),x(u,"ssh"))},children:(je,Tt)=>{Ht();var ee=Vt("SSH");k(je,ee)},$$slots:{default:!0}})}var D=R(W,2);{let he=w(()=>l(u)==="websocket"),Ne=w(()=>l(u)==="websocket"?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:bg-muted");Ze(D,{variant:"ghost",type:"button",get"aria-pressed"(){return l(he)},get class(){return`flex-1 px-3 py-1.5 text-sm rounded-md border transition-colors ${l(Ne)??""}`},onclick:()=>{l(u)!=="websocket"&&(P(),x(u,"websocket"))},children:(je,Tt)=>{Ht();var ee=Vt("WebSocket");k(je,ee)},$$slots:{default:!0}})}Y(H);var ae=R(H,2);{var ge=he=>{var Ne=fO(),je=te(Ne),Tt=te(je);Do(Tt,{for:"host",children:(mt,Mt)=>{Ht();var Ue=Vt();L(Ke=>B(Ue,Ke),[()=>_.workspace_addRemoteSetupModal_host_label()]),k(mt,Ue)},$$slots:{default:!0}});var ee=R(Tt,2);Xr(ee,{id:"host",placeholder:"dev.example.com",class:"mt-1",get value(){return l(d)},set value(mt){x(d,mt,!0)}}),Y(je);var Ge=R(je,2),it=te(Ge);Do(it,{for:"port",children:(mt,Mt)=>{Ht();var Ue=Vt();L(Ke=>B(Ue,Ke),[()=>_.workspace_addRemoteSetupModal_port_label()]),k(mt,Ue)},$$slots:{default:!0}});var Xe=R(it,2);Xr(Xe,{id:"port",type:"number",placeholder:"22",class:"mt-1",get value(){return l(f)},set value(mt){x(f,mt,!0)}}),Y(Ge),Y(Ne),k(he,Ne)},ue=he=>{var Ne=hO(),je=te(Ne);Do(je,{for:"wsUrl",children:(ee,Ge)=>{Ht();var it=Vt();L(Xe=>B(it,Xe),[()=>_.workspace_addRemoteSetupModal_wsUrl_label()]),k(ee,it)},$$slots:{default:!0}});var Tt=R(je,2);Xr(Tt,{id:"wsUrl",placeholder:"wss://dev.example.com/ws",class:"mt-1",get value(){return l(h)},set value(ee){x(h,ee,!0)}}),Y(Ne),k(he,Ne)};V(ae,he=>{l(u)==="ssh"?he(ge):he(ue,-1)})}var pe=R(ae,2),ke=te(pe);Do(ke,{for:"username",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_username_label()]),k(he,je)},$$slots:{default:!0}});var ye=R(ke,2);Xr(ye,{id:"username",placeholder:"john",class:"mt-1",get value(){return l(p)},set value(he){x(p,he,!0)}}),Y(pe),Y(Se);var Z=R(Se,2);{var $e=he=>{var Ne=gO(),je=te(Ne),Tt=re(je,!0),ee=R(je,2),Ge=()=>l(m),it=Ke=>{(Ke==="agent"||Ke==="keyfile"||Ke==="password")&&x(m,Ke,!0)};{let Ke=w(()=>_.workspace_addRemoteSetupModal_authentication_label());Rt(ee,()=>Gx,(Me,Xt)=>{Xt(Me,{type:"single",get value(){return Ge()},set value(tn){it(tn)},get"aria-label"(){return l(Ke)},variant:"outline",class:"flex w-full",children:(tn,es)=>{var le=pO(),ot=ce(le);Rt(ot,()=>ld,(Ve,ht)=>{ht(Ve,{value:"agent",class:"min-w-0 flex-1",onclick:Et=>{l(m)==="agent"&&Et.preventDefault()},onkeydown:Et=>{l(m)==="agent"&&["Enter"," "].includes(Et.key)&&Et.preventDefault()},children:(Et,qe)=>{Ht();var yt=Vt();L(Re=>B(yt,Re),[()=>_.workspace_addRemoteSetupModal_sshAgent_label()]),k(Et,yt)},$$slots:{default:!0}})});var At=R(ot,2);Rt(At,()=>ld,(Ve,ht)=>{ht(Ve,{value:"keyfile",class:"min-w-0 flex-1",onclick:Et=>{l(m)==="keyfile"&&Et.preventDefault()},onkeydown:Et=>{l(m)==="keyfile"&&["Enter"," "].includes(Et.key)&&Et.preventDefault()},children:(Et,qe)=>{Ht();var yt=Vt();L(Re=>B(yt,Re),[()=>_.workspace_addRemoteSetupModal_keyFile_label()]),k(Et,yt)},$$slots:{default:!0}})});var Zt=R(At,2);Rt(Zt,()=>ld,(Ve,ht)=>{ht(Ve,{value:"password",class:"min-w-0 flex-1",onclick:Et=>{l(m)==="password"&&Et.preventDefault()},onkeydown:Et=>{l(m)==="password"&&["Enter"," "].includes(Et.key)&&Et.preventDefault()},children:(Et,qe)=>{Ht();var yt=Vt();L(Re=>B(yt,Re),[()=>_.workspace_addRemoteSetupModal_password_label()]),k(Et,yt)},$$slots:{default:!0}})}),k(tn,le)},$$slots:{default:!0}})})}var Xe=R(ee,2);{var mt=Ke=>{const Me=w(()=>"~/.ssh/id_rsa");{let Xt=w(()=>_.workspace_addRemoteSetupModal_keyFile_label());Xr(Ke,{placeholder:l(Me),get"aria-label"(){return l(Xt)},get value(){return l(v)},set value(tn){x(v,tn,!0)}})}};V(Xe,Ke=>{l(m)==="keyfile"&&Ke(mt)})}var Mt=R(Xe,2);{var Ue=Ke=>{{let Me=w(()=>_.workspace_addRemoteSetupModal_password_label());Xr(Ke,{type:"password",placeholder:"••••••••",get"aria-label"(){return l(Me)},get value(){return l(g)},set value(Xt){x(g,Xt,!0)}})}};V(Mt,Ke=>{l(m)==="password"&&Ke(Ue)})}Y(Ne),L(Ke=>B(Tt,Ke),[()=>_.workspace_addRemoteSetupModal_authentication_label()]),k(he,Ne)},lt=he=>{var Ne=mO(),je=te(Ne),Tt=re(je,!0);Y(Ne),L(ee=>B(Tt,ee),[()=>_.workspace_addRemoteSetupModal_websocketAuth_description()]),k(he,Ne)};V(Z,he=>{l(u)==="ssh"?he($e):he(lt,-1)})}var St=R(Z,2),De=te(St);Do(De,{for:"workspacePath",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_repoPath_label()]),k(he,je)},$$slots:{default:!0}});var Le=R(De,2);Xr(Le,{id:"workspacePath",placeholder:"/home/user/myrepo",class:"mt-1",get value(){return l(S)},set value(he){x(S,he,!0)}}),Y(St);var Qe=R(St,2),Ct=te(Qe);Do(Ct,{for:"branch",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_branch_label()]),k(he,je)},$$slots:{default:!0}});var bt=R(Ct,2);Xr(bt,{id:"branch",placeholder:"main",class:"mt-1",get value(){return l(I)},set value(he){x(I,he,!0)}}),Y(Qe);var sn=R(Qe,2);{var Be=he=>{mx(he,{tone:"error",children:(Ne,je)=>{Ht();var Tt=Vt();L(()=>B(Tt,l(C))),k(Ne,Tt)},$$slots:{default:!0}})};V(sn,he=>{l(C)&&he(Be)})}Y(j),L(he=>B(oe,he),[()=>_.workspace_addRemoteSetupModal_connectionDetails_label()]),k(ie,j)},$$slots:{default:!0}})}};V(J,Q=>{t()&&Q(K)})}return k(n,G),Ot(z)}var bO=new Set(["$$slots","$$events","$$legacy","owner","name","suffix","provider","avatarUrl","local","showOwner","showForge","recent","option","selected","formStyle","checked","class"]),yO=N('<span class="text-subtle mr-1"> </span>'),wO=N('<span class="text-subtle ml-1"> </span>'),xO=N('<span role="img" class="text-subtle shrink-0"><!></span>'),kO=N('<span><span class="truncate"><!> <!></span> <!></span>');function jh(n,e){if(new.target)return Nt({component:jh,...n});Lt(e,!0);const t=M=>{var O=Je(),P=ce(O);{var E=z=>{{let G=w(()=>br(yr.check,"self-center"));Zm(z,{state:"checked",get class(){return l(G)}})}};V(P,z=>{(v()??p())&&z(E)})}k(M,O)};let r=y(e,"owner",7),s=y(e,"name",7),i=y(e,"suffix",7),o=y(e,"provider",7),a=y(e,"avatarUrl",7),c=y(e,"local",7,!1),u=y(e,"showOwner",7,!0),d=y(e,"showForge",7,!1),f=y(e,"recent",7,!1),h=y(e,"option",7,!1),p=y(e,"selected",7,!1),g=y(e,"formStyle",7,!1),v=y(e,"checked",7),m=y(e,"class",7,""),S=ui(e,bO);const I={github:"GitHub",gitlab:"GitLab"};var C={get owner(){return r()},set owner(M){r(M),b()},get name(){return s()},set name(M){s(M),b()},get suffix(){return i()},set suffix(M){i(M),b()},get provider(){return o()},set provider(M){o(M),b()},get avatarUrl(){return a()},set avatarUrl(M){a(M),b()},get local(){return c()},set local(M=!1){c(M),b()},get showOwner(){return u()},set showOwner(M=!0){u(M),b()},get showForge(){return d()},set showForge(M=!1){d(M),b()},get recent(){return f()},set recent(M=!1){f(M),b()},get option(){return h()},set option(M=!1){h(M),b()},get selected(){return p()},set selected(M=!1){p(M),b()},get formStyle(){return g()},set formStyle(M=!1){g(M),b()},get checked(){return v()},set checked(M){v(M),b()},get class(){return m()},set class(M=""){m(M),b()},$set:Dt,$on:(M,O)=>$t(e,M,O)};{const M=G=>{{let J=w(()=>g()?20:16);th(G,{get owner(){return r()},get provider(){return o()},get avatarUrl(){return a()},get local(){return c()},get size(){return l(J)}})}},O=G=>{var J=kO(),K=te(J),Q=te(K);{var $=j=>{var ne=yO(),we=re(ne);L(()=>B(we,`${r()??""} /`)),k(j,ne)};V(Q,j=>{u()&&r()&&j($)})}var X=R(Q),de=R(X);{var me=j=>{var ne=wO(),we=re(ne);L(()=>B(we,`(${i()??""})`)),k(j,ne)};V(de,j=>{i()&&j(me)})}Y(K);var ie=R(K,2);{var q=j=>{var ne=xO(),we=te(ne);{let be=w(()=>o()==="github"?Df:$f);ut(we,{get icon(){return l(be)},size:12})}Y(ne),L(()=>xt(ne,"aria-label",I[o()])),k(j,ne)};V(ie,j=>{d()&&o()&&!g()&&j(q)})}Y(J),L(()=>{wt(J,1,`flex min-w-0 items-center gap-2 ${g()?"":"text-sm"}`),xt(K,"data-recent-repo-label",f()?"":void 0),B(X,` ${s()??""} `)}),k(G,J)};let P=w(()=>g()?t:void 0),E=w(()=>h()?"option":void 0),z=w(()=>g()?br(yr.row,"cursor-pointer focus-visible:outline-none [--menu-icon-size:1.25rem]",m()):`gap-2 py-1.5 cursor-pointer ${m()}`);ov(n,us(()=>S,{get trailing(){return l(P)},get role(){return l(E)},get selected(){return p()},get class(){return l(z)},leading:M,title:O,$$slots:{leading:!0,title:!0}}))}return Ot(C)}var _O=N('<p class="mt-1"> </p>'),SO=N('<div role="alert" class="mt-2 px-1 text-sm text-subtle"><div class="flex items-center gap-2"><span> </span> <!></div> <!></div>'),CO=N('<div role="status"><!><span> </span></div>'),MO=N('<div role="listbox"></div>'),TO=N("<p> </p>");function Gh(n,e){const t=Vi();if(new.target)return Nt({component:Gh,...n});Lt(e,!0);let r=y(e,"id",7,t),s=y(e,"items",7),i=y(e,"getKey",7),o=y(e,"getOwner",7),a=y(e,"getName",7),c=y(e,"getAvatarUrl",7),u=y(e,"provider",7),d=y(e,"label",7),f=y(e,"loading",7,!1),h=y(e,"loadingLabel",7),p=y(e,"emptyLabel",7),g=y(e,"error",7),v=y(e,"detail",7),m=y(e,"retryLabel",7),S=y(e,"onRetry",7),I=y(e,"onSelect",7),C=y(e,"selectedKey",7),M=y(e,"activeIndex",31,()=>-1),O=y(e,"scrollable",7,!0),P=y(e,"formStyle",7,!1),E=fe(void 0),z="",G=0;ft(()=>{M()>=s().length&&M(-1)});function J(j){M(Math.max(0,Math.min(s().length-1,j))),l(E)?.querySelectorAll('[role="option"]')[M()]?.focus()}function K(j,ne,we){if(!j.isComposing){if(["ArrowDown","ArrowUp","Home","End"].includes(j.key))j.preventDefault(),j.stopPropagation(),J(j.key==="Home"?0:j.key==="End"?s().length-1:we+(j.key==="ArrowDown"?1:-1));else if(j.key==="Enter"||j.key===" ")j.preventDefault(),j.stopPropagation(),I()(ne);else if(j.key.length===1&&!j.metaKey&&!j.ctrlKey&&!j.altKey){const be=Date.now();z=be-G>500?j.key:z+j.key,G=be;for(let Se=1;Se<=s().length;Se+=1){const se=(we+Se)%s().length;if(`${o()(s()[se])}/${a()(s()[se])}`.toLowerCase().startsWith(z.toLowerCase())){j.preventDefault(),J(se);break}}}}}var Q={get id(){return r()},set id(j=t){r(j),b()},get items(){return s()},set items(j){s(j),b()},get getKey(){return i()},set getKey(j){i(j),b()},get getOwner(){return o()},set getOwner(j){o(j),b()},get getName(){return a()},set getName(j){a(j),b()},get getAvatarUrl(){return c()},set getAvatarUrl(j){c(j),b()},get provider(){return u()},set provider(j){u(j),b()},get label(){return d()},set label(j){d(j),b()},get loading(){return f()},set loading(j=!1){f(j),b()},get loadingLabel(){return h()},set loadingLabel(j){h(j),b()},get emptyLabel(){return p()},set emptyLabel(j){p(j),b()},get error(){return g()},set error(j){g(j),b()},get detail(){return v()},set detail(j){v(j),b()},get retryLabel(){return m()},set retryLabel(j){m(j),b()},get onRetry(){return S()},set onRetry(j){S(j),b()},get onSelect(){return I()},set onSelect(j){I(j),b()},get selectedKey(){return C()},set selectedKey(j){C(j),b()},get activeIndex(){return M()},set activeIndex(j=-1){M(j),b()},get scrollable(){return O()},set scrollable(j=!0){O(j),b()},get formStyle(){return P()},set formStyle(j=!1){P(j),b()},$set:Dt,$on:(j,ne)=>$t(e,j,ne)},$=Je(),X=ce($);{var de=j=>{var ne=SO(),we=te(ne),be=te(we),Se=re(be,!0),se=R(be,2);{var oe=D=>{Ze(D,{variant:"ghost",type:"button",class:"underline underline-offset-2 cursor-pointer hover:no-underline",get onclick(){return S()},children:(ae,ge)=>{Ht();var ue=Vt();L(()=>B(ue,m())),k(ae,ue)},$$slots:{default:!0}})};V(se,D=>{S()&&m()&&D(oe)})}Y(we);var H=R(we,2);{var W=D=>{var ae=_O(),ge=re(ae,!0);L(()=>B(ge,v())),k(D,ae)};V(H,D=>{v()&&D(W)})}Y(ne),L(()=>B(Se,g())),k(j,ne)},me=j=>{var ne=CO(),we=te(ne);li(we,{size:12});var be=R(we),Se=re(be,!0);Y(ne),L(()=>{xt(ne,"aria-label",h()),wt(ne,1,`mt-2 flex items-center gap-2 ${P()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),B(Se,h())}),k(j,ne)},ie=j=>{var ne=MO();Cs(ne,23,s,we=>i()(we),(we,be,Se)=>{{let se=w(()=>`${r()}-${l(Se)}`),oe=w(()=>`${o()(l(be))}/${a()(l(be))}`),H=w(()=>l(Se)===Math.max(0,M())?0:-1),W=w(()=>C()?i()(l(be))===C():l(Se)===M()),D=w(()=>l(Se)===M()||i()(l(be))===C()),ae=w(()=>i()(l(be))===C()),ge=w(()=>o()(l(be))),ue=w(()=>a()(l(be))),pe=w(()=>c()?.(l(be)));jh(we,{get id(){return l(se)},option:!0,get"aria-label"(){return l(oe)},get tabindex(){return l(H)},get"aria-selected"(){return l(W)},get selected(){return l(D)},get checked(){return l(ae)},get formStyle(){return P()},get owner(){return l(ge)},get name(){return l(ue)},get avatarUrl(){return l(pe)},get provider(){return u()},onclick:()=>I()(l(be)),onmousemove:()=>M(l(Se)),onfocus:()=>M(l(Se)),onkeydown:ke=>K(ke,l(be),l(Se))})}}),Y(ne),Qn(ne,we=>x(E,we),()=>l(E)),L(()=>{xt(ne,"id",r()),xt(ne,"aria-label",d()),wt(ne,1,Xn(O()?"mt-2 max-h-56 overflow-y-auto":"mt-2"))}),k(j,ne)},q=j=>{var ne=TO(),we=re(ne,!0);L(()=>{wt(ne,1,`mt-2 ${P()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),B(we,p())}),k(j,ne)};V(X,j=>{g()?j(de):f()?j(me,1):s().length?j(ie,2):j(q,-1)})}return k(n,$),Ot(Q)}var EO=N('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),AO=N('<div class="min-w-0" data-testid="gitlab-picker-list"><!> <div class="flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring"><!> <!></div> <!> <!> <!></div>');function R0(n,e){if(new.target)return Nt({component:R0,...n});Lt(e,!0);let t=y(e,"selectedProjectPath",7),r=y(e,"onSelect",7),s=y(e,"scopeKey",7),i=y(e,"prefix",7),o=y(e,"instanceBaseUrl",7),a=y(e,"query",7),c=y(e,"page",7),u=y(e,"copy",7),d=y(e,"onSearch",7),f=y(e,"onSubmit",7),h=y(e,"submitLabel",7),p=y(e,"onMore",7),g=y(e,"onRecover",7),v=y(e,"scrollable",7,!0),m=y(e,"formStyle",7,!1),S=fe(void 0);function I(ie){if(ie.key!=="ArrowDown"||ie.isComposing)return;const q=l(S)?.querySelector('[role="option"]');q&&(ie.preventDefault(),ie.stopPropagation(),q.focus())}var C={get selectedProjectPath(){return t()},set selectedProjectPath(ie){t(ie),b()},get onSelect(){return r()},set onSelect(ie){r(ie),b()},get scopeKey(){return s()},set scopeKey(ie){s(ie),b()},get prefix(){return i()},set prefix(ie){i(ie),b()},get instanceBaseUrl(){return o()},set instanceBaseUrl(ie){o(ie),b()},get query(){return a()},set query(ie){a(ie),b()},get page(){return c()},set page(ie){c(ie),b()},get copy(){return u()},set copy(ie){u(ie),b()},get onSearch(){return d()},set onSearch(ie){d(ie),b()},get onSubmit(){return f()},set onSubmit(ie){f(ie),b()},get submitLabel(){return h()},set submitLabel(ie){h(ie),b()},get onMore(){return p()},set onMore(ie){p(ie),b()},get onRecover(){return g()},set onRecover(ie){g(ie),b()},get scrollable(){return v()},set scrollable(ie=!0){v(ie),b()},get formStyle(){return m()},set formStyle(ie=!1){m(ie),b()},$set:Dt,$on:(ie,q)=>$t(e,ie,q)},M=AO(),O=te(M);{var P=ie=>{var q=EO(),j=re(q,!0);L(()=>B(j,o())),k(ie,q)};V(O,ie=>{o()&&!i()&&ie(P)})}var E=R(O,2),z=te(E);{var G=ie=>{var q=Je(),j=ce(q);On(j,i),k(ie,q)};V(z,ie=>{i()&&ie(G)})}var J=R(z,2);{var K=ie=>{{let q=w(()=>!s());Xr(ie,{type:"search",get"aria-label"(){return u().searchLabel},get value(){return a()},get disabled(){return l(q)},get placeholder(){return u().searchPlaceholder},oninput:j=>d()(j.currentTarget.value,s()),onkeydown:I,class:"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm",noFocusStyle:!0})}};V(J,ie=>{c().status!=="unavailable"&&ie(K)})}Y(E);var Q=R(E,2);{var $=ie=>{{let q=w(()=>!a().trim()||c().status==="loading"||c().loadingMore);Ze(ie,{type:"button",variant:"secondary",class:"mt-2 w-full",get disabled(){return l(q)},onclick:()=>f()?.(a(),s()),children:(j,ne)=>{Ht();var we=Vt();L(()=>B(we,h())),k(j,we)},$$slots:{default:!0}})}};V(Q,ie=>{c().status!=="unavailable"&&f()&&h()&&ie($)})}var X=R(Q,2);Qf(X,s,ie=>{{let q=w(()=>c().status==="ready"?c().items:[]),j=w(()=>c().status==="loading"),ne=w(()=>a()?u().emptySearchLabel:u().emptyLabel),we=w(()=>c().status==="unavailable"?c().message:void 0),be=w(()=>c().status==="unavailable"?c().detail:void 0),Se=w(()=>c().status==="unavailable"?c().actionLabel:void 0),se=w(()=>g()?()=>g()?.(s()):void 0);Gh(ie,{get items(){return l(q)},getKey:oe=>oe.projectPath,getOwner:oe=>oe.projectPath.split("/").slice(0,-1).join("/"),getName:oe=>oe.projectPath.split("/").at(-1)??oe.name,getAvatarUrl:oe=>oe.ownerAvatarUrl,provider:"gitlab",get scrollable(){return v()},get formStyle(){return m()},get label(){return u().listLabel},get loading(){return l(j)},get loadingLabel(){return u().loadingLabel},get emptyLabel(){return l(ne)},get error(){return l(we)},get detail(){return l(be)},get retryLabel(){return l(Se)},get onRetry(){return l(se)},get selectedKey(){return t()},onSelect:oe=>r()(oe.projectPath,s())})}});var de=R(X,2);{var me=ie=>{Ze(ie,{type:"button",variant:"ghost",class:"mt-2 w-full",get disabled(){return c().loadingMore},onclick:()=>p()(s()),children:(q,j)=>{Ht();var ne=Vt();L(()=>B(ne,c().loadingMore?u().loadingMoreLabel:u().loadMoreLabel)),k(q,ne)},$$slots:{default:!0}})};V(de,ie=>{c().status==="ready"&&(c().hasMore||c().loadingMore)&&ie(me)})}return Y(M),Qn(M,ie=>x(S,ie),()=>l(S)),k(n,M),Ot(C)}var RO=N('<div class="py-2 px-2 flex items-center gap-2 text-xs text-emerald-500"><!> <span> </span></div>'),bm=N("<!> <span> </span>",1),PO=N('<div class="py-2 px-2 space-y-2"><p class="text-xs text-danger"> </p> <!></div>'),IO=N('<div class="py-2 px-2 space-y-1"><p class="text-xs text-subtle"> </p> <p class="text-xs text-subtle"> <code class="bg-muted px-1 rounded">auggie login</code> </p></div>'),LO=N("<!> <span> </span> <!>",1),OO=N('<div class="py-1.5 px-3 space-y-2"><div class="flex items-center justify-between gap-2"><p class="text-xs text-subtle"> </p> <!></div> <!> <div class="flex items-center gap-1.5 text-xs text-subtle"><!></div></div>'),NO=N('<div class="py-2 px-2 flex items-center gap-2 text-xs text-subtle"><!> <span> </span></div>'),DO=N('<p class="type-caption whitespace-normal text-muted-foreground"> </p>'),$O=N('<div class="first-line-icon type-caption"><!></div> <div class="flex-1 min-w-0"><p> </p> <!></div>',1),ym=N("<div><!></div>");function P0(n,e){if(new.target)return Nt({component:P0,...n});Lt(e,!0);const t=()=>rn(g,"$isAuthenticated$",a),r=()=>rn(v,"$isAuthenticating$",a),s=()=>rn(m,"$deviceFlow$",a),i=()=>rn(S,"$error$",a),o=()=>rn(I,"$requiresDaemonAuth$",a),[a,c]=Jl();let u=y(e,"message",23,()=>_.lib_githubAuth_connect_label()),d=y(e,"compact",7,!1),f=y(e,"onSuccess",7),h=y(e,"class",7,""),p=y(e,"autoStart",7,!1);const g=ev(),v=ik(),m=ok(),S=ak(),I=lk();let C=fe(!1),M=fe(!1),O=fe(!1);Lf(()=>{It.dispatch(Kd()),p()&&P()});function P(){x(C,!0),It.dispatch(_x())}function E(){l(C)&&(It.dispatch(xp()),x(C,!1))}function z(){It.dispatch(Sx()),P()}function G(){x(C,!1),x(O,!0),setTimeout(()=>{x(O,!1),typeof f()=="function"&&f()()},1e3)}async function J(){if(l(C)){if(t()){G();return}x(M,!0);try{await C1.isAuthenticated()&&(It.dispatch(Kd()),G())}catch{}finally{x(M,!1)}}}ft(()=>{!l(C)&&r()&&s()&&x(C,!0)}),ft(()=>{l(C)&&t()&&G()}),ft(()=>{if(!l(C)||!s())return;const se=()=>{J()};return window.addEventListener("focus",se),()=>{window.removeEventListener("focus",se)}}),ql(()=>{l(C)&&r()&&It.dispatch(xp())});const K=w(()=>l(C)&&r()),Q=w(()=>l(C)&&s()),$=w(()=>l(C)&&i());var X={get message(){return u()},set message(se=_.lib_githubAuth_connect_label()){u(se),b()},get compact(){return d()},set compact(se=!1){d(se),b()},get onSuccess(){return f()},set onSuccess(se){f(se),b()},get class(){return h()},set class(se=""){h(se),b()},get autoStart(){return p()},set autoStart(se=!1){p(se),b()},$set:Dt,$on:(se,oe)=>$t(e,se,oe)},de=ym(),me=te(de);{var ie=se=>{var oe=RO(),H=te(oe);ut(H,{get icon(){return Hm},size:"xs"});var W=R(H,2),D=re(W,!0);Y(oe),L(ae=>B(D,ae),[()=>_.lib_githubAuth_connected_label()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},q=se=>{var oe=PO(),H=te(oe),W=re(H,!0),D=R(H,2);Ze(D,{variant:"outline",size:"xs",onclick:z,children:(ae,ge)=>{var ue=bm(),pe=ce(ue);ut(pe,{get icon(){return Bf},size:"xs"});var ke=R(pe,2),ye=re(ke,!0);L(Z=>B(ye,Z),[()=>_.lib_githubAuth_tryAgain_label()]),k(ae,ue)},$$slots:{default:!0}}),Y(oe),L(()=>B(W,i())),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},j=se=>{var oe=IO(),H=te(oe),W=re(H,!0),D=R(H,2),ae=te(D),ge=R(ae,2);Y(D),Y(oe),L((ue,pe,ke)=>{B(W,ue),B(ae,`${pe??""} `),B(ge,` ${ke??""}`)},[()=>_.lib_githubAuth_daemonAuthFirst_message(),()=>_.lib_githubAuth_run_before(),()=>_.lib_githubAuth_inYourTerminal_after()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},ne=se=>{var oe=OO(),H=te(oe),W=te(H),D=re(W,!0),ae=R(W,2);{let Z=w(()=>_.lib_githubAuth_closeModal_ariaLabel());Ze(ae,{variant:"ghost-light",size:"icon-xs",class:"-mt-2 -mr-2",onclick:E,get"aria-label"(){return l(Z)},children:($e,lt)=>{ut($e,{get icon(){return Fi},size:"xs"})},$$slots:{default:!0}})}Y(H);var ge=R(H,2);qx(ge,{get userCode(){return s().userCode},get verificationUri(){return s().verificationUri},compact:!0});var ue=R(ge,2),pe=te(ue);{var ke=Z=>{var $e=bm(),lt=ce($e);li(lt,{size:12});var St=R(lt,2),De=re(St,!0);L(Le=>B(De,Le),[()=>_.lib_githubAuth_checking_label()]),k(Z,$e)},ye=Z=>{var $e=LO(),lt=ce($e);li(lt,{size:12});var St=R(lt,2),De=re(St,!0),Le=R(St,2);Ze(Le,{type:"button",class:"cursor-pointer underline underline-offset-2 decoration-muted-foreground/20",onclick:J,children:(Qe,Ct)=>{Ht();var bt=Vt();L(sn=>B(bt,sn),[()=>_.lib_githubAuth_checkNow_label()]),k(Qe,bt)},$$slots:{default:!0}}),L(Qe=>B(De,Qe),[()=>_.lib_githubAuth_waitingForAuthorization_label()]),k(Z,$e)};V(pe,Z=>{l(M)?Z(ke):Z(ye,-1)})}Y(ue),Y(oe),L(Z=>B(D,Z),[()=>_.lib_githubAuth_enterCode_label()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},we=se=>{var oe=NO(),H=te(oe);li(H,{size:12});var W=R(H,2),D=re(W,!0);Y(oe),L(ae=>B(D,ae),[()=>_.lib_githubAuth_startingAuthentication_label()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},be=se=>{var oe=ym(),H=te(oe);{let W=w(()=>d()?"h-8":"h-auto items-start py-2");Ze(H,{type:"button",variant:"plain",get class(){return`w-full min-w-0 justify-start gap-2 px-2 type-caption font-normal text-left text-muted-foreground hover:bg-muted ${l(W)??""}`},onclick:P,children:(D,ae)=>{var ge=$O(),ue=ce(ge),pe=te(ue);nh(pe,{size:16,class:"text-ghost"}),Y(ue);var ke=R(ue,2),ye=te(ke),Z=re(ye,!0),$e=R(ye,2);{var lt=St=>{var De=DO(),Le=re(De,!0);L(Qe=>B(Le,Qe),[()=>_.lib_githubAuth_enables_description()]),k(St,De)};V($e,St=>{d()||St(lt)})}Y(ke),L(()=>{wt(ye,1,`type-caption font-normal ${d()?"truncate":"whitespace-normal"}`),B(Z,u())}),k(D,ge)},$$slots:{default:!0}})}Y(oe),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)};V(me,se=>{l(O)?se(ie):l($)?se(q,1):o()?se(j,2):l(Q)&&s()?se(ne,3):l(K)?se(we,4):se(be,-1)})}Y(de),L(()=>wt(de,1,`min-w-0 rounded-sm ${d()?"":"bg-sidebar"} ${h()??""}`)),k(n,de);var Se=Ot(X);return c(),Se}function BO(n){return n==="folder"||n==="new"?{label:_.workspace_plainFolder_initializeGit_label(),description:_.workspace_plainFolder_initializeGit_description()}:{label:_.workspace_plainFolder_switchGitRepo_label(),description:_.workspace_plainFolder_switchGitRepo_description()}}var zO=N('<div data-testid="initialize-git-toggle"><!> <div class="min-w-0"><label class="text-sm font-medium text-foreground"> </label> <p class="text-xs text-muted-foreground"> </p></div></div>');function I0(n,e){if(new.target)return Nt({component:I0,...n});Lt(e,!0);let t=y(e,"checked",7),r=y(e,"disabled",7,!1),s=y(e,"onCheckedChange",7),i=y(e,"folder",7),o=y(e,"class",7,"");const a=w(()=>BO(i())),c=w(()=>l(a).label),u=w(()=>l(a).description),d=`initialize-git-${crypto.randomUUID()}`;var f={get checked(){return t()},set checked(C){t(C),b()},get disabled(){return r()},set disabled(C=!1){r(C),b()},get onCheckedChange(){return s()},set onCheckedChange(C){s(C),b()},get folder(){return i()},set folder(C){i(C),b()},get class(){return o()},set class(C=""){o(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},h=zO(),p=te(h);{let C=w(()=>`${d}-switch`),M=w(()=>`${d}-label`),O=w(()=>`${d}-description`);Gm(p,{get id(){return l(C)},get checked(){return t()},get disabled(){return r()},size:"sm",class:"mt-0.5 shrink-0",get ariaLabelledby(){return l(M)},get ariaDescribedby(){return l(O)},onCheckedChange:P=>s()(P)})}var g=R(p,2),v=te(g),m=re(v,!0),S=R(v,2),I=re(S,!0);return Y(g),Y(h),L(()=>{wt(h,1,`flex min-w-0 items-start gap-2.5 ${o()??""}`),xt(v,"id",`${d}-label`),xt(v,"for",`${d}-switch`),B(m,l(c)),xt(S,"id",`${d}-description`),B(I,l(u))}),k(n,h),Ot(f)}function FO(n){return n.githubConnected||n.gitlabConnected||n.githubFailed||n.gitlabFailed?!0:!n.githubSettled||!n.gitlabSettled}function HO(n){return n.plainFoldersOffered?n.selected?n.selected:n.hasGitRepositoryEntry?"codebase":n.forgeState==="none"||n.hasPlainFolderEntry?"folder":"codebase":"codebase"}function UO(n){return n.githubConnected||n.gitlabConnected?"connected":n.githubFailed||!n.githubSettled||n.gitlabFailed||!n.gitlabSettled?"unknown":"none"}const VO=It.createSelector(n=>n.userPreferences?.labsPlainFolderWorkspacesEnabled===!0&&M1(n.daemonHealth?.stats?.protocolVersion)),g$=It.createSelector(n=>{const e=n.workspace?.workspaces?Kf(n.workspace.workspaces).filter(s=>s.id!==Cx):[],t=n.gitlabAuth?.statusFailed===!0,r=T1({rememberedChoice:null,workspacesLoaded:n.workspace?.hasLoaded===!0,hasGitWorkspace:E1(e),githubConnected:n.githubAuth?.isAuthenticated===!0,githubSettled:n.githubAuth?.statusSettled===!0,githubFailed:n.githubAuth?.statusFailed===!0,gitlabConnected:n.gitlabAuth?.isConfigured===!0,gitlabSettled:n.gitlabAuth?.statusReady===!0||t,gitlabFailed:t});return r===null?"pending":r?"on":"off"}),WO=It.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return FO({githubConnected:n.githubAuth?.isAuthenticated===!0,githubSettled:n.githubAuth?.statusSettled===!0,githubFailed:n.githubAuth?.statusFailed===!0,gitlabConnected:n.gitlabAuth?.isConfigured===!0,gitlabSettled:n.gitlabAuth?.statusReady===!0||e,gitlabFailed:e})}),KO=It.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return UO({githubConnected:n.githubAuth?.isAuthenticated===!0,githubSettled:n.githubAuth?.statusSettled===!0,githubFailed:n.githubAuth?.statusFailed===!0,gitlabConnected:n.gitlabAuth?.isConfigured===!0,gitlabSettled:n.gitlabAuth?.statusReady===!0||e,gitlabFailed:e})}),jO=It.createSelector(n=>n.githubRepos.repos),GO=It.createSelector(n=>Kf(jO.select(n))),qO=It.createSelector(n=>n.githubRepos.loading),JO=It.createSelector(n=>n.githubRepos.error),XO=It.createSelector(n=>n.githubRepos.loaded),QO=It.createSelector(n=>n.githubRepoSearch.results),YO=It.createSelector(n=>Kf(QO.select(n))),ZO=It.createSelector(n=>n.githubRepoSearch.loading),eN=It.createSelector(n=>n.githubRepoSearch.lastQuery);var tN=N('<div data-recent-repo-row=""><!> <!> <!></div>'),nN=N(" <!>",1),Sc=N("<!> <!>",1),rN=N('<span class="text-sm pl-3 shrink-0 select-none"> </span>'),wm=N("<span> </span>"),xm=N('<span class="text-sm text-subtle ml-1"> </span>'),km=N("<span> </span> <!>",1),sN=N('<span class="min-w-0 flex-1 text-left truncate"><!> <!></span>'),iN=N("<div><!> <!> <!> <!> <!></div>"),oN=N('<div class="flex min-h-10 items-center gap-2 px-3 py-2"><div class="w-4 h-4 bg-muted rounded animate-pulse"></div> <div class="h-4 bg-muted rounded flex-1 animate-pulse"></div></div>'),aN=N('<div role="status"></div>'),lN=N('<p class="type-body px-3 py-2 text-muted-foreground" role="status"> </p>'),cN=N("<!> <span> </span>",1),uN=N('<div class="shrink-0 px-2 pt-1"><!></div> <div class="min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1" data-testid="recent-repositories" role="group"><!></div> <div class="shrink-0 border-t border-border p-2"><!></div>',1),dN=N('<div class="flex shrink-0 items-center gap-1 px-2 pt-2 pb-2"><!> <h2> </h2></div>'),fN=N('<div class="shrink-0 px-4 pt-2 pb-3"><h2 class="text-base font-semibold text-foreground"> </h2> <p class="text-sm text-subtle mt-1"> </p></div>'),hN=N('<div class="flex items-center justify-between gap-2 mt-2 px-1"><span class="text-sm text-subtle truncate flex-1"> </span> <!></div>'),pN=N('<!> <!> <div class="flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring"><!> <!></div> <!> <!>',1),gN=N('<span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <span><div class="truncate"> </div> <!></span>',1),mN=N('<div class="mt-2 px-1"><span class="text-sm text-danger"> </span></div>'),vN=N('<div class="flex items-center gap-2 text-sm text-subtle"><!> <span> </span></div>'),Cc=N('<div class="flex items-center justify-between gap-2"><span class="text-sm text-subtle"> </span> <!></div>'),bN=N('<div class="flex items-center justify-between gap-2"><span class="text-sm text-warning-ink"> </span> <!></div>'),yN=N('<div class="mt-2 px-1"><div class="text-sm text-subtle truncate mb-2"> </div> <!></div>'),wN=N('<!> <div class="flex items-center gap-3"><span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <!></div> <!>',1),xN=N('<div role="button" tabindex="0" class="w-full flex items-center gap-2 px-3 py-2 rounded-lg bg-sidebar text-left cursor-pointer hover:bg-muted/50 transition-colors"><!> <div class="flex-1 min-w-0"><div class="text-sm"> </div> <div class="text-xs text-subtle"> </div></div> <!></div>'),kN=N('<div class="text-sm text-subtle px-3 py-2"> </div>'),_N=N("<!> ",1),SN=N('<div class="space-y-1"><!> <!> <!></div>'),CN=N('<div class="mx-3 mb-3 p-3 bg-sidebar rounded-lg"><div class="flex items-start gap-3"><!> <div class="flex-1 min-w-0"><div class="text-sm font-medium truncate mb-1"> </div> <div class="text-sm text-subtle mb-2"> </div> <div class="flex gap-2"><!> <!></div></div></div></div>'),MN=N('<div class="flex items-center gap-2 py-1.5"><div class="w-4 h-4 bg-muted rounded animate-pulse"></div> <div class="h-4 bg-muted rounded flex-1 animate-pulse"></div></div>'),TN=N('<div class="space-y-1"></div>'),EN=N('<div class="-mx-2" data-testid="recent-repositories"><!></div>'),AN=N('<div class="min-h-16 overflow-y-auto flex-1 px-4 pb-3 pt-2"><!> <!></div>'),RN=N('<div class="shrink-0 px-3 mb-3"><!> <!></div> <!> <!>',1),PN=N("<!> <!> <!>",1),IN=N('<div class="relative min-w-0"><!></div> <!> <!>',1);function js(n,e){const t=Vi();if(new.target)return Nt({component:js,...n});Lt(e,!0);const r=()=>rn(K,"$hostMember$",G),s=()=>rn(Q,"$canAdministerHost$",G),i=()=>rn(pe,"$isGithubAuthenticated$",G),o=()=>rn(D,"$recentRepoRefresh$",G),a=()=>rn($,"$admission$",G),c=()=>rn(se,"$workspaceInitializerRecentRepos$",G),u=()=>rn(be,"$dismissedRecentRepoKeys$",G),d=()=>rn(ca,"$cloneSourceVisible$",G),f=()=>rn(oe,"$workspaceInitializerRemoteSetups$",G),h=()=>rn(Se,"$defaultParentPath$",G),p=()=>rn(ae,"$directoryStatusCheck$",G),g=()=>rn(Ao,"$plainFolderCreationAvailable$",G),v=()=>rn(ki,"$forgeConnectionState$",G),m=()=>rn(ye,"$githubRepos$",G),S=()=>rn(Le,"$githubSearchLastQuery$",G),I=()=>rn(St,"$githubSearchResults$",G),C=()=>rn($e,"$githubReposLoaded$",G),M=()=>rn(Z,"$githubReposLoading$",G),O=()=>rn(lt,"$githubReposError$",G),P=()=>rn(we,"$initializerHydrated$",G),E=()=>rn(Fe,"$remoteWorkspacesEnabled$",G),z=()=>rn(De,"$githubSearchLoading$",G),[G,J]=Jl(),K=Nf(),Q=vw(),$=bw(),X=Ga("RepoSelector"),de=Xf(),me=new Yf;let ie=fe(null),q=fe(!1);const j=_.workspace_isolationMode_worktree_label(),ne=It.dispatch,we=A1(),be=R1(),Se=P1(),se=I1(),oe=L1(),H=crypto.randomUUID(),W=crypto.randomUUID(),D=O1(H),ae=N1(W);let ge,ue;const pe=ev(),ke=w(()=>r()||s()&&i()),ye=GO(),Z=qO(),$e=XO(),lt=JO(),St=YO(),De=ZO(),Le=eN();function Qe(T,F){const Ce=T.includes("\\")?"\\":"/";return`${T.replace(/[/\\]$/,"")}${Ce}${F}`}let Ct=y(e,"variant",7,"ghost"),bt=y(e,"value",7,""),sn=y(e,"onchange",7),Be=y(e,"triggerClass",7),he=y(e,"rowLabel",7),Ne=y(e,"displayValue",7),je=y(e,"triggerSuffix",7),Tt=y(e,"triggerValueClass",7,"text-subtle"),ee=y(e,"triggerContentClass",7,"gap-0.75"),Ge=y(e,"emptyLabel",7),it=y(e,"showEmptyIcon",7,!1),Xe=y(e,"showTriggerChevron",7,!1),mt=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),Mt=y(e,"triggerIcon",7),Ue=y(e,"triggerAriaLabel",7),Ke=y(e,"onClear",7),Me=y(e,"gitlab",7),Xt=y(e,"gitlabSelected",7,!1),tn=y(e,"plainFolderMode",7,!1),es=y(e,"plainFolderSelected",7,!1),le=y(e,"gitChoice",7);function ot(T){yn++,sn()&&sn()(new CustomEvent("change",{detail:T}))}function At(){l(qe)&&l(qe).focus()}function Zt(T="local"){l(Ve)&&!bt()&&(x(Ve,""),x(ht,""),x(at,"local"),x(Lr,"")),We=T,he()&&x(Pn,"add"),x(Re,!0)}let Ve=fe(Ar(bt())),ht=fe(Ar(bt())),Et=fe(""),qe=fe(void 0),yt=fe(null),Re=fe(!1),We=null,Pt=fe(!1);const Ye=w(()=>!o()||o().admission===a()&&o().status==="pending");let ze=fe(!1),pt=fe(!1),at=fe(Ar(nn(bt()))),Bt=fe(""),rt=fe(null);const Qt=w(()=>{const T=c(),F=o();return!F||F.admission!==a()||It.dispatch!==ne?T:B1({saved:T,source:F,dismissed:u(),mode:he()?"all":"recent"})});async function Vn(T,F){T.preventDefault(),T.stopPropagation();const Ce=T.currentTarget,Ft=Ce.closest("[data-recent-repo-row]"),vn=Ft?.nextElementSibling??Ft?.previousElementSibling,Ys=Ce.closest('[role="dialog"]'),Xi=vn?.querySelector("[data-remove-recent-repo]")??Ys?.querySelector('[role="tab"][aria-selected="true"]')??Ys?.querySelector("[data-repo-search]");It.dispatch(Lx({path:F.path,type:F.type})),await qo(),Xi?.focus()}let Yn=fe(null),Gr=fe(null),hs=null,zt=fe("github"),ps=fe("github");const bn=w(()=>[...i()?[{id:"github",label:"github.com/",icon:Df}]:[],...Me()?.authenticated&&Me().instanceBaseUrl?[{id:"gitlab",label:`${Me().instanceBaseUrl.replace(/^https:\/\//,"").replace(/\/$/,"")}/`,icon:$f}]:[]]),$s=w(()=>l(bn).find(T=>T.id===l(ps))??l(bn)[0]),ji=w(()=>l($s)?.id??"github"),Qs=w(()=>l(zt)==="github"||l(zt)==="gitlab"),To=w(()=>l($s)?.label??_.workspace_repoSelector_clone_tab()),ca=WO(),A=w(()=>d()||l(bn).length>0||r());function ve(T){return!l(A)&&(T==="github"||T==="gitlab")?"local":T}function Ee(){x(Re,!1),gk({tab:"connections",hash:"integrations"}).catch(T=>X.error("Failed to open connection settings",T))}function gt(T){l(bn).some(F=>F.id===T)&&(x(ps,T,!0),x(zt,T,!0))}ft(()=>{if(!(!l(Re)||l(zt)!=="gitlab"))return ii(()=>{const T=Me();if(T)return T.onOpenChange?.(!0,T.scopeKey),()=>ii(()=>{const F=Me()??T;F.onOpenChange?.(!1,F.scopeKey)})})}),ft(()=>{l(Re)&&l(zt)==="gitlab"&&!Me()&&x(Re,!1)}),ft(()=>{l(Qs)&&x(zt,ve(l(ji)),!0)});let Ie=fe(!1),xe=fe("select-repo"),on=fe(Ar(_.workspace_repoSelector_selectFolder_title())),gn=fe(void 0);const Fe=O_("remote-workspaces");let Gt=fe(Ar(f())),_n=fe(!1);ft(()=>{x(Gt,f(),!0)});function Sn(T=l(Gt)){It.dispatch(Ox(pk(T)))}function gs(T){x(Ve,T.name,!0),x(ht,""),x(at,"local"),x(ze,!1),x(pt,!0);const F={path:T.workspacePath||T.name,type:"remote",remoteSetup:T,isNewRepo:!1,isValidPath:!0};ot(F),x(Re,!1)}function Bs(T){const F=l(Gt).filter(Ce=>Ce.id!==T);x(Gt,F,!0),Sn(F)}function di(){x(_n,!0)}function Eo(T){const F=[...l(Gt),T];x(Gt,F,!0),Sn(F),x(_n,!1)}let xi=fe(!1),ir=fe(""),ts=fe("new-project"),fi=fe(""),Lr=fe("");function qu(){return od(h(),tn())}ft(()=>{const T=tn(),F=h();ii(()=>{l(ir)===od(F,!T)&&x(ir,od(F,T),!0)})});function nc(T){It.dispatch(Px(T))}function U(T){if(!T||T.trim().length===0)return;const F=T.trim();if(F.includes("/")||F.includes("\\"))return _.workspace_repoSelector_nameSeparators_error();if(F===".."||F==="."||/^\.+$/.test(F))return _.workspace_repoSelector_nameDots_error();if(F.includes("\0"))return _.workspace_repoSelector_nameNull_error();if(/[<>:"|?*]/.test(F))return _.workspace_repoSelector_nameInvalid_error();if(F.length>255)return _.workspace_repoSelector_nameTooLong_error()}const Pe=w(()=>U(l(ts))),Oe=w(()=>l(ir)&&l(ts)&&!l(Pe)?Qe(l(ir),l(ts)):""),dt=w(()=>p()?.admission===a()&&p().path===l(Oe)&&p().status==="ready"?p().result:null);let Ut=fe(null);const en=w(()=>p()?.admission===a()&&p().path===l(Oe)&&(p().status==="failed"||p().status==="unsupported")),Cn=w(()=>tn()?l(en)?"existing":F1(l(dt),l(Ut)?.parent===l(ir)?l(Ut).inRepo:null):null);ft(()=>{const T=l(ir);if(!tn()||!T||l(Ut)?.parent===T)return;let F=!1;return cd("file:getDirectoryStatus",{path:T}).then(Ce=>!!(Ce?.success&&(Ce.data?.isGitRepo||Ce.data?.isSubdirectoryOfGitRepo))).catch(()=>!1).then(Ce=>{F||x(Ut,{parent:T,inRepo:Ce},!0)}),()=>{F=!0}});const ln=w(()=>p()?.admission===a()&&p().path===l(Oe)&&p().status==="pending");let Ae=fe(!1),st=fe(""),yn=0;const mn=w(()=>()=>{const T=l(Qt).filter(Ce=>l(zt)==="local"?Ce.type==="local":l(Qs)&&Ce.type==="github"),F=l(zt)==="gitlab"?Me()?.query??"":l(Et);return F===""?T:T.filter(Ce=>vp(Ce,F))});let Pn=fe("browse"),ms=fe(""),vs=fe(null),hi=fe(void 0);const bs=w(()=>{if(l(Qt).some(_i))return l(Qt);let T;if(Xt()&&Me()?.instanceBaseUrl&&Me().selectedProjectPath){const F=Me().selectedProjectPath,Ce=`${Me().instanceBaseUrl}/${F}`;T={path:Ce,type:"github",githubUrl:Ce,name:F.split("/").at(-1),owner:F.split("/").slice(0,-1).join("/"),repositoryIdentity:{provider:"gitlab",instanceBaseUrl:Me().instanceBaseUrl,projectPath:F}}}else if(!Xt()&&l(Ve)){const F=l(at)==="github"?Wt(l(Lr)||l(Ve)):null;T=F?{path:`${F.owner}/${F.repo}`,type:"github",githubUrl:`https://github.com/${F.owner}/${F.repo}`,name:F.repo,owner:F.owner}:{path:l(Ve),type:"local",name:D1(l(Ve)),...es()?{plainFolder:!0}:{}}}return T?[T,...l(Qt)]:l(Qt)}),Ao=VO(),ki=KO(),Gi=T=>T.type==="local"&&T.plainFolder===!0,or=w(()=>{const T=l(bs).find(_i);return T?es()||Gi(T)?"folder":"codebase":null}),zs=w(()=>he()?HO({plainFoldersOffered:g(),forgeState:l(bn).length>0||r()?"connected":v(),hasGitRepositoryEntry:l(bs).some(F=>!Gi(F)),hasPlainFolderEntry:l(bs).some(Gi),selected:l(or)})==="folder"?_.workspace_compactInitializer_folder_label():he():void 0),pi=w(()=>g()?_.workspace_repoSelector_searchWithFolders_placeholder():_.workspace_repoSelector_search_placeholder()),ys=w(()=>g()?_.workspace_repoSelector_addRepositoryOrFolder_label():_.workspace_repoSelector_addRepository_label()),qi=w(()=>Ge()??(he()?l(ys):_.workspace_repoSelector_selectRepository_label())),Fs=w(()=>l(ms).trim()===""?l(bs):l(bs).filter(T=>vp(T,l(ms).trim())));function Ji(T){const F=sl(T,Me()?.instanceBaseUrl);return T.type!=="local"&&F?.provider==="gitlab"&&(!Me()?.authenticated||F.instanceBaseUrl!==Me().instanceBaseUrl||!Me().scopeKey&&!Me().onSelectRecent||Me().page.status==="unavailable")}function _i(T){const F=sl(T,Me()?.instanceBaseUrl);return T.type!=="local"&&F?.provider==="gitlab"?Xt()&&Me()?.instanceBaseUrl===F.instanceBaseUrl&&Me().selectedProjectPath===F.projectPath:Xt()||!l(Ve)?!1:T.type==="github"?l(at)==="github"&&dn(T.githubUrl||T.path,l(Lr)||l(Ve)):l(at)!=="github"&&T.path===l(Ve)}function ua(){return[...l(hi)?.querySelectorAll("[data-recent-repo-row]")??[]].map(T=>T.querySelector("button:not([data-remove-recent-repo])")).filter(T=>!!T&&!T.disabled)}function Ja(T){if(!T.isComposing){if(T.key==="ArrowDown"){const F=ua()[0];if(!F)return;T.preventDefault(),F.focus()}else if(T.key==="Enter"){T.preventDefault(),T.stopPropagation();const F=l(Fs).find(Ce=>!Ji(Ce));F&&rc(F)}}}function Xa(T){if(T.key!=="ArrowDown"&&T.key!=="ArrowUp")return;const F=ua(),Ce=F.indexOf(document.activeElement);if(!(Ce<0))if(T.preventDefault(),T.key==="ArrowUp"&&Ce===0)l(vs)?.focus();else{const Ft=T.key==="ArrowDown"?1:-1;F[Math.min(F.length-1,Ce+Ft)]?.focus()}}function Qa(){const T=l(ms).trim();if(T&&l(A)){const F=Wt(Mn(T));F?(x(ps,"github"),x(zt,"github"),Kn(`${F.owner}/${F.repo}`)):l(zt)==="github"&&Kn(T)}x(Pn,"add"),qo().then(()=>{l(zt)==="github"&&l(yt)?.focus()})}function ar(){x(Pn,"browse"),qo().then(()=>l(vs)?.focus())}function kr(T){const F=T==="repository"?l(ji):T;he()&&F==="local"&&Wt(l(ht))&&qr(""),x(zt,F,!0)}const lr=w(()=>l(fi).trim()),Es=w(()=>{const T=m();if(!T.length)return[];const F=l(lr).toLowerCase();return F?T.filter(Ce=>`${Ce.owner}/${Ce.name}`.toLowerCase().includes(F)):T}),ns=w(()=>{if(S()!==l(lr))return[];const T=I();if(!T.length)return[];const F=new Set(m().map(Ce=>Ce.id));return T.filter(Ce=>!F.has(Ce.id))}),Fn=w(()=>l(zt)==="github"&&l(ke)?[...l(Es),...l(ns)]:[]),_r=w(()=>{const T=l(Yn);if(!T)return!1;const F=T.owner.toLowerCase(),Ce=T.repo.toLowerCase();return l(Fn).some(Ft=>Ft.owner.toLowerCase()===F&&Ft.name.toLowerCase()===Ce)});let tt=fe(-1);ft(()=>{l(Fn),x(tt,-1)}),ft(()=>{l(zt)==="github"&&l(ke)&&!C()&&!M()&&!O()&&It.dispatch(kp())});function Kt(){It.dispatch(kp())}function un(T){x(fi,`${T.owner}/${T.name}`),x(Yn,{owner:T.owner,repo:T.name,url:`https://github.com/${T.owner}/${T.name}`},!0),Xu()}function Zn(T){if(!T.isComposing){if(T.key==="Enter"){T.preventDefault(),T.stopPropagation(),As();return}if(T.key==="ArrowDown"){if(!l(Fn).length)return;T.preventDefault(),x(tt,Math.min(l(tt)+1,l(Fn).length-1),!0);return}if(T.key==="ArrowUp"){if(!l(Fn).length)return;T.preventDefault(),x(tt,Math.max(l(tt)-1,-1),!0)}}}function As(){const T=l(tt)>=0?l(Fn)[l(tt)]:void 0;T?un(T):Xu()}let Rs=fe(-1);ft(()=>{l(mn)(),x(Rs,-1)});function nn(T){return T&&Wt(T)?"github":"local"}function dn(T,F){const Ce=Wt(T),Ft=Wt(F);return!!Ce&&!!Ft&&Ce.owner.toLowerCase()===Ft.owner.toLowerCase()&&Ce.repo.toLowerCase()===Ft.repo.toLowerCase()}ft(()=>{bt()&&bt()!==l(Ve)&&(x(Ve,bt()),x(ht,bt()),x(at,nn(bt()),!0),l(Lr)&&!dn(l(Lr),bt())&&x(Lr,""))});function Wn(){if(x(q,!Ym(l(ie),360)),x(Et,""),he()&&l(Pn)==="browse")x(ms,""),requestAnimationFrame(()=>{l(Re)&&l(Pn)==="browse"&&l(vs)?.focus()});else if(he()){We&&(x(zt,We,!0),We=null);return}const T=l(Ve)||bt();if(X.info("Dropdown opened",{currentValue:T,selectedRepoType:l(at)}),We)x(zt,We,!0),We=null;else if(Xt()&&l(bn).some(F=>F.id==="gitlab"))x(ps,"gitlab"),x(zt,"gitlab");else if(T){if(x(zt,ve(l(at)==="github"?l(ji):l(at)),!0),l(at)==="github"&&l(A)&&l(ht)){const F=Wt(l(ht));F&&(x(fi,`${F.owner}/${F.repo}`),qr(`https://github.com/${F.owner}/${F.repo}`,""))}}else x(zt,ve(l(ji)),!0);requestAnimationFrame(()=>{he()||l(Re)&&l(zt)!=="gitlab"&&l(qe)&&(l(qe).focus(),l(qe).select())})}let Or=!1;ft(()=>{const T=l(Re);T&&!Or?Wn():!T&&Or&&he()&&!l(Pt)&&!l(Ie)&&x(Pn,"browse"),Or=T}),ft(()=>{if(l(Re))return ja(T=>{T.isComposing||x(Re,!1)})}),ft(()=>{l(zt)==="new"&&!l(ir)&&x(ir,qu(),!0)}),ft(()=>{const T=l(Oe),F=a();!T||!l(ir)||!l(ts)||!F||(ue=crypto.randomUUID(),It.dispatch(Mx(W,ue,F,T)))}),ft(()=>{s()&&It.dispatch(Kd())}),ft(()=>{const T=a(),F=Me()?.instanceBaseUrl;P(),!(!T||It.dispatch!==ne)&&(ge=crypto.randomUUID(),It.dispatch(Tx(H,ge,T,F)))}),ql(()=>{ge&&ne(Ex(H,ge)),ue&&ne(Ax(W,ue))});function Wt(T){const F=T.trim();if(!F)return null;if(F.startsWith("git@github.com:")){const Ft=F.slice(15).replace(/\.git$/,"").split("/");return Ft.length>=2&&Ft[0]&&Ft[1]?{owner:Ft[0],repo:Ft[1]}:null}try{const Ce=new URL(F);if(Ce.hostname!=="github.com"&&Ce.hostname!=="www.github.com"||Ce.protocol!=="http:"&&Ce.protocol!=="https:")return null;const Ft=Ce.pathname.split("/").filter(Boolean);if(Ft.length<2)return null;const vn=Ft[0],Ys=Ft[1].replace(/\.git$/,"");if(vn&&Ys)return{owner:vn,repo:Ys}}catch{}if(!F.includes("\\")&&!F.includes(":")&&!F.startsWith(".")&&!F.startsWith("/")){const Ce=F.split("/");if(Ce.length===2&&Ce[0]&&Ce[1]){const Ft=vn=>/^[a-zA-Z0-9]([a-zA-Z0-9\-_\.]*[a-zA-Z0-9])?$/.test(vn)||/^[a-zA-Z0-9]$/.test(vn);if(Ft(Ce[0])&&Ft(Ce[1]))return{owner:Ce[0],repo:Ce[1]}}}return null}function Mn(T){const F=T.trim();if(!F)return"";const Ce=Wt(F);if(Ce)return`${Ce.owner}/${Ce.repo}`;if(F.toLowerCase().startsWith("github.com/")){const Ft=F.slice(11),vn=Ft.split("/").filter(Boolean);return vn.length>=2?`${vn[0]}/${vn[1].replace(/\.git$/,"")}`:Ft.replace(/\/$/,"")}if(F.toLowerCase().startsWith("www.github.com/")){const Ft=F.slice(15),vn=Ft.split("/").filter(Boolean);return vn.length>=2?`${vn[0]}/${vn[1].replace(/\.git$/,"")}`:Ft.replace(/\/$/,"")}return F.replace(/\/$/,"").replace(/\.git$/,"")}function Kn(T){let F=T;F.toLowerCase().startsWith("https://github.com/")?F=F.slice(19):F.toLowerCase().startsWith("http://github.com/")?F=F.slice(18):F.toLowerCase().startsWith("github.com/")&&(F=F.slice(11)),x(fi,F,!0),F?qr(`https://github.com/${F}`,F):qr(""),Sr(F)}function Sr(T){l(ke)&&It.dispatch(Rx(T.trim()))}function Hs(T){const F=T.clipboardData?.getData("text")||"";if(F){T.preventDefault();const Ce=Mn(F);x(fi,Ce,!0),Ce&&qr(`https://github.com/${Ce}`,Ce),Sr(Ce)}}async function rs(T){try{const F=await cd("file:getDirectoryStatus",{path:T});F.success&&F.data&&(x(rt,F.data,!0),x(ze,!F.data.exists&&!F.data.isSubdirectoryOfGitRepo,!0),F.data.exists&&!F.data.isDirectory&&x(pt,!1))}catch(F){X.warn("Failed to check directory status",F)}}function qr(T,F=T){x(ht,T,!0),x(Et,F,!0),hs&&clearTimeout(hs),x(Yn,null),x(Gr,null),x(Bt,""),hs=setTimeout(()=>{Ju(T)},300)}function Nr(T){return T.startsWith("https://github.com")||T.startsWith("http://github.com")||T.startsWith("github.com")||T.startsWith("github:")||T.startsWith("git@github.com")}async function Ju(T){if(!T||T.trim()===""){x(Yn,null),x(Gr,null);return}if(T.startsWith("/")||T.startsWith("~")||T.includes(":\\")||T.startsWith("./")||T.startsWith("../")){x(Yn,null),x(Gr,T,!0),await rs(T);return}if(Nr(T)){const F=Wt(T);if(F){const Ce=`https://github.com/${F.owner}/${F.repo}`;x(Gr,null),x(Yn,{owner:F.owner,repo:F.repo,url:Ce},!0);return}}x(Yn,null),x(Gr,null)}function rc(T){if(yn++,he()&&_i(T)){x(Re,!1);return}const F=sl(T,Me()?.instanceBaseUrl);if(T.type!=="local"&&F?.provider==="gitlab"){if(!Me()?.authenticated||F.instanceBaseUrl!==Me().instanceBaseUrl||!Me().scopeKey&&!Me().onSelectRecent||Me().page.status==="unavailable")return;Me().onSelectRecent?Me().onSelectRecent(F.projectPath,F.instanceBaseUrl):Me().onSelect(F.projectPath,Me().scopeKey),x(Re,!1);return}if(T.type==="local"&&(tn()||T.plainFolder===!0)){O0(T);return}Jh(T)}async function Ya(T){try{const F=await cd("file:getDirectoryStatus",{path:T});return F?.success&&F.data?F.data:null}catch(F){return X.warn("Failed to check directory status",F),null}}async function O0(T){const F=yn,Ce=await Ya(T.path);if(F!==yn)return;const Ft=!!Ce&&(Ce.isGitRepo||!!Ce.isSubdirectoryOfGitRepo);if(Ce?Ce.exists&&Ce.isDirectory&&!Ft:T.plainFolder===!0||tn()){if(tn()){Za(T.path,"existing");return}x(st,T.path,!0),x(Ae,!0);return}if(tn()&&Ce&&!Ce.exists&&!Ft){Za(T.path,"new");return}Jh(T,Ce?.isSubdirectoryOfGitRepo?Ce.relativePathFromGitRoot:"")}function Jh(T,F=""){const Ce=T.type==="github"&&T.githubUrl?Wt(T.githubUrl):null,Ft=Ce?`${Ce.owner}/${Ce.repo}`:T.path;x(Ve,Ft,!0),x(ht,T.type==="github"?T.githubUrl:T.path,!0),x(at,T.type,!0),x(Lr,T.type==="github"&&T.githubUrl||"",!0),x(ze,!1),x(pt,!0),x(Bt,""),x(rt,null);const vn={path:Ft,type:T.type,isNewRepo:!1,isValidPath:!0};F&&(vn.scope=F),T.type==="github"&&T.githubUrl&&(vn.githubUrl=T.githubUrl),ot(vn),x(Re,!1)}function Xh(T,F,Ce){x(xe,T,!0),x(on,F,!0),x(gn,Ce,!0),Yx({title:F,defaultPath:Ce,openModal:()=>x(Ie,!0),onSelect:Qh})}function N0(){Xh("select-repo",_.workspace_repoSelector_selectRepoFolder_title(),typeof l(Ve)=="string"?l(Ve):void 0)}async function D0(T){yn++;try{if(await rs(T),l(rt)?.exists&&!l(rt)?.isGitRepo&&!l(rt)?.isSubdirectoryOfGitRepo){if(tn()){Za(T,"existing");return}x(st,T,!0),x(Ae,!0);return}x(Ve,T,!0),x(ht,T,!0),x(Lr,""),x(at,"local"),x(pt,!0),x(Bt,"");const F={path:T,type:"local",isNewRepo:l(ze),isValidPath:!0,scope:l(rt)?.relativePathFromGitRoot};ot(F),x(Re,!1)}catch(F){X.error("Failed to select folder",F)}}function $0(){x(Pt,!0),Xh("new-repo-parent",_.workspace_repoSelector_selectNewRepoParent_title(),l(ir)||void 0)}function da(){if(!l(ir)||!l(ts)||l(Pe))return;const T=Qe(l(ir),l(ts));x(Ve,T,!0),x(ht,T,!0),x(Lr,""),x(pt,!0),x(Bt,""),x(rt,null),x(at,"new");const F=l(dt)?.exists&&l(dt)?.isGitRepo,Ce=l(Cn);if(Ce){Za(T,Ce),x(xi,!1);return}x(ze,!F),ot({path:T,type:"local",isNewRepo:!F,isValidPath:!0}),nc(l(ir)),x(xi,!1),x(Re,!1)}async function Qh(T){x(Ie,!1);const F=l(xe);if(F==="select-repo"){await D0(T);return}F==="new-repo-parent"&&(x(ir,T,!0),nc(l(ir))),x(Pt,!1),x(Re,!0)}function B0(){x(Ie,!1),l(xe)!=="select-repo"&&(x(Pt,!1),x(Re,!0))}function Xu(){const T=Wt(l(fi));if(!T)return;const F={owner:T.owner,repo:T.repo,url:`https://github.com/${T.owner}/${T.repo}`},Ce=`${F.owner}/${F.repo}`,Ft={path:Ce,type:"github",githubUrl:F.url,isNewRepo:!1,isValidPath:!0};x(Ve,Ce),x(ht,F.url,!0),x(Lr,F.url,!0),x(at,"github"),x(pt,!0),x(Bt,""),ot(Ft),x(Re,!1)}function z0(){if(!l(st))return;x(Ve,l(st),!0),x(ht,l(st),!0),x(Lr,""),x(at,"local"),x(ze,!0),x(pt,!0),x(Bt,"");const T={path:l(st),type:"local",isNewRepo:!0,isValidPath:!0};ot(T),x(Ae,!1),x(st,""),x(Re,!1)}function Za(T,F){x(Ve,T,!0),x(ht,T,!0),x(Lr,""),x(at,F==="new"?"new":"local",!0),x(ze,!1),x(pt,!0),x(Bt,""),x(rt,null),ot({path:T,type:"local",isNewRepo:!1,isValidPath:!0,plainFolder:F}),x(Ae,!1),x(st,""),x(Re,!1)}function F0(T,F){const Ce=F==="local"&&l(Ae)?l(st):"";le()?.onCheckedChange(T,F),Ce&&!T&&Za(Ce,"existing")}function H0(){x(Ae,!1),x(st,""),x(Gr,null),x(rt,null),x(ht,""),x(Et,"")}function U0(){if(!l(Ve))return _.workspace_repoSelector_selectRepository_label();if(l(at)==="github"&&l(Lr)){const F=Wt(l(Lr));if(F)return`${F.owner}/${F.repo}`}if(l(Ve).match(/^[^\/]+\/[^\/]+$/)&&!l(Ve).includes("\\")&&!l(Ve).startsWith("/"))return l(Ve);const T=l(Ve).split(/[\/\\]/);return T[T.length-1]||l(Ve)}const Qu=w(()=>Xt()?Ne()??Me()?.selectedProjectPath??"":Ne()??U0()),sc=w(()=>Xt()?!!l(Qu):!!l(Ve)),Yu=`${t}-github-suggestions`,Yh=w(()=>Xt()&&Me()?.authenticated&&Me().scopeKey&&Me().page.status!=="unavailable"&&Me().selectedProject?.projectPath===Me().selectedProjectPath?Me().selectedProject:void 0),Zh=w(()=>Xt()?null:$1({selectedValue:l(Ve),selectedRepoType:l(at),confirmedGithubUrl:l(Lr)},Wt)),Zu=w(()=>l(bs).find(_i)),ed=w(()=>l(Zu)?sl(l(Zu),Me()?.instanceBaseUrl):null);function ep(T){if(!(T?.provider!=="gitlab"||!Me()?.authenticated||!Me().scopeKey||T.instanceBaseUrl!==Me().instanceBaseUrl||Me().page.status!=="ready"))return(Me().page.items.find(F=>F.projectPath===T.projectPath)??(Me().selectedProject?.projectPath===T.projectPath?Me().selectedProject:void 0))?.ownerAvatarUrl}var V0={focusInput:At,openOnLocalTab:Zt,get variant(){return Ct()},set variant(T="ghost"){Ct(T),b()},get value(){return bt()},set value(T=""){bt(T),b()},get onchange(){return sn()},set onchange(T){sn(T),b()},get triggerClass(){return Be()},set triggerClass(T){Be(T),b()},get rowLabel(){return he()},set rowLabel(T){he(T),b()},get displayValue(){return Ne()},set displayValue(T){Ne(T),b()},get triggerSuffix(){return je()},set triggerSuffix(T){je(T),b()},get triggerValueClass(){return Tt()},set triggerValueClass(T="text-subtle"){Tt(T),b()},get triggerContentClass(){return ee()},set triggerContentClass(T="gap-0.75"){ee(T),b()},get emptyLabel(){return Ge()},set emptyLabel(T){Ge(T),b()},get showEmptyIcon(){return it()},set showEmptyIcon(T=!1){it(T),b()},get showTriggerChevron(){return Xe()},set showTriggerChevron(T=!1){Xe(T),b()},get triggerChevronClass(){return mt()},set triggerChevronClass(T="ml-2 opacity-50"){mt(T),b()},get triggerIcon(){return Mt()},set triggerIcon(T){Mt(T),b()},get triggerAriaLabel(){return Ue()},set triggerAriaLabel(T){Ue(T),b()},get onClear(){return Ke()},set onClear(T){Ke(T),b()},get gitlab(){return Me()},set gitlab(T){Me(T),b()},get gitlabSelected(){return Xt()},set gitlabSelected(T=!1){Xt(T),b()},get plainFolderMode(){return tn()},set plainFolderMode(T=!1){tn(T),b()},get plainFolderSelected(){return es()},set plainFolderSelected(T=!1){es(T),b()},get gitChoice(){return le()},set gitChoice(T){le(T),b()},$set:Dt,$on:(T,F)=>$t(e,T,F)},tp=IN(),td=ce(tp);{const T=(Ce,Ft=ls,vn=ls)=>{var Ys=Je(),Xi=ce(Ys);Cs(Xi,19,Ft,Ps=>Ix(Ps),(Ps,cr,gi)=>{var Us=tN();{const gr=fn=>{{let er=w(()=>l(ur)&&l(cr).type!=="local"?l(ur).projectPath.split("/").at(-1):l(ss).primary),Dr=w(()=>l(ur)?.provider),is=w(()=>l(cr).type==="local"),$n=w(()=>l(cr).type!=="local"),Ti=w(()=>vn()(l(cr),l(gi))),$r=w(()=>!!he()),Br=w(()=>l(cr).type!=="local"&&l(ur)?.provider==="gitlab"&&(!Me()?.authenticated||l(ur).instanceBaseUrl!==Me().instanceBaseUrl||!Me().scopeKey&&!Me().onSelectRecent||Me().page.status==="unavailable"));jh(fn,{get owner(){return l(Ci)},get name(){return l(er)},get suffix(){return l(ss).suffix},get provider(){return l(Dr)},get avatarUrl(){return l(ei)},get local(){return l(is)},get showOwner(){return l($n)},showForge:!0,recent:!0,get selected(){return l(Ti)},get formStyle(){return l($r)},class:"flex-1",onclick:()=>rc(l(cr)),get disabled(){return l(Br)}})}},ss=w(()=>H1(l(cr))),ur=w(()=>sl(l(cr),Me()?.instanceBaseUrl)),Ci=w(()=>l(ur)?l(ur).projectPath.split("/").slice(0,-1).join("/"):l(ss).ownerPrefix),Mi=w(()=>z1(l(cr))),ei=w(()=>ep(l(ur)));var mi=te(Us);{var Ro=fn=>{Eu(fn,{get content(){return l(Mi)},delayDuration:300,side:"bottom",class:"flex min-w-0 flex-1",children:(er,Dr)=>{gr(er)},$$slots:{default:!0}})},fa=fn=>{gr(fn)};V(mi,fn=>{l(Mi)?fn(Ro):fn(fa,-1)})}var Si=R(mi,2);{var Qi=fn=>{const er=w(()=>`${l(ur).instanceBaseUrl.replace(/\/$/,"")}/${l(ur).projectPath}`);{let Dr=w(()=>_.browser_embedded_openExternal_tooltip()),is=w(()=>_.browser_embedded_openExternal_ariaLabel());Ze(fn,{variant:"ghost",size:"icon-compact",iconOnly:!0,get href(){return l(er)},target:"_blank",rel:"noopener noreferrer",get tooltip(){return l(Dr)},get"aria-label"(){return l(is)},class:"mr-1 shrink-0 text-subtle",onclick:$n=>{$n.preventDefault(),$n.stopPropagation(),jf(l(er),{event:$n,forceExternal:!0})},children:($n,Ti)=>{ut($n,{get icon(){return Dm},size:12})},$$slots:{default:!0}})}};V(Si,fn=>{he()&&l(ur)&&fn(Qi)})}var Po=R(Si,2);{var Zs=fn=>{{let er=w(()=>_.workspace_repoSelector_removeRecent_ariaLabel({repository:l(cr).path})),Dr=w(()=>_.workspace_repoSelector_removeRecent_tooltip());Ze(fn,{variant:"ghost",type:"button",size:"icon-compact",iconOnly:!0,"data-remove-recent-repo":!0,class:"mr-2 shrink-0 opacity-0 pointer-events-none group-hover/recent-repo:opacity-100 group-hover/recent-repo:pointer-events-auto group-focus-within/recent-repo:opacity-100 group-focus-within/recent-repo:pointer-events-auto",get"aria-label"(){return l(er)},get title(){return l(Dr)},onclick:is=>Vn(is,l(cr)),children:(is,$n)=>{ut(is,{get icon(){return Fi},size:12})},$$slots:{default:!0}})}};V(Po,fn=>{he()||fn(Zs)})}Y(Us)}L(gr=>wt(Us,1,`group/recent-repo flex min-w-0 items-center ${he()?"rounded-(--radius-row)":""} ${gr??""}`),[()=>he()&&vn()(l(cr),l(gi))?"bg-selected":""]),k(Ps,Us)}),k(Ce,Ys)},F=Ce=>{var Ft=Je(),vn=ce(Ft);{var Ys=Ps=>{var cr=Je(),gi=ce(cr);Rt(gi,()=>Wf,(Us,mi)=>{mi(Us,{children:(Ro,fa)=>{var Si=Sc(),Qi=ce(Si);{const Zs=(gr,ss)=>{Ze(gr,us(()=>(ss?.()).props,{variant:"plain",class:"group/forge relative h-auto shrink-0 rounded-none py-2.5 pl-3 pr-4 text-sm font-normal hover:underline focus:underline",children:(Ci,Mi)=>{Ht();var ei=nN(),fn=ce(ei),er=R(fn);ut(er,{get icon(){return Da},size:10,class:"absolute right-0 opacity-0 group-hover/forge:opacity-100 group-focus/forge:opacity-100"}),L(()=>B(fn,`${l(To)??""} `)),k(Ci,ei)},$$slots:{default:!0}}))};Rt(Qi,()=>Uf,(gr,ss)=>{ss(gr,{child:Zs,$$slots:{child:!0}})})}var Po=R(Qi,2);{let Zs=w(()=>({to:de()})),gr=w(()=>_.workspace_repoSelector_whichRepo_label());Rt(Po,()=>Vf,(ss,ur)=>{ur(ss,{get portalProps(){return l(Zs)},get"aria-label"(){return l(gr)},children:(Ci,Mi)=>{var ei=Je(),fn=ce(ei);{let er=w(()=>l($s)?.id);Rt(fn,()=>cx,(Dr,is)=>{is(Dr,{get value(){return l(er)},onValueChange:$n=>gt($n),children:($n,Ti)=>{var $r=Je(),Br=ce($r);Cs(Br,17,()=>l(bn),qt=>qt.id,(qt,In)=>{var zr=Je(),wn=ce(zr);{const An=dr=>{ut(dr,{get icon(){return l(In).icon},size:12})};Rt(wn,()=>ux,(dr,Vs)=>{Vs(dr,{get value(){return l(In).id},closeOnSelect:!0,leading:An,children:(Cr,ws)=>{Ht();var Mr=Vt();L(()=>B(Mr,l(In).label)),k(Cr,Mr)},$$slots:{leading:!0,default:!0}})})}k(qt,zr)}),k($n,$r)},$$slots:{default:!0}})})}k(Ci,ei)},$$slots:{default:!0}})})}k(Ro,Si)},$$slots:{default:!0}})}),k(Ps,cr)},Xi=Ps=>{var cr=rN(),gi=re(cr,!0);L(()=>B(gi,l($s)?.label??"github.com/")),k(Ps,cr)};V(vn,Ps=>{l(bn).length>1?Ps(Ys):Ps(Xi,-1)})}k(Ce,Ft)};var W0=te(td);Rt(W0,()=>qf,(Ce,Ft)=>{Ft(Ce,{get open(){return l(Re)},set open(vn){x(Re,vn,!0)},children:(vn,Ys)=>{var Xi=Sc(),Ps=ce(Xi);{const gi=(Us,mi)=>{let Ro=()=>(mi?.()).props;{let fa=w(()=>!he()),Si=w(()=>`w-full ${Be()??""}`),Qi=w(()=>Ue()??(he()?void 0:`${_.workspace_repoSelector_selectRepository_label()}: ${l(Qu)}`)),Po=w(()=>he()&&!Ue()?`${t}-field-label ${t}-field-value`:void 0);Ze(Us,us(Ro,{get variant(){return Ct()},get wrapContent(){return l(fa)},get class(){return l(Si)},get"aria-label"(){return l(Qi)},get"aria-labelledby"(){return l(Po)},get ref(){return l(ie)},set ref(Zs){x(ie,Zs,!0)},children:(Zs,gr)=>{var ss=iN(),ur=te(ss);{var Ci=qt=>{var In=wm(),zr=re(In,!0);L(()=>{wt(In,1,Xn(yr.fieldLabel)),xt(In,"id",`${t}-field-label`),B(zr,l(zs))}),k(qt,In)};V(ur,qt=>{he()&&qt(Ci)})}var Mi=R(ur,2);{var ei=qt=>{ut(qt,{get icon(){return Mt()},size:"xs"})},fn=qt=>{Ba(qt,{size:12,class:"text-ghost -mb-0.25 mr-1"})};V(Mi,qt=>{Mt()?qt(ei):it()&&!l(sc)&&qt(fn,1)})}var er=R(Mi,2);{var Dr=qt=>{{let In=w(()=>l(ed)?.projectPath.split("/").slice(0,-1).join("/")||l(Zh)||l(Yh)?.namespace),zr=w(()=>l(ed)?.provider??(Xt()?"gitlab":l(Zh)?"github":void 0)),wn=w(()=>ep(l(ed))??l(Yh)?.ownerAvatarUrl),An=w(()=>l(Zu)?.type==="local"||!Xt()&&l(at)!=="github"),dr=w(()=>he()?20:16);th(qt,{get owner(){return l(In)},get provider(){return l(zr)},get avatarUrl(){return l(wn)},get local(){return l(An)},get size(){return l(dr)}})}},is=qt=>{Ba(qt,{size:16,class:"shrink-0 text-muted-foreground"})};V(er,qt=>{!Mt()&&l(sc)?qt(Dr):!Mt()&&he()&&!it()&&qt(is,1)})}var $n=R(er,2);{var Ti=qt=>{var In=sN(),zr=te(In);{var wn=Cr=>{var ws=km(),Mr=ce(ws),Io=re(Mr,!0),ha=R(Mr,2);{var Yi=Lo=>{var Zi=xm(),eo=re(Zi,!0);L(pa=>B(eo,pa),[()=>_.workspace_repoSelector_new_label()]),k(Lo,Zi)};V(ha,Lo=>{l(ze)&&!Ne()&&!Xt()&&Lo(Yi)})}L(()=>{wt(Mr,1,Xn(Tt())),B(Io,l(Qu))}),k(Cr,ws)},An=Cr=>{var ws=wm(),Mr=re(ws,!0);L(()=>{wt(ws,1,Xn(Tt())),B(Mr,l(qi))}),k(Cr,ws)};V(zr,Cr=>{l(sc)?Cr(wn):Cr(An,-1)})}var dr=R(zr,2);{var Vs=Cr=>{var ws=xm(),Mr=re(ws);L(()=>B(Mr,`(${je()??""})`)),k(Cr,ws)};V(dr,Cr=>{je()&&Cr(Vs)})}Y(In),L(()=>xt(In,"id",he()?`${t}-field-value`:void 0)),k(qt,In)};V($n,qt=>{!Mt()&&(l(sc)||l(qi))&&qt(Ti)})}var $r=R($n,2);{var Br=qt=>{ut(qt,{get icon(){return Da},size:10,get class(){return mt()}})};V($r,qt=>{Xe()&&qt(Br)})}Y(ss),L(()=>wt(ss,1,`flex w-full min-w-0 items-center truncate ${ee()}`)),k(Zs,ss)},$$slots:{default:!0}}))}};Rt(Ps,()=>eh,(Us,mi)=>{mi(Us,{child:gi,$$slots:{child:!0}})})}var cr=R(Ps,2);{let gi=w(()=>l(zs)??_.workspace_repoSelector_whichRepo_label()),Us=w(()=>he()?`w-[360px] max-w-[calc(100vw-1rem)] min-w-0 max-h-[min(440px,var(--bits-popover-content-available-height,calc(100dvh-1rem)))] flex flex-col ${l(Pn)==="browse"?"overflow-hidden":"overflow-y-auto"}`:"w-[400px] max-w-[calc(100vw-16px)] min-w-0 max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto flex flex-col"),mi=w(()=>he()?me.current||l(q)?"bottom":"left":void 0),Ro=w(()=>he()?me.current||l(q)?4:24:void 0),fa=w(()=>he()?me.current||l(q)?"end":"start":void 0),Si=w(()=>({to:de()})),Qi=w(()=>de()?"absolute":"fixed");Rt(cr,()=>Gf,(Po,Zs)=>{Zs(Po,{role:"dialog",get"aria-label"(){return l(gi)},get class(){return l(Us)},get side(){return l(mi)},get sideOffset(){return l(Ro)},get align(){return l(fa)},onkeydown:gr=>{he()&&l(Pn)==="browse"&&gr.target instanceof Node&&l(hi)?.contains(gr.target)&&Xa(gr),gr.key==="Enter"&&gr.stopPropagation()},get portalProps(){return l(Si)},get strategy(){return l(Qi)},portal:!0,children:(gr,ss)=>{var ur=Je(),Ci=ce(ur);{var Mi=fn=>{var er=uN(),Dr=ce(er),is=te(Dr);{let wn=w(()=>`${t}-form-repos`);Xr(is,{variant:"search",type:"text",role:"searchbox","data-repo-search":!0,"data-testid":"repo-form-search",get value(){return l(ms)},oninput:An=>x(ms,An.currentTarget.value,!0),onkeydown:Ja,get placeholder(){return l(pi)},get"aria-label"(){return l(pi)},get"aria-controls"(){return l(wn)},get ref(){return l(vs)},set ref(An){x(vs,An,!0)}})}Y(Dr);var $n=R(Dr,2),Ti=te($n);{var $r=wn=>{var An=aN();Cs(An,20,()=>[1,2,3],Tc,(dr,Vs)=>{var Cr=oN();k(dr,Cr)}),Y(An),k(wn,An)},Br=wn=>{var An=lN(),dr=re(An,!0);L(Vs=>B(dr,Vs),[()=>_.hud_filter_noRepositories_label()]),k(wn,An)},qt=wn=>{T(wn,()=>l(Fs),()=>An=>_i(An))};V(Ti,wn=>{l(Ye)&&l(bs).length===0?wn($r):l(Fs).length===0?wn(Br,1):wn(qt,-1)})}Y($n),Qn($n,wn=>x(hi,wn),()=>l(hi));var In=R($n,2),zr=te(In);Ze(zr,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-add",get class(){return`${yr.row} w-full`},onclick:Qa,children:(wn,An)=>{var dr=cN(),Vs=ce(dr);ut(Vs,{get icon(){return $c},class:"size-4 shrink-0"});var Cr=R(Vs,2),ws=re(Cr,!0);L(()=>B(ws,l(ys))),k(wn,dr)},$$slots:{default:!0}}),Y(In),L(wn=>{xt($n,"id",`${t}-form-repos`),xt($n,"aria-label",wn)},[()=>_.workspace_repoSelector_recent_label()]),k(fn,er)},ei=fn=>{var er=Sc(),Dr=ce(er);{var is=$r=>{var Br=dN(),qt=te(Br);{let wn=w(()=>_.ui_navButtons_goBack_tooltip());Ze(qt,{variant:"ghost",type:"button",size:"icon-sm",iconOnly:!0,"data-testid":"repo-form-back",class:"shrink-0 text-muted-foreground",get"aria-label"(){return l(wn)},onclick:ar,children:(An,dr)=>{ut(An,{get icon(){return g1},class:"size-3.5!"})},$$slots:{default:!0}})}var In=R(qt,2),zr=re(In,!0);Y(Br),L(()=>{wt(In,1,`${yr.title} min-w-0 truncate`),B(zr,l(ys))}),k($r,Br)},$n=$r=>{var Br=fN(),qt=te(Br),In=re(qt,!0),zr=R(qt,2),wn=re(zr,!0);Y(Br),L((An,dr)=>{B(In,An),B(wn,dr)},[()=>_.workspace_repoSelector_whichRepo_label(),()=>_.workspace_repoSelector_whichRepo_description()]),k($r,Br)};V(Dr,$r=>{he()?$r(is):$r($n,-1)})}var Ti=R(Dr,2);{let $r=w(()=>l(Qs)?"repository":l(zt)),Br=w(()=>he()?"shrink-0":"min-h-0");Rt(Ti,()=>Jx,(qt,In)=>{In(qt,{get value(){return l($r)},onValueChange:kr,get class(){return`flex flex-col ${l(Br)??""}`},children:(zr,wn)=>{var An=PN(),dr=ce(An);{let Mr=w(()=>_.workspace_repoSelector_whichRepo_label());Rt(dr,()=>Xx,(Io,ha)=>{ha(Io,{get"aria-label"(){return l(Mr)},class:"flex shrink-0 gap-0 mx-3 mb-3 bg-sidebar rounded-lg p-1",children:(Yi,Lo)=>{var Zi=Sc(),eo=ce(Zi);{var pa=Oo=>{var to=Je(),ga=ce(to);{let el=w(()=>l(Qs)?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");Rt(ga,()=>Sp,(tl,nl)=>{nl(tl,{value:"repository",get class(){return`flex-1 min-w-0 h-auto min-h-(--control-height-medium) px-2 py-1.5 text-sm whitespace-normal rounded-md cursor-pointer transition-all ${l(el)??""}`},children:(ma,ic)=>{Ht();var rl=Vt();L(va=>B(rl,va),[()=>_.workspace_repoSelector_clone_tab()]),k(ma,rl)},$$slots:{default:!0}})})}k(Oo,to)};V(eo,Oo=>{l(A)&&Oo(pa)})}var nd=R(eo,2);Cs(nd,1,()=>[{id:"local",label:_.workspace_repoSelector_existingFolder_tab()},{id:"new",label:_.workspace_repoSelector_new_tab()},...E()?[{id:"remote",label:_.workspace_repoSelector_remoteServer_tab()}]:[]],Tc,(Oo,to)=>{var ga=Je(),el=ce(ga);{let tl=w(()=>l(zt)===l(to).id?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");Rt(el,()=>Sp,(nl,ma)=>{ma(nl,{get value(){return l(to).id},get class(){return`flex-1 min-w-0 h-auto min-h-(--control-height-medium) px-2 py-1.5 text-sm whitespace-normal rounded-md cursor-pointer transition-all ${l(tl)??""}`},children:(ic,rl)=>{Ht();var va=Vt();L(()=>B(va,l(to).label)),k(ic,va)},$$slots:{default:!0}})})}k(Oo,ga)}),k(Yi,Zi)},$$slots:{default:!0}})})}var Vs=R(dr,2);{var Cr=Mr=>{Ze(Mr,{type:"button",variant:"link",size:"sm",class:"mx-3 -mt-1 mb-2 h-auto self-start p-0 text-xs",onclick:Ee,children:(Io,ha)=>{Ht();var Yi=Vt();L(Lo=>B(Yi,Lo),[()=>_.workspace_repoSelector_connectForgeToClone_label()]),k(Io,Yi)},$$slots:{default:!0}})};V(Vs,Mr=>{!l(A)&&s()&&Mr(Cr)})}var ws=R(Vs,2);{let Mr=w(()=>l(Qs)?"repository":l(zt));Rt(ws,()=>av,(Io,ha)=>{ha(Io,{get value(){return l(Mr)},class:"mt-0 min-h-0 flex flex-col",children:(Yi,Lo)=>{var Zi=RN(),eo=ce(Zi),pa=te(eo);{var nd=Tn=>{const Bn=w(()=>l(zt)),fr=w(()=>l(Bn)==="new"?"new":l(Ae)&&l(st)?"folder":le().folder??null);{let tr=w(()=>l(fr)==="git-repo"?le().worktree!==!1:le().checked);I0(Tn,{class:"mb-3 px-1",get folder(){return l(fr)},get checked(){return l(tr)},get disabled(){return le().disabled},onCheckedChange:nr=>F0(nr,l(Bn))})}};V(pa,Tn=>{le()&&(l(zt)==="local"||l(zt)==="new")&&Tn(nd)})}var Oo=R(pa,2);{var to=Tn=>{{let Bn=w(()=>!he()),fr=w(()=>!!he());R0(Tn,us(Me,{get scrollable(){return l(Bn)},get formStyle(){return l(fr)},get prefix(){return F},onSelect:(tr,nr)=>{yn++,Me()?.onSelect(tr,nr),x(Re,!1)}}))}},ga=Tn=>{Ze(Tn,{type:"button",class:"w-full flex items-center justify-between px-3 py-2.5 rounded-lg border-0 text-left cursor-pointer",onclick:N0,children:(Bn,fr)=>{var tr=km(),nr=ce(tr),xs=re(nr,!0),Rn=R(nr,2);ut(Rn,{get icon(){return Js},class:"text-ghost opacity-50"}),L(an=>{wt(nr,1,`text-sm truncate ${l(ht)?"text-foreground":"text-muted-foreground"}`),B(xs,an)},[()=>l(ht)||_.workspace_repoSelector_selectAFolder_placeholder()]),k(Bn,tr)},$$slots:{default:!0}})},el=Tn=>{var Bn=pN(),fr=ce(Bn);If(fr,{kind:"repository"});var tr=R(fr,2);If(tr,{});var nr=R(tr,2),xs=te(nr);F(xs);var Rn=R(xs,2);{let xn=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),jn=w(()=>l(Fn).length>0?Yu:void 0),Tr=w(()=>l(Fn).length>0),Fr=w(()=>l(Fn)[l(tt)]?`${Yu}-${l(tt)}`:void 0);Qn(Xr(Rn,{placeholder:"owner/repo",type:"text",oninput:Gn=>Kn(Gn.currentTarget.value),onpaste:Hs,onkeydown:Zn,class:"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm",noFocusStyle:!0,role:"combobox",get"aria-label"(){return l(xn)},"aria-autocomplete":"list",get"aria-controls"(){return l(jn)},get"aria-expanded"(){return l(Tr)},get"aria-activedescendant"(){return l(Fr)},get ref(){return l(yt)},set ref(Gn){x(yt,Gn,!0)},get value(){return l(fi)},set value(Gn){x(fi,Gn,!0)}}),Gn=>x(qe,Gn,!0),()=>l(qe))}Y(nr);var an=R(nr,2);{var Hn=xn=>{{let jn=w(()=>_.workspace_repoSelector_githubSignIn_description());P0(xn,{class:"mt-2",get message(){return l(jn)}})}},mr=xn=>{{let jn=w(()=>!!he()),Tr=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Fr=w(()=>!l(Fn).length&&(M()||!!(l(lr)&&z()))),Gn=w(()=>l(lr)?_.workspace_repoSelector_searchingGithub_label({query:l(lr)}):_.gitlabCheckout_loading_label()),Ws=w(()=>_.hud_filter_noRepositories_label()),No=w(()=>O()?r()?O():_.workspace_repoSelector_suggestionsUnavailable_label():void 0),no=w(()=>_.workspace_repoSelector_retrySuggestions_label());Gh(xn,{get formStyle(){return l(jn)},get id(){return Yu},get items(){return l(Fn)},getKey:Is=>Is.id,getOwner:Is=>Is.owner,getName:Is=>Is.name,provider:"github",get label(){return l(Tr)},get loading(){return l(Fr)},get loadingLabel(){return l(Gn)},get emptyLabel(){return l(Ws)},get error(){return l(No)},get retryLabel(){return l(no)},onRetry:Kt,onSelect:un,get activeIndex(){return l(tt)},set activeIndex(Is){x(tt,Is,!0)}})}};V(an,xn=>{!l(ke)&&s()?xn(Hn):l(ke)&&xn(mr,1)})}var cn=R(an,2);{var vr=xn=>{var jn=hN(),Tr=te(jn),Fr=re(Tr),Gn=R(Tr,2);Ze(Gn,{size:"sm",onclick:Xu,class:"shrink-0",children:(Ws,No)=>{Ht();var no=Vt();L(Is=>B(no,Is),[()=>_.workspace_repoSelector_select_label()]),k(Ws,no)},$$slots:{default:!0}}),Y(jn),L(()=>B(Fr,`${l(Yn).owner??""}/${l(Yn).repo??""}`)),k(xn,jn)};V(cn,xn=>{l(Yn)&&!l(_r)&&xn(vr)})}k(Tn,Bn)},tl=Tn=>{var Bn=wN(),fr=ce(Bn);Ze(fr,{type:"button",variant:"plain",wrapContent:!1,class:"w-full flex items-center gap-3 mb-2 text-left cursor-pointer",onclick:$0,children:(cn,vr)=>{var xn=gN(),jn=ce(xn),Tr=re(jn,!0),Fr=R(jn,2),Gn=te(Fr),Ws=re(Gn,!0),No=R(Gn,2);ut(No,{get icon(){return Js},class:"text-ghost shrink-0 opacity-50"}),Y(Fr),L((no,Is)=>{B(Tr,no),wt(Fr,1,`flex-1 min-w-0 text-sm h-(--control-height-medium) px-3 bg-sidebar rounded-(--radius-medium) flex items-center justify-between ${l(ir)?"text-foreground":"text-subtle"} truncate`),B(Ws,Is)},[()=>_.workspace_repoSelector_parentFolder_label(),()=>l(ir)||_.workspace_repoSelector_select_placeholder()]),k(cn,xn)},$$slots:{default:!0}});var tr=R(fr,2),nr=te(tr),xs=re(nr,!0),Rn=R(nr,2);Xr(Rn,{placeholder:"new-project",type:"text",onkeydown:cn=>{cn.key==="Enter"&&!cn.isComposing&&(cn.preventDefault(),cn.stopPropagation(),da())},class:"bg-sidebar border-none",noFocusStyle:!0,get value(){return l(ts)},set value(cn){x(ts,cn,!0)}}),Y(tr);var an=R(tr,2);{var Hn=cn=>{var vr=mN(),xn=te(vr),jn=re(xn,!0);Y(vr),L(()=>B(jn,l(Pe))),k(cn,vr)},mr=cn=>{var vr=yN(),xn=te(vr),jn=re(xn,!0),Tr=R(xn,2);{var Fr=Er=>{var Un=vN(),Hr=te(Un);li(Hr,{size:14});var ti=R(Hr,2),ni=re(ti,!0);Y(Un),L(rr=>B(ni,rr),[()=>_.workspace_repoSelector_checking_label()]),k(Er,Un)},Gn=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_select_label()]),k(rr,ks)},$$slots:{default:!0}}),Y(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_repoExists_label({isolationLabel:j})]),k(Er,Un)},Ws=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_select_label()]),k(rr,ks)},$$slots:{default:!0}}),Y(Un),L(rr=>B(ti,rr),[()=>_.onboarding_localRepoTab_plainFolder_description()]),k(Er,Un)},No=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",variant:"primary",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_create_label()]),k(rr,ks)},$$slots:{default:!0}}),Y(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_newFolderWillBeCreated_label()]),k(Er,Un)},no=Er=>{var Un=bN(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",variant:"primary",onclick:da,class:"shrink-0",disabled:!0,children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_create_label()]),k(rr,ks)},$$slots:{default:!0}}),Y(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_folderNotGitRepo_label()]),k(Er,Un)},Is=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",variant:"primary",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_create_label()]),k(rr,ks)},$$slots:{default:!0}}),Y(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_newRepoWillBeCreated_label()]),k(Er,Un)};V(Tr,Er=>{l(ln)?Er(Fr):l(dt)?.exists&&l(dt)?.isGitRepo?Er(Gn,1):l(Cn)==="existing"?Er(Ws,2):l(Cn)==="new"?Er(No,3):l(dt)?.exists&&!l(dt)?.isGitRepo?Er(no,4):Er(Is,-1)})}Y(vr),L(()=>B(jn,l(Oe))),k(cn,vr)};V(an,cn=>{l(Pe)?cn(Hn):l(Oe)&&cn(mr,1)})}L(cn=>B(xs,cn),[()=>_.workspace_repoSelector_folderName_label()]),k(Tn,Bn)},nl=Tn=>{var Bn=SN(),fr=te(Bn);Cs(fr,17,()=>l(Gt),Rn=>Rn.id,(Rn,an)=>{var Hn=xN(),mr=te(Hn);Kh(mr,{size:14,class:"text-ghost shrink-0"});var cn=R(mr,2),vr=te(cn),xn=re(vr,!0),jn=R(vr,2),Tr=re(jn,!0);Y(cn);var Fr=R(cn,2);{let Gn=w(()=>_.workspace_repoSelector_removeSetup_tooltip());Ze(Fr,{variant:"ghost",type:"button",size:"icon-compact",iconOnly:!0,onclick:Ws=>{Ws.stopPropagation(),Ws.preventDefault(),Bs(l(an).id)},class:"ml-1 rounded text-muted-foreground hover:text-danger hover:bg-danger-background/10",get title(){return l(Gn)},children:(Ws,No)=>{ut(Ws,{get icon(){return Fi},size:"xs"})},$$slots:{default:!0}})}Y(Hn),L(()=>{B(xn,l(an).name),B(Tr,l(an).transport==="websocket"?l(an).wsUrl:`${l(an).username}@${l(an).host}:${l(an).port}`)}),Kr("click",Hn,()=>gs(l(an))),Kr("keydown",Hn,Gn=>{(Gn.key==="Enter"||Gn.key===" ")&&(Gn.preventDefault(),gs(l(an)))}),k(Rn,Hn)});var tr=R(fr,2);{var nr=Rn=>{var an=kN(),Hn=re(an,!0);L(mr=>B(Hn,mr),[()=>_.workspace_repoSelector_noRemoteSetups_label()]),k(Rn,an)};V(tr,Rn=>{l(Gt).length===0&&Rn(nr)})}var xs=R(tr,2);Ze(xs,{variant:"ghost",type:"button",class:"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left cursor-pointer hover:bg-muted/50 transition-colors text-sm text-muted-foreground",onclick:di,children:(Rn,an)=>{var Hn=_N(),mr=ce(Hn);ut(mr,{get icon(){return $c},size:"sm"});var cn=R(mr);L(vr=>B(cn,` ${vr??""}`),[()=>_.workspace_repoSelector_addRemoteSetup_label()]),k(Rn,Hn)},$$slots:{default:!0}}),Y(Bn),k(Tn,Bn)};V(Oo,Tn=>{l(zt)==="gitlab"&&Me()?Tn(to):l(zt)==="local"?Tn(ga,1):l(zt)==="github"?Tn(el,2):l(zt)==="new"?Tn(tl,3):l(zt)==="remote"&&Tn(nl,4)})}Y(eo);var ma=R(eo,2);{var ic=Tn=>{var Bn=CN(),fr=te(Bn),tr=te(fr);ut(tr,{get icon(){return Js},class:"text-ghost shrink-0 mt-0.5"});var nr=R(tr,2),xs=te(nr),Rn=re(xs,!0),an=R(xs,2),Hn=re(an,!0),mr=R(an,2),cn=te(mr);Ze(cn,{size:"sm",variant:"secondary",onclick:z0,children:(xn,jn)=>{Ht();var Tr=Vt();L(Fr=>B(Tr,Fr),[()=>_.workspace_repoSelector_initializeGit_label()]),k(xn,Tr)},$$slots:{default:!0}});var vr=R(cn,2);Ze(vr,{size:"sm",variant:"secondary",onclick:H0,children:(xn,jn)=>{Ht();var Tr=Vt();L(Fr=>B(Tr,Fr),[()=>_.workspace_repoSelector_chooseDifferentFolder_label()]),k(xn,Tr)},$$slots:{default:!0}}),Y(mr),Y(nr),Y(fr),Y(Bn),L((xn,jn)=>{xt(xs,"title",l(st)),B(Rn,xn),B(Hn,jn)},[()=>l(st).split("/").pop()||l(st),()=>_.workspace_repoSelector_notGitRepository_label()]),k(Tn,Bn)};V(ma,Tn=>{l(zt)!=="gitlab"&&l(Ae)&&l(st)&&Tn(ic)})}var rl=R(ma,2);{var va=Tn=>{var Bn=AN(),fr=te(Bn);lx(fr,{size:5,class:"mb-2",children:(Rn,an)=>{Ht();var Hn=Vt();L(mr=>B(Hn,mr),[()=>_.workspace_repoSelector_recent_label()]),k(Rn,Hn)},$$slots:{default:!0}});var tr=R(fr,2);{var nr=Rn=>{var an=TN();Cs(an,20,()=>[1,2,3],Tc,(Hn,mr)=>{var cn=MN();k(Hn,cn)}),Y(an),k(Rn,an)},xs=Rn=>{var an=EN(),Hn=te(an);{let mr=w(()=>l(mn)());T(Hn,()=>l(mr),()=>(cn,vr)=>vr===l(Rs))}Y(an),k(Rn,an)};V(tr,Rn=>{l(Ye)&&l(Qt).length===0?Rn(nr):Rn(xs,-1)})}Y(Bn),k(Tn,Bn)},q0=w(()=>!he()&&(l(zt)==="local"||l(Qs))&&(l(Ye)||l(mn)().length>0));V(rl,Tn=>{l(q0)&&Tn(va)})}k(Yi,Zi)},$$slots:{default:!0}})})}k(zr,An)},$$slots:{default:!0}})})}k(fn,er)};V(Ci,fn=>{he()&&l(Pn)==="browse"?fn(Mi):fn(ei,-1)})}k(gr,ur)},$$slots:{default:!0}})})}k(vn,Xi)},$$slots:{default:!0}})}),Y(td)}var np=R(td,2);{var K0=T=>{A0(T,{get isOpen(){return l(_n)},onclose:()=>x(_n,!1),onsave:Eo})};V(np,T=>{E()&&T(K0)})}var j0=R(np,2);Qx(j0,{get open(){return l(Ie)},get title(){return l(on)},get initialPath(){return l(gn)},selectLabel:"Select folder",onSelect:Qh,onClose:B0}),k(n,tp);var G0=Ot(V0);return J(),G0}So(["click","keydown"]);var LN=N('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),ON=N('<div class="flex items-center rounded-lg bg-sidebar"><!></div>'),NN=N('<span class="mt-1 block"> </span>'),DN=N("<span> </span> <!>",1),_m=N("<!> <!>",1),$N=N("<div><!> <!></div>"),BN=N("<!> <!> <!>",1),zN=N('<div data-testid="gitlab-picker-list"><!> <!></div>');function L0(n,e){if(new.target)return Nt({component:L0,...n});Lt(e,!0);let t=y(e,"scopeKey",7),r=y(e,"prefix",7),s=y(e,"instanceBaseUrl",7),i=y(e,"query",7),o=y(e,"page",7),a=y(e,"copy",7),c=y(e,"onSearch",7),u=y(e,"onSubmit",7),d=y(e,"submitLabel",7),f=y(e,"onMore",7),h=y(e,"onRecover",7),p=y(e,"selectedKey",7),g=y(e,"getKey",7),v=y(e,"getText",7),m=y(e,"onSelect",7),S=y(e,"row",7),I=y(e,"compact",7,!1),C=fe(void 0);function M(Q){if(Q.key!=="ArrowDown"||Q.isComposing)return;const $=l(C)?.querySelector('[data-slot="list-view-item"]');$&&(Q.preventDefault(),Q.stopPropagation(),$.focus())}var O={get scopeKey(){return t()},set scopeKey(Q){t(Q),b()},get prefix(){return r()},set prefix(Q){r(Q),b()},get instanceBaseUrl(){return s()},set instanceBaseUrl(Q){s(Q),b()},get query(){return i()},set query(Q){i(Q),b()},get page(){return o()},set page(Q){o(Q),b()},get copy(){return a()},set copy(Q){a(Q),b()},get onSearch(){return c()},set onSearch(Q){c(Q),b()},get onSubmit(){return u()},set onSubmit(Q){u(Q),b()},get submitLabel(){return d()},set submitLabel(Q){d(Q),b()},get onMore(){return f()},set onMore(Q){f(Q),b()},get onRecover(){return h()},set onRecover(Q){h(Q),b()},get selectedKey(){return p()},set selectedKey(Q){p(Q),b()},get getKey(){return g()},set getKey(Q){g(Q),b()},get getText(){return v()},set getText(Q){v(Q),b()},get onSelect(){return m()},set onSelect(Q){m(Q),b()},get row(){return S()},set row(Q){S(Q),b()},get compact(){return I()},set compact(Q=!1){I(Q),b()},$set:Dt,$on:(Q,$)=>$t(e,Q,$)},P=zN(),E=te(P);{var z=Q=>{var $=LN(),X=re($,!0);L(()=>B(X,s())),k(Q,$)};V(E,Q=>{s()&&!r()&&!I()&&Q(z)})}var G=R(E,2);{var J=Q=>{var $=_m(),X=ce($);{var de=ie=>{var q=ON(),j=te(q);On(j,r),Y(q),k(ie,q)};V(X,ie=>{r()&&ie(de)})}var me=R(X,2);{const ie=ne=>{var we=DN(),be=ce(we),Se=re(be,!0),se=R(be,2);{var oe=H=>{var W=NN(),D=re(W,!0);L(()=>B(D,o().detail)),k(H,W)};V(se,H=>{o().detail&&H(oe)})}L(()=>B(Se,o().message)),k(ne,we)};let q=w(()=>h()?o().actionLabel:void 0),j=w(()=>h()&&o().actionLabel?()=>h()?.(t()):void 0);dx(me,{density:"compact",get retryLabel(){return l(q)},get onRetry(){return l(j)},message:ie,$$slots:{message:!0}})}k(Q,$)},K=Q=>{var $=BN(),X=ce($);{var de=be=>{{let Se=w(()=>!t());Xr(be,{variant:"search",type:"text",role:"searchbox",get"aria-label"(){return a().searchLabel},get value(){return i()},get disabled(){return l(Se)},get placeholder(){return a().searchPlaceholder},oninput:se=>c()(se.currentTarget.value,t()),onkeydown:M,class:"shrink-0"})}},me=be=>{Zx(be,{get label(){return a().searchLabel},control:(se,oe=ls)=>{var H=$N(),W=te(H);{var D=ge=>{var ue=Je(),pe=ce(ue);On(pe,r),k(ge,ue)};V(W,ge=>{r()&&ge(D)})}var ae=R(W,2);{let ge=w(()=>!t()),ue=w(()=>r()?"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm":void 0);Xr(ae,us(oe,{type:"search",get value(){return i()},get disabled(){return l(ge)},get placeholder(){return a().searchPlaceholder},oninput:pe=>c()(pe.currentTarget.value,t()),onkeydown:M,get class(){return l(ue)}}))}Y(H),L(()=>wt(H,1,Xn(r()?"flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring":void 0))),k(se,H)},$$slots:{control:!0}})};V(X,be=>{I()?be(de):be(me,-1)})}var ie=R(X,2);{var q=be=>{{let Se=w(()=>!i().trim()||o().status==="loading"||o().loadingMore);Ze(be,{type:"button",variant:"secondary",class:"w-full shrink-0",get disabled(){return l(Se)},onclick:()=>u()?.(i(),t()),children:(se,oe)=>{Ht();var H=Vt();L(()=>B(H,d())),k(se,H)},$$slots:{default:!0}})}};V(ie,be=>{u()&&d()&&be(q)})}var j=R(ie,2);{var ne=be=>{fx(be,{get label(){return a().loadingLabel},density:"compact"})},we=be=>{var Se=_m(),se=ce(Se);Qf(se,t,W=>{{const D=pe=>{px(pe,{density:"compact",description:ye=>{Ht();var Z=Vt();L(()=>B(Z,i()?a().emptySearchLabel:a().emptyLabel)),k(ye,Z)},$$slots:{description:!0}})};let ae=w(()=>p()?[p()]:[]),ge=w(()=>I()?"min-h-0 flex-1":"max-h-56"),ue=w(()=>I()?40:void 0);hx(W,{get items(){return o().items},get getKey(){return g()},get getText(){return v()},selectable:"single",get selectedKeys(){return l(ae)},onActivate:pe=>m()(pe,t()),get ariaLabel(){return a().listLabel},get class(){return l(ge)},get rowHeight(){return l(ue)},get row(){return S()},empty:D,$$slots:{empty:!0}})}});var oe=R(se,2);{var H=W=>{Ze(W,{type:"button",variant:"ghost",class:"w-full shrink-0",get disabled(){return o().loadingMore},onclick:()=>f()(t()),children:(D,ae)=>{Ht();var ge=Vt();L(()=>B(ge,o().loadingMore?a().loadingMoreLabel:a().loadMoreLabel)),k(D,ge)},$$slots:{default:!0}})};V(oe,W=>{(o().hasMore||o().loadingMore)&&W(H)})}k(be,Se)};V(j,be=>{o().status==="loading"?be(ne):be(we,-1)})}k(Q,$)};V(G,Q=>{o().status==="unavailable"?Q(J):Q(K,-1)})}return Y(P),Qn(P,Q=>x(C,Q),()=>l(C)),L(()=>wt(P,1,Xn(I()?"flex min-h-0 min-w-0 flex-1 flex-col gap-1 px-2 pt-1 pb-2":"min-w-0 space-y-3"))),k(n,P),Ot(O)}var FN=new Set(["$$slots","$$events","$$legacy","projectPath","selectedBranch","placeholder","protectedLabel","triggerClass","rowLabel","isLoading","showTriggerChevron","triggerChevronClass","onSelect","onOpenChange"]),HN=N("<span> </span>"),UN=N('<!> <span class="sr-only"> </span>',1),VN=N('<span class="flex-1 min-w-0 text-left truncate"> </span>'),WN=N("<span><!> <!> <!></span>"),KN=N('<p class="break-all type-caption text-foreground"> </p>'),jN=N('<span class="type-caption shrink-0 text-muted-foreground"> </span>'),GN=N('<div><!> <span class="min-w-0 flex-1 truncate"> </span> <!> <!></div>'),Sm=N("<!> <!>",1);function Nc(n,e){if(new.target)return Nt({component:Nc,...n});Lt(e,!0);let t=y(e,"projectPath",7),r=y(e,"selectedBranch",7),s=y(e,"placeholder",7),i=y(e,"protectedLabel",7),o=y(e,"triggerClass",7),a=y(e,"rowLabel",7),c=y(e,"isLoading",7,!1),u=y(e,"showTriggerChevron",7,!1),d=y(e,"triggerChevronClass",7),f=y(e,"onSelect",7),h=y(e,"onOpenChange",7),p=ui(e,FN),g=fe(!1);const v=Xf(),m=new Yf,S=w(()=>c()||e.page.status==="loading");var I={get projectPath(){return t()},set projectPath(O){t(O),b()},get selectedBranch(){return r()},set selectedBranch(O){r(O),b()},get placeholder(){return s()},set placeholder(O){s(O),b()},get protectedLabel(){return i()},set protectedLabel(O){i(O),b()},get triggerClass(){return o()},set triggerClass(O){o(O),b()},get rowLabel(){return a()},set rowLabel(O){a(O),b()},get isLoading(){return c()},set isLoading(O=!1){c(O),b()},get showTriggerChevron(){return u()},set showTriggerChevron(O=!1){u(O),b()},get triggerChevronClass(){return d()},set triggerChevronClass(O){d(O),b()},get onSelect(){return f()},set onSelect(O){f(O),b()},get onOpenChange(){return h()},set onOpenChange(O){h(O),b()},$set:Dt,$on:(O,P)=>$t(e,O,P)},C=Je(),M=ce(C);return Rt(M,()=>qf,(O,P)=>{P(O,{onOpenChange:E=>h()?.(E,e.scopeKey),get open(){return l(g)},set open(E){x(g,E,!0)},children:(E,z)=>{var G=Sm(),J=ce(G);{const Q=($,X)=>{let de=()=>(X?.()).props;{let me=w(()=>`min-w-0 max-w-full text-muted-foreground ${o()??""}`),ie=w(()=>!a());Ze($,us(de,{variant:"ghost",type:"button",get class(){return l(me)},get"aria-busy"(){return l(S)},get wrapContent(){return l(ie)},children:(q,j)=>{var ne=WN(),we=te(ne);{var be=D=>{var ae=HN(),ge=re(ae,!0);L(()=>{wt(ae,1,Xn(yr.fieldLabel)),B(ge,a())}),k(D,ae)};V(we,D=>{a()&&D(be)})}var Se=R(we,2);{var se=D=>{var ae=UN(),ge=ce(ae);li(ge,{size:14,class:"text-ghost"});var ue=R(ge,2),pe=re(ue,!0);L(()=>B(pe,e.copy.loadingLabel)),k(D,ae)},oe=D=>{var ae=VN(),ge=re(ae,!0);L(()=>B(ge,r()?.name||s())),k(D,ae)};V(Se,D=>{!r()&&l(S)?D(se):D(oe,-1)})}var H=R(Se,2);{var W=D=>{ut(D,{get icon(){return Da},size:10,get class(){return d()}})};V(H,D=>{u()&&!l(S)&&D(W)})}Y(ne),L(()=>wt(ne,1,`flex w-full min-w-0 items-center truncate ${a()?"gap-2":"gap-0.75"}`)),k(q,ne)},$$slots:{default:!0}}))}};Rt(J,()=>eh,($,X)=>{X($,{child:Q,$$slots:{child:!0}})})}var K=R(J,2);{let Q=w(()=>a()??e.copy.listLabel),$=w(()=>a()?"flex w-[360px] max-w-[calc(100vw-1rem)] min-w-0 max-h-[min(440px,var(--bits-popover-content-available-height,calc(100dvh-1rem)))] flex-col overflow-hidden":"w-80 max-w-[calc(100vw-2rem)] max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto space-y-2 p-3"),X=w(()=>a()?m.current?"bottom":"left":void 0),de=w(()=>a()?m.current?4:24:void 0),me=w(()=>a()&&m.current?"end":"start"),ie=w(()=>({to:v()})),q=w(()=>v()?"absolute":"fixed");Rt(K,()=>Gf,(j,ne)=>{ne(j,{role:"dialog",get"aria-label"(){return l(Q)},get class(){return l($)},get side(){return l(X)},get sideOffset(){return l(de)},get align(){return l(me)},get portalProps(){return l(ie)},get strategy(){return l(q)},onkeydown:we=>{we.key==="Enter"&&we.stopPropagation()},children:(we,be)=>{var Se=Sm(),se=ce(Se);{var oe=W=>{var D=KN(),ae=re(D,!0);L(()=>B(ae,t())),k(W,D)};V(se,W=>{a()||W(oe)})}var H=R(se,2);{const W=(ge,ue)=>{let pe=()=>(ue?.()).item,ke=()=>(ue?.()).selected;var ye=Je(),Z=ce(ye);{var $e=St=>{var De=GN(),Le=te(De);uo(Le,{size:16,get class(){return yr.icon}});var Qe=R(Le,2),Ct=re(Qe,!0),bt=R(Qe,2);{var sn=he=>{var Ne=jN(),je=re(Ne,!0);L(()=>B(je,i())),k(he,Ne)};V(bt,he=>{pe().protected&&he(sn)})}var Be=R(bt,2);{let he=w(()=>ke()?"checked":"empty");Zm(Be,{get state(){return l(he)},get class(){return yr.check}})}Y(De),L(()=>{wt(De,1,`flex ${yr.row}`),B(Ct,pe().name)}),k(St,De)},lt=St=>{ek(St,{title:Qe=>{Ht();var Ct=Vt();L(()=>B(Ct,pe().name)),k(Qe,Ct)},meta:Qe=>{Ht();var Ct=Vt();L(()=>B(Ct,pe().protected?i():"")),k(Qe,Ct)},$$slots:{title:!0,meta:!0}})};V(Z,St=>{a()?St($e):St(lt,-1)})}k(ge,ye)};let D=w(()=>!!a()),ae=w(()=>r()?.name);L0(H,us(()=>p,{get compact(){return l(D)},get selectedKey(){return l(ae)},getKey:ge=>ge.name,getText:ge=>ge.name,onSelect:(ge,ue)=>{f()({name:ge.name,commitSha:ge.commitSha},ue),x(g,!1)},row:W,$$slots:{row:!0}}))}k(we,Se)},$$slots:{default:!0}})})}k(E,G)},$$slots:{default:!0}})}),k(n,C),Ot(I)}var qN=N('<div class="flex min-h-10 min-w-0 items-center gap-2 pl-0 pr-2 py-2 text-sm leading-5"><span> </span> <span class="min-w-0 truncate"> </span></div>'),JN=N('<div class="min-w-0"><!></div>'),XN=N('<label class="flex items-center gap-2 py-2 text-sm text-muted-foreground"><!> </label>'),QN=N('<p class="min-w-0 truncate text-sm text-muted-foreground"> </p> <!>',1),Bd=N("<!> <!> <!>",1),YN=N('<div class="relative min-w-0"><!> <!></div>'),si=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>'),Cm=N('<!> <span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>',1),Mc=N("<!> <!>",1),Mm=N("<!> <!> <!> <!> <!>",1),ZN=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pr-1"> </span>'),eD=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0 px-1"> </span>'),tD=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pl-1"> </span>'),nD=N('<!> <span class="text-ui text-subtle whitespace-nowrap"> </span>',1),rD=N('<!> <!> <!> <span class="text-xs text-subtle whitespace-nowrap min-w-0 font-mono truncate max-w-60"> </span> <!> <span class="text-sm font-medium whitespace-nowrap shrink-0 font-mono"> </span> <!> <!>',1),sD=N("<div><!></div>");function iD(n,e){if(new.target)return Nt({component:iD,...n});Lt(e,!0);let t=y(e,"repoPath",7,""),r=y(e,"branch",7,""),s=y(e,"repoType",7,"local"),i=y(e,"gitlab",7),o=y(e,"gitlabBranch",7),a=y(e,"githubUrl",7,""),c=y(e,"skipIsolation",7,!1),u=y(e,"isNewRepo",7,!1),d=y(e,"suggestedBranch",7),f=y(e,"remoteSetup",7,null),h=y(e,"onRemoteSetupChange",7),p=y(e,"onRepoChange",7),g=y(e,"onBranchChange",7),v=y(e,"onSkipIsolationChange",7),m=y(e,"onGitHubAuthNeededChange",7),S=y(e,"onBranchStatusChange",7),I=y(e,"onBranchesLoaded",7),C=y(e,"presentation",7,"default"),M=y(e,"field",7,"both"),O=y(e,"isLoading",7,!1),P=y(e,"detectedGitHubOwner",7,null),E=y(e,"detectedGitHubRepo",7,null),z=y(e,"plainFolderMode",7,!1),G=y(e,"plainFolder",7,null),J=y(e,"gitChoice",7);const K=w(()=>C()==="metadata"),Q=w(()=>C()==="form"),$="\0",X=le=>le.split($).map(ot=>ot.trim()),de=w(()=>X(_.workspace_repoAndBranchPicker_workOnRepo_label({repo:$}))),me=w(()=>X(_.workspace_repoAndBranchPicker_workOnRepoOffBranch_label({repo:$,branch:$}))),ie=w(()=>X(_.workspace_repoAndBranchPicker_repoOffBranch_label({repo:$,branch:$}))),q=w(()=>X(_.workspace_repoAndBranchPicker_cloneRepoAndWorkOffBranch_label({repo:$,branch:$}))),j=w(()=>X(_.workspace_repoAndBranchPicker_workInFolder_label({repo:$}))),ne=w(()=>X((c()?_.workspace_repoAndBranchPicker_workOnRemoteOnBranch_label:_.workspace_repoAndBranchPicker_workOnRemoteOffBranch_label)({repo:$,path:$,branch:$}))),we=w(()=>l(K)?"block w-full min-w-0 text-sm text-foreground":"flex items-center flex-wrap gap-x-0.5 gap-y-1 [&>div]:min-w-0 [&>div]:max-w-full"),be="rounded-md bg-muted/40! shadow-none! outline-none! hover:bg-muted/60! active:bg-muted/70! data-[state=open]:bg-muted/70! data-[state=open]:text-foreground focus-visible:bg-muted/70! focus-visible:text-foreground focus-visible:outline-none! focus-visible:outline-offset-0! focus-visible:ring-0! focus-visible:ring-offset-0! focus-visible:shadow-none! disabled:bg-muted/50! disabled:text-muted-foreground disabled:hover:bg-muted/50! forced-colors:border forced-colors:border-[ButtonText] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",Se=w(()=>l(K)?`group/metadata-trigger min-w-0 px-2! py-1! text-sm leading-5 font-normal text-foreground ${be}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium)"),se=w(()=>l(K)?`group/metadata-trigger w-full min-w-0 px-2! py-1! text-sm leading-5 font-normal text-foreground overflow-hidden ${be}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium) overflow-hidden"),oe="h-2.5 w-2.5 shrink-0 text-ghost opacity-70",H="text-foreground font-normal",W="text-muted-foreground",D="main",ae=w(()=>l(K)&&M()==="branch"&&O()),ge=w(()=>f()?`${f().username}@${f().host}:${f().workspacePath}`:"");function ue(le){const ot=le.split(/[\\/]/).filter(Boolean);return ot[ot.length-1]||le}function pe(le){const ot=le.trim().replace(/^git@github\.com:/,"https://github.com/");try{const At=new URL(ot.startsWith("http")?ot:`https://${ot}`);return At.hostname!=="github.com"?ue(le):At.pathname.replace(/^\//,"").replace(/\.git$/,"")||ue(le)}catch{return ue(le.replace(/\.git$/,""))}}const ke=w(()=>s()==="gitlab"?i()?.selectedProjectPath??"":s()==="remote"&&f()?f().name:s()==="github"&&a()?pe(a()):ue(t())),ye=w(()=>s()==="gitlab"?o()?.selectedBranch?.name??"":s()==="remote"&&f()&&f().branch||r()||D),Z=w(()=>l(ke)?`${l(ke)}/${l(ye)}`:""),$e=w(()=>s()==="gitlab"?"":s()==="remote"&&f()?f().name:s()==="github"&&a()?a():t()),lt=w(()=>l(K)?l(ke):void 0),St=w(()=>P()&&E()?`${P()}/${E()}`:void 0),De=w(()=>t()||(s()==="remote"&&f()?f().workspacePath:""));function Le(le){p()?.(le)}function Qe(le){g()?.(le)}const Ct=w(()=>s()==="gitlab"||!!t()||s()==="github"&&!!a()||s()==="remote"&&!!f());let bt=fe(void 0);function sn(){l(bt)?.focusInput?.()}function Be(le="local"){l(bt)?.openOnLocalTab?.(le)}var he={focusInput:sn,openFolderSelection:Be,get repoPath(){return t()},set repoPath(le=""){t(le),b()},get branch(){return r()},set branch(le=""){r(le),b()},get repoType(){return s()},set repoType(le="local"){s(le),b()},get gitlab(){return i()},set gitlab(le){i(le),b()},get gitlabBranch(){return o()},set gitlabBranch(le){o(le),b()},get githubUrl(){return a()},set githubUrl(le=""){a(le),b()},get skipIsolation(){return c()},set skipIsolation(le=!1){c(le),b()},get isNewRepo(){return u()},set isNewRepo(le=!1){u(le),b()},get suggestedBranch(){return d()},set suggestedBranch(le){d(le),b()},get remoteSetup(){return f()},set remoteSetup(le=null){f(le),b()},get onRemoteSetupChange(){return h()},set onRemoteSetupChange(le){h(le),b()},get onRepoChange(){return p()},set onRepoChange(le){p(le),b()},get onBranchChange(){return g()},set onBranchChange(le){g(le),b()},get onSkipIsolationChange(){return v()},set onSkipIsolationChange(le){v(le),b()},get onGitHubAuthNeededChange(){return m()},set onGitHubAuthNeededChange(le){m(le),b()},get onBranchStatusChange(){return S()},set onBranchStatusChange(le){S(le),b()},get onBranchesLoaded(){return I()},set onBranchesLoaded(le){I(le),b()},get presentation(){return C()},set presentation(le="default"){C(le),b()},get field(){return M()},set field(le="both"){M(le),b()},get isLoading(){return O()},set isLoading(le=!1){O(le),b()},get detectedGitHubOwner(){return P()},set detectedGitHubOwner(le=null){P(le),b()},get detectedGitHubRepo(){return E()},set detectedGitHubRepo(le=null){E(le),b()},get plainFolderMode(){return z()},set plainFolderMode(le=!1){z(le),b()},get plainFolder(){return G()},set plainFolder(le=null){G(le),b()},get gitChoice(){return J()},set gitChoice(le){J(le),b()},$set:Dt,$on:(le,ot)=>$t(e,le,ot)},Ne=sD(),je=te(Ne);{var Tt=le=>{var ot=Bd(),At=ce(ot);{let qe=w(()=>s()==="gitlab"),yt=w(()=>!!G()&&s()==="local"),Re=w(()=>_.workspace_compactInitializer_repository_label()),We=w(()=>l(ke)||void 0);Qn(js(At,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get gitlabSelected(){return l(qe)},get plainFolderSelected(){return l(yt)},get value(){return l($e)},onchange:Le,get rowLabel(){return l(Re)},get triggerClass(){return yr.fieldTrigger},get displayValue(){return l(We)},triggerValueClass:"text-foreground",triggerContentClass:"gap-1"}),Pt=>x(bt,Pt,!0),()=>l(bt))}var Zt=R(At,2);{var Ve=qe=>{var yt=JN(),Re=te(yt);{var We=ze=>{var pt=Je(),at=ce(pt);{var Bt=rt=>{{let Qt=w(()=>_.workspace_compactInitializer_branch_label());Nc(rt,us(o,{get rowLabel(){return l(Qt)},get triggerClass(){return yr.fieldTrigger},showTriggerChevron:!1}))}};V(at,rt=>{o()&&rt(Bt)})}k(ze,pt)},Pt=ze=>{var pt=qN(),at=te(pt),Bt=re(at,!0),rt=R(at,2),Qt=re(rt,!0);Y(pt),L(Vn=>{wt(at,1,Xn(yr.fieldLabel)),B(Bt,Vn),B(Qt,f().branch||"main")},[()=>_.workspace_compactInitializer_branch_label()]),k(ze,pt)},Ye=ze=>{{let pt=w(()=>_.workspace_compactInitializer_branch_label()),at=w(()=>!l(Ct));ml(ze,{variant:"ghost",get rowLabel(){return l(pt)},get triggerClass(){return yr.fieldTrigger},get value(){return r()},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(at)},showUncommittedIndicator:!0,triggerContentClass:"w-full gap-2",onSkipIsolationChange:Bt=>v()?.(Bt),onGitHubAuthNeededChange:Bt=>m()?.(Bt),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Qe})}};V(Re,ze=>{s()==="gitlab"?ze(We):s()==="remote"&&f()?ze(Pt,1):ze(Ye,-1)})}Y(yt),k(qe,yt)};V(Zt,qe=>{!u()&&l(Ct)&&!(G()&&s()==="local")&&qe(Ve)})}var ht=R(Zt,2);{var Et=qe=>{var yt=QN(),Re=ce(yt),We=re(Re,!0);Pl(Re,(ze,pt)=>jd?.(ze,pt),()=>l(ge));var Pt=R(Re,2);{var Ye=ze=>{var pt=XN(),at=te(pt);Tp(at,{get checked(){return c()},onCheckedChange:rt=>v()?.(rt)});var Bt=R(at);Y(pt),L(rt=>B(Bt,` ${rt??""}`),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),k(ze,pt)};V(Pt,ze=>{typeof v()=="function"&&ze(Ye)})}L(()=>B(We,l(ge))),k(qe,yt)};V(ht,qe=>{s()==="remote"&&f()&&qe(Et)})}k(le,ot)},ee=le=>{{let ot=w(()=>s()==="gitlab"),At=w(()=>l(K)?H:W),Zt=w(()=>l(K)?"gap-1.5":"gap-0.75");Qn(js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get gitlabSelected(){return l(ot)},get value(){return l($e)},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(lt)},get triggerValueClass(){return l(At)},get triggerContentClass(){return l(Zt)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe}),Ve=>x(bt,Ve,!0),()=>l(bt))}},Ge=le=>{var ot=Je(),At=ce(ot);{var Zt=Ve=>{Nc(Ve,us(o,{get triggerClass(){return l(se)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe}))};V(At,Ve=>{o()&&Ve(Zt)})}k(le,ot)},it=le=>{var ot=YN(),At=te(ot);{let ht=w(()=>l(K)&&!l(ae)),Et=w(()=>l(K)?`w-full gap-1.5 ${l(ae)?"pr-5":""}`:void 0);ml(At,{variant:"ghost",get triggerClass(){return l(se)},get value(){return l(ye)},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,disabled:!1,showUncommittedIndicator:!0,get showTriggerChevron(){return l(ht)},triggerChevronClass:oe,get triggerContentClass(){return l(Et)},onSkipIsolationChange:qe=>v()?.(qe),onGitHubAuthNeededChange:qe=>m()?.(qe),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Qe})}var Zt=R(At,2);{var Ve=ht=>{li(ht,{size:16,class:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-subtle"})};V(Zt,ht=>{l(ae)&&ht(Ve)})}Y(ot),k(le,ot)},Xe=le=>{var ot=Bd(),At=ce(ot);{var Zt=qe=>{var yt=si(),Re=re(yt,!0);L(()=>B(Re,l(de)[0])),k(qe,yt)};V(At,qe=>{!l(K)&&l(de)[0]&&qe(Zt)})}var Ve=R(At,2);{let qe=w(()=>l(K)?H:W),yt=w(()=>l(K)?"gap-1.5":"gap-0.75");Qn(js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",value:"",onchange:Le,get triggerClass(){return l(Se)},get triggerValueClass(){return l(qe)},get triggerContentClass(){return l(yt)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe}),Re=>x(bt,Re,!0),()=>l(bt))}var ht=R(Ve,2);{var Et=qe=>{var yt=si(),Re=re(yt,!0);L(()=>B(Re,l(de)[1])),k(qe,yt)};V(ht,qe=>{!l(K)&&l(de)[1]&&qe(Et)})}k(le,ot)},mt=le=>{var ot=Bd(),At=ce(ot);{var Zt=qe=>{var yt=Je(),Re=ce(yt);{var We=Ye=>{var ze=Cm(),pt=ce(ze);ut(pt,{get icon(){return $c},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var at=R(pt,2),Bt=re(at,!0);L(rt=>B(Bt,rt),[()=>_.workspace_repoAndBranchPicker_createFolder_label()]),k(Ye,ze)},Pt=Ye=>{var ze=si(),pt=re(ze,!0);L(()=>B(pt,l(j)[0])),k(Ye,ze)};V(Re,Ye=>{G()==="new"?Ye(We):l(j)[0]&&Ye(Pt,1)})}k(qe,yt)};V(At,qe=>{l(K)||qe(Zt)})}var Ve=R(At,2);{let qe=w(()=>l(K)?l(ke):void 0),yt=w(()=>l(K)?H:W),Re=w(()=>l(K)?"gap-1.5":"gap-0.75");js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(qe)},get triggerValueClass(){return l(yt)},get triggerContentClass(){return l(Re)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=qe=>{var yt=si(),Re=re(yt,!0);L(()=>B(Re,l(j)[1])),k(qe,yt)};V(ht,qe=>{!l(K)&&G()!=="new"&&l(j)[1]&&qe(Et)})}k(le,ot)},Mt=le=>{var ot=Mc(),At=ce(ot);{var Zt=ht=>{var Et=Cm(),qe=ce(Et);ut(qe,{get icon(){return $c},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var yt=R(qe,2),Re=re(yt,!0);L(We=>B(Re,We),[()=>_.workspace_repoAndBranchPicker_createNewRepo_label()]),k(ht,Et)};V(At,ht=>{l(K)||ht(Zt)})}var Ve=R(At,2);{let ht=w(()=>l(K)?l(Z):void 0),Et=w(()=>l(K)?H:W),qe=w(()=>l(K)?"gap-1.5":"gap-0.75");js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(ht)},get triggerValueClass(){return l(Et)},get triggerContentClass(){return l(qe)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}k(le,ot)},Ue=le=>{{let ot=w(()=>s()==="gitlab"),At=w(()=>s()==="gitlab"?"":t());js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},get gitlabSelected(){return l(ot)},variant:"ghost",get value(){return l(At)},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(Z)},triggerValueClass:H,triggerContentClass:"gap-1.5",showTriggerChevron:!0,triggerChevronClass:oe})}},Ke=le=>{var ot=Mm(),At=ce(ot);{var Zt=Ye=>{var ze=Mc(),pt=ce(ze);Ba(pt,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var at=R(pt,2);{var Bt=rt=>{var Qt=si(),Vn=re(Qt,!0);L(()=>B(Vn,l(q)[0])),k(rt,Qt)};V(at,rt=>{l(q)[0]&&rt(Bt)})}k(Ye,ze)};V(At,Ye=>{l(K)||Ye(Zt)})}var Ve=R(At,2);{let Ye=w(()=>s()==="gitlab"),ze=w(()=>s()==="gitlab"?"":t()),pt=w(()=>l(K)?H:W);js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},get gitlabSelected(){return l(Ye)},variant:"ghost",get value(){return l(ze)},onchange:Le,get triggerClass(){return l(Se)},get triggerValueClass(){return l(pt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=Ye=>{var ze=si(),pt=re(ze,!0);L(()=>B(pt,l(K)?l(ie)[1]:l(q)[1])),k(Ye,ze)};V(ht,Ye=>{(l(K)?l(ie)[1]:l(q)[1])&&Ye(Et)})}var qe=R(ht,2);{var yt=Ye=>{var ze=Je(),pt=ce(ze);{var at=Bt=>{Nc(Bt,us(o,{get triggerClass(){return l(se)}}))};V(pt,Bt=>{o()&&Bt(at)})}k(Ye,ze)},Re=Ye=>{{let ze=w(()=>t()||""),pt=w(()=>!t()),at=w(()=>l(K)?"w-full gap-1.5":void 0);ml(Ye,{variant:"ghost",get triggerClass(){return l(se)},get value(){return r()},get repoPath(){return l(ze)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(pt)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(K)},triggerChevronClass:oe,get triggerContentClass(){return l(at)},onSkipIsolationChange:Bt=>v()?.(Bt),onGitHubAuthNeededChange:Bt=>m()?.(Bt),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Qe})}};V(qe,Ye=>{s()==="gitlab"?Ye(yt):Ye(Re,-1)})}var We=R(qe,2);{var Pt=Ye=>{var ze=si(),pt=re(ze,!0);L(()=>B(pt,l(K)?l(ie)[2]:l(q)[2])),k(Ye,ze)};V(We,Ye=>{(l(K)?l(ie)[2]:l(q)[2])&&Ye(Pt)})}k(le,ot)},Me=le=>{js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return f().name},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(Z)},triggerValueClass:H,triggerContentClass:"gap-1.5",showTriggerChevron:!0,triggerChevronClass:oe})},Xt=le=>{var ot=rD(),At=ce(ot);{var Zt=rt=>{var Qt=Mc(),Vn=ce(Qt);Kh(Vn,{size:16,class:"text-ghost ml-0.75 -mb-px mr-2 shrink-0"});var Yn=R(Vn,2);{var Gr=hs=>{var zt=si(),ps=re(zt,!0);L(()=>B(ps,l(ne)[0])),k(hs,zt)};V(Yn,hs=>{l(ne)[0]&&hs(Gr)})}k(rt,Qt)};V(At,rt=>{l(K)||rt(Zt)})}var Ve=R(At,2);{let rt=w(()=>l(K)?H:W);js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return f().name},onchange:Le,get triggerClass(){return l(Se)},get triggerValueClass(){return l(rt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=rt=>{var Qt=ZN(),Vn=re(Qt,!0);L(()=>B(Vn,l(ne)[1])),k(rt,Qt)};V(ht,rt=>{l(ne)[1]&&rt(Et)})}var qe=R(ht,2),yt=re(qe,!0);Pl(qe,(rt,Qt)=>jd?.(rt,Qt),()=>l(ge));var Re=R(qe,2);{var We=rt=>{var Qt=eD(),Vn=re(Qt,!0);L(()=>B(Vn,l(ne)[2])),k(rt,Qt)};V(Re,rt=>{l(ne)[2]&&rt(We)})}var Pt=R(Re,2),Ye=re(Pt,!0),ze=R(Pt,2);{var pt=rt=>{var Qt=tD(),Vn=re(Qt,!0);L(()=>B(Vn,l(ne)[3])),k(rt,Qt)};V(ze,rt=>{l(ne)[3]&&rt(pt)})}var at=R(ze,2);{var Bt=rt=>{Ze(rt,{variant:"ghost",type:"button",onclick:()=>v()?.(!c()),class:"flex items-center gap-1.5 ml-3 shrink-0 cursor-pointer",children:(Qt,Vn)=>{var Yn=nD(),Gr=ce(Yn);Tp(Gr,{get checked(){return c()},class:"-mb-0.5",onCheckedChange:ps=>v()?.(ps)});var hs=R(Gr,2),zt=re(hs,!0);L(ps=>B(zt,ps),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),k(Qt,Yn)},$$slots:{default:!0}})};V(at,rt=>{typeof v()=="function"&&rt(Bt)})}L(()=>{B(yt,l(ge)),B(Ye,f().branch||"main")}),k(le,ot)},tn=le=>{js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(Z)},triggerValueClass:H,triggerContentClass:"gap-1.5",showTriggerChevron:!0,triggerChevronClass:oe})},es=le=>{var ot=Mm(),At=ce(ot);{var Zt=We=>{var Pt=Mc(),Ye=ce(Pt);Ba(Ye,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var ze=R(Ye,2);{var pt=at=>{var Bt=si(),rt=re(Bt,!0);L(()=>B(rt,l(me)[0])),k(at,Bt)};V(ze,at=>{l(me)[0]&&at(pt)})}k(We,Pt)};V(At,We=>{l(K)||We(Zt)})}var Ve=R(At,2);{let We=w(()=>l(K)?H:W);js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get triggerSuffix(){return l(St)},get triggerValueClass(){return l(We)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=We=>{var Pt=si(),Ye=re(Pt,!0);L(()=>B(Ye,l(me)[1])),k(We,Pt)};V(ht,We=>{l(me)[1]&&We(Et)})}var qe=R(ht,2);{let We=w(()=>t()||""),Pt=w(()=>!t()),Ye=w(()=>l(K)?"w-full gap-1.5":void 0);ml(qe,{variant:"ghost",get triggerClass(){return l(se)},get value(){return r()},get repoPath(){return l(We)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(Pt)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(K)},triggerChevronClass:oe,get triggerContentClass(){return l(Ye)},onSkipIsolationChange:ze=>v()?.(ze),onGitHubAuthNeededChange:ze=>m()?.(ze),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Qe})}var yt=R(qe,2);{var Re=We=>{var Pt=si(),Ye=re(Pt,!0);L(()=>B(Ye,l(me)[2])),k(We,Pt)};V(yt,We=>{l(me)[2]&&We(Re)})}k(le,ot)};V(je,le=>{l(Q)?le(Tt):M()==="repo"?le(ee,1):M()==="branch"&&s()==="gitlab"?le(Ge,2):M()==="branch"?le(it,3):l(Ct)?G()&&s()==="local"?le(mt,5):u()?le(Mt,6):(s()==="github"&&a()||s()==="gitlab")&&l(K)?le(Ue,7):s()==="github"&&a()||s()==="gitlab"?le(Ke,8):s()==="remote"&&f()&&l(K)?le(Me,9):s()==="remote"&&f()?le(Xt,10):l(K)?le(tn,11):le(es,-1):le(Xe,4)})}return Y(Ne),L(()=>wt(Ne,1,Xn(l(Q)?"grid min-w-0 gap-1":l(we)))),k(n,Ne),Ot(he)}const oD=/^[\w.-]+\/[\w.-]+$/;function Tm(n){return n.replace(/[\\/]+$/,"")||n.slice(0,1)}function Em(n){let e=n.trim().toLowerCase();e=e.replace(/^[a-z+]+:\/\//,"").replace(/^[^@/]+@([^:/]+):/,"$1/"),e=e.replace(/^[^@/]+@/,""),e=e.replace(/\/+$/,"").replace(/\.git$/,"");const t=e.split("/").filter(Boolean);return t.length===2?`github.com/${t.join("/")}`:t.length===3&&t[0].includes(".")?t.join("/"):null}function m$(n){switch(n.type){case"github":{const e=n.githubUrl&&Em(n.githubUrl)||(n.path&&oD.test(n.path.trim())?Em(n.path):null);return e?`github:${e}`:null}case"local":{const e=n.path?.trim();return e?`local:${Tm(e)}`:null}case"remote":{const e=n.remote?.host?.trim().toLowerCase(),t=(n.remote?.workspacePath||n.path)?.trim();return e&&t?`remote:${e}:${Tm(t)}`:null}case"gitlab":{const e=n.gitlab?.instanceBaseUrl?.trim().toLowerCase().replace(/\/+$/,""),t=n.gitlab?.projectPath?.trim().toLowerCase().replace(/^\/+|\/+$/g,"");return e&&t?`gitlab:${e}/${t}`:null}}}function v$(n){const e=[],t=[];if(!n)return{files:e,folderFiles:t};const r=n.items;if(r&&r.length>0){let s=!1;for(const i of Array.from(r)){if(i.kind!=="file")continue;s=!0;const o=i.getAsFile();if(!o)continue;(typeof i.webkitGetAsEntry=="function"?i.webkitGetAsEntry():null)?.isDirectory?t.push(o):e.push(o)}if(s&&(e.length>0||t.length>0))return{files:e,folderFiles:t}}return{files:Array.from(n.files??[]),folderFiles:t}}const zd="data:",Am=";base64,";function aD(n){if(!n.startsWith(zd))return null;const e=n.indexOf(Am,zd.length);if(e===-1)return null;const t=n.slice(zd.length,e),r=n.slice(e+Am.length);return!t.startsWith("image/")||r.length===0?null:{mimeType:t,data:r}}const Rm=Ga("image-context-items");let lD=0;const b$=30*1024*1024,y$=10*1024*1024;function cD(n){if(n===0)return"0 Bytes";const e=1024,t=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(n)/Math.log(e));return Math.round(n/Math.pow(e,r)*100)/100+" "+t[r]}function uD(n){return new Promise((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(new Error("Failed to read file")),r.readAsDataURL(n)})}async function w$(n,e){const{maxBytes:t,readFile:r=uD,signal:s}=e,i=[],o=[];for(const a of n){if(s?.aborted)return[];if(a.size>t){o.push(a.name);continue}try{const c=await r(a);if(s?.aborted)return[];const u=aD(c);if(!u)throw new Error("Invalid data URL format");const{mimeType:d,data:f}=u,h=Date.now(),p=a.name||U1(d,`image-${h}`);i.push({id:`file-upload-${h}-${++lD}-${p}`,type:"file",label:p,description:`${d} • ${cD(a.size)}`,path:p,file:a,imageData:f,imageMimeType:d,...Um(d)?{}:{placementFileName:p}})}catch(c){if(s?.aborted)return[];Rm.error("Failed to add image to context",{fileName:a.name,error:c}),_s.error(_.chat_richInput_addImageFailed_error({name:a.name}))}}return s?.aborted?[]:(i.length>0&&Rm.debug(`Added ${i.length} image(s) to context`),o.length>0&&_s.error(_.chat_richInput_filesTooLarge_error({names:o.join(", ")})),i)}var dD=N('<img class="w-full h-full object-cover"/>'),fD=N('<div class="flex size-full items-center justify-center bg-muted text-subtle"><!></div>'),hD=N("<div><!> <!></div> <!>",1),pD=N('<span class="tabular-nums opacity-70 shrink-0" data-testid="attachment-upload-progress"> </span>'),gD=N("<!> <!>",1),mD=N('<div class="w-4 h-4 rounded overflow-hidden shrink-0"><img class="w-full h-full object-cover"/></div>'),vD=N('<div><!> <span class="font-medium truncate max-w-30"> </span> <!> <!></div>');function bD(n,e){if(new.target)return Nt({component:bD,...n});Lt(e,!0);let t=y(e,"id",7),r=y(e,"name",7),s=y(e,"type",7,""),i=y(e,"size",7),o=y(e,"file",7),a=y(e,"imageData",7),c=y(e,"imageMimeType",7),u=y(e,"onRemove",7),d=y(e,"class",7,""),f=y(e,"variant",7,"chip"),h=y(e,"placementStatus",7,void 0),p=y(e,"placementProgress",7,void 0),g=y(e,"placementError",7,void 0),v=y(e,"onRetry",7),m=fe(null);const S=w(()=>Um(c()||s()||o()?.type));let I=fe(null);const C=w(()=>l(S)?a()&&c()?`data:${ad(c())};base64,${a()}`:l(I):null);ft(()=>{if(l(S)&&!(a()&&c())&&o()){const q=URL.createObjectURL(o());return x(I,q,!0),()=>URL.revokeObjectURL(q)}x(I,null)});const M=w(()=>{if(s()==="folder")return Js;const q=ad(s()||c()||o()?.type);return q.startsWith("image")?Dc:q.includes("javascript")||q.includes("typescript")||q.includes("json")?Wd:q.includes("text")||q.includes("markdown")?Ff:Fo}),O=w(()=>ad(s()||c()||o()?.type).startsWith("image")),P=w(()=>{if(h()!=="failed")return;const q=_.chat_attachmentPreview_placementFailed_tooltip({name:r()});return g()?`${q} — ${g()}`:q}),E=w(()=>{if(h()!=="placing"||p()===void 0)return;const q=Math.max(0,Math.min(1,p()));return Lm(q,{style:"percent",maximumFractionDigits:0})});let z=fe(!1),G=fe(null);function J(){f()==="thumbnail"&&l(O)&&l(C)&&x(z,!0)}function K(q){(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),J())}function Q(q){q.stopPropagation(),u()?.(t())}var $={get id(){return t()},set id(q){t(q),b()},get name(){return r()},set name(q){r(q),b()},get type(){return s()},set type(q=""){s(q),b()},get size(){return i()},set size(q){i(q),b()},get file(){return o()},set file(q){o(q),b()},get imageData(){return a()},set imageData(q){a(q),b()},get imageMimeType(){return c()},set imageMimeType(q){c(q),b()},get onRemove(){return u()},set onRemove(q){u(q),b()},get class(){return d()},set class(q=""){d(q),b()},get variant(){return f()},set variant(q="chip"){f(q),b()},get placementStatus(){return h()},set placementStatus(q=void 0){h(q),b()},get placementProgress(){return p()},set placementProgress(q=void 0){p(q),b()},get placementError(){return g()},set placementError(q=void 0){g(q),b()},get onRetry(){return v()},set onRetry(q){v(q),b()},$set:Dt,$on:(q,j)=>$t(e,q,j)},X=Je(),de=ce(X);{var me=q=>{var j=hD(),ne=ce(j),we=te(ne);{let oe=w(()=>_.chat_attachmentPreview_viewFullSize_ariaLabel({name:r()})),H=w(()=>!l(C));Ze(we,{variant:"plain",wrapContent:!1,type:"button",class:"w-16 h-16 rounded-lg overflow-hidden cursor-pointer hover:opacity-90 transition-opacity",onclick:J,onkeydown:K,get"aria-label"(){return l(oe)},get title(){return r()},get disabled(){return l(H)},get ref(){return l(G)},set ref(W){x(G,W,!0)},children:(W,D)=>{var ae=Je(),ge=ce(ae);{var ue=ke=>{var ye=dD();L(()=>{xt(ye,"src",l(C)),xt(ye,"alt",r())}),xo("error",ye,()=>x(m,l(C),!0)),Fd(ye),k(ke,ye)},pe=ke=>{var ye=fD(),Z=te(ye);ut(Z,{get icon(){return Dc},size:"15"}),Y(ye),k(ke,ye)};V(ge,ke=>{l(C)?ke(ue):ke(pe,-1)})}k(W,ae)},$$slots:{default:!0}})}var be=R(we,2);{var Se=oe=>{{let H=w(()=>_.chat_attachmentPreview_remove_ariaLabel({name:r()}));Ze(oe,{variant:"ghost",size:"icon-xs",class:"absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity duration-spring-fast ease-spring-fast motion-reduce:transition-none bg-background/80 hover:bg-background shadow-sm",onclick:Q,get"aria-label"(){return l(H)},children:(W,D)=>{ut(W,{get icon(){return Fi},size:"10"})},$$slots:{default:!0}})}};V(be,oe=>{u()&&oe(Se)})}Y(ne);var se=R(ne,2);{let oe=w(()=>l(C)??"");bv(se,{get imageUrl(){return l(oe)},get imageName(){return r()},get openerElement(){return l(G)},get open(){return l(z)},set open(H){x(z,H,!0)}})}L(()=>wt(ne,1,`relative group shrink-0 ${d()??""}`)),Ss(1,ne,()=>Ud,()=>({tier:"moderate",y:0,scale:.9})),Ss(2,ne,()=>Vd,()=>({tier:"fast"})),k(q,j)},ie=q=>{var j=vD(),ne=te(j);{var we=ue=>{var pe=gD(),ke=ce(pe);li(ke,{size:15,class:"opacity-50 shrink-0"});var ye=R(ke,2);{var Z=$e=>{var lt=pD(),St=re(lt,!0);L(()=>B(St,l(E))),k($e,lt)};V(ye,$e=>{l(E)!==void 0&&$e(Z)})}k(ue,pe)},be=ue=>{ut(ue,{get icon(){return Om},size:"15",class:"shrink-0"})},Se=ue=>{var pe=mD(),ke=re(pe);L(()=>{xt(ke,"src",l(C)),xt(ke,"alt",r())}),xo("error",ke,()=>x(m,l(C),!0)),Fd(ke),k(ue,pe)},se=ue=>{ut(ue,{get icon(){return l(M)},size:"15",class:"opacity-30 shrink-0"})};V(ne,ue=>{h()==="placing"?ue(we):h()==="failed"?ue(be,1):l(O)&&l(C)&&l(m)!==l(C)?ue(Se,2):ue(se,-1)})}var oe=R(ne,2),H=re(oe,!0),W=R(oe,2);{var D=ue=>{{let pe=w(()=>_.chat_attachmentPreview_retryPlacement_ariaLabel({name:r()}));Ze(ue,{variant:"ghost-light",size:"icon-xs",class:"shrink-0 -my-1",onclick:ke=>{ke.stopPropagation(),v()(t())},get"aria-label"(){return l(pe)},"data-testid":"attachment-retry",children:(ke,ye)=>{ut(ke,{get icon(){return Bf},size:"10"})},$$slots:{default:!0}})}};V(W,ue=>{h()==="failed"&&v()&&ue(D)})}var ae=R(W,2);{var ge=ue=>{{let pe=w(()=>h()==="failed"?"":"opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),ke=w(()=>_.chat_attachmentPreview_removeAttachment_ariaLabel());Ze(ue,{variant:"ghost-light",size:"icon-xs",get class(){return`shrink-0 ${l(pe)??""} transition-opacity duration-spring-fast ease-spring-fast motion-reduce:transition-none -my-1 -mr-1`},onclick:()=>u()(t()),get"aria-label"(){return l(ke)},children:(ye,Z)=>{ut(ye,{get icon(){return Fi},size:"10"})},$$slots:{default:!0}})}};V(ae,ue=>{u()&&ue(ge)})}Y(j),L(()=>{wt(j,1,`flex items-center gap-1.5 px-2 py-0.5 rounded text-xs whitespace-nowrap group shrink-0 ${h()==="failed"?"bg-danger-background/10 text-danger border border-danger/40":"bg-muted/70 text-subtle"} ${d()??""}`),xt(j,"data-placement-status",h()),xt(j,"title",l(P)),B(H,r())}),Ss(1,j,()=>Ud,()=>({tier:"moderate",y:0,scale:.9})),Ss(2,j,()=>Vd,()=>({tier:"fast"})),k(q,j)};V(de,q=>{f()==="thumbnail"&&l(O)&&l(S)&&(!l(C)||l(m)!==l(C))?q(me):q(ie,-1)})}return k(n,X),Ot($)}export{Zf as $,uv as A,ml as B,DE as C,aa as D,xE as E,_e as F,uo as G,If as H,y$ as I,Dn as J,nv as K,iD as L,la as M,p0 as N,th as O,$_ as P,RS as Q,b$ as R,jt as S,i_ as T,He as U,Vh as V,av as W,rR as X,sR as Y,et as Z,NL as _,t$ as a,Zv as a0,eh as a1,Fc as a2,yv as a3,vv as a4,m$ as a5,r$ as a6,hn as a7,SI as a8,f$ as a9,Ca as aA,o$ as aB,a$ as aC,WO as aD,c$ as aE,eN as aF,ZO as aG,YO as aH,GO as aI,JO as aJ,XO as aK,qO as aL,l$ as aM,g$ as aN,O_ as aO,VO as aP,v$ as aQ,gP as aR,fP as aS,GR as aT,qR as aU,l_ as aV,Qd as aW,Jd as aX,ZD as aY,Ka as aZ,i$ as aa,p$ as ab,u$ as ac,$2 as ad,fv as ae,cD as af,e$ as ag,Jk as ah,Ep as ai,Zk as aj,zc as ak,ct as al,aL as am,sa as an,s$ as ao,Ch as ap,Mh as aq,w$ as ar,h$ as as,ZP as at,n$ as au,Yb as av,hv as aw,pn as ax,aD as ay,Au as az,bD as b,zE as c,FP as d,Pf as e,LI as f,Rr as g,Yt as h,DL as i,zn as j,P0 as k,lv as l,nh as m,mv as n,bv as o,I0 as p,tc as q,rh as r,wv as s,ov as t,pr as u,vt as v,SE as w,ju as x,_P as y,kn as z};
166
+ `,textSerializers:mt(A)}).replace(/\u00A0/g," ")}function Ue(A){return Mt(A,A.state.doc.content.size)}function Ke(A){return Mt(A,A.state.selection.from)}function Me(A,ve){const Ee=Ue(A),gt=PL(Ee,Ke(A).length);(!gt||gt.from!==l(Be)?.from)&&(x(he,null),x(Ne,null)),x(Be,gt,!0),gt&&ve?.dismissNewContext&&x(he,l(it),!0)}function Xt(){x(Ne,l(Be)?.from??null,!0)}function tn(A){A.preventDefault()}function es(A){if(!l(Z)||!l(Be))return;const ve=Ue(l(Z)),Ee=Ke(l(Z)).length,gt={from:l(Z).state.selection.from-l(Be).query.length-1,to:l(Z).state.selection.from+l(Be).to-Ee},Ie=l(Be).to===ve.length||!/^\s/u.test(ve.slice(l(Be).to)),xe=[{type:"skillCommand",attrs:{name:A.name}},...Ie?[{type:"text",text:" "}]:[]];l(Z).chain().focus().insertContentAt(gt,xe).setTextSelection(gt.from+2).run()}function le(A){const ve=vL(A,$().map(Ee=>Ee.name));return ne()?GP(ve,ne()):ve}function ot(A){if(!l(Xe)||!l(je))return!1;const ve=!A.shiftKey&&!A.metaKey&&!A.ctrlKey&&!A.altKey&&["ArrowUp","ArrowDown","Enter"].includes(A.key);return A.key!=="Escape"&&!ve?!1:l(je).onKeyDown({event:A})?!0:A.key==="Enter"?(A.preventDefault(),!0):!1}function At(){l(Z)&&l(Z).view&&l(Z).chain().focus().insertContent("@").run()}function Zt(A){return l(Z)&&l(Z).view?(l(Z).chain().focus().insertContent(A).run(),!0):!1}function Ve(){if(h())return!1;if(l(Z)&&l(Z).view)try{if(l(Z).view.hasFocus())return!0;const A=l(Z),ve=document.activeElement;return requestAnimationFrame(()=>{if(l(Z)!==A||A.isDestroyed||h()||A.view.hasFocus())return;const Ee=document.activeElement;Ee!==ve&&Ee instanceof HTMLElement&&Jm(Ee)&&!A.view.dom.contains(Ee)||(A.view.focus(),A.commands.scrollIntoView())}),typeof l(Z).view.hasFocus=="function"?l(Z).view.hasFocus():!0}catch(A){s.debug("[TipTapEditor] Editor not ready for focus:",A)}return!1}function ht(){if(h())return!1;if(l(Z)&&l(Z).view)try{return l(Z).chain().focus("end").run(),!0}catch(A){s.debug("[TipTapEditor] Editor not ready for focusEnd:",A)}return!1}function Et(){if(h())return!1;if(l(Z)&&l(Z).view)try{return l(Z).chain().focus().selectAll().run(),!0}catch(A){s.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",A)}return!1}function qe(){try{return l(Z)?.getHTML?.()??""}catch(A){return s.error("[TipTapEditor] Error getting HTML:",A),l(Z)?.getText?.()??""}}function yt(){l(Z)&&(bt=!0,l(Z).commands.clearContent(!0),bt=!1)}async function Re(A){if(!l(Z))return;const ve=le(A||"");Yc(ve,l(Z).schema).eq(l(Z).state.doc)||l(Z).chain().command(({tr:Ee})=>(Ee.setMeta("external-update",!0),!0)).setContent(ve).run()}function We(A,ve){l(Z)&&l(Z).view&&l(Z).chain().focus().setImage({src:A,alt:ve||""}).createParagraphNear().focus().run()}function Pt(){if(!l(Z))return s.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const A=[];return l(Z).state.doc.descendants(ve=>{if(ve.type.name==="image"){const Ee=ve.attrs.src;Ee&&Ee.startsWith("data:")&&A.push({src:Ee,alt:ve.attrs.alt||void 0})}return!0}),s.debug("TipTapEditor: Extracted inline images",{imageCount:A.length,imageSources:A.map(ve=>({alt:ve.alt,srcLength:ve.src?.length||0}))}),A}function Qe(){return Ma(l(Z))}function ze(A){if(s.debug("TipTapEditor: insertContextMention called",{hasEditor:!!l(Z),hasEditorView:!!l(Z)?.view,attrs:{itemType:A.itemType,identifier:A.identifier,title:A.title}}),l(Z)&&l(Z).view){const ve=l(Z).chain().focus().insertContextMention(A).run();return s.debug("TipTapEditor: insertContextMention result",{result:ve}),ve}return s.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function pt(A){if(!l(Z)||!l(Z).view)return s.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return l(Z).chain().focus().insertContent({type:"mention",attrs:{id:A.id,label:A.label,type:A.type,uri:A.uri,meta:A.meta||{}}}).insertContent(" ").run(),!0}catch(ve){return s.error("TipTapEditor: insertMention failed",ve),!1}}function at(){if(!l(Z))return s.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const A=[];return l(Z).state.doc.descendants(ve=>(ve.type.name==="mention"&&A.push({id:ve.attrs.id,label:ve.attrs.label,type:ve.attrs.type||"file",uri:ve.attrs.uri||"",meta:ve.attrs.meta||{}}),!0)),s.debug("TipTapEditor: Extracted mentions",{mentionCount:A.length,types:A.map(ve=>ve.type)}),A}function Bt(){if(!l(Z))return s.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const A=[];return l(Z).state.doc.descendants(ve=>{if(ve.type.name==="contextMention"){const Ee=ve.attrs;A.push({itemType:Ee.itemType,provider:Ee.provider,title:Ee.title,url:Ee.url,identifier:Ee.identifier,contextId:Ee.contextId,description:Ee.description,metadata:Ee.metadata})}return!0}),s.debug("TipTapEditor: Extracted context mentions",{mentionCount:A.length}),A}const rt={char:"@",pluginKey:new Dn("mention"),items:async({query:A})=>{if(s.debug("Mention query:",A),z()?.(A),!v()&&m()){s.debug("No workspace but repoPath available, using async search:",m());const Ee={workspaceId:void 0,repoPath:m(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const gt=await i.search(A,Ee);return s.debug("Mention search results from repoPath:",gt.length),gt}catch(gt){s.error("Failed to search mentions with repoPath:",gt);const Ie=i.searchSync(A,Ee);return s.debug("Fallback sync search results:",Ie.length),Ie}}if(!v())return s.debug("No workspace and no repoPath - returning empty results"),[];const ve={workspaceId:v().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Ee=await i.search(A,ve);return s.debug("Mention search results:",Ee.length),Ee}catch(Ee){return s.error("Failed to search mentions:",Ee),[]}},render:()=>SI(ge),command:({editor:A,range:ve,props:Ee})=>{const gt={id:Ee.id,label:Ee.label,type:Ee.type,uri:Ee.uri,meta:Ee.meta||{}};A.view&&A.chain().focus().deleteRange(ve).insertContent({type:"mention",attrs:gt}).run(),G()?.(Ee)}};Lf(()=>{let A=!1;return(async()=>{const ve=le(o()||"");if(A)return;const Ee=l(ye);if(!Ee)return;x(Z,new xE({element:Ee,extensions:[...ne()?[KP.configure({references:()=>ne()??[]}),jP]:[],GR.configure({heading:!1,codeBlock:!1,horizontalRule:!1,link:!1,bulletList:!1,orderedList:!1,listItem:!1,code:!1,bold:!1,italic:!1,strike:!1,blockquote:!1,dropcursor:!1}),M0({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:Ie=>/^https?:\/\//.test(Ie)||Ie.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),qR.configure({placeholder:u()?({editor:Ie})=>fo.getState(Ie.state)?.parts.length?"":c():c(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),gP.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),_P.configure({workspaceId:v()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:rt,renderHTML({node:Ie}){const xe=hv(Ie.attrs,v()?.id,l_);return["span",{"data-mention":"true","data-type":Ie.attrs.type||"file","data-uri":Ie.attrs.uri||"","data-meta":JSON.stringify(Ie.attrs.meta||{}),"data-id":Ie.attrs.id,"data-label":Ie.attrs.label,class:"mention-chip",tabindex:"0"},xe]},renderText:({node:Ie})=>{const xe=Ie.attrs||{};try{return pw({type:xe.type,id:xe.id,label:xe.label,meta:xe.meta})}catch{return`@${xe?.meta?.fullPath||xe?.meta?.path||xe?.label||xe?.id||"item"}`}}}),FP.extend({renderText:({node:Ie})=>{const xe=Ie.attrs||{},on=JSON.stringify({provider:xe.provider||"browser",identifier:xe.identifier||"",title:xe.title||"",url:xe.url||"",description:xe.description||"",metadata:xe.metadata||"",itemType:xe.itemType||""});return`@context[${btoa(unescape(encodeURIComponent(on)))}]`}}),WP,QP,_L],content:ve,editable:l(pe),enableCoreExtensions:{delete:!1},onCreate:({editor:Ie})=>{Me(Ie),S()&&requestAnimationFrame(()=>{if(Ie.isDestroyed)return;Ie.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:Ie})=>{Ie.docChanged&&De&&Le&&(io(De),Ye?.(),Ye=void 0,Le.remove(),De=null,Le=null)},onUpdate:({editor:Ie,transaction:xe})=>{if(xe.getMeta("external-update")||xe.getMeta(Wh)||bt)return;const on=W()?YP(xe):null;on&&W()?.(on);const gn=Ma(Ie);Me(Ie,{dismissNewContext:xe.getMeta("uiEvent")==="paste"}),xe.getMeta(Gu)?I()?.(gn,{programmatic:!0}):I()?.(gn)},onSelectionUpdate:({editor:Ie,transaction:xe})=>{Me(Ie,{dismissNewContext:xe.getMeta("uiEvent")==="paste"});const{from:on,to:gn,empty:Fe}=Ie.state.selection;if(Fe)J()?.(null);else{const Gt=Ie.state.doc.textBetween(on,gn," ");J()?.(Gt.trim()||null)}},onFocus:({editor:Ie})=>{ii(()=>{x(sn,!0),Me(Ie)})},onBlur:()=>{ii(()=>{x(sn,!1)})},editorProps:{handleDOMEvents:{compositionstart:()=>(ii(()=>{x($e,!0)}),oe()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!l(Z)||l(Z).isDestroyed||(ii(()=>{x($e,!1)}),oe()?.(!1),St())})}),!1),beforeinput:()=>(H()?.(),!1)},attributes:{class:`tiptap-editor ${g()}`,role:"textbox","aria-multiline":"true","aria-label":a(),autocomplete:"off",spellcheck:"false",autocorrect:"off",autocapitalize:"off"},handlePaste:(Ie,xe)=>{if(eI(xe))return!0;const on=xe.clipboardData?.getData("text/plain");if(on){const gn=on.split(`
167
+ `);if(gn.length>=5){const{state:Fe,dispatch:Gt}=Ie,_n=Fe.schema.nodes.pasteChip.create({content:on,lineCount:gn.length}),Sn=Fe.tr.replaceSelectionWith(_n).setMeta("uiEvent","paste");return Gt(Sn),!0}if(/\r|\n/.test(on)){const{state:Fe,dispatch:Gt}=Ie,_n=bL(Fe.schema,on);if(_n.length>0){const Sn=new He(_e.from(_n),1,1);return Gt(Fe.tr.replaceSelection(Sn).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(Ie,xe)=>ZP(xe),handleKeyDown:(Ie,xe)=>{if(Ie.composing||xe.isComposing||xe.keyCode===229)return!1;if(ot(xe))return!0;if(xe.key==="Escape"&&O())return xe.preventDefault(),O()(),!0;const on=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),gn=Fe=>fk(xe,zc(Fe),on);if(gn("chat.mention-context")&&zc("chat.mention-context")!=="@")return xe.preventDefault(),l(Z)?.chain().focus().insertContent("@").run(),!0;if(on&&xe.ctrlKey&&!xe.metaKey){if(xe.key==="a"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,Sn=Fe.selection.$head.start();return Gt(Fe.tr.setSelection(et.create(Fe.doc,Sn))),!0}if(xe.key==="e"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,Sn=Fe.selection.$head.end();return Gt(Fe.tr.setSelection(et.create(Fe.doc,Sn))),!0}if(xe.key==="k"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,_n=Fe.selection.$head,Sn=_n.pos,gs=_n.end();return Sn<gs&&Gt(Fe.tr.delete(Sn,gs)),!0}if(xe.key==="p"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","backward","line"),!0}if(xe.key==="n"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","forward","line"),!0}if(xe.key==="f"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","forward","character"),!0}if(xe.key==="b"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify("move","backward","character"),!0}}if(xe.metaKey&&!xe.ctrlKey&&!xe.altKey){if(xe.key==="ArrowLeft"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify(xe.shiftKey?"extend":"move","backward","lineboundary"),!0}if(xe.key==="ArrowRight"){xe.preventDefault();const Fe=window.getSelection();return Fe&&Fe.rangeCount>0&&Fe.modify(xe.shiftKey?"extend":"move","forward","lineboundary"),!0}if(xe.key==="ArrowUp"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,_n=1;if(xe.shiftKey){const{from:Sn}=Fe.selection;Gt(Fe.tr.setSelection(et.create(Fe.doc,_n,Sn)))}else Gt(Fe.tr.setSelection(et.create(Fe.doc,_n)));return!0}if(xe.key==="ArrowDown"){xe.preventDefault();const{state:Fe,dispatch:Gt}=Ie,_n=Fe.doc.content.size-1;if(xe.shiftKey){const{to:Sn}=Fe.selection;Gt(Fe.tr.setSelection(et.create(Fe.doc,Sn,_n)))}else Gt(Fe.tr.setSelection(et.create(Fe.doc,_n)));return!0}}if(gn("chat.force-send"))return xe.preventDefault(),M()?.(),!0;if(gn("chat.new-line"))return xe.preventDefault(),l(Z)?.chain().setHardBreak().scrollIntoView().run(),!0;if(xe.key==="ArrowUp"&&P()&&!xe.shiftKey&&!xe.metaKey&&!xe.ctrlKey){if(rt.pluginKey.getState(Ie.state)?.active)return!1;const{state:Gt}=Ie,{from:_n}=Gt.selection,Sn=_n<=1,gs=Gt.doc.textContent.length===0;if(Sn||gs){const Bs=P()();if(Bs!==null)return xe.preventDefault(),l(Z)?.chain().setContent(le(Bs)).focus("end").run(),I()?.(Bs),!0}}if(xe.key==="ArrowDown"&&E()&&!xe.shiftKey&&!xe.metaKey&&!xe.ctrlKey){if(rt.pluginKey.getState(Ie.state)?.active)return!1;const{state:Gt}=Ie,{to:_n}=Gt.selection,Sn=Gt.doc.content.size-1,gs=_n>=Sn,Bs=Gt.doc.textContent.length===0;if(gs||Bs){const di=E()();if(di!==null)return xe.preventDefault(),l(Z)?.chain().setContent(le(di)).focus("end").run(),I()?.(di),!0}}return gn("chat.send")?rt.pluginKey.getState(Ie.state)?.active?!1:C()?(xe.preventDefault(),C()(),!0):!1:!1}}}),!0),Ee.addEventListener("mouseover",Yt),Ee.addEventListener("mouseout",Vn),Ee.addEventListener("click",Gr),l(Z).view.dom.addEventListener("keydown",hs)})(),()=>{A=!0}});function Yt(A){const ve=A.target,Ee=gp(ve);if(Ee){const gt=ve.getBoundingClientRect();if(!Le){Le=document.createElement("div"),(ge?.target()??document.body).appendChild(Le);const Ie=Ee.type||"file",xe=Ee.label||ve.textContent||"",on={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};De=vl(w0,{target:Le,props:{mention:{id:Ee.id,type:Ie,label:xe,uri:Ee.uri,meta:Ee.meta,icon:on[Ie]||"📄"},position:{x:gt.left,y:gt.bottom+5},onClose:()=>{De&&Le&&(io(De),Ye?.(),Ye=void 0,Le.remove(),De=null,Le=null)}}});const gn=Le.firstElementChild;gn instanceof HTMLElement&&(Ye=ge?.register(gn,Ct)),Le.addEventListener("mouseout",Qn)}}}function Vn(A){const ve=A.target;A.relatedTarget?.closest(".mention-hover-preview")||ve.hasAttribute("data-mention")&&De&&Le&&(io(De),Ye?.(),Ye=void 0,Le.remove(),De=null,Le=null)}function Qn(A){A.relatedTarget?.closest("[data-mention]")||De&&Le&&(io(De),Ye?.(),Ye=void 0,Le.remove(),De=null,Le=null)}async function Gr(A){const ve=gp(A.target);if(ve&&ve.type!=="member"){if(ve.intentUrl){A.preventDefault(),A.stopPropagation();const{handleIntentLink:Ee}=await cs(async()=>{const{handleIntentLink:gt}=await import("./Bn-4GS40.js");return{handleIntentLink:gt}},__vite__mapDeps([47,1,2,48,4,5,6,0,3,7,8,9,10,11,12,24,45,14,15,16,17,49,21,50,51,20,22,23,44,30]),import.meta.url);await Ee(ve.intentUrl);return}if(ve.type==="note"&&ve.note){if(A.preventDefault(),A.stopPropagation(),ve.note.workspaceId){const{handleIntentLink:Ee}=await cs(async()=>{const{handleIntentLink:gt}=await import("./Bn-4GS40.js");return{handleIntentLink:gt}},__vite__mapDeps([47,1,2,48,4,5,6,0,3,7,8,9,10,11,12,24,45,14,15,16,17,49,21,50,51,20,22,23,44,30]),import.meta.url);await Ee(gw(ve.note.id,ve.note.workspaceId))}else{const{navigateToNote:Ee}=await cs(async()=>{const{navigateToNote:gt}=await import("./D5XrjD_m.js").then(Ie=>Ie.h);return{navigateToNote:gt}},__vite__mapDeps([52,26,2,53,54,36,20,11,5,1,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24,30,42,55]),import.meta.url);await Ee(ve.note.id)}return}if(ve.type==="file"&&ve.filePath){A.preventDefault(),A.stopPropagation();const{navigateToFile:Ee}=await cs(async()=>{const{navigateToFile:gt}=await import("./D5XrjD_m.js").then(Ie=>Ie.h);return{navigateToFile:gt}},__vite__mapDeps([52,26,2,53,54,36,20,11,5,1,14,15,16,17,3,9,21,8,4,6,22,0,7,10,12,23,24,30,42,55]),import.meta.url);await Ee(ve.filePath);return}}}function hs(A){if(!A.metaKey||A.ctrlKey||A.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(A.key)||!l(Z))return;const{state:ve,dispatch:Ee}=l(Z).view;if(A.key==="ArrowLeft"){A.preventDefault(),A.stopPropagation();const gt=window.getSelection();gt&&gt.rangeCount>0&&gt.modify(A.shiftKey?"extend":"move","backward","lineboundary")}else if(A.key==="ArrowRight"){A.preventDefault(),A.stopPropagation();const gt=window.getSelection();gt&&gt.rangeCount>0&&gt.modify(A.shiftKey?"extend":"move","forward","lineboundary")}else if(A.key==="ArrowUp"){A.preventDefault(),A.stopPropagation();const gt=1;if(A.shiftKey){const{from:Ie}=ve.selection;Ee(ve.tr.setSelection(et.create(ve.doc,gt,Ie)).scrollIntoView())}else Ee(ve.tr.setSelection(et.create(ve.doc,gt)).scrollIntoView())}else if(A.key==="ArrowDown"){A.preventDefault(),A.stopPropagation();const gt=ve.doc.content.size-1;if(A.shiftKey){const{to:Ie}=ve.selection;Ee(ve.tr.setSelection(et.create(ve.doc,Ie,gt)).scrollIntoView())}else Ee(ve.tr.setSelection(et.create(ve.doc,gt)).scrollIntoView())}}ql(()=>{l(Z)&&(l(Z).view.dom.removeEventListener("keydown",hs),l(Z).destroy()),l(ye)&&(l(ye).removeEventListener("mouseover",Yt),l(ye).removeEventListener("mouseout",Vn),l(ye).removeEventListener("click",Gr)),Le&&Le.removeEventListener("mouseout",Qn),De&&Le&&(io(De),Ye?.(),Ye=void 0,Le.remove())});let zt=0;ft(()=>{if(!l(Z))return;const A=Ma(l(Z));if(o()===A)return;if(l(Z).view.hasFocus()){zt+=1;return}const ve=l(Z).view.hasFocus(),{from:Ee}=l(Z).state.selection,gt=++zt;(async()=>{const Ie=le(o()||"");!l(Z)||gt!==zt||Ma(l(Z))===A&&l(Z).chain().command(({tr:xe})=>(xe.setMeta("external-update",!0),!0)).setContent(Ie).command(({tr:xe,state:on})=>{if(ve)try{const gn=on.doc.content.size,Fe=Math.min(Ee,gn);xe.setSelection(et.create(on.doc,Fe,Fe))}catch{}return!0}).run()})()}),ft(()=>{l(Z)&&l(Z).setEditable(l(pe),!1)}),ft(()=>{!l(Z)||l(Z).isDestroyed||l(Z).view.dispatch(l(Z).state.tr.setMeta(gl,Y()))}),ft(()=>{const A=l(Z)?.view.dom;A&&(A.setAttribute("aria-haspopup","listbox"),l(Xe)&&l(ee)?(A.setAttribute("aria-controls",Tt),A.setAttribute("aria-activedescendant",l(ee))):(A.removeAttribute("aria-controls"),A.removeAttribute("aria-activedescendant")))});var ps={flushScreenEvidence:St,insertAtSymbol:At,insertText:Zt,focus:Ve,focusEnd:ht,focusAndSelectAll:Et,getHTML:qe,clear:yt,setContent:Re,insertImage:We,getInlineImages:Pt,getTextContent:Qe,insertContextMention:ze,insertMention:pt,getMentions:at,getContextMentions:Bt,get value(){return o()},set value(A=""){o(A),b()},get ariaLabel(){return a()},set ariaLabel(A=_.chat_richInput_editor_ariaLabel()){a(A),b()},get placeholder(){return c()},set placeholder(A=_.chat_richInput_askAnything_placeholder()){c(A),b()},get reactivePlaceholder(){return u()},set reactivePlaceholder(A=!1){u(A),b()},get disabled(){return d()},set disabled(A=!1){d(A),b()},get editableWhileDisabled(){return f()},set editableWhileDisabled(A=!1){f(A),b()},get inputLocked(){return h()},set inputLocked(A=!1){h(A),b()},get class(){return p()},set class(A=""){p(A),b()},get editorClassName(){return g()},set editorClassName(A=""){g(A),b()},get workspace(){return v()},set workspace(A){v(A),b()},get repoPath(){return m()},set repoPath(A){m(A),b()},get autoFocus(){return S()},set autoFocus(A=!1){S(A),b()},get onUpdate(){return I()},set onUpdate(A){I(A),b()},get onSubmit(){return C()},set onSubmit(A){C(A),b()},get onForceSubmit(){return M()},set onForceSubmit(A){M(A),b()},get onEscape(){return O()},set onEscape(A){O(A),b()},get onHistoryPrev(){return P()},set onHistoryPrev(A){P(A),b()},get onHistoryNext(){return E()},set onHistoryNext(A){E(A),b()},get onMentionStart(){return z()},set onMentionStart(A){z(A),b()},get onMentionSelect(){return G()},set onMentionSelect(A){G(A),b()},get onSelectionChange(){return J()},set onSelectionChange(A){J(A),b()},get contextItems(){return K()},set contextItems(A=[]){K(A),b()},get trailingHint(){return Y()},set trailingHint(A=null){Y(A),b()},get skills(){return $()},set skills(A=[]){$(A),b()},get skillsLoading(){return X()},set skillsLoading(A=!1){X(A),b()},get skillsError(){return de()},set skillsError(A=null){de(A),b()},get onSkillsRetry(){return me()},set onSkillsRetry(A){me(A),b()},get slashEmptyLabel(){return ie()},set slashEmptyLabel(A){ie(A),b()},get slashNotice(){return q()},set slashNotice(A){q(A),b()},get unavailableSkillTitle(){return j()},set unavailableSkillTitle(A){j(A),b()},get screenReferences(){return ne()},set screenReferences(A){ne(A),b()},get screenInsertions(){return we()},set screenInsertions(A=[]){we(A),b()},get screenInterim(){return be()},set screenInterim(A=[]){be(A),b()},get screenSpeechActive(){return Se()},set screenSpeechActive(A=!1){Se(A),b()},get onScreenInsertionApplied(){return se()},set onScreenInsertionApplied(A){se(A),b()},get onCompositionChange(){return oe()},set onCompositionChange(A){oe(A),b()},get onUserTextInput(){return H()},set onUserTextInput(A){H(A),b()},get onScreenReferencesEdited(){return W()},set onScreenReferencesEdited(A){W(A),b()},get minHeight(){return D()},set minHeight(A=80){D(A),b()},get maxHeight(){return ae()},set maxHeight(A=300){ae(A),b()},$set:Dt,$on:(A,ve)=>$t(e,A,ve)},bn=OL(),$s=te(bn),ji=()=>l(Xe),Ys=A=>!A&&Xt();Rt($s,()=>Vx,(A,ve)=>{ve(A,{get open(){return ji()},set open(Ee){Ys(Ee)},children:(Ee,gt)=>{var Ie=Je(),xe=ce(Ie);{let on=w(()=>ge?.target());Rt(xe,()=>Vm,(gn,Fe)=>{Fe(gn,{get to(){return l(on)},children:(Gt,_n)=>{var Sn=Je(),gs=ce(Sn);{let Bs=w(()=>l(ye)??null);Rt(gs,()=>Ux,(di,Eo)=>{Eo(di,{get customAnchor(){return l(Bs)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:tn,onCloseAutoFocus:tn,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return l(ue)},set ref(xi){x(ue,xi,!0)},children:(xi,ir)=>{Yn(T0(xi,{get listboxId(){return Tt},get items(){return l(Ge)},get loading(){return X()},get error(){return de()},get emptyLabel(){return ie()},get notice(){return q()},get onRetry(){return me()},onSelect:es,onDismiss:Xt,onActiveOptionChange:ts=>x(ee,ts,!0)}),ts=>x(je,ts,!0),()=>l(je))},$$slots:{default:!0}})})}k(Gt,Sn)},$$slots:{default:!0}})})}k(Ee,Ie)},$$slots:{default:!0}})});var To=R($s,2);let ca;return Yn(To,A=>x(ye,A),()=>l(ye)),Q(bn),L(()=>{ca=wt(To,1,`tiptap-container ${p()??""}`,"svelte-bv9i3d",ca,{"placeholder-suppressed":l(ke)}),Hi(To,`--tt-min-height:${D()}px;--tt-max-height:${ae()}px`)}),k(n,bn),Ot(ps)}class DL extends Error{constructor(t){super(t);nt(this,"reason");this.name="EnhancePromptUnavailableError",this.reason=t}}function $L(n){return"available"in n&&n.available===!1}function h$(n){return n==="auggie"}function BL(n,e,{model:t,workspaceId:r}){return{prompt:n,mode:e,...t?{model:t}:{},...r?{workspaceId:r}:{}}}async function p$(n,e={}){const t=await Wm("agent.enhancePrompt",BL(n,"enhance",e));if($L(t))throw new DL(t.reason);return t}function Kh(n,e){if(new.target)return Nt({component:Kh,...n});Lt(e,!0);let t=y(e,"size",7,16),r=y(e,"class",7,"");var s={get size(){return t()},set size(i=16){t(i),b()},get class(){return r()},set class(i=""){r(i),b()},$set:Dt,$on:(i,o)=>$t(e,i,o)};return f1(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Ot(s)}var zL=new Set(["$$slots","$$events","$$legacy","ref","pressed","disabled","size","class","onclick","title","ariaLabel","ariaDescribedby","onChange","children"]);function E0(n,e){if(new.target)return Nt({component:E0,...n});Lt(e,!0);let t=y(e,"ref",15,null),r=y(e,"pressed",15,!1),s=y(e,"disabled",7,!1),i=y(e,"size",7,"default"),o=y(e,"class",7),a=y(e,"onclick",7),c=y(e,"title",7),u=y(e,"ariaLabel",7),d=y(e,"ariaDescribedby",7),f=y(e,"onChange",7),h=y(e,"children",7),p=ui(e,zL);function g(C){r(C),f()?.(C),e.onPressedChange?.(C)}const v={default:"h-(--control-height-medium) px-2.5",sm:"h-(--control-height-small) px-2",lg:"h-(--control-height-large) px-3",xs:"h-(--control-height-small) px-2"};var m={get ref(){return t()},set ref(C=null){t(C),b()},get pressed(){return r()},set pressed(C=!1){r(C),b()},get disabled(){return s()},set disabled(C=!1){s(C),b()},get size(){return i()},set size(C="default"){i(C),b()},get class(){return o()},set class(C){o(C),b()},get onclick(){return a()},set onclick(C){a(C),b()},get title(){return c()},set title(C){c(C),b()},get ariaLabel(){return u()},set ariaLabel(C){u(C),b()},get ariaDescribedby(){return d()},set ariaDescribedby(C){d(C),b()},get onChange(){return f()},set onChange(C){f(C),b()},get children(){return h()},set children(C){h(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},S=Je(),I=ce(S);{let C=w(()=>br("type-caption inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap rounded-(--radius-medium) border border-border bg-muted text-muted-foreground transition-[background-color,color,box-shadow] duration-spring-fast ease-spring-fast data-[state=off]:hover:bg-hover data-[state=off]:active:bg-active disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-selected data-[state=on]:shadow-(--elevation-raised) data-[state=on]:text-foreground data-[state=on]:hover:bg-selected motion-reduce:transition-none",v[i()],o()));Rt(I,()=>iv,(M,O)=>{O(M,us({get"aria-label"(){return u()},get"aria-describedby"(){return d()},get disabled(){return s()},get title(){return c()},get onclick(){return a()},get class(){return l(C)}},()=>p,{onPressedChange:g,get ref(){return t()},set ref(P){t(P)},get pressed(){return r()},set pressed(P){r(P)},children:(P,E)=>{var z=Je(),G=ce(z);On(G,()=>h()??ls),k(P,z)},$$slots:{default:!0}}))})}return k(n,S),Ot(m)}var FL=N('<span class="ml-auto shrink-0"> </span>'),HL=N('<span><!></span> <span class="min-w-0 truncate"> </span> <!> <!>',1),UL=N('<div role="status"> </div>'),vm=N("<!> <!>",1),Ta=N("<span> </span>"),VL=N('<div><!> <!> <span class="truncate"> </span></div>'),WL=N('<span class="text-orange-500"> </span>'),KL=N('<span> </span> <span class="text-sm opacity-75 ml-1"> </span>',1),jL=N('<!> <span class="sr-only"> </span>',1),GL=N('<span class="w-1.5 h-1.5 ml-0.5 rounded-full bg-warning cursor-help"></span>'),qL=N('<div class="flex-0 flex flex-col"><!></div>'),JL=N('<div><!> <!> <span class="flex-1 text-left truncate min-w-0"><!></span> <!> <!></div>'),XL=N('<div class="shrink-0 px-3 pt-3 pb-2"><h2 class="type-body font-semibold text-foreground"> </h2> <p class="type-caption mt-0.5 text-subtle"> </p></div>'),YL=N('<div class="shrink-0 px-2 pb-2"><p class="type-caption px-3 pt-1 pb-1.5 font-medium text-subtle"> </p> <div><!> <span class="min-w-0 flex-1 truncate"> </span> <span class="shrink-0 text-subtle"> </span></div></div>'),QL=N('<!> <span class="flex-1 min-w-0"><span class="text-subtle"> </span> <strong class="text-foreground ml-1 truncate"> </strong></span>',1),ZL=N('<span class="first-line-icon text-sm"><svg class="w-5 h-5 text-ghost" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"></path></svg></span> <div class="flex-1 min-w-0"><p class="text-sm font-medium text-foreground"> </p> <p class="text-sm text-subtle"> </p></div>',1),eO=N('<div><span class="first-line-icon text-sm"><!></span> <div class="flex-1 min-w-0"><p class="text-sm font-medium text-foreground"> </p> <p class="text-sm text-subtle"> </p></div></div>'),tO=N('<div><div class="text-sm text-danger"> </div> <div class="text-sm text-subtle mt-1"> </div></div>'),nO=N('<div class="text-sm text-subtle mt-1"> </div>'),rO=N('<div role="alert"><div class="text-sm text-danger"> </div> <!></div>'),sO=N("<!> ",1),iO=N('<div class="flex shrink-0 flex-wrap items-center gap-1 border-t border-border bg-popover px-2 py-1.5"><!> <!></div>'),oO=N('<!> <div class="min-h-16 overflow-hidden flex flex-1 flex-col" data-testid="branch-results"><!> <!></div> <!>',1),aO=N('<p class="type-caption mt-2 pl-6.5 text-muted-foreground"> </p>'),lO=N('<div class="shrink-0 border-t border-border p-2"><div class="px-3 py-2.5"><!> <!></div></div>'),cO=N("<!> <div><!></div> <!>",1),uO=N('<div class="relative min-w-0"><!></div>');function ml(n,e){const t=Vi();if(new.target)return Nt({component:ml,...n});Lt(e,!0);const r=()=>rn(S,"$branchByRepo$",o),s=()=>rn(h,"$connection$",o),i=()=>rn(f,"$hostMember$",o),[o,a]=Jl(),c=U=>{{let Pe=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel()),Oe=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());Ze(U,{onclick:ve,variant:"ghost",size:"icon-sm",class:"shrink-0 text-muted-foreground",get disabled(){return l(ke)},get"aria-label"(){return l(Pe)},get tooltip(){return l(Oe)},children:(dt,Ut)=>{var en=Je(),Cn=ce(en);{var ln=st=>{li(st,{size:14})},Ae=st=>{ut(st,{get icon(){return hp},class:"size-3.5!"})};V(Cn,st=>{l(ke)?st(ln):st(Ae,-1)})}k(dt,en)},$$slots:{default:!0}})}},u=U=>{var Pe=Je(),Oe=ce(Pe);{var dt=en=>{uo(en,{size:16,get class(){return yr.icon}})},Ut=en=>{uo(en,{size:14,class:"text-subtle"})};V(Oe,en=>{K()?en(dt):en(Ut,-1)})}k(U,Pe)},d=(U,Pe=ls)=>{const Oe=w(()=>Eo(Pe()));var dt=vm(),Ut=ce(dt);{let ln=w(()=>_.ui_groupedCombobox_toggleGroup_ariaLabel({group:Pe().label})),Ae=w(()=>K()?`w-full justify-start gap-2 ${yr.group} h-auto`:"w-full justify-start gap-2 px-2 text-subtle");Ze(Ut,{variant:"ghost",size:"sm",wrapContent:!1,get"aria-expanded"(){return l(Oe)},get"data-branch-group"(){return Pe().key},get"aria-label"(){return l(ln)},get class(){return l(Ae)},onclick:()=>xi(Pe()),children:(st,yn)=>{var mn=HL(),Pn=ce(mn),ms=te(Pn);{let or=w(()=>`${K()?"size-4!":"size-3.5!"} shrink-0 ${l(Oe)?"":"-rotate-90"}`);ut(ms,{get icon(){return Da},get class(){return l(or)}})}Q(Pn);var vs=R(Pn,2),hi=re(vs,!0),bs=R(vs,2);{var Ao=or=>{Kx(or,{size:"compact",class:"rounded-full px-1.5 font-normal text-subtle",children:(zs,pi)=>{Ht();var ys=Vt();L(qi=>B(ys,qi),[()=>as(Pe().options.length)]),k(zs,ys)},$$slots:{default:!0}})};V(bs,or=>{Pe().key!=="remote"&&or(Ao)})}var ki=R(bs,2);{var Gi=or=>{var zs=FL(),pi=re(zs,!0);L(ys=>{xt(zs,"role",Pe().key==="remote"&&l(ae)?"status":void 0),B(pi,ys)},[()=>l(ae)?_.ui_combobox_loadingOptions_message():_.workspace_branchSelector_groupLoad_label()]),k(or,zs)};V(ki,or=>{Pe().key==="remote"&&(l(ae)||!l(ge)&&l(W).length===0)&&or(Gi)})}L(()=>{wt(Pn,1,`first-line-icon ${K()?"w-4":"w-3.5"}`),B(hi,Pe().label)}),k(st,mn)},$$slots:{default:!0}})}var en=R(Ut,2);{var Cn=ln=>{var Ae=UL(),st=re(Ae,!0);L(yn=>{wt(Ae,1,`type-caption py-2 pr-3 text-muted-foreground ${K()?"pl-8":"pl-6"}`),B(st,yn)},[()=>_.workspace_branchSelector_noRemoteBranches_label()]),k(ln,Ae)};V(en,ln=>{Pe().key==="remote"&&l(Oe)&&!l(ae)&&l(ge)&&Pe().options.length===0&&ln(Cn)})}k(U,dt)},f=Nf(),h=rd();let p=null;const g=Ga("BranchSelector"),v=Xf(),m=new Qf,S=_1();let I=y(e,"variant",7,"underline"),C=y(e,"value",7,""),M=y(e,"repoPath",7),O=y(e,"repoType",7),P=y(e,"githubUrl",7),E=y(e,"disabled",7,!1),z=y(e,"dropUp",7,!1),G=y(e,"portal",7,!0),J=y(e,"triggerClass",7),K=y(e,"rowLabel",7),Y=y(e,"hasTriggerIcon",7,!0),$=y(e,"description",7),X=y(e,"skipIsolation",7,!1),de=y(e,"suggestedBranch",7),me=y(e,"onSkipIsolationChange",7),ie=y(e,"onGitHubAuthNeededChange",7),q=y(e,"onBranchStatusChange",7),j=y(e,"onBranchesLoaded",7),ne=y(e,"onchange",7),we=y(e,"showUncommittedIndicator",7,!1),be=y(e,"showTriggerChevron",7,!1),Se=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),se=y(e,"triggerContentClass",7,"gap-0.75"),oe=fe(""),H=fe(Ar([])),W=fe(Ar([])),D=fe(!1),ae=fe(!1),ge=fe(!1),ue=fe(""),pe=fe(""),ke=fe(!1),ye=fe(null),Z=fe(""),$e=null,lt=fe(Ar([])),St=0,De=0,Le=null,Ye=fe(null),Ct=fe(!1),bt=fe(!1),sn=fe(void 0),Be=fe(null),he=fe(void 0),Ne=fe(void 0),je=fe(null),Tt=fe(void 0),ee=fe(void 0);const Ge=w(()=>O()==="local"&&typeof me()=="function"&&!!l(pe));let it=fe(void 0);ft(()=>{l(Ct)||(x(it,void 0),x(ee,void 0))}),ft(()=>{if(l(Ct))return ja(U=>{U.isComposing||Ys()})});let Xe=fe("none"),mt=fe(!1);const Mt=_.workspace_isolationMode_worktree_label(),Ue=w(()=>X()&&O()==="local");let Ke=fe(0),Me=fe(!1),Xt=fe(!1),tn=fe(null),es=null;ft(()=>{if(typeof ie()=="function"&&l(Xe)!==es){es=l(Xe);try{ie()(l(Xe))}catch(U){g.error("Error in onGitHubAuthNeededChange callback",U)}}});const le=w(()=>C()||l(oe)),ot=w(()=>l(le)===l(pe)&&l(pe)!=="");ft(()=>{if(!l(Ue)||!l(pe)||l(le)===l(pe))return;const U=l(pe);ii(()=>$s(U,{keepSkipIsolation:!0,keepOpen:!0}))});let At=null;ft(()=>{if(typeof q()=="function"&&l(le)){const U=l(Ke),Pe=l(Me),Oe=l(pe),dt=l(ot),Ut=l(Xt);if(At&&At.behind===U&&At.hasUncommittedChanges===Pe&&At.currentBranch===Oe&&At.isCurrentBranch===dt&&At.isLoading===Ut)return;const en={behind:U,hasUncommittedChanges:Pe,currentBranch:Oe,isCurrentBranch:dt,isLoading:Ut};At=en;try{q()(en)}catch(Cn){g.error("Error in onBranchStatusChange callback",Cn)}}});const Zt=new Map,Ve=300*1e3;let ht="",Et="local",qe,yt=null;const Re=150;let We=null,Pt=0;function Qe(){const U=rd.select(It.state);return U&&M()?{connection:U,repoPath:M(),repoType:O(),githubUrl:P(),generation:Pt,cacheKey:JSON.stringify([U,M(),O(),P()])}:null}function ze(U){return U.generation===Pt&&U.connection===rd.select(It.state)&&U.repoPath===M()&&U.repoType===O()&&U.githubUrl===P()}function pt(){yt&&(clearTimeout(yt),yt=null),We?.abort(),We=null}ql(()=>{Pt++,St++,pt(),$e&&clearTimeout($e)});function at(U){return ya.get("enableFormPersistence")&&r()[U]||""}let Bt="";ft(()=>{g.debug("Value prop effect triggered",{value:C(),repoPath:M(),internalSelectedBranch:l(oe)});const U=M()!==Bt;Bt=M(),C()?(g.debug("Setting internalSelectedBranch from value prop",{value:C()}),x(oe,C())):U&&(g.debug("Repo changed and value is empty, clearing internalSelectedBranch"),x(oe,""))});function rt(){pt(),x(ke,!0),x(ye,null),yt=setTimeout(()=>{yt=null,Qn()},Re)}ft(()=>{const U=s(),Pe=U!==p;p=U;const Oe=M(),dt=O(),Ut=P(),en=Oe!==ht,Cn=dt!==Et,ln=Ut!==qe;Pe&&Zt.clear();const Ae=Pe||en||Oe&&(Cn||ln);ht=Oe,Et=dt,qe=Ut,Ae&&(Pt++,pt(),Le=null,x(W,[],!0),x(D,!1),x(ae,!1),x(ge,!1),x(pe,""),x(Xe,"none"),St++,x(lt,[],!0),x(ye,null),ps(),A(),Oe&&U?(g.debug("Repo changed - resetting branch",{previousRepoPath:ht,currentRepoPath:Oe,previousInternalBranch:l(oe)}),x(oe,""),x(ue,""),x(H,[],!0),rt()):(x(H,[],!0),x(oe,""),x(ue,""),x(ke,!1)))});function Yt(){if(typeof j()=="function")try{j()({branches:[...l(H)],remoteBranches:[...l(W)],defaultBranch:l(ue),currentBranch:l(pe)})}catch(U){g.error("Error in onBranchesLoaded callback",U)}}function Vn(){if(C()){bn(C());return}const U=at(M());U&&(l(H).includes(U)||l(W).includes(U))?bn(U):l(ue)?bn(l(ue)):bn(l(H)[0])}async function Qn(){const U=Qe();if(!U){x(ke,!1);return}We&&We.abort();const Pe=new AbortController;We=Pe;const Oe=()=>!Pe.signal.aborted&&ze(U);g.debug("fetchBranches called",{repoPath:M(),repoType:O(),githubUrl:P()}),mp.start(`fetchBranches-${M()}`,{repoType:O(),githubUrl:P()});let dt=O(),Ut=P();if(M()&&M().includes("/")&&!M().startsWith("/")&&!M().startsWith("~")&&!M().startsWith(".")&&!M().includes(":\\")&&M().split("/").length===2&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(M())&&(dt="github",Ut||(Ut=`https://github.com/${M()}`,g.debug("Reconstructed GitHub URL from shorthand",{repoPath:M(),effectiveGithubUrl:Ut}))),ya.get("enableBranchCaching")){const Ae=Zt.get(U.cacheKey);if(Ae&&Date.now()-Ae.timestamp<Ve){if(x(H,Ae.branches,!0),x(W,Ae.remoteBranches||[],!0),x(ue,Ae.default,!0),x(pe,Ae.current||"",!0),dt==="github")Vn();else if(C())bn(C());else{const st=at(M());st&&(l(H).includes(st)||l(W).includes(st))?bn(st):l(pe)&&l(H).includes(l(pe))?bn(l(pe)):l(ue)&&l(H).includes(l(ue))?bn(l(ue)):l(H).length>0&&bn(l(H)[0])}if(!Oe())return;Yt(),x(ke,!1);return}}x(ke,!0),x(ye,null);let Cn=!1,ln=!1;try{if(ya.get("simulateSlowNetwork")&&await new Promise(Ae=>setTimeout(Ae,ya.get("networkDelay")||0)),!Oe())return;if(dt==="local"){const Ae=await xa.git.getBranches(U.repoPath,!0);if(!Oe())return;if(Ae){if(x(H,Ae.branches,!0),x(W,Ae.remoteBranches,!0),x(ue,Ae.defaultBranch||"",!0),x(pe,Ae.currentBranch||"",!0),C())bn(C());else{const st=at(M());st&&(l(H).includes(st)||l(W).includes(st))?bn(st):l(pe)&&l(H).includes(l(pe))?bn(l(pe)):l(ue)&&l(H).includes(l(ue))?bn(l(ue)):l(H).length>0&&bn(l(H)[0])}Cn=!0}else throw new Error("Failed to fetch branches")}else if(dt==="github"&&Ut){const Ae=Mp(Ut);if(!Ae)throw new Error("Invalid GitHub URL format");const{owner:st,repo:yn}=Ae;xa.integrations.githubBranchesCached(st,yn).then(mn=>{if(!(!Oe()||ln)&&mn.branches.length!==0){if(x(H,mn.branches,!0),x(ue,mn.defaultBranch||"",!0),x(ke,!1),!Le){const Pn=at(M()),ms=C(),vs=De;if(Vn(),!Oe())return;Le={autoSelectedBranch:l(oe),valueBeforePaint:ms,savedBranchBeforePaint:Pn,explicitSelectionRevision:vs}}Yt(),g.debug("Rendered cached branches via github.branches.listCached",{owner:st,repo:yn,count:mn.branches.length,source:mn.source})}});try{const mn=await xa.integrations.githubBranches(st,yn);if(!Oe()){g.debug("Branch fetch aborted after response");return}ln=!0,x(H,mn.branches,!0),x(ue,mn.defaultBranch||"",!0),x(Xe,"none"),Cn=!0,g.debug("Fetched branches via daemon github.branches.list",{owner:st,repo:yn,count:l(H).length})}catch(mn){if(!Oe())return;if(ln=!0,i())throw mn;const Pn=mn instanceof Error?mn.message:String(mn);throw/not configured|not authenticated/i.test(Pn)?(x(Xe,"not-authenticated"),new Error("GITHUB_AUTH_REQUIRED")):/404|not found/i.test(Pn)?(x(Xe,"no-access"),new Error("GITHUB_NO_ACCESS")):mn}}if(!Oe())return;if(ya.get("enableBranchCaching")&&Zt.set(U.cacheKey,{branches:l(H),remoteBranches:l(W),default:l(ue),current:l(pe),timestamp:Date.now()}),dt==="github"&&l(H).length>0){const Ae=Le;if(Ae&&!Ae.valueBeforePaint){if(De===Ae.explicitSelectionRevision&&(!C()||C()===Ae.autoSelectedBranch)){const st=Ae.savedBranchBeforePaint,yn=st&&(l(H).includes(st)||l(W).includes(st))?st:l(ue)||l(H)[0];l(oe)!==yn&&bn(yn)}}else Vn()}Cn&&Oe()&&(Le=null,Yt())}catch(Ae){if(Ae instanceof Error&&Ae.name==="AbortError"){g.debug("Branch fetch aborted in outer catch (superseded by newer request)");return}if(!Oe()){g.debug("Branch fetch aborted; skipping error-state write");return}const st=Ae instanceof Error?Ae:new Error(String(Ae));if(g.error("Failed to fetch branches",st,{repoPath:M(),repoType:O(),githubUrl:P(),effectiveRepoType:dt,effectiveGithubUrl:Ut,githubAuthNeeded:l(Xe)}),Ae instanceof Error){if(Ae.message==="GITHUB_AUTH_REQUIRED"){x(ye,null);return}else if(Ae.message==="GITHUB_NO_ACCESS"){x(ye,_.workspace_branchSelector_noAccess_error(),!0),yp.error(l(ye));return}Ae.message.includes("private repo")||Ae.message.includes("authenticate with GitHub")||Ae.message.includes("access permissions")||Ae.message.includes("GitHub API error")?x(ye,Ae.message,!0):Ae.message.includes("Git is not installed")||Ae.message.includes("ENOENT")||Ae.message.includes("spawn git")?x(ye,_.workspace_branchSelector_gitNotInstalled_error(),!0):Ae.message.includes("rate limit")?x(ye,_.workspace_branchSelector_rateLimit_error(),!0):Ae.message.includes("404")||Ae.message.includes("not found")?dt==="github"?x(ye,_.workspace_branchSelector_repoNotFoundGithub_error(),!0):x(ye,_.workspace_branchSelector_repoNotFound_error(),!0):Ae.message.includes("network")||Ae.message.includes("fetch")?x(ye,_.workspace_branchSelector_network_error(),!0):Ae.message.includes("permission")||Ae.message.includes("denied")?x(ye,_.workspace_branchSelector_permissionDenied_error(),!0):x(ye,Ae.message||_.workspace_branchSelector_fetchBranchesFailed_error(),!0)}else x(ye,_.workspace_branchSelector_fetchBranchesFailedManual_error(),!0);X()&&dt==="local"||yp.error(l(ye)),x(H,[],!0)}finally{mp.end(`fetchBranches-${U.repoPath}`),We===Pe&&Oe()&&(x(ke,!1),We=null)}}async function Gr(){const U=Qe();if(!(!U||U.repoType!=="local")&&!(l(ae)||l(ge))){x(ae,!0),x(ge,!0),g.debug("Fetching remote branches for",{repoPath:M()});try{const Pe=await xa.git.getBranches(U.repoPath,!0);if(!ze(U))return;if(Pe){if(x(W,Pe.remoteBranches||[],!0),ya.get("enableBranchCaching")){const Oe=Zt.get(U.cacheKey);Oe&&Zt.set(U.cacheKey,{...Oe,remoteBranches:l(W)})}g.debug("Fetched remote branches",{count:l(W).length})}}catch(Pe){if(!ze(U))return;g.error("Failed to fetch remote branches",Pe)}finally{ze(U)&&x(ae,!1)}}}function hs(){x(D,!l(D)),l(D)&&l(W).length===0&&!l(ae)&&!l(ge)&&Gr()}async function zt(U){const Pe=Qe();if(!U||!Pe||Pe.repoType!=="local"){x(Ke,0),x(Me,!1),x(Xt,!1);return}x(tn,U,!0),x(Xt,!0),g.debug("Fetching branch status",{branchName:U});try{if(hk()){const Oe=await xa.git.branchStatus(Pe.repoPath,U);if(!ze(Pe)||l(tn)!==U){g.debug("Ignoring stale branch status response",{requested:U,current:l(tn)});return}Oe?(x(Ke,Oe.behind??0,!0),x(Me,U===l(pe)?Oe.hasUncommittedChanges??!1:!1,!0),g.debug("Branch status fetched",{branchName:U,behind:l(Ke),hasUncommittedChanges:l(Me),currentBranch:l(pe),isCurrentBranch:U===l(pe)})):(g.warn("Failed to get branch status",{branchName:U,repoPath:M()}),x(Ke,0),x(Me,!1))}}catch(Oe){if(!ze(Pe)||l(tn)!==U)return;g.error("Failed to fetch branch status",Oe),x(Ke,0),x(Me,!1)}finally{ze(Pe)&&l(tn)===U&&x(Xt,!1)}}function ps(){x(Ke,0),x(Me,!1),x(Xt,!1),x(tn,null)}function bn(U){const Pe=Qe();if(Pe){x(oe,U,!0),g.debug("setInternalBranch called",{branchName:U,hasOnchange:typeof ne()=="function"});try{typeof ne()=="function"&&(g.debug("Calling onchange with branch",{branchName:U}),ne()(new CustomEvent("change",{detail:{branch:U}})))}catch(Oe){g.error("Error in onchange callback",Oe)}ze(Pe)&&zt(U)}}function $s(U,{keepSkipIsolation:Pe=!1,keepOpen:Oe=!1}={}){De++,x(oe,U,!0),A();try{typeof ne()=="function"&&ne()(new CustomEvent("change",{detail:{branch:U}}))}catch(dt){g.error("Error in onchange callback",dt)}if(!Pe&&X()&&typeof me()=="function")try{me()(!1)}catch(dt){g.error("Error in onSkipIsolationChange callback",dt)}zt(U),Oe||Ys()}function ji(U){const Pe=l(je)?.closest('[role="dialog"]');if(!l(it)&&Pe&&l(Be)){x(ee,l(Tt)?.getBoundingClientRect().height||void 0,!0);const Oe=l(Be),dt=Oe.getBoundingClientRect(),Ut=Pe.getBoundingClientRect(),en=Ut.left-dt.left,Cn=Ut.top-dt.top;x(it,{contextElement:Oe,getBoundingClientRect:()=>{const ln=Oe.getBoundingClientRect(),Ae=Math.max(wa,Oe.ownerDocument.documentElement.clientHeight-wa-Ut.height),st=Math.min(Math.max(wa,ln.top+Cn),Ae),yn=Math.max(wa,Oe.ownerDocument.documentElement.clientWidth-wa-Ut.width),mn=Math.min(Math.max(wa,ln.left+en),yn);return new DOMRect(mn,st,0,0)}},!0)}try{me()?.(!U)}catch(Oe){g.error("Error in onSkipIsolationChange callback",Oe)}!U&&l(pe)&&$s(l(pe),{keepSkipIsolation:!0,keepOpen:!0})}function Ys(){const U=l(Ct);x(Ct,!1),U&&To()}async function To(){await qo(),!l(Ct)&&l(Be)?.isConnected&&l(Be).focus({preventScroll:!0})}function ca(U){$e&&clearTimeout($e),$e=setTimeout(()=>{x(Z,U,!0)},100)}function A(){$e&&(clearTimeout($e),$e=null),x(Z,"")}async function ve(){const U=Qe();U&&Zt.delete(U.cacheKey),x(Xe,"none"),await Qn()}async function Ee(){if(!i()){x(mt,!0),x(ye,null);try{const{initializeGitHubAuth:U,startGitHubAuth:Pe}=await cs(async()=>{const{initializeGitHubAuth:ln,startGitHubAuth:Ae}=await import("./CRwmdgt6.js").then(st=>st.nF);return{initializeGitHubAuth:ln,startGitHubAuth:Ae}},__vite__mapDeps([14,15,2,16,17,11,5,3,1,9]),import.meta.url),{selectGitHubAuthIsAuthenticated:Oe,selectGitHubAuthIsAuthenticating:dt,selectGitHubAuthError:Ut}=await cs(async()=>{const{selectGitHubAuthIsAuthenticated:ln,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:st}=await import("./C_tu278J.js").then(yn=>yn.x);return{selectGitHubAuthIsAuthenticated:ln,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:st}},__vite__mapDeps([40,14,15,2,16,17,11,5,3,1,9,20,21,8,4,6,22,0,7,10,12,23,24,41,27,26,42,43,44,30,29,45,46]),import.meta.url),en=It;en.dispatch(U()),en.dispatch(Pe());const Cn=setInterval(async()=>{const ln=en.state;if(Oe.select(ln))clearInterval(Cn),x(mt,!1),x(Xe,"none"),await ve();else if(!dt.select(ln)){clearInterval(Cn),x(mt,!1);const Ae=Ut.select(ln);Ae&&x(ye,Ae,!0)}},1e3);setTimeout(()=>{l(mt)&&(clearInterval(Cn),x(mt,!1),x(ye,_.workspace_branchSelector_githubTimeout_error(),!0))},300*1e3)}catch(U){g.error("Failed to connect GitHub",U),x(mt,!1),x(ye,U instanceof Error?U.message:_.workspace_branchSelector_githubConnectFailed_error(),!0)}}}let gt=fe(!0),Ie=fe(!0),xe=!1;ft(()=>{if(l(Ct)){const U=!xe;U&&requestAnimationFrame(()=>{l(Ct)&&!l(Ue)&&l(Ye)&&(l(Ye).focus(),l(Ye).select())}),U&&(x(bt,!Qm(l(Be),360)),l(le)&&O()==="local"&&zt(l(le)))}xe=l(Ct)}),ft(()=>{l(Z)&&(l(gs).length>0&&x(gt,!1),l(Sn).length>0&&x(Ie,!1),l(Bs).length>0&&x(D,!0))});function on(){const U=P()||(M()&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(M())?`https://github.com/${M()}`:void 0);return U?Mp(U):null}ft(()=>{const U=s(),Pe=l(Z).trim();if(!U||O()!=="github"||!Pe){St++,x(lt,[],!0);return}const Oe=on();if(!Oe){St++,x(lt,[],!0);return}const dt=Qe();if(!dt)return;const Ut=++St;x(lt,[],!0),xa.integrations.githubBranches(Oe.owner,Oe.repo,Pe).then(en=>{!ze(dt)||Ut!==St||x(lt,en.branches,!0)}).catch(()=>{})});function gn(U){return U.startsWith("dependabot/")}function Fe(U){const Pe=U.trim(),Oe=Pe.startsWith("+ ")?Pe.substring(2):Pe;if(S1(Oe))return!0;if(U.startsWith("+ ")){const Ut=U.substring(2);if(Ut.startsWith("workspace")||Ut.startsWith("ws/")||Ut.startsWith("ws_"))return!0}return!!(Oe.startsWith("workspace-")||Oe.startsWith("workspace/")||Oe.startsWith("ws/")||Oe.startsWith("ws_")||/-\d{13}-[a-z0-9]+$/.test(Oe))}const Gt=w(()=>l(lt).length>0?[...l(H),...l(lt).filter(U=>!l(H).includes(U))]:l(H)),_n=w(()=>l(Gt).filter(U=>!Fe(U)&&!gn(U)&&U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>U===l(pe)?-1:Pe===l(pe)?1:U===l(ue)?-1:Pe===l(ue)?1:U.localeCompare(Pe))),Sn=w(()=>l(Gt).filter(U=>gn(U)&&U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>U.localeCompare(Pe))),gs=w(()=>l(Gt).filter(U=>Fe(U)&&U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>{const Oe=en=>{const Cn=en.match(/(\d{13})/);return Cn?parseInt(Cn[1]):null},dt=Oe(U),Ut=Oe(Pe);return dt&&Ut?Ut-dt:dt&&!Ut?-1:!dt&&Ut?1:U.localeCompare(Pe)})),Bs=w(()=>l(W).filter(U=>U.toLowerCase().includes(l(Z).toLowerCase())).sort((U,Pe)=>U.localeCompare(Pe))),di=w(()=>{const U=(Pe,Oe=!1)=>Pe.map(dt=>({value:dt,label:dt,class:K()&&Oe?"pl-8":void 0,description:dt===l(ue)?_.workspace_branchSelector_default_label():dt===l(pe)?_.workspace_branchSelector_current_label():void 0}));return[{key:"regular",label:"",options:U(l(_n))},{key:"workspace",label:_.workspace_branchSelector_workspaceBranches_label(),options:U(l(gs),!0),collapsed:l(gt)},{key:"remote",label:_.workspace_branchSelector_remoteBranches_label(),options:U(l(Bs),!0),collapsed:!l(D),keepEmpty:O()==="local"},{key:"dependabot",label:_.workspace_branchSelector_dependabotBranches_label(),options:U(l(Sn),!0),collapsed:l(Ie)}].filter(Pe=>Pe.key!=="remote"||O()==="local")});function Eo(U){return!U.collapsed}function xi(U){U.key==="workspace"?x(gt,!l(gt)):U.key==="remote"?hs():U.key==="dependabot"&&x(Ie,!l(Ie))}var ir={get variant(){return I()},set variant(U="underline"){I(U),b()},get value(){return C()},set value(U=""){C(U),b()},get repoPath(){return M()},set repoPath(U){M(U),b()},get repoType(){return O()},set repoType(U){O(U),b()},get githubUrl(){return P()},set githubUrl(U){P(U),b()},get disabled(){return E()},set disabled(U=!1){E(U),b()},get dropUp(){return z()},set dropUp(U=!1){z(U),b()},get portal(){return G()},set portal(U=!0){G(U),b()},get triggerClass(){return J()},set triggerClass(U){J(U),b()},get rowLabel(){return K()},set rowLabel(U){K(U),b()},get hasTriggerIcon(){return Y()},set hasTriggerIcon(U=!0){Y(U),b()},get description(){return $()},set description(U){$(U),b()},get skipIsolation(){return X()},set skipIsolation(U=!1){X(U),b()},get suggestedBranch(){return de()},set suggestedBranch(U){de(U),b()},get onSkipIsolationChange(){return me()},set onSkipIsolationChange(U){me(U),b()},get onGitHubAuthNeededChange(){return ie()},set onGitHubAuthNeededChange(U){ie(U),b()},get onBranchStatusChange(){return q()},set onBranchStatusChange(U){q(U),b()},get onBranchesLoaded(){return j()},set onBranchesLoaded(U){j(U),b()},get onchange(){return ne()},set onchange(U){ne(U),b()},get showUncommittedIndicator(){return we()},set showUncommittedIndicator(U=!1){we(U),b()},get showTriggerChevron(){return be()},set showTriggerChevron(U=!1){be(U),b()},get triggerChevronClass(){return Se()},set triggerChevronClass(U="ml-2 opacity-50"){Se(U),b()},get triggerContentClass(){return se()},set triggerContentClass(U="gap-0.75"){se(U),b()},$set:Dt,$on:(U,Pe)=>$t(e,U,Pe)},ts=Je(),fi=ce(ts);{var Lr=U=>{var Pe=VL(),Oe=te(Pe);{var dt=Ae=>{var st=Ta(),yn=re(st,!0);L(()=>{wt(st,1,Xn(yr.fieldLabel)),B(yn,K())}),k(Ae,st)};V(Oe,Ae=>{K()&&Ae(dt)})}var Ut=R(Oe,2);{var en=Ae=>{{let st=w(()=>K()?16:12);uo(Ae,{get size(){return l(st)},class:"text-ghost shrink-0"})}};V(Ut,Ae=>{Y()&&Ae(en)})}var Cn=R(Ut,2),ln=re(Cn,!0);Q(Pe),L(Ae=>{wt(Pe,1,`flex min-w-0 items-center gap-2 text-subtle text-sm ${K()?"min-h-10 px-3 py-2":"py-1"}`),B(ln,Ae)},[()=>l(le)||C()||(l(Ue)?_.workspace_branchSelector_noIsolation_label({isolationLabel:Mt}):_.workspace_branchSelector_noBranchSelected_label())]),k(U,Pe)},qu=U=>{var Pe=uO(),Oe=te(Pe);Rt(Oe,()=>qf,(dt,Ut)=>{Ut(dt,{get open(){return l(Ct)},set open(en){x(Ct,en,!0)},children:(en,Cn)=>{var ln=vm(),Ae=ce(ln);{const yn=(mn,Pn)=>{let ms=()=>(Pn?.()).props;{let vs=w(()=>I()==="default"?"outline":I()),hi=w(()=>!K()),bs=w(()=>`${_.workspace_branchSelector_selectBranch_label()}: ${l(le)||C()}`),Ao=w(()=>`w-full text-muted-foreground ${J()} ${l(Xe)==="not-authenticated"?"ring-1 ring-orange-400 rounded-sm":de()&&de()!==l(oe)?"ring-1 ring-primary-ink rounded-sm":""}`);Ze(mn,us(ms,{get variant(){return l(vs)},get wrapContent(){return l(hi)},get"aria-label"(){return l(bs)},get class(){return l(Ao)},get ref(){return l(Be)},set ref(ki){x(Be,ki,!0)},children:(ki,Gi)=>{var or=JL(),zs=te(or);{var pi=tt=>{var Kt=Ta(),un=re(Kt,!0);L(()=>{wt(Kt,1,Xn(yr.fieldLabel)),B(un,K())}),k(tt,Kt)};V(zs,tt=>{K()&&tt(pi)})}var ys=R(zs,2);{var qi=tt=>{ut(tt,{get icon(){return h1},class:"text-orange-500",size:"xs"})},Fs=tt=>{{let Kt=w(()=>K()?16:12);uo(tt,{get size(){return l(Kt)},class:"text-ghost shrink-0"})}};V(ys,tt=>{l(Xe)==="not-authenticated"?tt(qi):Y()&&tt(Fs,1)})}var Ji=R(ys,2),_i=te(Ji);{var ua=tt=>{var Kt=WL(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_connectGithub_label()]),k(tt,Kt)},Ja=tt=>{var Kt=KL(),un=ce(Kt),Zn=re(un,!0),As=R(un,2),Rs=re(As,!0);L(nn=>{B(Zn,l(le)),B(Rs,nn)},[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:Mt})]),k(tt,Kt)},Xa=tt=>{var Kt=Ta(),un=re(Kt,!0);L(()=>B(un,l(le))),k(tt,Kt)},Ya=tt=>{var Kt=Ta(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:Mt})]),k(tt,Kt)},ar=tt=>{var Kt=Ta(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_selectRepoFirst_label()]),k(tt,Kt)},kr=tt=>{var Kt=jL(),un=ce(Kt);li(un,{size:14,class:"text-ghost"});var Zn=R(un,2),As=re(Zn,!0);L(Rs=>B(As,Rs),[()=>_.workspace_compactInitializer_waitingBranchSelection_label()]),k(tt,Kt)},lr=tt=>{var Kt=Ta(),un=re(Kt,!0);L(Zn=>B(un,Zn),[()=>_.workspace_branchSelector_selectBranch_label()]),k(tt,Kt)};V(_i,tt=>{l(Xe)==="not-authenticated"?tt(ua):X()&&l(le)?tt(Ja,1):l(le)?tt(Xa,2):l(Ue)&&M()?tt(Ya,3):M()?l(ke)?tt(kr,5):tt(lr,-1):tt(ar,4)})}Q(Ji);var Es=R(Ji,2);{var ns=tt=>{var Kt=qL(),un=te(Kt);{let Zn=w(()=>_.workspace_branchSelector_uncommittedChanges_tooltip());Eu(un,{get content(){return l(Zn)},side:"bottom",delayDuration:200,children:(As,Rs)=>{var nn=GL();k(As,nn)},$$slots:{default:!0}})}Q(Kt),Ss(3,Kt,()=>Bo,()=>({axis:"x",tier:"moderate"})),k(tt,Kt)};V(Es,tt=>{we()&&!X()&&l(le)&&O()==="local"&&!l(Xt)&&l(Me)&&l(ot)&&tt(ns)})}var Fn=R(Es,2);{var _r=tt=>{ut(tt,{get icon(){return Da},size:10,get class(){return Se()}})};V(Fn,tt=>{be()&&tt(_r)})}Q(or),L(()=>wt(or,1,`flex items-center truncate min-w-0 ${se()}`)),k(ki,or)},$$slots:{default:!0}}))}};Rt(Ae,()=>eh,(mn,Pn)=>{Pn(mn,{child:yn,$$slots:{child:!0}})})}var st=R(Ae,2);{let yn=w(()=>K()??_.workspace_branchSelector_whichBranch_label()),mn=w(()=>K()?"w-[360px] pt-1 max-w-[calc(100vw-1rem)] min-w-0 max-h-[min(440px,var(--bits-popover-content-available-height,calc(100dvh-1rem)))] overflow-y-auto flex flex-col":"w-[400px] max-w-[calc(100vw-16px)] min-w-0 max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto flex flex-col"),Pn=w(()=>!l(it)),ms=w(()=>l(it)?"bottom":K()?m.current||l(bt)?"bottom":"left":z()?"top":"bottom"),vs=w(()=>l(it)?"start":K()?m.current||l(bt)?"end":"start":"center"),hi=w(()=>l(it)?0:K()?m.current||l(bt)?4:24:void 0),bs=w(()=>({to:v()})),Ao=w(()=>v()?"absolute":"fixed");Rt(st,()=>Gf,(ki,Gi)=>{Gi(ki,{role:"dialog",get"aria-label"(){return l(yn)},get class(){return l(mn)},get customAnchor(){return l(it)},get avoidCollisions(){return l(Pn)},get side(){return l(ms)},get align(){return l(vs)},get sideOffset(){return l(hi)},get portalProps(){return l(bs)},get strategy(){return l(Ao)},onOpenAutoFocus:or=>{or.preventDefault(),qo().then(()=>{l(Ct)&&(l(Ue)?l(je):l(Ye))?.focus()})},get portal(){return G()},children:(or,zs)=>{var pi=cO(),ys=ce(pi);{var qi=ar=>{var kr=XL(),lr=te(kr),Es=re(lr,!0),ns=R(lr,2),Fn=re(ns,!0);Q(kr),L((_r,tt)=>{B(Es,_r),B(Fn,tt)},[()=>_.workspace_branchSelector_whichBranch_label(),()=>$()||_.workspace_branchSelector_whichBranch_description()]),k(ar,kr)};V(ys,ar=>{K()||ar(qi)})}var Fs=R(ys,2);let Ji;var _i=te(Fs);{var ua=ar=>{var kr=YL(),lr=te(kr),Es=re(lr,!0),ns=R(lr,2),Fn=te(ns);u(Fn);var _r=R(Fn,2),tt=re(_r,!0),Kt=R(_r,2),un=re(Kt,!0);Q(ns),Q(kr),L((Zn,As)=>{B(Es,Zn),wt(ns,1,Xn(K()?yr.row+" flex min-w-0":"type-caption flex min-w-0 items-center gap-2 px-2 py-1")),B(tt,l(pe)),B(un,As)},[()=>_.workspace_branchSelector_folderBranch_label(),()=>_.workspace_branchSelector_currentBranch_label()]),k(ar,kr)},Ja=ar=>{var kr=oO(),lr=ce(kr);{var Es=nn=>{{let dn=w(()=>K()?"bg-sidebar hover:bg-hover":"bg-primary/10 hover:bg-primary/15 border border-primary/20");Ze(nn,{variant:"ghost",type:"button",get class(){return`mx-2 mb-2 px-3 py-2 flex items-center gap-2 text-sm text-left rounded-md transition-colors cursor-pointer ${l(dn)??""}`},onclick:()=>$s(de()),children:(Wn,Or)=>{var Wt=QL(),Mn=ce(Wt);uo(Mn,{size:14,class:"text-primary-ink shrink-0"});var Kn=R(Mn,2),Sr=te(Kn),Hs=re(Sr,!0),rs=R(Sr,2),qr=re(rs,!0);Q(Kn),L(Nr=>{B(Hs,Nr),B(qr,de())},[()=>_.workspace_branchSelector_usePrBranch_label()]),k(Wn,Wt)},$$slots:{default:!0}})}};V(lr,nn=>{de()&&de()!==l(oe)&&nn(Es)})}var ns=R(lr,2),Fn=te(ns);{var _r=nn=>{{let dn=w(()=>K()?"mx-2 rounded-(--radius-medium) bg-sidebar":"w-full border-l-2 border-primary bg-primary/5");Ze(nn,{variant:"ghost",type:"button",get class(){return`px-3 py-3 flex items-start gap-3 hover:bg-muted/50 transition-colors cursor-pointer text-left ${l(dn)??""}`},onclick:Ee,children:(Wn,Or)=>{var Wt=ZL(),Mn=R(ce(Wt),2),Kn=te(Mn),Sr=re(Kn,!0),Hs=R(Kn,2),rs=re(Hs,!0);Q(Mn),L((qr,Nr)=>{B(Sr,qr),B(rs,Nr)},[()=>_.workspace_branchSelector_connectWithGithub_label(),()=>_.workspace_branchSelector_connectWithGithub_description()]),k(Wn,Wt)},$$slots:{default:!0}})}},tt=nn=>{var dn=eO(),Wn=te(dn),Or=te(Wn);li(Or,{size:20,class:"text-ghost"}),Q(Wn);var Wt=R(Wn,2),Mn=te(Wt),Kn=re(Mn,!0),Sr=R(Mn,2),Hs=re(Sr,!0);Q(Wt),Q(dn),L((rs,qr)=>{wt(dn,1,`px-3 py-3 flex items-start gap-3 ${K()?"mx-2 rounded-(--radius-medium) bg-sidebar":"border-l-2 border-primary bg-primary/5"}`),B(Kn,rs),B(Hs,qr)},[()=>_.workspace_branchSelector_connectingGithub_label(),()=>_.workspace_branchSelector_completeAuth_description()]),k(nn,dn)},Kt=nn=>{var dn=tO(),Wn=te(dn),Or=re(Wn,!0),Wt=R(Wn,2),Mn=re(Wt,!0);Q(dn),L((Kn,Sr)=>{wt(dn,1,`py-2 bg-danger-background/10 ${K()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),B(Or,Kn),B(Mn,Sr)},[()=>_.workspace_branchSelector_noAccess_error(),()=>_.workspace_branchSelector_noAccess_description()]),k(nn,dn)},un=nn=>{var dn=rO(),Wn=te(dn),Or=re(Wn,!0),Wt=R(Wn,2);{var Mn=Kn=>{var Sr=nO(),Hs=re(Sr,!0);L(rs=>B(Hs,rs),[()=>_.workspace_branchSelector_typeManually_description()]),k(Kn,Sr)};V(Wt,Kn=>{O()==="github"&&Kn(Mn)})}Q(dn),L(()=>{wt(dn,1,`py-2 bg-danger-background/10 ${K()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),B(Or,l(ye))}),k(nn,dn)};V(Fn,nn=>{!i()&&l(Xe)==="not-authenticated"&&!l(mt)?nn(_r):l(mt)?nn(tt,1):l(Xe)==="no-access"?nn(Kt,2):l(ye)&&nn(un,3)})}var Zn=R(Fn,2);{let nn=w(()=>K()?yr.row:void 0),dn=w(()=>_.workspace_branchSelector_selectBranch_label()),Wn=w(()=>_.workspace_branchSelector_search_placeholder()),Or=w(()=>_.workspace_branchSelector_search_placeholder()),Wt=w(()=>_.workspace_branchSelector_noBranchesFound_label()),Mn=w(()=>l(ke)&&l(H).length===0),Kn=w(()=>K()?"flex min-h-0 flex-1 flex-col gap-1 px-2":"flex min-h-0 flex-1 flex-col px-2 pb-1"),Sr=w(()=>K()?"search":void 0),Hs=w(()=>K()?c:void 0),rs=w(()=>K()?"min-h-0 max-h-none flex-1 p-0 pb-2":"min-h-0 max-h-none flex-1"),qr=w(()=>K()?"flex min-h-0 max-h-none flex-col rounded-none border-0 shadow-none":"flex min-h-0 max-h-none flex-col border-0 shadow-none");Wx(Zn,{get open(){return l(Ct)},get value(){return l(oe)},get groups(){return l(di)},get groupHeader(){return d},get optionIcon(){return u},get rowClass(){return l(nn)},get ariaLabel(){return l(dn)},get placeholder(){return l(Wn)},get searchPlaceholder(){return l(Or)},get emptyText(){return l(Wt)},get loading(){return l(Mn)},staticPosition:!0,allowCustom:!0,onquerychange:ca,oncommit:Nr=>{typeof Nr=="string"&&$s(Nr)},oninteractoutside:Nr=>{Nr.target instanceof Node&&(l(he)?.contains(Nr.target)||l(Ne)?.contains(Nr.target))&&Nr.preventDefault()},get class(){return l(Kn)},get inputVariant(){return l(Sr)},get inputAction(){return l(Hs)},inputClass:"shrink-0",get viewportClass(){return l(rs)},size:"compact",get contentClass(){return l(qr)},get inputRef(){return l(Ye)},set inputRef(Nr){x(Ye,Nr,!0)}})}Q(ns);var As=R(ns,2);{var Rs=nn=>{var dn=iO(),Wn=te(dn);Cs(Wn,17,()=>l(di).filter(Wt=>Wt.key==="workspace"&&Wt.options.length>0||Wt.key==="remote"),Wt=>Wt.key,(Wt,Mn)=>{{let Kn=w(()=>Eo(l(Mn)));E0(Wt,{size:"sm",get pressed(){return l(Kn)},get ariaLabel(){return l(Mn).label},onChange:()=>xi(l(Mn)),class:"gap-1.5 border-transparent bg-transparent px-2.5 text-subtle data-[state=on]:border-border data-[state=on]:bg-hover data-[state=on]:font-medium data-[state=on]:shadow-none data-[state=on]:hover:bg-muted",children:(Sr,Hs)=>{var rs=sO(),qr=ce(rs);{var Nr=Qa=>{ut(Qa,{get icon(){return Hm},class:"size-3! text-primary-ink"})},Ju=w(()=>Eo(l(Mn)));V(qr,Qa=>{l(Ju)&&Qa(Nr)})}var rc=R(qr);L(()=>B(rc,` ${l(Mn).label??""}`)),k(Sr,rs)},$$slots:{default:!0}})}});var Or=R(Wn,2);{let Wt=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());Ze(Or,{onclick:ve,variant:"ghost",size:"icon-sm",class:"ml-auto shrink-0",get disabled(){return l(ke)},get"aria-label"(){return l(Wt)},children:(Mn,Kn)=>{ut(Mn,{get icon(){return hp},class:"size-3.5!"})},$$slots:{default:!0}})}Q(dn),Yn(dn,Wt=>x(he,Wt),()=>l(he)),k(nn,dn)};V(As,nn=>{K()||nn(Rs)})}k(ar,kr)};V(_i,ar=>{l(Ue)&&l(pe)?ar(ua):ar(Ja,-1)})}Q(Fs),Yn(Fs,ar=>x(Tt,ar),()=>l(Tt));var Xa=R(Fs,2);{var Ya=ar=>{var kr=lO(),lr=te(kr),Es=te(lr);{const _r=Rs=>{{let nn=w(()=>l(Ue)?Js:p1);ut(Rs,{get icon(){return l(nn)},class:"size-4! text-subtle"})}},tt=(Rs,nn)=>{let dn=()=>(nn?.()).labelId,Wn=()=>(nn?.()).descriptionId;{let Or=w(()=>`${t}-isolation`),Wt=w(()=>!X());Gm(Rs,{get id(){return l(Or)},get checked(){return l(Wt)},get ariaLabelledby(){return dn()},get ariaDescribedby(){return Wn()},class:"dark:[&_[data-switch-thumb][data-state=unchecked]]:bg-foreground",onCheckedChange:ji,get ref(){return l(je)},set ref(Mn){x(je,Mn,!0)}})}};let Kt=w(()=>`${t}-isolation-row`),un=w(()=>`${t}-isolation`),Zn=w(()=>_.workspace_branchSelector_isolation_label({isolationLabel:Mt})),As=w(()=>l(Ue)?_.workspace_branchSelector_isolationOff_description():_.workspace_branchSelector_isolationOn_description());ax(Es,{get id(){return l(Kt)},get htmlFor(){return l(un)},activateLabel:!0,get label(){return l(Zn)},get description(){return l(As)},class:"branch-isolation-row grid-cols-[minmax(0,1fr)_auto] items-start gap-2.5 py-0 first:pt-0 last:pb-0 md:grid-cols-[minmax(0,1fr)_auto] md:items-start md:gap-2.5 [&_[data-field-label]]:py-0 [&_[data-field-label]]:font-normal [&_[data-field-leading]]:mt-0 [&_[data-field-control]]:min-h-0 [&_[data-field-control]]:w-auto [&_.space-y-1]:space-y-0",leading:_r,control:tt,$$slots:{leading:!0,control:!0}})}var ns=R(Es,2);{var Fn=_r=>{var tt=aO(),Kt=re(tt,!0);L(un=>B(Kt,un),[()=>_.workspace_branchSelector_directWarning_description()]),k(_r,tt)};V(ns,_r=>{l(Ue)&&_r(Fn)})}Q(lr),Yn(lr,_r=>x(Ne,_r),()=>l(Ne)),Q(kr),k(ar,kr)};V(Xa,ar=>{O()==="local"&&typeof me()=="function"&&l(pe)&&ar(Ya)})}L(()=>{wt(Fs,1,`flex flex-col transition-none ${l(ee)?"shrink-0":"flex-1"} ${l(Ge)?"min-h-52":"min-h-0"}`),Ji=Hi(Fs,"",Ji,{height:l(ee)?`${l(ee)}px`:void 0})}),k(or,pi)},$$slots:{default:!0}})})}k(en,ln)},$$slots:{default:!0}})}),Q(Pe),Yn(Pe,dt=>x(sn,dt),()=>l(sn)),k(U,Pe)};V(fi,U=>{E()?U(Lr):U(qu,-1)})}k(n,ts);var nc=Ot(ir);return a(),nc}var dO=N('<p class="type-caption text-muted-foreground px-2 py-1" role="status"> </p>');function If(n,e){if(new.target)return Nt({component:If,...n});Lt(e,!0);const t=()=>rn(a,"$member$",s),r=()=>rn(c,"$execution$",s),[s,i]=Jl();let o=y(e,"kind",7,"git-policy");const a=Nf(),c=mw(),u=w(()=>t()?o()==="ai"?_.hostExecution_providerSetup_description():o()==="repository"?r()&&!r().repositoryConnections.some(v=>v.configured)?_.hostExecution_repositorySetup_description():null:r()?.gitCredentialPolicy.managedHelperEnabled===!1?_.hostExecution_disabledHelper_description({setting:r().gitCredentialPolicy.setting}):null:null);var d={get kind(){return o()},set kind(v="git-policy"){o(v),b()},$set:Dt,$on:(v,m)=>$t(e,v,m)},f=Je(),h=ce(f);{var p=v=>{var m=dO(),S=re(m,!0);L(()=>B(S,l(u))),k(v,m)};V(h,v=>{l(u)&&v(p)})}k(n,f);var g=Ot(d);return i(),g}var fO=N('<div class="grid grid-cols-[minmax(0,1fr)_5rem] gap-3"><div><!> <!></div> <div><!> <!></div></div>'),hO=N("<div><!> <!></div>"),pO=N("<!> <!> <!>",1),gO=N('<div class="space-y-3"><h3 class="text-sm font-medium"> </h3> <!> <!> <!></div>'),mO=N('<div class="type-caption text-subtle"><p> </p></div>'),vO=N('<div class="space-y-4"><div><!> <!></div> <div class="space-y-3"><h3 class="text-sm font-medium"> </h3> <div class="flex gap-2"><!> <!></div> <!> <div><!> <!></div></div> <!> <div><!> <!></div> <div><!> <!></div> <!></div>');function A0(n,e){if(new.target)return Nt({component:A0,...n});Lt(e,!0);let t=y(e,"isOpen",7),r=y(e,"onclose",7),s=y(e,"onsave",7),i=y(e,"inline",7,!1),o=y(e,"initialSetup",7);const a=Ga("AddRemoteSetupModal");let c=fe(Ar(o()?.name??"")),u=fe("ssh"),d=fe(Ar(o()?.host??"")),f=fe(Ar(o()?.port??22)),h=fe(Ar(o()?.wsUrl??"")),p=fe(Ar(o()?.username??"")),g=fe(""),v=fe(""),m=fe("agent"),S=fe(Ar(o()?.workspacePath??"")),I=fe(Ar(o()?.branch??"main")),C=fe("");const M=w(()=>l(c).trim()!==""&&(l(u)==="ssh"?l(d).trim()!==""&&l(f)>0&&l(f)<=65535:l(h).trim()!=="")&&l(p).trim()!==""&&l(S).trim()!==""&&(l(m)==="agent"||l(m)==="keyfile"&&l(v).trim()!==""||l(m)==="password"&&l(g).trim()!==""));function O(){if(!l(M)){x(C,_.workspace_addRemoteSetupModal_requiredFields_error(),!0);return}const Y={id:crypto.randomUUID(),name:l(c).trim(),host:l(u)==="ssh"?l(d).trim():"",port:l(u)==="ssh"?l(f):0,username:l(p).trim(),password:l(m)==="password"?l(g).trim():void 0,keyPath:l(m)==="keyfile"?l(v).trim():void 0,useAgent:l(m)==="agent",workspacePath:l(S).trim(),transport:l(u),wsUrl:l(u)==="websocket"?l(h).trim():void 0,branch:l(I).trim()||void 0};a.info("Saving new remote setup",{name:Y.name,transport:Y.transport}),s()(Y),P(),r()()}function P(){x(c,""),x(u,"ssh"),x(d,""),x(f,22),x(h,""),x(p,""),x(g,""),x(v,""),x(m,"agent"),x(S,""),x(I,"main"),x(C,"")}function E(){P(),r()()}var z={get isOpen(){return t()},set isOpen(Y){t(Y),b()},get onclose(){return r()},set onclose(Y){r(Y),b()},get onsave(){return s()},set onsave(Y){s(Y),b()},get inline(){return i()},set inline(Y=!1){i(Y),b()},get initialSetup(){return o()},set initialSetup(Y){o(Y),b()},$set:Dt,$on:(Y,$)=>$t(e,Y,$)},G=Je(),J=ce(G);{var K=Y=>{{let $=w(()=>_.workspace_addRemoteSetupModal_title()),X=w(()=>_.workspace_addRemoteSetupModal_close_ariaLabel()),de=w(()=>_.workspace_addRemoteSetupModal_addSetup_label()),me=w(()=>_.workspace_addRemoteSetupModal_cancel_label());jx(Y,{get open(){return t()},get static(){return i()},get title(){return l($)},get closeLabel(){return l(X)},get submitLabel(){return l(de)},get cancelLabel(){return l(me)},size:"lg",get canSubmit(){return l(M)},onSubmit:O,onCancel:E,children:(ie,q)=>{var j=vO(),ne=te(j),we=te(ne);Do(we,{for:"name",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_setupName_label()]),k(he,je)},$$slots:{default:!0}});var be=R(we,2);{let he=w(()=>_.workspace_addRemoteSetupModal_setupName_placeholder());Xr(be,{id:"name",get placeholder(){return l(he)},class:"mt-1",get value(){return l(c)},set value(Ne){x(c,Ne,!0)}})}Q(ne);var Se=R(ne,2),se=te(Se),oe=re(se,!0),H=R(se,2),W=te(H);{let he=w(()=>l(u)==="ssh"),Ne=w(()=>l(u)==="ssh"?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:bg-muted");Ze(W,{variant:"ghost",type:"button",get"aria-pressed"(){return l(he)},get class(){return`flex-1 px-3 py-1.5 text-sm rounded-md border transition-colors ${l(Ne)??""}`},onclick:()=>{l(u)!=="ssh"&&(P(),x(u,"ssh"))},children:(je,Tt)=>{Ht();var ee=Vt("SSH");k(je,ee)},$$slots:{default:!0}})}var D=R(W,2);{let he=w(()=>l(u)==="websocket"),Ne=w(()=>l(u)==="websocket"?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:bg-muted");Ze(D,{variant:"ghost",type:"button",get"aria-pressed"(){return l(he)},get class(){return`flex-1 px-3 py-1.5 text-sm rounded-md border transition-colors ${l(Ne)??""}`},onclick:()=>{l(u)!=="websocket"&&(P(),x(u,"websocket"))},children:(je,Tt)=>{Ht();var ee=Vt("WebSocket");k(je,ee)},$$slots:{default:!0}})}Q(H);var ae=R(H,2);{var ge=he=>{var Ne=fO(),je=te(Ne),Tt=te(je);Do(Tt,{for:"host",children:(mt,Mt)=>{Ht();var Ue=Vt();L(Ke=>B(Ue,Ke),[()=>_.workspace_addRemoteSetupModal_host_label()]),k(mt,Ue)},$$slots:{default:!0}});var ee=R(Tt,2);Xr(ee,{id:"host",placeholder:"dev.example.com",class:"mt-1",get value(){return l(d)},set value(mt){x(d,mt,!0)}}),Q(je);var Ge=R(je,2),it=te(Ge);Do(it,{for:"port",children:(mt,Mt)=>{Ht();var Ue=Vt();L(Ke=>B(Ue,Ke),[()=>_.workspace_addRemoteSetupModal_port_label()]),k(mt,Ue)},$$slots:{default:!0}});var Xe=R(it,2);Xr(Xe,{id:"port",type:"number",placeholder:"22",class:"mt-1",get value(){return l(f)},set value(mt){x(f,mt,!0)}}),Q(Ge),Q(Ne),k(he,Ne)},ue=he=>{var Ne=hO(),je=te(Ne);Do(je,{for:"wsUrl",children:(ee,Ge)=>{Ht();var it=Vt();L(Xe=>B(it,Xe),[()=>_.workspace_addRemoteSetupModal_wsUrl_label()]),k(ee,it)},$$slots:{default:!0}});var Tt=R(je,2);Xr(Tt,{id:"wsUrl",placeholder:"wss://dev.example.com/ws",class:"mt-1",get value(){return l(h)},set value(ee){x(h,ee,!0)}}),Q(Ne),k(he,Ne)};V(ae,he=>{l(u)==="ssh"?he(ge):he(ue,-1)})}var pe=R(ae,2),ke=te(pe);Do(ke,{for:"username",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_username_label()]),k(he,je)},$$slots:{default:!0}});var ye=R(ke,2);Xr(ye,{id:"username",placeholder:"john",class:"mt-1",get value(){return l(p)},set value(he){x(p,he,!0)}}),Q(pe),Q(Se);var Z=R(Se,2);{var $e=he=>{var Ne=gO(),je=te(Ne),Tt=re(je,!0),ee=R(je,2),Ge=()=>l(m),it=Ke=>{(Ke==="agent"||Ke==="keyfile"||Ke==="password")&&x(m,Ke,!0)};{let Ke=w(()=>_.workspace_addRemoteSetupModal_authentication_label());Rt(ee,()=>Gx,(Me,Xt)=>{Xt(Me,{type:"single",get value(){return Ge()},set value(tn){it(tn)},get"aria-label"(){return l(Ke)},variant:"outline",class:"flex w-full",children:(tn,es)=>{var le=pO(),ot=ce(le);Rt(ot,()=>ld,(Ve,ht)=>{ht(Ve,{value:"agent",class:"min-w-0 flex-1",onclick:Et=>{l(m)==="agent"&&Et.preventDefault()},onkeydown:Et=>{l(m)==="agent"&&["Enter"," "].includes(Et.key)&&Et.preventDefault()},children:(Et,qe)=>{Ht();var yt=Vt();L(Re=>B(yt,Re),[()=>_.workspace_addRemoteSetupModal_sshAgent_label()]),k(Et,yt)},$$slots:{default:!0}})});var At=R(ot,2);Rt(At,()=>ld,(Ve,ht)=>{ht(Ve,{value:"keyfile",class:"min-w-0 flex-1",onclick:Et=>{l(m)==="keyfile"&&Et.preventDefault()},onkeydown:Et=>{l(m)==="keyfile"&&["Enter"," "].includes(Et.key)&&Et.preventDefault()},children:(Et,qe)=>{Ht();var yt=Vt();L(Re=>B(yt,Re),[()=>_.workspace_addRemoteSetupModal_keyFile_label()]),k(Et,yt)},$$slots:{default:!0}})});var Zt=R(At,2);Rt(Zt,()=>ld,(Ve,ht)=>{ht(Ve,{value:"password",class:"min-w-0 flex-1",onclick:Et=>{l(m)==="password"&&Et.preventDefault()},onkeydown:Et=>{l(m)==="password"&&["Enter"," "].includes(Et.key)&&Et.preventDefault()},children:(Et,qe)=>{Ht();var yt=Vt();L(Re=>B(yt,Re),[()=>_.workspace_addRemoteSetupModal_password_label()]),k(Et,yt)},$$slots:{default:!0}})}),k(tn,le)},$$slots:{default:!0}})})}var Xe=R(ee,2);{var mt=Ke=>{const Me=w(()=>"~/.ssh/id_rsa");{let Xt=w(()=>_.workspace_addRemoteSetupModal_keyFile_label());Xr(Ke,{placeholder:l(Me),get"aria-label"(){return l(Xt)},get value(){return l(v)},set value(tn){x(v,tn,!0)}})}};V(Xe,Ke=>{l(m)==="keyfile"&&Ke(mt)})}var Mt=R(Xe,2);{var Ue=Ke=>{{let Me=w(()=>_.workspace_addRemoteSetupModal_password_label());Xr(Ke,{type:"password",placeholder:"••••••••",get"aria-label"(){return l(Me)},get value(){return l(g)},set value(Xt){x(g,Xt,!0)}})}};V(Mt,Ke=>{l(m)==="password"&&Ke(Ue)})}Q(Ne),L(Ke=>B(Tt,Ke),[()=>_.workspace_addRemoteSetupModal_authentication_label()]),k(he,Ne)},lt=he=>{var Ne=mO(),je=te(Ne),Tt=re(je,!0);Q(Ne),L(ee=>B(Tt,ee),[()=>_.workspace_addRemoteSetupModal_websocketAuth_description()]),k(he,Ne)};V(Z,he=>{l(u)==="ssh"?he($e):he(lt,-1)})}var St=R(Z,2),De=te(St);Do(De,{for:"workspacePath",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_repoPath_label()]),k(he,je)},$$slots:{default:!0}});var Le=R(De,2);Xr(Le,{id:"workspacePath",placeholder:"/home/user/myrepo",class:"mt-1",get value(){return l(S)},set value(he){x(S,he,!0)}}),Q(St);var Ye=R(St,2),Ct=te(Ye);Do(Ct,{for:"branch",children:(he,Ne)=>{Ht();var je=Vt();L(Tt=>B(je,Tt),[()=>_.workspace_addRemoteSetupModal_branch_label()]),k(he,je)},$$slots:{default:!0}});var bt=R(Ct,2);Xr(bt,{id:"branch",placeholder:"main",class:"mt-1",get value(){return l(I)},set value(he){x(I,he,!0)}}),Q(Ye);var sn=R(Ye,2);{var Be=he=>{mx(he,{tone:"error",children:(Ne,je)=>{Ht();var Tt=Vt();L(()=>B(Tt,l(C))),k(Ne,Tt)},$$slots:{default:!0}})};V(sn,he=>{l(C)&&he(Be)})}Q(j),L(he=>B(oe,he),[()=>_.workspace_addRemoteSetupModal_connectionDetails_label()]),k(ie,j)},$$slots:{default:!0}})}};V(J,Y=>{t()&&Y(K)})}return k(n,G),Ot(z)}var bO=new Set(["$$slots","$$events","$$legacy","owner","name","suffix","provider","avatarUrl","local","showOwner","showForge","recent","option","selected","formStyle","checked","class"]),yO=N('<span class="text-subtle mr-1"> </span>'),wO=N('<span class="text-subtle ml-1"> </span>'),xO=N('<span role="img" class="text-subtle shrink-0"><!></span>'),kO=N('<span><span class="truncate"><!> <!></span> <!></span>');function jh(n,e){if(new.target)return Nt({component:jh,...n});Lt(e,!0);const t=M=>{var O=Je(),P=ce(O);{var E=z=>{{let G=w(()=>br(yr.check,"self-center"));Zm(z,{state:"checked",get class(){return l(G)}})}};V(P,z=>{(v()??p())&&z(E)})}k(M,O)};let r=y(e,"owner",7),s=y(e,"name",7),i=y(e,"suffix",7),o=y(e,"provider",7),a=y(e,"avatarUrl",7),c=y(e,"local",7,!1),u=y(e,"showOwner",7,!0),d=y(e,"showForge",7,!1),f=y(e,"recent",7,!1),h=y(e,"option",7,!1),p=y(e,"selected",7,!1),g=y(e,"formStyle",7,!1),v=y(e,"checked",7),m=y(e,"class",7,""),S=ui(e,bO);const I={github:"GitHub",gitlab:"GitLab"};var C={get owner(){return r()},set owner(M){r(M),b()},get name(){return s()},set name(M){s(M),b()},get suffix(){return i()},set suffix(M){i(M),b()},get provider(){return o()},set provider(M){o(M),b()},get avatarUrl(){return a()},set avatarUrl(M){a(M),b()},get local(){return c()},set local(M=!1){c(M),b()},get showOwner(){return u()},set showOwner(M=!0){u(M),b()},get showForge(){return d()},set showForge(M=!1){d(M),b()},get recent(){return f()},set recent(M=!1){f(M),b()},get option(){return h()},set option(M=!1){h(M),b()},get selected(){return p()},set selected(M=!1){p(M),b()},get formStyle(){return g()},set formStyle(M=!1){g(M),b()},get checked(){return v()},set checked(M){v(M),b()},get class(){return m()},set class(M=""){m(M),b()},$set:Dt,$on:(M,O)=>$t(e,M,O)};{const M=G=>{{let J=w(()=>g()?20:16);th(G,{get owner(){return r()},get provider(){return o()},get avatarUrl(){return a()},get local(){return c()},get size(){return l(J)}})}},O=G=>{var J=kO(),K=te(J),Y=te(K);{var $=j=>{var ne=yO(),we=re(ne);L(()=>B(we,`${r()??""} /`)),k(j,ne)};V(Y,j=>{u()&&r()&&j($)})}var X=R(Y),de=R(X);{var me=j=>{var ne=wO(),we=re(ne);L(()=>B(we,`(${i()??""})`)),k(j,ne)};V(de,j=>{i()&&j(me)})}Q(K);var ie=R(K,2);{var q=j=>{var ne=xO(),we=te(ne);{let be=w(()=>o()==="github"?Df:$f);ut(we,{get icon(){return l(be)},size:12})}Q(ne),L(()=>xt(ne,"aria-label",I[o()])),k(j,ne)};V(ie,j=>{d()&&o()&&!g()&&j(q)})}Q(J),L(()=>{wt(J,1,`flex min-w-0 items-center gap-2 ${g()?"":"text-sm"}`),xt(K,"data-recent-repo-label",f()?"":void 0),B(X,` ${s()??""} `)}),k(G,J)};let P=w(()=>g()?t:void 0),E=w(()=>h()?"option":void 0),z=w(()=>g()?br(yr.row,"cursor-pointer focus-visible:outline-none [--menu-icon-size:1.25rem]",m()):`gap-2 py-1.5 cursor-pointer ${m()}`);ov(n,us(()=>S,{get trailing(){return l(P)},get role(){return l(E)},get selected(){return p()},get class(){return l(z)},leading:M,title:O,$$slots:{leading:!0,title:!0}}))}return Ot(C)}var _O=N('<p class="mt-1"> </p>'),SO=N('<div role="alert" class="mt-2 px-1 text-sm text-subtle"><div class="flex items-center gap-2"><span> </span> <!></div> <!></div>'),CO=N('<div role="status"><!><span> </span></div>'),MO=N('<div role="listbox"></div>'),TO=N("<p> </p>");function Gh(n,e){const t=Vi();if(new.target)return Nt({component:Gh,...n});Lt(e,!0);let r=y(e,"id",7,t),s=y(e,"items",7),i=y(e,"getKey",7),o=y(e,"getOwner",7),a=y(e,"getName",7),c=y(e,"getAvatarUrl",7),u=y(e,"provider",7),d=y(e,"label",7),f=y(e,"loading",7,!1),h=y(e,"loadingLabel",7),p=y(e,"emptyLabel",7),g=y(e,"error",7),v=y(e,"detail",7),m=y(e,"retryLabel",7),S=y(e,"onRetry",7),I=y(e,"onSelect",7),C=y(e,"selectedKey",7),M=y(e,"activeIndex",31,()=>-1),O=y(e,"scrollable",7,!0),P=y(e,"formStyle",7,!1),E=fe(void 0),z="",G=0;ft(()=>{M()>=s().length&&M(-1)});function J(j){M(Math.max(0,Math.min(s().length-1,j))),l(E)?.querySelectorAll('[role="option"]')[M()]?.focus()}function K(j,ne,we){if(!j.isComposing){if(["ArrowDown","ArrowUp","Home","End"].includes(j.key))j.preventDefault(),j.stopPropagation(),J(j.key==="Home"?0:j.key==="End"?s().length-1:we+(j.key==="ArrowDown"?1:-1));else if(j.key==="Enter"||j.key===" ")j.preventDefault(),j.stopPropagation(),I()(ne);else if(j.key.length===1&&!j.metaKey&&!j.ctrlKey&&!j.altKey){const be=Date.now();z=be-G>500?j.key:z+j.key,G=be;for(let Se=1;Se<=s().length;Se+=1){const se=(we+Se)%s().length;if(`${o()(s()[se])}/${a()(s()[se])}`.toLowerCase().startsWith(z.toLowerCase())){j.preventDefault(),J(se);break}}}}}var Y={get id(){return r()},set id(j=t){r(j),b()},get items(){return s()},set items(j){s(j),b()},get getKey(){return i()},set getKey(j){i(j),b()},get getOwner(){return o()},set getOwner(j){o(j),b()},get getName(){return a()},set getName(j){a(j),b()},get getAvatarUrl(){return c()},set getAvatarUrl(j){c(j),b()},get provider(){return u()},set provider(j){u(j),b()},get label(){return d()},set label(j){d(j),b()},get loading(){return f()},set loading(j=!1){f(j),b()},get loadingLabel(){return h()},set loadingLabel(j){h(j),b()},get emptyLabel(){return p()},set emptyLabel(j){p(j),b()},get error(){return g()},set error(j){g(j),b()},get detail(){return v()},set detail(j){v(j),b()},get retryLabel(){return m()},set retryLabel(j){m(j),b()},get onRetry(){return S()},set onRetry(j){S(j),b()},get onSelect(){return I()},set onSelect(j){I(j),b()},get selectedKey(){return C()},set selectedKey(j){C(j),b()},get activeIndex(){return M()},set activeIndex(j=-1){M(j),b()},get scrollable(){return O()},set scrollable(j=!0){O(j),b()},get formStyle(){return P()},set formStyle(j=!1){P(j),b()},$set:Dt,$on:(j,ne)=>$t(e,j,ne)},$=Je(),X=ce($);{var de=j=>{var ne=SO(),we=te(ne),be=te(we),Se=re(be,!0),se=R(be,2);{var oe=D=>{Ze(D,{variant:"ghost",type:"button",class:"underline underline-offset-2 cursor-pointer hover:no-underline",get onclick(){return S()},children:(ae,ge)=>{Ht();var ue=Vt();L(()=>B(ue,m())),k(ae,ue)},$$slots:{default:!0}})};V(se,D=>{S()&&m()&&D(oe)})}Q(we);var H=R(we,2);{var W=D=>{var ae=_O(),ge=re(ae,!0);L(()=>B(ge,v())),k(D,ae)};V(H,D=>{v()&&D(W)})}Q(ne),L(()=>B(Se,g())),k(j,ne)},me=j=>{var ne=CO(),we=te(ne);li(we,{size:12});var be=R(we),Se=re(be,!0);Q(ne),L(()=>{xt(ne,"aria-label",h()),wt(ne,1,`mt-2 flex items-center gap-2 ${P()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),B(Se,h())}),k(j,ne)},ie=j=>{var ne=MO();Cs(ne,23,s,we=>i()(we),(we,be,Se)=>{{let se=w(()=>`${r()}-${l(Se)}`),oe=w(()=>`${o()(l(be))}/${a()(l(be))}`),H=w(()=>l(Se)===Math.max(0,M())?0:-1),W=w(()=>C()?i()(l(be))===C():l(Se)===M()),D=w(()=>l(Se)===M()||i()(l(be))===C()),ae=w(()=>i()(l(be))===C()),ge=w(()=>o()(l(be))),ue=w(()=>a()(l(be))),pe=w(()=>c()?.(l(be)));jh(we,{get id(){return l(se)},option:!0,get"aria-label"(){return l(oe)},get tabindex(){return l(H)},get"aria-selected"(){return l(W)},get selected(){return l(D)},get checked(){return l(ae)},get formStyle(){return P()},get owner(){return l(ge)},get name(){return l(ue)},get avatarUrl(){return l(pe)},get provider(){return u()},onclick:()=>I()(l(be)),onmousemove:()=>M(l(Se)),onfocus:()=>M(l(Se)),onkeydown:ke=>K(ke,l(be),l(Se))})}}),Q(ne),Yn(ne,we=>x(E,we),()=>l(E)),L(()=>{xt(ne,"id",r()),xt(ne,"aria-label",d()),wt(ne,1,Xn(O()?"mt-2 max-h-56 overflow-y-auto":"mt-2"))}),k(j,ne)},q=j=>{var ne=TO(),we=re(ne,!0);L(()=>{wt(ne,1,`mt-2 ${P()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),B(we,p())}),k(j,ne)};V(X,j=>{g()?j(de):f()?j(me,1):s().length?j(ie,2):j(q,-1)})}return k(n,$),Ot(Y)}var EO=N('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),AO=N('<div class="min-w-0" data-testid="gitlab-picker-list"><!> <div class="flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring"><!> <!></div> <!> <!> <!></div>');function R0(n,e){if(new.target)return Nt({component:R0,...n});Lt(e,!0);let t=y(e,"selectedProjectPath",7),r=y(e,"onSelect",7),s=y(e,"scopeKey",7),i=y(e,"prefix",7),o=y(e,"instanceBaseUrl",7),a=y(e,"query",7),c=y(e,"page",7),u=y(e,"copy",7),d=y(e,"onSearch",7),f=y(e,"onSubmit",7),h=y(e,"submitLabel",7),p=y(e,"onMore",7),g=y(e,"onRecover",7),v=y(e,"scrollable",7,!0),m=y(e,"formStyle",7,!1),S=fe(void 0);function I(ie){if(ie.key!=="ArrowDown"||ie.isComposing)return;const q=l(S)?.querySelector('[role="option"]');q&&(ie.preventDefault(),ie.stopPropagation(),q.focus())}var C={get selectedProjectPath(){return t()},set selectedProjectPath(ie){t(ie),b()},get onSelect(){return r()},set onSelect(ie){r(ie),b()},get scopeKey(){return s()},set scopeKey(ie){s(ie),b()},get prefix(){return i()},set prefix(ie){i(ie),b()},get instanceBaseUrl(){return o()},set instanceBaseUrl(ie){o(ie),b()},get query(){return a()},set query(ie){a(ie),b()},get page(){return c()},set page(ie){c(ie),b()},get copy(){return u()},set copy(ie){u(ie),b()},get onSearch(){return d()},set onSearch(ie){d(ie),b()},get onSubmit(){return f()},set onSubmit(ie){f(ie),b()},get submitLabel(){return h()},set submitLabel(ie){h(ie),b()},get onMore(){return p()},set onMore(ie){p(ie),b()},get onRecover(){return g()},set onRecover(ie){g(ie),b()},get scrollable(){return v()},set scrollable(ie=!0){v(ie),b()},get formStyle(){return m()},set formStyle(ie=!1){m(ie),b()},$set:Dt,$on:(ie,q)=>$t(e,ie,q)},M=AO(),O=te(M);{var P=ie=>{var q=EO(),j=re(q,!0);L(()=>B(j,o())),k(ie,q)};V(O,ie=>{o()&&!i()&&ie(P)})}var E=R(O,2),z=te(E);{var G=ie=>{var q=Je(),j=ce(q);On(j,i),k(ie,q)};V(z,ie=>{i()&&ie(G)})}var J=R(z,2);{var K=ie=>{{let q=w(()=>!s());Xr(ie,{type:"search",get"aria-label"(){return u().searchLabel},get value(){return a()},get disabled(){return l(q)},get placeholder(){return u().searchPlaceholder},oninput:j=>d()(j.currentTarget.value,s()),onkeydown:I,class:"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm",noFocusStyle:!0})}};V(J,ie=>{c().status!=="unavailable"&&ie(K)})}Q(E);var Y=R(E,2);{var $=ie=>{{let q=w(()=>!a().trim()||c().status==="loading"||c().loadingMore);Ze(ie,{type:"button",variant:"secondary",class:"mt-2 w-full",get disabled(){return l(q)},onclick:()=>f()?.(a(),s()),children:(j,ne)=>{Ht();var we=Vt();L(()=>B(we,h())),k(j,we)},$$slots:{default:!0}})}};V(Y,ie=>{c().status!=="unavailable"&&f()&&h()&&ie($)})}var X=R(Y,2);Yf(X,s,ie=>{{let q=w(()=>c().status==="ready"?c().items:[]),j=w(()=>c().status==="loading"),ne=w(()=>a()?u().emptySearchLabel:u().emptyLabel),we=w(()=>c().status==="unavailable"?c().message:void 0),be=w(()=>c().status==="unavailable"?c().detail:void 0),Se=w(()=>c().status==="unavailable"?c().actionLabel:void 0),se=w(()=>g()?()=>g()?.(s()):void 0);Gh(ie,{get items(){return l(q)},getKey:oe=>oe.projectPath,getOwner:oe=>oe.projectPath.split("/").slice(0,-1).join("/"),getName:oe=>oe.projectPath.split("/").at(-1)??oe.name,getAvatarUrl:oe=>oe.ownerAvatarUrl,provider:"gitlab",get scrollable(){return v()},get formStyle(){return m()},get label(){return u().listLabel},get loading(){return l(j)},get loadingLabel(){return u().loadingLabel},get emptyLabel(){return l(ne)},get error(){return l(we)},get detail(){return l(be)},get retryLabel(){return l(Se)},get onRetry(){return l(se)},get selectedKey(){return t()},onSelect:oe=>r()(oe.projectPath,s())})}});var de=R(X,2);{var me=ie=>{Ze(ie,{type:"button",variant:"ghost",class:"mt-2 w-full",get disabled(){return c().loadingMore},onclick:()=>p()(s()),children:(q,j)=>{Ht();var ne=Vt();L(()=>B(ne,c().loadingMore?u().loadingMoreLabel:u().loadMoreLabel)),k(q,ne)},$$slots:{default:!0}})};V(de,ie=>{c().status==="ready"&&(c().hasMore||c().loadingMore)&&ie(me)})}return Q(M),Yn(M,ie=>x(S,ie),()=>l(S)),k(n,M),Ot(C)}var RO=N('<div class="py-2 px-2 flex items-center gap-2 text-xs text-emerald-500"><!> <span> </span></div>'),bm=N("<!> <span> </span>",1),PO=N('<div class="py-2 px-2 space-y-2"><p class="text-xs text-danger"> </p> <!></div>'),IO=N('<div class="py-2 px-2 space-y-1"><p class="text-xs text-subtle"> </p> <p class="text-xs text-subtle"> <code class="bg-muted px-1 rounded">auggie login</code> </p></div>'),LO=N("<!> <span> </span> <!>",1),OO=N('<div class="py-1.5 px-3 space-y-2"><div class="flex items-center justify-between gap-2"><p class="text-xs text-subtle"> </p> <!></div> <!> <div class="flex items-center gap-1.5 text-xs text-subtle"><!></div></div>'),NO=N('<div class="py-2 px-2 flex items-center gap-2 text-xs text-subtle"><!> <span> </span></div>'),DO=N('<p class="type-caption whitespace-normal text-muted-foreground"> </p>'),$O=N('<div class="first-line-icon type-caption"><!></div> <div class="flex-1 min-w-0"><p> </p> <!></div>',1),ym=N("<div><!></div>");function P0(n,e){if(new.target)return Nt({component:P0,...n});Lt(e,!0);const t=()=>rn(g,"$isAuthenticated$",a),r=()=>rn(v,"$isAuthenticating$",a),s=()=>rn(m,"$deviceFlow$",a),i=()=>rn(S,"$error$",a),o=()=>rn(I,"$requiresDaemonAuth$",a),[a,c]=Jl();let u=y(e,"message",23,()=>_.lib_githubAuth_connect_label()),d=y(e,"compact",7,!1),f=y(e,"onSuccess",7),h=y(e,"class",7,""),p=y(e,"autoStart",7,!1);const g=ev(),v=ik(),m=ok(),S=ak(),I=lk();let C=fe(!1),M=fe(!1),O=fe(!1);Lf(()=>{It.dispatch(Kd()),p()&&P()});function P(){x(C,!0),It.dispatch(_x())}function E(){l(C)&&(It.dispatch(xp()),x(C,!1))}function z(){It.dispatch(Sx()),P()}function G(){x(C,!1),x(O,!0),setTimeout(()=>{x(O,!1),typeof f()=="function"&&f()()},1e3)}async function J(){if(l(C)){if(t()){G();return}x(M,!0);try{await C1.isAuthenticated()&&(It.dispatch(Kd()),G())}catch{}finally{x(M,!1)}}}ft(()=>{!l(C)&&r()&&s()&&x(C,!0)}),ft(()=>{l(C)&&t()&&G()}),ft(()=>{if(!l(C)||!s())return;const se=()=>{J()};return window.addEventListener("focus",se),()=>{window.removeEventListener("focus",se)}}),ql(()=>{l(C)&&r()&&It.dispatch(xp())});const K=w(()=>l(C)&&r()),Y=w(()=>l(C)&&s()),$=w(()=>l(C)&&i());var X={get message(){return u()},set message(se=_.lib_githubAuth_connect_label()){u(se),b()},get compact(){return d()},set compact(se=!1){d(se),b()},get onSuccess(){return f()},set onSuccess(se){f(se),b()},get class(){return h()},set class(se=""){h(se),b()},get autoStart(){return p()},set autoStart(se=!1){p(se),b()},$set:Dt,$on:(se,oe)=>$t(e,se,oe)},de=ym(),me=te(de);{var ie=se=>{var oe=RO(),H=te(oe);ut(H,{get icon(){return Hm},size:"xs"});var W=R(H,2),D=re(W,!0);Q(oe),L(ae=>B(D,ae),[()=>_.lib_githubAuth_connected_label()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},q=se=>{var oe=PO(),H=te(oe),W=re(H,!0),D=R(H,2);Ze(D,{variant:"outline",size:"xs",onclick:z,children:(ae,ge)=>{var ue=bm(),pe=ce(ue);ut(pe,{get icon(){return Bf},size:"xs"});var ke=R(pe,2),ye=re(ke,!0);L(Z=>B(ye,Z),[()=>_.lib_githubAuth_tryAgain_label()]),k(ae,ue)},$$slots:{default:!0}}),Q(oe),L(()=>B(W,i())),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},j=se=>{var oe=IO(),H=te(oe),W=re(H,!0),D=R(H,2),ae=te(D),ge=R(ae,2);Q(D),Q(oe),L((ue,pe,ke)=>{B(W,ue),B(ae,`${pe??""} `),B(ge,` ${ke??""}`)},[()=>_.lib_githubAuth_daemonAuthFirst_message(),()=>_.lib_githubAuth_run_before(),()=>_.lib_githubAuth_inYourTerminal_after()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},ne=se=>{var oe=OO(),H=te(oe),W=te(H),D=re(W,!0),ae=R(W,2);{let Z=w(()=>_.lib_githubAuth_closeModal_ariaLabel());Ze(ae,{variant:"ghost-light",size:"icon-xs",class:"-mt-2 -mr-2",onclick:E,get"aria-label"(){return l(Z)},children:($e,lt)=>{ut($e,{get icon(){return Fi},size:"xs"})},$$slots:{default:!0}})}Q(H);var ge=R(H,2);qx(ge,{get userCode(){return s().userCode},get verificationUri(){return s().verificationUri},compact:!0});var ue=R(ge,2),pe=te(ue);{var ke=Z=>{var $e=bm(),lt=ce($e);li(lt,{size:12});var St=R(lt,2),De=re(St,!0);L(Le=>B(De,Le),[()=>_.lib_githubAuth_checking_label()]),k(Z,$e)},ye=Z=>{var $e=LO(),lt=ce($e);li(lt,{size:12});var St=R(lt,2),De=re(St,!0),Le=R(St,2);Ze(Le,{type:"button",class:"cursor-pointer underline underline-offset-2 decoration-muted-foreground/20",onclick:J,children:(Ye,Ct)=>{Ht();var bt=Vt();L(sn=>B(bt,sn),[()=>_.lib_githubAuth_checkNow_label()]),k(Ye,bt)},$$slots:{default:!0}}),L(Ye=>B(De,Ye),[()=>_.lib_githubAuth_waitingForAuthorization_label()]),k(Z,$e)};V(pe,Z=>{l(M)?Z(ke):Z(ye,-1)})}Q(ue),Q(oe),L(Z=>B(D,Z),[()=>_.lib_githubAuth_enterCode_label()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},we=se=>{var oe=NO(),H=te(oe);li(H,{size:12});var W=R(H,2),D=re(W,!0);Q(oe),L(ae=>B(D,ae),[()=>_.lib_githubAuth_startingAuthentication_label()]),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)},be=se=>{var oe=ym(),H=te(oe);{let W=w(()=>d()?"h-8":"h-auto items-start py-2");Ze(H,{type:"button",variant:"plain",get class(){return`w-full min-w-0 justify-start gap-2 px-2 type-caption font-normal text-left text-muted-foreground hover:bg-muted ${l(W)??""}`},onclick:P,children:(D,ae)=>{var ge=$O(),ue=ce(ge),pe=te(ue);nh(pe,{size:16,class:"text-ghost"}),Q(ue);var ke=R(ue,2),ye=te(ke),Z=re(ye,!0),$e=R(ye,2);{var lt=St=>{var De=DO(),Le=re(De,!0);L(Ye=>B(Le,Ye),[()=>_.lib_githubAuth_enables_description()]),k(St,De)};V($e,St=>{d()||St(lt)})}Q(ke),L(()=>{wt(ye,1,`type-caption font-normal ${d()?"truncate":"whitespace-normal"}`),B(Z,u())}),k(D,ge)},$$slots:{default:!0}})}Q(oe),Ss(3,oe,()=>Bo,()=>({axis:"y",tier:"moderate"})),k(se,oe)};V(me,se=>{l(O)?se(ie):l($)?se(q,1):o()?se(j,2):l(Y)&&s()?se(ne,3):l(K)?se(we,4):se(be,-1)})}Q(de),L(()=>wt(de,1,`min-w-0 rounded-sm ${d()?"":"bg-sidebar"} ${h()??""}`)),k(n,de);var Se=Ot(X);return c(),Se}function BO(n){return n==="folder"||n==="new"?{label:_.workspace_plainFolder_initializeGit_label(),description:_.workspace_plainFolder_initializeGit_description()}:{label:_.workspace_plainFolder_switchGitRepo_label(),description:_.workspace_plainFolder_switchGitRepo_description()}}var zO=N('<div data-testid="initialize-git-toggle"><!> <div class="min-w-0"><label class="text-sm font-medium text-foreground"> </label> <p class="text-xs text-muted-foreground"> </p></div></div>');function I0(n,e){if(new.target)return Nt({component:I0,...n});Lt(e,!0);let t=y(e,"checked",7),r=y(e,"disabled",7,!1),s=y(e,"onCheckedChange",7),i=y(e,"folder",7),o=y(e,"class",7,"");const a=w(()=>BO(i())),c=w(()=>l(a).label),u=w(()=>l(a).description),d=`initialize-git-${crypto.randomUUID()}`;var f={get checked(){return t()},set checked(C){t(C),b()},get disabled(){return r()},set disabled(C=!1){r(C),b()},get onCheckedChange(){return s()},set onCheckedChange(C){s(C),b()},get folder(){return i()},set folder(C){i(C),b()},get class(){return o()},set class(C=""){o(C),b()},$set:Dt,$on:(C,M)=>$t(e,C,M)},h=zO(),p=te(h);{let C=w(()=>`${d}-switch`),M=w(()=>`${d}-label`),O=w(()=>`${d}-description`);Gm(p,{get id(){return l(C)},get checked(){return t()},get disabled(){return r()},size:"sm",class:"mt-0.5 shrink-0",get ariaLabelledby(){return l(M)},get ariaDescribedby(){return l(O)},onCheckedChange:P=>s()(P)})}var g=R(p,2),v=te(g),m=re(v,!0),S=R(v,2),I=re(S,!0);return Q(g),Q(h),L(()=>{wt(h,1,`flex min-w-0 items-start gap-2.5 ${o()??""}`),xt(v,"id",`${d}-label`),xt(v,"for",`${d}-switch`),B(m,l(c)),xt(S,"id",`${d}-description`),B(I,l(u))}),k(n,h),Ot(f)}function FO(n){return n.githubConnected||n.gitlabConnected||n.githubFailed||n.gitlabFailed?!0:!n.githubSettled||!n.gitlabSettled}function HO(n){return n.plainFoldersOffered?n.selected?n.selected:n.hasGitRepositoryEntry?"codebase":n.forgeState==="none"||n.hasPlainFolderEntry?"folder":"codebase":"codebase"}function UO(n){return n.githubConnected||n.gitlabConnected?"connected":n.githubFailed||!n.githubSettled||n.gitlabFailed||!n.gitlabSettled?"unknown":"none"}const VO=It.createSelector(n=>n.userPreferences?.labsPlainFolderWorkspacesEnabled===!0&&M1(n.daemonHealth?.stats?.protocolVersion)),g$=It.createSelector(n=>{const e=n.workspace?.workspaces?Kf(n.workspace.workspaces).filter(s=>s.id!==Cx):[],t=n.gitlabAuth?.statusFailed===!0,r=T1({rememberedChoice:null,workspacesLoaded:n.workspace?.hasLoaded===!0,hasGitWorkspace:E1(e),githubConnected:n.githubAuth?.isAuthenticated===!0,githubSettled:n.githubAuth?.statusSettled===!0,githubFailed:n.githubAuth?.statusFailed===!0,gitlabConnected:n.gitlabAuth?.isConfigured===!0,gitlabSettled:n.gitlabAuth?.statusReady===!0||t,gitlabFailed:t});return r===null?"pending":r?"on":"off"}),WO=It.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return FO({githubConnected:n.githubAuth?.isAuthenticated===!0,githubSettled:n.githubAuth?.statusSettled===!0,githubFailed:n.githubAuth?.statusFailed===!0,gitlabConnected:n.gitlabAuth?.isConfigured===!0,gitlabSettled:n.gitlabAuth?.statusReady===!0||e,gitlabFailed:e})}),KO=It.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return UO({githubConnected:n.githubAuth?.isAuthenticated===!0,githubSettled:n.githubAuth?.statusSettled===!0,githubFailed:n.githubAuth?.statusFailed===!0,gitlabConnected:n.gitlabAuth?.isConfigured===!0,gitlabSettled:n.gitlabAuth?.statusReady===!0||e,gitlabFailed:e})}),jO=It.createSelector(n=>n.githubRepos.repos),GO=It.createSelector(n=>Kf(jO.select(n))),qO=It.createSelector(n=>n.githubRepos.loading),JO=It.createSelector(n=>n.githubRepos.error),XO=It.createSelector(n=>n.githubRepos.loaded),YO=It.createSelector(n=>n.githubRepoSearch.results),QO=It.createSelector(n=>Kf(YO.select(n))),ZO=It.createSelector(n=>n.githubRepoSearch.loading),eN=It.createSelector(n=>n.githubRepoSearch.lastQuery);var tN=N('<div data-recent-repo-row=""><!> <!> <!></div>'),nN=N(" <!>",1),Sc=N("<!> <!>",1),rN=N('<span class="text-sm pl-3 shrink-0 select-none"> </span>'),wm=N("<span> </span>"),xm=N('<span class="text-sm text-subtle ml-1"> </span>'),km=N("<span> </span> <!>",1),sN=N('<span class="min-w-0 flex-1 text-left truncate"><!> <!></span>'),iN=N("<div><!> <!> <!> <!> <!></div>"),oN=N('<div class="flex min-h-10 items-center gap-2 px-3 py-2"><div class="w-4 h-4 bg-muted rounded animate-pulse"></div> <div class="h-4 bg-muted rounded flex-1 animate-pulse"></div></div>'),aN=N('<div role="status"></div>'),lN=N('<p class="type-body px-3 py-2 text-muted-foreground" role="status"> </p>'),cN=N("<!> <span> </span>",1),uN=N('<div class="shrink-0 px-2 pt-1"><!></div> <div class="min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1" data-testid="recent-repositories" role="group"><!></div> <div class="shrink-0 border-t border-border p-2"><!></div>',1),dN=N('<div class="flex shrink-0 items-center gap-1 px-2 pt-2 pb-2"><!> <h2> </h2></div>'),fN=N('<div class="shrink-0 px-4 pt-2 pb-3"><h2 class="text-base font-semibold text-foreground"> </h2> <p class="text-sm text-subtle mt-1"> </p></div>'),hN=N('<div class="flex items-center justify-between gap-2 mt-2 px-1"><span class="text-sm text-subtle truncate flex-1"> </span> <!></div>'),pN=N('<!> <!> <div class="flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring"><!> <!></div> <!> <!>',1),gN=N('<span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <span><div class="truncate"> </div> <!></span>',1),mN=N('<div class="mt-2 px-1"><span class="text-sm text-danger"> </span></div>'),vN=N('<div class="flex items-center gap-2 text-sm text-subtle"><!> <span> </span></div>'),Cc=N('<div class="flex items-center justify-between gap-2"><span class="text-sm text-subtle"> </span> <!></div>'),bN=N('<div class="flex items-center justify-between gap-2"><span class="text-sm text-warning-ink"> </span> <!></div>'),yN=N('<div class="mt-2 px-1"><div class="text-sm text-subtle truncate mb-2"> </div> <!></div>'),wN=N('<!> <div class="flex items-center gap-3"><span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <!></div> <!>',1),xN=N('<div role="button" tabindex="0" class="w-full flex items-center gap-2 px-3 py-2 rounded-lg bg-sidebar text-left cursor-pointer hover:bg-muted/50 transition-colors"><!> <div class="flex-1 min-w-0"><div class="text-sm"> </div> <div class="text-xs text-subtle"> </div></div> <!></div>'),kN=N('<div class="text-sm text-subtle px-3 py-2"> </div>'),_N=N("<!> ",1),SN=N('<div class="space-y-1"><!> <!> <!></div>'),CN=N('<div class="mx-3 mb-3 p-3 bg-sidebar rounded-lg"><div class="flex items-start gap-3"><!> <div class="flex-1 min-w-0"><div class="text-sm font-medium truncate mb-1"> </div> <div class="text-sm text-subtle mb-2"> </div> <div class="flex gap-2"><!> <!></div></div></div></div>'),MN=N('<div class="flex items-center gap-2 py-1.5"><div class="w-4 h-4 bg-muted rounded animate-pulse"></div> <div class="h-4 bg-muted rounded flex-1 animate-pulse"></div></div>'),TN=N('<div class="space-y-1"></div>'),EN=N('<div class="-mx-2" data-testid="recent-repositories"><!></div>'),AN=N('<div class="min-h-16 overflow-y-auto flex-1 px-4 pb-3 pt-2"><!> <!></div>'),RN=N('<div class="shrink-0 px-3 mb-3"><!> <!></div> <!> <!>',1),PN=N("<!> <!> <!>",1),IN=N('<div class="relative min-w-0"><!></div> <!> <!>',1);function js(n,e){const t=Vi();if(new.target)return Nt({component:js,...n});Lt(e,!0);const r=()=>rn(K,"$hostMember$",G),s=()=>rn(Y,"$canAdministerHost$",G),i=()=>rn(pe,"$isGithubAuthenticated$",G),o=()=>rn(D,"$recentRepoRefresh$",G),a=()=>rn($,"$admission$",G),c=()=>rn(se,"$workspaceInitializerRecentRepos$",G),u=()=>rn(be,"$dismissedRecentRepoKeys$",G),d=()=>rn(ca,"$cloneSourceVisible$",G),f=()=>rn(oe,"$workspaceInitializerRemoteSetups$",G),h=()=>rn(Se,"$defaultParentPath$",G),p=()=>rn(ae,"$directoryStatusCheck$",G),g=()=>rn(Ao,"$plainFolderCreationAvailable$",G),v=()=>rn(ki,"$forgeConnectionState$",G),m=()=>rn(ye,"$githubRepos$",G),S=()=>rn(Le,"$githubSearchLastQuery$",G),I=()=>rn(St,"$githubSearchResults$",G),C=()=>rn($e,"$githubReposLoaded$",G),M=()=>rn(Z,"$githubReposLoading$",G),O=()=>rn(lt,"$githubReposError$",G),P=()=>rn(we,"$initializerHydrated$",G),E=()=>rn(Fe,"$remoteWorkspacesEnabled$",G),z=()=>rn(De,"$githubSearchLoading$",G),[G,J]=Jl(),K=Nf(),Y=vw(),$=bw(),X=Ga("RepoSelector"),de=Xf(),me=new Qf;let ie=fe(null),q=fe(!1);const j=_.workspace_isolationMode_worktree_label(),ne=It.dispatch,we=A1(),be=R1(),Se=P1(),se=I1(),oe=L1(),H=crypto.randomUUID(),W=crypto.randomUUID(),D=O1(H),ae=N1(W);let ge,ue;const pe=ev(),ke=w(()=>r()||s()&&i()),ye=GO(),Z=qO(),$e=XO(),lt=JO(),St=QO(),De=ZO(),Le=eN();function Ye(T,F){const Ce=T.includes("\\")?"\\":"/";return`${T.replace(/[/\\]$/,"")}${Ce}${F}`}let Ct=y(e,"variant",7,"ghost"),bt=y(e,"value",7,""),sn=y(e,"onchange",7),Be=y(e,"triggerClass",7),he=y(e,"rowLabel",7),Ne=y(e,"displayValue",7),je=y(e,"triggerSuffix",7),Tt=y(e,"triggerValueClass",7,"text-subtle"),ee=y(e,"triggerContentClass",7,"gap-0.75"),Ge=y(e,"emptyLabel",7),it=y(e,"showEmptyIcon",7,!1),Xe=y(e,"showTriggerChevron",7,!1),mt=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),Mt=y(e,"triggerIcon",7),Ue=y(e,"triggerAriaLabel",7),Ke=y(e,"onClear",7),Me=y(e,"gitlab",7),Xt=y(e,"gitlabSelected",7,!1),tn=y(e,"plainFolderMode",7,!1),es=y(e,"plainFolderSelected",7,!1),le=y(e,"gitChoice",7);function ot(T){yn++,sn()&&sn()(new CustomEvent("change",{detail:T}))}function At(){l(qe)&&l(qe).focus()}function Zt(T="local"){l(Ve)&&!bt()&&(x(Ve,""),x(ht,""),x(at,"local"),x(Lr,"")),We=T,he()&&x(Pn,"add"),x(Re,!0)}let Ve=fe(Ar(bt())),ht=fe(Ar(bt())),Et=fe(""),qe=fe(void 0),yt=fe(null),Re=fe(!1),We=null,Pt=fe(!1);const Qe=w(()=>!o()||o().admission===a()&&o().status==="pending");let ze=fe(!1),pt=fe(!1),at=fe(Ar(nn(bt()))),Bt=fe(""),rt=fe(null);const Yt=w(()=>{const T=c(),F=o();return!F||F.admission!==a()||It.dispatch!==ne?T:B1({saved:T,source:F,dismissed:u(),mode:he()?"all":"recent"})});async function Vn(T,F){T.preventDefault(),T.stopPropagation();const Ce=T.currentTarget,Ft=Ce.closest("[data-recent-repo-row]"),vn=Ft?.nextElementSibling??Ft?.previousElementSibling,Qs=Ce.closest('[role="dialog"]'),Xi=vn?.querySelector("[data-remove-recent-repo]")??Qs?.querySelector('[role="tab"][aria-selected="true"]')??Qs?.querySelector("[data-repo-search]");It.dispatch(Lx({path:F.path,type:F.type})),await qo(),Xi?.focus()}let Qn=fe(null),Gr=fe(null),hs=null,zt=fe("github"),ps=fe("github");const bn=w(()=>[...i()?[{id:"github",label:"github.com/",icon:Df}]:[],...Me()?.authenticated&&Me().instanceBaseUrl?[{id:"gitlab",label:`${Me().instanceBaseUrl.replace(/^https:\/\//,"").replace(/\/$/,"")}/`,icon:$f}]:[]]),$s=w(()=>l(bn).find(T=>T.id===l(ps))??l(bn)[0]),ji=w(()=>l($s)?.id??"github"),Ys=w(()=>l(zt)==="github"||l(zt)==="gitlab"),To=w(()=>l($s)?.label??_.workspace_repoSelector_clone_tab()),ca=WO(),A=w(()=>d()||l(bn).length>0||r());function ve(T){return!l(A)&&(T==="github"||T==="gitlab")?"local":T}function Ee(){x(Re,!1),gk({tab:"connections",hash:"integrations"}).catch(T=>X.error("Failed to open connection settings",T))}function gt(T){l(bn).some(F=>F.id===T)&&(x(ps,T,!0),x(zt,T,!0))}ft(()=>{if(!(!l(Re)||l(zt)!=="gitlab"))return ii(()=>{const T=Me();if(T)return T.onOpenChange?.(!0,T.scopeKey),()=>ii(()=>{const F=Me()??T;F.onOpenChange?.(!1,F.scopeKey)})})}),ft(()=>{l(Re)&&l(zt)==="gitlab"&&!Me()&&x(Re,!1)}),ft(()=>{l(Ys)&&x(zt,ve(l(ji)),!0)});let Ie=fe(!1),xe=fe("select-repo"),on=fe(Ar(_.workspace_repoSelector_selectFolder_title())),gn=fe(void 0);const Fe=O_("remote-workspaces");let Gt=fe(Ar(f())),_n=fe(!1);ft(()=>{x(Gt,f(),!0)});function Sn(T=l(Gt)){It.dispatch(Ox(pk(T)))}function gs(T){x(Ve,T.name,!0),x(ht,""),x(at,"local"),x(ze,!1),x(pt,!0);const F={path:T.workspacePath||T.name,type:"remote",remoteSetup:T,isNewRepo:!1,isValidPath:!0};ot(F),x(Re,!1)}function Bs(T){const F=l(Gt).filter(Ce=>Ce.id!==T);x(Gt,F,!0),Sn(F)}function di(){x(_n,!0)}function Eo(T){const F=[...l(Gt),T];x(Gt,F,!0),Sn(F),x(_n,!1)}let xi=fe(!1),ir=fe(""),ts=fe("new-project"),fi=fe(""),Lr=fe("");function qu(){return od(h(),tn())}ft(()=>{const T=tn(),F=h();ii(()=>{l(ir)===od(F,!T)&&x(ir,od(F,T),!0)})});function nc(T){It.dispatch(Px(T))}function U(T){if(!T||T.trim().length===0)return;const F=T.trim();if(F.includes("/")||F.includes("\\"))return _.workspace_repoSelector_nameSeparators_error();if(F===".."||F==="."||/^\.+$/.test(F))return _.workspace_repoSelector_nameDots_error();if(F.includes("\0"))return _.workspace_repoSelector_nameNull_error();if(/[<>:"|?*]/.test(F))return _.workspace_repoSelector_nameInvalid_error();if(F.length>255)return _.workspace_repoSelector_nameTooLong_error()}const Pe=w(()=>U(l(ts))),Oe=w(()=>l(ir)&&l(ts)&&!l(Pe)?Ye(l(ir),l(ts)):""),dt=w(()=>p()?.admission===a()&&p().path===l(Oe)&&p().status==="ready"?p().result:null);let Ut=fe(null);const en=w(()=>p()?.admission===a()&&p().path===l(Oe)&&(p().status==="failed"||p().status==="unsupported")),Cn=w(()=>tn()?l(en)?"existing":F1(l(dt),l(Ut)?.parent===l(ir)?l(Ut).inRepo:null):null);ft(()=>{const T=l(ir);if(!tn()||!T||l(Ut)?.parent===T)return;let F=!1;return cd("file:getDirectoryStatus",{path:T}).then(Ce=>!!(Ce?.success&&(Ce.data?.isGitRepo||Ce.data?.isSubdirectoryOfGitRepo))).catch(()=>!1).then(Ce=>{F||x(Ut,{parent:T,inRepo:Ce},!0)}),()=>{F=!0}});const ln=w(()=>p()?.admission===a()&&p().path===l(Oe)&&p().status==="pending");let Ae=fe(!1),st=fe(""),yn=0;const mn=w(()=>()=>{const T=l(Yt).filter(Ce=>l(zt)==="local"?Ce.type==="local":l(Ys)&&Ce.type==="github"),F=l(zt)==="gitlab"?Me()?.query??"":l(Et);return F===""?T:T.filter(Ce=>vp(Ce,F))});let Pn=fe("browse"),ms=fe(""),vs=fe(null),hi=fe(void 0);const bs=w(()=>{if(l(Yt).some(_i))return l(Yt);let T;if(Xt()&&Me()?.instanceBaseUrl&&Me().selectedProjectPath){const F=Me().selectedProjectPath,Ce=`${Me().instanceBaseUrl}/${F}`;T={path:Ce,type:"github",githubUrl:Ce,name:F.split("/").at(-1),owner:F.split("/").slice(0,-1).join("/"),repositoryIdentity:{provider:"gitlab",instanceBaseUrl:Me().instanceBaseUrl,projectPath:F}}}else if(!Xt()&&l(Ve)){const F=l(at)==="github"?Wt(l(Lr)||l(Ve)):null;T=F?{path:`${F.owner}/${F.repo}`,type:"github",githubUrl:`https://github.com/${F.owner}/${F.repo}`,name:F.repo,owner:F.owner}:{path:l(Ve),type:"local",name:D1(l(Ve)),...es()?{plainFolder:!0}:{}}}return T?[T,...l(Yt)]:l(Yt)}),Ao=VO(),ki=KO(),Gi=T=>T.type==="local"&&T.plainFolder===!0,or=w(()=>{const T=l(bs).find(_i);return T?es()||Gi(T)?"folder":"codebase":null}),zs=w(()=>he()?HO({plainFoldersOffered:g(),forgeState:l(bn).length>0||r()?"connected":v(),hasGitRepositoryEntry:l(bs).some(F=>!Gi(F)),hasPlainFolderEntry:l(bs).some(Gi),selected:l(or)})==="folder"?_.workspace_compactInitializer_folder_label():he():void 0),pi=w(()=>g()?_.workspace_repoSelector_searchWithFolders_placeholder():_.workspace_repoSelector_search_placeholder()),ys=w(()=>g()?_.workspace_repoSelector_addRepositoryOrFolder_label():_.workspace_repoSelector_addRepository_label()),qi=w(()=>Ge()??(he()?l(ys):_.workspace_repoSelector_selectRepository_label())),Fs=w(()=>l(ms).trim()===""?l(bs):l(bs).filter(T=>vp(T,l(ms).trim())));function Ji(T){const F=sl(T,Me()?.instanceBaseUrl);return T.type!=="local"&&F?.provider==="gitlab"&&(!Me()?.authenticated||F.instanceBaseUrl!==Me().instanceBaseUrl||!Me().scopeKey&&!Me().onSelectRecent||Me().page.status==="unavailable")}function _i(T){const F=sl(T,Me()?.instanceBaseUrl);return T.type!=="local"&&F?.provider==="gitlab"?Xt()&&Me()?.instanceBaseUrl===F.instanceBaseUrl&&Me().selectedProjectPath===F.projectPath:Xt()||!l(Ve)?!1:T.type==="github"?l(at)==="github"&&dn(T.githubUrl||T.path,l(Lr)||l(Ve)):l(at)!=="github"&&T.path===l(Ve)}function ua(){return[...l(hi)?.querySelectorAll("[data-recent-repo-row]")??[]].map(T=>T.querySelector("button:not([data-remove-recent-repo])")).filter(T=>!!T&&!T.disabled)}function Ja(T){if(!T.isComposing){if(T.key==="ArrowDown"){const F=ua()[0];if(!F)return;T.preventDefault(),F.focus()}else if(T.key==="Enter"){T.preventDefault(),T.stopPropagation();const F=l(Fs).find(Ce=>!Ji(Ce));F&&rc(F)}}}function Xa(T){if(T.key!=="ArrowDown"&&T.key!=="ArrowUp")return;const F=ua(),Ce=F.indexOf(document.activeElement);if(!(Ce<0))if(T.preventDefault(),T.key==="ArrowUp"&&Ce===0)l(vs)?.focus();else{const Ft=T.key==="ArrowDown"?1:-1;F[Math.min(F.length-1,Ce+Ft)]?.focus()}}function Ya(){const T=l(ms).trim();if(T&&l(A)){const F=Wt(Mn(T));F?(x(ps,"github"),x(zt,"github"),Kn(`${F.owner}/${F.repo}`)):l(zt)==="github"&&Kn(T)}x(Pn,"add"),qo().then(()=>{l(zt)==="github"&&l(yt)?.focus()})}function ar(){x(Pn,"browse"),qo().then(()=>l(vs)?.focus())}function kr(T){const F=T==="repository"?l(ji):T;he()&&F==="local"&&Wt(l(ht))&&qr(""),x(zt,F,!0)}const lr=w(()=>l(fi).trim()),Es=w(()=>{const T=m();if(!T.length)return[];const F=l(lr).toLowerCase();return F?T.filter(Ce=>`${Ce.owner}/${Ce.name}`.toLowerCase().includes(F)):T}),ns=w(()=>{if(S()!==l(lr))return[];const T=I();if(!T.length)return[];const F=new Set(m().map(Ce=>Ce.id));return T.filter(Ce=>!F.has(Ce.id))}),Fn=w(()=>l(zt)==="github"&&l(ke)?[...l(Es),...l(ns)]:[]),_r=w(()=>{const T=l(Qn);if(!T)return!1;const F=T.owner.toLowerCase(),Ce=T.repo.toLowerCase();return l(Fn).some(Ft=>Ft.owner.toLowerCase()===F&&Ft.name.toLowerCase()===Ce)});let tt=fe(-1);ft(()=>{l(Fn),x(tt,-1)}),ft(()=>{l(zt)==="github"&&l(ke)&&!C()&&!M()&&!O()&&It.dispatch(kp())});function Kt(){It.dispatch(kp())}function un(T){x(fi,`${T.owner}/${T.name}`),x(Qn,{owner:T.owner,repo:T.name,url:`https://github.com/${T.owner}/${T.name}`},!0),Xu()}function Zn(T){if(!T.isComposing){if(T.key==="Enter"){T.preventDefault(),T.stopPropagation(),As();return}if(T.key==="ArrowDown"){if(!l(Fn).length)return;T.preventDefault(),x(tt,Math.min(l(tt)+1,l(Fn).length-1),!0);return}if(T.key==="ArrowUp"){if(!l(Fn).length)return;T.preventDefault(),x(tt,Math.max(l(tt)-1,-1),!0)}}}function As(){const T=l(tt)>=0?l(Fn)[l(tt)]:void 0;T?un(T):Xu()}let Rs=fe(-1);ft(()=>{l(mn)(),x(Rs,-1)});function nn(T){return T&&Wt(T)?"github":"local"}function dn(T,F){const Ce=Wt(T),Ft=Wt(F);return!!Ce&&!!Ft&&Ce.owner.toLowerCase()===Ft.owner.toLowerCase()&&Ce.repo.toLowerCase()===Ft.repo.toLowerCase()}ft(()=>{bt()&&bt()!==l(Ve)&&(x(Ve,bt()),x(ht,bt()),x(at,nn(bt()),!0),l(Lr)&&!dn(l(Lr),bt())&&x(Lr,""))});function Wn(){if(x(q,!Qm(l(ie),360)),x(Et,""),he()&&l(Pn)==="browse")x(ms,""),requestAnimationFrame(()=>{l(Re)&&l(Pn)==="browse"&&l(vs)?.focus()});else if(he()){We&&(x(zt,We,!0),We=null);return}const T=l(Ve)||bt();if(X.info("Dropdown opened",{currentValue:T,selectedRepoType:l(at)}),We)x(zt,We,!0),We=null;else if(Xt()&&l(bn).some(F=>F.id==="gitlab"))x(ps,"gitlab"),x(zt,"gitlab");else if(T){if(x(zt,ve(l(at)==="github"?l(ji):l(at)),!0),l(at)==="github"&&l(A)&&l(ht)){const F=Wt(l(ht));F&&(x(fi,`${F.owner}/${F.repo}`),qr(`https://github.com/${F.owner}/${F.repo}`,""))}}else x(zt,ve(l(ji)),!0);requestAnimationFrame(()=>{he()||l(Re)&&l(zt)!=="gitlab"&&l(qe)&&(l(qe).focus(),l(qe).select())})}let Or=!1;ft(()=>{const T=l(Re);T&&!Or?Wn():!T&&Or&&he()&&!l(Pt)&&!l(Ie)&&x(Pn,"browse"),Or=T}),ft(()=>{if(l(Re))return ja(T=>{T.isComposing||x(Re,!1)})}),ft(()=>{l(zt)==="new"&&!l(ir)&&x(ir,qu(),!0)}),ft(()=>{const T=l(Oe),F=a();!T||!l(ir)||!l(ts)||!F||(ue=crypto.randomUUID(),It.dispatch(Mx(W,ue,F,T)))}),ft(()=>{s()&&It.dispatch(Kd())}),ft(()=>{const T=a(),F=Me()?.instanceBaseUrl;P(),!(!T||It.dispatch!==ne)&&(ge=crypto.randomUUID(),It.dispatch(Tx(H,ge,T,F)))}),ql(()=>{ge&&ne(Ex(H,ge)),ue&&ne(Ax(W,ue))});function Wt(T){const F=T.trim();if(!F)return null;if(F.startsWith("git@github.com:")){const Ft=F.slice(15).replace(/\.git$/,"").split("/");return Ft.length>=2&&Ft[0]&&Ft[1]?{owner:Ft[0],repo:Ft[1]}:null}try{const Ce=new URL(F);if(Ce.hostname!=="github.com"&&Ce.hostname!=="www.github.com"||Ce.protocol!=="http:"&&Ce.protocol!=="https:")return null;const Ft=Ce.pathname.split("/").filter(Boolean);if(Ft.length<2)return null;const vn=Ft[0],Qs=Ft[1].replace(/\.git$/,"");if(vn&&Qs)return{owner:vn,repo:Qs}}catch{}if(!F.includes("\\")&&!F.includes(":")&&!F.startsWith(".")&&!F.startsWith("/")){const Ce=F.split("/");if(Ce.length===2&&Ce[0]&&Ce[1]){const Ft=vn=>/^[a-zA-Z0-9]([a-zA-Z0-9\-_\.]*[a-zA-Z0-9])?$/.test(vn)||/^[a-zA-Z0-9]$/.test(vn);if(Ft(Ce[0])&&Ft(Ce[1]))return{owner:Ce[0],repo:Ce[1]}}}return null}function Mn(T){const F=T.trim();if(!F)return"";const Ce=Wt(F);if(Ce)return`${Ce.owner}/${Ce.repo}`;if(F.toLowerCase().startsWith("github.com/")){const Ft=F.slice(11),vn=Ft.split("/").filter(Boolean);return vn.length>=2?`${vn[0]}/${vn[1].replace(/\.git$/,"")}`:Ft.replace(/\/$/,"")}if(F.toLowerCase().startsWith("www.github.com/")){const Ft=F.slice(15),vn=Ft.split("/").filter(Boolean);return vn.length>=2?`${vn[0]}/${vn[1].replace(/\.git$/,"")}`:Ft.replace(/\/$/,"")}return F.replace(/\/$/,"").replace(/\.git$/,"")}function Kn(T){let F=T;F.toLowerCase().startsWith("https://github.com/")?F=F.slice(19):F.toLowerCase().startsWith("http://github.com/")?F=F.slice(18):F.toLowerCase().startsWith("github.com/")&&(F=F.slice(11)),x(fi,F,!0),F?qr(`https://github.com/${F}`,F):qr(""),Sr(F)}function Sr(T){l(ke)&&It.dispatch(Rx(T.trim()))}function Hs(T){const F=T.clipboardData?.getData("text")||"";if(F){T.preventDefault();const Ce=Mn(F);x(fi,Ce,!0),Ce&&qr(`https://github.com/${Ce}`,Ce),Sr(Ce)}}async function rs(T){try{const F=await cd("file:getDirectoryStatus",{path:T});F.success&&F.data&&(x(rt,F.data,!0),x(ze,!F.data.exists&&!F.data.isSubdirectoryOfGitRepo,!0),F.data.exists&&!F.data.isDirectory&&x(pt,!1))}catch(F){X.warn("Failed to check directory status",F)}}function qr(T,F=T){x(ht,T,!0),x(Et,F,!0),hs&&clearTimeout(hs),x(Qn,null),x(Gr,null),x(Bt,""),hs=setTimeout(()=>{Ju(T)},300)}function Nr(T){return T.startsWith("https://github.com")||T.startsWith("http://github.com")||T.startsWith("github.com")||T.startsWith("github:")||T.startsWith("git@github.com")}async function Ju(T){if(!T||T.trim()===""){x(Qn,null),x(Gr,null);return}if(T.startsWith("/")||T.startsWith("~")||T.includes(":\\")||T.startsWith("./")||T.startsWith("../")){x(Qn,null),x(Gr,T,!0),await rs(T);return}if(Nr(T)){const F=Wt(T);if(F){const Ce=`https://github.com/${F.owner}/${F.repo}`;x(Gr,null),x(Qn,{owner:F.owner,repo:F.repo,url:Ce},!0);return}}x(Qn,null),x(Gr,null)}function rc(T){if(yn++,he()&&_i(T)){x(Re,!1);return}const F=sl(T,Me()?.instanceBaseUrl);if(T.type!=="local"&&F?.provider==="gitlab"){if(!Me()?.authenticated||F.instanceBaseUrl!==Me().instanceBaseUrl||!Me().scopeKey&&!Me().onSelectRecent||Me().page.status==="unavailable")return;Me().onSelectRecent?Me().onSelectRecent(F.projectPath,F.instanceBaseUrl):Me().onSelect(F.projectPath,Me().scopeKey),x(Re,!1);return}if(T.type==="local"&&(tn()||T.plainFolder===!0)){O0(T);return}Jh(T)}async function Qa(T){try{const F=await cd("file:getDirectoryStatus",{path:T});return F?.success&&F.data?F.data:null}catch(F){return X.warn("Failed to check directory status",F),null}}async function O0(T){const F=yn,Ce=await Qa(T.path);if(F!==yn)return;const Ft=!!Ce&&(Ce.isGitRepo||!!Ce.isSubdirectoryOfGitRepo);if(Ce?Ce.exists&&Ce.isDirectory&&!Ft:T.plainFolder===!0||tn()){if(tn()){Za(T.path,"existing");return}x(st,T.path,!0),x(Ae,!0);return}if(tn()&&Ce&&!Ce.exists&&!Ft){Za(T.path,"new");return}Jh(T,Ce?.isSubdirectoryOfGitRepo?Ce.relativePathFromGitRoot:"")}function Jh(T,F=""){const Ce=T.type==="github"&&T.githubUrl?Wt(T.githubUrl):null,Ft=Ce?`${Ce.owner}/${Ce.repo}`:T.path;x(Ve,Ft,!0),x(ht,T.type==="github"?T.githubUrl:T.path,!0),x(at,T.type,!0),x(Lr,T.type==="github"&&T.githubUrl||"",!0),x(ze,!1),x(pt,!0),x(Bt,""),x(rt,null);const vn={path:Ft,type:T.type,isNewRepo:!1,isValidPath:!0};F&&(vn.scope=F),T.type==="github"&&T.githubUrl&&(vn.githubUrl=T.githubUrl),ot(vn),x(Re,!1)}function Xh(T,F,Ce){x(xe,T,!0),x(on,F,!0),x(gn,Ce,!0),Qx({title:F,defaultPath:Ce,openModal:()=>x(Ie,!0),onSelect:Yh})}function N0(){Xh("select-repo",_.workspace_repoSelector_selectRepoFolder_title(),typeof l(Ve)=="string"?l(Ve):void 0)}async function D0(T){yn++;try{if(await rs(T),l(rt)?.exists&&!l(rt)?.isGitRepo&&!l(rt)?.isSubdirectoryOfGitRepo){if(tn()){Za(T,"existing");return}x(st,T,!0),x(Ae,!0);return}x(Ve,T,!0),x(ht,T,!0),x(Lr,""),x(at,"local"),x(pt,!0),x(Bt,"");const F={path:T,type:"local",isNewRepo:l(ze),isValidPath:!0,scope:l(rt)?.relativePathFromGitRoot};ot(F),x(Re,!1)}catch(F){X.error("Failed to select folder",F)}}function $0(){x(Pt,!0),Xh("new-repo-parent",_.workspace_repoSelector_selectNewRepoParent_title(),l(ir)||void 0)}function da(){if(!l(ir)||!l(ts)||l(Pe))return;const T=Ye(l(ir),l(ts));x(Ve,T,!0),x(ht,T,!0),x(Lr,""),x(pt,!0),x(Bt,""),x(rt,null),x(at,"new");const F=l(dt)?.exists&&l(dt)?.isGitRepo,Ce=l(Cn);if(Ce){Za(T,Ce),x(xi,!1);return}x(ze,!F),ot({path:T,type:"local",isNewRepo:!F,isValidPath:!0}),nc(l(ir)),x(xi,!1),x(Re,!1)}async function Yh(T){x(Ie,!1);const F=l(xe);if(F==="select-repo"){await D0(T);return}F==="new-repo-parent"&&(x(ir,T,!0),nc(l(ir))),x(Pt,!1),x(Re,!0)}function B0(){x(Ie,!1),l(xe)!=="select-repo"&&(x(Pt,!1),x(Re,!0))}function Xu(){const T=Wt(l(fi));if(!T)return;const F={owner:T.owner,repo:T.repo,url:`https://github.com/${T.owner}/${T.repo}`},Ce=`${F.owner}/${F.repo}`,Ft={path:Ce,type:"github",githubUrl:F.url,isNewRepo:!1,isValidPath:!0};x(Ve,Ce),x(ht,F.url,!0),x(Lr,F.url,!0),x(at,"github"),x(pt,!0),x(Bt,""),ot(Ft),x(Re,!1)}function z0(){if(!l(st))return;x(Ve,l(st),!0),x(ht,l(st),!0),x(Lr,""),x(at,"local"),x(ze,!0),x(pt,!0),x(Bt,"");const T={path:l(st),type:"local",isNewRepo:!0,isValidPath:!0};ot(T),x(Ae,!1),x(st,""),x(Re,!1)}function Za(T,F){x(Ve,T,!0),x(ht,T,!0),x(Lr,""),x(at,F==="new"?"new":"local",!0),x(ze,!1),x(pt,!0),x(Bt,""),x(rt,null),ot({path:T,type:"local",isNewRepo:!1,isValidPath:!0,plainFolder:F}),x(Ae,!1),x(st,""),x(Re,!1)}function F0(T,F){const Ce=F==="local"&&l(Ae)?l(st):"";le()?.onCheckedChange(T,F),Ce&&!T&&Za(Ce,"existing")}function H0(){x(Ae,!1),x(st,""),x(Gr,null),x(rt,null),x(ht,""),x(Et,"")}function U0(){if(!l(Ve))return _.workspace_repoSelector_selectRepository_label();if(l(at)==="github"&&l(Lr)){const F=Wt(l(Lr));if(F)return`${F.owner}/${F.repo}`}if(l(Ve).match(/^[^\/]+\/[^\/]+$/)&&!l(Ve).includes("\\")&&!l(Ve).startsWith("/"))return l(Ve);const T=l(Ve).split(/[\/\\]/);return T[T.length-1]||l(Ve)}const Yu=w(()=>Xt()?Ne()??Me()?.selectedProjectPath??"":Ne()??U0()),sc=w(()=>Xt()?!!l(Yu):!!l(Ve)),Qu=`${t}-github-suggestions`,Qh=w(()=>Xt()&&Me()?.authenticated&&Me().scopeKey&&Me().page.status!=="unavailable"&&Me().selectedProject?.projectPath===Me().selectedProjectPath?Me().selectedProject:void 0),Zh=w(()=>Xt()?null:$1({selectedValue:l(Ve),selectedRepoType:l(at),confirmedGithubUrl:l(Lr)},Wt)),Zu=w(()=>l(bs).find(_i)),ed=w(()=>l(Zu)?sl(l(Zu),Me()?.instanceBaseUrl):null);function ep(T){if(!(T?.provider!=="gitlab"||!Me()?.authenticated||!Me().scopeKey||T.instanceBaseUrl!==Me().instanceBaseUrl||Me().page.status!=="ready"))return(Me().page.items.find(F=>F.projectPath===T.projectPath)??(Me().selectedProject?.projectPath===T.projectPath?Me().selectedProject:void 0))?.ownerAvatarUrl}var V0={focusInput:At,openOnLocalTab:Zt,get variant(){return Ct()},set variant(T="ghost"){Ct(T),b()},get value(){return bt()},set value(T=""){bt(T),b()},get onchange(){return sn()},set onchange(T){sn(T),b()},get triggerClass(){return Be()},set triggerClass(T){Be(T),b()},get rowLabel(){return he()},set rowLabel(T){he(T),b()},get displayValue(){return Ne()},set displayValue(T){Ne(T),b()},get triggerSuffix(){return je()},set triggerSuffix(T){je(T),b()},get triggerValueClass(){return Tt()},set triggerValueClass(T="text-subtle"){Tt(T),b()},get triggerContentClass(){return ee()},set triggerContentClass(T="gap-0.75"){ee(T),b()},get emptyLabel(){return Ge()},set emptyLabel(T){Ge(T),b()},get showEmptyIcon(){return it()},set showEmptyIcon(T=!1){it(T),b()},get showTriggerChevron(){return Xe()},set showTriggerChevron(T=!1){Xe(T),b()},get triggerChevronClass(){return mt()},set triggerChevronClass(T="ml-2 opacity-50"){mt(T),b()},get triggerIcon(){return Mt()},set triggerIcon(T){Mt(T),b()},get triggerAriaLabel(){return Ue()},set triggerAriaLabel(T){Ue(T),b()},get onClear(){return Ke()},set onClear(T){Ke(T),b()},get gitlab(){return Me()},set gitlab(T){Me(T),b()},get gitlabSelected(){return Xt()},set gitlabSelected(T=!1){Xt(T),b()},get plainFolderMode(){return tn()},set plainFolderMode(T=!1){tn(T),b()},get plainFolderSelected(){return es()},set plainFolderSelected(T=!1){es(T),b()},get gitChoice(){return le()},set gitChoice(T){le(T),b()},$set:Dt,$on:(T,F)=>$t(e,T,F)},tp=IN(),td=ce(tp);{const T=(Ce,Ft=ls,vn=ls)=>{var Qs=Je(),Xi=ce(Qs);Cs(Xi,19,Ft,Ps=>Ix(Ps),(Ps,cr,gi)=>{var Us=tN();{const gr=fn=>{{let er=w(()=>l(ur)&&l(cr).type!=="local"?l(ur).projectPath.split("/").at(-1):l(ss).primary),Dr=w(()=>l(ur)?.provider),is=w(()=>l(cr).type==="local"),$n=w(()=>l(cr).type!=="local"),Ti=w(()=>vn()(l(cr),l(gi))),$r=w(()=>!!he()),Br=w(()=>l(cr).type!=="local"&&l(ur)?.provider==="gitlab"&&(!Me()?.authenticated||l(ur).instanceBaseUrl!==Me().instanceBaseUrl||!Me().scopeKey&&!Me().onSelectRecent||Me().page.status==="unavailable"));jh(fn,{get owner(){return l(Ci)},get name(){return l(er)},get suffix(){return l(ss).suffix},get provider(){return l(Dr)},get avatarUrl(){return l(ei)},get local(){return l(is)},get showOwner(){return l($n)},showForge:!0,recent:!0,get selected(){return l(Ti)},get formStyle(){return l($r)},class:"flex-1",onclick:()=>rc(l(cr)),get disabled(){return l(Br)}})}},ss=w(()=>H1(l(cr))),ur=w(()=>sl(l(cr),Me()?.instanceBaseUrl)),Ci=w(()=>l(ur)?l(ur).projectPath.split("/").slice(0,-1).join("/"):l(ss).ownerPrefix),Mi=w(()=>z1(l(cr))),ei=w(()=>ep(l(ur)));var mi=te(Us);{var Ro=fn=>{Eu(fn,{get content(){return l(Mi)},delayDuration:300,side:"bottom",class:"flex min-w-0 flex-1",children:(er,Dr)=>{gr(er)},$$slots:{default:!0}})},fa=fn=>{gr(fn)};V(mi,fn=>{l(Mi)?fn(Ro):fn(fa,-1)})}var Si=R(mi,2);{var Yi=fn=>{const er=w(()=>`${l(ur).instanceBaseUrl.replace(/\/$/,"")}/${l(ur).projectPath}`);{let Dr=w(()=>_.browser_embedded_openExternal_tooltip()),is=w(()=>_.browser_embedded_openExternal_ariaLabel());Ze(fn,{variant:"ghost",size:"icon-compact",iconOnly:!0,get href(){return l(er)},target:"_blank",rel:"noopener noreferrer",get tooltip(){return l(Dr)},get"aria-label"(){return l(is)},class:"mr-1 shrink-0 text-subtle",onclick:$n=>{$n.preventDefault(),$n.stopPropagation(),jf(l(er),{event:$n,forceExternal:!0})},children:($n,Ti)=>{ut($n,{get icon(){return Dm},size:12})},$$slots:{default:!0}})}};V(Si,fn=>{he()&&l(ur)&&fn(Yi)})}var Po=R(Si,2);{var Zs=fn=>{{let er=w(()=>_.workspace_repoSelector_removeRecent_ariaLabel({repository:l(cr).path})),Dr=w(()=>_.workspace_repoSelector_removeRecent_tooltip());Ze(fn,{variant:"ghost",type:"button",size:"icon-compact",iconOnly:!0,"data-remove-recent-repo":!0,class:"mr-2 shrink-0 opacity-0 pointer-events-none group-hover/recent-repo:opacity-100 group-hover/recent-repo:pointer-events-auto group-focus-within/recent-repo:opacity-100 group-focus-within/recent-repo:pointer-events-auto",get"aria-label"(){return l(er)},get title(){return l(Dr)},onclick:is=>Vn(is,l(cr)),children:(is,$n)=>{ut(is,{get icon(){return Fi},size:12})},$$slots:{default:!0}})}};V(Po,fn=>{he()||fn(Zs)})}Q(Us)}L(gr=>wt(Us,1,`group/recent-repo flex min-w-0 items-center ${he()?"rounded-(--radius-row)":""} ${gr??""}`),[()=>he()&&vn()(l(cr),l(gi))?"bg-selected":""]),k(Ps,Us)}),k(Ce,Qs)},F=Ce=>{var Ft=Je(),vn=ce(Ft);{var Qs=Ps=>{var cr=Je(),gi=ce(cr);Rt(gi,()=>Wf,(Us,mi)=>{mi(Us,{children:(Ro,fa)=>{var Si=Sc(),Yi=ce(Si);{const Zs=(gr,ss)=>{Ze(gr,us(()=>(ss?.()).props,{variant:"plain",class:"group/forge relative h-auto shrink-0 rounded-none py-2.5 pl-3 pr-4 text-sm font-normal hover:underline focus:underline",children:(Ci,Mi)=>{Ht();var ei=nN(),fn=ce(ei),er=R(fn);ut(er,{get icon(){return Da},size:10,class:"absolute right-0 opacity-0 group-hover/forge:opacity-100 group-focus/forge:opacity-100"}),L(()=>B(fn,`${l(To)??""} `)),k(Ci,ei)},$$slots:{default:!0}}))};Rt(Yi,()=>Uf,(gr,ss)=>{ss(gr,{child:Zs,$$slots:{child:!0}})})}var Po=R(Yi,2);{let Zs=w(()=>({to:de()})),gr=w(()=>_.workspace_repoSelector_whichRepo_label());Rt(Po,()=>Vf,(ss,ur)=>{ur(ss,{get portalProps(){return l(Zs)},get"aria-label"(){return l(gr)},children:(Ci,Mi)=>{var ei=Je(),fn=ce(ei);{let er=w(()=>l($s)?.id);Rt(fn,()=>cx,(Dr,is)=>{is(Dr,{get value(){return l(er)},onValueChange:$n=>gt($n),children:($n,Ti)=>{var $r=Je(),Br=ce($r);Cs(Br,17,()=>l(bn),qt=>qt.id,(qt,In)=>{var zr=Je(),wn=ce(zr);{const An=dr=>{ut(dr,{get icon(){return l(In).icon},size:12})};Rt(wn,()=>ux,(dr,Vs)=>{Vs(dr,{get value(){return l(In).id},closeOnSelect:!0,leading:An,children:(Cr,ws)=>{Ht();var Mr=Vt();L(()=>B(Mr,l(In).label)),k(Cr,Mr)},$$slots:{leading:!0,default:!0}})})}k(qt,zr)}),k($n,$r)},$$slots:{default:!0}})})}k(Ci,ei)},$$slots:{default:!0}})})}k(Ro,Si)},$$slots:{default:!0}})}),k(Ps,cr)},Xi=Ps=>{var cr=rN(),gi=re(cr,!0);L(()=>B(gi,l($s)?.label??"github.com/")),k(Ps,cr)};V(vn,Ps=>{l(bn).length>1?Ps(Qs):Ps(Xi,-1)})}k(Ce,Ft)};var W0=te(td);Rt(W0,()=>qf,(Ce,Ft)=>{Ft(Ce,{get open(){return l(Re)},set open(vn){x(Re,vn,!0)},children:(vn,Qs)=>{var Xi=Sc(),Ps=ce(Xi);{const gi=(Us,mi)=>{let Ro=()=>(mi?.()).props;{let fa=w(()=>!he()),Si=w(()=>`w-full ${Be()??""}`),Yi=w(()=>Ue()??(he()?void 0:`${_.workspace_repoSelector_selectRepository_label()}: ${l(Yu)}`)),Po=w(()=>he()&&!Ue()?`${t}-field-label ${t}-field-value`:void 0);Ze(Us,us(Ro,{get variant(){return Ct()},get wrapContent(){return l(fa)},get class(){return l(Si)},get"aria-label"(){return l(Yi)},get"aria-labelledby"(){return l(Po)},get ref(){return l(ie)},set ref(Zs){x(ie,Zs,!0)},children:(Zs,gr)=>{var ss=iN(),ur=te(ss);{var Ci=qt=>{var In=wm(),zr=re(In,!0);L(()=>{wt(In,1,Xn(yr.fieldLabel)),xt(In,"id",`${t}-field-label`),B(zr,l(zs))}),k(qt,In)};V(ur,qt=>{he()&&qt(Ci)})}var Mi=R(ur,2);{var ei=qt=>{ut(qt,{get icon(){return Mt()},size:"xs"})},fn=qt=>{Ba(qt,{size:12,class:"text-ghost -mb-0.25 mr-1"})};V(Mi,qt=>{Mt()?qt(ei):it()&&!l(sc)&&qt(fn,1)})}var er=R(Mi,2);{var Dr=qt=>{{let In=w(()=>l(ed)?.projectPath.split("/").slice(0,-1).join("/")||l(Zh)||l(Qh)?.namespace),zr=w(()=>l(ed)?.provider??(Xt()?"gitlab":l(Zh)?"github":void 0)),wn=w(()=>ep(l(ed))??l(Qh)?.ownerAvatarUrl),An=w(()=>l(Zu)?.type==="local"||!Xt()&&l(at)!=="github"),dr=w(()=>he()?20:16);th(qt,{get owner(){return l(In)},get provider(){return l(zr)},get avatarUrl(){return l(wn)},get local(){return l(An)},get size(){return l(dr)}})}},is=qt=>{Ba(qt,{size:16,class:"shrink-0 text-muted-foreground"})};V(er,qt=>{!Mt()&&l(sc)?qt(Dr):!Mt()&&he()&&!it()&&qt(is,1)})}var $n=R(er,2);{var Ti=qt=>{var In=sN(),zr=te(In);{var wn=Cr=>{var ws=km(),Mr=ce(ws),Io=re(Mr,!0),ha=R(Mr,2);{var Qi=Lo=>{var Zi=xm(),eo=re(Zi,!0);L(pa=>B(eo,pa),[()=>_.workspace_repoSelector_new_label()]),k(Lo,Zi)};V(ha,Lo=>{l(ze)&&!Ne()&&!Xt()&&Lo(Qi)})}L(()=>{wt(Mr,1,Xn(Tt())),B(Io,l(Yu))}),k(Cr,ws)},An=Cr=>{var ws=wm(),Mr=re(ws,!0);L(()=>{wt(ws,1,Xn(Tt())),B(Mr,l(qi))}),k(Cr,ws)};V(zr,Cr=>{l(sc)?Cr(wn):Cr(An,-1)})}var dr=R(zr,2);{var Vs=Cr=>{var ws=xm(),Mr=re(ws);L(()=>B(Mr,`(${je()??""})`)),k(Cr,ws)};V(dr,Cr=>{je()&&Cr(Vs)})}Q(In),L(()=>xt(In,"id",he()?`${t}-field-value`:void 0)),k(qt,In)};V($n,qt=>{!Mt()&&(l(sc)||l(qi))&&qt(Ti)})}var $r=R($n,2);{var Br=qt=>{ut(qt,{get icon(){return Da},size:10,get class(){return mt()}})};V($r,qt=>{Xe()&&qt(Br)})}Q(ss),L(()=>wt(ss,1,`flex w-full min-w-0 items-center truncate ${ee()}`)),k(Zs,ss)},$$slots:{default:!0}}))}};Rt(Ps,()=>eh,(Us,mi)=>{mi(Us,{child:gi,$$slots:{child:!0}})})}var cr=R(Ps,2);{let gi=w(()=>l(zs)??_.workspace_repoSelector_whichRepo_label()),Us=w(()=>he()?`w-[360px] max-w-[calc(100vw-1rem)] min-w-0 max-h-[min(440px,var(--bits-popover-content-available-height,calc(100dvh-1rem)))] flex flex-col ${l(Pn)==="browse"?"overflow-hidden":"overflow-y-auto"}`:"w-[400px] max-w-[calc(100vw-16px)] min-w-0 max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto flex flex-col"),mi=w(()=>he()?me.current||l(q)?"bottom":"left":void 0),Ro=w(()=>he()?me.current||l(q)?4:24:void 0),fa=w(()=>he()?me.current||l(q)?"end":"start":void 0),Si=w(()=>({to:de()})),Yi=w(()=>de()?"absolute":"fixed");Rt(cr,()=>Gf,(Po,Zs)=>{Zs(Po,{role:"dialog",get"aria-label"(){return l(gi)},get class(){return l(Us)},get side(){return l(mi)},get sideOffset(){return l(Ro)},get align(){return l(fa)},onkeydown:gr=>{he()&&l(Pn)==="browse"&&gr.target instanceof Node&&l(hi)?.contains(gr.target)&&Xa(gr),gr.key==="Enter"&&gr.stopPropagation()},get portalProps(){return l(Si)},get strategy(){return l(Yi)},portal:!0,children:(gr,ss)=>{var ur=Je(),Ci=ce(ur);{var Mi=fn=>{var er=uN(),Dr=ce(er),is=te(Dr);{let wn=w(()=>`${t}-form-repos`);Xr(is,{variant:"search",type:"text",role:"searchbox","data-repo-search":!0,"data-testid":"repo-form-search",get value(){return l(ms)},oninput:An=>x(ms,An.currentTarget.value,!0),onkeydown:Ja,get placeholder(){return l(pi)},get"aria-label"(){return l(pi)},get"aria-controls"(){return l(wn)},get ref(){return l(vs)},set ref(An){x(vs,An,!0)}})}Q(Dr);var $n=R(Dr,2),Ti=te($n);{var $r=wn=>{var An=aN();Cs(An,20,()=>[1,2,3],Tc,(dr,Vs)=>{var Cr=oN();k(dr,Cr)}),Q(An),k(wn,An)},Br=wn=>{var An=lN(),dr=re(An,!0);L(Vs=>B(dr,Vs),[()=>_.hud_filter_noRepositories_label()]),k(wn,An)},qt=wn=>{T(wn,()=>l(Fs),()=>An=>_i(An))};V(Ti,wn=>{l(Qe)&&l(bs).length===0?wn($r):l(Fs).length===0?wn(Br,1):wn(qt,-1)})}Q($n),Yn($n,wn=>x(hi,wn),()=>l(hi));var In=R($n,2),zr=te(In);Ze(zr,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-add",get class(){return`${yr.row} w-full`},onclick:Ya,children:(wn,An)=>{var dr=cN(),Vs=ce(dr);ut(Vs,{get icon(){return $c},class:"size-4 shrink-0"});var Cr=R(Vs,2),ws=re(Cr,!0);L(()=>B(ws,l(ys))),k(wn,dr)},$$slots:{default:!0}}),Q(In),L(wn=>{xt($n,"id",`${t}-form-repos`),xt($n,"aria-label",wn)},[()=>_.workspace_repoSelector_recent_label()]),k(fn,er)},ei=fn=>{var er=Sc(),Dr=ce(er);{var is=$r=>{var Br=dN(),qt=te(Br);{let wn=w(()=>_.ui_navButtons_goBack_tooltip());Ze(qt,{variant:"ghost",type:"button",size:"icon-sm",iconOnly:!0,"data-testid":"repo-form-back",class:"shrink-0 text-muted-foreground",get"aria-label"(){return l(wn)},onclick:ar,children:(An,dr)=>{ut(An,{get icon(){return g1},class:"size-3.5!"})},$$slots:{default:!0}})}var In=R(qt,2),zr=re(In,!0);Q(Br),L(()=>{wt(In,1,`${yr.title} min-w-0 truncate`),B(zr,l(ys))}),k($r,Br)},$n=$r=>{var Br=fN(),qt=te(Br),In=re(qt,!0),zr=R(qt,2),wn=re(zr,!0);Q(Br),L((An,dr)=>{B(In,An),B(wn,dr)},[()=>_.workspace_repoSelector_whichRepo_label(),()=>_.workspace_repoSelector_whichRepo_description()]),k($r,Br)};V(Dr,$r=>{he()?$r(is):$r($n,-1)})}var Ti=R(Dr,2);{let $r=w(()=>l(Ys)?"repository":l(zt)),Br=w(()=>he()?"shrink-0":"min-h-0");Rt(Ti,()=>Jx,(qt,In)=>{In(qt,{get value(){return l($r)},onValueChange:kr,get class(){return`flex flex-col ${l(Br)??""}`},children:(zr,wn)=>{var An=PN(),dr=ce(An);{let Mr=w(()=>_.workspace_repoSelector_whichRepo_label());Rt(dr,()=>Xx,(Io,ha)=>{ha(Io,{get"aria-label"(){return l(Mr)},class:"flex shrink-0 gap-0 mx-3 mb-3 bg-sidebar rounded-lg p-1",children:(Qi,Lo)=>{var Zi=Sc(),eo=ce(Zi);{var pa=Oo=>{var to=Je(),ga=ce(to);{let el=w(()=>l(Ys)?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");Rt(ga,()=>Sp,(tl,nl)=>{nl(tl,{value:"repository",get class(){return`flex-1 min-w-0 h-auto min-h-(--control-height-medium) px-2 py-1.5 text-sm whitespace-normal rounded-md cursor-pointer transition-all ${l(el)??""}`},children:(ma,ic)=>{Ht();var rl=Vt();L(va=>B(rl,va),[()=>_.workspace_repoSelector_clone_tab()]),k(ma,rl)},$$slots:{default:!0}})})}k(Oo,to)};V(eo,Oo=>{l(A)&&Oo(pa)})}var nd=R(eo,2);Cs(nd,1,()=>[{id:"local",label:_.workspace_repoSelector_existingFolder_tab()},{id:"new",label:_.workspace_repoSelector_new_tab()},...E()?[{id:"remote",label:_.workspace_repoSelector_remoteServer_tab()}]:[]],Tc,(Oo,to)=>{var ga=Je(),el=ce(ga);{let tl=w(()=>l(zt)===l(to).id?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");Rt(el,()=>Sp,(nl,ma)=>{ma(nl,{get value(){return l(to).id},get class(){return`flex-1 min-w-0 h-auto min-h-(--control-height-medium) px-2 py-1.5 text-sm whitespace-normal rounded-md cursor-pointer transition-all ${l(tl)??""}`},children:(ic,rl)=>{Ht();var va=Vt();L(()=>B(va,l(to).label)),k(ic,va)},$$slots:{default:!0}})})}k(Oo,ga)}),k(Qi,Zi)},$$slots:{default:!0}})})}var Vs=R(dr,2);{var Cr=Mr=>{Ze(Mr,{type:"button",variant:"link",size:"sm",class:"mx-3 -mt-1 mb-2 h-auto self-start p-0 text-xs",onclick:Ee,children:(Io,ha)=>{Ht();var Qi=Vt();L(Lo=>B(Qi,Lo),[()=>_.workspace_repoSelector_connectForgeToClone_label()]),k(Io,Qi)},$$slots:{default:!0}})};V(Vs,Mr=>{!l(A)&&s()&&Mr(Cr)})}var ws=R(Vs,2);{let Mr=w(()=>l(Ys)?"repository":l(zt));Rt(ws,()=>av,(Io,ha)=>{ha(Io,{get value(){return l(Mr)},class:"mt-0 min-h-0 flex flex-col",children:(Qi,Lo)=>{var Zi=RN(),eo=ce(Zi),pa=te(eo);{var nd=Tn=>{const Bn=w(()=>l(zt)),fr=w(()=>l(Bn)==="new"?"new":l(Ae)&&l(st)?"folder":le().folder??null);{let tr=w(()=>l(fr)==="git-repo"?le().worktree!==!1:le().checked);I0(Tn,{class:"mb-3 px-1",get folder(){return l(fr)},get checked(){return l(tr)},get disabled(){return le().disabled},onCheckedChange:nr=>F0(nr,l(Bn))})}};V(pa,Tn=>{le()&&(l(zt)==="local"||l(zt)==="new")&&Tn(nd)})}var Oo=R(pa,2);{var to=Tn=>{{let Bn=w(()=>!he()),fr=w(()=>!!he());R0(Tn,us(Me,{get scrollable(){return l(Bn)},get formStyle(){return l(fr)},get prefix(){return F},onSelect:(tr,nr)=>{yn++,Me()?.onSelect(tr,nr),x(Re,!1)}}))}},ga=Tn=>{Ze(Tn,{type:"button",class:"w-full flex items-center justify-between px-3 py-2.5 rounded-lg border-0 text-left cursor-pointer",onclick:N0,children:(Bn,fr)=>{var tr=km(),nr=ce(tr),xs=re(nr,!0),Rn=R(nr,2);ut(Rn,{get icon(){return Js},class:"text-ghost opacity-50"}),L(an=>{wt(nr,1,`text-sm truncate ${l(ht)?"text-foreground":"text-muted-foreground"}`),B(xs,an)},[()=>l(ht)||_.workspace_repoSelector_selectAFolder_placeholder()]),k(Bn,tr)},$$slots:{default:!0}})},el=Tn=>{var Bn=pN(),fr=ce(Bn);If(fr,{kind:"repository"});var tr=R(fr,2);If(tr,{});var nr=R(tr,2),xs=te(nr);F(xs);var Rn=R(xs,2);{let xn=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),jn=w(()=>l(Fn).length>0?Qu:void 0),Tr=w(()=>l(Fn).length>0),Fr=w(()=>l(Fn)[l(tt)]?`${Qu}-${l(tt)}`:void 0);Yn(Xr(Rn,{placeholder:"owner/repo",type:"text",oninput:Gn=>Kn(Gn.currentTarget.value),onpaste:Hs,onkeydown:Zn,class:"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm",noFocusStyle:!0,role:"combobox",get"aria-label"(){return l(xn)},"aria-autocomplete":"list",get"aria-controls"(){return l(jn)},get"aria-expanded"(){return l(Tr)},get"aria-activedescendant"(){return l(Fr)},get ref(){return l(yt)},set ref(Gn){x(yt,Gn,!0)},get value(){return l(fi)},set value(Gn){x(fi,Gn,!0)}}),Gn=>x(qe,Gn,!0),()=>l(qe))}Q(nr);var an=R(nr,2);{var Hn=xn=>{{let jn=w(()=>_.workspace_repoSelector_githubSignIn_description());P0(xn,{class:"mt-2",get message(){return l(jn)}})}},mr=xn=>{{let jn=w(()=>!!he()),Tr=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Fr=w(()=>!l(Fn).length&&(M()||!!(l(lr)&&z()))),Gn=w(()=>l(lr)?_.workspace_repoSelector_searchingGithub_label({query:l(lr)}):_.gitlabCheckout_loading_label()),Ws=w(()=>_.hud_filter_noRepositories_label()),No=w(()=>O()?r()?O():_.workspace_repoSelector_suggestionsUnavailable_label():void 0),no=w(()=>_.workspace_repoSelector_retrySuggestions_label());Gh(xn,{get formStyle(){return l(jn)},get id(){return Qu},get items(){return l(Fn)},getKey:Is=>Is.id,getOwner:Is=>Is.owner,getName:Is=>Is.name,provider:"github",get label(){return l(Tr)},get loading(){return l(Fr)},get loadingLabel(){return l(Gn)},get emptyLabel(){return l(Ws)},get error(){return l(No)},get retryLabel(){return l(no)},onRetry:Kt,onSelect:un,get activeIndex(){return l(tt)},set activeIndex(Is){x(tt,Is,!0)}})}};V(an,xn=>{!l(ke)&&s()?xn(Hn):l(ke)&&xn(mr,1)})}var cn=R(an,2);{var vr=xn=>{var jn=hN(),Tr=te(jn),Fr=re(Tr),Gn=R(Tr,2);Ze(Gn,{size:"sm",onclick:Xu,class:"shrink-0",children:(Ws,No)=>{Ht();var no=Vt();L(Is=>B(no,Is),[()=>_.workspace_repoSelector_select_label()]),k(Ws,no)},$$slots:{default:!0}}),Q(jn),L(()=>B(Fr,`${l(Qn).owner??""}/${l(Qn).repo??""}`)),k(xn,jn)};V(cn,xn=>{l(Qn)&&!l(_r)&&xn(vr)})}k(Tn,Bn)},tl=Tn=>{var Bn=wN(),fr=ce(Bn);Ze(fr,{type:"button",variant:"plain",wrapContent:!1,class:"w-full flex items-center gap-3 mb-2 text-left cursor-pointer",onclick:$0,children:(cn,vr)=>{var xn=gN(),jn=ce(xn),Tr=re(jn,!0),Fr=R(jn,2),Gn=te(Fr),Ws=re(Gn,!0),No=R(Gn,2);ut(No,{get icon(){return Js},class:"text-ghost shrink-0 opacity-50"}),Q(Fr),L((no,Is)=>{B(Tr,no),wt(Fr,1,`flex-1 min-w-0 text-sm h-(--control-height-medium) px-3 bg-sidebar rounded-(--radius-medium) flex items-center justify-between ${l(ir)?"text-foreground":"text-subtle"} truncate`),B(Ws,Is)},[()=>_.workspace_repoSelector_parentFolder_label(),()=>l(ir)||_.workspace_repoSelector_select_placeholder()]),k(cn,xn)},$$slots:{default:!0}});var tr=R(fr,2),nr=te(tr),xs=re(nr,!0),Rn=R(nr,2);Xr(Rn,{placeholder:"new-project",type:"text",onkeydown:cn=>{cn.key==="Enter"&&!cn.isComposing&&(cn.preventDefault(),cn.stopPropagation(),da())},class:"bg-sidebar border-none",noFocusStyle:!0,get value(){return l(ts)},set value(cn){x(ts,cn,!0)}}),Q(tr);var an=R(tr,2);{var Hn=cn=>{var vr=mN(),xn=te(vr),jn=re(xn,!0);Q(vr),L(()=>B(jn,l(Pe))),k(cn,vr)},mr=cn=>{var vr=yN(),xn=te(vr),jn=re(xn,!0),Tr=R(xn,2);{var Fr=Er=>{var Un=vN(),Hr=te(Un);li(Hr,{size:14});var ti=R(Hr,2),ni=re(ti,!0);Q(Un),L(rr=>B(ni,rr),[()=>_.workspace_repoSelector_checking_label()]),k(Er,Un)},Gn=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_select_label()]),k(rr,ks)},$$slots:{default:!0}}),Q(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_repoExists_label({isolationLabel:j})]),k(Er,Un)},Ws=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_select_label()]),k(rr,ks)},$$slots:{default:!0}}),Q(Un),L(rr=>B(ti,rr),[()=>_.onboarding_localRepoTab_plainFolder_description()]),k(Er,Un)},No=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",variant:"primary",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_create_label()]),k(rr,ks)},$$slots:{default:!0}}),Q(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_newFolderWillBeCreated_label()]),k(Er,Un)},no=Er=>{var Un=bN(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",variant:"primary",onclick:da,class:"shrink-0",disabled:!0,children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_create_label()]),k(rr,ks)},$$slots:{default:!0}}),Q(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_folderNotGitRepo_label()]),k(Er,Un)},Is=Er=>{var Un=Cc(),Hr=te(Un),ti=re(Hr,!0),ni=R(Hr,2);Ze(ni,{size:"sm",variant:"primary",onclick:da,class:"shrink-0",children:(rr,oc)=>{Ht();var ks=Vt();L(Ei=>B(ks,Ei),[()=>_.workspace_repoSelector_create_label()]),k(rr,ks)},$$slots:{default:!0}}),Q(Un),L(rr=>B(ti,rr),[()=>_.workspace_repoSelector_newRepoWillBeCreated_label()]),k(Er,Un)};V(Tr,Er=>{l(ln)?Er(Fr):l(dt)?.exists&&l(dt)?.isGitRepo?Er(Gn,1):l(Cn)==="existing"?Er(Ws,2):l(Cn)==="new"?Er(No,3):l(dt)?.exists&&!l(dt)?.isGitRepo?Er(no,4):Er(Is,-1)})}Q(vr),L(()=>B(jn,l(Oe))),k(cn,vr)};V(an,cn=>{l(Pe)?cn(Hn):l(Oe)&&cn(mr,1)})}L(cn=>B(xs,cn),[()=>_.workspace_repoSelector_folderName_label()]),k(Tn,Bn)},nl=Tn=>{var Bn=SN(),fr=te(Bn);Cs(fr,17,()=>l(Gt),Rn=>Rn.id,(Rn,an)=>{var Hn=xN(),mr=te(Hn);Kh(mr,{size:14,class:"text-ghost shrink-0"});var cn=R(mr,2),vr=te(cn),xn=re(vr,!0),jn=R(vr,2),Tr=re(jn,!0);Q(cn);var Fr=R(cn,2);{let Gn=w(()=>_.workspace_repoSelector_removeSetup_tooltip());Ze(Fr,{variant:"ghost",type:"button",size:"icon-compact",iconOnly:!0,onclick:Ws=>{Ws.stopPropagation(),Ws.preventDefault(),Bs(l(an).id)},class:"ml-1 rounded text-muted-foreground hover:text-danger hover:bg-danger-background/10",get title(){return l(Gn)},children:(Ws,No)=>{ut(Ws,{get icon(){return Fi},size:"xs"})},$$slots:{default:!0}})}Q(Hn),L(()=>{B(xn,l(an).name),B(Tr,l(an).transport==="websocket"?l(an).wsUrl:`${l(an).username}@${l(an).host}:${l(an).port}`)}),Kr("click",Hn,()=>gs(l(an))),Kr("keydown",Hn,Gn=>{(Gn.key==="Enter"||Gn.key===" ")&&(Gn.preventDefault(),gs(l(an)))}),k(Rn,Hn)});var tr=R(fr,2);{var nr=Rn=>{var an=kN(),Hn=re(an,!0);L(mr=>B(Hn,mr),[()=>_.workspace_repoSelector_noRemoteSetups_label()]),k(Rn,an)};V(tr,Rn=>{l(Gt).length===0&&Rn(nr)})}var xs=R(tr,2);Ze(xs,{variant:"ghost",type:"button",class:"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left cursor-pointer hover:bg-muted/50 transition-colors text-sm text-muted-foreground",onclick:di,children:(Rn,an)=>{var Hn=_N(),mr=ce(Hn);ut(mr,{get icon(){return $c},size:"sm"});var cn=R(mr);L(vr=>B(cn,` ${vr??""}`),[()=>_.workspace_repoSelector_addRemoteSetup_label()]),k(Rn,Hn)},$$slots:{default:!0}}),Q(Bn),k(Tn,Bn)};V(Oo,Tn=>{l(zt)==="gitlab"&&Me()?Tn(to):l(zt)==="local"?Tn(ga,1):l(zt)==="github"?Tn(el,2):l(zt)==="new"?Tn(tl,3):l(zt)==="remote"&&Tn(nl,4)})}Q(eo);var ma=R(eo,2);{var ic=Tn=>{var Bn=CN(),fr=te(Bn),tr=te(fr);ut(tr,{get icon(){return Js},class:"text-ghost shrink-0 mt-0.5"});var nr=R(tr,2),xs=te(nr),Rn=re(xs,!0),an=R(xs,2),Hn=re(an,!0),mr=R(an,2),cn=te(mr);Ze(cn,{size:"sm",variant:"secondary",onclick:z0,children:(xn,jn)=>{Ht();var Tr=Vt();L(Fr=>B(Tr,Fr),[()=>_.workspace_repoSelector_initializeGit_label()]),k(xn,Tr)},$$slots:{default:!0}});var vr=R(cn,2);Ze(vr,{size:"sm",variant:"secondary",onclick:H0,children:(xn,jn)=>{Ht();var Tr=Vt();L(Fr=>B(Tr,Fr),[()=>_.workspace_repoSelector_chooseDifferentFolder_label()]),k(xn,Tr)},$$slots:{default:!0}}),Q(mr),Q(nr),Q(fr),Q(Bn),L((xn,jn)=>{xt(xs,"title",l(st)),B(Rn,xn),B(Hn,jn)},[()=>l(st).split("/").pop()||l(st),()=>_.workspace_repoSelector_notGitRepository_label()]),k(Tn,Bn)};V(ma,Tn=>{l(zt)!=="gitlab"&&l(Ae)&&l(st)&&Tn(ic)})}var rl=R(ma,2);{var va=Tn=>{var Bn=AN(),fr=te(Bn);lx(fr,{size:5,class:"mb-2",children:(Rn,an)=>{Ht();var Hn=Vt();L(mr=>B(Hn,mr),[()=>_.workspace_repoSelector_recent_label()]),k(Rn,Hn)},$$slots:{default:!0}});var tr=R(fr,2);{var nr=Rn=>{var an=TN();Cs(an,20,()=>[1,2,3],Tc,(Hn,mr)=>{var cn=MN();k(Hn,cn)}),Q(an),k(Rn,an)},xs=Rn=>{var an=EN(),Hn=te(an);{let mr=w(()=>l(mn)());T(Hn,()=>l(mr),()=>(cn,vr)=>vr===l(Rs))}Q(an),k(Rn,an)};V(tr,Rn=>{l(Qe)&&l(Yt).length===0?Rn(nr):Rn(xs,-1)})}Q(Bn),k(Tn,Bn)},q0=w(()=>!he()&&(l(zt)==="local"||l(Ys))&&(l(Qe)||l(mn)().length>0));V(rl,Tn=>{l(q0)&&Tn(va)})}k(Qi,Zi)},$$slots:{default:!0}})})}k(zr,An)},$$slots:{default:!0}})})}k(fn,er)};V(Ci,fn=>{he()&&l(Pn)==="browse"?fn(Mi):fn(ei,-1)})}k(gr,ur)},$$slots:{default:!0}})})}k(vn,Xi)},$$slots:{default:!0}})}),Q(td)}var np=R(td,2);{var K0=T=>{A0(T,{get isOpen(){return l(_n)},onclose:()=>x(_n,!1),onsave:Eo})};V(np,T=>{E()&&T(K0)})}var j0=R(np,2);Yx(j0,{get open(){return l(Ie)},get title(){return l(on)},get initialPath(){return l(gn)},selectLabel:"Select folder",onSelect:Yh,onClose:B0}),k(n,tp);var G0=Ot(V0);return J(),G0}So(["click","keydown"]);var LN=N('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),ON=N('<div class="flex items-center rounded-lg bg-sidebar"><!></div>'),NN=N('<span class="mt-1 block"> </span>'),DN=N("<span> </span> <!>",1),_m=N("<!> <!>",1),$N=N("<div><!> <!></div>"),BN=N("<!> <!> <!>",1),zN=N('<div data-testid="gitlab-picker-list"><!> <!></div>');function L0(n,e){if(new.target)return Nt({component:L0,...n});Lt(e,!0);let t=y(e,"scopeKey",7),r=y(e,"prefix",7),s=y(e,"instanceBaseUrl",7),i=y(e,"query",7),o=y(e,"page",7),a=y(e,"copy",7),c=y(e,"onSearch",7),u=y(e,"onSubmit",7),d=y(e,"submitLabel",7),f=y(e,"onMore",7),h=y(e,"onRecover",7),p=y(e,"selectedKey",7),g=y(e,"getKey",7),v=y(e,"getText",7),m=y(e,"onSelect",7),S=y(e,"row",7),I=y(e,"compact",7,!1),C=fe(void 0);function M(Y){if(Y.key!=="ArrowDown"||Y.isComposing)return;const $=l(C)?.querySelector('[data-slot="list-view-item"]');$&&(Y.preventDefault(),Y.stopPropagation(),$.focus())}var O={get scopeKey(){return t()},set scopeKey(Y){t(Y),b()},get prefix(){return r()},set prefix(Y){r(Y),b()},get instanceBaseUrl(){return s()},set instanceBaseUrl(Y){s(Y),b()},get query(){return i()},set query(Y){i(Y),b()},get page(){return o()},set page(Y){o(Y),b()},get copy(){return a()},set copy(Y){a(Y),b()},get onSearch(){return c()},set onSearch(Y){c(Y),b()},get onSubmit(){return u()},set onSubmit(Y){u(Y),b()},get submitLabel(){return d()},set submitLabel(Y){d(Y),b()},get onMore(){return f()},set onMore(Y){f(Y),b()},get onRecover(){return h()},set onRecover(Y){h(Y),b()},get selectedKey(){return p()},set selectedKey(Y){p(Y),b()},get getKey(){return g()},set getKey(Y){g(Y),b()},get getText(){return v()},set getText(Y){v(Y),b()},get onSelect(){return m()},set onSelect(Y){m(Y),b()},get row(){return S()},set row(Y){S(Y),b()},get compact(){return I()},set compact(Y=!1){I(Y),b()},$set:Dt,$on:(Y,$)=>$t(e,Y,$)},P=zN(),E=te(P);{var z=Y=>{var $=LN(),X=re($,!0);L(()=>B(X,s())),k(Y,$)};V(E,Y=>{s()&&!r()&&!I()&&Y(z)})}var G=R(E,2);{var J=Y=>{var $=_m(),X=ce($);{var de=ie=>{var q=ON(),j=te(q);On(j,r),Q(q),k(ie,q)};V(X,ie=>{r()&&ie(de)})}var me=R(X,2);{const ie=ne=>{var we=DN(),be=ce(we),Se=re(be,!0),se=R(be,2);{var oe=H=>{var W=NN(),D=re(W,!0);L(()=>B(D,o().detail)),k(H,W)};V(se,H=>{o().detail&&H(oe)})}L(()=>B(Se,o().message)),k(ne,we)};let q=w(()=>h()?o().actionLabel:void 0),j=w(()=>h()&&o().actionLabel?()=>h()?.(t()):void 0);dx(me,{density:"compact",get retryLabel(){return l(q)},get onRetry(){return l(j)},message:ie,$$slots:{message:!0}})}k(Y,$)},K=Y=>{var $=BN(),X=ce($);{var de=be=>{{let Se=w(()=>!t());Xr(be,{variant:"search",type:"text",role:"searchbox",get"aria-label"(){return a().searchLabel},get value(){return i()},get disabled(){return l(Se)},get placeholder(){return a().searchPlaceholder},oninput:se=>c()(se.currentTarget.value,t()),onkeydown:M,class:"shrink-0"})}},me=be=>{Zx(be,{get label(){return a().searchLabel},control:(se,oe=ls)=>{var H=$N(),W=te(H);{var D=ge=>{var ue=Je(),pe=ce(ue);On(pe,r),k(ge,ue)};V(W,ge=>{r()&&ge(D)})}var ae=R(W,2);{let ge=w(()=>!t()),ue=w(()=>r()?"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm":void 0);Xr(ae,us(oe,{type:"search",get value(){return i()},get disabled(){return l(ge)},get placeholder(){return a().searchPlaceholder},oninput:pe=>c()(pe.currentTarget.value,t()),onkeydown:M,get class(){return l(ue)}}))}Q(H),L(()=>wt(H,1,Xn(r()?"flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring":void 0))),k(se,H)},$$slots:{control:!0}})};V(X,be=>{I()?be(de):be(me,-1)})}var ie=R(X,2);{var q=be=>{{let Se=w(()=>!i().trim()||o().status==="loading"||o().loadingMore);Ze(be,{type:"button",variant:"secondary",class:"w-full shrink-0",get disabled(){return l(Se)},onclick:()=>u()?.(i(),t()),children:(se,oe)=>{Ht();var H=Vt();L(()=>B(H,d())),k(se,H)},$$slots:{default:!0}})}};V(ie,be=>{u()&&d()&&be(q)})}var j=R(ie,2);{var ne=be=>{fx(be,{get label(){return a().loadingLabel},density:"compact"})},we=be=>{var Se=_m(),se=ce(Se);Yf(se,t,W=>{{const D=pe=>{px(pe,{density:"compact",description:ye=>{Ht();var Z=Vt();L(()=>B(Z,i()?a().emptySearchLabel:a().emptyLabel)),k(ye,Z)},$$slots:{description:!0}})};let ae=w(()=>p()?[p()]:[]),ge=w(()=>I()?"min-h-0 flex-1":"max-h-56"),ue=w(()=>I()?40:void 0);hx(W,{get items(){return o().items},get getKey(){return g()},get getText(){return v()},selectable:"single",get selectedKeys(){return l(ae)},onActivate:pe=>m()(pe,t()),get ariaLabel(){return a().listLabel},get class(){return l(ge)},get rowHeight(){return l(ue)},get row(){return S()},empty:D,$$slots:{empty:!0}})}});var oe=R(se,2);{var H=W=>{Ze(W,{type:"button",variant:"ghost",class:"w-full shrink-0",get disabled(){return o().loadingMore},onclick:()=>f()(t()),children:(D,ae)=>{Ht();var ge=Vt();L(()=>B(ge,o().loadingMore?a().loadingMoreLabel:a().loadMoreLabel)),k(D,ge)},$$slots:{default:!0}})};V(oe,W=>{(o().hasMore||o().loadingMore)&&W(H)})}k(be,Se)};V(j,be=>{o().status==="loading"?be(ne):be(we,-1)})}k(Y,$)};V(G,Y=>{o().status==="unavailable"?Y(J):Y(K,-1)})}return Q(P),Yn(P,Y=>x(C,Y),()=>l(C)),L(()=>wt(P,1,Xn(I()?"flex min-h-0 min-w-0 flex-1 flex-col gap-1 px-2 pt-1 pb-2":"min-w-0 space-y-3"))),k(n,P),Ot(O)}var FN=new Set(["$$slots","$$events","$$legacy","projectPath","selectedBranch","placeholder","protectedLabel","triggerClass","rowLabel","isLoading","showTriggerChevron","triggerChevronClass","onSelect","onOpenChange"]),HN=N("<span> </span>"),UN=N('<!> <span class="sr-only"> </span>',1),VN=N('<span class="flex-1 min-w-0 text-left truncate"> </span>'),WN=N("<span><!> <!> <!></span>"),KN=N('<p class="break-all type-caption text-foreground"> </p>'),jN=N('<span class="type-caption shrink-0 text-muted-foreground"> </span>'),GN=N('<div><!> <span class="min-w-0 flex-1 truncate"> </span> <!> <!></div>'),Sm=N("<!> <!>",1);function Nc(n,e){if(new.target)return Nt({component:Nc,...n});Lt(e,!0);let t=y(e,"projectPath",7),r=y(e,"selectedBranch",7),s=y(e,"placeholder",7),i=y(e,"protectedLabel",7),o=y(e,"triggerClass",7),a=y(e,"rowLabel",7),c=y(e,"isLoading",7,!1),u=y(e,"showTriggerChevron",7,!1),d=y(e,"triggerChevronClass",7),f=y(e,"onSelect",7),h=y(e,"onOpenChange",7),p=ui(e,FN),g=fe(!1);const v=Xf(),m=new Qf,S=w(()=>c()||e.page.status==="loading");var I={get projectPath(){return t()},set projectPath(O){t(O),b()},get selectedBranch(){return r()},set selectedBranch(O){r(O),b()},get placeholder(){return s()},set placeholder(O){s(O),b()},get protectedLabel(){return i()},set protectedLabel(O){i(O),b()},get triggerClass(){return o()},set triggerClass(O){o(O),b()},get rowLabel(){return a()},set rowLabel(O){a(O),b()},get isLoading(){return c()},set isLoading(O=!1){c(O),b()},get showTriggerChevron(){return u()},set showTriggerChevron(O=!1){u(O),b()},get triggerChevronClass(){return d()},set triggerChevronClass(O){d(O),b()},get onSelect(){return f()},set onSelect(O){f(O),b()},get onOpenChange(){return h()},set onOpenChange(O){h(O),b()},$set:Dt,$on:(O,P)=>$t(e,O,P)},C=Je(),M=ce(C);return Rt(M,()=>qf,(O,P)=>{P(O,{onOpenChange:E=>h()?.(E,e.scopeKey),get open(){return l(g)},set open(E){x(g,E,!0)},children:(E,z)=>{var G=Sm(),J=ce(G);{const Y=($,X)=>{let de=()=>(X?.()).props;{let me=w(()=>`min-w-0 max-w-full text-muted-foreground ${o()??""}`),ie=w(()=>!a());Ze($,us(de,{variant:"ghost",type:"button",get class(){return l(me)},get"aria-busy"(){return l(S)},get wrapContent(){return l(ie)},children:(q,j)=>{var ne=WN(),we=te(ne);{var be=D=>{var ae=HN(),ge=re(ae,!0);L(()=>{wt(ae,1,Xn(yr.fieldLabel)),B(ge,a())}),k(D,ae)};V(we,D=>{a()&&D(be)})}var Se=R(we,2);{var se=D=>{var ae=UN(),ge=ce(ae);li(ge,{size:14,class:"text-ghost"});var ue=R(ge,2),pe=re(ue,!0);L(()=>B(pe,e.copy.loadingLabel)),k(D,ae)},oe=D=>{var ae=VN(),ge=re(ae,!0);L(()=>B(ge,r()?.name||s())),k(D,ae)};V(Se,D=>{!r()&&l(S)?D(se):D(oe,-1)})}var H=R(Se,2);{var W=D=>{ut(D,{get icon(){return Da},size:10,get class(){return d()}})};V(H,D=>{u()&&!l(S)&&D(W)})}Q(ne),L(()=>wt(ne,1,`flex w-full min-w-0 items-center truncate ${a()?"gap-2":"gap-0.75"}`)),k(q,ne)},$$slots:{default:!0}}))}};Rt(J,()=>eh,($,X)=>{X($,{child:Y,$$slots:{child:!0}})})}var K=R(J,2);{let Y=w(()=>a()??e.copy.listLabel),$=w(()=>a()?"flex w-[360px] max-w-[calc(100vw-1rem)] min-w-0 max-h-[min(440px,var(--bits-popover-content-available-height,calc(100dvh-1rem)))] flex-col overflow-hidden":"w-80 max-w-[calc(100vw-2rem)] max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto space-y-2 p-3"),X=w(()=>a()?m.current?"bottom":"left":void 0),de=w(()=>a()?m.current?4:24:void 0),me=w(()=>a()&&m.current?"end":"start"),ie=w(()=>({to:v()})),q=w(()=>v()?"absolute":"fixed");Rt(K,()=>Gf,(j,ne)=>{ne(j,{role:"dialog",get"aria-label"(){return l(Y)},get class(){return l($)},get side(){return l(X)},get sideOffset(){return l(de)},get align(){return l(me)},get portalProps(){return l(ie)},get strategy(){return l(q)},onkeydown:we=>{we.key==="Enter"&&we.stopPropagation()},children:(we,be)=>{var Se=Sm(),se=ce(Se);{var oe=W=>{var D=KN(),ae=re(D,!0);L(()=>B(ae,t())),k(W,D)};V(se,W=>{a()||W(oe)})}var H=R(se,2);{const W=(ge,ue)=>{let pe=()=>(ue?.()).item,ke=()=>(ue?.()).selected;var ye=Je(),Z=ce(ye);{var $e=St=>{var De=GN(),Le=te(De);uo(Le,{size:16,get class(){return yr.icon}});var Ye=R(Le,2),Ct=re(Ye,!0),bt=R(Ye,2);{var sn=he=>{var Ne=jN(),je=re(Ne,!0);L(()=>B(je,i())),k(he,Ne)};V(bt,he=>{pe().protected&&he(sn)})}var Be=R(bt,2);{let he=w(()=>ke()?"checked":"empty");Zm(Be,{get state(){return l(he)},get class(){return yr.check}})}Q(De),L(()=>{wt(De,1,`flex ${yr.row}`),B(Ct,pe().name)}),k(St,De)},lt=St=>{ek(St,{title:Ye=>{Ht();var Ct=Vt();L(()=>B(Ct,pe().name)),k(Ye,Ct)},meta:Ye=>{Ht();var Ct=Vt();L(()=>B(Ct,pe().protected?i():"")),k(Ye,Ct)},$$slots:{title:!0,meta:!0}})};V(Z,St=>{a()?St($e):St(lt,-1)})}k(ge,ye)};let D=w(()=>!!a()),ae=w(()=>r()?.name);L0(H,us(()=>p,{get compact(){return l(D)},get selectedKey(){return l(ae)},getKey:ge=>ge.name,getText:ge=>ge.name,onSelect:(ge,ue)=>{f()({name:ge.name,commitSha:ge.commitSha},ue),x(g,!1)},row:W,$$slots:{row:!0}}))}k(we,Se)},$$slots:{default:!0}})})}k(E,G)},$$slots:{default:!0}})}),k(n,C),Ot(I)}var qN=N('<div class="flex min-h-10 min-w-0 items-center gap-2 pl-0 pr-2 py-2 text-sm leading-5"><span> </span> <span class="min-w-0 truncate"> </span></div>'),JN=N('<div class="min-w-0"><!></div>'),XN=N('<label class="flex items-center gap-2 py-2 text-sm text-muted-foreground"><!> </label>'),YN=N('<p class="min-w-0 truncate text-sm text-muted-foreground"> </p> <!>',1),Bd=N("<!> <!> <!>",1),QN=N('<div class="relative min-w-0"><!> <!></div>'),si=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>'),Cm=N('<!> <span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>',1),Mc=N("<!> <!>",1),Mm=N("<!> <!> <!> <!> <!>",1),ZN=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pr-1"> </span>'),eD=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0 px-1"> </span>'),tD=N('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pl-1"> </span>'),nD=N('<!> <span class="text-ui text-subtle whitespace-nowrap"> </span>',1),rD=N('<!> <!> <!> <span class="text-xs text-subtle whitespace-nowrap min-w-0 font-mono truncate max-w-60"> </span> <!> <span class="text-sm font-medium whitespace-nowrap shrink-0 font-mono"> </span> <!> <!>',1),sD=N("<div><!></div>");function iD(n,e){if(new.target)return Nt({component:iD,...n});Lt(e,!0);let t=y(e,"repoPath",7,""),r=y(e,"branch",7,""),s=y(e,"repoType",7,"local"),i=y(e,"gitlab",7),o=y(e,"gitlabBranch",7),a=y(e,"githubUrl",7,""),c=y(e,"skipIsolation",7,!1),u=y(e,"isNewRepo",7,!1),d=y(e,"suggestedBranch",7),f=y(e,"remoteSetup",7,null),h=y(e,"onRemoteSetupChange",7),p=y(e,"onRepoChange",7),g=y(e,"onBranchChange",7),v=y(e,"onSkipIsolationChange",7),m=y(e,"onGitHubAuthNeededChange",7),S=y(e,"onBranchStatusChange",7),I=y(e,"onBranchesLoaded",7),C=y(e,"presentation",7,"default"),M=y(e,"field",7,"both"),O=y(e,"isLoading",7,!1),P=y(e,"detectedGitHubOwner",7,null),E=y(e,"detectedGitHubRepo",7,null),z=y(e,"plainFolderMode",7,!1),G=y(e,"plainFolder",7,null),J=y(e,"gitChoice",7);const K=w(()=>C()==="metadata"),Y=w(()=>C()==="form"),$="\0",X=le=>le.split($).map(ot=>ot.trim()),de=w(()=>X(_.workspace_repoAndBranchPicker_workOnRepo_label({repo:$}))),me=w(()=>X(_.workspace_repoAndBranchPicker_workOnRepoOffBranch_label({repo:$,branch:$}))),ie=w(()=>X(_.workspace_repoAndBranchPicker_repoOffBranch_label({repo:$,branch:$}))),q=w(()=>X(_.workspace_repoAndBranchPicker_cloneRepoAndWorkOffBranch_label({repo:$,branch:$}))),j=w(()=>X(_.workspace_repoAndBranchPicker_workInFolder_label({repo:$}))),ne=w(()=>X((c()?_.workspace_repoAndBranchPicker_workOnRemoteOnBranch_label:_.workspace_repoAndBranchPicker_workOnRemoteOffBranch_label)({repo:$,path:$,branch:$}))),we=w(()=>l(K)?"block w-full min-w-0 text-sm text-foreground":"flex items-center flex-wrap gap-x-0.5 gap-y-1 [&>div]:min-w-0 [&>div]:max-w-full"),be="rounded-md bg-muted/40! shadow-none! outline-none! hover:bg-muted/60! active:bg-muted/70! data-[state=open]:bg-muted/70! data-[state=open]:text-foreground focus-visible:bg-muted/70! focus-visible:text-foreground focus-visible:outline-none! focus-visible:outline-offset-0! focus-visible:ring-0! focus-visible:ring-offset-0! focus-visible:shadow-none! disabled:bg-muted/50! disabled:text-muted-foreground disabled:hover:bg-muted/50! forced-colors:border forced-colors:border-[ButtonText] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",Se=w(()=>l(K)?`group/metadata-trigger min-w-0 px-2! py-1! text-sm leading-5 font-normal text-foreground ${be}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium)"),se=w(()=>l(K)?`group/metadata-trigger w-full min-w-0 px-2! py-1! text-sm leading-5 font-normal text-foreground overflow-hidden ${be}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium) overflow-hidden"),oe="h-2.5 w-2.5 shrink-0 text-ghost opacity-70",H="text-foreground font-normal",W="text-muted-foreground",D="main",ae=w(()=>l(K)&&M()==="branch"&&O()),ge=w(()=>f()?`${f().username}@${f().host}:${f().workspacePath}`:"");function ue(le){const ot=le.split(/[\\/]/).filter(Boolean);return ot[ot.length-1]||le}function pe(le){const ot=le.trim().replace(/^git@github\.com:/,"https://github.com/");try{const At=new URL(ot.startsWith("http")?ot:`https://${ot}`);return At.hostname!=="github.com"?ue(le):At.pathname.replace(/^\//,"").replace(/\.git$/,"")||ue(le)}catch{return ue(le.replace(/\.git$/,""))}}const ke=w(()=>s()==="gitlab"?i()?.selectedProjectPath??"":s()==="remote"&&f()?f().name:s()==="github"&&a()?pe(a()):ue(t())),ye=w(()=>s()==="gitlab"?o()?.selectedBranch?.name??"":s()==="remote"&&f()&&f().branch||r()||D),Z=w(()=>l(ke)?`${l(ke)}/${l(ye)}`:""),$e=w(()=>s()==="gitlab"?"":s()==="remote"&&f()?f().name:s()==="github"&&a()?a():t()),lt=w(()=>l(K)?l(ke):void 0),St=w(()=>P()&&E()?`${P()}/${E()}`:void 0),De=w(()=>t()||(s()==="remote"&&f()?f().workspacePath:""));function Le(le){p()?.(le)}function Ye(le){g()?.(le)}const Ct=w(()=>s()==="gitlab"||!!t()||s()==="github"&&!!a()||s()==="remote"&&!!f());let bt=fe(void 0);function sn(){l(bt)?.focusInput?.()}function Be(le="local"){l(bt)?.openOnLocalTab?.(le)}var he={focusInput:sn,openFolderSelection:Be,get repoPath(){return t()},set repoPath(le=""){t(le),b()},get branch(){return r()},set branch(le=""){r(le),b()},get repoType(){return s()},set repoType(le="local"){s(le),b()},get gitlab(){return i()},set gitlab(le){i(le),b()},get gitlabBranch(){return o()},set gitlabBranch(le){o(le),b()},get githubUrl(){return a()},set githubUrl(le=""){a(le),b()},get skipIsolation(){return c()},set skipIsolation(le=!1){c(le),b()},get isNewRepo(){return u()},set isNewRepo(le=!1){u(le),b()},get suggestedBranch(){return d()},set suggestedBranch(le){d(le),b()},get remoteSetup(){return f()},set remoteSetup(le=null){f(le),b()},get onRemoteSetupChange(){return h()},set onRemoteSetupChange(le){h(le),b()},get onRepoChange(){return p()},set onRepoChange(le){p(le),b()},get onBranchChange(){return g()},set onBranchChange(le){g(le),b()},get onSkipIsolationChange(){return v()},set onSkipIsolationChange(le){v(le),b()},get onGitHubAuthNeededChange(){return m()},set onGitHubAuthNeededChange(le){m(le),b()},get onBranchStatusChange(){return S()},set onBranchStatusChange(le){S(le),b()},get onBranchesLoaded(){return I()},set onBranchesLoaded(le){I(le),b()},get presentation(){return C()},set presentation(le="default"){C(le),b()},get field(){return M()},set field(le="both"){M(le),b()},get isLoading(){return O()},set isLoading(le=!1){O(le),b()},get detectedGitHubOwner(){return P()},set detectedGitHubOwner(le=null){P(le),b()},get detectedGitHubRepo(){return E()},set detectedGitHubRepo(le=null){E(le),b()},get plainFolderMode(){return z()},set plainFolderMode(le=!1){z(le),b()},get plainFolder(){return G()},set plainFolder(le=null){G(le),b()},get gitChoice(){return J()},set gitChoice(le){J(le),b()},$set:Dt,$on:(le,ot)=>$t(e,le,ot)},Ne=sD(),je=te(Ne);{var Tt=le=>{var ot=Bd(),At=ce(ot);{let qe=w(()=>s()==="gitlab"),yt=w(()=>!!G()&&s()==="local"),Re=w(()=>_.workspace_compactInitializer_repository_label()),We=w(()=>l(ke)||void 0);Yn(js(At,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get gitlabSelected(){return l(qe)},get plainFolderSelected(){return l(yt)},get value(){return l($e)},onchange:Le,get rowLabel(){return l(Re)},get triggerClass(){return yr.fieldTrigger},get displayValue(){return l(We)},triggerValueClass:"text-foreground",triggerContentClass:"gap-1"}),Pt=>x(bt,Pt,!0),()=>l(bt))}var Zt=R(At,2);{var Ve=qe=>{var yt=JN(),Re=te(yt);{var We=ze=>{var pt=Je(),at=ce(pt);{var Bt=rt=>{{let Yt=w(()=>_.workspace_compactInitializer_branch_label());Nc(rt,us(o,{get rowLabel(){return l(Yt)},get triggerClass(){return yr.fieldTrigger},showTriggerChevron:!1}))}};V(at,rt=>{o()&&rt(Bt)})}k(ze,pt)},Pt=ze=>{var pt=qN(),at=te(pt),Bt=re(at,!0),rt=R(at,2),Yt=re(rt,!0);Q(pt),L(Vn=>{wt(at,1,Xn(yr.fieldLabel)),B(Bt,Vn),B(Yt,f().branch||"main")},[()=>_.workspace_compactInitializer_branch_label()]),k(ze,pt)},Qe=ze=>{{let pt=w(()=>_.workspace_compactInitializer_branch_label()),at=w(()=>!l(Ct));ml(ze,{variant:"ghost",get rowLabel(){return l(pt)},get triggerClass(){return yr.fieldTrigger},get value(){return r()},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(at)},showUncommittedIndicator:!0,triggerContentClass:"w-full gap-2",onSkipIsolationChange:Bt=>v()?.(Bt),onGitHubAuthNeededChange:Bt=>m()?.(Bt),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Ye})}};V(Re,ze=>{s()==="gitlab"?ze(We):s()==="remote"&&f()?ze(Pt,1):ze(Qe,-1)})}Q(yt),k(qe,yt)};V(Zt,qe=>{!u()&&l(Ct)&&!(G()&&s()==="local")&&qe(Ve)})}var ht=R(Zt,2);{var Et=qe=>{var yt=YN(),Re=ce(yt),We=re(Re,!0);Pl(Re,(ze,pt)=>jd?.(ze,pt),()=>l(ge));var Pt=R(Re,2);{var Qe=ze=>{var pt=XN(),at=te(pt);Tp(at,{get checked(){return c()},onCheckedChange:rt=>v()?.(rt)});var Bt=R(at);Q(pt),L(rt=>B(Bt,` ${rt??""}`),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),k(ze,pt)};V(Pt,ze=>{typeof v()=="function"&&ze(Qe)})}L(()=>B(We,l(ge))),k(qe,yt)};V(ht,qe=>{s()==="remote"&&f()&&qe(Et)})}k(le,ot)},ee=le=>{{let ot=w(()=>s()==="gitlab"),At=w(()=>l(K)?H:W),Zt=w(()=>l(K)?"gap-1.5":"gap-0.75");Yn(js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get gitlabSelected(){return l(ot)},get value(){return l($e)},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(lt)},get triggerValueClass(){return l(At)},get triggerContentClass(){return l(Zt)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe}),Ve=>x(bt,Ve,!0),()=>l(bt))}},Ge=le=>{var ot=Je(),At=ce(ot);{var Zt=Ve=>{Nc(Ve,us(o,{get triggerClass(){return l(se)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe}))};V(At,Ve=>{o()&&Ve(Zt)})}k(le,ot)},it=le=>{var ot=QN(),At=te(ot);{let ht=w(()=>l(K)&&!l(ae)),Et=w(()=>l(K)?`w-full gap-1.5 ${l(ae)?"pr-5":""}`:void 0);ml(At,{variant:"ghost",get triggerClass(){return l(se)},get value(){return l(ye)},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,disabled:!1,showUncommittedIndicator:!0,get showTriggerChevron(){return l(ht)},triggerChevronClass:oe,get triggerContentClass(){return l(Et)},onSkipIsolationChange:qe=>v()?.(qe),onGitHubAuthNeededChange:qe=>m()?.(qe),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Ye})}var Zt=R(At,2);{var Ve=ht=>{li(ht,{size:16,class:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-subtle"})};V(Zt,ht=>{l(ae)&&ht(Ve)})}Q(ot),k(le,ot)},Xe=le=>{var ot=Bd(),At=ce(ot);{var Zt=qe=>{var yt=si(),Re=re(yt,!0);L(()=>B(Re,l(de)[0])),k(qe,yt)};V(At,qe=>{!l(K)&&l(de)[0]&&qe(Zt)})}var Ve=R(At,2);{let qe=w(()=>l(K)?H:W),yt=w(()=>l(K)?"gap-1.5":"gap-0.75");Yn(js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",value:"",onchange:Le,get triggerClass(){return l(Se)},get triggerValueClass(){return l(qe)},get triggerContentClass(){return l(yt)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe}),Re=>x(bt,Re,!0),()=>l(bt))}var ht=R(Ve,2);{var Et=qe=>{var yt=si(),Re=re(yt,!0);L(()=>B(Re,l(de)[1])),k(qe,yt)};V(ht,qe=>{!l(K)&&l(de)[1]&&qe(Et)})}k(le,ot)},mt=le=>{var ot=Bd(),At=ce(ot);{var Zt=qe=>{var yt=Je(),Re=ce(yt);{var We=Qe=>{var ze=Cm(),pt=ce(ze);ut(pt,{get icon(){return $c},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var at=R(pt,2),Bt=re(at,!0);L(rt=>B(Bt,rt),[()=>_.workspace_repoAndBranchPicker_createFolder_label()]),k(Qe,ze)},Pt=Qe=>{var ze=si(),pt=re(ze,!0);L(()=>B(pt,l(j)[0])),k(Qe,ze)};V(Re,Qe=>{G()==="new"?Qe(We):l(j)[0]&&Qe(Pt,1)})}k(qe,yt)};V(At,qe=>{l(K)||qe(Zt)})}var Ve=R(At,2);{let qe=w(()=>l(K)?l(ke):void 0),yt=w(()=>l(K)?H:W),Re=w(()=>l(K)?"gap-1.5":"gap-0.75");js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(qe)},get triggerValueClass(){return l(yt)},get triggerContentClass(){return l(Re)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=qe=>{var yt=si(),Re=re(yt,!0);L(()=>B(Re,l(j)[1])),k(qe,yt)};V(ht,qe=>{!l(K)&&G()!=="new"&&l(j)[1]&&qe(Et)})}k(le,ot)},Mt=le=>{var ot=Mc(),At=ce(ot);{var Zt=ht=>{var Et=Cm(),qe=ce(Et);ut(qe,{get icon(){return $c},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var yt=R(qe,2),Re=re(yt,!0);L(We=>B(Re,We),[()=>_.workspace_repoAndBranchPicker_createNewRepo_label()]),k(ht,Et)};V(At,ht=>{l(K)||ht(Zt)})}var Ve=R(At,2);{let ht=w(()=>l(K)?l(Z):void 0),Et=w(()=>l(K)?H:W),qe=w(()=>l(K)?"gap-1.5":"gap-0.75");js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(ht)},get triggerValueClass(){return l(Et)},get triggerContentClass(){return l(qe)},get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}k(le,ot)},Ue=le=>{{let ot=w(()=>s()==="gitlab"),At=w(()=>s()==="gitlab"?"":t());js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},get gitlabSelected(){return l(ot)},variant:"ghost",get value(){return l(At)},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(Z)},triggerValueClass:H,triggerContentClass:"gap-1.5",showTriggerChevron:!0,triggerChevronClass:oe})}},Ke=le=>{var ot=Mm(),At=ce(ot);{var Zt=Qe=>{var ze=Mc(),pt=ce(ze);Ba(pt,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var at=R(pt,2);{var Bt=rt=>{var Yt=si(),Vn=re(Yt,!0);L(()=>B(Vn,l(q)[0])),k(rt,Yt)};V(at,rt=>{l(q)[0]&&rt(Bt)})}k(Qe,ze)};V(At,Qe=>{l(K)||Qe(Zt)})}var Ve=R(At,2);{let Qe=w(()=>s()==="gitlab"),ze=w(()=>s()==="gitlab"?"":t()),pt=w(()=>l(K)?H:W);js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},get gitlabSelected(){return l(Qe)},variant:"ghost",get value(){return l(ze)},onchange:Le,get triggerClass(){return l(Se)},get triggerValueClass(){return l(pt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=Qe=>{var ze=si(),pt=re(ze,!0);L(()=>B(pt,l(K)?l(ie)[1]:l(q)[1])),k(Qe,ze)};V(ht,Qe=>{(l(K)?l(ie)[1]:l(q)[1])&&Qe(Et)})}var qe=R(ht,2);{var yt=Qe=>{var ze=Je(),pt=ce(ze);{var at=Bt=>{Nc(Bt,us(o,{get triggerClass(){return l(se)}}))};V(pt,Bt=>{o()&&Bt(at)})}k(Qe,ze)},Re=Qe=>{{let ze=w(()=>t()||""),pt=w(()=>!t()),at=w(()=>l(K)?"w-full gap-1.5":void 0);ml(Qe,{variant:"ghost",get triggerClass(){return l(se)},get value(){return r()},get repoPath(){return l(ze)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(pt)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(K)},triggerChevronClass:oe,get triggerContentClass(){return l(at)},onSkipIsolationChange:Bt=>v()?.(Bt),onGitHubAuthNeededChange:Bt=>m()?.(Bt),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Ye})}};V(qe,Qe=>{s()==="gitlab"?Qe(yt):Qe(Re,-1)})}var We=R(qe,2);{var Pt=Qe=>{var ze=si(),pt=re(ze,!0);L(()=>B(pt,l(K)?l(ie)[2]:l(q)[2])),k(Qe,ze)};V(We,Qe=>{(l(K)?l(ie)[2]:l(q)[2])&&Qe(Pt)})}k(le,ot)},Me=le=>{js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return f().name},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(Z)},triggerValueClass:H,triggerContentClass:"gap-1.5",showTriggerChevron:!0,triggerChevronClass:oe})},Xt=le=>{var ot=rD(),At=ce(ot);{var Zt=rt=>{var Yt=Mc(),Vn=ce(Yt);Kh(Vn,{size:16,class:"text-ghost ml-0.75 -mb-px mr-2 shrink-0"});var Qn=R(Vn,2);{var Gr=hs=>{var zt=si(),ps=re(zt,!0);L(()=>B(ps,l(ne)[0])),k(hs,zt)};V(Qn,hs=>{l(ne)[0]&&hs(Gr)})}k(rt,Yt)};V(At,rt=>{l(K)||rt(Zt)})}var Ve=R(At,2);{let rt=w(()=>l(K)?H:W);js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return f().name},onchange:Le,get triggerClass(){return l(Se)},get triggerValueClass(){return l(rt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=rt=>{var Yt=ZN(),Vn=re(Yt,!0);L(()=>B(Vn,l(ne)[1])),k(rt,Yt)};V(ht,rt=>{l(ne)[1]&&rt(Et)})}var qe=R(ht,2),yt=re(qe,!0);Pl(qe,(rt,Yt)=>jd?.(rt,Yt),()=>l(ge));var Re=R(qe,2);{var We=rt=>{var Yt=eD(),Vn=re(Yt,!0);L(()=>B(Vn,l(ne)[2])),k(rt,Yt)};V(Re,rt=>{l(ne)[2]&&rt(We)})}var Pt=R(Re,2),Qe=re(Pt,!0),ze=R(Pt,2);{var pt=rt=>{var Yt=tD(),Vn=re(Yt,!0);L(()=>B(Vn,l(ne)[3])),k(rt,Yt)};V(ze,rt=>{l(ne)[3]&&rt(pt)})}var at=R(ze,2);{var Bt=rt=>{Ze(rt,{variant:"ghost",type:"button",onclick:()=>v()?.(!c()),class:"flex items-center gap-1.5 ml-3 shrink-0 cursor-pointer",children:(Yt,Vn)=>{var Qn=nD(),Gr=ce(Qn);Tp(Gr,{get checked(){return c()},class:"-mb-0.5",onCheckedChange:ps=>v()?.(ps)});var hs=R(Gr,2),zt=re(hs,!0);L(ps=>B(zt,ps),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),k(Yt,Qn)},$$slots:{default:!0}})};V(at,rt=>{typeof v()=="function"&&rt(Bt)})}L(()=>{B(yt,l(ge)),B(Qe,f().branch||"main")}),k(le,ot)},tn=le=>{js(le,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get displayValue(){return l(Z)},triggerValueClass:H,triggerContentClass:"gap-1.5",showTriggerChevron:!0,triggerChevronClass:oe})},es=le=>{var ot=Mm(),At=ce(ot);{var Zt=We=>{var Pt=Mc(),Qe=ce(Pt);Ba(Qe,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var ze=R(Qe,2);{var pt=at=>{var Bt=si(),rt=re(Bt,!0);L(()=>B(rt,l(me)[0])),k(at,Bt)};V(ze,at=>{l(me)[0]&&at(pt)})}k(We,Pt)};V(At,We=>{l(K)||We(Zt)})}var Ve=R(At,2);{let We=w(()=>l(K)?H:W);js(Ve,{get gitlab(){return i()},get plainFolderMode(){return z()},get gitChoice(){return J()},variant:"ghost",get value(){return t()},onchange:Le,get triggerClass(){return l(Se)},get triggerSuffix(){return l(St)},get triggerValueClass(){return l(We)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(K)},triggerChevronClass:oe})}var ht=R(Ve,2);{var Et=We=>{var Pt=si(),Qe=re(Pt,!0);L(()=>B(Qe,l(me)[1])),k(We,Pt)};V(ht,We=>{l(me)[1]&&We(Et)})}var qe=R(ht,2);{let We=w(()=>t()||""),Pt=w(()=>!t()),Qe=w(()=>l(K)?"w-full gap-1.5":void 0);ml(qe,{variant:"ghost",get triggerClass(){return l(se)},get value(){return r()},get repoPath(){return l(We)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(Pt)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(K)},triggerChevronClass:oe,get triggerContentClass(){return l(Qe)},onSkipIsolationChange:ze=>v()?.(ze),onGitHubAuthNeededChange:ze=>m()?.(ze),get onBranchStatusChange(){return S()},get onBranchesLoaded(){return I()},onchange:Ye})}var yt=R(qe,2);{var Re=We=>{var Pt=si(),Qe=re(Pt,!0);L(()=>B(Qe,l(me)[2])),k(We,Pt)};V(yt,We=>{l(me)[2]&&We(Re)})}k(le,ot)};V(je,le=>{l(Y)?le(Tt):M()==="repo"?le(ee,1):M()==="branch"&&s()==="gitlab"?le(Ge,2):M()==="branch"?le(it,3):l(Ct)?G()&&s()==="local"?le(mt,5):u()?le(Mt,6):(s()==="github"&&a()||s()==="gitlab")&&l(K)?le(Ue,7):s()==="github"&&a()||s()==="gitlab"?le(Ke,8):s()==="remote"&&f()&&l(K)?le(Me,9):s()==="remote"&&f()?le(Xt,10):l(K)?le(tn,11):le(es,-1):le(Xe,4)})}return Q(Ne),L(()=>wt(Ne,1,Xn(l(Y)?"grid min-w-0 gap-1":l(we)))),k(n,Ne),Ot(he)}const oD=/^[\w.-]+\/[\w.-]+$/;function Tm(n){return n.replace(/[\\/]+$/,"")||n.slice(0,1)}function Em(n){let e=n.trim().toLowerCase();e=e.replace(/^[a-z+]+:\/\//,"").replace(/^[^@/]+@([^:/]+):/,"$1/"),e=e.replace(/^[^@/]+@/,""),e=e.replace(/\/+$/,"").replace(/\.git$/,"");const t=e.split("/").filter(Boolean);return t.length===2?`github.com/${t.join("/")}`:t.length===3&&t[0].includes(".")?t.join("/"):null}function m$(n){switch(n.type){case"github":{const e=n.githubUrl&&Em(n.githubUrl)||(n.path&&oD.test(n.path.trim())?Em(n.path):null);return e?`github:${e}`:null}case"local":{const e=n.path?.trim();return e?`local:${Tm(e)}`:null}case"remote":{const e=n.remote?.host?.trim().toLowerCase(),t=(n.remote?.workspacePath||n.path)?.trim();return e&&t?`remote:${e}:${Tm(t)}`:null}case"gitlab":{const e=n.gitlab?.instanceBaseUrl?.trim().toLowerCase().replace(/\/+$/,""),t=n.gitlab?.projectPath?.trim().toLowerCase().replace(/^\/+|\/+$/g,"");return e&&t?`gitlab:${e}/${t}`:null}}}function v$(n){const e=[],t=[];if(!n)return{files:e,folderFiles:t};const r=n.items;if(r&&r.length>0){let s=!1;for(const i of Array.from(r)){if(i.kind!=="file")continue;s=!0;const o=i.getAsFile();if(!o)continue;(typeof i.webkitGetAsEntry=="function"?i.webkitGetAsEntry():null)?.isDirectory?t.push(o):e.push(o)}if(s&&(e.length>0||t.length>0))return{files:e,folderFiles:t}}return{files:Array.from(n.files??[]),folderFiles:t}}const zd="data:",Am=";base64,";function aD(n){if(!n.startsWith(zd))return null;const e=n.indexOf(Am,zd.length);if(e===-1)return null;const t=n.slice(zd.length,e),r=n.slice(e+Am.length);return!t.startsWith("image/")||r.length===0?null:{mimeType:t,data:r}}const Rm=Ga("image-context-items");let lD=0;const b$=30*1024*1024,y$=10*1024*1024;function cD(n){if(n===0)return"0 Bytes";const e=1024,t=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(n)/Math.log(e));return Math.round(n/Math.pow(e,r)*100)/100+" "+t[r]}function uD(n){return new Promise((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(new Error("Failed to read file")),r.readAsDataURL(n)})}async function w$(n,e){const{maxBytes:t,readFile:r=uD,signal:s}=e,i=[],o=[];for(const a of n){if(s?.aborted)return[];if(a.size>t){o.push(a.name);continue}try{const c=await r(a);if(s?.aborted)return[];const u=aD(c);if(!u)throw new Error("Invalid data URL format");const{mimeType:d,data:f}=u,h=Date.now(),p=a.name||U1(d,`image-${h}`);i.push({id:`file-upload-${h}-${++lD}-${p}`,type:"file",label:p,description:`${d} • ${cD(a.size)}`,path:p,file:a,imageData:f,imageMimeType:d,...Um(d)?{}:{placementFileName:p}})}catch(c){if(s?.aborted)return[];Rm.error("Failed to add image to context",{fileName:a.name,error:c}),_s.error(_.chat_richInput_addImageFailed_error({name:a.name}))}}return s?.aborted?[]:(i.length>0&&Rm.debug(`Added ${i.length} image(s) to context`),o.length>0&&_s.error(_.chat_richInput_filesTooLarge_error({names:o.join(", ")})),i)}var dD=N('<img class="w-full h-full object-cover"/>'),fD=N('<div class="flex size-full items-center justify-center bg-muted text-subtle"><!></div>'),hD=N("<div><!> <!></div> <!>",1),pD=N('<span class="tabular-nums opacity-70 shrink-0" data-testid="attachment-upload-progress"> </span>'),gD=N("<!> <!>",1),mD=N('<div class="w-4 h-4 rounded overflow-hidden shrink-0"><img class="w-full h-full object-cover"/></div>'),vD=N('<div><!> <span class="font-medium truncate max-w-30"> </span> <!> <!></div>');function bD(n,e){if(new.target)return Nt({component:bD,...n});Lt(e,!0);let t=y(e,"id",7),r=y(e,"name",7),s=y(e,"type",7,""),i=y(e,"size",7),o=y(e,"file",7),a=y(e,"imageData",7),c=y(e,"imageMimeType",7),u=y(e,"onRemove",7),d=y(e,"class",7,""),f=y(e,"variant",7,"chip"),h=y(e,"placementStatus",7,void 0),p=y(e,"placementProgress",7,void 0),g=y(e,"placementError",7,void 0),v=y(e,"onRetry",7),m=fe(null);const S=w(()=>Um(c()||s()||o()?.type));let I=fe(null);const C=w(()=>l(S)?a()&&c()?`data:${ad(c())};base64,${a()}`:l(I):null);ft(()=>{if(l(S)&&!(a()&&c())&&o()){const q=URL.createObjectURL(o());return x(I,q,!0),()=>URL.revokeObjectURL(q)}x(I,null)});const M=w(()=>{if(s()==="folder")return Js;const q=ad(s()||c()||o()?.type);return q.startsWith("image")?Dc:q.includes("javascript")||q.includes("typescript")||q.includes("json")?Wd:q.includes("text")||q.includes("markdown")?Ff:Fo}),O=w(()=>ad(s()||c()||o()?.type).startsWith("image")),P=w(()=>{if(h()!=="failed")return;const q=_.chat_attachmentPreview_placementFailed_tooltip({name:r()});return g()?`${q} — ${g()}`:q}),E=w(()=>{if(h()!=="placing"||p()===void 0)return;const q=Math.max(0,Math.min(1,p()));return Lm(q,{style:"percent",maximumFractionDigits:0})});let z=fe(!1),G=fe(null);function J(){f()==="thumbnail"&&l(O)&&l(C)&&x(z,!0)}function K(q){(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),J())}function Y(q){q.stopPropagation(),u()?.(t())}var $={get id(){return t()},set id(q){t(q),b()},get name(){return r()},set name(q){r(q),b()},get type(){return s()},set type(q=""){s(q),b()},get size(){return i()},set size(q){i(q),b()},get file(){return o()},set file(q){o(q),b()},get imageData(){return a()},set imageData(q){a(q),b()},get imageMimeType(){return c()},set imageMimeType(q){c(q),b()},get onRemove(){return u()},set onRemove(q){u(q),b()},get class(){return d()},set class(q=""){d(q),b()},get variant(){return f()},set variant(q="chip"){f(q),b()},get placementStatus(){return h()},set placementStatus(q=void 0){h(q),b()},get placementProgress(){return p()},set placementProgress(q=void 0){p(q),b()},get placementError(){return g()},set placementError(q=void 0){g(q),b()},get onRetry(){return v()},set onRetry(q){v(q),b()},$set:Dt,$on:(q,j)=>$t(e,q,j)},X=Je(),de=ce(X);{var me=q=>{var j=hD(),ne=ce(j),we=te(ne);{let oe=w(()=>_.chat_attachmentPreview_viewFullSize_ariaLabel({name:r()})),H=w(()=>!l(C));Ze(we,{variant:"plain",wrapContent:!1,type:"button",class:"w-16 h-16 rounded-lg overflow-hidden cursor-pointer hover:opacity-90 transition-opacity",onclick:J,onkeydown:K,get"aria-label"(){return l(oe)},get title(){return r()},get disabled(){return l(H)},get ref(){return l(G)},set ref(W){x(G,W,!0)},children:(W,D)=>{var ae=Je(),ge=ce(ae);{var ue=ke=>{var ye=dD();L(()=>{xt(ye,"src",l(C)),xt(ye,"alt",r())}),xo("error",ye,()=>x(m,l(C),!0)),Fd(ye),k(ke,ye)},pe=ke=>{var ye=fD(),Z=te(ye);ut(Z,{get icon(){return Dc},size:"15"}),Q(ye),k(ke,ye)};V(ge,ke=>{l(C)?ke(ue):ke(pe,-1)})}k(W,ae)},$$slots:{default:!0}})}var be=R(we,2);{var Se=oe=>{{let H=w(()=>_.chat_attachmentPreview_remove_ariaLabel({name:r()}));Ze(oe,{variant:"ghost",size:"icon-xs",class:"absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity duration-spring-fast ease-spring-fast motion-reduce:transition-none bg-background/80 hover:bg-background shadow-sm",onclick:Y,get"aria-label"(){return l(H)},children:(W,D)=>{ut(W,{get icon(){return Fi},size:"10"})},$$slots:{default:!0}})}};V(be,oe=>{u()&&oe(Se)})}Q(ne);var se=R(ne,2);{let oe=w(()=>l(C)??"");bv(se,{get imageUrl(){return l(oe)},get imageName(){return r()},get openerElement(){return l(G)},get open(){return l(z)},set open(H){x(z,H,!0)}})}L(()=>wt(ne,1,`relative group shrink-0 ${d()??""}`)),Ss(1,ne,()=>Ud,()=>({tier:"moderate",y:0,scale:.9})),Ss(2,ne,()=>Vd,()=>({tier:"fast"})),k(q,j)},ie=q=>{var j=vD(),ne=te(j);{var we=ue=>{var pe=gD(),ke=ce(pe);li(ke,{size:15,class:"opacity-50 shrink-0"});var ye=R(ke,2);{var Z=$e=>{var lt=pD(),St=re(lt,!0);L(()=>B(St,l(E))),k($e,lt)};V(ye,$e=>{l(E)!==void 0&&$e(Z)})}k(ue,pe)},be=ue=>{ut(ue,{get icon(){return Om},size:"15",class:"shrink-0"})},Se=ue=>{var pe=mD(),ke=re(pe);L(()=>{xt(ke,"src",l(C)),xt(ke,"alt",r())}),xo("error",ke,()=>x(m,l(C),!0)),Fd(ke),k(ue,pe)},se=ue=>{ut(ue,{get icon(){return l(M)},size:"15",class:"opacity-30 shrink-0"})};V(ne,ue=>{h()==="placing"?ue(we):h()==="failed"?ue(be,1):l(O)&&l(C)&&l(m)!==l(C)?ue(Se,2):ue(se,-1)})}var oe=R(ne,2),H=re(oe,!0),W=R(oe,2);{var D=ue=>{{let pe=w(()=>_.chat_attachmentPreview_retryPlacement_ariaLabel({name:r()}));Ze(ue,{variant:"ghost-light",size:"icon-xs",class:"shrink-0 -my-1",onclick:ke=>{ke.stopPropagation(),v()(t())},get"aria-label"(){return l(pe)},"data-testid":"attachment-retry",children:(ke,ye)=>{ut(ke,{get icon(){return Bf},size:"10"})},$$slots:{default:!0}})}};V(W,ue=>{h()==="failed"&&v()&&ue(D)})}var ae=R(W,2);{var ge=ue=>{{let pe=w(()=>h()==="failed"?"":"opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),ke=w(()=>_.chat_attachmentPreview_removeAttachment_ariaLabel());Ze(ue,{variant:"ghost-light",size:"icon-xs",get class(){return`shrink-0 ${l(pe)??""} transition-opacity duration-spring-fast ease-spring-fast motion-reduce:transition-none -my-1 -mr-1`},onclick:()=>u()(t()),get"aria-label"(){return l(ke)},children:(ye,Z)=>{ut(ye,{get icon(){return Fi},size:"10"})},$$slots:{default:!0}})}};V(ae,ue=>{u()&&ue(ge)})}Q(j),L(()=>{wt(j,1,`flex items-center gap-1.5 px-2 py-0.5 rounded text-xs whitespace-nowrap group shrink-0 ${h()==="failed"?"bg-danger-background/10 text-danger border border-danger/40":"bg-muted/70 text-subtle"} ${d()??""}`),xt(j,"data-placement-status",h()),xt(j,"title",l(P)),B(H,r())}),Ss(1,j,()=>Ud,()=>({tier:"moderate",y:0,scale:.9})),Ss(2,j,()=>Vd,()=>({tier:"fast"})),k(q,j)};V(de,q=>{f()==="thumbnail"&&l(O)&&l(S)&&(!l(C)||l(m)!==l(C))?q(me):q(ie,-1)})}return k(n,X),Ot($)}export{Zf as $,uv as A,ml as B,DE as C,aa as D,xE as E,_e as F,uo as G,If as H,y$ as I,Dn as J,nv as K,iD as L,la as M,p0 as N,th as O,$_ as P,RS as Q,b$ as R,jt as S,i_ as T,He as U,Vh as V,av as W,rR as X,sR as Y,et as Z,NL as _,t$ as a,Zv as a0,eh as a1,Fc as a2,yv as a3,vv as a4,m$ as a5,r$ as a6,hn as a7,SI as a8,f$ as a9,Ca as aA,o$ as aB,a$ as aC,WO as aD,c$ as aE,eN as aF,ZO as aG,QO as aH,GO as aI,JO as aJ,XO as aK,qO as aL,l$ as aM,g$ as aN,O_ as aO,VO as aP,v$ as aQ,gP as aR,fP as aS,GR as aT,qR as aU,l_ as aV,Yd as aW,Jd as aX,ZD as aY,Ka as aZ,i$ as aa,p$ as ab,u$ as ac,$2 as ad,fv as ae,cD as af,e$ as ag,Jk as ah,Ep as ai,Zk as aj,zc as ak,ct as al,aL as am,sa as an,s$ as ao,Ch as ap,Mh as aq,w$ as ar,h$ as as,ZP as at,n$ as au,Qb as av,hv as aw,pn as ax,aD as ay,Au as az,bD as b,zE as c,FP as d,Pf as e,LI as f,Rr as g,Qt as h,DL as i,zn as j,P0 as k,lv as l,nh as m,mv as n,bv as o,I0 as p,tc as q,rh as r,wv as s,ov as t,pr as u,vt as v,SE as w,ju as x,_P as y,kn as z};