@intent-hq/web 2.342.4 → 2.342.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{CYkYJCIe.js → 1XQU3Y04.js} +1 -1
  3. package/web/app/immutable/chunks/{5KtPZQMj.js → 1cBRNdrT.js} +1 -1
  4. package/web/app/immutable/chunks/{D4m_3H3b.js → 34EP1V4U.js} +1 -1
  5. package/web/app/immutable/chunks/{t9E12oJ3.js → 3UFVWcav.js} +1 -1
  6. package/web/app/immutable/chunks/{NM7qy67Z.js → 5MJ74bom.js} +1 -1
  7. package/web/app/immutable/chunks/{DIw4K70V.js → 8GRPg7Be.js} +1 -1
  8. package/web/app/immutable/chunks/{Cth8kMss.js → B8esy8Vu.js} +1 -1
  9. package/web/app/immutable/chunks/{BGxSDng4.js → B9pffw5f.js} +1 -1
  10. package/web/app/immutable/chunks/{CTCotWuX.js → BAGnnBCG.js} +1 -1
  11. package/web/app/immutable/chunks/{jqA28ECO.js → BAKJw_70.js} +1 -1
  12. package/web/app/immutable/chunks/{ClPZ-dnm.js → BAq1pHdg.js} +1 -1
  13. package/web/app/immutable/chunks/{DV-obrTk.js → BDaNM4HC.js} +1 -1
  14. package/web/app/immutable/chunks/{DDm2Bs3C.js → BFEnkdqB.js} +1 -1
  15. package/web/app/immutable/chunks/{CVKwboeu.js → BJL3vZfi.js} +1 -1
  16. package/web/app/immutable/chunks/{C8qlJ0Ks.js → BKSBgVEt.js} +1 -1
  17. package/web/app/immutable/chunks/{CFgR764H.js → BLvT7caV.js} +1 -1
  18. package/web/app/immutable/chunks/{BmytRNPE.js → BNPwBixc.js} +1 -1
  19. package/web/app/immutable/chunks/{CICfpKca.js → BP-Q7b0i.js} +1 -1
  20. package/web/app/immutable/chunks/{CpUxooti.js → BPJT_jmR.js} +1 -1
  21. package/web/app/immutable/chunks/{Cf4bZipG.js → BPnWvR4U.js} +1 -1
  22. package/web/app/immutable/chunks/{BI2l6wE6.js → BQPPEUu1.js} +1 -1
  23. package/web/app/immutable/chunks/{7HuWq_hr.js → BTQOjzCX.js} +1 -1
  24. package/web/app/immutable/chunks/{C8KtEq0s.js → BVtokOo_.js} +1 -1
  25. package/web/app/immutable/chunks/{CD69NP_A.js → BY6vo3uD.js} +1 -1
  26. package/web/app/immutable/chunks/{D0LCHW4n.js → BYcqhPVA.js} +2 -2
  27. package/web/app/immutable/chunks/{B9Rr6BpD.js → BdINg18V.js} +1 -1
  28. package/web/app/immutable/chunks/{DgtpjRdr.js → BfRwjOCA.js} +1 -1
  29. package/web/app/immutable/chunks/{uZlZnPJv.js → BfqGTcOP.js} +1 -1
  30. package/web/app/immutable/chunks/{BtxzFh2d.js → BiJM57Y-.js} +1 -1
  31. package/web/app/immutable/chunks/{BGqqSLU-.js → BjxSeDhE.js} +2 -2
  32. package/web/app/immutable/chunks/{LUvhmWrd.js → Bl3ku6zY.js} +1 -1
  33. package/web/app/immutable/chunks/{BwfLVMMM.js → BlxdQMTv.js} +1 -1
  34. package/web/app/immutable/chunks/{Ci8LBOxa.js → BmLaJ9xx.js} +1 -1
  35. package/web/app/immutable/chunks/{BkT4AaId.js → BmZEWeMm.js} +1 -1
  36. package/web/app/immutable/chunks/{B2sG3ycV.js → BnOitAd5.js} +3 -3
  37. package/web/app/immutable/chunks/{Dt0R2Ktk.js → BokY6u4h.js} +1 -1
  38. package/web/app/immutable/chunks/{DgiTVZJP.js → BpIyu9yy.js} +1 -1
  39. package/web/app/immutable/chunks/{BS1TtWt_.js → BqJU57xs.js} +1 -1
  40. package/web/app/immutable/chunks/{CQWXQG41.js → Bxcfvdut.js} +1 -1
  41. package/web/app/immutable/chunks/{D-CZRaat.js → BywpJ9Jr.js} +1 -1
  42. package/web/app/immutable/chunks/{D5YUYmA3.js → C44zP9aX.js} +1 -1
  43. package/web/app/immutable/chunks/{5Cz4WZpZ.js → C4EYhr_S.js} +1 -1
  44. package/web/app/immutable/chunks/{BVg9yzXR.js → C9QANngy.js} +1 -1
  45. package/web/app/immutable/chunks/{DumOb8FY.js → CBZtJT-n.js} +1 -1
  46. package/web/app/immutable/chunks/{_d_cQJ1G.js → CCRKTTsT.js} +1 -1
  47. package/web/app/immutable/chunks/{CmwgdR7R.js → CH88el2F.js} +1 -1
  48. package/web/app/immutable/chunks/{D-XhH1EI.js → CJ6UQw63.js} +1 -1
  49. package/web/app/immutable/chunks/{BFw-QJi_.js → CJXKaPZY.js} +1 -1
  50. package/web/app/immutable/chunks/{DxzBH9If.js → CO4Qh4-v.js} +1 -1
  51. package/web/app/immutable/chunks/{C3fOi3VT.js → COFMFdMU.js} +1 -1
  52. package/web/app/immutable/chunks/{ZvX_fEaP.js → CQ4I_Mdn.js} +1 -1
  53. package/web/app/immutable/chunks/{DOJHO8tY.js → CQx6ZF60.js} +1 -1
  54. package/web/app/immutable/chunks/{BAKm0uzb.js → CRsmjbca.js} +1 -1
  55. package/web/app/immutable/chunks/{D2wzgv1F.js → CTGhMPAl.js} +1 -1
  56. package/web/app/immutable/chunks/{BuvdM8FN.js → CZfVnA69.js} +2 -2
  57. package/web/app/immutable/chunks/{DfEfJ41H.js → Cdb-RlPf.js} +1 -1
  58. package/web/app/immutable/chunks/{CNpCGMBp.js → CgAIgZYS.js} +1 -1
  59. package/web/app/immutable/chunks/{DRUHoPvO.js → CjN3bu3h.js} +1 -1
  60. package/web/app/immutable/chunks/{CgO3N0Eh.js → Ck2rWFI2.js} +12 -12
  61. package/web/app/immutable/chunks/{Os4z29kc.js → Co1GOV8m.js} +1 -1
  62. package/web/app/immutable/chunks/{BGlD6YLC.js → Coekp85l.js} +1 -1
  63. package/web/app/immutable/chunks/{Dtat8Jyj.js → CrvrVD-n.js} +1 -1
  64. package/web/app/immutable/chunks/{DYJF6z7c.js → CvYPF82-.js} +4 -4
  65. package/web/app/immutable/chunks/{BbmXR-SH.js → CwVL3hLj.js} +1 -1
  66. package/web/app/immutable/chunks/{CxvlNIyu.js → Cxon-xet.js} +1 -1
  67. package/web/app/immutable/chunks/{CRgdXK-6.js → D1IC4eoI.js} +1 -1
  68. package/web/app/immutable/chunks/D3QcPFoL.js +18 -0
  69. package/web/app/immutable/chunks/{C17WHWXN.js → D4BOXNo3.js} +3 -3
  70. package/web/app/immutable/chunks/{CqND6pvG.js → D5Ky76z6.js} +1 -1
  71. package/web/app/immutable/chunks/{CyAWaGyu.js → D6fq3jd3.js} +1 -1
  72. package/web/app/immutable/chunks/{DMIUJOUV.js → D6mwmUlO.js} +2 -2
  73. package/web/app/immutable/chunks/{Cqu-aR4t.js → D7Rp1YzU.js} +1 -1
  74. package/web/app/immutable/chunks/{LPPUEsZT.js → D9piAIpK.js} +1 -1
  75. package/web/app/immutable/chunks/{mS-9NIEA.js → DA09cdDe.js} +4 -4
  76. package/web/app/immutable/chunks/{CvZnx98i.js → DBkwUnB3.js} +1 -1
  77. package/web/app/immutable/chunks/{DQDdpgUG.js → DCdtmpaz.js} +1 -1
  78. package/web/app/immutable/chunks/{Bb4ph25I.js → DEwhJbS-.js} +1 -1
  79. package/web/app/immutable/chunks/{C_7QOYdw.js → DGu3KEOd.js} +1 -1
  80. package/web/app/immutable/chunks/{DRlYzKsv.js → DH9p1XHN.js} +1 -1
  81. package/web/app/immutable/chunks/{Dvj55vXN.js → DHOmmgcl.js} +2 -2
  82. package/web/app/immutable/chunks/{DEgM7-3u.js → DI_OiaCT.js} +1 -1
  83. package/web/app/immutable/chunks/{1KURqqMz.js → DJtGLOxa.js} +1 -1
  84. package/web/app/immutable/chunks/{COgT-EXe.js → DK7bkBKS.js} +1 -1
  85. package/web/app/immutable/chunks/{DSnMQfNF.js → DKpqyoHF.js} +1 -1
  86. package/web/app/immutable/chunks/{ChiWSNHv.js → DQzntlzl.js} +3 -3
  87. package/web/app/immutable/chunks/{B8XCEZm-.js → DS-PgUc7.js} +1 -1
  88. package/web/app/immutable/chunks/{CFR39oq5.js → DU6dXL8V.js} +1 -1
  89. package/web/app/immutable/chunks/{BONdHkQs.js → DVBxlkFp.js} +1 -1
  90. package/web/app/immutable/chunks/{C_hDvi-s.js → DVjUIntK.js} +1 -1
  91. package/web/app/immutable/chunks/{DB4b4MsO.js → DbPC6tLA.js} +1 -1
  92. package/web/app/immutable/chunks/{DuD5Wxpm.js → Dcv7OLYk.js} +1 -1
  93. package/web/app/immutable/chunks/{BeeSTXCF.js → DdbGGrJT.js} +1 -1
  94. package/web/app/immutable/chunks/{DxtKR96k.js → DerHBx5w.js} +1 -1
  95. package/web/app/immutable/chunks/{BRm0glkU.js → Dgglyxba.js} +1 -1
  96. package/web/app/immutable/chunks/{DKTzyP0R.js → Dng3CYSh.js} +1 -1
  97. package/web/app/immutable/chunks/DqN3eEdL.js +175 -0
  98. package/web/app/immutable/chunks/{CBR1HO24.js → Dqm94Bm7.js} +1 -1
  99. package/web/app/immutable/chunks/{C4jx-XZh.js → DqmXJyxa.js} +4 -4
  100. package/web/app/immutable/chunks/{Bau8iVXk.js → DsnPbcrG.js} +1 -1
  101. package/web/app/immutable/chunks/{CkMQV99G.js → DtLFy1HX.js} +1 -1
  102. package/web/app/immutable/chunks/{DUpM6F7J.js → DuHPqQGE.js} +1 -1
  103. package/web/app/immutable/chunks/{Bj2crfQp.js → Duzuaj0l.js} +1 -1
  104. package/web/app/immutable/chunks/{L-ubqpH9.js → DxWaTKL0.js} +3 -3
  105. package/web/app/immutable/chunks/{B6A6cgF-.js → DzGcLQsv.js} +1 -1
  106. package/web/app/immutable/chunks/{CkPDW0xR.js → F3N2tbK9.js} +1 -1
  107. package/web/app/immutable/chunks/{PeAPKDUF.js → F9fxsiNO.js} +1 -1
  108. package/web/app/immutable/chunks/{bijN4Zym.js → G9eRzhXv.js} +1 -1
  109. package/web/app/immutable/chunks/{BvQPs1Xx.js → H3AlxZF2.js} +1 -1
  110. package/web/app/immutable/chunks/{ztS7waxk.js → O5gmiwkz.js} +1 -1
  111. package/web/app/immutable/chunks/{Dc7eHIw9.js → QFw_XNQ-.js} +1 -1
  112. package/web/app/immutable/chunks/SYPnLWme.js +1 -0
  113. package/web/app/immutable/chunks/{C4lA6Qko.js → VlZpY_zn.js} +1 -1
  114. package/web/app/immutable/chunks/{D0ypGvvA.js → XIVGG58R.js} +1 -1
  115. package/web/app/immutable/chunks/{DjFKdLks.js → Xd2ADnnE.js} +1 -1
  116. package/web/app/immutable/chunks/{DXeiIMAg.js → Ye026sG_.js} +1 -1
  117. package/web/app/immutable/chunks/{BtxvvbW8.js → ZuHjZPjN.js} +1 -1
  118. package/web/app/immutable/chunks/{BnMYxi1T.js → _MlFNRUP.js} +1 -1
  119. package/web/app/immutable/chunks/_RTfq0v6.js +4 -0
  120. package/web/app/immutable/chunks/{VPc0uUzO.js → af2M07Jp.js} +1 -1
  121. package/web/app/immutable/chunks/{8a4AenV7.js → b31Z8LKe.js} +1 -1
  122. package/web/app/immutable/chunks/{CRVLrgxJ.js → cf3hShp0.js} +1 -1
  123. package/web/app/immutable/chunks/{3KbBjGJm.js → dF445d6n.js} +1 -1
  124. package/web/app/immutable/chunks/{zGggXnza.js → ftrEOorZ.js} +2 -2
  125. package/web/app/immutable/chunks/{CUfd6v40.js → fwxl4rBI.js} +1 -1
  126. package/web/app/immutable/chunks/{BAdws6Fu.js → gLnFSVct.js} +2 -2
  127. package/web/app/immutable/chunks/{DdI6xQc_.js → iSPSrAXS.js} +1 -1
  128. package/web/app/immutable/chunks/{DTnOOoUt.js → iZrGkeHG.js} +1 -1
  129. package/web/app/immutable/chunks/{CxMzoxX3.js → jJxI_UAc.js} +1 -1
  130. package/web/app/immutable/chunks/{CUMVOvj8.js → jpkdFrp6.js} +1 -1
  131. package/web/app/immutable/chunks/{DEpTpabV.js → k5gd82i4.js} +1 -1
  132. package/web/app/immutable/chunks/{DkqCzXww.js → mO0YX6Up.js} +1 -1
  133. package/web/app/immutable/chunks/{DwdKjBer.js → o3OBOoSf.js} +1 -1
  134. package/web/app/immutable/chunks/{CEhJvA02.js → q8sNwmKq.js} +1 -1
  135. package/web/app/immutable/chunks/{B1NzFEuO.js → r7GEgyab.js} +2 -2
  136. package/web/app/immutable/chunks/{B1cObw1z.js → rqpOGBN5.js} +1 -1
  137. package/web/app/immutable/chunks/{H0MOjDP3.js → u9XHqibz.js} +1 -1
  138. package/web/app/immutable/chunks/{D78kBZDL.js → wMidnPXT.js} +3 -3
  139. package/web/app/immutable/chunks/{WIMBPpA0.js → zzo-K1GZ.js} +1 -1
  140. package/web/app/immutable/entry/{app.4WfHy_Zl.js → app.F7HSlLyZ.js} +2 -2
  141. package/web/app/immutable/entry/start.CUFDKLDi.js +1 -0
  142. package/web/app/immutable/nodes/{0.vO0Tybn6.js → 0.Bl0xo6es.js} +1 -1
  143. package/web/app/immutable/nodes/{1.Bfh_ynUg.js → 1.BIjEngSs.js} +1 -1
  144. package/web/app/immutable/nodes/{10.CbLOWaiK.js → 10.CxhXAvUx.js} +1 -1
  145. package/web/app/immutable/nodes/{14.CgOJLuna.js → 14.CgIrR2xa.js} +1 -1
  146. package/web/app/immutable/nodes/{17.CeWDuaDv.js → 17.B_Cve8Oj.js} +2 -2
  147. package/web/app/immutable/nodes/{2.BJIFazOq.js → 2.Lo576kSK.js} +4 -4
  148. package/web/app/immutable/nodes/{3.BfaIoPwI.js → 3.KCA5aN-y.js} +1 -1
  149. package/web/app/immutable/nodes/{4.CIKjzhEc.js → 4.BA93tNs_.js} +1 -1
  150. package/web/app/immutable/nodes/{5.D0xlWd9R.js → 5.CK2zLy3y.js} +1 -1
  151. package/web/app/immutable/nodes/{6.CXDD93jK.js → 6.Cv46jHXT.js} +1 -1
  152. package/web/app/immutable/nodes/{7.Om4HLRbN.js → 7.Cy3olq8_.js} +1 -1
  153. package/web/app/immutable/nodes/{8.3MB3X1xo.js → 8.DzgEjwaM.js} +4 -4
  154. package/web/app/immutable/nodes/{9.CawzZbso.js → 9.Ddzgkod6.js} +4 -4
  155. package/web/app/version.json +1 -1
  156. package/web/index.html +9 -9
  157. package/web/app/immutable/chunks/CAZtHQBF.js +0 -175
  158. package/web/app/immutable/chunks/CKJ3ApuI.js +0 -1
  159. package/web/app/immutable/chunks/Cg2SHWhQ.js +0 -18
  160. package/web/app/immutable/chunks/CpMT4a7n.js +0 -4
  161. package/web/app/immutable/entry/start.gUgDD-in.js +0 -1
@@ -1,175 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/Bfr1QjPr.js","/app/immutable/chunks/DXyyWeag.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/Cuqq8bL5.js","/app/immutable/chunks/CjaOLL1c.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/CnVt0JNG.js","/app/immutable/chunks/DyvrH0mm.js","/app/immutable/chunks/BybfkKTj.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/q36554_4.js","/app/immutable/chunks/D5ej8a-y.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/ppRpwazH.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/D32PJnzX.js","/app/immutable/chunks/Cg2SHWhQ.js","/app/immutable/chunks/BTdkHPOB.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/DEYvT_CO.js","/app/immutable/chunks/BboIV5H5.js","/app/immutable/chunks/BnovDLUv.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/DogedYC1.js","/app/immutable/chunks/ChkzKl5W.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/pKvpKpo4.js","/app/immutable/chunks/DNBv5HWD.js","/app/immutable/chunks/DlyM6KGr.js","/app/immutable/chunks/i7ZdGAM9.js","/app/immutable/chunks/BhSvFvWk.js","/app/immutable/chunks/l23P2uQD.js","/app/immutable/assets/register.CUyDR59i.css","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/Jt_K3Kpx.js","/app/immutable/assets/terminal-manager.MhP_vFvK.css","/app/immutable/chunks/BkT4AaId.js","/app/immutable/chunks/D5YUYmA3.js","/app/immutable/chunks/DT4bpJWb.js","/app/immutable/chunks/DJkHth-B.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/RD9QY1Yc.js","/app/immutable/chunks/BAKm0uzb.js","/app/immutable/chunks/DHQOuksI.js","/app/immutable/chunks/BAdws6Fu.js","/app/immutable/chunks/BuvdM8FN.js","/app/immutable/chunks/3KbBjGJm.js","/app/immutable/chunks/DMIUJOUV.js","/app/immutable/chunks/BwfLVMMM.js","/app/immutable/chunks/DEgM7-3u.js"])))=>i.map(i=>d[i]);
2
- var Hw=Object.defineProperty;var wp=n=>{throw TypeError(n)};var Uw=(n,e,t)=>e in n?Hw(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var it=(n,e,t)=>Uw(n,typeof e!="symbol"?e+"":e,t),xp=(n,e,t)=>e.has(n)||wp("Cannot "+t);var rs=(n,e,t)=>(xp(n,e,"read from private field"),t?t.call(n):e.get(n)),ao=(n,e,t)=>e.has(n)?wp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),kp=(n,e,t,r)=>(xp(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t);import{aa as Vw,cd as Ww,bK as _p,Q as Sp,bJ as Cp,O as Mp,at as jw,by as Kw,au as Gw,aE as qw,bo as Ti,bs as Rt,a7 as Ye,ay as ae,W as x,aD as l,a5 as ne,bf as Or,bA as Q,bn as Pt,c9 as w,aA as b,aB as B,bH as k,bS as A,b_ as N,bl as re,bO as H,cb as Jw,bV as he,aw as To,bz as tf,be as $t,b$ as zt,aC as Qi,bv as Tp,al as Xw,ai as Ro,ca as ut,aj as Qr,br as Cr,bb as Cl,c3 as uo,aG as Yw,bk as Fu,c0 as Qo,bj as sc,c5 as Zs}from"./DYhIMPy1.js";import{dS as iv,G as Qw,F as Zw,Z as e1,R as Xf,S as t1,i as nf,aC as n1,ab as r1,U as s1,dT as i1,a0 as o1,ca as Yf,cE as kd,b_ as a1,cS as l1,aT as c1,cD as u1}from"./Cg2SHWhQ.js";import{t as It,br as y,a_ as K,bz as Lt,b as Ot,bs as Ei,bp as _,bu as ks,bx as Ep,bt as Ja,bv as nn,_ as xs}from"./DXyyWeag.js";import{t as ws,I as Ps,g as d1,i as ov,u as av,j as f1,v as h1,F as rf,c as sf,D as Uo,s as p1,l as g1}from"./BboIV5H5.js";import{ay as lv,cO as m1,ax as v1,bC as b1,F as rt,c_ as Ji,bj as ti,bp as Qf,bq as Zf,aN as y1,aO as _d,bS as w1,bT as x1,cl as k1,bB as Gc,cm as eh,aV as cv,a4 as uv,cn as _1,av as S1,as as sa,b7 as C1,br as th,bd as nh,s as M1,bA as T1,aE as Ap,bc as jo,cU as dv,cR as E1,ci as fv,cF as hv,ag as A1,ar as pv,au as Rp,al as R1,af as P1,ao as I1,cS as L1,aJ as Sd,cj as O1,bt as N1,c6 as D1,ct as Pp,Q as $1,cC as B1,ap as z1,bQ as F1,am as H1,c2 as U1,bJ as V1,cV as W1,ah as j1,bh as K1,aX as G1,cZ as q1,ai as J1,bO as X1,aP as Y1,aY as Q1,bY as Z1,b9 as ex,cs as tx,cy as nx,bN as rx,bk as sx,be as of,aH as ix,aZ as ox,v as ax,b6 as lx,ck as Ip,aM as cx,aq as gv,bw as mv,a8 as ux,c8 as qc,Y as dx}from"./BTdkHPOB.js";import{aJ as fx,az as hx,av as px,ai as gx,Q as mx,c_ as vx,aE as bx,cM as Lp,aR as Op,cw as yx,aG as Np,s as ka,ap as wx,a2 as xx,cV as kx,aU as _x,a5 as Sx,bN as Cx,bO as Mx,bM as Tx,cD as Ex,cz as Ax,cx as Rx,cJ as Px,cL as Ix,cI as Lx,cy as Ox,ce as Nx,aC as Cd,ax as Dp,Y as Dx,T as dl,O as $x,ay as Bx,X as zx,m as Fx,V as Hx,a6 as Ux,al as vv,j as Md}from"./CUfd6v40.js";import{i as da,l as Mr,w as Xi,v as at,j as Bn,u as ot,o as Vx,g as Fl,n as as,p as $c,I as pi}from"./CjaOLL1c.js";import{s as Un}from"./Cuqq8bL5.js";import{aT as Fa,aJ as Us,bn as rh,av as Wx,aH as jx,aF as Kx,aE as Gx,aS as qx,bp as $p,an as Jx,as as Xx,at as Yx,a5 as bv,aq as Qx,ar as Zx,f as Je,br as ek,aW as tk,aw as nk,aQ as rk,aj as sk,am as Hu,ax as yv}from"./Bfr1QjPr.js";import{a as ik,z as fa,P as ok,p as sh,h as ih,i as Ko,K as wv,l as xv,M as oh,u as ak,s as lk,v as kv,L as Fo,H as ck,R as uk,k as dk,d as fk,f as hk,e as pk,E as gk}from"./CX_KiszT.js";import{i as _v,f as mk,I as is,a as vk}from"./ChOlbK8y.js";import"./Co9PgWQA.js";import{c as xt}from"./CnVt0JNG.js";import{b as jn}from"./BaIAhI85.js";import{a as Sv}from"./CC7to1B5.js";import{e as bk,g as yk}from"./B5m4HK_m.js";import{f as wk,k as Rs,t as Bp}from"./DT4bpJWb.js";import{c as ha,l as Et}from"./ChTqQfQN.js";import"./DJkHth-B.js";import{nk as xk,c as Bc,Iy as At,nx as kk,be as Cv,BL as zp,ro as _k,n9 as Sk,x_ as Ck,qv as af,Io as Mk,eb as Fp,fS as Tk,ny as ah,g as Ek,qh as Mv,ql as Ak,I_ as Rk,s5 as Hp,Lf as Pk,Lu as Ik,qm as Lk,Lt as Ok,Le as Nk,Cf as Dk,G_ as $k,yC as Bk,k2 as zk,H4 as Fk}from"./D5ej8a-y.js";import{k as Hk,p as Uk,o as Tv,v as Up,e as Vk,s as Wk,x as lh,L as jk,S as Kk,w as Gk,l as qk,P as Jk,m as Uu,C as ch,W as cn,n as Vu,E as Ev,B as Xk,G as Yk,f as lf,y as cf,T as Qk,q as Zk,r as Vp,D as e_,N as t_,F as n_,j as r_}from"./CpMT4a7n.js";import{F as s_,t as uf,k as uh,O as _a,M as Av}from"./4NMrKcis.js";import{cq as Jc,H as Wp,bF as i_,bM as o_,W as jp,aN as Rv,aO as a_,aL as l_,aM as c_,aR as u_}from"./D5YUYmA3.js";import{a as dh,m as d_,u as Wu}from"./D6bHtnlF.js";import{bU as f_,al as h_,y as p_}from"./BAKm0uzb.js";import{g as g_}from"./CMiilI_P.js";import{O as Pv,G as fh,H as m_,z as v_}from"./DyvrH0mm.js";import"./Dwmx7Nbz.js";import{I as ju}from"./lkH5RFQO.js";import{d as Vo}from"./ChkzKl5W.js";import{s as b_,C as Kp}from"./CshdgsKR.js";import"./B0gQeWRk.js";import"./BKnW-cqy.js";import"./C5oPUaEZ.js";import{i as Td}from"./RD9QY1Yc.js";import{b as y_,c as Ml,T as Iv}from"./2YGlULfT.js";import{d as w_}from"./3KbBjGJm.js";function Y3(n,e){var t=Mp,r=Sp,s=n();return{subscribe:Ww(s,o=>{var a=s!==n(),c,u=Sp,d=Mp;_p(r),Cp(t);try{c=jw(()=>{Kw(()=>{const f=n();a&&o(f)})})}finally{_p(u),Cp(d)}return a=!0,c}).subscribe}}function Q3(n){let e;const t=Vw(s=>{let i=!1;const o=n.subscribe(a=>{e=a,i&&s()});return i=!0,o});function r(){return Gw()?(t(),e):qw(n)}return"set"in n?{get current(){return r()},set current(s){n.set(s)}}:{get current(){return r()}}}var x_=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","type","disabled","openOnHover","openDelay","closeDelay"]),k_=B("<button><!></button>");function Lv(n,e){const t=Ti();if(new.target)return It({component:Lv,...n});Rt(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>Fa(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=Ei(e,x_);const p=Hk.create({id:Us(()=>i()),ref:Us(()=>o(),m=>o(m)),disabled:Us(()=>!!c()),openOnHover:Us(()=>u()),openDelay:Us(()=>d()),closeDelay:Us(()=>f())}),g=w(()=>rh(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=Fa(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:Lt,$on:(m,C)=>Ot(e,m,C)};return s_(n,{get id(){return i()},get ref(){return p.opts.ref},children:(m,C)=>{var $=Ye(),M=ae($);{var S=I=>{var E=Ye(),L=ae(E);Un(L,s,()=>({props:l(g)})),x(I,E)},D=I=>{var E=k_();da(E,()=>({...l(g)}));var L=ne(E);Un(L,()=>r()??Or),Q(E),x(I,E)};K(M,I=>{s()?I(S):I(D,-1)})}x(m,$)},$$slots:{default:!0}}),Pt(v)}var __=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","value"]),S_=B("<div><!></div>");function Ov(n,e){const t=Ti();if(new.target)return It({component:Ov,...n});Rt(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>Fa(t)),o=y(e,"ref",15,null),a=y(e,"value",7),c=Ei(e,__);const u=Uk.create({value:Us(()=>a()),id:Us(()=>i()),ref:Us(()=>o(),m=>o(m))}),d=w(()=>rh(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=Fa(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:Lt,$on:(m,C)=>Ot(e,m,C)},h=Ye(),p=ae(h);{var g=m=>{var C=Ye(),$=ae(C);Un($,s,()=>({props:l(d)})),x(m,C)},v=m=>{var C=S_();da(C,()=>({...l(d)}));var $=ne(C);Un($,()=>r()??Or),Q(C),x(m,C)};K(p,m=>{s()?m(g):m(v,-1)})}return x(n,h),Pt(f)}const C_=qx({component:"toggle",parts:["root"]});var Ql,Zl;const ap=class ap{constructor(e){it(this,"opts");it(this,"attachment");ao(this,Ql,w(()=>({pressed:this.opts.pressed.current})));ao(this,Zl,w(()=>({[C_.root]:"",id:this.opts.id.current,"data-disabled":Gx(this.opts.disabled.current),"aria-pressed":Kx(this.opts.pressed.current),"data-state":M_(this.opts.pressed.current),disabled:jx(this.opts.disabled.current),onclick:this.onclick,...this.attachment})));this.opts=e,this.attachment=Wx(this.opts.ref),this.onclick=this.onclick.bind(this)}static create(e){return new ap(e)}onclick(e){this.opts.disabled.current||(this.opts.pressed.current=!this.opts.pressed.current)}get snippetProps(){return l(rs(this,Ql))}set snippetProps(e){k(rs(this,Ql),e)}get props(){return l(rs(this,Zl))}set props(e){k(rs(this,Zl),e)}};Ql=new WeakMap,Zl=new WeakMap;let df=ap;function M_(n){return n?"on":"off"}var T_=new Set(["$$slots","$$events","$$legacy","ref","id","pressed","onPressedChange","disabled","type","children","child"]),E_=B("<button><!></button>");function Nv(n,e){const t=Ti();if(new.target)return It({component:Nv,...n});Rt(e,!0);let r=y(e,"ref",15,null),s=y(e,"id",23,()=>Fa(t)),i=y(e,"pressed",15,!1),o=y(e,"onPressedChange",7,$p),a=y(e,"disabled",7,!1),c=y(e,"type",7,"button"),u=y(e,"children",7),d=y(e,"child",7),f=Ei(e,T_);const h=df.create({pressed:Us(()=>i(),M=>{i(M),o()(M)}),disabled:Us(()=>a()??!1),id:Us(()=>s()),ref:Us(()=>r(),M=>r(M))}),p=w(()=>rh(f,h.props,{type:c()}));var g={get ref(){return r()},set ref(M=null){r(M),b()},get id(){return s()},set id(M=Fa(t)){s(M),b()},get pressed(){return i()},set pressed(M=!1){i(M),b()},get onPressedChange(){return o()},set onPressedChange(M=$p){o(M),b()},get disabled(){return a()},set disabled(M=!1){a(M),b()},get type(){return c()},set type(M="button"){c(M),b()},get children(){return u()},set children(M){u(M),b()},get child(){return d()},set child(M){d(M),b()},$set:Lt,$on:(M,S)=>Ot(e,M,S)},v=Ye(),m=ae(v);{var C=M=>{var S=Ye(),D=ae(S);{let I=w(()=>({props:l(p),...h.snippetProps}));Un(D,d,()=>l(I))}x(M,S)},$=M=>{var S=E_();da(S,()=>({...l(p)}));var D=ne(S);Un(D,()=>u()??Or,()=>h.snippetProps),Q(S),x(M,S)};K(m,M=>{d()?M(C):M($,-1)})}return x(n,v),Pt(g)}var A_=B('<h4 class="type-body font-medium"> </h4>'),R_=B('<div class="flex items-start gap-2"><!> <!></div>'),P_=B("<p> </p>"),I_=B('<div class="type-caption"><!></div>'),L_=B("<div><!></div>"),O_=B("<div></div>"),N_=B('<div class="relative"><!> <div><!> <!> <!></div> <!></div> <!>',1),D_=B("<!><!>",1);function hh(n,e){if(new.target)return It({component:hh,...n});Rt(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,""),C=y(e,"contentContainerClass",7,""),$=y(e,"showArrow",7,!0),M=y(e,"showClose",7,!1),S=y(e,"onClose",7),D=y(e,"variant",7,"default"),I=y(e,"maxWidth",7,"20rem"),E=y(e,"interactive",7,!1),L=y(e,"disableAnimation",7,!1),ee=y(e,"children",7),U=y(e,"trigger",7),ie=y(e,"icon",7),F=y(e,"footer",7),W=y(e,"iconClass",7,""),Y=y(e,"footerClass",7,""),ce=y(e,"descriptionClass",7,""),pe=y(e,"onclick",7);const j={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:b1,iconColor:"text-info"},success:{bg:"bg-popover",text:"text-success",border:"border border-success/40",icon:v1,iconColor:"text-success"},warning:{bg:"bg-popover",text:"text-warning-ink",border:"border border-warning/40",icon:m1,iconColor:"text-warning-ink"},error:{bg:"bg-danger",text:"text-danger-background",border:"border border-danger/40",icon:lv,iconColor:"text-danger-background"},custom:{bg:"",text:"",border:"",icon:null,iconColor:""}},ue=w(()=>j[D()]),P=w(()=>ie()||l(ue).icon),z=w(()=>Mr("overlay-surface z-(--layer-tooltip)",!L()&&"tooltip-motion",l(ue).bg,l(ue).text,l(ue).border,m()));function le(V){p(V),g()?.(V)}function ge(){p(!1),S()?.()}var ye={get title(){return t()},set title(V=""){t(V),b()},get description(){return r()},set description(V=""){r(V),b()},get content(){return s()},set content(V){s(V),b()},get side(){return i()},set side(V="top"){i(V),b()},get align(){return o()},set align(V="center"){o(V),b()},get sideOffset(){return a()},set sideOffset(V=8){a(V),b()},get alignOffset(){return c()},set alignOffset(V=0){c(V),b()},get delayDuration(){return u()},set delayDuration(V=200){u(V),b()},get disableHoverableContent(){return d()},set disableHoverableContent(V=!1){d(V),b()},get disableCloseOnTriggerClick(){return f()},set disableCloseOnTriggerClick(V=!1){f(V),b()},get disabled(){return h()},set disabled(V=!1){h(V),b()},get open(){return p()},set open(V=!1){p(V),b()},get onOpenChange(){return g()},set onOpenChange(V){g(V),b()},get class(){return v()},set class(V=""){v(V),b()},get contentClass(){return m()},set contentClass(V=""){m(V),b()},get contentContainerClass(){return C()},set contentContainerClass(V=""){C(V),b()},get showArrow(){return $()},set showArrow(V=!0){$(V),b()},get showClose(){return M()},set showClose(V=!1){M(V),b()},get onClose(){return S()},set onClose(V){S(V),b()},get variant(){return D()},set variant(V="default"){D(V),b()},get maxWidth(){return I()},set maxWidth(V="20rem"){I(V),b()},get interactive(){return E()},set interactive(V=!1){E(V),b()},get disableAnimation(){return L()},set disableAnimation(V=!1){L(V),b()},get children(){return ee()},set children(V){ee(V),b()},get trigger(){return U()},set trigger(V){U(V),b()},get icon(){return ie()},set icon(V){ie(V),b()},get footer(){return F()},set footer(V){F(V),b()},get iconClass(){return W()},set iconClass(V=""){W(V),b()},get footerClass(){return Y()},set footerClass(V=""){Y(V),b()},get descriptionClass(){return ce()},set descriptionClass(V=""){ce(V),b()},get onclick(){return pe()},set onclick(V){pe(V),b()},$set:Lt,$on:(V,G)=>Ot(e,V,G)},Z=Ye(),oe=ae(Z);{let V=w(()=>E()?0:u());xt(oe,()=>Zx,(G,O)=>{O(G,{get delayDuration(){return l(V)},children:(te,ve)=>{var de=Ye(),fe=ae(de);{let ke=w(()=>E()?0:u()),be=w(()=>!E()&&d());xt(fe,()=>Jx,(J,Me)=>{Me(J,{onOpenChange:le,get delayDuration(){return l(ke)},get disableHoverableContent(){return l(be)},get disableCloseOnTriggerClick(){return f()},get open(){return p()},set open(Be){p(Be)},children:(Be,gt)=>{var Ie=D_(),$e=ae(Ie);{const Vt=(Ae,Ce)=>{let we=()=>(Ce?.()).props;Yx(Ae,{get triggerProps(){return we()},children:(Ue,_t)=>{var se=Ye(),Ze=ae(se);{var lt=bt=>{var Bt=Ye(),Fe=ae(Bt);Un(Fe,()=>U()??Or),x(bt,Bt)},et=bt=>{var Bt=Ye(),Fe=ae(Bt);Un(Fe,()=>ee()??Or),x(bt,Bt)};K(Ze,bt=>{U()?bt(lt):ee()&&bt(et,1)})}x(Ue,se)},$$slots:{default:!0}})};let st=w(()=>Mr("inline-flex",v()));xt($e,()=>Xx,(Ae,Ce)=>{Ce(Ae,{get class(){return l(st)},get disabled(){return h()},get onclick(){return pe()},"data-tooltip-trigger":!0,child:Vt,$$slots:{child:!0}})})}var ze=A($e);{var vt=Vt=>{var st=Ye(),Ae=ae(st);xt(Ae,()=>bv,(Ce,we)=>{we(Ce,{children:(Ue,_t)=>{var se=Ye(),Ze=ae(se);xt(Ze,()=>Qx,(lt,et)=>{et(lt,{role:"tooltip",get side(){return i()},get align(){return o()},get sideOffset(){return a()},get alignOffset(){return c()},get class(){return l(z)},"data-tooltip-content":!0,"data-overlay-surface":!0,onFocusOutside:()=>{},children:(bt,Bt)=>{var Fe=N_(),Ke=ae(Fe),Yt=ne(Ke);{var Ne=je=>{{let qe=w(()=>_.ui_tooltipRich_close_ariaLabel());Je(je,{variant:"ghost",size:"icon-compact",onclick:ge,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(qe)},children:(Ct,Ge)=>{rt(Ct,{get icon(){return Ji},size:"xs",class:"w-3 h-3"})},$$slots:{default:!0}})}};K(Yt,je=>{M()&&je(Ne)})}var en=A(Yt,2),Yn=ne(en);{var vn=je=>{var qe=R_(),Ct=ne(qe);{var Ge=pt=>{{let qt=w(()=>Mr("w-4 h-4 mt-0.5 flex-shrink-0",l(ue).iconColor,W()));rt(pt,{get icon(){return l(P)},size:"1x",get class(){return l(qt)}})}};K(Ct,pt=>{l(P)&&pt(Ge)})}var nt=A(Ct,2);{var Qe=pt=>{var qt=A_(),Ht=re(qt,!0);N(()=>H(Ht,t())),x(pt,qt)};K(nt,pt=>{t()&&pt(Qe)})}Q(qe),x(je,qe)};K(Yn,je=>{(t()||l(P))&&je(vn)})}var me=A(Yn,2);{var tt=je=>{var qe=P_(),Ct=re(qe,!0);N(Ge=>{at(qe,1,Ge),H(Ct,r())},[()=>Bn(Mr("type-body opacity-90",ce()))]),x(je,qe)};K(me,je=>{r()&&je(tt)})}var St=A(me,2);{var sn=je=>{var qe=I_(),Ct=ne(qe);Un(Ct,()=>s()??Or),Q(qe),x(je,qe)};K(St,je=>{s()&&je(sn)})}Q(en);var jt=A(en,2);{var yt=je=>{var qe=L_(),Ct=ne(qe);Un(Ct,()=>F()??Or),Q(qe),N(Ge=>at(qe,1,Ge),[()=>Bn(Mr("px-3 py-2",Y()))]),x(je,qe)};K(jt,je=>{F()&&je(yt)})}Q(Ke);var dt=A(Ke,2);{var Le=je=>{var qe=Ye(),Ct=ae(qe);{const Ge=(nt,Qe)=>{let pt=()=>(Qe?.()).props;var qt=O_();da(qt,Ht=>({class:Ht,...pt()}),[()=>Mr("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")]),x(nt,qt)};xt(Ct,()=>wk,(nt,Qe)=>{Qe(nt,{child:Ge,$$slots:{child:!0}})})}x(je,qe)};K(dt,je=>{$()&&je(Le)})}N(()=>{Xi(Ke,`max-width: ${I()??""};`),at(en,1,`px-3 py-2 space-y-1 ${C()??""}`)}),x(bt,Fe)},$$slots:{default:!0}})}),x(Ue,se)},$$slots:{default:!0}})}),x(Vt,st)};K(ze,Vt=>{!h()&&(t()||r()||s())&&Vt(vt)})}x(Be,Ie)},$$slots:{default:!0}})})}x(te,de)},$$slots:{default:!0}})})}return x(n,Z),Pt(ye)}var $_=new Set(["$$slots","$$events","$$legacy","leading","title","description","trailing","selected","disabled","class"]),B_=B('<span data-slot="action-row-leading" class="first-line-icon w-(--menu-icon-size)"><!></span>'),z_=B('<span data-slot="action-row-description"><!></span>'),F_=B('<span data-slot="action-row-trailing" class="first-line-icon gap-2"><!></span>'),H_=B('<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 Dv(n,e){if(new.target)return It({component:Dv,...n});Rt(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=Ei(e,$_);var d={get leading(){return t()},set leading(D){t(D),b()},get title(){return r()},set title(D){r(D),b()},get description(){return s()},set description(D){s(D),b()},get trailing(){return i()},set trailing(D){i(D),b()},get selected(){return o()},set selected(D=!1){o(D),b()},get disabled(){return a()},set disabled(D=!1){a(D),b()},get class(){return c()},set class(D){c(D),b()},$set:Lt,$on:(D,I)=>Ot(e,D,I)},f=H_();da(f,D=>({type:"button",...u,disabled:a(),"data-slot":"menu-action-row","data-selected":o()?"":void 0,class:D}),[()=>Mr(dh(),"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=ne(f);{var p=D=>{var I=B_(),E=ne(I);Un(E,t),Q(I),x(D,I)};K(h,D=>{t()&&D(p)})}var g=A(h,2),v=ne(g),m=ne(v);Un(m,r),Q(v);var C=A(v,2);{var $=D=>{var I=z_(),E=ne(I);Un(E,s),Q(I),N(()=>at(I,1,`min-w-0 break-words ${d_}`)),x(D,I)};K(C,D=>{s()&&D($)})}Q(g);var M=A(g,2);{var S=D=>{var I=F_(),E=ne(I);Un(E,i),Q(I),x(D,I)};K(M,D=>{i()&&D(S)})}return Q(f),x(n,f),Pt(d)}const Ku=Lv;var U_=new Set(["$$slots","$$events","$$legacy","value","class","children"]);function $v(n,e){if(new.target)return It({component:$v,...n});Rt(e,!0);let t=y(e,"value",7),r=y(e,"class",7),s=y(e,"children",7),i=Ei(e,U_);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:Lt,$on:(u,d)=>Ot(e,u,d)},a=Ye(),c=ae(a);{let u=w(()=>Mr("mt-3",r()));xt(c,()=>Ov,(d,f)=>{f(d,ks({get value(){return t()},get class(){return l(u)}},()=>i,{children:(h,p)=>{var g=Ye(),v=ae(g);Un(v,()=>s()??Or),x(h,g)},$$slots:{default:!0}}))})}return x(n,a),Pt(o)}var V_=B('<img loading="lazy"/>');function Bv(n,e){if(new.target)return It({component:Bv,...n});Rt(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=he(!1);const u=w(()=>r()||`https://github.com/${encodeURIComponent(t())}.png?size=${s()*2}`);Jw(()=>{t(),l(u),k(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:Lt,$on:(v,m)=>Ot(e,v,m)},f=Ye(),h=ae(f);{var p=v=>{var m=Ye(),C=ae(m);Un(C,()=>a()??Or),x(v,m)},g=v=>{var m=V_();N(()=>{ot(m,"src",l(u)),ot(m,"width",s()),ot(m,"height",s()),ot(m,"alt",o()??""),ot(m,"aria-hidden",o()===void 0?"true":void 0),at(m,1,Bn(i()))}),To("error",m,()=>{k(c,!0)}),tf(m),x(v,m)};K(h,v=>{l(c)?v(p):v(g,-1)})}return x(n,f),Pt(d)}var W_=new Set(["$$slots","$$events","$$legacy","children"]),j_=Qi('<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>'),K_=Qi('<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),G_=Qi('<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>'),q_=Qi('<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>'),J_=Qi('<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>'),X_=Qi('<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>'),Y_=Qi('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function zv(n,e){if(new.target)return It({component:zv,...n});Rt(e,!0);const t=Vx();let r=y(e,"children",7),s=Ei(e,W_),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(I){let{weight:E,color:L,size:ee,mirrored:U,...ie}=I;return ie}var d={get children(){return r()},set children(I){r(I),b()},$set:Lt,$on:(I,E)=>Ot(e,I,E)},f=Y_();da(f,(I,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",...I,...E}),[()=>u(t),()=>u(s)]);var h=ne(f);{var p=I=>{var E=Ye(),L=ae(E);Un(L,r),x(I,E)};K(h,I=>{r()&&I(p)})}var g=A(h,2);{var v=I=>{var E=j_();x(I,E)},m=I=>{var E=K_();$t(),x(I,E)},C=I=>{var E=G_();x(I,E)},$=I=>{var E=q_();x(I,E)},M=I=>{var E=J_();x(I,E)},S=I=>{var E=X_();x(I,E)},D=I=>{var E=zt();E.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),x(I,E)};K(g,I=>{l(i)==="bold"?I(v):l(i)==="duotone"?I(m,1):l(i)==="fill"?I(C,2):l(i)==="light"?I($,3):l(i)==="regular"?I(M,4):l(i)==="thin"?I(S,5):I(D,-1)})}return Q(f),x(n,f),Pt(d)}function Zo(n,e){if(new.target)return It({component:Zo,...n});Rt(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:Lt,$on:(i,o)=>Ot(e,i,o)};return zv(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Pt(s)}function ph(n,e){if(new.target)return It({component:ph,...n});Rt(e,!0);const t=g=>{var v=Ye(),m=ae(v);{var C=S=>{rt(S,{get icon(){return ti},get size(){return a()},class:"shrink-0 text-muted-foreground"})},$=S=>{{let D=w(()=>s()==="github"?Qf:Zf);rt(S,{get icon(){return l(D)},get size(){return a()},class:"shrink-0 text-muted-foreground"})}},M=S=>{Zo(S,{get size(){return a()},class:"shrink-0 text-muted-foreground"})};K(m,S=>{o()?S(C):s()?S($,1):S(M,-1)})}x(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:Lt,$on:(g,v)=>Ot(e,g,v)},u=Ye(),d=ae(u);{var f=g=>{Bv(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()??"");Tv(g,{get avatarUrl(){return i()},get label(){return l(v)},get size(){return a()},referrerpolicy:"no-referrer"})}},p=g=>{t(g)};K(d,g=>{r()&&s()==="github"?g(f):i()?g(h,1):g(p,-1)})}return x(n,u),Pt(c)}var Q_=Qi('<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 gh(n,e){if(new.target)return It({component:gh,...n});Rt(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:Lt,$on:(o,a)=>Ot(e,o,a)},i=Q_();return N(()=>{ot(i,"width",t()),ot(i,"height",t()),at(i,0,Bn(r()))}),x(n,i),Pt(s)}function Z_(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 eS=B('<span class="agent-avatar-unread-dot svelte-v6mebl" data-avatar-unread-dot=""></span>'),tS=B('<span role="img" data-agent-avatar-with-state="" data-agent-avatar-surface=""><!> <!></span>');function Fv(n,e){if(new.target)return It({component:Fv,...n});Rt(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,Up),a=y(e,"size",7,void 0),c=y(e,"state",7,"idle"),u=y(e,"class",7,"");const d=w(()=>Z_(c())),f=w(()=>a()??Wk[o()].surface),h=w(()=>a()===void 0);var p={get agentId(){return t()},set agentId(M){t(M),b()},get specialist(){return r()},set specialist(M=null){r(M),b()},get icon(){return s()},set icon(M=null){s(M),b()},get provider(){return i()},set provider(M=void 0){i(M),b()},get variant(){return o()},set variant(M=Up){o(M),b()},get size(){return a()},set size(M=void 0){a(M),b()},get state(){return c()},set state(M="idle"){c(M),b()},get class(){return u()},set class(M=""){u(M),b()},$set:Lt,$on:(M,S)=>Ot(e,M,S)},g=tS();let v;var m=ne(g);Vk(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 C=A(m,2);{var $=M=>{var S=eS();x(M,S)};K(C,M=>{c()==="unread"&&M($)})}return Q(g),N(()=>{at(g,1,`agent-avatar-with-state agent-avatar-with-state--${c()??""} ${u()??""}`,"svelte-v6mebl"),ot(g,"aria-label",l(d)),ot(g,"title",l(d)),ot(g,"data-avatar-state",c()),ot(g,"data-avatar-variant",l(h)?o():void 0),v=Xi(g,"",v,{width:l(h)?void 0:`${l(f)}px`,height:l(h)?void 0:`${l(f)}px`})}),x(n,g),Pt(p)}function ff(n){return Qw(n)}function nS(n){return Zw(n)}function Gp(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&&!ff(n)?"completed":i||n.status===Bc.Error||n.status==="failed"?"failed":o?"question":a?"needs-permission":c==="discussion"?"attention-discussion":c==="blocker"?"attention-blocker":nS(n)?"waiting":ff(n)?"running":t&&!r?"unread":"idle"}function rS(n,e={}){if(!n)return Gp({},e);const t=xk(n),r=n.status===Bc.Completed||String(n.status).toLowerCase()==="completed",s=n.status===Bc.Error||n.status===Bc.Deleted||String(n.status).toLowerCase()==="failed";return Gp(iv(n),{...e,hasQuestion:f_(n)||e.hasQuestion===!0,hasUnread:e.hasUnread??n.hasUnread,isCompleted:e.isCompleted??r,isFailed:e.isFailed??s,attentionKind:e.attentionKind??t?.kind??null})}function Z3(n){return n?ff(iv(n)):!1}function sS(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=ws(n.ciStatus.total);if(n.ciStatus.failed>0){const i=ws(n.ciStatus.failed);e.push(n.ciStatus.pending>0?_.workspace_prStatus_checksFailingRunning_tooltip({failed:i,total:s,pending:ws(n.ciStatus.pending)}):_.workspace_prStatus_checksFailing_tooltip({failed:i,total:s}))}else n.ciStatus.pending>0?e.push(_.workspace_prStatus_checksRunning_tooltip({pending:ws(n.ciStatus.pending),total:s})):t.push(_.workspace_prStatus_checksPassing_tooltip({passed:ws(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=ws(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
- `):""}const iS={queued:0,draft:1,open:2,merged:3,closed:4};function Hv(n,e){return n?`${n}#${e}`:String(e)}function Ed(n,e){return Hv(n?.toLowerCase(),e)}function oS(n,e){return n&&e?e.localeCompare(n):n?-1:e?1:0}function aS(n,e){return n==="merged"?{statusIcon:y1,foregroundClass:"text-purple-500",backgroundClass:"bg-purple-500/10",accessibleStateLabel:_.workspace_prSection_merged_label()}:n==="closed"?{statusIcon:_d,foregroundClass:"text-danger",backgroundClass:"bg-danger-background/10",accessibleStateLabel:_.workspace_prSection_closed_label()}:n==="draft"?{statusIcon:_d,foregroundClass:"text-muted-foreground",backgroundClass:"bg-muted",accessibleStateLabel:_.workspace_prSection_statusDraft_label()}:{statusIcon:_d,foregroundClass:"text-success",backgroundClass:"bg-success/10",accessibleStateLabel:e?_.workspace_prSection_statusQueued_label():_.workspace_prSection_statusOpen_label()}}function eB({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=>[Ed(fx(h.url)??r,h.number),h])),u=hx(px(a,e,s,i,r),t,r),d=new Map;for(const h of u){const p=h.monitorIdentity??Ed(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=Ed(p,h.number),v=h.resource?void 0:c.get(g),m=v?.isDraft?"draft":h.status,C=gx({...h,status:m});return{pr:h,repo:p,identity:g,source:v,status:m,queued:C,rank:iS[C?"queued":m]}}).sort((h,p)=>h.rank-p.rank||oS(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 C=h.monitorSnapshot?"":sS(g);return{identity:h.monitorIdentity??Hv(p,h.number),resource:h.resource,monitorAvailability:h.monitorAvailability,numberLabel:e1(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,...aS(v,m),details:[mx({...h,status:v}),C].filter(Boolean).join(`
4
- `),monitorAgentId:h.monitorAgentId,monitorOnly:h.monitorOnly===!0}})}function lS(n){return"type"in n&&n.type==="separator"}function tB(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 hf(n,e,t=""){let r=0;const s=[];for(const[o,a]of n.entries()){if(lS(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}]:[],...hf(d)]})}else s.push({...c,kind:"submenu",children:hf(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 Uv(n,e){for(const t of n){if("type"in t)continue;if(t.id===e)return t;const r=t.submenu?Uv(t.submenu,e):void 0;if(r)return r}}function cS(n,e){if(new.target)return It({component:cS,...n});Rt(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,()=>Ep()),a=y(e,"returnFocus",7),c=y(e,"selection",7);const u=w(()=>hf(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=Ep()){o(f),b()},get returnFocus(){return a()},set returnFocus(f){a(f),b()},get selection(){return c()},set selection(f){c(f),b()},$set:Lt,$on:(f,h)=>Ot(e,f,h)};{let f=w(()=>({x:t(),y:r(),returnFocus:a()}));ik(n,{get actions(){return l(u)},get ariaLabel(){return o()},get contextMenu(){return l(f)},onAction:h=>Uv(s(),h)?.onClick(),onOpenChange:h=>{h||i()?.()}})}return Pt(d)}function uS(){try{return At.state.userPreferences?.shortcutOverrides??{}}catch{return{}}}function Xc(n){return Pv(n,uS())}function nB(n){if(typeof At.getReadableState!="function")return Tp(Xc(n));try{return Xw(At.getReadableState(),e=>Pv(n,e.userPreferences?.shortcutOverrides??{}))}catch{return Tp(Xc(n))}}function dS(n,e){return n?.isExternalLink===!0&&typeof n.workspaceId=="string"&&n.workspaceId?n.workspaceId:e||void 0}function Vv(n,e,t){const r=n.label||n.id||"mention";if(n.type==="member")return Xf(r);if(n.type==="note"&&n.id&&t){const s=dS(n.meta,e),i=s?t(s,n.id)?.trim():void 0;if(i)return i}return r}function rB(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=Vv({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 fS=(n,e)=>{let t;try{t=g_().state}catch{return}const r=t?.workspaceNotes?.byWorkspaceId?.[n]?.notes;return r?kk(r,e)?.title:void 0};var hS=B('<p class="mt-2 max-w-[90vw] rounded-md bg-black/60 px-3 py-1.5 text-center text-sm text-white"> </p>'),pS=B('<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 mh(n,e){if(new.target)return It({component:mh,...n});Rt(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=_v(),p=mk(m);let g=he(null),v=he(null);function m(){t()&&(t(!1),i()?.(),o()?.isConnected&&o().focus({preventScroll:!0}))}function C(E){(E.target instanceof Element?E.target:null)?.closest('[data-media-lightbox-content], [role="toolbar"], button, input')||m()}function $(E){if(d()?.(E),E.defaultPrevented||E.key!=="Tab"||!l(g))return;const L=Array.from(l(g).querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),ee=L[0],U=L[L.length-1];!ee||!U||(E.shiftKey&&document.activeElement===ee?(E.preventDefault(),U.focus()):!E.shiftKey&&document.activeElement===U&&(E.preventDefault(),ee.focus()))}ut(()=>{if(t())return fa(m)}),ut(()=>{!t()||!l(v)||requestAnimationFrame(()=>l(v)?.focus())});var M={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:Lt,$on:(E,L)=>Ot(e,E,L)},S=Ye(),D=ae(S);{var I=E=>{{let L=w(()=>h?.target()??"body");ok(E,{get target(){return l(L)},zIndex:1e3,children:(ee,U)=>{var ie=pS(),F=ne(ie),W=ne(F);{var Y=z=>{var le=Ye(),ge=ae(le);Un(ge,c),x(z,le)};K(W,z=>{c()&&z(Y)})}var ce=A(W,2);Je(ce,{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(z){k(v,z,!0)},children:(z,le)=>{rt(z,{get icon(){return Ji},size:"lg"})},$$slots:{default:!0}}),Q(F),Fl(F,z=>p?.(z));var pe=A(F,2),j=ne(pe);Un(j,a),Q(pe),Fl(pe,z=>p?.(z));var ue=A(pe,2);{var P=z=>{var le=hS(),ge=re(le,!0);N(()=>H(ge,u())),x(z,le)};K(ue,z=>{u()&&z(P)})}Q(ie),jn(ie,z=>k(g,z),()=>l(g)),N(()=>ot(ie,"aria-label",r())),Qr("click",ie,C),Qr("keydown",ie,$),To("copy",ie,function(...z){f()?.apply(this,z)}),Ps(3,ie,()=>d1,()=>({tier:"moderate"})),x(ee,ie)},$$slots:{default:!0}})}};K(D,E=>{t()&&E(I)})}return x(n,S),Pt(M)}Ro(["click","keydown"]);function Gu(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 Wv(n){try{return new URL(n).protocol==="https:"}catch{return!1}}function pf(n){const e=/^data:([^;,]+);base64,(.*)$/s.exec(n);return e?{mimeType:e[1],base64:e[2]}:null}function gf(n){return Wv(n)||Gu(n)!==null||/^workspace-asset:\/\/[^/?#]+/.test(n)||/^data:image\/[a-z0-9.+-]+(?:;[^,]*)?,/i.test(n)}function jv(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 gS(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 mS={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};function vS(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&&mS[t]||"png";return`${e}.${r}`}var bS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-dimensions"> </div>'),yS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-size"> </div>'),wS=B("<!> <!> <!>",1),xS=B("<!> <!> <!> <!>",1),kS=B("<!> <!>",1);function Kv(n,e){if(new.target)return It({component:Kv,...n});Rt(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(()=>pf(t())),c=w(()=>Gu(t())),u=w(()=>Wv(t()));let d=he(null),f=he(null),h=null;function p(){if(h===t())return;const U=h=t();k(d,null),k(f,l(a)?jv(l(a).base64):null,!0);const ie=new Image;ie.onload=()=>{h===U&&k(d,{width:ie.naturalWidth,height:ie.naturalHeight},!0)},ie.src=t(),l(a)||fetch(t()).then(F=>F.ok?F.blob():null).then(F=>{F&&h===U&&k(f,F.size,!0)}).catch(()=>{})}ut(()=>{s()&&p()}),ut(()=>{if(s())return fa(()=>{s(!1)})});async function g(U=t()){const ie=pf(U);if(ie)return gS(ie.base64,ie.mimeType);const F=await fetch(U);if(!F.ok)throw new Error(`Image fetch failed: ${F.status}`);return await F.blob()}async function v(){let U=null;try{let ie=t(),F=l(a)?.mimeType;if(!l(a)){const Y=await g();F=Y.type,U=URL.createObjectURL(Y),ie=U}const W=document.createElement("a");W.href=ie,W.download=vS({workspacePath:l(c)?.path,imageName:r(),mimeType:F}),document.body.appendChild(W);try{W.click()}finally{W.remove()}}catch{Rs.error(_.ui_imageActionsMenu_downloadFailed_error())}finally{U&&URL.revokeObjectURL(U)}}async function m(){if(l(c))try{await Jc(l(c).path),Rs.success(_.ui_imageActionsMenu_pathCopied_label())}catch{Rs.error(_.ui_imageActionsMenu_copyFailed_error())}}async function C(){if(l(u))try{await Jc(t()),Rs.success(_.ui_imageActionsMenu_linkCopied_label())}catch{Rs.error(_.ui_imageActionsMenu_copyFailed_error())}}async function $(U){let ie,F;try{let W;if(U.type.split(";")[0].trim()==="image/svg+xml"){F=URL.createObjectURL(U);const pe=new Image;pe.src=F,await pe.decode(),W=pe}else W=ie=await createImageBitmap(U);const Y=document.createElement("canvas");Y.width=W instanceof HTMLImageElement?W.naturalWidth:W.width,Y.height=W instanceof HTMLImageElement?W.naturalHeight:W.height;const ce=Y.getContext("2d");if(!ce)throw new Error("2d canvas context unavailable");return ce.drawImage(W,0,0),await new Promise((pe,j)=>{Y.toBlob(ue=>ue?pe(ue):j(new Error("canvas toBlob failed")),"image/png")})}finally{ie?.close(),F&&URL.revokeObjectURL(F)}}async function M(U=t()){try{let ie=await g(U);ie.type!=="image/png"&&(ie=await $(ie)),await navigator.clipboard.write([new ClipboardItem({"image/png":ie})]),Rs.success(_.ui_imageActionsMenu_imageCopied_label())}catch{Rs.error(_.ui_imageActionsMenu_copyFailed_error())}}function S(U,ie=t()){return U.defaultPrevented||!gf(ie)||U instanceof KeyboardEvent&&(U.key.toLowerCase()!=="c"||!(U.metaKey||U.ctrlKey)||U.altKey||U.shiftKey||U.isComposing)||Sv(U.target)||document.getSelection()?.toString()?!1:(U.preventDefault(),U.stopPropagation(),U instanceof KeyboardEvent&&U.repeat||(M(ie),s(!1)),!0)}var D={handleCopy:S,get imageUrl(){return t()},set imageUrl(U){t(U),b()},get imageName(){return r()},set imageName(U){r(U),b()},get open(){return s()},set open(U=!1){s(U),b()},get triggerClass(){return i()},set triggerClass(U){i(U),b()},get contentClass(){return o()},set contentClass(U){o(U),b()},$set:Lt,$on:(U,ie)=>Ot(e,U,ie)},I=Ye(),E=ae(I);{var L=U=>{var ie=Ye(),F=ae(ie);xt(F,()=>oh,(W,Y)=>{Y(W,{get open(){return s()},set open(ce){s(ce)},children:(ce,pe)=>{var j=kS(),ue=ae(j);{const z=(ge,ye)=>{let Z=()=>(ye?.()).props;{let oe=w(()=>_.ui_imageActionsMenu_trigger_ariaLabel());Je(ge,ks(Z,{variant:"plain",size:"icon-sm",wrapContent:!1,get active(){return s()},get"aria-label"(){return l(oe)},children:(V,G)=>{wv(V,{class:"size-3.5"})},$$slots:{default:!0}}))}};let le=w(()=>Mr("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",i()));xt(ue,()=>sh,(ge,ye)=>{ye(ge,{get class(){return l(le)},onclick:Z=>Z.stopPropagation(),onkeydown:Z=>S(Z),oncopy:Z=>S(Z),child:z,$$slots:{child:!0}})})}var P=A(ue,2);xt(P,()=>ih,(z,le)=>{le(z,{get class(){return o()},align:"end",onkeydown:ge=>S(ge),oncopy:ge=>S(ge),children:(ge,ye)=>{var Z=xS(),oe=ae(Z);xt(oe,()=>Ko,(fe,ke)=>{ke(fe,{onSelect:()=>void v(),children:(be,J)=>{$t();var Me=zt();N(Be=>H(Me,Be),[()=>_.ui_imageActionsMenu_download_label()]),x(be,Me)},$$slots:{default:!0}})});var V=A(oe,2);xt(V,()=>Ko,(fe,ke)=>{ke(fe,{onSelect:()=>void M(),children:(be,J)=>{$t();var Me=zt();N(Be=>H(Me,Be),[()=>_.ui_imageActionsMenu_copyImage_label()]),x(be,Me)},$$slots:{default:!0}})});var G=A(V,2);{var O=fe=>{var ke=Ye(),be=ae(ke);xt(be,()=>Ko,(J,Me)=>{Me(J,{onSelect:()=>void m(),children:(Be,gt)=>{$t();var Ie=zt();N($e=>H(Ie,$e),[()=>_.ui_imageActionsMenu_copyPath_label()]),x(Be,Ie)},$$slots:{default:!0}})}),x(fe,ke)},te=fe=>{var ke=Ye(),be=ae(ke);xt(be,()=>Ko,(J,Me)=>{Me(J,{onSelect:()=>void C(),children:(Be,gt)=>{$t();var Ie=zt();N($e=>H(Ie,$e),[()=>_.ui_imageActionsMenu_copyLink_label()]),x(Be,Ie)},$$slots:{default:!0}})}),x(fe,ke)};K(G,fe=>{l(c)?fe(O):l(u)&&fe(te,1)})}var ve=A(G,2);{var de=fe=>{var ke=wS(),be=ae(ke);xt(be,()=>xv,(Ie,$e)=>{$e(Ie,{})});var J=A(be,2);{var Me=Ie=>{var $e=bS(),ze=re($e,!0);N(vt=>H(ze,vt),[()=>_.ui_imageActionsMenu_dimensions_label({width:ws(l(d).width),height:ws(l(d).height)})]),x(Ie,$e)};K(J,Ie=>{l(d)&&Ie(Me)})}var Be=A(J,2);{var gt=Ie=>{var $e=yS(),ze=re($e,!0);N(vt=>H(ze,vt),[()=>ov(l(f))]),x(Ie,$e)};K(Be,Ie=>{l(f)!==null&&Ie(gt)})}x(fe,ke)};K(ve,fe=>{(l(d)||l(f)!==null)&&fe(de)})}x(ge,Z)},$$slots:{default:!0}})}),x(ce,j)},$$slots:{default:!0}})}),x(U,ie)},ee=w(()=>gf(t()));K(E,U=>{l(ee)&&U(L)})}return x(n,I),Pt(D)}var _S=B('<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 Gv(n,e){if(new.target)return It({component:Gv,...n});Rt(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=he(1),f=he(0),h=he(0),p=he(!1),g=he(null);ut(()=>{i()?.(l(d))});let v=null,m=0,C=0,$=0,M=!1;const S=w(()=>av(l(d),{style:"percent",maximumFractionDigits:0}));function D(O){return Math.min(s(),Math.max(r(),O))}function I(O,te,ve){const de=D(ve),fe=l(g)?.getBoundingClientRect(),ke=fe?O-fe.left:0,be=fe?te-fe.top:0;k(f,ke-(ke-l(f))/l(d)*de),k(h,be-(be-l(h))/l(d)*de),k(d,de,!0)}function E(O){const te=l(g)?.getBoundingClientRect();te?I(te.left+te.width/2,te.top+te.height/2,O):k(d,D(O),!0)}function L(){k(d,1),k(f,0),k(h,0)}function ee(O){O.preventDefault();const te=O.ctrlKey?c:a;I(O.clientX,O.clientY,l(d)*Math.exp(-O.deltaY*te))}ut(()=>{const O=l(g);if(O)return O.addEventListener("wheel",ee,{passive:!1}),()=>O.removeEventListener("wheel",ee)});function U(O){if(O.metaKey||O.ctrlKey||O.altKey)return!1;if(O.key==="+"||O.key==="=")E(l(d)*o);else if(O.key==="-")E(l(d)/o);else if(O.key==="0")L();else return!1;return O.preventDefault(),!0}function ie(O){if(O.button>0)return;k(p,!0),v=O.pointerId,m=O.clientX,C=O.clientY,$=0;const te=O.currentTarget;typeof te.setPointerCapture=="function"&&te.setPointerCapture(O.pointerId)}function F(O){if(!l(p)||O.pointerId!==v)return;const te=O.clientX-m,ve=O.clientY-C;$+=Math.abs(te)+Math.abs(ve),k(f,l(f)+te),k(h,l(h)+ve),m=O.clientX,C=O.clientY}function W(O){if(!l(p)||O.pointerId!==v)return;k(p,!1),v=null,$>u&&(M=!0);const te=O.currentTarget;typeof te.hasPointerCapture=="function"&&typeof te.releasePointerCapture=="function"&&te.hasPointerCapture(O.pointerId)&&te.releasePointerCapture(O.pointerId)}function Y(O){M&&(M=!1,O.preventDefault(),O.stopPropagation())}function ce(O){const te=Number.parseFloat(O.currentTarget.value);Number.isFinite(te)&&E(te)}var pe={handleKeydown:U,get children(){return t()},set children(O){t(O),b()},get minZoom(){return r()},set minZoom(O=.25){r(O),b()},get maxZoom(){return s()},set maxZoom(O=8){s(O),b()},get onScaleChange(){return i()},set onScaleChange(O){i(O),b()},$set:Lt,$on:(O,te)=>Ot(e,O,te)},j=_S(),ue=ne(j),P=ne(ue);Un(P,t),Q(ue);var z=A(ue,2),le=ne(z);{let O=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel());Je(le,{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(O)},get title(){return l(te)},children:(ve,de)=>{rt(ve,{get icon(){return w1}})},$$slots:{default:!0}})}var ge=A(le,2),ye=ne(ge);{let O=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel());ak(ye,{class:"accent-white",get min(){return r()},get max(){return s()},step:"0.01",get value(){return l(d)},oninput:ce,get"aria-label"(){return l(O)},get title(){return l(te)},"data-testid":"zoom-pan-slider"})}Q(ge);var Z=A(ge,2);{let O=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel());Je(Z,{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(O)},get title(){return l(te)},children:(ve,de)=>{rt(ve,{get icon(){return x1}})},$$slots:{default:!0}})}var oe=A(Z,2),V=re(oe,!0),G=A(oe,2);{let O=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel());Je(G,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:L,get"aria-label"(){return l(O)},get title(){return l(te)},children:(ve,de)=>{rt(ve,{get icon(){return k1}})},$$slots:{default:!0}})}return Q(z),Q(j),jn(j,O=>k(g,O),()=>l(g)),N((O,te)=>{at(j,1,`relative h-full w-full touch-none select-none overflow-hidden ${l(p)?"cursor-grabbing":"cursor-grab"}`),ot(j,"aria-label",O),Xi(ue,`transform: translate(${l(f)??""}px, ${l(h)??""}px) scale(${l(d)??""}); transform-origin: 0 0;`),ot(z,"aria-label",te),H(V,l(S))},[()=>_.ui_zoomPanViewport_viewport_ariaLabel(),()=>_.ui_zoomPanViewport_controls_ariaLabel()]),Qr("pointerdown",j,ie),Qr("pointermove",j,F),Qr("pointerup",j,W),To("pointercancel",j,W),To("click",j,Y,!0),Qr("keydown",j,U),Qr("pointerdown",z,O=>O.stopPropagation()),x(n,j),Pt(pe)}Ro(["pointerdown","pointermove","pointerup","keydown"]);var SS=B('<img class="max-h-[90vh] max-w-[90vw] rounded-lg object-contain" draggable="false" data-media-lightbox-content=""/>');function qv(n,e){if(new.target)return It({component:qv,...n});Rt(e,!0);const t=m=>{var C=Ye(),$=ae(C);{var M=S=>{jn(Kv(S,{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(D){k(f,D,!0)}}),D=>k(d,D,!0),()=>l(d))};K($,S=>{c()&&S(M)})}x(m,C)};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=he(void 0),d=he(void 0),f=he(!1);ut(()=>{r()||k(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()||!gf(s())||(m.preventDefault(),m.stopPropagation(),k(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:Lt,$on:(m,C)=>Ot(e,m,C)};{let m=w(()=>_.ui_imageLightbox_preview_ariaLabel()),C=w(()=>_.ui_imageLightbox_close_ariaLabel());mh(n,{get ariaLabel(){return l(m)},get closeLabel(){return l(C)},get onClose(){return o()},get openerElement(){return a()},get actions(){return t},onKeydown:h,onCopy:p,get open(){return r()},set open($){r($)},children:($,M)=>{var S=Ye(),D=ae(S);fh(D,s,I=>{jn(Gv(I,{children:(E,L)=>{var ee=SS();N(()=>{ot(ee,"src",s()),ot(ee,"alt",i())}),Qr("contextmenu",ee,g),x(E,ee)},$$slots:{default:!0}}),E=>k(u,E,!0),()=>l(u))}),x($,S)},$$slots:{default:!0}})}return Pt(v)}Ro(["contextmenu"]);var CS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-duration"> </div>'),MS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-dimensions"> </div>'),TS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-size"> </div>'),ES=B("<!> <!> <!> <!>",1),AS=B("<!> <!> <!>",1),RS=B("<!> <!>",1);function Yc(n,e){if(new.target)return It({component:Yc,...n});Rt(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(()=>pf(t())),d=w(()=>Gu(t())),f=w(()=>s()??(l(u)?"inline":l(d)?"workspace":"remote"));let h=he(null),p=he(null),g=he(null),v=null;function m(){if(v===t())return;const E=v=t();k(h,null),k(p,null),k(g,l(u)?jv(l(u).base64):null,!0);const L=document.createElement("video");L.preload="metadata",L.onloadedmetadata=()=>{v===E&&(Number.isFinite(L.duration)&&L.duration>0&&k(h,L.duration,!0),L.videoWidth>0&&L.videoHeight>0&&k(p,{width:L.videoWidth,height:L.videoHeight},!0))},L.src=t(),l(u)||fetch(t()).then(ee=>ee.ok?ee.blob():null).then(ee=>{ee&&v===E&&k(g,ee.size,!0)}).catch(()=>{})}function C(){const E=l(d)?.path.split("/").pop();if(E)return E;const L=(r()||"video").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(L))return L;const ee=(i()??l(u)?.mimeType)==="video/webm"?"webm":"mp4";return`${L}.${ee}`}async function $(){let E=null;try{let L=t();if(!l(u)){const U=await fetch(t());if(!U.ok)throw new Error(`Video fetch failed: ${U.status}`);E=URL.createObjectURL(await U.blob()),L=E}const ee=document.createElement("a");ee.href=L,ee.download=C(),document.body.appendChild(ee),ee.click(),ee.remove(),E&&URL.revokeObjectURL(E)}catch{E&&URL.revokeObjectURL(E),Rs.error(_.ui_videoActionsMenu_downloadFailed_error())}}async function M(E,L){try{await Jc(E),Rs.success(L)}catch{Rs.error(_.ui_videoActionsMenu_copyFailed_error())}}ut(()=>{o()&&m()}),ut(()=>{if(o())return fa(()=>{o(!1)})});var S={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:Lt,$on:(E,L)=>Ot(e,E,L)},D=Ye(),I=ae(D);return xt(I,()=>oh,(E,L)=>{L(E,{get open(){return o()},set open(ee){o(ee)},children:(ee,U)=>{var ie=RS(),F=ae(ie);{let Y=w(()=>Mr("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",a())),ce=w(()=>_.ui_videoActionsMenu_trigger_ariaLabel());xt(F,()=>sh,(pe,j)=>{j(pe,{get class(){return l(Y)},get"aria-label"(){return l(ce)},onclick:ue=>ue.stopPropagation(),children:(ue,P)=>{wv(ue,{class:"size-3.5"})},$$slots:{default:!0}})})}var W=A(F,2);xt(W,()=>ih,(Y,ce)=>{ce(Y,{get class(){return c()},align:"end",children:(pe,j)=>{var ue=AS(),P=ae(ue);xt(P,()=>Ko,(oe,V)=>{V(oe,{onSelect:()=>void $(),children:(G,O)=>{$t();var te=zt();N(ve=>H(te,ve),[()=>_.ui_videoActionsMenu_download_label()]),x(G,te)},$$slots:{default:!0}})});var z=A(P,2);{var le=oe=>{var V=Ye(),G=ae(V);xt(G,()=>Ko,(O,te)=>{te(O,{onSelect:()=>void M(l(d).path,_.ui_videoActionsMenu_pathCopied_label()),children:(ve,de)=>{$t();var fe=zt();N(ke=>H(fe,ke),[()=>_.ui_videoActionsMenu_copyPath_label()]),x(ve,fe)},$$slots:{default:!0}})}),x(oe,V)},ge=oe=>{var V=Ye(),G=ae(V);xt(G,()=>Ko,(O,te)=>{te(O,{onSelect:()=>void M(t(),_.ui_videoActionsMenu_linkCopied_label()),children:(ve,de)=>{$t();var fe=zt();N(ke=>H(fe,ke),[()=>_.ui_videoActionsMenu_copyLink_label()]),x(ve,fe)},$$slots:{default:!0}})}),x(oe,V)};K(z,oe=>{l(f)==="workspace"&&l(d)?oe(le):l(f)==="remote"&&oe(ge,1)})}var ye=A(z,2);{var Z=oe=>{var V=ES(),G=ae(V);xt(G,()=>xv,(be,J)=>{J(be,{})});var O=A(G,2);{var te=be=>{var J=CS(),Me=re(J,!0);N(Be=>H(Me,Be),[()=>_.ui_videoActionsMenu_duration_label({duration:f1(l(h)*1e3)})]),x(be,J)};K(O,be=>{l(h)!==null&&be(te)})}var ve=A(O,2);{var de=be=>{var J=MS(),Me=re(J,!0);N(Be=>H(Me,Be),[()=>_.ui_videoActionsMenu_dimensions_label({width:ws(l(p).width),height:ws(l(p).height)})]),x(be,J)};K(ve,be=>{l(p)&&be(de)})}var fe=A(ve,2);{var ke=be=>{var J=TS(),Me=re(J,!0);N(Be=>H(Me,Be),[()=>ov(l(g))]),x(be,J)};K(fe,be=>{l(g)!==null&&be(ke)})}x(oe,V)};K(ye,oe=>{(l(h)!==null||l(p)||l(g)!==null)&&oe(Z)})}x(pe,ue)},$$slots:{default:!0}})}),x(ee,ie)},$$slots:{default:!0}})}),x(n,D),Pt(S)}var PS=B('<p class="type-body text-white/80" role="status"> </p>'),IS=B('<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 Jv(n,e){if(new.target)return It({component:Jv,...n});Rt(e,!0);const t=p=>{Yc(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=he(!1);ut(()=>{!r()||!s()||k(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:Lt,$on:(p,g)=>Ot(e,p,g)};{let p=w(()=>_.chat_videoBlock_dialog_title({name:i()})),g=w(()=>_.chat_videoBlock_close_ariaLabel());mh(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 C=IS(),$=ne(C),M=re($,!0),S=A($,2);{var D=I=>{var E=PS(),L=re(E,!0);N(ee=>H(L,ee),[()=>_.chat_videoBlock_unavailable_description()]),x(I,E)};K(S,I=>{l(f)&&I(D)})}Q(C),N(I=>{ot($,"src",s()),ot($,"poster",o()),ot($,"aria-label",i()),H(M,I)},[()=>_.chat_videoBlock_unsupported_description()]),To("error",$,()=>k(f,!0)),x(v,C)},$$slots:{default:!0}})}return Pt(h)}var LS=B('<span class="block truncate text-foreground"> </span>'),OS=B("<!> ",1),NS=B("<!> <!>",1),DS=B('<span class="flex shrink-0 flex-wrap items-center gap-1"><!> <!></span>'),$S=B('<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 Xv(n,e){if(new.target)return It({component:Xv,...n});Rt(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(L){L.preventDefault(),L.stopPropagation()}function u(L){c(L),o()?.()}async function d(L){if(c(L),!!s())try{await Jc(s()),Rs.success(_.ui_imageActionsMenu_pathCopied_label())}catch{Rs.error(_.ui_imageActionsMenu_copyFailed_error())}}function f(L){if(c(L),!s()||!i())return;const ee=s().split("/").map(encodeURIComponent).join("/");lh(`intent://local/file/${ee}`,{workspaceId:Cv(i())})}var h={get name(){return t()},set name(L){t(L),b()},get reason(){return r()},set reason(L){r(L),b()},get path(){return s()},set path(L){s(L),b()},get workspaceId(){return i()},set workspaceId(L){i(L),b()},get onRetry(){return o()},set onRetry(L){o(L),b()},$set:Lt,$on:(L,ee)=>Ot(e,L,ee)},p=$S(),g=ne(p),v=ne(g),m=ne(v);rt(m,{get icon(){return Gc},class:"size-3.5"}),Q(v);var C=A(v,2),$=ne(C);{var M=L=>{var ee=LS(),U=re(ee,!0);Fl(ee,(ie,F)=>uf?.(ie,F),t),N(()=>H(U,t())),x(L,ee)};K($,L=>{t()&&L(M)})}var S=A($,2),D=re(S,!0);Q(C),Q(g);var I=A(g,2);{var E=L=>{var ee=DS(),U=ne(ee);{var ie=Y=>{{let ce=w(()=>_.chat_shared_retry_label());Je(Y,{variant:"ghost",size:"icon-compact",get tooltip(){return l(ce)},onclick:u,children:(pe,j)=>{rt(pe,{get icon(){return eh},size:"xs"})},$$slots:{default:!0}})}};K(U,Y=>{o()&&Y(ie)})}var F=A(U,2);{var W=Y=>{var ce=NS(),pe=ae(ce);{var j=P=>{Je(P,{variant:"ghost",size:"compact",onclick:f,children:(z,le)=>{var ge=OS(),ye=ae(ge);rt(ye,{get icon(){return uv},size:"xs"});var Z=A(ye);N(oe=>H(Z,` ${oe??""}`),[()=>_.chat_changesPanel_openFile_tooltip()]),x(z,ge)},$$slots:{default:!0}})};K(pe,P=>{i()&&r()!=="other-workspace"&&r()!=="invalid-link"&&P(j)})}var ue=A(pe,2);{let P=w(()=>_.ui_imageActionsMenu_copyPath_label());Je(ue,{variant:"ghost",size:"icon-compact",get tooltip(){return l(P)},onclick:d,children:(z,le)=>{rt(z,{get icon(){return cv},size:"xs"})},$$slots:{default:!0}})}x(Y,ce)};K(F,Y=>{s()&&Y(W)})}Q(ee),x(L,ee)};K(I,L=>{(o()||s())&&L(E)})}return Q(p),N(()=>{ot(p,"data-reason",r()),H(D,l(a))}),x(n,p),Pt(h)}const sB=At.createSelector(n=>n.featureCodes.activeFeatures),BS=At.createSelector((n,e)=>n.featureCodes.activeFeatures.includes(e)),iB=At.createSelector(n=>n.featureCodes.activeFeatures.length>0),oB=At.createSelector(n=>n.featureCodes.dialogOpen);var zS=B("<span> </span>"),FS=B('<div role="search"><div><!> <!> <!></div> <div><!> <!> <!></div></div>');function HS(n,e){if(new.target)return It({component:HS,...n});Rt(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()),C=y(e,"showResultText",7,!0),$=y(e,"showResultWhenQueryEmpty",7,!1),M=y(e,"resultFormat",7,"slash"),S=y(e,"resultVariant",7,void 0),D=y(e,"searchAriaLabel",23,()=>_.ui_panelFindBar_search_ariaLabel()),I=y(e,"previousLabel",23,()=>_.ui_panelFindBar_previous_label()),E=y(e,"previousShortcutLabel",7,"Shift+Enter"),L=y(e,"previousKeyShortcuts",7,"Shift+Enter"),ee=y(e,"previousTitle",7,void 0),U=y(e,"nextLabel",23,()=>_.ui_panelFindBar_next_label()),ie=y(e,"nextShortcutLabel",7,"Enter"),F=y(e,"nextKeyShortcuts",7,"Enter"),W=y(e,"nextTitle",7,void 0),Y=y(e,"closeLabel",23,()=>_.ui_panelFindBar_close_label()),ce=y(e,"closeShortcutLabel",7,"Esc"),pe=y(e,"closeKeyShortcuts",7,"Escape"),j=y(e,"closeTitle",7,void 0),ue=y(e,"layout",7,"floating"),P=y(e,"class",7),z=y(e,"inputWrapperClass",7),le=y(e,"inputClass",7),ge=y(e,"actionsClass",7),ye=y(e,"onPrevious",7),Z=y(e,"onNext",7),oe=y(e,"onClose",7),V=y(e,"onQueryChange",7),G=y(e,"onInput",7),O=y(e,"onKeydown",7);const te=w(()=>t().trim().length>0),ve=w(()=>i()||a()||!l(te)||u()&&typeof g()=="number"&&g()<=0),de=w(()=>{if(v()!==void 0)return v();if(!C()||!l(te)&&!$()||typeof g()!="number")return null;if(g()<=0)return l(te)?m():null;const se=Math.min(Math.max(p()+1,1),g());return M()==="of"?_.ui_panelFindBar_matchOf_label({current:se,total:g()}):`${se} / ${g()}`}),fe=w(()=>S()??(typeof g()=="number"&&g()<=0&&l(te)?"destructive":"muted"));ut(()=>{(d()||h()!==void 0)&&r()&&!i()&&!o()&&(r().focus(),f()&&r().select())});function ke(){r()?.focus()}function be(){r()?.blur()}function J(){r()?.select()}function Me(se,Ze){return Ze?`${se} (${Ze})`:se}function Be(se){t(se.currentTarget.value),V()?.(t(),se),G()?.(se)}function gt(se){O()?.(se),!se.defaultPrevented&&(se.key==="Escape"&&oe()&&!c()&&!i()?(se.preventDefault(),oe()(se)):se.key==="Enter"&&!l(ve)&&(se.preventDefault(),se.shiftKey?ye()?.(t(),se):Z()?.(t(),se)))}var Ie={focus:ke,blur:be,select:J,get query(){return t()},set query(se=""){t(se),b()},get inputRef(){return r()},set inputRef(se=null){r(se),b()},get placeholder(){return s()},set placeholder(se=_.ui_panelFindBar_find_placeholder()){s(se),b()},get disabled(){return i()},set disabled(se=!1){i(se),b()},get inputDisabled(){return o()},set inputDisabled(se=!1){o(se),b()},get navigationDisabled(){return a()},set navigationDisabled(se=!1){a(se),b()},get closeDisabled(){return c()},set closeDisabled(se=!1){c(se),b()},get disableNavigationWhenNoMatches(){return u()},set disableNavigationWhenNoMatches(se=!0){u(se),b()},get autofocus(){return d()},set autofocus(se=!1){d(se),b()},get selectOnFocus(){return f()},set selectOnFocus(se=!0){f(se),b()},get focusTrigger(){return h()},set focusTrigger(se){h(se),b()},get currentMatchIndex(){return p()},set currentMatchIndex(se=0){p(se),b()},get totalMatches(){return g()},set totalMatches(se){g(se),b()},get resultText(){return v()},set resultText(se=void 0){v(se),b()},get emptyResultText(){return m()},set emptyResultText(se=_.ui_panelFindBar_noMatches_label()){m(se),b()},get showResultText(){return C()},set showResultText(se=!0){C(se),b()},get showResultWhenQueryEmpty(){return $()},set showResultWhenQueryEmpty(se=!1){$(se),b()},get resultFormat(){return M()},set resultFormat(se="slash"){M(se),b()},get resultVariant(){return S()},set resultVariant(se=void 0){S(se),b()},get searchAriaLabel(){return D()},set searchAriaLabel(se=_.ui_panelFindBar_search_ariaLabel()){D(se),b()},get previousLabel(){return I()},set previousLabel(se=_.ui_panelFindBar_previous_label()){I(se),b()},get previousShortcutLabel(){return E()},set previousShortcutLabel(se="Shift+Enter"){E(se),b()},get previousKeyShortcuts(){return L()},set previousKeyShortcuts(se="Shift+Enter"){L(se),b()},get previousTitle(){return ee()},set previousTitle(se=void 0){ee(se),b()},get nextLabel(){return U()},set nextLabel(se=_.ui_panelFindBar_next_label()){U(se),b()},get nextShortcutLabel(){return ie()},set nextShortcutLabel(se="Enter"){ie(se),b()},get nextKeyShortcuts(){return F()},set nextKeyShortcuts(se="Enter"){F(se),b()},get nextTitle(){return W()},set nextTitle(se=void 0){W(se),b()},get closeLabel(){return Y()},set closeLabel(se=_.ui_panelFindBar_close_label()){Y(se),b()},get closeShortcutLabel(){return ce()},set closeShortcutLabel(se="Esc"){ce(se),b()},get closeKeyShortcuts(){return pe()},set closeKeyShortcuts(se="Escape"){pe(se),b()},get closeTitle(){return j()},set closeTitle(se=void 0){j(se),b()},get layout(){return ue()},set layout(se="floating"){ue(se),b()},get class(){return P()},set class(se){P(se),b()},get inputWrapperClass(){return z()},set inputWrapperClass(se){z(se),b()},get inputClass(){return le()},set inputClass(se){le(se),b()},get actionsClass(){return ge()},set actionsClass(se){ge(se),b()},get onPrevious(){return ye()},set onPrevious(se){ye(se),b()},get onNext(){return Z()},set onNext(se){Z(se),b()},get onClose(){return oe()},set onClose(se){oe(se),b()},get onQueryChange(){return V()},set onQueryChange(se){V(se),b()},get onInput(){return G()},set onInput(se){G(se),b()},get onKeydown(){return O()},set onKeydown(se){O(se),b()},$set:Lt,$on:(se,Ze)=>Ot(e,se,Ze)},$e=FS(),ze=ne($e),vt=ne(ze);rt(vt,{get icon(){return _1},class:"size-3 shrink-0 text-muted-foreground"});var Vt=A(vt,2);{let se=w(()=>i()||o()),Ze=w(()=>Mr("h-6 w-36 border-0 bg-transparent px-0 py-0 text-sm shadow-none","placeholder:text-muted-foreground",le()));is(Vt,{type:"text",get placeholder(){return s()},get disabled(){return l(se)},noFocusStyle:!0,get class(){return l(Ze)},get"aria-label"(){return D()},oninput:Be,onkeydown:gt,get ref(){return r()},set ref(lt){r(lt)},get value(){return t()},set value(lt){t(lt)}})}var st=A(Vt,2);{var Ae=se=>{var Ze=zS(),lt=re(Ze,!0);N(et=>{at(Ze,1,et),H(lt,l(de))},[()=>Bn(Mr("whitespace-nowrap text-xs tabular-nums",l(fe)==="destructive"?"text-danger":"text-muted-foreground"))]),x(se,Ze)};K(st,se=>{l(de)&&se(Ae)})}Q(ze);var Ce=A(ze,2),we=ne(Ce);{let se=w(()=>ee()??Me(I(),E()));Je(we,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:Ze=>ye()?.(t(),Ze),get disabled(){return l(ve)},get"aria-label"(){return I()},get"aria-keyshortcuts"(){return L()},get title(){return l(se)},children:(Ze,lt)=>{rt(Ze,{get icon(){return S1},class:"size-3"})},$$slots:{default:!0}})}var Ue=A(we,2);{let se=w(()=>W()??Me(U(),ie()));Je(Ue,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:Ze=>Z()?.(t(),Ze),get disabled(){return l(ve)},get"aria-label"(){return U()},get"aria-keyshortcuts"(){return F()},get title(){return l(se)},children:(Ze,lt)=>{rt(Ze,{get icon(){return sa},class:"size-3"})},$$slots:{default:!0}})}var _t=A(Ue,2);{let se=w(()=>i()||c()),Ze=w(()=>j()??Me(Y(),ce()));Je(_t,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:lt=>oe()?.(lt),get disabled(){return l(se)},get"aria-label"(){return Y()},get"aria-keyshortcuts"(){return pe()},get title(){return l(Ze)},children:(lt,et)=>{rt(lt,{get icon(){return Ji},class:"size-3.5"})},$$slots:{default:!0}})}return Q(Ce),Q($e),N((se,Ze,lt)=>{ot($e,"aria-label",D()),at($e,1,se),at(ze,1,Ze),at(Ce,1,lt)},[()=>Bn(Mr("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",ue()==="floating"&&"absolute top-2 right-4 z-50",i()&&"pointer-events-none opacity-60",P())),()=>Bn(Mr("flex h-7 min-w-0 items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2",z())),()=>Bn(Mr("flex items-center gap-0.5",ge()))]),x(n,$e),Pt(Ie)}var qp=Object.defineProperty,US=(n,e)=>{let t={};for(var r in n)qp(t,r,{get:n[r],enumerable:!0});return qp(t,Symbol.toStringTag,{value:"Module"}),t};function Jr(n){this.content=n}Jr.prototype={constructor:Jr,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 Jr(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 Jr(t)},addToStart:function(n,e){return new Jr([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Jr(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 Jr(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=Jr.from(n),n.size?new Jr(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Jr.from(n),n.size?new Jr(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Jr.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}};Jr.from=function(n){if(n instanceof Jr)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Jr(e)};function Yv(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&&eb(o.charCodeAt(c-1))&&Zv(o.charCodeAt(c))&&t--,t}if(s.content.size||i.content.size){let o=Yv(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Qv(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&&eb(u.charCodeAt(f-1))&&Zv(u.charCodeAt(f))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let u=Qv(o.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}function Zv(n){return n>=56320&&n<57344}function eb(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 Yv(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Qv(this,e,t,r)}findIndex(e){if(e==0)return mc(0,e);if(e==this.size)return mc(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?mc(t+1,i):mc(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 Ad={index:0,offset:0};function mc(n,e){return Ad.index=n,Ad.offset=e,Ad}function Qc(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(!Qc(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Qc(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Pn=class mf{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&&Qc(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 mf.none;if(e instanceof mf)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};Pn.none=[];class Hl extends Error{}class We{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=nb(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new We(r,this.openStart,this.openEnd)}removeBetween(e,t){return new We(tb(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 We.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 We(_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 We(e,r,s)}}We.empty=new We(_e.empty,0,0);function tb(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(tb(i.content,e-s-1,t-s-1)))}function nb(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=nb(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 VS(n,e,t){if(t.openStart>n.depth)throw new Hl("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Hl("Inconsistent open depths");return rb(n,e,t,0)}function rb(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=rb(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 ta(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=WS(t,n);return ta(i,ib(n,o,a,e,r))}else return ta(i,Zc(n,e,r))}function sb(n,e){if(!e.type.compatibleContent(n.type))throw new Hl("Cannot join "+e.type.name+" onto "+n.type.name)}function vf(n,e,t){let r=n.node(t);return sb(r,e.node(t)),r}function ea(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 Tl(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&&(ea(n.nodeAfter,r),i++));for(let a=i;a<o;a++)ea(s.child(a),r);e&&e.depth==t&&e.textOffset&&ea(e.nodeBefore,r)}function ta(n,e){if(!n.type.validContent(e))throw new Hl("Invalid content for node "+n.type.name);return n.copy(e)}function ib(n,e,t,r,s){let i=n.depth>s&&vf(n,e,s+1),o=r.depth>s&&vf(t,r,s+1),a=[];return Tl(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(sb(i,o),ea(ta(i,ib(n,e,t,r,s+1)),a)):(i&&ea(ta(i,Zc(n,e,s+1)),a),Tl(e,t,s,a),o&&ea(ta(o,Zc(t,r,s+1)),a)),Tl(r,null,s,a),new _e(a)}function Zc(n,e,t){let r=[];if(Tl(null,n,t,r),n.depth>t){let s=vf(n,e,t+1);ea(ta(s,Zc(n,e,t+1)),r)}return Tl(e,null,t,r),new _e(r)}function WS(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 Ul{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 Pn.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 eu(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 Ul(t,r,i)}static resolveCached(e,t){let r=Jp.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 Jp.set(e,r=new jS);let s=r.elts[r.i]=Ul.resolve(e,t);return r.i=(r.i+1)%KS,s}}class jS{constructor(){this.elts=[],this.i=0}}const KS=12,Jp=new WeakMap;class eu{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 GS=Object.create(null);let wo=class bf{constructor(e,t,r,s=Pn.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&&Qc(this.attrs,t||e.defaultAttrs||GS)&&Pn.sameSet(this.marks,r||Pn.none)}copy(e=null){return e==this.content?this:new bf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new bf(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 We.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 We(u,s.depth-o,i.depth-o)}replace(e,t,r){return VS(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 Ul.resolveCached(this,e)}resolveNoCache(e){return Ul.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()+")"),ob(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),Xp(this.type.attrs,this.attrs,"node",this.type.name);let e=Pn.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];Xp(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Pn.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)}};wo.prototype.text=void 0;class tu extends wo{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):ob(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 tu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new tu(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 ob(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Xp(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 ia{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new qS(e,t);if(r.next==null)return ia.empty;let s=ab(r);r.next&&r.err("Unexpected trailing text");let i=tC(eC(s));return nC(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
- `)}}ia.empty=new ia(!0);class qS{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 ab(n){let e=[];do e.push(JS(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function JS(n){let e=[];do e.push(XS(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function XS(n){let e=ZS(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=YS(n,e);else break;return e}function Yp(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function YS(n,e){let t=Yp(n),r=t;return n.eat(",")&&(n.next!="}"?r=Yp(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function QS(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 ZS(n){if(n.eat("(")){let e=ab(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=QS(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 eC(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 lb(n,e){return e-n}function Qp(n,e){let t=[];return r(e),t.sort(lb);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 tC(n){let e=Object.create(null);return t(Qp(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]);Qp(n,c).forEach(d=>{u||s.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new ia(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(lb);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function nC(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 cb(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 ub(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 db(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new sC(n,r,e[r]);return t}let Zp=class fb{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=db(e,r.attrs),this.defaultAttrs=cb(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==ia.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:ub(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wo(this,this.computeAttrs(e),_e.from(t),Pn.setFrom(r))}createChecked(e=null,t,r){return t=_e.from(t),this.checkContent(t),new wo(this,this.computeAttrs(e),t,Pn.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 wo(this,e,t.append(i),Pn.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:Pn.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new fb(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 rC(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 sC{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?rC(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class qu{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=db(e,s.attrs),this.excluded=null;let i=cb(this.attrs);this.instance=i?new Pn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Pn(this,ub(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new qu(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 zc{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=Jr.from(e.nodes),t.marks=Jr.from(e.marks||{}),this.nodes=Zp.compile(this.spec.nodes,this),this.marks=qu.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]=ia.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?eg(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==""?[]:eg(this,o.split(" "))}this.nodeFromJSON=s=>wo.fromJSON(this,s),this.markFromJSON=s=>Pn.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 Zp){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 tu(r,r.defaultAttrs,e,Pn.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 eg(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 iC(n){return n.tag!=null}function oC(n){return n.style!=null}class xo{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(iC(s))this.tags.push(s);else if(oC(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 ng(this,t,!1);return r.addAll(e,Pn.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ng(this,t,!0);return r.addAll(e,Pn.none,t.from,t.to),We.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(cC(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=rg(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=rg(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xo(e,xo.schemaRules(e)))}}const hb={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},aC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},pb={ol:!0,ul:!0},Vl=1,yf=2,El=4;function tg(n,e,t){return e!=null?(e?Vl:0)|(e==="full"?yf:0):n&&n.whitespace=="pre"?Vl|yf:t&~El}class vc{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=Pn.none,this.match=i||(o&El?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&Vl)){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&&!hb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ng{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=tg(null,t.preserveWhitespace,0)|(r?El:0);s?i=new vc(s.type,s.attrs,Pn.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new vc(null,null,Pn.none,!0,null,o):i=new vc(e.schema.topNodeType,null,Pn.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&yf?"full":this.localPreserveWS||(s.options&Vl)>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
- `);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;pb.hasOwnProperty(o)&&this.parser.normalizeLists&&lC(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:aC.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(hb.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
- `),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=Pn.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):sg(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=tg(e,i,o.options);o.options&El&&o.content.length==0&&(a|=El);let c=Pn.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):sg(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new vc(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|=Vl)}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 lC(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&pb.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function cC(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function rg(n){let e={};for(let t in n)e[t]=n[t];return e}function sg(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 pa{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=bc(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 bc(t).createTextNode(e.text);let{dom:r,contentDOM:s}=Fc(bc(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&&Fc(bc(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return typeof t=="string"?{dom:e.createTextNode(t)}:Fc(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pa(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ig(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ig(e.marks)}}function ig(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function bc(n){return n.document||window.document}const og=new WeakMap;function uC(n){let e=og.get(n);return e===void 0&&og.set(n,e=dC(n)),e}function dC(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 Fc(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=uC(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}=Fc(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 gb=65535,mb=Math.pow(2,16);function fC(n,e){return n+e*mb}function ag(n){return n&gb}function hC(n){return(n-(n&gb))/mb}const vb=1,bb=2,Hc=4,yb=8;class wf{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&yb)>0}get deletedBefore(){return(this.delInfo&(vb|Hc))>0}get deletedAfter(){return(this.delInfo&(bb|Hc))>0}get deletedAcross(){return(this.delInfo&Hc)>0}}class Vs{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Vs.empty)return Vs.empty}recover(e){let t=0,r=ag(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+hC(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:fC(a/3,e-c),v=0;return u&&(v|=e==c?bb:e==f?vb:Hc,(t<0?e!=c:e!=f)&&(v|=yb)),new wf(p,v,g)}s+=d-u}return r?e+s:new wf(e+s,0,null)}touches(e,t){let r=0,s=ag(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 Vs(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vs.empty:new Vs(e<0?[0,-e,0]:[0,0,e])}}Vs.empty=new Vs([]);class Wl{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 Wl(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 Wl;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 wf(e,s,null)}}const Rd=Object.create(null);class us{getMap(){return Vs.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Rd[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 Rd)throw new RangeError("Duplicate use of step JSON ID "+e);return Rd[e]=t,t.prototype.jsonID=e,t}}class br{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new br(e,null)}static fail(e){return new br(null,e)}static fromReplace(e,t,r,s){try{return br.ok(e.replace(t,r,s))}catch(i){if(i instanceof Hl)return br.fail(i.message);throw i}}}function vh(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(vh(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return _e.fromArray(r)}class bo extends us{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 We(vh(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 br.fromReplace(e,this.from,this.to,i)}invert(){return new hi(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 bo(t.pos,r.pos,this.mark)}merge(e){return e instanceof bo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bo(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 bo(t.from,t.to,e.markFromJSON(t.mark))}}us.jsonID("addMark",bo);class hi extends us{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 We(vh(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return br.fromReplace(e,this.from,this.to,r)}invert(){return new bo(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 hi(t.pos,r.pos,this.mark)}merge(e){return e instanceof hi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hi(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 hi(t.from,t.to,e.markFromJSON(t.mark))}}us.jsonID("removeMark",hi);class yo extends us{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return br.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return br.fromReplace(e,this.pos,this.pos+1,new We(_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 yo(this.pos,t.marks[s]);return new yo(this.pos,this.mark)}}return new oa(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yo(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 yo(t.pos,e.markFromJSON(t.mark))}}us.jsonID("addNodeMark",yo);class oa extends us{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return br.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return br.fromReplace(e,this.pos,this.pos+1,new We(_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 yo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new oa(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 oa(t.pos,e.markFromJSON(t.mark))}}us.jsonID("removeNodeMark",oa);class nr extends us{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&xf(e,this.from,this.to)?br.fail("Structure replace would overwrite content"):br.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vs([this.from,this.to-this.from,this.slice.size])}invert(e){return new nr(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&&nr.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new nr(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof nr)||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?We.empty:new We(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new nr(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?We.empty:new We(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new nr(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 nr(t.from,t.to,We.fromJSON(e,t.slice),!!t.structure)}}nr.MAP_BIAS=1;us.jsonID("replace",nr);class Dr extends us{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&&(xf(e,this.from,this.gapFrom)||xf(e,this.gapTo,this.to)))return br.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return br.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?br.fromReplace(e,this.from,this.to,r):br.fail("Content does not fit in gap")}getMap(){return new Vs([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 Dr(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 Dr(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 Dr(t.from,t.to,t.gapFrom,t.gapTo,We.fromJSON(e,t.slice),t.insert,!!t.structure)}}us.jsonID("replaceAround",Dr);function xf(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 pC(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 hi(h,p,f[v])));a&&a.to==h?a.to=p:i.push(a=new bo(h,p,r))}}),s.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function gC(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 qu){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 hi(o.from,o.to,o.style)))}function bh(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 nr(a,d,We.empty));else{r=f;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new hi(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 We(_e.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new nr(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 We(c,0,0))}for(let c=o.length-1;c>=0;c--)n.step(o[c])}function mC(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Xa(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||!mC(o,a,c))break;a&&(s=1),c<o.childCount&&(i=1)}return null}function vC(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 Dr(c,u,o,a,new We(d.append(h),f,p),d.size-f,!0))}function yh(n,e,t=null,r=n){let s=bC(n,e),i=s&&yC(r,e);return i?s.map(lg).concat({type:e,attrs:t}).concat(i.map(lg)):null}function lg(n){return{type:n,attrs:null}}function bC(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 yC(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 wC(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 Dr(s,i,s,i,new We(r,0,0),t.length,!0))}function xC(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)&&kC(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&&xb(n,o,a,i),bh(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 Dr(f,h,f+1,h-1,new We(_e.from(r.create(c,null,o.marks)),0,0),1,!0)),u===!0&&wb(n,o,a,i),!1}})}function wb(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 xb(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 kC(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function _C(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 Dr(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new We(_e.from(o),0,0),1,!0))}function Gi(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 SC(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 nr(e,e,new We(i.append(o),t,t),!0))}function Po(n,e){let t=n.resolve(e),r=t.index();return kb(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function CC(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 kb(n,e){return!!(n&&e&&!n.isLeaf&&CC(n,e))}function Ju(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&&kb(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 MC(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);xb(n,d.node(),d.before(),a)}o.inlineContent&&bh(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 nr(u,c.map(e+t,-1),We.empty,!0)),r===!0){let d=n.doc.resolve(u);wb(n,d.node(),d.before(),n.steps.length)}return n}function TC(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 _b(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 Xu(n,e,t=e,r=We.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return Sb(s,i,r)?new nr(e,t,r):new EC(s,i,r).fit()}function Sb(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class EC{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 We(i,o,a);return e>-1?new Dr(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new nr(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=cg(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 ug(e,-1)<=t?!1:(this.unplaced.size>1&&ug(e,1)>r&&r++,this.unplaced=new We(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=cg(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new We(bl(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new We(bl(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(Cb(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=yl(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 C=m.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),m=C.content}this.unplaced=g?e==0?We.empty:new We(bl(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new We(bl(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||!Pd(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=Pd(e,t,s,r,i);if(o){for(let a=t-1;a>=0;a--){let{match:c,type:u}=this.frontier[a],d=Pd(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=yl(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=yl(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=yl(this.placed,this.frontier.length,t))}}function bl(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(bl(n.firstChild.content,e-1,t)))}function yl(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(yl(n.lastChild.content,e-1,t)))}function cg(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Cb(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Cb(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 Pd(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&&!AC(t,i.content,o)?a:null}function AC(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function RC(n){return n.spec.defining||n.spec.definingForContent}function ug(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 PC(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(Sb(s,i,r))return n.step(new nr(e,t,r));let o=Tb(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=RC(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],C=!0;m<0&&(C=!1,m=-m);let $=s.node(m-1),M=s.index(m-1);if($.canReplaceWith(M,M,g.type,g.marks))return n.replace(s.before(m),C?i.after(m):t,new We(Mb(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 Mb(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Mb(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 IC(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=TC(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new We(_e.from(r),0,0))}function LC(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=Tb(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 Tb(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 Da extends us{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 br.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 br.fromReplace(e,this.pos,this.pos+1,new We(_e.from(s),0,t.isLeaf?0:1))}getMap(){return Vs.empty}invert(e){return new Da(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 Da(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 Da(t.pos,t.attr,t.value)}}us.jsonID("attr",Da);class jl extends us{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 br.ok(r)}getMap(){return Vs.empty}invert(e){return new jl(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 jl(t.attr,t.value)}}us.jsonID("docAttr",jl);let Ha=class extends Error{};Ha=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ha.prototype=Object.create(Error.prototype);Ha.prototype.constructor=Ha;Ha.prototype.name="TransformError";class Eb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Wl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ha(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=We.empty){let s=Xu(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new We(_e.from(r),0,0))}delete(e,t){return this.replace(e,t,We.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return PC(this,e,t,r),this}replaceRangeWith(e,t,r){return IC(this,e,t,r),this}deleteRange(e,t){return LC(this,e,t),this}lift(e,t){return vC(this,e,t),this}join(e,t=1){return MC(this,e,t),this}wrap(e,t){return wC(this,e,t),this}setBlockType(e,t=e,r,s=null){return xC(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return _C(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new Da(e,t,r)),this}setDocAttribute(e,t){return this.step(new jl(e,t)),this}addNodeMark(e,t){return this.step(new yo(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 Pn)t.isInSet(r.marks)&&this.step(new oa(e,t));else{let s=r.marks,i,o=[];for(;i=t.isInSet(s);)o.push(new oa(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 SC(this,e,t,r),this}addMark(e,t,r){return pC(this,e,t,r),this}removeMark(e,t,r){return gC(this,e,t,r),this}clearIncompatible(e,t,r){return bh(this,e,t,r),this}}const Id=Object.create(null);class Xt{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new OC(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=We.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?We.empty:t),a==0&&hg(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),hg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new Xe(e):Pa(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?Pa(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Pa(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 Ws(e.node(0))}static atStart(e){return Pa(e,e,0,0,1)||new Ws(e)}static atEnd(e){return Pa(e,e,e.content.size,e.childCount,-1)||new Ws(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Id[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 Id)throw new RangeError("Duplicate use of selection JSON ID "+e);return Id[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Xe.between(this.$anchor,this.$head).getBookmark()}}Xt.prototype.visible=!0;class OC{constructor(e,t){this.$from=e,this.$to=t}}let dg=!1;function fg(n){!dg&&!n.parent.inlineContent&&(dg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Xe extends Xt{constructor(e,t=e){fg(e),fg(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 Xt.near(r);let s=e.resolve(t.map(this.anchor));return new Xe(s.parent.inlineContent?s:r,r)}replace(e,t=We.empty){if(super.replace(e,t),t==We.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Xe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yu(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 Xe(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=Xt.findFrom(t,r,!0)||Xt.findFrom(t,-r,!0);if(i)t=i.$head;else return Xt.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(Xt.findFrom(e,-r,!0)||Xt.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new Xe(e,t)}}Xt.jsonID("text",Xe);class Yu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Yu(e.map(this.anchor),e.map(this.head))}resolve(e){return Xe.between(e.resolve(this.anchor),e.resolve(this.head))}}class wt extends Xt{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?Xt.near(i):new wt(i)}content(){return new We(_e.from(this.node),0,0)}eq(e){return e instanceof wt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new wh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new wt(e.resolve(t.anchor))}static create(e,t){return new wt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}wt.prototype.visible=!1;Xt.jsonID("node",wt);class wh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yu(r,r):new wh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&wt.isSelectable(r)?new wt(t):Xt.near(t)}}class Ws extends Xt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=We.empty){if(t==We.empty){e.delete(0,e.doc.content.size);let r=Xt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ws(e)}map(e){return new Ws(e)}eq(e){return e instanceof Ws}getBookmark(){return NC}}Xt.jsonID("all",Ws);const NC={map(){return this},resolve(n){return new Ws(n)}};function Pa(n,e,t,r,s,i=!1){if(e.inlineContent)return Xe.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&&wt.isSelectable(a))return wt.create(n,t-(s<0?a.nodeSize:0))}else{let c=Pa(n,a,t+s,s<0?a.childCount:0,s,i);if(c)return c}t+=a.nodeSize*s}return null}function hg(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof nr||s instanceof Dr))return;let i=n.mapping.maps[r],o;i.forEach((a,c,u,d)=>{o==null&&(o=d)}),n.setSelection(Xt.near(n.doc.resolve(o),t))}const pg=1,yc=2,gg=4;class DC extends Eb{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|pg)&~yc,this.storedMarks=null,this}get selectionSet(){return(this.updated&pg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=yc,this}ensureMarks(e){return Pn.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&yc)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~yc,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)||Pn.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(Xt.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|=gg,this}get scrolledIntoView(){return(this.updated&gg)>0}}function mg(n,e){return!e||!n?n:n.bind(e)}class wl{constructor(e,t,r){this.name=e,this.init=mg(t.init,r),this.apply=mg(t.apply,r)}}const $C=[new wl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new wl("selection",{init(n,e){return n.selection||Xt.atStart(e.doc)},apply(n){return n.selection}}),new wl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new wl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ld{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=$C.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 wl(r.key,r.spec.state,r))})}}class Wi{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 Wi(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 DC(this)}static create(e){let t=new Ld(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Wi(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 Ld(this.schema,e.plugins),r=t.fields,s=new Wi(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 Ld(e.schema,e.plugins),i=new Wi(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=wo.fromJSON(e.schema,t.doc);else if(o.name=="selection")i.selection=Xt.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 Ab(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Ab(s,e,{})),t[r]=s}return t}class An{constructor(e){this.spec=e,this.props={},e.props&&Ab(e.props,this,this.props),this.key=e.key?e.key.key:Rb("plugin")}getState(e){return e[this.key]}}const Od=Object.create(null);function Rb(n){return n in Od?n+"$"+ ++Od[n]:(Od[n]=0,n+"$")}class Wn{constructor(e="key"){this.key=Rb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Pb=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Ib(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Lb=(n,e,t)=>{let r=Ib(n,t);if(!r)return!1;let s=xh(r);if(!s){let o=r.blockRange(),a=o&&Xa(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(Wb(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Ua(i,"end")||wt.isSelectable(i)))for(let o=r.depth;;o--){let a=Xu(n.doc,r.before(o),r.after(o),We.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Ua(i,"end")?Xt.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):wt.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},Ob=(n,e,t)=>{let r=Ib(n,t);if(!r)return!1;let s=xh(r);return s?Db(n,s,e):!1},Nb=(n,e,t)=>{let r=Bb(n,t);if(!r)return!1;let s=kh(r);return s?Db(n,s,e):!1};function Db(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=Xu(n.doc,i,c,We.empty);if(!u||u.from!=i||u instanceof nr&&u.slice.size>=c-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(Xe.create(d.doc,i)),t(d.scrollIntoView())}return!0}function Ua(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 $b=(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=xh(r)}let o=i&&i.nodeBefore;return!o||!wt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(wt.create(n.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function xh(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 Bb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const zb=(n,e,t)=>{let r=Bb(n,t);if(!r)return!1;let s=kh(r);if(!s)return!1;let i=s.nodeAfter;if(Wb(n,s,e,1))return!0;if(r.parent.content.size==0&&(Ua(i,"start")||wt.isSelectable(i))){let o=Xu(n.doc,r.before(),r.after(),We.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Ua(i,"start")?Xt.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):wt.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},Fb=(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=kh(r)}let o=i&&i.nodeAfter;return!o||!wt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(wt.create(n.doc,i.pos)).scrollIntoView()),!0)};function kh(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 BC=(n,e)=>{let t=n.selection,r=t instanceof wt,s;if(r){if(t.node.isTextblock||!Po(n.doc,t.from))return!1;s=t.from}else if(s=Ju(n.doc,t.from,-1),s==null)return!1;if(e){let i=n.tr.join(s);r&&i.setSelection(wt.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},zC=(n,e)=>{let t=n.selection,r;if(t instanceof wt){if(t.node.isTextblock||!Po(n.doc,t.to))return!1;r=t.to}else if(r=Ju(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},FC=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&Xa(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},Hb=(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 _h(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 HC=(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=_h(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(Xt.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},Ub=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof Ws||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=_h(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(Xe.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Vb=(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(Gi(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&Xa(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function UC(n){return(e,t)=>{if(e.selection instanceof wt&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!Gi(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 Xe||e.selection instanceof Ws)&&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=_h(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=Gi(r.doc,f,o.length,o);if(h||(o[0]=c?{type:c}:null,h=Gi(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 VC=UC(),WC=(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(wt.create(n.doc,s))),!0)};function jC(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||Po(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Wb(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,c=s.type.spec.isolating||i.type.spec.isolating;if(!c&&jC(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 C=o.length-1;C>=0;C--)g=_e.from(o[C].create(null,g));g=_e.from(s.copy(g));let v=n.tr.step(new Dr(e.pos-1,p,e.pos,p,new We(g,1,0),o.length,!0)),m=v.doc.resolve(p+2*o.length);m.nodeAfter&&m.nodeAfter.type==s.type&&Po(v.doc,m.pos)&&v.join(m.pos),t(v.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&c?null:Xt.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&Xa(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&Ua(i,"start",!0)&&Ua(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 C=_e.empty;for(let M=g.length-1;M>=0;M--)C=_e.from(g[M].copy(C));let $=n.tr.step(new Dr(e.pos-g.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new We(C,g.length,0),0,!0));t($.scrollIntoView())}return!0}}return!1}function jb(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(Xe.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const KC=jb(-1),GC=jb(1);function qC(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i),a=o&&yh(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function vg(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 Sh(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}Sh(Pb,Lb,$b);Sh(Pb,zb,Fb);Sh(Hb,Ub,Vb,VC);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function JC(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 XC(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function XC(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 eu(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new eu(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=yh(i,t,r,e);return a?(n&&YC(n,e,a,s,t),!0):!1}function YC(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 Dr(e.start-(r?2:0),e.end,e.start,e.end,new We(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&&Gi(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return n}function QC(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?ZC(e,t,n,i):eM(e,t,i):!0:!1}}function ZC(n,e,t,r){let s=n.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Dr(i-1,o,i,o,new We(_e.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new eu(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=Xa(r);if(a==null)return!1;s.lift(r,a);let c=s.doc.resolve(s.mapping.map(i,-1)-1);return Po(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),e(s.scrollIntoView()),!0}function eM(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 Dr(f-(a?1:0),h+(c?1:0),f+1,h-1,new We((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 tM(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 We(_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 Dr(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const Xr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Va=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let kf=null;const Vi=function(n,e,t){let r=kf||(kf=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},nM=function(){kf=null},aa=function(n,e,t,r){return t&&(bg(n,e,t,r,-1)||bg(n,e,t,r,1))},rM=/^(img|br|input|textarea|hr)$/i;function bg(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:ls(n))){let o=n.parentNode;if(!o||!kt(o)||ic(n)||rM.test(n.nodeName)||n.contentEditable=="false")return!1;e=Xr(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?ls(n):0}else return!1}}function ls(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function kt(n){return n.nodeType==1}function Tr(n){return n.nodeType==3}function la(n,e){return e?n.contains(kt(e)?e:e.parentNode):!1}function sM(n,e){for(;;){if(Tr(n)&&e)return n;if(kt(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=ls(n)}else if(n.parentNode&&!ic(n))e=Xr(n),n=n.parentNode;else return null}}function iM(n,e){for(;;){if(Tr(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&&!ic(n))e=Xr(n)+1,n=n.parentNode;else return null}}function oM(n,e,t){for(let r=e==0,s=e==ls(n);r||s;){if(n==t)return!0;let i=Xr(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==ls(n)}}function ic(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 Qu=function(n){return n.focusNode&&aa(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Wo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function aM(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function lM(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(ls(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(ls(r.startContainer),r.startOffset)}}}const Mi=typeof navigator<"u"?navigator:null,yg=typeof document<"u"?document:null,Io=Mi&&Mi.userAgent||"",_f=/Edge\/(\d+)/.exec(Io),Kb=/MSIE \d/.exec(Io),Sf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Io),Ls=!!(Kb||Sf||_f),ko=Kb?document.documentMode:Sf?+Sf[1]:_f?+_f[1]:0,js=!Ls&&/gecko\/(\d+)/i.test(Io);js&&+(/Firefox\/(\d+)/.exec(Io)||[0,0])[1];const Cf=!Ls&&/Chrome\/(\d+)/.exec(Io),Zr=!!Cf,Gb=Cf?+Cf[1]:0,cs=!Ls&&!!Mi&&/Apple Computer/.test(Mi.vendor),Wa=cs&&(/Mobile\/\w+/.test(Io)||!!Mi&&Mi.maxTouchPoints>2),ei=Wa||(Mi?/Mac/.test(Mi.platform):!1),qb=Mi?/Win/.test(Mi.platform):!1,ji=/Android \d/.test(Io),Zu=!!yg&&"webkitFontSmoothing"in yg.documentElement.style,cM=Zu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function uM(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 $i(n,e){return typeof n=="number"?n:n[e]}function dM(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 wg(n,e,t){if(!Mf(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=Va(o);continue}let a=o==i.body,c=a?uM(i):dM(o),u=0,d=0;if(e.top<c.top+$i(r,"top")?d=-(c.top-e.top+$i(s,"top")):e.bottom>c.bottom-$i(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+$i(s,"top")-c.top:e.bottom-c.bottom+$i(s,"bottom")),e.left<c.left+$i(r,"left")?u=-(c.left-e.left+$i(s,"left")):e.right>c.right-$i(r,"right")&&(u=e.right-c.right+$i(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:Va(o)}}function fM(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:Jb(n.dom)}}function Jb(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Va(r));return e}function hM({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Xb(t,r==0?0:r-e)}function Xb(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 Sa=null;function pM(n){if(n.setActive)return n.setActive();if(Sa)return n.focus(Sa);let e=Jb(n);n.focus(Sa==null?{get preventScroll(){return Sa={preventScroll:!0},!0}}:void 0),Sa||(Sa=!1,Xb(e,0))}function Yb(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(Tr(d))h=Vi(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&&Tr(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&&Tr(t)?gM(t,s):!t||r?{node:n,offset:i}:Yb(t,s)}function gM(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=co(r,1);if(o.top!=o.bottom&&Ch(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 Ch(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function mM(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function vM(n,e,t){let{node:r,offset:s}=Yb(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 bM(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 Qb(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(Ch(e,u))return Qb(o,e,u)}}if((i=(i+1)%r)==s)break}return n}function yM(n,e){let t=n.dom.ownerDocument,r,s=0,i=lM(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(!Ch(e,u)||(o=Qb(n.dom,e,u),!o))return null}if(cs)for(let u=o;r&&u;u=Va(u))u.draggable&&(r=void 0);if(o=mM(o,e),r){if(js&&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;Zu&&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=bM(n,r,s,e))}a==null&&(a=vM(n,o,e));let c=n.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Mf(n){return n.top<n.bottom||n.left<n.right}function co(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Mf(r))return r}return Array.prototype.find.call(t,Mf)||n.getBoundingClientRect()}const wM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Zb(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),o=Zu||js;if(Tr(r))if(o&&(wM.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let c=co(Vi(r,s,s),t);if(js&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=co(Vi(r,s-1,s-1),-1);if(u.top==c.top){let d=co(Vi(r,s,s+1),-1);if(d.top!=c.top)return fl(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++,fl(co(Vi(r,c,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==ls(r))){let c=r.childNodes[s-1];if(kt(c))return Nd(c.getBoundingClientRect(),!1)}if(i==null&&s<ls(r)){let c=r.childNodes[s];if(kt(c))return Nd(c.getBoundingClientRect(),!0)}return Nd(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==ls(r))){let c=r.childNodes[s-1],u=Tr(c)?Vi(c,ls(c)-(o?0:1)):kt(c)&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return fl(co(u,1),!1)}if(i==null&&s<ls(r)){let c=r.childNodes[s];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?Tr(c)?Vi(c,0,o?0:1):kt(c)?c:null:null;if(u)return fl(co(u,-1),!0)}return fl(co(Tr(r)?Vi(r):r,-t),t>=0)}function fl(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 Nd(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 ey(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 xM(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return ey(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=Zb(n,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let c;if(kt(a))c=a.getClientRects();else if(Tr(a))c=Vi(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 kM=/[\u0590-\u08ac]/;function _M(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?!kM.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:o:ey(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&&!la(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 xg=null,kg=null,_g=!1;function SM(n,e,t){return xg==e&&kg==t?_g:(xg=e,kg=t,_g=t=="up"||t=="down"?xM(n,e,t):_M(n,e,t))}const ni=0,Sg=1,Go=2,gi=3;class oc{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=ni,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&&la(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>Xr(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)?la(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 ny||i instanceof ty&&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?Xr(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?Xr(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=Xr(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=Xr(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((js||cs)&&e==t){let{node:p,offset:g}=a;if(Tr(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:Xr(m)+1});break}let C=v.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let v=p.childNodes[g-1];f=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(js&&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&&cs)&&aa(a.node,a.offset,d.anchorNode,d.anchorOffset)&&aa(c.node,c.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==t)&&!(f&&js)){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?Go:Sg,e==a&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=gi:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Go:gi}r=o}this.dirty=Go}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Go:Sg;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ty extends oc{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==ni&&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 CM extends oc{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 _o extends oc{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=pa.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new _o(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&gi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=gi&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ni){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ni}}slice(e,t,r){let s=_o.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;t<o&&(i=Ef(i,t,o,r)),e>0&&(i=Ef(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 So extends oc{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(!Tr(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=pa.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=iy(d,r,t),u?c=new MM(e,t,r,s,d,f||null,h,u):t.isText?new ed(e,t,r,s,d,h):new So(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==ni&&e.eq(this.node)&&nu(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 EM(this,o&&o.node,e),u=this.node.inlineContent,d=u&&this.node.isBlock;PM(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?Pn.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==Go)&&(o&&this.protectLocalComposition(e,o),ry(this.contentDOM,this.children,e),Wa&&IM(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Xe)||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=LM(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 CM(this,i,t,s);e.input.compositionNodes.push(o),this.children=Ef(this.children,r,r+s.length,e,o)}update(e,t,r,s){return this.dirty==gi||!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=ni}updateOuterDeco(e){if(nu(e,this.outerDeco))return;let t=!kt(this.nodeDOM),r=this.dom;this.dom=sy(this.dom,this.nodeDOM,Tf(this.outerDeco,this.node,t),Tf(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 Cg(n,e,t,r,s){iy(r,e,n);let i=new So(void 0,n,e,t,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class ed extends So{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==gi||this.dirty!=ni&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ni||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=ni,!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 ed(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=gi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ny extends oc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ni&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class MM extends So{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==gi)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 ry(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=Mg(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(a,r);if(o instanceof _o){let c=r?r.previousSibling:n.lastChild;ry(o.contentDOM,o.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=Mg(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Al=function(n){n&&(this.nodeName=n)};Al.prototype=Object.create(null);const qo=[new Al];function Tf(n,e,t){if(n.length==0)return qo;let r=t?qo[0]:new Al,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new Al(o.nodeName));for(let a in o){let c=o[a];c!=null&&(t&&s.length==1&&s.push(r=new Al(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 sy(n,e,t,r){if(t==qo&&r==qo)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=qo[0]),s=c}TM(s,a||qo[0],o)}return s}function TM(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 iy(n,e,t){return sy(n,n,qo,Tf(e,t,!kt(n)))}function nu(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 Mg(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class EM{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=AM(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=ni,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 _o&&d.dirty!=gi&&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=_o.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==gi&&o.dom==o.contentDOM&&(o.dirty=Go),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 So){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!=gi&&nu(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=Go,f.updateChildren(s,o+1),f.dirty=ni),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)||!nu(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=So.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=So.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 ty(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 _o;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ed)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((cs||Zr)&&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 ny(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 AM(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 _o)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 RM(n,e){return n.type.side-e.type.side}function PM(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(RM);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 C=0;C<a.length;C++)a[C].to<m&&(m=a[C].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 IM(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 LM(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 Ef(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 Mh(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(Qu(t)){for(c=o;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&wt.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&oM(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;u=new wt(o==f?a:r.resolve(f))}else if(js&&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=Xt.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=Th(n,d,a,f)}return u}function oy(n){return n.editable?n.hasFocus():ly(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function qi(n,e=!1){let t=n.state.selection;if(ay(n,t),!oy(n))return;let r=n.input.mouseDown;if(!e&&Zr&&r){let s=n.domSelectionRange(),i=n.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&aa(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)NM(n);else{let{anchor:s,head:i}=t,o,a;Tg&&!(t instanceof Xe)&&(t.$from.parent.inlineContent||(o=Eg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Eg(n,t.to))),n.docView.setSelection(s,i,n,e),Tg&&(o&&Ag(o),a&&Ag(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&OM(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const Tg=cs||Zr&&Gb<63;function Eg(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(cs&&s&&s.contentEditable=="false")return Dd(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Dd(s);if(i)return Dd(i)}}function Dd(n){return n.contentEditable="true",cs&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Ag(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function OM(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(()=>{(!oy(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function NM(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Xr(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Ls&&ko<=11&&(t.disabled=!0,t.disabled=!1)}function ay(n,e){if(e instanceof wt){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Rg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Rg(n)}function Rg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Th(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||Xe.between(e,t,r)}function Pg(n){return n.editable&&!n.hasFocus()?!1:ly(n)}function ly(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return la(n.dom,e.anchorNode)&&(n.editable||la(n.dom,e.focusNode))}catch{return!1}}function DM(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return aa(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Af(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&&Xt.findFrom(i,e)}function fo(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ig(n,e,t){let r=n.state.selection;if(r instanceof Xe)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 fo(n,new Xe(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Af(n.state,e);return s&&s instanceof wt?fo(n,s):!1}else if(!(ei&&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?wt.isSelectable(i)?fo(n,new wt(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):fo(n,new Xe(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof wt&&r.node.isInline)return fo(n,new Xe(e>0?r.$to:r.$from));{let s=Af(n.state,e);return s?fo(n,s):!1}}}function Rl(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):kt(n)&&n.contentEditable=="false"}function Ca(n,e){return e<0?$M(n):BM(n)}function $M(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(js&&kt(t)&&r<ls(t)&&Rl(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!kt(t))break;let a=t.childNodes[r-1];if(Rl(a,-1))s=t,i=--r;else if(Tr(a))t=a,r=t.nodeValue.length;else break}else{if(cy(t))break;{let a=t.previousSibling;for(;a&&Rl(a,-1);)s=t.parentNode,i=Xr(a),a=a.previousSibling;if(a)t=a,r=ls(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Rf(n,t,r):s&&Rf(n,s,i)}function BM(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=ls(t),i,o;for(;;)if(r<s){if(!kt(t))break;let a=t.childNodes[r];if(Rl(a,1))i=t,o=++r;else break}else{if(cy(t))break;{let a=t.nextSibling;for(;a&&Rl(a,1);)i=a.parentNode,o=Xr(a)+1,a=a.nextSibling;if(a)t=a,r=0,s=ls(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&Rf(n,i,o)}function cy(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function zM(n,e){for(;n&&e==n.childNodes.length&&!ic(n);)e=Xr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(Tr(t))return t;if(kt(t)&&t.contentEditable=="false")break;n=t,e=0}}function FM(n,e){for(;n&&!e&&!ic(n);)e=Xr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(Tr(t))return t;if(kt(t)&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Rf(n,e,t){if(!Tr(e)){let i,o;(o=zM(e,t))?(e=o,t=0):(i=FM(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Qu(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&&qi(n)},50)}function Lg(n,e){let t=n.state.doc.resolve(e);if(!(Zr||qb)&&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 Og(n,e,t){let r=n.state.selection;if(r instanceof Xe&&!r.empty||t.indexOf("s")>-1||ei&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Af(n.state,e);if(o&&o instanceof wt)return fo(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Ws?Xt.near(o,e):Xt.findFrom(o,e);return a?fo(n,a):!1}return!1}function Ng(n,e){if(!(n.state.selection instanceof Xe))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 Dg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function HM(n){if(!cs||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;Dg(n,r,"true"),setTimeout(()=>Dg(n,r,"false"),20)}return!1}function UM(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function VM(n,e){let t=e.keyCode,r=UM(e);if(t==8||ei&&t==72&&r=="c")return Ng(n,-1)||Ca(n,-1);if(t==46&&!e.shiftKey||ei&&t==68&&r=="c")return Ng(n,1)||Ca(n,1);if(t==13||t==27)return!0;if(t==37||ei&&t==66&&r=="c"){let s=t==37?Lg(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ig(n,s,r)||Ca(n,s)}else if(t==39||ei&&t==70&&r=="c"){let s=t==39?Lg(n,n.state.selection.from)=="ltr"?1:-1:1;return Ig(n,s,r)||Ca(n,s)}else{if(t==38||ei&&t==80&&r=="c")return Og(n,-1,r)||Ca(n,-1);if(t==40||ei&&t==78&&r=="c")return HM(n)||Og(n,1,r)||Ca(n,1);if(r==(ei?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Eh(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")||pa.fromSchema(n.state.schema),a=gy(),c=a.createElement("div");c.appendChild(o.serializeFragment(r,{document:a}));let u=c.firstChild,d,f=0;for(;u&&kt(u)&&(d=py[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
-
12
- `);return{dom:c,text:h,slice:e}}function uy(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 We(_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=pa.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=GM(t),Zu&&qM(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")||xo.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!WM.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=JM($g(a,+d[1],+d[2]),d[4]);else if(a=We.maxOpen(jM(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=$g(a,f,h)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const WM=/^(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 jM(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&&fy(c,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=hy(o[o.length-1],i.length));let d=dy(a,c);o.push(d),s=s.matchType(d.type),i=c}}),o)return _e.from(o)}return n}function dy(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,_e.from(n));return n}function fy(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=fy(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(dy(t,n,s+1))))}}function hy(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,hy(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 $g(n,e,t){return e<n.openStart&&(n=new We(Pf(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new We(Pf(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const py={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 gy(){return document.implementation.createHTMLDocument("title")}let hl=null;function KM(n){let e=window.trustedTypes;if(!e)return n;if(!hl){if(hl=e.defaultPolicy)try{return hl.createHTML(n)}catch{}hl=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return hl.createHTML(n)}function GM(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=gy(),r=t.body,s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&py[s[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=KM(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 qM(n){let e=n.querySelectorAll(Zr?"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 JM(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 We(s,i,o)}const _s={},Ss={},XM={touchstart:!0,touchmove:!0};class YM{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 QM(n){for(let e in _s){let t=_s[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{e2(n,r)&&!Ah(n,r)&&(n.editable||!(r.type in Ss))&&t(n,r)},XM[e]?{passive:!0}:void 0)}cs&&n.dom.addEventListener("input",()=>null),If(n)}function Ki(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ZM(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 If(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ah(n,r))})}function Ah(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function e2(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 t2(n,e){!Ah(n,e)&&_s[e.type]&&(n.editable||!(e.type in Ss))&&_s[e.type](n,e)}Ss.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!yy(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ji&&Zr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wa&&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,Wo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||VM(n,t)?t.preventDefault():Ki(n,"key")};Ss.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ss.keypress=(n,e)=>{let t=e;if(yy(n)||!t.charCode||t.ctrlKey&&!t.altKey||ei&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof Xe)||!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 ac(n){return{left:n.clientX,top:n.clientY}}function n2(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Rh(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 lc(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 r2(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&wt.isSelectable(r)?(lc(n,new wt(t)),!0):!1}function s2(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof wt&&(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(wt.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?(lc(n,wt.create(n.state.doc,s)),!0):!1}function i2(n,e,t,r,s){return Rh(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?s2(n,t):r2(n,t))}function o2(n,e,t,r){return Rh(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function a2(n,e,t,r){return Rh(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||l2(n,t,r)}function l2(n,e,t){if(t.button!=0)return!1;let r=my(n,e,!0),s=n.state.doc;return r?(lc(n,r),r instanceof Xe&&s.eq(n.state.doc)&&(n.input.mouseDown=new u2(n,r)),!0):!1}function my(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?Xe.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 Xe.create(r,a+1,a+1+o.content.size);if(t&&wt.isSelectable(o))return wt.create(r,a)}return null}function Ph(n){return ru(n)}const vy=ei?"metaKey":"ctrlKey";_s.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Ph(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&n2(t,n.input.lastClick)&&!t[vy]&&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(ac(t));o&&(i=="singleClick"?n.input.mouseDown=new c2(n,o,t,!!r):(i=="doubleClick"?o2:a2)(n,o.pos,o.inside,t)?t.preventDefault():Ki(n,"pointer"))};class by{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 c2 extends by{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[vy],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 wt&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&js&&!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()),Ki(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||qi(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(ac(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ki(this.view,"pointer"):i2(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||cs&&this.mightDrag&&!this.mightDrag.node.isAtom||Zr&&!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)?(lc(this.view,Xt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ki(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ki(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 u2 extends by{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(),Ki(this.view,"pointer");let t=this.view.posAtCoords(ac(e)),r=t&&my(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];lc(this.view,Xe.create(s,o,a))}}_s.touchstart=n=>{n.input.lastTouch=Date.now(),Ph(n),Ki(n,"pointer")};_s.touchmove=n=>{n.input.lastTouch=Date.now(),Ki(n,"pointer")};_s.contextmenu=n=>Ph(n);function yy(n,e){return n.composing?!0:cs&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const d2=ji?5e3:-1;Ss.compositionstart=Ss.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Xe&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Zr&&qb&&f2(n)))n.markCursor=n.state.storedMarks||t.marks(),ru(n,!0),n.markCursor=null;else if(ru(n,!e.selection.empty),js&&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(Tr(o)){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}wy(n,d2)};function f2(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"}Ss.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++,wy(n,20))};function wy(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ru(n),e))}function xy(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function h2(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=sM(e.focusNode,e.focusOffset),r=iM(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 ru(n,e=!1){if(!(ji&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),xy(n),e||n.docView&&n.docView.dirty){let t=Mh(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 p2(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 Kl=Ls&&ko<15||Wa&&cM<604;_s.copy=Ss.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Kl?null:t.clipboardData,o=r.content(),{dom:a,text:c}=Eh(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):p2(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function g2(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function m2(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?Gl(n,r.value,null,s,e):Gl(n,r.textContent,r.innerHTML,s,e)},50)}function Gl(n,e,t,r,s){let i=uy(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,s,i||We.empty)))return!0;if(!i)return!1;let o=g2(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 ky(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," "):""}Ss.paste=(n,e)=>{let t=e;if(n.composing&&!ji)return;let r=Kl?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Gl(n,ky(r),r.getData("text/html"),s,t)?t.preventDefault():m2(n,t)};class _y{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const v2=ei?"altKey":"ctrlKey";function Sy(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[v2]}_s.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(ac(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof wt?s.to-1:s.to))){if(r&&r.mightDrag)o=wt.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=wt.create(n.state.doc,f.posBefore))}}let a=(o||n.state.selection).content(),{dom:c,text:u,slice:d}=Eh(n,a);(!t.dataTransfer.files.length||!Zr||Gb>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Kl?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Kl||t.dataTransfer.setData("text/plain",u),n.dragging=new _y(d,Sy(n,t),o)};_s.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ss.dragover=Ss.dragenter=(n,e)=>e.preventDefault();Ss.drop=(n,e)=>{try{b2(n,e,n.dragging)}finally{n.dragging=null}};function b2(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(ac(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=uy(n,ky(e.dataTransfer),Kl?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&Sy(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||We.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?_b(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&&wt.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new wt(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,v,m,C)=>p=C),c.setSelection(Th(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}_s.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())&&qi(n)},20))};_s.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)};_s.beforeinput=(n,e)=>{if(ji&&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,Wo(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 Ss)_s[n]=Ss[n];function ql(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 su{constructor(e,t){this.toDOM=e,this.spec=t||na,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 Nr(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof su&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ql(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Co{constructor(e,t){this.attrs=e,this.spec=t||na}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 Nr(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Co&&ql(this.attrs,e.attrs)&&ql(this.spec,e.spec)}static is(e){return e.type instanceof Co}destroy(){}}class Ih{constructor(e,t){this.attrs=e,this.spec=t||na}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 Nr(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 Ih&&ql(this.attrs,e.attrs)&&ql(this.spec,e.spec)}destroy(){}}class Nr{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Nr(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 Nr(e,e,new su(t,r))}static inline(e,t,r,s){return new Nr(e,t,new Co(r,s))}static node(e,t,r,s){return new Nr(e,t,new Ih(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Co}get widget(){return this.type instanceof su}}const Ia=[],na={};class rn{constructor(e,t){this.local=e.length?e:Ia,this.children=t.length?t:Ia}static create(e,t){return t.length?iu(t,e,0,na):ss}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==ss||e.maps.length==0?this:this.mapInner(e,t,0,0,r||na)}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?y2(this.children,o||[],e,t,r,s,i):o?new rn(o.sort(ra),Ia):ss}add(e,t){return t.length?this==ss?rn.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=My(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,iu(d,a,u+1,na)),i+=3}});let o=Cy(i?Ty(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new rn(o.length?this.local.concat(o).sort(ra):this.local,s||this.children)}remove(e){return e.length==0||this==ss?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!=ss?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 rn(s,r):ss}forChild(e,t){if(this==ss)return this;if(t.isLeaf)return rn.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 Co){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 rn(s.sort(ra),Ia);return r?new go([a,r]):a}return r||ss}eq(e){if(this==e)return!0;if(!(e instanceof rn)||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 Lh(this.localsInner(e))}localsInner(e){if(this==ss)return Ia;if(e.inlineContent||!this.local.some(Co.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Co||t.push(this.local[r]);return t}forEachSet(e){e(this)}}rn.empty=new rn([],[]);rn.removeOverlap=Lh;const ss=rn.empty;class go{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,na));return go.from(r)}forChild(e,t){if(t.isLeaf)return rn.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=ss&&(i instanceof go?r=r.concat(i.members):r.push(i))}return go.from(r)}eq(e){if(!(e instanceof go)||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?Lh(r?t:t.sort(ra)):Ia}static from(e){switch(e.length){case 0:return ss;case 1:return e[0];default:return new go(e.every(t=>t instanceof rn)?e:e.reduce((t,r)=>t.concat(r instanceof rn?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function y2(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 C=0;C<a.length;C+=3){let $=a[C+1];if($<0||h>$+d-f)continue;let M=a[C]+d-f;p>=M?a[C+1]=h<=M?-2:-1:h>=d&&m&&(a[C]+=m,a[C+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 C=a[u+2].mapInner(t,m,d+1,n[u]+i+1,o);C!=ss?(a[u]=f,a[u+1]=p,a[u+2]=C):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=w2(a,n,e,t,s,i,o),d=iu(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 rn(e.sort(ra),a)}function Cy(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 Nr(s.from+e,s.to+e,s.type))}return t}function w2(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 My(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 Ty(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function iu(n,e,t,r){let s=[],i=!1;e.forEach((a,c)=>{let u=My(n,a,c+t);if(u){i=!0;let d=iu(u,a,t+c+1,r);d!=ss&&s.push(c,c+a.nodeSize,d)}});let o=Cy(i?Ty(n):n,-t).sort(ra);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 rn(o,s):ss}function ra(n,e){return n.from-e.from||n.to-e.to}function Lh(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),Bg(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),Bg(e,s,r.copy(i.from,r.to)));break}}}return e}function Bg(n,e,t){for(;e<n.length&&ra(t,n[e])>0;)e++;n.splice(e,0,t)}function $d(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ss&&e.push(r)}),n.cursorWrapper&&e.push(rn.create(n.state.doc,[n.cursorWrapper.deco])),go.from(e)}const x2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},k2=Ls&&ko<=11;class _2{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 S2{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _2,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]);Ls&&ko<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():cs&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),k2&&(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,x2)),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(Pg(this.view)){if(this.suppressingSelectionUpdates)return qi(this.view);if(Ls&&ko<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&aa(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=Va(i))t.add(i);for(let i=e.anchorNode;i;i=Va(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:Tr(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)&&Pg(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||Zr&&(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(js&&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||T2(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&&Qu(r)&&(u=Mh(e))&&u.eq(Xt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qi(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),C2(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,E2(e,c)),this.handleDOMChange(i,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||qi(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),Tr(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(Ls&&ko<=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?Xr(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),c=i&&i.parentNode==e.target?Xr(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 zg=new WeakMap,Fg=!1;function C2(n){if(!zg.has(n)&&(zg.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=js,Fg)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."),Fg=!0}}function Hg(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return aa(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function M2(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Hg(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?Hg(n,t):null}function T2(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 E2(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 A2(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&&la(n.dom,f)&&(d=[{node:f,offset:u.anchorOffset}],Qu(u)||d.push({node:u.focusNode,offset:u.focusOffset})),Zr&&n.input.lastKeyCode===8)for(let C=o;C>i;C--){let $=s.childNodes[C-1],M=$.pmViewDesc;if($.nodeName=="BR"&&!M){o=C;break}if(!M||M.size)break}let h=n.state.doc,p=n.someProp("domParser")||xo.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:R2(r),context:g});if(d&&d[0].pos!=null){let C=d[0].pos,$=d[1]&&d[1].pos;$==null&&($=C),v={anchor:C+a,head:$+a}}return{doc:m,sel:v,from:a,to:c}}const R2=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(cs&&/^(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||cs&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},P2=/^(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 I2(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,L=Mh(n,E);if(L&&!n.state.selection.eq(L)){if(Zr&&ji&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",U=>U(n,Wo(13,"Enter"))))return;let ee=n.state.tr.setSelection(L);E=="pointer"?ee.setMeta("pointer",!0):E=="key"&&ee.scrollIntoView(),i&&ee.setMeta("composition",i),n.dispatch(ee)}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=A2(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=D2(f.content,u.doc.content,u.from,h,p);if(g&&n.input.domChangeCount++,(Wa&&n.input.lastIOSEnter>Date.now()-225||ji)&&s.some(E=>kt(E)&&!P2.test(E.nodeName))&&(!g||g.endA>=g.endB)&&n.someProp("handleKeyDown",E=>E(n,Wo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!g)if(r&&c instanceof Xe&&!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=Ug(n,n.state.doc,u.sel);if(E&&!E.eq(n.state.selection)){let L=n.state.tr.setSelection(E);i&&L.setMeta("composition",i),n.dispatch(L)}}return}n.state.selection.from<n.state.selection.to&&g.start==g.endB&&n.state.selection instanceof Xe&&(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)),Ls&&ko<=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),C=d.resolve(g.start),$=v.sameParent(m)&&v.parent.inlineContent&&C.end()>=g.endA;if((Wa&&n.input.lastIOSEnter>Date.now()-225&&(!$||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!$&&N2(u.doc,v.pos,m.pos))&&n.someProp("handleKeyDown",E=>E(n,Wo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>g.start&&O2(d,g.start,g.endA,v,m)&&n.someProp("handleKeyDown",E=>E(n,Wo(8,"Backspace")))){ji&&Zr&&n.domObserver.suppressSelectionUpdates();return}Zr&&g.endB==g.start&&(n.input.lastChromeDelete=Date.now()),ji&&!$&&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,Wo(13,"Enter"))})},20));let M=g.start,S=g.endA,D=E=>{let L=E||n.state.tr.replace(M,S,u.doc.slice(g.start-u.from,g.endB-u.from));if(u.sel){let ee=Ug(n,L.doc,u.sel);ee&&!(Zr&&n.composing&&ee.empty&&(g.start!=g.endB||n.input.lastChromeDelete<Date.now()-100)&&(ee.head==M||ee.head==L.mapping.map(S)-1)||Ls&&ee.empty&&ee.head==M)&&L.setSelection(ee)}return i&&L.setMeta("composition",i),L.scrollIntoView()},I;if($)if(v.pos==m.pos){Ls&&ko<=11&&v.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>qi(n),20));let E=D(n.state.tr.delete(M,S)),L=d.resolve(g.start).marksAcross(d.resolve(g.endA));L&&E.ensureMarks(L),n.dispatch(E)}else if(g.endA==g.endB&&(I=L2(v.parent.content.cut(v.parentOffset,m.parentOffset),C.parent.content.cut(C.parentOffset,g.endA-C.start())))){let E=D(n.state.tr);I.type=="add"?E.addMark(M,S,I.mark):E.removeMark(M,S,I.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),L=()=>D(n.state.tr.insertText(E,M,S));n.someProp("handleTextInput",ee=>ee(n,M,S,E,L))||n.dispatch(L())}else n.dispatch(D());else n.dispatch(D())}function Ug(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Th(n,e.resolve(t.anchor),e.resolve(t.head))}function L2(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 O2(n,e,t,r,s){if(t-e<=s.pos-r.pos||Bd(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(Bd(i,!0,!0));return!o.parent.isTextblock||o.pos>t||Bd(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function N2(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 Bd(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 D2(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 Ey{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 YM,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Gg),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=jg(this),Wg(this),this.nodeViews=Kg(this),this.docView=Cg(this.state.doc,Vg(this),$d(this),this.dom,this),this.domObserver=new S2(this,(r,s,i,o)=>I2(this,r,s,i,o)),this.domObserver.start(),QM(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&&If(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Gg),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&&(xy(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=Kg(this);B2(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&If(this),this.editable=jg(this),Wg(this);let c=$d(this),u=Vg(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&&fM(this);if(o){this.domObserver.stop();let p=f&&(Ls||Zr)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&$2(s.selection,e.selection);if(f){let v=Zr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=h2(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Cg(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())&&DM(this)&&g.delaySelUpdate())?qi(this,p):(ay(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&&hM(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!la(this.dom,e))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof wt){let t=this.docView.domAfterPos(this.state.selection.from);kt(t)&&wg(this,t.getBoundingClientRect(),e)}else wg(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 _y(e.slice,e.move,s<0?void 0:wt.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(Ls){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&&pM(this.dom),qi(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 yM(this,e)}coordsAtPos(e,t=1){return Zb(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 SM(this,t||this.state,e)}pasteHTML(e,t){return Gl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Gl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Eh(this,e)}destroy(){this.docView&&(ZM(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$d(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,nM())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return t2(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?cs&&this.root.nodeType===11&&aM(this.dom.ownerDocument)==this.dom&&M2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Ey.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Vg(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"),[Nr.node(0,n.state.doc.content.size,e)]}function Wg(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:Nr.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function jg(n){return!n.someProp("editable",e=>e(n.state)===!1)}function $2(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 Kg(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 B2(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 Gg(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 Eo={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:"'"},ou={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},z2=typeof navigator<"u"&&/Mac/.test(navigator.platform),F2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Yr=0;Yr<10;Yr++)Eo[48+Yr]=Eo[96+Yr]=String(Yr);for(var Yr=1;Yr<=24;Yr++)Eo[Yr+111]="F"+Yr;for(var Yr=65;Yr<=90;Yr++)Eo[Yr]=String.fromCharCode(Yr+32),ou[Yr]=String.fromCharCode(Yr);for(var zd in Eo)ou.hasOwnProperty(zd)||(ou[zd]=Eo[zd]);function H2(n){var e=z2&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||F2&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ou:Eo)[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 U2=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),V2=typeof navigator<"u"&&/Win/.test(navigator.platform);function W2(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))U2?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 j2(n){let e=Object.create(null);for(let t in n)e[W2(t)]=n[t];return e}function Fd(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 K2(n){return new An({props:{handleKeyDown:Ay(n)}})}function Ay(n){let e=j2(n);return function(t,r){let s=H2(r),i,o=e[Fd(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[Fd(s,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(V2&&r.ctrlKey&&r.altKey)&&(i=Eo[r.keyCode])&&i!=s){let a=e[Fd(i,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var au=200,$r=function(){};$r.prototype.append=function(e){return e.length?(e=$r.from(e),!this.length&&e||e.length<au&&this.leafAppend(e)||this.length<au&&e.leafPrepend(this)||this.appendInner(e)):this};$r.prototype.prepend=function(e){return e.length?$r.from(e).append(this):this};$r.prototype.appendInner=function(e){return new G2(this,e)};$r.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?$r.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};$r.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};$r.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)};$r.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};$r.from=function(e){return e instanceof $r?e:e&&e.length?new Ry(e):$r.empty};var Ry=(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<=au)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=au)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})($r);$r.empty=new Ry([]);var G2=(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})($r);const q2=500;class fi{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 _i(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 _i(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 fi(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 _i(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>X2&&(a=J2(a,u),o-=u),new fi(a.append(i),o)}remapping(e,t){let r=new Wl;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 fi(this.items.append(e.map(t=>new _i(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 _i(g,v,m))}else r.push(new _i(g))},s);let u=[];for(let h=t;h<o;h++)u.push(new _i(i.maps[h]));let d=this.items.slice(0,s).append(u).append(r),f=new fi(d,a);return f.emptyItemCount()>q2&&(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 _i(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 fi($r.from(s.reverse()),i)}}fi.empty=new fi($r.empty,0);function J2(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class _i{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 _i(t.getMap().invert(),t,this.selection)}}}class ho{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const X2=20;function Y2(n,e,t,r){let s=t.getMeta(Mo),i;if(s)return s.historyState;t.getMeta(Py)&&(n=new ho(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Mo))return o.getMeta(Mo).redo?new ho(n.done.addTransform(t,void 0,r,Uc(e)),n.undone,qg(t.mapping.maps),n.prevTime,n.prevComposition):new ho(n.done,n.undone.addTransform(t,void 0,r,Uc(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||!Q2(t,n.prevRanges)),u=o?Hd(n.prevRanges,t.mapping):qg(t.mapping.maps);return new ho(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Uc(e)),fi.empty,u,t.time,a??n.prevComposition)}else return(i=t.getMeta("rebased"))?new ho(n.done.rebased(t,i),n.undone.rebased(t,i),Hd(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ho(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Hd(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Q2(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 qg(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 Hd(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 Z2(n,e,t){let r=Uc(e),s=Mo.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 ho(t?a:i.remaining,t?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(Mo,{redo:t,historyState:c})}let Ud=!1,Jg=null;function Uc(n){let e=n.plugins;if(Jg!=e){Ud=!1,Jg=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ud=!0;break}}return Ud}function eT(n){return n.setMeta(Py,!0)}const Mo=new Wn("history"),Py=new Wn("closeHistory");function tT(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new An({key:Mo,state:{init(){return new ho(fi.empty,fi.empty,null,0,-1)},apply(e,t,r){return Y2(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Ly:r=="historyRedo"?Oy:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Iy(n,e){return(t,r)=>{let s=Mo.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=Z2(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Ly=Iy(!1,!0),Oy=Iy(!0,!0);function nT(n){return n.getMeta(Mo)!=null}function td(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 $a=class Ny{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),C=p(...v)(m);return a.push(C),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=Ny.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:td({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 rT=()=>({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),sT=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),iT=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{ranges:r}=t;if(!e)return!0;const s=n.mapping.maps.length;return r.forEach(({$from:i,$to:o})=>{const a=i.pos,c=o.pos,u=n.mapping.slice(s);let d=1;n.doc.nodesBetween(u.map(a),u.map(c),(f,h)=>{d=Math.max(d,n.doc.resolve(h).depth+1)});for(let f=0;f<d;f+=1){const h=n.doc,p=n.mapping.maps.length,g=n.mapping.slice(s);let v=p,m=n.mapping.slice(p);const C=g.map(a),$=g.map(c);if(h.nodesBetween(C,$,(M,S)=>{if(M.type.isText)return;n.mapping.maps.length!==v&&(v=n.mapping.maps.length,m=n.mapping.slice(p));const D=n.doc.resolve(m.map(S)),I=n.doc.resolve(m.map(S+M.nodeSize)),E=D.blockRange(I);if(!E)return;const L=Xa(E);if(M.type.isTextblock){const{defaultType:ee}=D.parent.contentMatchAt(D.index()),U=n.doc.nodeAt(E.start);ee&&U&&!U.hasMarkup(ee)&&ee.validContent(U.content)&&n.setNodeMarkup(E.start,ee)}(L||L===0)&&n.lift(E,L)}),n.doc.eq(h))break}}),!0},oT=n=>e=>n(e),aT=()=>({state:n,dispatch:e})=>Ub(n,e),lT=(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 Xe(r.doc.resolve(Math.max(o-1,0)))),!0},cT=()=>({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 Er(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 uT=n=>({tr:e,state:t,dispatch:r})=>{const s=Er(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},dT=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},fT=n=>n.content?/^text(\*|\+)/.test(n.content):!1,Xg=(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 fT(r)?t==="left"?n.start()-1:n.end()+1:n.pos},hT=(n,e,t)=>({from:Xg(n,t,"left"),to:Xg(e,t,"right")}),pT=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,s=n.selection instanceof Xe?n.selection.$from.marksAcross(n.selection.$to):null,i=t.steps.length;r.forEach(o=>{const a=t.mapping.slice(i),c=t.doc.resolve(a.map(o.$from.pos)),u=t.doc.resolve(a.map(o.$to.pos)),{from:d,to:f}=hT(c,u,n.schema);t.deleteRange(d,f)}),t.selection.empty||t.setSelection(Xe.near(t.doc.resolve(t.selection.from))),s&&t.ensureMarks(s),t.scrollIntoView(),e(t)}return!0},gT=()=>({commands:n})=>n.keyboardShortcut("Enter"),mT=()=>({state:n,dispatch:e})=>HC(n,e);function Oh(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function lu(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:Oh(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function Dy(n,e,t={}){return n.find(r=>r.type===e&&lu(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Yg(n,e,t={}){return!!Dy(n,e,t)}function Nh(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(!Dy([...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&&Yg([...n.parent.child(s-1).marks],e,t);)s-=1,i-=n.parent.child(s).nodeSize;for(;o<n.parent.childCount&&Yg([...n.parent.child(o).marks],e,t);)a+=n.parent.child(o).nodeSize,o+=1;return{from:i,to:a}}function Zi(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 vT=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=Zi(n,r.schema),{doc:o,selection:a}=t,{$from:c,from:u,to:d}=a;if(s){const f=Nh(c,i,e);if(f&&f.from<=u&&f.to>=d){const h=Xe.create(o,f.from,f.to);t.setSelection(h)}}return!0},bT=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 $y(n){return n instanceof Xe}function Jo(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Lf(n,e=null){if(!e)return null;const t=Xt.atStart(n),r=Xt.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?Xe.create(n,Jo(0,s,i),Jo(n.content.size,s,i)):Xe.create(n,Jo(e,s,i),Jo(e,s,i))}function Of(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Jl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function yT(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const wT=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Jl()||Of())&&r.dom.focus(),yT()&&!Jl()&&!Of()&&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&&!$y(t.state.selection))return o(),!0;const a=Lf(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},xT=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),kT=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),By=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&&By(r)}return n};function wc(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 By(t)}function zy(n){return typeof n?.nodesBetween=="function"}function ja(n,e,t){if(zy(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),ja("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const c=new zc({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?xo.fromSchema(c).parseSlice(wc(n),t.parseOptions):xo.fromSchema(c).parse(wc(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=xo.fromSchema(e);return t.slice?i.parseSlice(wc(n),t.parseOptions).content:i.parse(wc(n),t.parseOptions)}return ja("",e,t)}function Fy(n){return!("type"in n)}function Hy(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof nr||s instanceof Dr))return;const i=n.mapping.maps[r];let o=0;i.forEach((a,c,u,d)=>{o===0&&(o=d)}),n.setSelection(Xt.near(n.doc.resolve(o),t))}const _T=(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{ja(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(m){c(m)}try{var o;a=ja(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=Fy(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(""):zy(e)?v=g.map(m=>{var C;return(C=m.text)!==null&&C!==void 0?C:""}).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),C=m.node(),$=m.parentOffset===0,M=C.isText||C.isTextblock,S=C.content.size>0;$&&M&&S&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}t.updateSelection&&Hy(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 Uy(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 ST=(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=Uy(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=ja(o,r.schema);h=u.createAndFill(f,p)}else h=u.createAndFill(f);return h?(t&&(e.insert(c.pos,h),a&&Hy(e,e.steps.length-1,-1)),!0):!1},CT=()=>({state:n,dispatch:e})=>BC(n,e),MT=()=>({state:n,dispatch:e})=>zC(n,e),TT=()=>({state:n,dispatch:e})=>Lb(n,e),ET=()=>({state:n,dispatch:e})=>zb(n,e),Vy=(n,e)=>{const t=n.resolve(e),r=t.nodeBefore,s=t.nodeAfter;return!r||!s?!1:!r.type.spec.isolating&&!s.type.spec.isolating},AT=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ju(n.doc,n.selection.$from.pos,-1);return r==null||!Vy(n.doc,r)?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},RT=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ju(n.doc,n.selection.$from.pos,1);return r==null||!Vy(n.doc,r)?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},PT=()=>({state:n,dispatch:e})=>Ob(n,e),IT=()=>({state:n,dispatch:e})=>Nb(n,e);function Wy(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function LT(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))Jl()||Wy()?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 OT=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=LT(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 Yi(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?Er(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=>lu(d.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=c}const NT=(n,e={})=>({state:t,dispatch:r})=>Yi(t,Er(n,t.schema),e)?FC(t,r):!1,DT=()=>({state:n,dispatch:e})=>Vb(n,e),$T=n=>({state:e,dispatch:t})=>{const r=Er(n,e.schema);return QC(r)(e,t)},BT=()=>({state:n,dispatch:e})=>Hb(n,e);function nd(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Qg(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 zT=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=nd(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=Er(n,r.schema)),a==="mark"&&(o=Zi(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,Qg(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(Qg(h.attrs,e))))})})}),c},FT=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),HT=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ws(n.doc);n.setSelection(t)}return!0},UT=()=>({state:n,dispatch:e})=>$b(n,e),VT=()=>({state:n,dispatch:e})=>Fb(n,e),WT=()=>({state:n,dispatch:e})=>WC(n,e),jT=()=>({state:n,dispatch:e})=>GC(n,e),KT=()=>({state:n,dispatch:e})=>KC(n,e);function cu(n,e,t={},r={}){return ja(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const GT=(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=cu(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});if(o){const d=Fy(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 jy(n,e){const t=Zi(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 Ky(n,e){const t=new Eb(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function aB(n,e){const t=[];return n.descendants((r,s)=>{e(r)&&t.push({node:r,pos:s})}),t}function qT(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function JT(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 rd(n){return e=>JT(e.$from,n)}function ht(n,e,t){return n.config[e]===void 0&&n.parent?ht(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ht(n.parent,e,t):null}):n.config[e]}function Dh(n){return n.map(e=>{const t=ht(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Dh(t())]:e}).flat(10)}function $h(n,e){const t=pa.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Gy(n,e){const t=new Map;for(const s of n){var r;const i=(r=t.get(s.type))!==null&&r!==void 0?r:new Map;i.set(s.name,s),t.set(s.type,i)}return[...Object.values(e.nodes),...Object.values(e.marks)].flatMap(s=>{var i;return Object.entries((i=s.spec.attrs)!==null&&i!==void 0?i:{}).map(([o,a])=>{var c;const u=(c=t.get(s.name))===null||c===void 0?void 0:c.get(o),d=Object.hasOwn(a,"default");return{type:s.name,name:o,attribute:{rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,...u?.attribute,default:a.default,isRequired:!d,validate:a.validate}}})})}const XT={content:"string",marks:"string",group:"string",inline:"boolean",atom:"boolean",selectable:"boolean",draggable:"boolean",code:"boolean",whitespace:["pre","normal"],definingAsContext:"boolean",definingForContent:"boolean",defining:"boolean",isolating:"boolean",linebreakReplacement:"boolean"},YT={inclusive:"boolean",excludes:"string",group:"string",spanning:"boolean",code:"boolean"};function QT(n,e,t){return Object.fromEntries(Object.entries(e).flatMap(([r,s])=>{const i=n[r];if(i===void 0)return[];if(!(typeof s=="string"?typeof i===s:typeof i=="string"&&s.includes(i)))throw new RangeError(`Invalid schemaSpec field '${t}.${r}'`);return[[r,i]]}))}function Zg(n,e,t,r){return{...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="attrs"&&!Object.hasOwn(r,s))),...QT(t,r,n),attrs:t.attrs}}function em(n,e,t){for(const r of Object.keys(e))if(!Object.hasOwn(n,r))throw new RangeError(`schemaSpec requires a local ${t} extension named '${r}'`);for(const r of Object.keys(n))if(!Object.hasOwn(e,r))throw new RangeError(`Local ${t} extension '${r}' is not in schemaSpec`)}function ZT(n,e){em(n.nodes,e.nodes,"node"),em(n.marks,e.marks,"mark");let t=e.spec.nodes,r=e.spec.marks;return e.spec.nodes.forEach((s,i)=>{t=t.update(s,Zg(s,n.nodes[s],i,XT))}),e.spec.marks.forEach((s,i)=>{r=r.update(s,Zg(s,n.marks[s],i,YT))}),{topNode:e.topNodeType.name,nodes:t,marks:r}}function qy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Ka(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function Bh(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ka(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=ht(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=ht(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 Nf(n){return typeof n=="function"}function wn(n,e=void 0,...t){return Nf(n)?e?n.bind(e)(...t):n(...t):n}function eE(n={}){return Object.keys(n).length===0&&n.constructor===Object}function tE(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 tm(n){const e=[],t=tE(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 xn(...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([...tm(r[s]),...tm(i)]);r[s]=Array.from(o.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[s]=i}),r},{})}function ca(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)=>xn(t,r),{})}function nE(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function nm(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):nE(t.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function rm(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&eE(t)?!1:t!=null))}function sm(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 im(n,e,t=Bh(n)){var r;const{nodeExtensions:s,markExtensions:i}=Ka(n);return{topNode:(r=s.find(o=>ht(o,"topNode")))===null||r===void 0?void 0:r.name,nodes:Object.fromEntries(s.map(o=>{const a=t.filter(p=>p.type===o.name),c={name:o.name,options:o.options,storage:o.storage,editor:e},u=rm({...n.reduce((p,g)=>{const v=ht(g,"extendNodeSchema",c);return{...p,...v?v(o):{}}},{}),content:wn(ht(o,"content",c)),marks:wn(ht(o,"marks",c)),group:wn(ht(o,"group",c)),inline:wn(ht(o,"inline",c)),atom:wn(ht(o,"atom",c)),selectable:wn(ht(o,"selectable",c)),draggable:wn(ht(o,"draggable",c)),code:wn(ht(o,"code",c)),whitespace:wn(ht(o,"whitespace",c)),linebreakReplacement:wn(ht(o,"linebreakReplacement",c)),defining:wn(ht(o,"defining",c)),isolating:wn(ht(o,"isolating",c)),attrs:Object.fromEntries(a.map(sm))}),d=wn(ht(o,"parseHTML",c));d&&(u.parseDOM=d.map(p=>nm(p,a)));const f=ht(o,"renderHTML",c);f&&(u.toDOM=p=>f({node:p,HTMLAttributes:ca(p,a)}));const h=ht(o,"renderText",c);return h&&(u.toText=h),[o.name,u]})),marks:Object.fromEntries(i.map(o=>{const a=t.filter(h=>h.type===o.name),c={name:o.name,options:o.options,storage:o.storage,editor:e},u=rm({...n.reduce((h,p)=>{const g=ht(p,"extendMarkSchema",c);return{...h,...g?g(o):{}}},{}),inclusive:wn(ht(o,"inclusive",c)),excludes:wn(ht(o,"excludes",c)),group:wn(ht(o,"group",c)),spanning:wn(ht(o,"spanning",c)),code:wn(ht(o,"code",c)),attrs:Object.fromEntries(a.map(sm))}),d=wn(ht(o,"parseHTML",c));d&&(u.parseDOM=d.map(h=>nm(h,a)));const f=ht(o,"renderHTML",c);return f&&(u.toDOM=h=>f({mark:h,HTMLAttributes:ca(h,a)})),[o.name,u]}))}}function rE(n,e,t){if(t===void 0)return new zc(im(n,e));const r=qy(n.filter(o=>o.type!=="extension").map(o=>o.name));if(r.length)throw new RangeError(`Duplicate local schema types: ${r.join(", ")}`);const s=new zc(t),i=im(n,e,Gy(Bh(n),s));return new zc(ZT(i,s))}function Pl(n){return n.sort((t,r)=>{const s=ht(t,"priority")||100,i=ht(r,"priority")||100;return s>i?-1:s<i?1:0})}function Jy(n){const e=Pl(Dh(n)),t=qy(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 zh(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=`
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 sE(n,e){return zh(n,{from:0,to:n.content.size},e)}function Fh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function iE(n,e){const t=Er(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 Xy(n,e){const t=nd(typeof e=="string"?e:e.name,n.schema);return t==="node"?iE(n,e):t==="mark"?jy(n,e):{}}function oE(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 aE(n){const e=oE(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 sd(n){const{mapping:e,steps:t}=n,r=[],s=e.invert();return e.maps.forEach((i,o)=>{const a=[];if(i.ranges.length)i.forEach((u,d)=>{a.push({from:u,to:d})});else{const{from:u,to:d}=t[o];if(u===void 0||d===void 0)return;a.push({from:u,to:d})}const c=e.slice(o);a.forEach(({from:u,to:d})=>{const f=c.map(u,-1),h=c.map(d),p=s.map(f,-1),g=s.map(h);r.push({oldRange:{from:p,to:g},newRange:{from:f,to:h}})})}),aE(r)}function id(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=Nh(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 lE=(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]},cE=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 Ma(n,e){return e.nodes[n]||e.marks[n]||null}function Vc(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 uE=(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 Df(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?Zi(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>lu(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),C=Math.min(p,v+g.nodeSize),$=C-m;o+=$,a.push(...g.marks.map(M=>({mark:M,from:m,to:C})))})}),o===0)return!1;const c=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>lu(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 dE(n,e,t={}){if(!e)return Yi(n,null,t)||Df(n,null,t);const r=nd(e,n.schema);return r==="node"?Yi(n,e,t):r==="mark"?Df(n,e,t):!1}const fE=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=rd(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)},hE=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function om(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function pl(n,e){const{nodeExtensions:t}=Ka(e),r=t.find(i=>i.name===n);if(!r)return!1;const s=wn(ht(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function cc(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&&(cc(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function Yy(n){return n instanceof wt}function pE(n){if(n===null||typeof n!="object")return!1;const e=n;return!(typeof e.apply!="function"||typeof e.getMap!="function"||typeof e.invert!="function"||typeof e.map!="function"||typeof e.merge!="function"||typeof e.toJSON!="function")}function gE(n){if(n===null||typeof n!="object")return!1;const e=n;if(!pE(e))return!1;const t=e.toJSON();return!(t===null||typeof t!="object"||t.stepType!=="replace")}var Qy=class Zy{constructor(e){this.position=e}static fromJSON(e){return new Zy(e.position)}toJSON(){return{position:this.position}}};function mE(n,e){const t=e.mapping.mapResult(n.position);return{position:new Qy(t.pos),mapResult:t}}function vE(n){return new Qy(n)}function bE(n,e,t){const{selection:r}=e;let s=null;if($y(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 yE=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:a}=i,c=Zi(n,r.schema);if(s)if(o){const u=jy(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 bE(r,t,c)},wE=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),xE=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=Er(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})=>vg(i,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>vg(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},kE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Jo(n,0,r.content.size),i=wt.create(r,s);e.setSelection(i)}return!0},_E=(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},SE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=Xe.atStart(r).from,a=Xe.atEnd(r).to,c=Jo(s,o,a),u=Jo(i,o,a),d=Xe.create(r,c,u);e.setSelection(d)}return!0},CE=n=>({state:e,dispatch:t})=>{const r=Er(n,e.schema);return tM(r)(e,t)};function am(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 ME=({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=Vc(u,a.node().type.name,a.node().attrs);if(i instanceof wt&&i.node.isBlock)return!a.parentOffset||!Gi(o,a.pos)?!1:(r&&(n&&am(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:Uy(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0;const g=i instanceof Xe&&!i.empty?Wi.create({doc:e.doc,selection:i}).tr.deleteSelection():null,v=g?g.doc:e.doc,m=g?g.mapping.map(a.pos):a.pos;let C=Gi(v,m,1,p);if(!p&&!C&&Gi(v,m,1,h?[{type:h}]:void 0)&&(C=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(C){const $=e.steps.length;if(i instanceof Xe&&e.deleteSelection(),e.split(e.mapping.slice($).map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h){const M=e.mapping.slice($).map(a.before()),S=e.doc.resolve(M);a.node(-1).canReplaceWith(S.index(),S.index()+1,h)&&e.setNodeMarkup(e.mapping.slice($).map(a.before()),h)}}n&&am(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return C},TE=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{const o=Er(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 D=a.index(-1)?1:a.index(-2)?2:3;for(let ie=a.depth-D;ie>=a.depth-3;ie-=1)S=_e.from(a.node(ie).copy(S));const I=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...Vc(f,a.node().type.name,a.node().attrs),...e},L=((h=o.contentMatch.defaultType)===null||h===void 0?void 0:h.createAndFill(E))||void 0;S=S.append(_e.from(o.createAndFill(null,L)||void 0));const ee=a.before(a.depth-(D-1));t.replace(ee,a.after(-I),new We(S,4-D,0));let U=-1;t.doc.nodesBetween(ee,t.doc.content.size,(ie,F)=>{if(U>-1)return!1;ie.isTextblock&&ie.content.size===0&&(U=F+1)}),U>-1&&t.setSelection(Xe.near(t.doc.resolve(U))),t.scrollIntoView()}return!0}const p=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,g={...Vc(f,d.type.name,d.attrs),...e},v={...Vc(f,a.node().type.name,a.node().attrs),...e},m=a.parentOffset===0&&a.index(-1)===0,C=a.before(-1);t.delete(a.pos,c.pos);const $=m?d.attrs:g,M=p?[{type:o,attrs:$},{type:p,attrs:v}]:[{type:o,attrs:$}];if(!Gi(t.doc,a.pos,2))return!1;if(s){const{selection:S,storedMarks:D}=r,{splittableMarks:I}=i.extensionManager,E=D||S.$to.parentOffset&&S.$from.marks();if(t.split(a.pos,2,M).scrollIntoView(),m&&t.setNodeMarkup(C,void 0,g),!E||!s)return!0;const L=E.filter(ee=>I.includes(ee.type.name));t.ensureMarks(L)}return!0};function e0(n,e,t){if(!n.validContent(e))return null;try{return n.create(t,e)}catch{return null}}function Hh(n,e){if(n.pendingContent.length===0)return!0;const t=e0(e,_e.from(n.pendingContent));return t?(n.items.push(t),n.pendingContent=[],!0):!1}function EE(n,e,t){return t.validContent(_e.from([...e.pendingContent,n]))?(e.pendingContent.push(n),!0):!Hh(e,t)||!t.validContent(_e.from(n))?!1:(e.pendingContent.push(n),!0)}function AE(n,e,t,r){const s=r(n,t);if(!s)return!1;const i=e0(t.listType,_e.from(s),n.attrs);return i?t.itemType.validContent(_e.from([...e.pendingContent,i]))?(e.pendingContent.push(i),!0):Hh(e,t.itemType)?(e.items.push(...s),!0):!1:!1}function RE(n,e,t){const r={items:[],pendingContent:[]};for(let s=0;s<n.childCount;s+=1){const i=n.child(s);if(!(e.isListNode(i)?AE(i,r,e,t):EE(i,r,e.itemType)))return null}return Hh(r,e.itemType)?r.items:null}function t0(n,e){const t=[];for(let r=0;r<n.childCount;r+=1){const s=RE(n.child(r),e,t0);if(!s)return null;t.push(...s)}return t}function lm(n,e){let t=null;return n.descendants((r,s)=>r!==e?!0:(t=s,!1)),t}function cm(n){return!n||n==="1"?null:n}function n0(n,e){return cm(n)===cm(e)}const xc=(n,e)=>{const t=rd(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&&Po(n.doc,t.pos))||!n0(t.node.attrs.type,s?.attrs.type)||n.join(t.pos),!0},kc=(n,e)=>{const t=rd(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&&Po(n.doc,r))||!n0(t.node.attrs.type,s?.attrs.type)||n.join(r),!0};function PE(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return Xe.between(r,s)}const IE=(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=Er(n,o.schema),g=Er(e,o.schema),{selection:v,storedMarks:m}=o,{$from:C,$to:$}=v,M=C.blockRange($),S=m||v.$to.parentOffset&&v.$from.marks();if(!M)return!1;const D=rd(Y=>pl(Y.type.name,f))(v),I=v.from===0&&v.to===o.doc.content.size,E=o.doc.content.content,L=E.length===1?E[0]:null,ee=I&&L&&pl(L.type.name,f)?{node:L,pos:0}:null,U=D??ee,ie=!!D&&M.depth>=1&&M.depth-D.depth<=1,F=!!ee;if((ie||F)&&U){if(U.node.type===p)return I&&F?c().command(({tr:Y,dispatch:ce})=>{const pe=PE(Y);return pe?(Y.setSelection(pe),ce&&ce(Y),!0):!1}).liftListItem(g).run():u.liftListItem(g);if(pl(U.node.type.name,f)&&p.validContent(U.node.content))return c().command(()=>(i.setNodeMarkup(U.pos,p),!0)).command(()=>xc(i,p)).command(()=>kc(i,p)).run();if(pl(U.node.type.name,f)){var W;const Y=(W=U.node.firstChild)===null||W===void 0?void 0:W.type;if(Y&&Y!==g){const ce=t0(U.node,{listType:p,itemType:g,isListNode:j=>pl(j.type.name,f)}),pe=ce?_e.from(ce):null;return!pe||!p.validContent(pe)?!1:c().command(()=>{const{$anchor:j,$head:ue}=i.selection,P=j.parent,z=ue.parent,le=j.parentOffset,ge=ue.parentOffset;let ye;try{ye=p.create(r,pe)}catch{return!1}if(i.replaceWith(U.pos,U.pos+U.node.nodeSize,ye),P.inlineContent&&z.inlineContent){const Z=lm(ye,P),oe=lm(ye,z);if(Z!==null&&oe!==null){const V=U.pos+Z+2+le,G=U.pos+oe+2+ge;i.setSelection(Xe.create(i.doc,V,G))}}return!0}).command(()=>xc(i,p)).command(()=>kc(i,p)).run()}}}return!t||!S||!a?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>xc(i,p)).command(()=>kc(i,p)).run():c().command(()=>{const Y=d().wrapInList(p,r),ce=S.filter(pe=>h.includes(pe.type.name));return i.ensureMarks(ce),Y?!0:u.clearNodes()}).wrapInList(p,r).command(()=>xc(i,p)).command(()=>kc(i,p)).run()},LE=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=Zi(n,r.schema);return Df(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},OE=(n,e,t={})=>({state:r,commands:s})=>{const i=Er(n,r.schema),o=Er(e,r.schema),a=Yi(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})},NE=(n,e={})=>({state:t,commands:r})=>{const s=Er(n,t.schema);return Yi(t,s,e)?r.lift(s):r.wrapIn(s,e)},DE=()=>({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},$E=(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},BE=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=t,a=Zi(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=Nh(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},zE=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},FE=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=nd(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=Er(n,r.schema)),a==="mark"&&(o=Zi(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,C)=>{i&&i===m.type&&(c=!0,g=Math.max(C,d),v=Math.min(C+m.nodeSize,f),h=C,p=m)}):r.doc.nodesBetween(d,f,(m,C)=>{C<d&&i&&i===m.type&&(c=!0,g=Math.max(C,d),v=Math.min(C+m.nodeSize,f),h=C,p=m),C>=d&&C<=f&&(i&&i===m.type&&(c=!0,s&&t.setNodeMarkup(C,void 0,{...m.attrs,...e})),o&&m.marks.length&&m.marks.forEach($=>{if(o===$.type&&(c=!0,s)){const M=Math.max(C,d),S=Math.min(C+m.nodeSize,f);t.addMark(M,S,o.create({...$.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},La=new Wn("__tiptap_decorations__"),HE=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(La,{type:"force",name:n}),!0),UE=(n,e={})=>({state:t,dispatch:r})=>{const s=Er(n,t.schema);return qC(s,e)(t,r)},VE=(n,e={})=>({state:t,dispatch:r})=>{const s=Er(n,t.schema);return JC(s,e)(t,r)};var WE=US({blur:()=>rT,clearContent:()=>sT,clearNodes:()=>iT,command:()=>oT,createParagraphNear:()=>aT,cut:()=>lT,deleteCurrentNode:()=>cT,deleteNode:()=>uT,deleteRange:()=>dT,deleteSelection:()=>pT,enter:()=>gT,exitCode:()=>mT,extendMarkRange:()=>vT,first:()=>bT,focus:()=>wT,forEach:()=>xT,insertContent:()=>kT,insertContentAt:()=>_T,insertDefaultBlock:()=>ST,joinBackward:()=>TT,joinDown:()=>MT,joinForward:()=>ET,joinItemBackward:()=>AT,joinItemForward:()=>RT,joinTextblockBackward:()=>PT,joinTextblockForward:()=>IT,joinUp:()=>CT,keyboardShortcut:()=>OT,lift:()=>NT,liftEmptyBlock:()=>DT,liftListItem:()=>$T,newlineInCode:()=>BT,resetAttributes:()=>zT,scrollIntoView:()=>FT,selectAll:()=>HT,selectNodeBackward:()=>UT,selectNodeForward:()=>VT,selectParentNode:()=>WT,selectTextblockEnd:()=>jT,selectTextblockStart:()=>KT,setContent:()=>GT,setMark:()=>yE,setMeta:()=>wE,setNode:()=>xE,setNodeSelection:()=>kE,setTextDirection:()=>_E,setTextSelection:()=>SE,sinkListItem:()=>CE,splitBlock:()=>ME,splitListItem:()=>TE,toggleList:()=>IE,toggleMark:()=>LE,toggleNode:()=>OE,toggleWrap:()=>NE,undoInputRule:()=>DE,unsetAllMarks:()=>$E,unsetMark:()=>BE,unsetTextDirection:()=>zE,updateAttributes:()=>FE,updateDecorations:()=>HE,wrapIn:()=>UE,wrapInList:()=>VE});const gl=new WeakMap;function jE(n,e){var t;gl.set(n,((t=gl.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const s=((r=gl.get(n))!==null&&r!==void 0?r:1)-1;s>0?gl.set(n,s):gl.delete(n)}}var KE=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 GE(n){return n.kind==="widget"}function r0(n,e){const t=[],r=new Set;for(const s of n)s.kind==="widget"&&GE(s)&&r.add(s.key),t.push(s.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function qE(n,e,t){const{decorations:r,widgetKeys:s}=r0(e,t);return{set:rn.create(n,r),widgetKeys:s}}function s0({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function JE({decorations:n,from:e,to:t,docSize:r,extensionName:s,warnedExtensions:i}){return n.filter(o=>s0({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 XE(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function i0(n){return n.jsonID==="attr"}function YE(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||i0(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function QE(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 ZE(n,e){if(n.steps.some(i=>!YE(i)))return{type:"full"};const t=sd(n).map(({newRange:i})=>i);n.steps.forEach((i,o)=>{if(!i0(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=QE(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 o0(n,e,t,r){return n.map(e,t,{onRemove:s=>{const i=s?.key;typeof i=="string"&&r.delete(i)}})}function eA(n,e,t){var r,s;const i=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:rn.empty,o=new Set((s=e.widgetKeysByExtension[n])!==null&&s!==void 0?s:[]);return{set:o0(i,t.mapping,t.doc,o),widgetKeys:o}}function um(n,e){const t=Object.values(e).flatMap(r=>r.find());return rn.create(n,t)}function dm(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function tA(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 nA(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const rA=new Set;var sA=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=La.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>tA(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=La.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:rA}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 An({key:La,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:dm(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,s,i)=>{const o=t.getMeta(La),a=o?.type==="force"&&!o.name,c=o?.type==="force"?o.name:void 0,u={},d={},f=new Set;return jE(n,()=>{for(const{name:h,spec:p}of e){const g=a||c===h;if(nA(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=eA(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:dm(d)}}},props:{decorations(t){var r,s;return(r=(s=La.getState(t))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:rn.empty}}})}applyChangedRangesRecompute(n,e,t,r,s){const i=ZE(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:rn.empty,u=new Set((a=t.widgetKeysByExtension[n])!==null&&a!==void 0?a:[]);let d=o0(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(C=>s0({position:C.from,from:h,to:p,docSize:f}));for(const C of g){const $=XE(C);$&&u.delete($)}d=d.remove(g);const{decorations:v,widgetKeys:m}=r0(JE({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 C of m)u.add(C)}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 qE(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]]:um(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):um(t.doc,r)}};function iA(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof wt){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 oA(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 fm(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function aA(n){return typeof n=="number"}function lA(n){return Object.prototype.toString.call(n).slice(8,-1)}function _c(n){return lA(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function lB(n){return typeof n=="string"&&n.trim().length>0&&!/[;{}]/.test(n)}function Uh(n){return/\s/.test(n)}function a0(n){return/^\w$/.test(n)}function cA(n,e){for(;e<n.length&&Uh(n[e]);)e+=1;return e}function od(n,e){for(;e<n.length&&!Uh(n[e]);)e+=1;return e}function uA(n,e,t){for(;e<n.length&&(a0(n[e])||t);)e+=1;return e}function dA(n,e){const t=n.indexOf(n[e],e+1);return{nextIndex:od(n,t===-1?e:t+1)}}function fA(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:od(n,o+1)}}function hA(n,e,t){const r=t==="pandoc",s=uA(n,e+1,r),i=n.slice(e,s),o=fA(n,i,s);if(o)return o;const a=s===n.length||Uh(n[s]);return{token:r&&a?{type:"boolean",name:i}:void 0,nextIndex:t==="shortcode"?od(n,s):s}}function pA(n,e,t){const r=n[e];return r==='"'||r==="'"?dA(n,e):a0(r)?hA(n,e,t):{nextIndex:od(n,e)}}function gA(n,e){const t=[];let r=0;for(;r<n.length&&(r=cA(n,r),!(r>=n.length));){const s=pA(n,r,e);s.token&&t.push(s.token),r=s.nextIndex}return t}function mA(n){const e={};return gA(n,"shortcode").forEach(t=>{t.type==="keyValue"&&(e[t.name]=t.value)}),e}function vA(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function bA(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=mA,serializeAttributes:i=vA,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 C=h[v];if(m!==void 0&&C===m)return;p[v]=C}}),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 C="",$="";if(a){const[,S]=m;$=S}else{const[,S,D]=m;$=S,C=D||""}const M=s($.trim());return{type:e,raw:m[0],content:C.trim(),attributes:M}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(C=>C.type==="text").map(C=>C.text).join(""));const g=d(h.attrs||{}),v=i(g),m=v?` ${v}`:"";return a?`[${u}${m}]`:`[${u}${m}]${p}[/${u}]`}}}function yA(n,e){return n.replace(/^[ \t]*/,t=>{let s=0;for(const i of t)s+=i===" "?4-s%4:1;return" ".repeat(Math.max(0,s-e))})}function wA(n,e){const t=`text
16
- ${n}
17
- `,r=e(t)[0];return(r?.type==="paragraph"||r?.type==="text")&&r.raw===t}function xA(n,e,t){var r;const s=e.split(`
18
- `),i=(r=t.isParagraphContinuation)!==null&&r!==void 0?r:(a=>wA(a,t.blockTokens));let o=0;for(const a of s){if(!a.trim()||!i(a))break;o+=1}return{mainContent:[n,...s.slice(0,o).map(a=>a.trimStart())].join(`
19
- `),nestedContent:s.slice(o).join(`
20
- `)}}function hm(n,e,t){const r=n.split(`
21
- `),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}
22
- `;continue}else return}const h=e.extractItemData(f),{indentLevel:p,mainContent:g}=h;i=`${i}${d}
23
- `;const v=[g];for(o+=1;o<r.length;){var c;const M=r[o];if(M.trim()===""){var u;const S=r.slice(o+1).findIndex(D=>D.trim()!=="");if(S===-1)break;if((((u=r[o+1+S].match(/^(\s*)/))===null||u===void 0||(u=u[1])===null||u===void 0?void 0:u.length)||0)>p){v.push(M),i=`${i}${M}
24
- `,o+=1;continue}else break}if((((c=M.match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>p)v.push(M),i=`${i}${M}
25
- `,o+=1;else break}let m;const C=v.slice(1);if(C.length>0){const M=xA(g,C.map(D=>yA(D,p+a)).join(`
26
- `),t);h.mainContent=M.mainContent;const S=M.nestedContent;S.trim()&&(e.customNestedParser?m=e.customNestedParser(S):m=t.blockTokens(S))}const $=e.createToken(h,m);s.push($)}if(s.length!==0)return{items:s,raw:i.slice(0,n.length)}}const pm=4;function gm(n){let e=0;for(const t of n)e=t===" "?e+pm-e%pm:e+1;return e}function l0(n,e,t,r,s){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[o,...a]=n.content,c=e.renderChildren([o]);let u=`${i}${s?.indentMainContent?c.split(`
27
- `).map((d,f)=>f===0?d:e.indent(d)).join(`
28
- `):c}`;return a&&a.length>0&&a.forEach((d,f)=>{var h,p;const g=(h=(p=e.renderChild)===null||p===void 0?void 0:p.call(e,d,f+1))!==null&&h!==void 0?h:e.renderChildren([d]);if(g!=null){const v=C=>{if(!s?.alignNestedToPrefix)return e.indent(C);const $=e.indent(""),M=gm(i);return(gm($)>=M?$:" ".repeat(M))+C},m=g.split(`
29
- `).map(C=>v(C||"")).join(`
30
- `);u+=d.type==="paragraph"?`
31
-
32
- ${m}`:`
33
- ${m}`}}),u}function c0(n,e){const t={...n};return _c(n)&&_c(e)&&Object.keys(e).forEach(r=>{_c(e[r])&&_c(n[r])?t[r]=c0(n[r],e[r]):t[r]=e[r]}),t}function kA(n,e,t={}){const{state:r}=e,{doc:s,tr:i}=r,o=n;s.descendants((a,c)=>{const u=i.mapping.map(c),d=i.mapping.map(c)+a.nodeSize;let f=null;if(a.marks.forEach(p=>{if(p!==o)return!1;f=p}),!f)return;let h=!1;if(Object.keys(t).forEach(p=>{t[p]!==f.attrs[p]&&(h=!0)}),h){const p=n.type.create({...n.attrs,...t});i.removeMark(u,d,n.type),i.addMark(u,d,p)}}),i.docChanged&&e.view.dispatch(i)}var uc=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!==null&&e!==void 0?e:!0}};const _A=(n,e)=>{if(Oh(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function SA(n){const{editor:e,from:t,to:r,text:s,insertText:i}=n;if(!i)return{inputTransaction:null,tr:e.view.state.tr};const o=e.view.state.tr.insertText(s,t,r);return{inputTransaction:o,tr:Wi.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function CA(n){const{editor:e,from:t,to:r,text:s,rule:i,match:o,plugin:a,insertText:c}=n,{view:u}=e,{inputTransaction:d,tr:f}=SA({editor:e,from:t,to:r,text:s,insertText:c}),h=d?t+s.length:r,p=td({state:u.state,transaction:f}),g={from:t-(o[0].length-s.length),to:h},{commands:v,chain:m,can:C}=new $a({editor:e,state:p});return i.handler({state:p,range:g,match:o,commands:v,chain:m,can:C})===null||!f.steps.length?!1:(d&&(u.dispatch(d),!u.state.doc.eq(d.doc))||(eT(f),f.setMeta("inputRule",!0),i.undoable&&f.setMeta(a,{transform:f,from:t,to:h,text:s}),u.dispatch(f)),!0)}function MA(n,e,t){const r=e[0].length-t.length;if(r<=0)return!0;const s=n.parentOffset-r;return s>=0&&n.parent.textBetween(s,n.parentOffset)===e[0].slice(0,r)}function Sc(n){var e;const{editor:t,from:r,to:s,text:i,rules:o,plugin:a,insertText:c}=n,{view:u}=t;if(u.composing)return!1;const d=u.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;const f=uE(d)+i;for(const h of o){const p=_A(f,h.find);if(!(!p||!MA(d,p,i))&&CA({editor:t,from:r,to:s,text:i,rule:h,match:p,plugin:a,insertText:c}))return!0}return!1}function TA(n){const{editor:e,rules:t}=n,r=new An({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const c=s.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=$h(_e.from(u),o.schema);const{from:d}=c,f=d+u.length;Sc({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return Sc({editor:e,from:i,to:o,text:a,rules:t,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Sc({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Sc({editor:e,from:o.pos,to:o.pos,text:`
34
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}var Vh=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...wn(ht(this,"addOptions",{name:this.name}))}}get storage(){return{...wn(ht(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>c0(this.options,n)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},ga=class u0 extends Vh{constructor(...e){super(...e),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new u0(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!i.find(a=>a?.type.name===t.name))return!1;const o=i.find(a=>a?.type.name===t.name);return o&&r.removeStoredMark(o),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},d0=class{constructor(n){this.find=n.find,this.handler=n.handler}};const EA=(n,e,t)=>{if(Oh(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=n,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function AA(n){const{editor:e,state:t,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=n,{commands:c,chain:u,can:d}=new $a({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,s,(h,p)=>{var g,v,m,C;if(!((g=h.type)===null||g===void 0||(g=g.spec)===null||g===void 0)&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const $=(v=(m=(C=h.content)===null||C===void 0?void 0:C.size)!==null&&m!==void 0?m:h.nodeSize)!==null&&v!==void 0?v:0,M=Math.max(r,p),S=Math.min(s,p+$);if(M>=S)return;const D=h.isText?h.text||"":h.textBetween(M-p,S-p,void 0,"");EA(D,i.find,o).forEach(I=>{if(I.index===void 0)return;const E=M+I.index+1,L=E+I[0].length,ee={from:t.tr.mapping.map(E),to:t.tr.mapping.map(L)},U=i.handler({state:t,range:ee,match:I,commands:c,chain:u,can:d,pasteEvent:o,dropEvent:a});f.push(U)})}),f.every(h=>h!==null)}let Ta=null;const RA=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function PA(n){const{editor:e,rules:t}=n;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const g=u.tr,v=td({state:u,transaction:g});if(!(!AA({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return e.on("destroy",()=>{Ta===e&&(Ta=null)}),t.map(u=>new An({view(d){const f=p=>{var g;r=!((g=d.dom.parentElement)===null||g===void 0)&&g.contains(p.target)?d.dom.parentElement:null,r&&(Ta=e)},h=()=>{Ta&&(Ta=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const h=Ta;h?.isEditable&&setTimeout(()=>{if(h.isDestroyed)return;const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=f,s=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!s,v=p.getMeta("uiEvent")==="drop"&&!i,m=p.getMeta("applyPasteRules"),C=!!m;if(!g&&!v&&!C)return;if(C){let{text:S}=m;typeof S=="string"?S=S:S=$h(_e.from(S),h.schema);const{from:D}=m,I=D+S.length,E=RA(S);return c({rule:u,state:h,from:D,to:{b:I},pasteEvt:E})}const $=f.doc.content.findDiffStart(h.doc.content),M=f.doc.content.findDiffEnd(h.doc.content);if(!(!aA($)||!M||$===M.b))return c({rule:u,state:h,from:$,to:M,pasteEvt:o})}}))}var ad=class{constructor(n,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=n,this.extensions=Jy(n),this.hasSchemaSpec=e.options.schemaSpec!==void 0,this.schema=rE(this.extensions,e,e.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t=ht(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ma(e.name,this.schema)});return t?{...n,...t()}:n},{})}get plugins(){const{editor:n}=this,e=Pl([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Ma(r.name,this.schema)},i=[],o=ht(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&ht(r,"exitable",s)&&(a.ArrowRight=()=>ga.handleExit({editor:n,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([p,g])=>[p,()=>g({editor:n})]));a={...a,...h}}const c=K2(a);i.push(c);const u=ht(r,"addInputRules",s);if(om(r,n.options.enableInputRules)&&u){const h=u();if(h&&h.length){const p=TA({editor:n,rules:h}),g=Array.isArray(p)?p:[p];i.push(...g)}}const d=ht(r,"addPasteRules",s);if(om(r,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const p=PA({editor:n,rules:h});i.push(...p)}}const f=ht(r,"addProseMirrorPlugins",s);if(f){const h=f();i.push(...h)}return i}),t=this.createDecorationPlugin();return t&&e.push(t),e}createDecorationPlugin(){var n;const{editor:e}=this;(n=this.decorationManager)===null||n===void 0||n.destroy();const t=[];return this.extensions.forEach(r=>{const s=ht(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Ma(r.name,this.schema)});s&&t.push({name:r.name,addDecorations:s})}),this.decorationManager=new sA({editor:e,entries:t}),this.decorationManager.plugin}get attributes(){const n=Bh(this.extensions);return this.hasSchemaSpec?Gy(n,this.schema):n}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Ka(this.extensions);return Object.fromEntries(e.filter(t=>!!ht(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),s=ht(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Er(t.name,this.schema)});if(!s)return[];const i=s();if(!i)return[];const o=(a,c,u,d,f)=>{const h=ca(a,r);return i({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:n,extension:t,HTMLAttributes:h})};return[t.name,o]}))}dispatchTransaction(n){const{editor:e}=this;return Pl([...this.extensions].reverse()).reduceRight((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Ma(r.name,this.schema)},i=ht(r,"dispatchTransaction",s);return i?o=>{i.call(s,{transaction:o,next:t})}:t},n)}transformPastedHTML(n){const{editor:e}=this;return Pl([...this.extensions]).reduce((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Ma(r.name,this.schema)},i=ht(r,"transformPastedHTML",s);return i?(o,a)=>{const c=t(o,a);return i.call(s,c)}:t},n||(t=>t))}get markViews(){const{editor:n}=this,{markExtensions:e}=Ka(this.extensions);return Object.fromEntries(e.filter(t=>!!ht(t,"addMarkView")).map(t=>{const r=this.attributes.filter(o=>o.type===t.name),s=ht(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Zi(t.name,this.schema)});if(!s)return[];const i=(o,a,c)=>{const u=ca(o,r);return s()({mark:o,view:a,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{kA(o,n,d)}})};return[t.name,i]}))}destroy(){var n;(n=this.decorationManager)===null||n===void 0||n.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){const r=t.parent;r.child===t&&(r.child=null),t=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ma(e.name,this.schema)};if(e.type==="mark"){var r,s;(!((r=wn(ht(e,"keepOnSplit",t)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((s=wn(ht(e,"clearable",t)))!==null&&s!==void 0)||s||this.nonClearableMarks.push(e.name)}const i=ht(e,"onBeforeCreate",t),o=ht(e,"onCreate",t),a=ht(e,"onUpdate",t),c=ht(e,"onSelectionUpdate",t),u=ht(e,"onTransaction",t),d=ht(e,"onFocus",t),f=ht(e,"onBlur",t),h=ht(e,"onDestroy",t);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}};ad.resolve=Jy;ad.sort=Pl;ad.flatten=Dh;var Kn=class f0 extends Vh{constructor(...e){super(...e),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new f0(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};const IA=Kn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new An({key:new Wn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,i=Fh(t),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((c,u)=>c.$from.pos-u.$from.pos).map(({$from:c,$to:u})=>zh(r,{from:c.pos,to:u.pos},a)).join(o??`
35
-
36
- `)}}})]}}),LA=Kn.create({name:"commands",addCommands(){return{...WE}}}),OA=Kn.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r;const s=()=>{var i,o,a;if((i=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(a=o.filterTransaction)===null||a===void 0?void 0:a.call(o,n))!==null&&i!==void 0?i:n.getMeta("y-sync$"))return;const c=Ky(n.before,[n,...e]);sd(c).forEach(d=>{c.mapping.mapResult(d.oldRange.from).deletedAfter&&c.mapping.mapResult(d.oldRange.to).deletedBefore&&c.before.nodesBetween(d.oldRange.from,d.oldRange.to,(f,h)=>{const p=h+f.nodeSize-2,g=d.oldRange.from<=h&&p<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:f,from:h,to:p,newFrom:c.mapping.map(h),newTo:c.mapping.map(p),deletedRange:d.oldRange,newRange:d.newRange,partial:!g,editor:this.editor,transaction:n,combinedTransform:c})})});const u=c.mapping;c.steps.forEach((d,f)=>{if(d instanceof hi){var h,p;const g=u.slice(f).map(d.from,-1),v=u.slice(f).map(d.to),m=u.invert().map(g,-1),C=u.invert().map(v),$=g>0?(h=c.doc.nodeAt(g-1))===null||h===void 0?void 0:h.marks.some(S=>S.eq(d.mark)):!1,M=(p=c.doc.nodeAt(v))===null||p===void 0?void 0:p.marks.some(S=>S.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:m,to:C},newRange:{from:g,to:v},partial:!!(M||$),editor:this.editor,transaction:n,combinedTransform:c})}})};!((t=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&t!==void 0)||t?setTimeout(s,0):s()}}),NA=Kn.create({name:"drop",addProseMirrorPlugins(){return[new An({key:new Wn("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),DA=Kn.create({name:"editable",addProseMirrorPlugins(){return[new An({key:new Wn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),$A=new Wn("focusEvents"),BA=Kn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new An({key:$A,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),zA=Kn.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:c,doc:u}=a,{empty:d,$anchor:f}=c,{pos:h,parent:p}=f,g=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,v=g.parent.type.spec.isolating,m=f.pos-f.parentOffset,C=v&&g.parent.childCount===1?m===f.pos:Xt.atStart(u).from===h;return!d||!p.type.isTextblock||p.textContent.length||!C||C&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Jl()||Wy()?i:s},addProseMirrorPlugins(){return[new An({key:new Wn("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(p=>p.getMeta("composition")))return;const r=n.some(p=>p.docChanged)&&!e.doc.eq(t.doc),s=n.some(p=>p.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,c=Xt.atStart(e.doc).from,u=Xt.atEnd(e.doc).to;if(i||!(o===c&&a===u)||!cc(t.doc))return;const d=t.tr,f=td({state:t,transaction:d}),{commands:h}=new $a({editor:this.editor,state:f});if(h.clearNodes(),!!d.steps.length)return d}})]}}),FA=Kn.create({name:"paste",addProseMirrorPlugins(){return[new An({key:new Wn("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),HA=Kn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new An({key:new Wn("tabindex"),props:{attributes:()=>{var n;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(n=this.options.value)!==null&&n!==void 0?n:"0"}}}})]}}),UA=Kn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Ka(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new An({key:new Wn("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let mm=!1;function VA(n){if(mm)return;mm=!0;let e;try{const t=nr.fromJSON(n,{from:0,to:0});if(!gE(t))return;e=t.slice.content}catch{return}e instanceof _e||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var WA=class xl{get name(){return this.node.type.name}constructor(e,t,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new xl(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new xl(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new xl(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const s=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,o=t.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(a);if(!s&&!o&&c.depth<=this.depth)return;const u=new xl(c,this.editor,s,s||o?t:null);s&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(t).length>0){const i=s.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const c=o[a];if(i[c]!==t[c])break}}else r=s;s=s.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(t);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(a=>t[a]===o.node.attrs[a])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,t,r))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};const jA=`.ProseMirror {
37
- position: relative;
38
- }
39
-
40
- .ProseMirror {
41
- word-wrap: break-word;
42
- white-space: pre-wrap;
43
- white-space: break-spaces;
44
- -webkit-font-variant-ligatures: none;
45
- font-variant-ligatures: none;
46
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
47
- }
48
-
49
- .ProseMirror [contenteditable="false"] {
50
- white-space: normal;
51
- }
52
-
53
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
54
- white-space: pre-wrap;
55
- }
56
-
57
- .ProseMirror pre {
58
- white-space: pre-wrap;
59
- }
60
-
61
- img.ProseMirror-separator {
62
- display: inline !important;
63
- border: none !important;
64
- margin: 0 !important;
65
- width: 0 !important;
66
- height: 0 !important;
67
- }
68
-
69
- .ProseMirror-gapcursor {
70
- display: none;
71
- pointer-events: none;
72
- position: absolute;
73
- margin: 0;
74
- }
75
-
76
- .ProseMirror-gapcursor:after {
77
- content: "";
78
- display: block;
79
- position: absolute;
80
- top: -2px;
81
- width: 20px;
82
- border-top: 1px solid black;
83
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
84
- }
85
-
86
- @keyframes ProseMirror-cursor-blink {
87
- to {
88
- visibility: hidden;
89
- }
90
- }
91
-
92
- .ProseMirror-hideselection *::selection {
93
- background: transparent;
94
- }
95
-
96
- .ProseMirror-hideselection *::-moz-selection {
97
- background: transparent;
98
- }
99
-
100
- .ProseMirror-hideselection * {
101
- caret-color: transparent;
102
- }
103
-
104
- .ProseMirror-focused .ProseMirror-gapcursor {
105
- display: block;
106
- }`;var KA=class extends KE{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:mE,createMappablePosition:vE},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=Lf(t,this.options.autofocus);this.editorState=Wi.create({doc:t,schema:this.schema,selection:r||void 0})}VA(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():$a.createFakeChain()}can(){return this.commandManager?this.commandManager.can():$a.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=oA(jA,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,attributes:this.getEditorViewAttributes()}),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=Nf(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?[DA,IA.configure({blockSeparator:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),LA,BA,zA,HA.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),NA,FA,OA,UA.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 ad(r,this)}createCommandManager(){this.commandManager=new $a({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=cu(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=cu(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Wi.create({doc:r,schema:this.schema,selection:Lf(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}getEditorViewAttributes(){var e;const t=(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes;return Nf(t)?r=>({role:"textbox",...t(r)}):{role:"textbox",...t}}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 Ey(e,{...t,attributes:this.getEditorViewAttributes(),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 Xy(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,s=typeof e=="string"?t:e;return dE(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $h(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
107
-
108
- `,textSerializers:r={}}=e||{};return sE(this.state.doc,{blockSeparator:t,textSerializers:{...Fh(this.schema),...r}})}get isEmpty(){return cc(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 WA(t,this,!1,r)}get $doc(){return this.$pos(0)}};function ua(n){return new uc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=wn(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(id(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 h0(n){return new uc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=wn(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 $f(n){return new uc({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=wn(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 Ga(n){return new uc({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=wn(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&yh(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&&Po(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)},undoable:n.undoable})}const GA=n=>"touches"in n;var qA=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.handleEditorUpdate=()=>{const a=this.editor.isEditable;a!==this.lastEditableState&&(this.lastEditableState=a,a?a&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())},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)}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!==null&&n!==void 0?n:null}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),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,GA(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}}},yr=class p0 extends Vh{constructor(...e){super(...e),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new p0(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},JA=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 $=this.dom.getBoundingClientRect(),M=i.getBoundingClientRect(),S=(c=n.offsetX)!==null&&c!==void 0?c:(u=n.nativeEvent)===null||u===void 0?void 0:u.offsetX,D=(d=n.offsetY)!==null&&d!==void 0?d:(f=n.nativeEvent)===null||f===void 0?void 0:f.offsetY;o=M.x-$.x+S,a=M.y-$.y+D}const h=this.dom.cloneNode(!0);try{const $=this.dom.getBoundingClientRect();h.style.width=`${Math.round($.width)}px`,h.style.height=`${Math.round($.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=wt.create(r.state.doc,v),C=r.state.tr.setSelection(m);r.dispatch(C)}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=wt.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?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"&&(Jl()||Of())&&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):n.type!=="selection":!0}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 Ao(n){return new d0({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=wn(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(id(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 g0=new WeakSet,m0=new WeakSet;function Ho(n){const e=n;return g0.add(e),e}function Bf(n){return Array.isArray(n)&&g0.has(n)}function v0(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&m0.has(e)&&!Bf(e)?v0(e):[e])}function XA(n,e){if(n==="slot")return 0;if(n instanceof Function){const s=n(e);return Array.isArray(s)&&!Bf(s)&&!m0.has(s)?Ho(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(Bf(t))return Ho([n,r,t]);if(t.length===0)return Ho([n,r]);const s=v0(t);return s.length===0?Ho([n,r]):Ho([n,r,...s])}return t!=null?Ho([n,r,t]):Ho([n,r])}const uu=(n,e)=>XA(n,e),YA=(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 We(p,0,0);return f.replace(d,i.after(),g),f.setSelection(Xe.create(f.doc,d+p.size)),f.scrollIntoView(),h(f),!0})},QA=/^\s*>\s$/,ZA=yr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return uu("blockquote",{...xn(this.options.HTMLAttributes,n),children:uu("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(`
109
- `).map(u=>u.trim()===""?t:`${t} ${u}`);r.push(c.join(`
110
- `))}),r.join(`
111
- ${t}
112
- `)},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:()=>YA(this.editor,this.type)}},addInputRules(){return[Ga({find:QA,type:this.type})]}}),eR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,tR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,nR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,rR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sR=ga.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 uu("strong",{...xn(this.options.HTMLAttributes,n),children:uu("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[ua({find:eR,type:this.type}),ua({find:nR,type:this.type})]},addPasteRules(){return[Ao({find:tR,type:this.type}),Ao({find:rR,type:this.type})]}}),iR=n=>{const e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},oR=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};function aR(n){const e=new Set((n.match(/`+/g)||[]).map(r=>r.length));let t=1;for(;e.has(t);)t+=1;return t}const lR=ga.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",xn(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e,t)=>{var r;if(!n.content)return"";const s=typeof(t==null||(r=t.meta)===null||r===void 0?void 0:r.markText)=="string"?t.meta.markText:"",i="`".repeat(aR(s)),o=s.startsWith("`")||s.endsWith("`")?" ":"";return`${i}${o}${e.renderChildren(n.content)}${o}${i}`},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[ua({find:iR,type:this.type})]},addPasteRules(){return[Ao({find:oR,type:this.type})]}}),Vd=4,cR=/^```([a-z]+)?[\s\n]$/,uR=/^~~~([a-z]+)?[\s\n]$/,dR=yr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Vd,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",xn(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(`
113
- `):r=`\`\`\`${s}
114
-
115
- \`\`\``,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:Vd,{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,`
116
- `,`
117
- `).split(`
118
- `).map(h=>a+h).join(`
119
- `);return c.replaceWith(u,d,r.schema.text(f)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!==null&&e!==void 0?e:Vd,{state:r}=n,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var c;const{pos:u}=i,d=i.start(),f=i.end(),h=r.doc.textBetween(d,f,`
120
- `,`
121
- `).split(`
122
- `);let p=0,g=0;const v=u-d;for(let M=0;M<h.length;M+=1){if(g+h[M].length>=v){p=M;break}g+=h[M].length+1}const m=((c=h[p].match(/^ */))===null||c===void 0?void 0:c[0])||"",C=Math.min(m.length,t);if(C===0)return!0;let $=d;for(let M=0;M<p;M+=1)$+=h[M].length+1;return a.delete($,$+C),u-$<=C&&a.setSelection(Xe.create(a.doc,$)),!0}):n.commands.command(({tr:a})=>{const{from:c,to:u}=s,d=r.doc.textBetween(c,u,`
123
- `,`
124
- `).split(`
125
- `).map(f=>{var h;const p=((h=f.match(/^ */))===null||h===void 0?void 0:h[0])||"",g=Math.min(p.length,t);return f.slice(g)}).join(`
126
- `);return a.replaceWith(c,u,r.schema.text(d)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
127
-
128
- `);return!i||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:n})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type||r.parentOffset!==0)return!1;const i=r.before();return i>0?!1:n.commands.insertDefaultBlock({pos:i})},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type||s.parentOffset!==s.parent.nodeSize-2)return!1;const o=s.after();return o===void 0?!1:r.nodeAt(o)?n.commands.command(({tr:a})=>(a.setSelection(Xt.near(r.resolve(o))),!0)):n.commands.exitCode()}}},addInputRules(){return[$f({find:cR,type:this.type,getAttributes:n=>({language:n[1]})}),$f({find:uR,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new An({key:new Wn("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s?.mode;if(!t||!i)return!1;const{tr:o,schema:a}=n.state,c=a.text(t.replace(/\r\n?/g,`
129
- `));return o.replaceSelectionWith(this.type.create({language:i},c)),o.selection.$from.parent.type!==this.type&&o.setSelection(Xe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),fR=yr.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
130
-
131
- `):""}),hR=yr.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",xn(this.options.HTMLAttributes,n)]},renderText(){return`
132
- `},renderMarkdown:()=>`
133
- `,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()}}}),pR=yr.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]}`,xn(this.options.HTMLAttributes,e),0]},parseMarkdown(n,e){const t=n.depth||1;return this.options.levels.includes(t)?e.createNode("heading",{level:t},e.parseInline(n.tokens||[])):e.createNode("paragraph",void 0,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=>$f({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),gR=yr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",xn(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!iA(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return Yy(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(Xe.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(wt.create(o.doc,c.pos)):o.setSelection(Xe.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(Xe.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[h0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),mR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,vR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,bR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,yR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,wR=ga.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",xn(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[ua({find:mR,type:this.type}),ua({find:bR,type:this.type})]},addPasteRules(){return[Ao({find:vR,type:this.type}),Ao({find:yR,type:this.type})]}}),xR="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",kR="ελ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",zf="numeric",Ff="ascii",Hf="alpha",Il="asciinumeric",kl="alphanumeric",Uf="domain",b0="emoji",_R="scheme",SR="slashscheme",Wd="whitespace";function CR(n,e){return n in e||(e[n]=[]),e[n]}function Xo(n,e,t){e[zf]&&(e[Il]=!0,e[kl]=!0),e[Ff]&&(e[Il]=!0,e[Hf]=!0),e[Il]&&(e[kl]=!0),e[Hf]&&(e[kl]=!0),e[kl]&&(e[Uf]=!0),e[b0]&&(e[Uf]=!0);for(const r in e){const s=CR(r,t);s.indexOf(n)<0&&s.push(n)}}function MR(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Is(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Is.groups={};Is.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||Is.groups;let s;return e&&e.j?s=e:(s=new Is(e),t&&r&&Xo(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||Is.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 Is,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Is,i){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(MR(o.t,r),t);Xo(i,c,r)}else t&&Xo(i,t,r);o.t=i}return s.j[n]=o,o}};const Zt=(n,e,t,r,s)=>n.ta(e,t,r,s),tr=(n,e,t,r,s)=>n.tr(e,t,r,s),vm=(n,e,t,r,s)=>n.ts(e,t,r,s),Ee=(n,e,t,r,s)=>n.tt(e,t,r,s),Hi="WORD",Vf="UWORD",y0="ASCIINUMERICAL",w0="ALPHANUMERICAL",Xl="LOCALHOST",Wf="TLD",jf="UTLD",Wc="SCHEME",Oa="SLASH_SCHEME",Wh="NUM",Kf="WS",jh="NL",Ll="OPENBRACE",Ol="CLOSEBRACE",du="OPENBRACKET",fu="CLOSEBRACKET",hu="OPENPAREN",pu="CLOSEPAREN",gu="OPENANGLEBRACKET",mu="CLOSEANGLEBRACKET",vu="FULLWIDTHLEFTPAREN",bu="FULLWIDTHRIGHTPAREN",yu="LEFTCORNERBRACKET",wu="RIGHTCORNERBRACKET",xu="LEFTWHITECORNERBRACKET",ku="RIGHTWHITECORNERBRACKET",_u="FULLWIDTHLESSTHAN",Su="FULLWIDTHGREATERTHAN",Cu="AMPERSAND",Mu="APOSTROPHE",Tu="ASTERISK",po="AT",Eu="BACKSLASH",Au="BACKTICK",Ru="CARET",Yo="COLON",Kh="COMMA",Pu="DOLLAR",Si="DOT",Iu="EQUALS",Gh="EXCLAMATION",Qs="HYPHEN",Nl="PERCENT",Lu="PIPE",Ou="PLUS",Nu="POUND",Dl="QUERY",qh="QUOTE",x0="FULLWIDTHMIDDLEDOT",Jh="SEMI",Ci="SLASH",$l="TILDE",Du="UNDERSCORE",k0="EMOJI",$u="SYM";var _0=Object.freeze({__proto__:null,ALPHANUMERICAL:w0,AMPERSAND:Cu,APOSTROPHE:Mu,ASCIINUMERICAL:y0,ASTERISK:Tu,AT:po,BACKSLASH:Eu,BACKTICK:Au,CARET:Ru,CLOSEANGLEBRACKET:mu,CLOSEBRACE:Ol,CLOSEBRACKET:fu,CLOSEPAREN:pu,COLON:Yo,COMMA:Kh,DOLLAR:Pu,DOT:Si,EMOJI:k0,EQUALS:Iu,EXCLAMATION:Gh,FULLWIDTHGREATERTHAN:Su,FULLWIDTHLEFTPAREN:vu,FULLWIDTHLESSTHAN:_u,FULLWIDTHMIDDLEDOT:x0,FULLWIDTHRIGHTPAREN:bu,HYPHEN:Qs,LEFTCORNERBRACKET:yu,LEFTWHITECORNERBRACKET:xu,LOCALHOST:Xl,NL:jh,NUM:Wh,OPENANGLEBRACKET:gu,OPENBRACE:Ll,OPENBRACKET:du,OPENPAREN:hu,PERCENT:Nl,PIPE:Lu,PLUS:Ou,POUND:Nu,QUERY:Dl,QUOTE:qh,RIGHTCORNERBRACKET:wu,RIGHTWHITECORNERBRACKET:ku,SCHEME:Wc,SEMI:Jh,SLASH:Ci,SLASH_SCHEME:Oa,SYM:$u,TILDE:$l,TLD:Wf,UNDERSCORE:Du,UTLD:jf,UWORD:Vf,WORD:Hi,WS:Kf});const Bi=/[a-z]/,ml=/\p{L}/u,jd=/\p{Emoji}/u,zi=/\d/,Kd=/\s/,bm="\r",Gd=`
134
- `,TR="️",ER="‍",qd="";let Cc=null,Mc=null;function AR(n=[]){const e={};Is.groups=e;const t=new Is;Cc==null&&(Cc=ym(xR)),Mc==null&&(Mc=ym(kR)),Ee(t,"'",Mu),Ee(t,"{",Ll),Ee(t,"}",Ol),Ee(t,"[",du),Ee(t,"]",fu),Ee(t,"(",hu),Ee(t,")",pu),Ee(t,"<",gu),Ee(t,">",mu),Ee(t,"(",vu),Ee(t,")",bu),Ee(t,"「",yu),Ee(t,"」",wu),Ee(t,"『",xu),Ee(t,"』",ku),Ee(t,"<",_u),Ee(t,">",Su),Ee(t,"&",Cu),Ee(t,"*",Tu),Ee(t,"@",po),Ee(t,"`",Au),Ee(t,"^",Ru),Ee(t,":",Yo),Ee(t,",",Kh),Ee(t,"$",Pu),Ee(t,".",Si),Ee(t,"=",Iu),Ee(t,"!",Gh),Ee(t,"-",Qs),Ee(t,"%",Nl),Ee(t,"|",Lu),Ee(t,"+",Ou),Ee(t,"#",Nu),Ee(t,"?",Dl),Ee(t,'"',qh),Ee(t,"/",Ci),Ee(t,";",Jh),Ee(t,"~",$l),Ee(t,"_",Du),Ee(t,"\\",Eu),Ee(t,"・",x0);const r=tr(t,zi,Wh,{[zf]:!0});tr(r,zi,r);const s=tr(r,Bi,y0,{[Il]:!0}),i=tr(r,ml,w0,{[kl]:!0}),o=tr(t,Bi,Hi,{[Ff]:!0});tr(o,zi,s),tr(o,Bi,o),tr(s,zi,s),tr(s,Bi,s);const a=tr(t,ml,Vf,{[Hf]:!0});tr(a,Bi),tr(a,zi,i),tr(a,ml,a),tr(i,zi,i),tr(i,Bi),tr(i,ml,i);const c=Ee(t,Gd,jh,{[Wd]:!0}),u=Ee(t,bm,Kf,{[Wd]:!0}),d=tr(t,Kd,Kf,{[Wd]:!0});Ee(t,qd,d),Ee(u,Gd,c),Ee(u,qd,d),tr(u,Kd,d),Ee(d,bm),Ee(d,Gd),tr(d,Kd,d),Ee(d,qd,d);const f=tr(t,jd,k0,{[b0]:!0});Ee(f,"#"),tr(f,jd,f),Ee(f,TR,f);const h=Ee(f,ER);Ee(h,"#"),tr(h,jd,f);const p=[[Bi,o],[zi,s]],g=[[Bi,null],[ml,a],[zi,i]];for(let v=0;v<Cc.length;v++)lo(t,Cc[v],Wf,Hi,p);for(let v=0;v<Mc.length;v++)lo(t,Mc[v],jf,Vf,g);Xo(Wf,{tld:!0,ascii:!0},e),Xo(jf,{utld:!0,alpha:!0},e),lo(t,"file",Wc,Hi,p),lo(t,"mailto",Wc,Hi,p),lo(t,"http",Oa,Hi,p),lo(t,"https",Oa,Hi,p),lo(t,"ftp",Oa,Hi,p),lo(t,"ftps",Oa,Hi,p),Xo(Wc,{scheme:!0,ascii:!0},e),Xo(Oa,{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],$=n[v][1]?{[_R]:!0}:{[SR]:!0};m.indexOf("-")>=0?$[Uf]=!0:Bi.test(m)?zi.test(m)?$[Il]=!0:$[Ff]=!0:$[zf]=!0,vm(t,m,m,$)}return vm(t,"localhost",Xl,{ascii:!0}),t.jd=new Is($u),{start:t,tokens:Object.assign({groups:e},_0)}}function S0(n,e){const t=RR(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 RR(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 lo(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 Is(r),i.jr=s.slice(),n.j[c]=i),n=i}return i=new Is(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function ym(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 Yl={defaultProtocol:"http",events:null,format:wm,formatHref:wm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Xh(n,e=null){let t=Object.assign({},Yl);n&&(t=Object.assign(t,n instanceof Xh?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}Xh.prototype={o:Yl,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]:Yl[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 wm(n){return n}function C0(n,e){this.t="token",this.v=n,this.tk=e}C0.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=Yl.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 ld(n,e){class t extends C0{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 PR=ld("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),xm=ld("text"),IR=ld("nl"),Tc=ld("url",{isLink:!0,toHref(n=Yl.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Xl&&n[1].t===Yo}}),Xs=n=>new Is(n);function LR({groups:n}){const e=n.domain.concat([Cu,Tu,po,Eu,Au,Ru,Pu,Iu,Qs,Wh,Nl,Lu,Ou,Nu,Ci,$u,$l,Du]),t=[Mu,Yo,Kh,Si,Gh,Nl,Dl,qh,Jh,gu,mu,Ll,Ol,fu,du,hu,pu,vu,bu,yu,wu,xu,ku,_u,Su],r=[Cu,Mu,Tu,Eu,Au,Ru,Pu,Iu,Qs,Ll,Ol,Nl,Lu,Ou,Nu,Dl,Ci,$u,$l,Du],s=Xs(),i=Ee(s,$l);Zt(i,r,i),Zt(i,n.domain,i);const o=Xs(),a=Xs(),c=Xs();Zt(s,n.domain,o),Zt(s,n.scheme,a),Zt(s,n.slashscheme,c),Zt(o,r,i),Zt(o,n.domain,o);const u=Ee(o,po);Ee(i,po,u),Ee(a,po,u),Ee(c,po,u);const d=Ee(i,Si);Zt(d,r,i),Zt(d,n.domain,i);const f=Xs();Zt(u,n.domain,f),Zt(f,n.domain,f);const h=Ee(f,Si);Zt(h,n.domain,f);const p=Xs(PR);Zt(h,n.tld,p),Zt(h,n.utld,p),Ee(u,Xl,p);const g=Ee(f,Qs);Ee(g,Qs,g),Zt(g,n.domain,f),Zt(p,n.domain,f),Ee(p,Si,h),Ee(p,Qs,g);const v=Ee(o,Qs),m=Ee(o,Si);Ee(v,Qs,v),Zt(v,n.domain,o),Zt(m,r,i),Zt(m,n.domain,o);const C=Xs(Tc);Zt(m,n.tld,C),Zt(m,n.utld,C),Zt(C,n.domain,o),Zt(C,r,i),Ee(C,Si,m),Ee(C,Qs,v),Ee(C,po,u);const $=Ee(C,Yo),M=Xs(Tc);Zt($,n.numeric,M);const S=Xs(Tc),D=Xs();Zt(S,e,S),Zt(S,t,D),Zt(D,e,S),Zt(D,t,D),Ee(C,Ci,S),Ee(M,Ci,S);const I=Ee(a,Yo),E=Ee(c,Yo),L=Ee(E,Ci),ee=Ee(L,Ci);Zt(a,n.domain,o),Ee(a,Si,m),Ee(a,Qs,v),Zt(c,n.domain,o),Ee(c,Si,m),Ee(c,Qs,v),Zt(I,n.domain,S),Ee(I,Ci,S),Ee(I,Dl,S),Zt(ee,n.domain,S),Zt(ee,e,S),Ee(ee,Ci,S);const U=[[Ll,Ol],[du,fu],[hu,pu],[gu,mu],[vu,bu],[yu,wu],[xu,ku],[_u,Su]];for(let ie=0;ie<U.length;ie++){const[F,W]=U[ie],Y=Ee(S,F);Ee(D,F,Y);const ce=Xs(Tc);Zt(Y,e,ce);const pe=Xs();Zt(Y,t,pe),Ee(Y,W,S),Zt(ce,e,ce),Zt(ce,t,pe),Zt(pe,e,ce),Zt(pe,t,pe),Ee(ce,W,S),Ee(pe,W,S)}return Ee(s,Xl,C),Ee(s,jh,IR),{start:s,tokens:_0}}function OR(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(Jd(xm,e,o)),o=[]),s-=h,d-=h;const p=f.t,g=t.slice(s-d,s);i.push(Jd(p,e,g))}}return o.length>0&&i.push(Jd(xm,e,o)),i}function Jd(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 NR=typeof console<"u"&&console&&console.warn||(()=>{}),DR="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Hn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function $R(){return Is.groups={},Hn.scanner=null,Hn.parser=null,Hn.tokenQueue=[],Hn.pluginQueue=[],Hn.customSchemes=[],Hn.initialized=!1,Hn}function km(n,e=!1){if(Hn.initialized&&NR(`linkifyjs: already initialized - will not register custom scheme "${n}" ${DR}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
135
- 1. Must only contain digits, lowercase ASCII letters or "-"
136
- 2. Cannot start or end with "-"
137
- 3. "-" cannot repeat`);Hn.customSchemes.push([n,e])}function BR(){Hn.scanner=AR(Hn.customSchemes);for(let n=0;n<Hn.tokenQueue.length;n++)Hn.tokenQueue[n][1]({scanner:Hn.scanner});Hn.parser=LR(Hn.scanner.tokens);for(let n=0;n<Hn.pluginQueue.length;n++)Hn.pluginQueue[n][1]({scanner:Hn.scanner,parser:Hn.parser});return Hn.initialized=!0,Hn}function Yh(n){return Hn.initialized||BR(),OR(Hn.parser.start,n,S0(Hn.scanner.start,n))}Yh.scan=S0;function M0(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 Xh(t),s=Yh(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 cd="[\0-   ᠎ -\u2029  ]",zR=new RegExp(cd),FR=new RegExp(`${cd}$`),HR=new RegExp(`${cd}+$`),UR=new RegExp(cd,"g");function VR(n,e,t){var r,s;const i=n.doc.resolve(e.to);if(!(!((r=i.nodeBefore)===null||r===void 0)&&r.isText))return;const o=(s=n.doc.textBetween(e.from,e.to,"","").match(HR))===null||s===void 0?void 0:s[0];if(!o)return;const a=e.to-o.length,c=id(a,e.to,n.doc).filter(f=>f.mark.type===t);if(!c.length)return;const{nodeAfter:u}=i;if(u&&c.some(f=>f.mark.isInSet(u.marks)))return;const d=n.storedMarks;n.removeMark(a,e.to,t),n.setStoredMarks(d),n.selection.empty&&n.selection.from===e.to&&n.removeStoredMark(t)}function WR(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function jR(n){return new An({key:new Wn("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=Ky(t.doc,[...e]);if(!e.some(nT)){const c=[];a.steps.forEach((u,d)=>{if(!(u instanceof nr)||!u.slice.size)return;const f=a.mapping.slice(d+1),h=f.map(u.from,1),p=f.map(u.from+u.slice.size,-1);h<p&&c.push({from:h,to:p})}),c.sort((u,d)=>d.to-u.to),c.forEach(u=>VR(o,u,n.type))}if(sd(a).forEach(({newRange:c})=>{const u=qT(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(!FR.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(zR).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=Yh(p).map(m=>m.toObject(n.defaultProtocol));if(!WR(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=>{id(m.from,m.to,r.doc).some(C=>C.mark.type===n.type)||o.addMark(m.from,m.to,n.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function KR(n){return new An({key:new Wn("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=Xy(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 GR=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,qR=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function T0(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function JR(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&T0(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 E0(n,e,t){var r,s;const[,i,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||T0(n,(r=e.index)!==null&&r!==void 0?r:0)||JR(n,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&t(o)}function A0(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 XR(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function R0(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 YR(n){const e=ua({find:t=>{const r=GR.exec(t);return!r||!E0(t,r,n.isAllowedHref)?null:A0(r)},type:n.type,getAttributes:R0});return new uc({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 QR(n){const e=Ao({find:t=>{var r,s;const i=[];for(const a of t.matchAll(qR))E0(t,a,n.isAllowedHref)&&i.push(A0(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=>XR(c,a)));return[...i,...o]},type:n.type,getAttributes:R0});return new d0({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 ZR(n){return new An({key:new Wn("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=M0(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 Fi(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(UR,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const P0=ga.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"){km(n);return}km(n.scheme,n.optionalSlashes)})},onDestroy(){$R()},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)=>!!Fi(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=>!!Fi(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=>!!Fi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xn(this.options.HTMLAttributes,n),0]:["a",xn(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=>!!Fi(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=>!!Fi(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?[YR({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!Fi(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;M0(e,{defaultProtocol:s}).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Fi(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?[QR({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!Fi(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:n})]:[Ao({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(jR({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Fi(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(KR({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(ZR({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}});var eP=P0;const tP="listItem",_m="textStyle",Sm=/^\s*([-+*])\s$/,I0=yr.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",xn(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,`
138
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tP,this.editor.getAttributes(_m)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ga({find:Sm,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ga({find:Sm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(_m),editor:this.editor})),[n]}}),nP=(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}},rP=(n,e,t,r)=>{const s=nP(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},sP=(n,e,t)=>rP(n.state,n.view.dispatch,e,t),L0=(n,e)=>Kn.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>sP(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),O0=[[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"]],Ec="abcdefghijklmnopqrstuvwxyz",N0=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function ud(n){let e=n,t="";for(const[r,s]of O0)for(;e>=r;)t+=s,e-=r;return t}function Qh(n){return ud(n).toUpperCase()}function D0(n){const e=n.toLowerCase();let t=0,r=0;for(;t<e.length;){let s=!1;for(const[i,o]of O0)if(e.startsWith(o,t)){r+=i,t+=o.length,s=!0;break}if(!s)return 0}return r}function iP(n){if(!/^[ivxlcdmIVXLCDM]+$/.test(n))return!1;const e=D0(n);return e<=0?!1:(n===n.toLowerCase()?ud(e):Qh(e))===n}function oP(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 Bu(n){if(n<=26)return Ec[n-1];const e=Math.floor((n-1)/26)-1,t=(n-1)%26;return e<0?Ec[t]:Ec[e]+Ec[t]}function dd(n){if(!(!n||/^\d+$/.test(n))){if(iP(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 Zh(n){if(/^\d+$/.test(n))return parseInt(n,10);const e=dd(n);if(e==="i"||e==="I")return D0(n);if(e==="a"||e==="A"){const r=oP(n);return r>0?r:1}const t=parseInt(n,10);return Number.isNaN(t)?1:t}function aP(n,e){if(n==="numeric")return String(e);switch(n){case"a":return Bu(e);case"A":return Bu(e).toUpperCase();case"i":return ud(e);case"I":return Qh(e);default:return String(e)}}function lP(n){var e;if(n.length===0)return!1;const t=(e=dd(n[0]))!==null&&e!==void 0?e:"numeric",r=Zh(n[0]);if(r<1)return!1;for(let s=0;s<n.length;s++){const i=aP(t,r+s);if(n[s]!==i)return!1}return!0}function cP(n){return{type:dd(n),start:Zh(n)}}function uP(n){const{type:e,start:t}=cP(n),r={};return e&&(r.type=e),t!==1&&(r.start=t),r}function dP(n,e,t=". "){const r=e+1;if(!n||n==="1")return`${r}${t}`;switch(n){case"a":return`${Bu(r)}${t}`;case"A":return`${Bu(r).toUpperCase()}${t}`;case"i":return`${ud(r)}${t}`;case"I":return`${Qh(r)}${t}`;default:return`${r}${t}`}}function fP(n){return!n[0]||n[0].type==="paragraph"?n:[{type:"paragraph",content:[]},...n]}function hP(n){var e,t;const r=(e=n.content)===null||e===void 0?void 0:e[0];return r?.type==="paragraph"&&!(!((t=r.content)===null||t===void 0)&&t.length)}const pP="&nbsp;",Cm=1,gP=n=>{var e;return((e=n?.level)!==null&&e!==void 0?e:Cm)>Cm};function mP(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 vP(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}const $0=yr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",xn(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(mP(n))return{type:"listItem",content:[{type:"paragraph",content:vP(n.text||"",e)}]};const[o,...a]=n.tokens;if(o.type==="heading"){var i;return{type:"listItem",content:[{type:"paragraph",content:e.parseInline((i=o.tokens)!==null&&i!==void 0?i:[])},...a.length>0?r(a):[]]}}if(n.tokens.some(c=>c.type==="paragraph"))s=r(n.tokens);else if(o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const c=r(n.tokens.slice(1));s.push(...c)}}else s=r(n.tokens)}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:fP(s)}},renderMarkdown:(n,e,t)=>{const r=o=>{if(o.parentType==="bulletList")return"- ";if(o.parentType==="orderedList"){var a,c;const u=((a=o.meta)===null||a===void 0||(a=a.parentAttrs)===null||a===void 0?void 0:a.start)||1;return dP((c=o.meta)===null||c===void 0||(c=c.parentAttrs)===null||c===void 0?void 0:c.type,u-1+(o.index||0),". ")}return"- "},s=l0(n,e,r,t,{alignNestedToPrefix:t?.parentType==="orderedList"});if(!hP(n)||!gP(t))return s;const i=r(t);return`${i}${pP}${s.slice(i.length)}`},addExtensions(){return[L0(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)}}}),ep=(n,e)=>{const{$from:t}=e.selection,r=Er(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}},B0=(n,e)=>{const t=ep(n,e);if(!t)return!1;const[,r]=lE(e,n,t.$pos.pos+4);return r},bP=(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))},Mm=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Yi(n.state,e)&&bP(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().command(({tr:d})=>{const f=u.end();return d.delete(i.before(),i.after()).insert(f,i.parent),d.setSelection(Xe.create(d.doc,f+1)),!0}).command(({state:d,dispatch:f})=>(Ob(d,f),!0)).run()}if(!Yi(n.state,e)||!hE(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()},yP=(n,e)=>{const t=B0(n,e),r=ep(n,e);return!r||!t?!1:t>r.depth},wP=(n,e)=>{const t=B0(n,e),r=ep(n,e);return!r||!t?!1:t<r.depth},Tm=(n,e)=>!Yi(n.state,e)||!fE(n.state,e)||!n.state.selection.empty?!1:yP(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():wP(e,n.state)?n.commands.command(({state:t,dispatch:r})=>Nb(t,r)):n.commands.joinItemForward(),xP=(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||Yi(r,e))return!1;const o=cE(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(Xe.create(h.doc,f+1)),h.scrollIntoView()),!0))},z0=Kn.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&&Tm(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&&Tm(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&&Mm(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&&Mm(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&&xP(n,e,t))return!0;return!1}}}}),zu=new RegExp(`^(\\s*)(${N0})([.)])\\s+(.*)$`),kP=/^\s/,Na={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function _P(n){return zu.test(n.trimStart())}function SP(n){const e=n.trimStart();return Na.bulletItem.test(e)||_P(e)||Na.heading.test(e)||Na.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Na.codeFence.test(e)||Na.blockMath.test(e)}function CP(n){return Object.values(Na).some(e=>e.test(n))}function MP(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&&SP(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function Em(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],i=s.match(zu);if(!i)break;const[,o,a,c,u]=i,d=o.length,f=parseInt(a,10),h=isNaN(f)?dd(a):void 0,p=isNaN(f)?Zh(a):f,g=[u];let v=t+1;const m=[s];let C=!1;for(;v<n.length;){const $=n[v];if($.match(zu))break;if($.trim()==="")m.push($),g.push(""),C=!0,v+=1;else if($.match(kP)){const M=$.length-$.trimStart().length,S=d+a.length+1;m.push($),g.push($.slice(Math.min(M,S))),v+=1}else{if(C||CP($))break;m.push($),g.push($),v+=1}}e.push({indent:d,number:p,type:h,content:g.join(`
139
- `).trim(),contentLines:g,raw:m.join(`
140
- `)}),r=v,t=v}return[e,r]}const TP=new RegExp(`^(${N0})([.)])\\s+(.+)$`);function EP(n){const e=n.split(`
141
- `).filter(r=>r.trim().length>0);if(e.length===0)return null;const t=[];for(const r of e){const s=r.trim().match(TP);if(!s)return null;t.push({marker:s[1],content:s[3]})}return lP(t.map(r=>r.marker))?{type:"orderedList",attrs:uP(t[0].marker),content:t.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function F0(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}=MP(i.contentLines),c=o.join(`
142
- `).trim(),u=[];c&&u.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const d=a.join(`
143
- `).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=F0(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(`
144
- `)})}r.push({type:"list_item",raw:i.raw,tokens:u}),s=f}else s+=1}return r}function AP(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 RP=64;function Am(n,e){const t=[];let r=0;for(;t.length<e;){const s=n.indexOf(`
145
- `,r);if(s===-1)return t.push(n.slice(r)),t;t.push(n.slice(r,s)),r=s+1}return t}function PP(n){const e=n.indexOf(`
146
- `),t=e===-1?n:n.slice(0,e);if(!zu.test(t))return[[],0,[]];let r=RP,s=Am(n,r),i=Em(s);for(;i[1]===s.length&&s.length===r;)r*=2,s=Am(n,r),i=Em(s);return[i[0],i[1],s]}const IP="listItem",Rm="textStyle",Pm=/^(\d+)\.\s$/;function Im(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 H0=yr.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=Im(t);if(s)return s}const r=n.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=Im(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,type:t,...r}=n,s=xn(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?AP(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,`
147
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(n,e,t)=>{var r,s;const[i,o,a]=PP(n);if(i.length===0)return;const c=F0(i,i[0].indent,t);if(c.length!==0)return{type:"list",ordered:!0,start:((r=i[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(s=i[0])===null||s===void 0?void 0:s.type,items:c,raw:a.slice(0,o).join(`
148
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(IP,this.editor.getAttributes(Rm)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new An({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=EP(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=Ga({find:Pm,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:n});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ga({find:Pm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Rm)}),joinPredicate:n,editor:this.editor})),[e]}}),LP=/^\s*(\[([( |x])?\])\s$/,OP="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",NP=(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"}`},DP=yr.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",xn(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 l0(n,e,r,void 0,{indentMainContent:!0})},addExtensions(){return this.options.nested?[L0(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=OP;const u=f=>{const h=NP(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=ca(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,C])=>{C==null?m in v?s.setAttribute(m,v[m]):s.removeAttribute(m):s.setAttribute(m,C)}),d=g,!0}}}},addInputRules(){return[Ga({find:LP,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),$P=yr.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",xn(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,`
149
- `):"",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=hm(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=hm(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()}}});Kn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(I0.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push($0.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(z0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(H0.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(DP.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push($P.configure(this.options.taskList)),n}});const Ac="&nbsp;",Xd=" ",BP=yr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",xn(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===Ac||t[0].text===Ac||t[0].raw===Xd||t[0].text===Xd)&&r.length===1&&r[0].type==="text"&&(r[0].text===Ac||r[0].text===Xd)?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?Ac:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),zP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,FP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,HP=ga.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",xn(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[ua({find:zP,type:this.type})]},addPasteRules(){return[Ao({find:FP,type:this.type})]}}),UP=yr.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),VP=ga.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",xn(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`<u>${e.renderChildren(n)}</u>`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.toLowerCase().indexOf("<u>")},tokenize(n,e,t){if(!/^<u>/i.test(n))return;const r=/\\[\s\S]|`+|<\/u>/gi;r.lastIndex=3;let s=r.exec(n);for(;s;){if(s[0].startsWith("`")){const i=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(n.slice(s.index));i&&(r.lastIndex=s.index+i[0].length)}else if(!s[0].startsWith("\\")){const i=n.slice(3,s.index);return i?{type:"underline",raw:n.slice(0,r.lastIndex),text:i,tokens:t.inlineTokens(i)}:void 0}s=r.exec(n)}}},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 WP(n={}){return new An({view(e){return new jP(e,n)}})}class jP{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=_b(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 rr extends Xt{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return rr.valid(r)?new rr(r):Xt.near(r)}content(){return We.empty}eq(e){return e instanceof rr&&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 rr(e.resolve(t.pos))}getBookmark(){return new tp(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!KP(e)||!GP(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&&rr.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(rr.valid(c))return c}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!wt.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(rr.valid(a))return a}return null}}}rr.prototype.visible=!1;rr.findFrom=rr.findGapCursorFrom;Xt.jsonID("gapcursor",rr);class tp{constructor(e){this.pos=e}map(e){return new tp(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return rr.valid(t)?new rr(t):Xt.near(t)}}function U0(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function KP(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||U0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function GP(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||U0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function qP(){return new An({props:{decorations:QP,createSelectionBetween(n,e,t){return e.pos==t.pos&&rr.valid(t)?new rr(t):null},handleClick:XP,handleKeyDown:JP,handleDOMEvents:{beforeinput:YP}}})}const JP=Ay({ArrowLeft:Rc("horiz",-1),ArrowRight:Rc("horiz",1),ArrowUp:Rc("vert",-1),ArrowDown:Rc("vert",1)});function Rc(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 Xe){if(!i.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=rr.findGapCursorFrom(a,e,c);return u?(s&&s(r.tr.setSelection(new rr(u))),!0):!1}}function XP(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!rr.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&wt.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new rr(r))),!0)}function YP(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof rr))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 We(s,0,0));return i.setSelection(Xe.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function QP(n){if(!(n.selection instanceof rr))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",rn.create(n.doc,[Nr.widget(n.selection.head,e,{key:"gapcursor"})])}Kn.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 An({key:new Wn("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 ZP=Kn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[WP(this.options)]}});Kn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new An({key:new Wn("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return rn.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(Nr.node(u,u+c.nodeSize,{class:this.options.className}))}),rn.create(n,i)}}})]}});const eI=Kn.create({name:"gapCursor",addProseMirrorPlugins(){return[qP()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=wn(ht(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),V0="placeholder",Lm=new Wn("tiptap__placeholder");function W0(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),Nr.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:a}):t})}function j0(n,e){return typeof n=="function"?n(e):n}function K0({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&&cc(d);return d.type.isTextblock&&(h||!e.showOnlyCurrent)&&p&&c.push(W0({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:j0(e.emptyNodeClass,{editor:n,node:d,pos:f,hasAnchor:h})},node:d,pos:f})),e.includeChildren}),c}function G0({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&&cc(u)){const f=i>=d&&i<=d+u.nodeSize;o.push(W0({editor:n,isEmptyDoc:a,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:j0(e.emptyNodeClass,{editor:n,node:u,pos:d,hasAnchor:f})},node:u,pos:d}))}}else o.push(...K0({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:0,to:r.content.size}));return rn.create(r,o)}function Bl(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 zl(n,e){return{from:Math.max(0,e.from),to:Math.min(n.content.size,e.to)}}function tI(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 nI(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 rI(n,e){const t=tI(n,e.from,e.to);return t.push(zl(n,Bl(n,e.from))),e.to>e.from?t.push(zl(n,Bl(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(zl(n,Bl(n,Math.min(e.from+1,n.content.size)))),t}function sI(n,e,t){const r=[];if(n.docChanged){const s=sd(n);for(const i of s)r.push(...rI(t.doc,i.newRange))}return n.selectionSet&&(r.push(zl(t.doc,Bl(t.doc,n.mapping.map(e.selection.anchor)))),r.push(zl(t.doc,Bl(t.doc,t.selection.anchor)))),nI(r)}function iI(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 oI({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}=iI(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=K0({editor:t,options:r,dataAttribute:s,doc:i,selection:o,from:u,to:d});h.length&&(a=a.add(i,h))}return a}function aI({editor:n,options:e,dataAttribute:t}){return{init(r,s){const i=G0({editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection});return i??rn.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:oI({decorations:s.map(r.mapping,r.doc),ranges:sI(r,i,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function lI(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function cI({editor:n,options:e}){const t=e.dataAttribute?`data-${lI(e.dataAttribute)}`:`data-${V0}`,r=e.showOnlyCurrent&&!e.includeChildren;return new An({key:Lm,...r?{}:{state:aI({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:s,selection:i})=>G0({editor:n,options:e,dataAttribute:t,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?rn.empty:(i=Lm.getState(s))!==null&&i!==void 0?i:rn.empty}}})}const uI=Kn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:V0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[cI({editor:this.editor,options:this.options})]}});function Gf(n,e){return!n.selection.empty&&!Yy(n.selection)&&e.isEditable}function dI(n,e){return Gf(n,e)&&!e.isFocused&&!e.view.dragging}function fI(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function hI(n){n.focus()}Kn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new An({key:new Wn("selection"),props:{decorations(t){return dI(t,n)?rn.create(t.doc,[Nr.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return Gf(t.state,n)&&fI(),!1},focus(t){return Gf(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&hI(t)}),!1}}}})]}});function Om({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const pI=Kn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Wn(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 An({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!Om({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Om({node:o,types:r})}}})]}}),gI=Kn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Ly(n,e),redo:()=>({state:n,dispatch:e})=>Oy(n,e)}},addProseMirrorPlugins(){return[tT(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()}}}),mI=Kn.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(sR.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(ZA.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(I0.configure(this.options.bulletList)),this.options.code!==!1&&n.push(lR.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(dR.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(fR.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(ZP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(eI.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(hR.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(pR.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(gI.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(gR.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(wR.configure(this.options.italic)),this.options.listItem!==!1&&n.push($0.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push(z0.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(P0.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(H0.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(BP.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(HP.configure(this.options.strike)),this.options.text!==!1&&n.push(UP.configure(this.options.text)),this.options.underline!==!1){var r;n.push(VP.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;n.push(pI.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return n}});var vI=mI,bI=uI;function yI(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:a}=n,c=r&&!s,u=fm(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 C=m.input.slice(Math.max(0,m.index-1),m.index),$=new RegExp(`^[${i?.map(fm).join("")}\0]?$`).test(C);if(i!==null&&!$)return null;const M=v+m.index;let S=M+m[0].length;return c&&d.test(g.slice(S-1,S+1))&&(m[0]+=" ",S+=1),M<a.pos&&S>=a.pos?{range:{from:M,to:S},query:m[0].slice(t.length),text:m[0]}:null}function wI(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,`
150
- `);return/\s/.test(r)}):!1}function xI(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 kI(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}:xI(n)}function _I({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&&!wI(r)}function SI({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function CI({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),rn.create(a.doc,[Nr.inline(u.from,u.to,{nodeName:e,class:p.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":r})])}}}function MI({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:C}=f,{empty:$,from:M}=C,S={...h},D=f.getMeta(d);if(D&&D.exit)return S.active=!1,S.decorationId=null,S.range={from:0,to:0},S.query=null,S.text=null,S.dismissedRange=h.active?{...h.range}:h.dismissedRange,S;if(S.composing=m,f.docChanged&&S.dismissedRange!==null&&(S.dismissedRange={from:f.mapping.map(S.dismissedRange.from),to:f.mapping.map(S.dismissedRange.to)}),v&&($||n.view.composing)){(M<h.range.from||M>h.range.to)&&!m&&!h.composing&&(S.active=!1);const I=o({char:e,allowSpaces:t,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:C.$from}),E=`id_${Math.floor(Math.random()*4294967295)}`;I&&a({editor:n,state:g,range:I.range,isActive:h.active})&&(!c||c({editor:n,range:I.range,query:I.query,text:I.text,transaction:f}))?(S.dismissedRange!==null&&!u({match:I,dismissedRange:S.dismissedRange,state:g,transaction:f})&&(S.dismissedRange=null),S.dismissedRange===null?(S.active=!0,S.decorationId=h.decorationId||E,S.range=I.range,S.query=I.query,S.text=I.text):S.active=!1):(I||(S.dismissedRange=null),S.active=!1)}else S.active=!1;return S.active||(S.decorationId=null,S.range={from:0,to:0},S.query=null,S.text=null),S}}}function TI({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 EI({placement:n,offset:e,flip:t,floatingUi:r}){var s,i,o,a;const c=[ek({mainAxis:(s=e.mainAxis)!==null&&s!==void 0?s:4,crossAxis:(i=e.crossAxis)!==null&&i!==void 0?i:0})];return t&&c.push(tk()),!(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 AI(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 RI({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&&AI(r).appendChild(o),a.onPosition||(o.style.visibility="hidden",o.style.width="max-content");const h=nk(c,o,()=>{rk(c,o,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:g,y:v,placement:m,strategy:C})=>{if(a.onPosition){a.onPosition({x:g,y:v,placement:m,strategy:C});return}Object.assign(o.style,{position:C,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 PI({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 C=TI({editor:n,items:t}),$=EI({placement:a,offset:c,flip:d,floatingUi:f});function M(S,D){switch(S){case"started":var I;r==null||(I=r.onStart)===null||I===void 0||I.call(r,D);break;case"updated":var E;r==null||(E=r.onUpdate)===null||E===void 0||E.call(r,D);break;case"stopped":var L;r==null||(L=r.onExit)===null||L===void 0||L.call(r,D)}}return{update:async(S,D)=>{var I,E;const L=e.getState(D),ee=e.getState(S.state);if(!L||!ee)return;let U=null;const ie=L.query!==ee.query,F=L.text!==ee.text,W=L.range.from!==ee.range.from||L.range.to!==ee.range.to,Y=ie||F||W;if(!L.active&&ee.active)U="started";else if(L.active&&!ee.active)U="stopped";else if(ee.active&&Y)U="updated";else return;const ce=U==="stopped"?L:ee,pe=S.dom.querySelector(`[data-decoration-id="${ce.decorationId}"]`),j=g(S,pe),ue=s===0||(ce.query?ce.query.length>=s:!1),P=(U==="started"||U==="updated")&&ue;if(m={editor:n,range:ce.range,query:ce.query||"",text:ce.text||"",items:o??[],command:ge=>p({editor:n,range:ce.range,props:ge}),decorationNode:pe,clientRect:j,loading:P,placement:a,offset:{mainAxis:(I=c.mainAxis)!==null&&I!==void 0?I:4,crossAxis:(E=c.crossAxis)!==null&&E!==void 0?E:0},container:u,flip:d,floatingUi:$,mount:RI({getReferenceRect:j,contextElement:S.dom,config:$,container:u,dismissOnOutsideClick:h,dismiss:()=>v(n.view)})},U==="started"){var z;r==null||(z=r.onBeforeStart)===null||z===void 0||z.call(r,m)}if(U==="updated"){var le;r==null||(le=r.onBeforeUpdate)===null||le===void 0||le.call(r,m)}if(U==="started"&&M(U,m),U==="started"||U==="updated")if(!P)C.abort(),m={...m,items:o??[],loading:!1};else{m={...m,items:o??[],loading:!0},U="updated",M(U,m);const ge=await C.fetch(ce.query||"",i);if(ge.status==="aborted")return;const ye=e.getState(S.state);if(!ye?.active){C.abort();return}m=ge.status==="resolved"?{...m,items:ge.items,loading:!1}:{...m,loading:!1}}if(U==="stopped"){C.abort(),M(U,m),m=void 0;return}U==="updated"&&M(U,m)},destroy:()=>{var S;C.abort(),m&&(r==null||(S=r.onExit)===null||S===void 0||S.call(r,m))}}}const II=new Wn("suggestion");function LI({pluginKey:n=II,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:C={},container:$,flip:M=!0,floatingUi:S,dismissOnOutsideClick:D=!0,render:I=()=>({}),allow:E=()=>!0,findSuggestionMatch:L=yI,shouldShow:ee,shouldResetDismissed:U}){const ie=I?.(),F=r&&!s,W=(pe,j)=>kI(e,pe,j,n);function Y(pe){return _I({...pe,editor:e,shouldResetDismissed:U,effectiveAllowSpaces:F})}const ce=pe=>SI({view:pe,pluginKeyRef:n});return new An({key:n,view:()=>PI({editor:e,pluginKey:n,items:h,renderer:ie,minQueryLength:p,debounce:g,initialItems:v,placement:m,offset:C,container:$,flip:M,floatingUi:S,dismissOnOutsideClick:D,command:f,clientRectFor:W,dispatchExit:ce}),state:MI({editor:e,char:t,effectiveAllowSpaces:F,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:L,allow:E,shouldShow:ee,shouldKeepDismissed:Y,pluginKey:n}),props:CI({pluginKey:n,decorationTag:a,decorationClass:c,decorationContent:u,decorationEmptyClass:d,renderer:ie,dispatchExit:ce})})}function OI({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){return{editor:n,char:r,pluginKey:new Wn,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 q0(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>OI({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function Nm(n,e){const t=q0(n),r=t.find(s=>s.char===e);return r||(t.length?t[0]:null)}const NI=yr.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",xn(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=Nm(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",xn({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=xn({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof s=="string"?["span",xn({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...bA({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:Nm(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 wo,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 q0(this).map(LI)}});var DI=NI;const $I=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,BI=yr.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",xn(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=xn(this.options.HTMLAttributes,a);Object.entries(d).forEach(([C,$])=>{if($!=null)switch(C){case"src":case"width":case"height":break;default:u.setAttribute(C,$)}}),d.src!==null&&(u.src=d.src);let f={...a};const h=C=>{if(typeof C=="string"&&C!==""){u.getAttribute("src")!==C&&(u.src=C);return}u.hasAttribute("src")&&u.removeAttribute("src"),u.src!==""&&(u.src="")};h(a.src);const p=C=>{if(C.type!==i.type)return!1;const $=c.extensionManager.attributes.filter(S=>S.type===C.type.name),M=ca(C,$);return Object.keys(f).forEach(S=>{!s.has(S)&&!(S in M)&&u.removeAttribute(S)}),Object.entries(M).forEach(([S,D])=>{s.has(S)||(D!=null?u.setAttribute(S,D):u.removeAttribute(S))}),h(M.src),f=M,!0},g=new qA({element:u,editor:c,node:i,getPos:o,onResize:(C,$)=>{u.style.width=`${C}px`,u.style.height=`${$}px`},onCommit:(C,$)=>{const M=o();M!==void 0&&this.editor.chain().setNodeSelection(M).updateAttributes(this.name,{width:C,height:$}).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[h0({find:$I,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var zI=BI;const J0="TipTapNodeView";class FI{constructor(e,{element:t,props:r}){it(this,"component");it(this,"props");it(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(){uo(this.component)}}class HI extends JA{mount(){const e=this.component,t=Cr({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 sk;r.set(J0,{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=Cl(e,{target:i,props:t,context:r});this.renderer=new FI(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=ca(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function np(n,e){return t=>new HI(n,t,e)}var UI=new Set(["$$slots","$$events","$$legacy","as","children"]);function fd(n,e){if(new.target)return It({component:fd,...n});Rt(e,!0);const t=y(e,"as",7,"div"),r=y(e,"children",7),s=Ei(e,UI),i=Yw(J0);let o;Fu(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:Lt,$on:(d,f)=>Ot(e,d,f)},c=Ye(),u=ae(c);return bk(u,t,!1,(d,f)=>{jn(d,v=>o=v,()=>o),da(d,()=>({"data-node-view-wrapper":"",role:"none",...s,ondragstart:i?.onDragStart}));var h=Ye(),p=ae(h);{var g=v=>{var m=Ye(),C=ae(m);Un(C,r),x(v,m)};K(p,v=>{r()&&v(g)})}x(f,h)}),x(n,c),Pt(a)}var VI=B('<div class="flex items-center gap-2" contenteditable="false"><!> <!></div>'),WI=B('<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),jI=B('<div class="group relative inline-block max-w-full"><!></div>'),KI=B("<!> <!>",1);function X0(n,e){if(new.target)return It({component:X0,...n});Rt(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=he(!1),u=he(null),d=he(null),f=w(()=>i().options.workspaceId),h=w(()=>vx(l(o),l(f))?.mimeType),p=w(()=>Gu(l(o))),g=w(()=>bx(l(o),l(f))),v=w(()=>l(p)?.path??l(g)?.path),m=w(()=>l(p)?.workspaceId??l(g)?.workspaceId??l(f));function C(I){I.preventDefault(),I.stopPropagation(),k(u,I.currentTarget instanceof HTMLElement?I.currentTarget:s().view.dom,!0),k(c,!0)}var $={get node(){return t()},set node(I){t(I),b()},get selected(){return r()},set selected(I){r(I),b()},get editor(){return s()},set editor(I){s(I),b()},get extension(){return i()},set extension(I){i(I),b()},$set:Lt,$on:(I,E)=>Ot(e,I,E)},M=KI(),S=ae(M);{let I=w(()=>`note-video-node${r()?" selected":""}`);fd(S,{get class(){return l(I)},children:(E,L)=>{var ee=jI(),U=ne(ee);{var ie=W=>{var Y=VI(),ce=ne(Y);Xv(ce,{get name(){return l(a)},reason:"load-failed",get path(){return l(v)},get workspaceId(){return l(m)}});var pe=A(ce,2);Yc(pe,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Q(Y),x(W,Y)},F=W=>{var Y=WI(),ce=ae(Y),pe=A(ce,2),j=ne(pe);{let P=w(()=>_.chat_videoBlock_play_ariaLabel({name:l(a)}));Je(j,{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:C,get"aria-label"(){return l(P)},children:(z,le)=>{rt(z,{get icon(){return C1},size:"sm"})},$$slots:{default:!0}})}var ue=A(j,2);Yc(ue,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Q(pe),N(()=>{ot(ce,"src",l(o)),ot(ce,"aria-label",l(a))}),To("error",ce,()=>k(d,l(o),!0)),x(W,Y)};K(U,W=>{l(d)===l(o)?W(ie):W(F,-1)})}Q(ee),x(E,ee)},$$slots:{default:!0}})}var D=A(S,2);return Jv(D,{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(I){k(c,I,!0)}}),x(n,M),Pt($)}const GI=yr.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",xn(n,{class:"markdown-video",controls:"",preload:"metadata",playsinline:""})]},addNodeView(){return np(X0)}}),qI={note:"internal","linear-issue":"linear","github-issue":"github","github-pr":"github","sentry-issue":"sentry","browser-url":"browser"};var Dm=B("<span><!></span>");function qf(n,e){if(new.target)return It({component:qf,...n});Rt(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()?qI[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:Lt,$on:(v,m)=>Ot(e,v,m)},c=Ye(),u=ae(c);{var d=v=>{jk(v,{get size(){return s()},get class(){return i()}})},f=v=>{gh(v,{get size(){return s()},get class(){return i()}})},h=v=>{Kk(v,{get size(){return s()},get class(){return i()}})},p=v=>{var m=Dm(),C=ne(m);rt(C,{get icon(){return th},get size(){return`${s()??""}px`}}),Q(m),N(()=>{at(m,1,Bn(i())),Xi(m,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),x(v,m)},g=v=>{var m=Dm(),C=ne(m);rt(C,{get icon(){return nh},get size(){return`${s()??""}px`}}),Q(m),N(()=>{at(m,1,Bn(i())),Xi(m,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),x(v,m)};K(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 x(n,c),Pt(a)}function mo(n,e){if(new.target)return It({component:mo,...n});Rt(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:Lt,$on:(i,o)=>Ot(e,i,o)};return M1(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Pt(s)}var JI=B('<span class="text-subtle shrink-0"> </span>'),XI=B('<span><!> <!> <span class="max-w-[180px] truncate"> </span></span>'),YI=B('<span class="text-ui font-medium text-subtle">·</span> <span class="text-ui font-medium text-subtle"> </span>',1),QI=B('<div class="text-sm font-medium text-foreground leading-snug"> </div>'),Pc=B("<span> </span>"),ZI=B('<span class="text-ui"> </span>'),Ic=B('<span class="text-ui text-subtle"> </span>'),eL=B('<div class="flex flex-wrap items-center gap-1.5"><!> <!> <!> <!></div>'),tL=B('<span class="px-1.5 py-0.5 rounded-full text-ui font-medium bg-muted/50 text-subtle"> </span>'),nL=B('<div class="flex flex-wrap gap-1"><!> <!></div>'),rL=B('<div class="flex items-center gap-3 text-ui text-subtle"><!> <!></div>'),sL=B('<div class="text-xs text-subtle line-clamp-6"> </div>'),iL=B('<span class="text-ui text-subtle ml-auto"> </span>'),oL=B('<div class="flex items-center gap-2 pt-1 border-t border-border"><!> <!> <!></div>'),aL=B('<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>'),lL=Qi('<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>'),cL=B('<span class="context-mention-wrapper group/pill relative inline-flex items-center svelte-1qhjkt1"><!> <!></span> <!>',1);function Y0(n,e){if(new.target)return It({component:Y0,...n});Rt(e,!0);const t=yk()?.workspaceId??void 0;let r=y(e,"node",7),s=y(e,"selected",7),i=y(e,"deleteNode",7),o=he(null),a=he(!1);ut(()=>{const W=Y=>{k(o,Y.detail.branch,!0),k(a,!0)};return document.addEventListener("initializer-branch-updated",W),()=>{document.removeEventListener("initializer-branch-updated",W)}});function c(W){W.preventDefault(),W.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 W=r().attrs.metadata;if(!W)return null;try{return JSON.parse(W)}catch{return null}}),m=w(()=>()=>{if(l(u)==="github"&&l(h)){const W=l(h).match(/^([^/]+)\/([^#]+)#(\d+)$/);if(W){const[,Y,ce,pe]=W,ue=!!l(v)()?.sourceBranch?"pull":"issues";return`https://github.com/${Y}/${ce}/${ue}/${pe}`}}return l(p)}),C=w(()=>()=>{const W=l(v)()?.sourceBranch;return W&&W.length>0?W:null}),$=w(()=>l(u)==="github"&&(l(d)==="github-pr"||l(d)==="github-issue")&&l(C)()!==null),M=w(()=>l(a)&&l($)&&l(C)()&&l(C)()!==l(o));function S(W){W.preventDefault(),W.stopPropagation();const Y=l(C)();if(Y){const ce=new CustomEvent("switch-to-pr-branch",{detail:{branch:Y,prIdentifier:l(h)},bubbles:!0});document.dispatchEvent(ce)}}function D(W){return W?h1(W,{style:"narrow"}):""}function I(W){if(!W)return"bg-muted text-subtle";const Y=W.toLowerCase();return Y.includes("progress")||Y.includes("active")||Y.includes("open")?"bg-blue-500/15 text-blue-500":Y.includes("done")||Y.includes("resolved")||Y.includes("closed")||Y.includes("complete")?"bg-green-500/15 text-green-500":Y.includes("backlog")||Y.includes("todo")||Y.includes("triage")?"bg-muted text-subtle":Y.includes("block")||Y.includes("error")||Y.includes("cancel")?"bg-red-500/15 text-red-500":"bg-muted text-subtle"}function E(W){if(!W)return null;const Y=W.toLowerCase();return Y.includes("urgent")||Y==="1"?{color:"bg-red-500",label:"🔴"}:Y.includes("high")||Y==="2"?{color:"bg-orange-500",label:"🟠"}:Y.includes("medium")||Y==="3"?{color:"bg-warning",label:"🟡"}:Y.includes("low")||Y==="4"?{color:"bg-blue-500",label:"🔵"}:null}function L(W){if(!W)return"";const Y=W.toLowerCase();return Y==="error"||Y==="fatal"?"text-danger":Y==="warning"?"text-warning-ink":"text-subtle"}const ee=w(()=>()=>l(d)==="browser-url"?l(f)||l(m)():l(h)&&l(f)?l(f):l(h)||l(f)),U=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 ie(W){W.preventDefault(),W.stopPropagation();const Y=l(m)();Y&&t&&await lh(Y,{workspaceId:Cv(t),event:W})}var F={get node(){return r()},set node(W){r(W),b()},get selected(){return s()},set selected(W){s(W),b()},get deleteNode(){return i()},set deleteNode(W){i(W),b()},$set:Lt,$on:(W,Y)=>Ot(e,W,Y)};return fd(n,{as:"span",class:"inline",children:(W,Y)=>{var ce=cL(),pe=ae(ce),j=ne(pe);hh(j,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"20rem",trigger:ye=>{var Z=XI(),oe=ne(Z);qf(oe,{get provider(){return l(u)},size:12,class:"shrink-0 opacity-30"});var V=A(oe,2);{var G=ve=>{var de=JI(),fe=re(de,!0);N(()=>H(fe,l(h))),x(ve,de)};K(V,ve=>{l(h)&&l(d)!=="browser-url"&&ve(G)})}var O=A(V,2),te=re(O,!0);Q(Z),N(ve=>{at(Z,1,`context-mention-pill inline-flex items-center gap-1 rounded-md px-1.5 py-1 pr-5 font-medium transition-colors
151
- ${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"),H(te,ve)},[()=>l(ee)()]),x(ye,Z)},content:ye=>{const Z=w(()=>l(v)()),oe=w(()=>l(Z)?E(l(Z).priority):null);var V=aL(),G=ne(V),O=ne(G);qf(O,{get provider(){return l(u)},size:10,class:"opacity-40"});var te=A(O,2),ve=re(te,!0),de=A(te,2);{var fe=Ae=>{var Ce=YI(),we=A(ae(Ce),2),Ue=re(we,!0);N(()=>H(Ue,l(h))),x(Ae,Ce)};K(de,Ae=>{l(h)&&l(d)!=="browser-url"&&Ae(fe)})}Q(G);var ke=A(G,2);{var be=Ae=>{var Ce=QI(),we=re(Ce,!0);N(()=>H(we,l(f))),x(Ae,Ce)};K(ke,Ae=>{l(f)&&Ae(be)})}var J=A(ke,2);{var Me=Ae=>{var Ce=eL(),we=ne(Ce);{var Ue=Bt=>{var Fe=Pc(),Ke=re(Fe,!0);N(Yt=>{at(Fe,1,`px-1.5 py-0.5 rounded text-ui font-medium ${Yt??""}`,"svelte-1qhjkt1"),H(Ke,l(Z).state)},[()=>I(l(Z).state)]),x(Bt,Fe)};K(we,Bt=>{l(Z).state&&Bt(Ue)})}var _t=A(we,2);{var se=Bt=>{var Fe=ZI(),Ke=re(Fe,!0);N(()=>H(Ke,l(oe).label)),x(Bt,Fe)};K(_t,Bt=>{l(oe)&&Bt(se)})}var Ze=A(_t,2);{var lt=Bt=>{var Fe=Pc(),Ke=re(Fe,!0);N(Yt=>{at(Fe,1,`text-ui font-medium ${Yt??""}`,"svelte-1qhjkt1"),H(Ke,l(Z).level)},[()=>L(l(Z).level)]),x(Bt,Fe)};K(Ze,Bt=>{l(Z).level&&l(u)==="sentry"&&Bt(lt)})}var et=A(Ze,2);{var bt=Bt=>{var Fe=Ic(),Ke=re(Fe);N(()=>H(Ke,`→ ${l(Z).assignee??""}`)),x(Bt,Fe)};K(et,Bt=>{l(Z).assignee&&Bt(bt)})}Q(Ce),x(Ae,Ce)};K(J,Ae=>{l(Z)&&(l(Z).state||l(oe)||l(Z).assignee)&&Ae(Me)})}var Be=A(J,2);{var gt=Ae=>{var Ce=nL(),we=ne(Ce);as(we,17,()=>l(Z).labels.split(",").map(Ze=>Ze.trim()).filter(Boolean).slice(0,5),$c,(Ze,lt)=>{var et=tL(),bt=re(et,!0);N(()=>H(bt,l(lt))),x(Ze,et)});var Ue=A(we,2);{var _t=Ze=>{var lt=Ic(),et=re(lt);N(bt=>H(et,`+${bt??""}`),[()=>l(Z).labels.split(",").length-5]),x(Ze,lt)},se=w(()=>l(Z).labels.split(",").length>5);K(Ue,Ze=>{l(se)&&Ze(_t)})}Q(Ce),x(Ae,Ce)};K(Be,Ae=>{l(Z)?.labels&&Ae(gt)})}var Ie=A(Be,2);{var $e=Ae=>{var Ce=rL(),we=ne(Ce);{var Ue=Ze=>{var lt=Pc(),et=re(lt,!0);N(bt=>H(et,bt),[()=>_.tiptap_contextMention_events_label({count:l(Z).count})]),x(Ze,lt)};K(we,Ze=>{l(Z).count&&Ze(Ue)})}var _t=A(we,2);{var se=Ze=>{var lt=Pc(),et=re(lt,!0);N(bt=>H(et,bt),[()=>_.tiptap_contextMention_users_label({count:l(Z).userCount})]),x(Ze,lt)};K(_t,Ze=>{l(Z).userCount&&Ze(se)})}Q(Ce),x(Ae,Ce)};K(Ie,Ae=>{l(Z)&&l(u)==="sentry"&&(l(Z).count||l(Z).userCount)&&Ae($e)})}var ze=A(Ie,2);{var vt=Ae=>{var Ce=sL(),we=re(Ce,!0);N(()=>H(we,l(g))),x(Ae,Ce)};K(ze,Ae=>{l(g)&&Ae(vt)})}var Vt=A(ze,2);{var st=Ae=>{var Ce=oL(),we=ne(Ce);{var Ue=et=>{var bt=Ic(),Bt=re(bt,!0);N(()=>H(Bt,l(Z).project)),x(et,bt)};K(we,et=>{l(Z).project&&et(Ue)})}var _t=A(we,2);{var se=et=>{var bt=Ic(),Bt=re(bt,!0);N(Fe=>H(Bt,Fe),[()=>_.tiptap_contextMention_byAuthor_label({author:l(Z).author})]),x(et,bt)};K(_t,et=>{l(Z).author&&et(se)})}var Ze=A(_t,2);{var lt=et=>{var bt=iL(),Bt=re(bt,!0);N(Fe=>H(Bt,Fe),[()=>D(l(Z).createdAt)]),x(et,bt)};K(Ze,et=>{l(Z).createdAt&&et(lt)})}Q(Ce),x(Ae,Ce)};K(Vt,Ae=>{l(Z)&&(l(Z).project||l(Z).createdAt||l(Z).author)&&Ae(st)})}Q(V),N(Ae=>H(ve,Ae),[()=>l(U)()]),x(ye,V)},$$slots:{trigger:!0,content:!0}});var ue=A(j,2);{let le=w(()=>s()?"bg-primary/20 hover:bg-primary/30":"bg-muted/60 hover:bg-muted"),ge=w(()=>_.tiptap_contextMention_remove_ariaLabel());Je(ue,{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
152
- opacity-0 group-hover/pill:opacity-100 transition-opacity
153
- ${l(le)??""}`},get"aria-label"(){return l(ge)},children:(ye,Z)=>{var oe=lL();x(ye,oe)},$$slots:{default:!0}})}Q(pe);var P=A(pe,2);{var z=le=>{{let ge=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Hu(le,{get content(){return l(ge)},side:"top",delayDuration:200,children:(ye,Z)=>{{let oe=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Je(ye,{type:"button",variant:"ghost",size:"icon-compact",iconOnly:!0,onclick:S,class:"branch-switch-btn size-5 ml-1 rounded cursor-pointer transition-colors hover:bg-primary/20",get"aria-label"(){return l(oe)},children:(V,G)=>{mo(V,{size:12,class:"text-primary-ink hover:text-primary-ink/80"})},$$slots:{default:!0}})}},$$slots:{default:!0}})}};K(P,le=>{l(M)&&le(z)})}Qr("click",pe,ie),x(W,ce)},$$slots:{default:!0}}),Pt(F)}Ro(["click"]);const uL=yr.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",xn(n,{"data-type":"context-mention",class:"context-mention"}),n.title||n.identifier||_.tiptap_contextMention_link_fallback()]},addNodeView(){return np(Y0)},addCommands(){return{insertContextMention:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});var dL=B('<span><!> <span class="whitespace-nowrap"> </span></span>'),fL=B('<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>'),hL=B('<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 Q0(n,e){if(new.target)return It({component:Q0,...n});Rt(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:Lt,$on:(p,g)=>Ot(e,p,g)};return fd(n,{as:"span",class:"inline",children:(p,g)=>{var v=hL(),m=ne(v);hh(m,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"24rem",trigger:I=>{var E=dL(),L=ne(E);rt(L,{get icon(){return Ap},size:"xs",class:"shrink-0 opacity-40"});var ee=A(L,2),U=re(ee,!0);Q(E),N(ie=>{at(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
154
- ${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"),H(U,ie)},[()=>_.tiptap_pasteChip_pastedLines_label({count:ws(l(c))})]),x(I,E)},content:I=>{var E=fL(),L=ne(E),ee=ne(L);rt(ee,{get icon(){return Ap},size:"xs",class:"opacity-40"});var U=A(ee,2),ie=re(U,!0),F=A(U,2),W=re(F);Q(L);var Y=A(L,2),ce=re(Y,!0);Q(E),N((pe,j)=>{H(ie,pe),H(W,`· ${j??""}`),H(ce,l(u))},[()=>_.tiptap_pasteChip_pastedText_label(),()=>_.tiptap_pasteChip_lines_label({count:ws(l(c))})]),x(I,E)},$$slots:{trigger:!0,content:!0}});var C=A(m,2),$=ne(C);{let S=w(()=>(r(),"")),D=w(()=>_.tiptap_pasteChip_expand_label()),I=w(()=>_.tiptap_pasteChip_expand_label());Je($,{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!
155
- ${l(S)??""}`},get"aria-label"(){return l(D)},get tooltip(){return l(I)},children:(E,L)=>{rt(E,{get icon(){return T1},size:10,class:""})},$$slots:{default:!0}})}var M=A($,2);{let S=w(()=>(r(),"")),D=w(()=>_.tiptap_pasteChip_remove_ariaLabel());Je(M,{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!
156
- ${l(S)??""}`},get"aria-label"(){return l(D)},children:(I,E)=>{rt(I,{get icon(){return Ji},size:10,class:""})},$$slots:{default:!0}})}Q(C),Q(v),x(p,v)},$$slots:{default:!0}}),Pt(h)}const pL=yr.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",xn(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 np(Q0)},addCommands(){return{insertPasteChip:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function Z0(n,e,t){const r=n.resolve(e),s=n.resolve(t),i=c=>c.type.name==="hardBreak"?`
157
- `:"",o=e>r.start()?n.textBetween(e-1,e,`
158
- `,i):`
159
- `,a=t<s.end()?n.textBetween(t,t+1,`
160
- `,i):`
161
- `;return a===" "&&(o===" "||o===`
162
- `)?[e,t+1]:o===" "&&a===`
163
- `?[e-1,t]:[e,t]}const gL=yr.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=ws(r);return["span",xn(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(...Z0(t.doc,a,a+o.nodeSize))),!0};return{Backspace:()=>n("before"),Delete:()=>n("after")}}}),vo=new Wn("screenInterim"),mL=Kn.create({name:"screenInterim",addProseMirrorPlugins(){return[new An({key:vo,state:{init:()=>null,apply(n,e){const t=n.getMeta(vo);return t!==void 0?t:e?{...e,anchor:n.mapping.map(e.anchor,1)}:null}},props:{decorations(n){const e=vo.getState(n);if(!e?.parts.length)return rn.empty;const t=new Map(e.references.map(r=>[r.id,r]));return rn.create(n.doc,[Nr.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:ws(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})])}}})]}}),hd="screen-reference-sync",rp="screen-evidence-insertion";function ew(n){return n.kind==="clip-start"?`[[clip:${n.number}]]`:n.kind==="clip-end"?`[[clip:${n.number}:end]]`:`[[mark:${n.number}]]`}function vL(n,e){if(e.length===0||!/\[\[(mark|clip):/.test(n))return n;const t=new Map(e.map(o=>[ew(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 bL(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(...Z0(r.doc,a,a+s.nodeSize))}),r.docChanged?(r.setMeta("addToHistory",!1).setMeta(hd,!0),n.view.dispatch(r),!0):!1}function yL(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=>[ew(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(hd,!0),n.view.dispatch(i),!0}function wL(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,`
164
- `).split(`
165
- `);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:Xe.near(a.resolve(Math.max(0,Math.min(r,a.content.size)))).from;return n.chain().setMeta(rp,e.id).command(({commands:u})=>c===void 0?u.insertContent(o,{updateSelection:!0}):u.insertContentAt(c,o,{updateSelection:!0})).scrollIntoView().run()}function $m(n){const e=[];return n.descendants(t=>{t.type.name==="screenReference"&&t.attrs.id&&e.push(t.attrs.id)}),e}function xL(n){if(!n.docChanged||n.getMeta(hd)||n.getMeta(rp))return null;const e=$m(n.before),t=$m(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 kL=yr.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",xn(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 _L(n){return n.dataTransfer?.types.includes("Files")??!1}function SL(n){return n.clipboardData?.types?.includes("Files")??!1}var CL=B('<span class="path svelte-1ycni0y"> </span>'),ML=B('<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 tw(n,e){if(new.target)return It({component:tw,...n});Rt(e,!0);let t=y(e,"mention",7),r=y(e,"position",7),s=y(e,"onClose",7),i=he(void 0);const o={file:jo,"file-range":jo,folder:ti,"source-folder":ti,note:nf,"note-range":nf,task:pv,rule:A1,command:hv,"external-source":th,agent:fv,member:E1,personality:dv,workspace:ti,symbol:jo};function a(){return o[t().type]||jo}function c(){if(t().type==="member")return t1(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:L,y:ee}=r();return L+250>window.innerWidth&&(L=window.innerWidth-250-10),ee+30>window.innerHeight&&(ee=r().y-30-10),{x:L,y:ee}}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:Lt,$on:(E,L)=>Ot(e,E,L)},g=ML(),v=ne(g),m=ne(v),C=ne(m);{let E=w(a);rt(C,{get icon(){return l(E)}})}Q(m);var $=A(m,2),M=ne($),S=re(M,!0),D=A(M,2);{var I=E=>{var L=CL(),ee=re(L,!0);N(()=>H(ee,h)),x(E,L)};K(D,E=>{h&&E(I)})}return Q($),Q(v),Q(g),jn(g,E=>k(i,E),()=>l(i)),N((E,L)=>{Xi(g,`left: ${f.x??""}px; top: ${f.y??""}px`),ot(g,"aria-label",E),H(S,L)},[()=>_.chat_mentionPreview_ariaLabel(),()=>t().type==="member"?Xf(t().label):t().label]),Qr("mouseout",g,u),Ps(1,g,()=>rf,()=>({tier:"fast",y:0,scale:1})),Ps(2,g,()=>sf,()=>({tier:"fast"})),x(n,g),Pt(p)}Ro(["mouseout"]);const Bm={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 Ui(n){return"items"in n||"subgroups"in n}function TL(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 nw={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},zm="other";function EL(n){return Ui(n)?zm:n.type in nw?n.type:zm}function AL(n){const e=new Map;for(const t of n){const r=EL(t),s=e.get(r)??[];e.set(r,s),s.push(t)}return Array.from(e,([t,r])=>({key:t,label:(nw[t]??_.chat_mentionList_otherSection_label)(),items:r}))}const Lc=ha("BreadcrumbController");var ec,tc,nc;class rw{constructor(){ao(this,ec,he(Cr([])));ao(this,tc,he(null));ao(this,nc,he(Cr([])));it(this,"groupStack",[])}get _breadcrumbs(){return l(rs(this,ec))}set _breadcrumbs(e){k(rs(this,ec),e,!0)}get _currentGroup(){return l(rs(this,tc))}set _currentGroup(e){k(rs(this,tc),e,!0)}get _currentItems(){return l(rs(this,nc))}set _currentItems(e){k(rs(this,nc),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),Lc.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(),Lc.debug("[BreadcrumbController] Popped to:",this._currentGroup),!0}navigateToRoot(){this._breadcrumbs=[],this._currentGroup=null,this._currentItems=[],this.groupStack=[],Lc.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),Lc.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()}}ec=new WeakMap,tc=new WeakMap,nc=new WeakMap;const vl={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 RL(n,e){if(e){const r=`${n}-${e}`;if(r in vl)return vl[r]}const t=n;return t in vl?vl[t]:vl.default}function sw(n,e){if(new.target)return It({component:sw,...n});Rt(e,!0);const t=()=>nn(o,"$session$",r),[r,s]=Ja();let i=y(e,"agentId",7);const o=n1(i()),a=w(()=>rS(t()));var c={get agentId(){return i()},set agentId(d){i(d),b()},$set:Lt,$on:(d,f)=>Ot(e,d,f)};Fv(n,{get agentId(){return i()},variant:"compact",get state(){return l(a)}});var u=Pt(c);return s(),u}var PL=B('<span class="mention-agent-avatar svelte-myc5g6"><!></span>'),IL=B("<span><!></span>"),LL=B('<span class="mention-subtitle svelte-myc5g6"> </span>'),OL=B('<span class="group-arrow svelte-myc5g6"><!></span>'),NL=B('<!> <div class="mention-content svelte-myc5g6"><div class="mention-label-line svelte-myc5g6"><span class="mention-label svelte-myc5g6"> </span></div> <!></div> <!>',1),DL=B('<span class="breadcrumb-icon svelte-myc5g6"> </span>'),$L=B("<!> ",1),BL=B('<span class="breadcrumb-separator svelte-myc5g6">›</span> <!>',1),zL=B('<div class="breadcrumbs svelte-myc5g6"><!> <!></div>'),FL=B('<div class="mention-skeleton svelte-myc5g6"><div class="skeleton-icon svelte-myc5g6"></div> <div class="skeleton-text svelte-myc5g6"></div></div>'),HL=B('<div class="mention-loading svelte-myc5g6" role="status"></div>'),UL=B('<div class="mention-section-heading type-caption px-2 pt-2 pb-1 font-medium text-muted-foreground svelte-myc5g6" role="presentation"> </div>'),VL=B('<div class="mention-section svelte-myc5g6"><!> <!></div>'),WL=B('<div class="mention-items svelte-myc5g6" role="listbox" tabindex="-1"></div>'),jL=B('<div class="mention-empty svelte-myc5g6" role="status"> </div>'),KL=B('<div class="enhanced-mention-list svelte-myc5g6"><div class="mention-container svelte-myc5g6"><div class="mention-list-section svelte-myc5g6"><!> <!></div></div></div>');function jc(n,e){const t=Ti();if(new.target)return It({component:jc,...n});Rt(e,!0);const r=(G,O=Or)=>{const te=w(()=>l(F).indexOf(O())),ve=w(()=>C(O())),de=w(()=>l(te)===l(d)),fe=w(()=>!Ui(O())&&O().type==="agent"),ke=w(()=>!Ui(O())&&O().type==="member"),be=w(()=>l(ke)?Xf(O().label):O().label);{let J=w(dh),Me=w(()=>l(de)?"selected":""),Be=w(()=>ce(O())),gt=w(()=>l(ke)&&O().subtitle?`${l(be)} · ${O().subtitle}`:l(be));Je(G,{variant:"plain",wrapContent:!1,get class(){return`${l(J)??""} mention-item ${l(Me)??""}`},get id(){return l(Be)},role:"option",get"aria-selected"(){return l(de)},get"aria-label"(){return l(gt)},tabindex:-1,onpointerdown:Ie=>Ie.preventDefault(),onmousedown:Ie=>Ie.preventDefault(),onclick:()=>L(l(te)),onmouseenter:()=>{l(v)||k(d,l(te),!0)},children:(Ie,$e)=>{var ze=NL(),vt=ae(ze);{var Vt=Fe=>{{let Ke=w(()=>O().meta?.avatarUrl);Tv(Fe,{get avatarUrl(){return l(Ke)},get label(){return O().label},size:18})}},st=Fe=>{var Ke=PL(),Yt=ne(Ke);sw(Yt,{get agentId(){return O().id}}),Q(Ke),x(Fe,Ke)},Ae=Fe=>{var Ke=IL();let Yt;var Ne=ne(Ke);rt(Ne,{get icon(){return l(ve)}}),Q(Ke),N(()=>Yt=at(Ke,1,"mention-icon svelte-myc5g6",null,Yt,{selected:l(de)})),x(Fe,Ke)};K(vt,Fe=>{l(ke)?Fe(Vt):l(fe)?Fe(st,1):Fe(Ae,-1)})}var Ce=A(vt,2),we=ne(Ce),Ue=ne(we),_t=re(Ue,!0);Q(we);var se=A(we,2);{var Ze=Fe=>{var Ke=LL(),Yt=re(Ke,!0);N(()=>H(Yt,O().subtitle)),x(Fe,Ke)},lt=w(()=>!Ui(O())&&O().subtitle);K(se,Fe=>{l(lt)&&Fe(Ze)})}Q(Ce);var et=A(Ce,2);{var bt=Fe=>{var Ke=OL(),Yt=ne(Ke);rt(Yt,{get icon(){return Rp},size:"xs"}),Q(Ke),x(Fe,Ke)},Bt=w(()=>Ui(O()));K(et,Fe=>{l(Bt)&&Fe(bt)})}N(()=>H(_t,l(be))),x(Ie,ze)},$$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=he(0);const f=new rw,h=w(()=>f.breadcrumbs),p=w(()=>f.isInGroup()?f.currentItems:s());let g,v=he(!0);const m=w(()=>typeof l(F)<"u"&&l(F).length>0?l(F)[l(d)]||null:l(p)[l(d)]||null);function C(G){const O=Ui(G)?"group":G.type,te=RL(O,G.subtype);return{file:jo,"file-code":of,"file-text":nh,"file-json":of,folder:ti,"folder-open":sx,"folder-code":ti,"sticky-note":nf,"list-todo":rx,"check-square":nx,shield:tx,terminal:hv,"external-link":ex,globe:th,palette:Z1,database:Q1,settings:Y1,lock:X1,"git-branch":Sd,box:J1,wrench:q1,package:G1,image:Gc,"test-tube":K1,"book-open":j1,"package-check":pv,users:W1,lightbulb:V1,"pen-tool":U1,bug:H1,sparkles:F1,"trending-up":z1,"refresh-cw":B1,"shield-check":Pp,"align-left":$1,"shield-alert":Pp,play:D1,hammer:N1,rocket:O1,github:Sd,gitlab:Sd,files:cv,folders:ti,"chevron-right":Rp,"user-tie":dv,"user-graduate":L1,"chalkboard-teacher":I1,bolt:P1,robot:fv,brain:R1}[te]||jo}sc(()=>f.destroy());function $(G){if(f?.handleKeyboard(G))return G.preventDefault(),G.stopPropagation(),!0;switch(G.key){case"ArrowUp":return G.preventDefault(),G.stopPropagation(),S(),!0;case"ArrowDown":return G.preventDefault(),G.stopPropagation(),D(),!0;case"ArrowRight":return!l(m)||!Ui(l(m))?!1:(G.preventDefault(),G.stopPropagation(),I(),!0);case"Enter":return G.preventDefault(),G.stopPropagation(),I(),!0;case"Escape":return G.preventDefault(),G.stopPropagation(),l(h).length>0?f.navigateToRoot():o()?.(),!0;default:return!1}}function M({event:G}){return $(G)}function S(){const G=l(F).length;G!==0&&(k(d,(l(d)+G-1)%G),E())}function D(){const G=l(F).length;G!==0&&(k(d,(l(d)+1)%G),E())}function I(){L(l(d))}async function E(){if(await Qo(),!g)return;const G=g.querySelector(".mention-item.selected");if(!G)return;const O=l(ie)?l(U).find(te=>te.items[0]===l(F)[l(d)]):void 0;O&&document.getElementById(Y(O))?.scrollIntoView?.({block:"nearest",behavior:"instant"}),G.scrollIntoView?.({block:"nearest",behavior:"instant"})}function L(G){const O=l(F)[G];O&&(Ui(O)?(f.push(O),k(d,0)):i()(O))}function ee(G){f.navigateToBreadcrumb(G),k(d,0)}ut(()=>{l(p),k(d,0),k(v,!0)});const U=w(()=>AL(Array.isArray(l(p))?l(p):[])),ie=w(()=>l(U).length>1),F=w(()=>l(U).flatMap(G=>G.items));function W(G){G.target instanceof Element&&G.target.closest(".mention-section-heading")&&G.preventDefault()}function Y(G){return`${t}-section-${G.key}`}function ce(G){return`${t}-option-${encodeURIComponent(`${Ui(G)?"group":G.type}:${G.id}`)}`}const pe=w(()=>l(m)?ce(l(m)):void 0);ut(()=>u()?.(l(pe)));var j={onKeyDown:M,get items(){return s()},set items(G=[]){s(G),b()},get command(){return i()},set command(G){i(G),b()},get onClose(){return o()},set onClose(G){o(G),b()},get loading(){return a()},set loading(G=!1){a(G),b()},get listboxId(){return c()},set listboxId(G=`${t}-listbox`){c(G),b()},get onActiveOptionChange(){return u()},set onActiveOptionChange(G){u(G),b()},$set:Lt,$on:(G,O)=>Ot(e,G,O)},ue=KL(),P=ne(ue),z=ne(P),le=ne(z);{var ge=G=>{var O=zL(),te=ne(O);Je(te,{variant:"plain",class:"breadcrumb-item",onmousedown:de=>de.preventDefault(),onclick:()=>f.navigateToRoot(),children:(de,fe)=>{$t();var ke=zt();N(be=>H(ke,be),[()=>_.chat_mentionList_all_label()]),x(de,ke)},$$slots:{default:!0}});var ve=A(te,2);as(ve,19,()=>l(h),(de,fe)=>de.id||`crumb-${fe}`,(de,fe,ke)=>{var be=BL(),J=A(ae(be),2);Je(J,{variant:"plain",class:"breadcrumb-item",onmousedown:Me=>Me.preventDefault(),onclick:()=>ee(l(ke)),children:(Me,Be)=>{var gt=$L(),Ie=ae(gt);{var $e=vt=>{var Vt=DL(),st=re(Vt,!0);N(()=>H(st,l(fe).icon)),x(vt,Vt)};K(Ie,vt=>{l(fe).icon&&vt($e)})}var ze=A(Ie);N(()=>H(ze,` ${l(fe).label??""}`)),x(Me,gt)},$$slots:{default:!0}}),x(de,be)}),Q(O),x(G,O)};K(le,G=>{l(h).length>0&&G(ge)})}var ye=A(le,2);{var Z=G=>{var O=HL();as(O,20,()=>[0,1,2,3],te=>te,(te,ve)=>{var de=FL(),fe=A(ne(de),2);Q(de),N(()=>Xi(fe,`width: ${55+ve*12}%`)),x(te,de)}),Q(O),N(te=>ot(O,"aria-label",te),[()=>_.ui_combobox_loadingOptions_message()]),x(G,O)},oe=G=>{var O=WL();as(O,21,()=>l(U),te=>te.key,(te,ve)=>{var de=VL(),fe=ne(de);{var ke=J=>{var Me=UL(),Be=re(Me,!0);N(gt=>{ot(Me,"id",gt),H(Be,l(ve).label)},[()=>Y(l(ve))]),x(J,Me)};K(fe,J=>{l(ie)&&J(ke)})}var be=A(fe,2);as(be,17,()=>l(ve).items,J=>ce(J),(J,Me)=>{r(J,()=>l(Me))}),Q(de),N(J=>{ot(de,"role",l(ie)?"group":void 0),ot(de,"aria-labelledby",J)},[()=>l(ie)?Y(l(ve)):void 0]),x(te,de)}),Q(O),N(te=>{ot(O,"id",c()),ot(O,"aria-label",te),ot(O,"aria-activedescendant",l(pe)),ot(O,"aria-busy",a())},[()=>_.chat_mentionList_ariaLabel()]),Qr("keydown",O,$),Qr("mousemove",O,()=>k(v,!1)),Qr("pointerdown",O,W),Qr("mousedown",O,W),x(G,O)},V=G=>{var O=jL(),te=re(O,!0);N(ve=>H(te,ve),[()=>_.chat_mentionList_noResults_label()]),x(G,O)};K(ye,G=>{a()&&l(p).length===0?G(Z):l(p).length>0?G(oe,1):G(V,-1)})}return Q(z),Q(P),Q(ue),jn(ue,G=>g=G,()=>g),x(n,ue),Pt(j)}Ro(["keydown","mousemove","pointerdown","mousedown"]);class GL{constructor(e){it(this,"unregisterPopup");it(this,"component",null);it(this,"popup",null);it(this,"editorElement",null);it(this,"inputContainer",null);it(this,"listboxId",`mention-listbox-${crypto.randomUUID()}`);it(this,"previousAria",new Map);it(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=Cl(jc,{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=Cl(jc,{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?(Et.info("[MentionSuggestionRenderer] Found .rich-input-container"),e):(e=this.editorElement.closest(".rich-textarea"),e?(Et.info("[MentionSuggestionRenderer] Found .rich-textarea"),e):(e=this.editorElement.closest('[style*="position"]'),e?(Et.info("[MentionSuggestionRenderer] Found positioned ancestor"),e):(Et.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){Et.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`),Et.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(Et.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){Et.info("[MentionSuggestionRenderer] Initializing popup and component in onUpdate (onStart was skipped)"),this.onStart(e);return}this.component&&this.popup?(Et.info("[MentionSuggestionRenderer] Updating component props without remounting"),this.component.$set({items:e.items,command:e.command,loading:!1})):!this.component&&this.popup&&(Et.info("[MentionSuggestionRenderer] Creating component in onUpdate"),this.component=Cl(jc,{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&&uo(this.component),this.popup=null,this.component=null}onExit(){this.generation=0,this.cleanup()}}function qL(n){const e=new GL(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 Vn(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=JL(t,r);return i?{score:XL(t,r,i),matches:i}:null}function JL(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 XL(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||YL(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 YL(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 QL(n,e){if(!n||!e)return null;if(!n.includes("/"))return Vn(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=ZL(t,r);return s?{score:eO(t,r,s),matches:[]}:null}function ZL(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(Vn(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&&Vn(i,f)){t.push(c),r=c+1,o=!0;break}if(d&&Vn(i,d)){t.push(c),r=c+1,o=!0;break}}}if(!o)return null}return t}function eO(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 Ba(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 iw="*",tO=["member","note","agent","file","folder","script","terminal",iw,"specialist"];function ow(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(iw)??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 nO(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 rO{constructor(e={}){it(this,"searchDebounceTimer",null);it(this,"currentAbortController",null);it(this,"cache",new Map);it(this,"config");it(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=Ba(e,t,r),i=this.cache.get(s);if(i&&!this.isCacheExpired(i))return Et.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}Et.debug("[SearchService] Searching with providers:",t.map(E=>E.id));const m=Ba(e,t,r),C=await Promise.all(t.map(E=>this.searchWithProvider(E,e,r,a)));if(a.aborted)return;if(m!==Ba(e,t,r)){h([]);return}const M=this.combineResults(C.flat()).filter(E=>TL(E)),S=this.applyFuzzyMatching(e,M),D=ow(S,this.config.typeOrder),I=this.config.typeOrder.length>0?nO(D,this.config.maxResultsPerKind):D.slice(0,this.config.maxResults);this.cache.set(m,{results:I,timestamp:Date.now()}),Et.debug(`[SearchService] Found ${I.length} results`),h(I)}catch(m){a.aborted?p(new DOMException("Search cancelled","AbortError")):(Et.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||Et.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=QL(e,a);u&&(o=Math.max(o,u.score*1.8))}const c=Vn(e,i.label);if(c&&(o=Math.max(o,c.score*1.5)),i.subtitle){const u=Vn(e,i.subtitle);u&&(o=Math.max(o,u.score))}if(i.description){const u=Vn(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 sO{constructor(){it(this,"id","file");it(this,"triggers",["@file","@f"]);it(this,"default",!0);it(this,"supportsRanges",!0);it(this,"supportsLivePreview",!0);it(this,"recentFiles",new Set);it(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){Et.debug("[FileProvider] Searching for:",{query:e,context:{workspaceId:t.workspaceId}});const r=t.workspaceId;if(!r)return[];try{const s=await yv("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 Et.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?Vn(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 iO{constructor(){it(this,"id","member")}getCacheKey(e){const t=At.state;return JSON.stringify({backendId:h_.select(t),ownPrincipalId:t.presence.ownPrincipalId,members:e.workspaceId?Lp.select(t,e.workspaceId):[]})}async search(e,t){const{workspaceId:r}=t;if(!r)return[];const s=e.replace(/^@/,"").toLowerCase();return Lp.select(At.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 oO{constructor(){it(this,"id","folder");it(this,"triggers",["@folder","@dir"])}async search(e,t){const r=t.workspaceId;if(!r)return[];try{const{backendRequest:s}=await xs(async()=>{const{backendRequest:c}=await import("./Bfr1QjPr.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?Vn(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 Et.debug("[FolderProvider] Failed to get folders:",s),[]}}}const aO=10,lO=.3;function cO(n){const e=n.toLowerCase().split(/\s+/).filter(Boolean);return(t,r)=>{const s=t?Vn(n,t):null;if(s)return 1+s.score;if(r){const i=r.toLowerCase();if(e.every(o=>i.includes(o)))return lO}return 0}}class uO{constructor(){it(this,"id","note");it(this,"triggers",["@note","@n"]);it(this,"supportsRanges",!0);it(this,"cachedNotes",[]);it(this,"lastCacheUpdate",0);it(this,"cacheTimeout",5e3)}async getSiblingWorkspaces(e){if(!e)return[];try{const[{store:t},{selectWorkspaceItems:r}]=await Promise.all([xs(()=>import("./q36554_4.js"),__vite__mapDeps([13,14,15,2,16,17,5,3,1,18,11,9,19,20]),import.meta.url),xs(()=>import("./Cg2SHWhQ.js").then(o=>o.dY),__vite__mapDeps([21,11,5,1,2,14,15,16,17,3,18,9,22,8,4,6,23,0,7,10,12,24,25]),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 Et.debug("[NoteProvider] Failed to get sibling workspaces:",t),[]}}async fetchNotesFromWorkspace(e,t){try{const[{store:r},{listSlimNotesRequested:s}]=await Promise.all([xs(()=>import("./q36554_4.js"),__vite__mapDeps([13,14,15,2,16,17,5,3,1,18,11,9,19,20]),import.meta.url),xs(()=>import("./D5ej8a-y.js").then(o=>o.LE),__vite__mapDeps([14,15,2,16,17,5,3,1,18,11,9]),import.meta.url)]);return(await r.dispatch(s(e))).map(o=>({note:o,workspaceId:e,workspaceTitle:t}))}catch(r){Et.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?cO(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,aO).map(({entry:{note:p,workspaceId:g,workspaceTitle:v},score:m})=>{const C=g===t.workspaceId,$=C?void 0:_.chat_mentions_fromWorkspace_subtitle({workspace:v||g}),M=p.content||p.contentPreview;return{candidate:{id:p.id,type:"note",label:p.title||p.id||_.chat_mentions_untitledNote_label(),subtitle:$,description:M?`${M.substring(0,100)}...`:"",icon:"📝",uri:`devspace://note/${p.id}`,meta:{preview:M?.substring(0,200)||"",workspaceId:g,...C?{}:{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){Et.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 dO{constructor(){it(this,"id","external");it(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||Vn(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 fO{constructor(){it(this,"id","rule");it(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||Vn(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 hO{constructor(){it(this,"id","task");it(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||Vn(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 pO{constructor(){it(this,"id","personality");it(this,"triggers",["@personality","@persona"]);it(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||Vn(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 gO{constructor(){it(this,"id","command");it(this,"triggers",["@cmd","@command"])}async search(e,t){return[Bm.USE_DEFAULT_CONTEXT,Bm.CLEAR_CONTEXT].filter(s=>!e||s.label.toLowerCase().includes(e.toLowerCase()))}}class mO{constructor(){it(this,"id","terminal");it(this,"triggers",["@terminal","@term"])}async search(e,t){try{const{terminalManager:r}=await xs(async()=>{const{terminalManager:v}=await import("./BnovDLUv.js").then(m=>m.c);return{terminalManager:v}},__vite__mapDeps([26,2,1,27,28,9,5,29,30,14,15,16,17,3,18,11,0,4,6,7,8,10,12,31,23,32,33,34,35,36,37,38,24,39,40]),import.meta.url),{selectTerminals:s,selectTerminalDisplayName:i}=await xs(async()=>{const{selectTerminals:v,selectTerminalDisplayName:m}=await import("./Jt_K3Kpx.js").then(C=>C.i);return{selectTerminals:v,selectTerminalDisplayName:m}},__vite__mapDeps([39,14,15,2,16,17,5,3,1,18,11,9]),import.meta.url),a=At.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=>Vn(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 Et.debug("[TerminalProvider] Failed to get terminals:",r),[]}}}class vO{constructor(){it(this,"id","script");it(this,"triggers",["@script","@scripts"])}async search(e,t){try{const{selectScriptEntries:r}=await xs(async()=>{const{selectScriptEntries:c}=await import("./BkT4AaId.js");return{selectScriptEntries:c}},__vite__mapDeps([41,14,15,2,16,17,5,3,1,18,11,9,42,43,4,6,0,7,8,10,12,25,44,45,22,46,47,48,21,23,24,49,28,27,50,51,32,30,52]),import.meta.url);if(!t.workspaceId)return[];const s=r.select(At.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=>Vn(e,c.name)!==null||Vn(e,zp(c))!==null):s).slice(0,10).map(c=>{const u=c.runtime.status,d=Wp(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} · ${zp(c)}`,description:_.chat_mentions_scriptOutput_description(),icon:"▶️",uri:`devspace://script/${encodeURIComponent(c.id)}`,meta:{workspaceId:t.workspaceId,command:c.command,status:Wp(u)?"ok":u==="exited"?"warning":void 0}}})}catch(r){return Et.debug("[ScriptProvider] Failed to get scripts:",r),[]}}}class bO{constructor(){it(this,"id","specialist");it(this,"triggers",["@specialist","@spec"])}async search(e,t){try{const r=o_.select(At.state);return!r||r.length===0?[]:r.filter(s=>e?Vn(e,s.name)!==null||Vn(e,s.id)!==null||Vn(e,s.description)!==null||Vn(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 Et.debug("[SpecialistProvider] Failed to get specialists:",r),[]}}}class yO{constructor(){it(this,"id","agent");it(this,"triggers",["@agent"])}async search(e,t){try{const{selectAllWorkspaceAgents:r}=await xs(async()=>{const{selectAllWorkspaceAgents:a}=await import("./Cg2SHWhQ.js").then(c=>c.dV);return{selectAllWorkspaceAgents:a}},__vite__mapDeps([21,11,5,1,2,14,15,16,17,3,18,9,22,8,4,6,23,0,7,10,12,24,25]),import.meta.url),s=t.workspaceId;if(!s)return[];const i=r.select(At.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=i_.select(At.state,d);m&&(f=m.name)}if(e){const m=Vn(e,u)!==null,C=Vn(e,"agent")!==null,$=f&&Vn(e,f)!==null,M=d&&Vn(e,d)!==null;if(!m&&!C&&!$&&!M)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(Gk(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 Et.debug("[AgentProvider] Failed to get agents:",r),[]}}}class wO{constructor(){it(this,"providers",new Map);it(this,"defaultProviders",[]);this.register(new sO),this.register(new oO),this.register(new uO),this.register(new dO),this.register(new fO),this.register(new hO),this.register(new pO),this.register(new gO),this.register(new mO),this.register(new vO),this.register(new yO),this.register(new bO),this.register(new iO),this.defaultProviders=["file","folder","note","terminal","script","agent","specialist","member"]}register(e){this.providers.set(e.id,e),Et.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 Ea=new wO,xO=5e3,kO=8,_O=100,SO=50,CO=/^devspace:\/\/[^\/]+\/([^\/]+)/,MO=[{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()}}],TO=[{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}],EO=[{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 AO(n){return typeof n.getCachedNotes=="function"}class RO{constructor(e={}){it(this,"searchService");it(this,"breadcrumbController");it(this,"resolvers",new Map);it(this,"config");it(this,"cachedResults",new Map);this.config={...e,typeOrder:e.typeOrder??tO},this.searchService=new rO(this.config),this.breadcrumbController=new rw}async search(e,t){if(!t?.workspaceId&&!t?.repoPath)return Et.error("[MentionSystem] search called without valid context (no workspaceId or repoPath)"),[];const r=(e||"").trim(),s=this.getProvidersForQuery(r);if(s.length===0)return Et.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"||Et.error("[MentionSystem] Search failed:",i),[]}}searchSync(e,t){const r=e.toLowerCase();if(!t?.workspaceId&&!t?.repoPath)return Et.debug("[MentionSystem] searchSync called without workspaceId or repoPath - returning empty results"),[];const s=Ba(e,this.getProvidersForQuery(e),t),i=Date.now();if(this.cachedResults.has(s)){const a=this.cachedResults.get(s);if(a&&i-a.timestamp<xO)return this.cachedResults.delete(s),this.cachedResults.set(s,a),a.results}this.updateCache(e,t).catch(a=>{Et.warn("[MentionSystem] Background cache update failed:",a)});const o=[];return o.push(...this.getNoteCandidates(r)),o.push(...this.filterCandidates(TO,r,3)),o.push(...this.filterCandidates(EO,r,2)),ow(o,this.config.typeOrder??[]).slice(0,kO)}getNoteCandidates(e){const t=Ea.get("note");if(t&&AO(t))try{return(t.getCachedNotes()||[]).filter(s=>!e||s.label&&typeof s.label=="string"&&s.label.toLowerCase().includes(e)).slice(0,3)}catch(r){Et.warn("[MentionSystem] Failed to get cached notes:",r)}return this.filterCandidates(MO,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=Ba(e,this.getProvidersForQuery(e),t),s=await this.search(e,t);if(r!==Ba(e,this.getProvidersForQuery(e),t))return;const i={results:s,timestamp:Date.now()};this.cachedResults.delete(r),this.cachedResults.set(r,i);const o=Ea.get("note");if(o&&await o.search(e,t),this.cachedResults.size>_O){const a=this.cachedResults.size-SO,c=Array.from(this.cachedResults.keys()).slice(0,a);for(const u of c)this.cachedResults.delete(u);Et.debug(`[MentionSystem] Cache cleanup: removed ${a} entries`)}}catch(r){Et.warn("[MentionSystem] Cache update failed:",r)}}getProvidersForQuery(e){if(!e)return Ea.getDefault();if(e.startsWith("@")){const r=e.indexOf(" "),s=r>0?e.substring(0,r):e,i=Ea.getByTrigger(s);if(i.length>0)return Et.debug("[MentionSystem] Using triggered providers for:",s),i}const t=Ea.getDefault();return Et.debug("[MentionSystem] Using default providers, count:",t.length),t}async resolve(e){if(!e||typeof e!="string")return Et.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 Et.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 Et.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 Et.warn("[MentionSystem] Invalid URI provided to getPreview:",e),null;try{return(await this.resolve(e)).preview||null}catch(t){return Et.error("[MentionSystem] Failed to get preview:",t),null}}registerProvider(e){if(!e){Et.error("[MentionSystem] Cannot register null/undefined provider");return}if(!e.id){Et.error("[MentionSystem] Cannot register provider without id");return}try{Ea.register(e),Et.debug(`[MentionSystem] Registered provider: ${e.id}`)}catch(t){Et.error("[MentionSystem] Failed to register provider:",t)}}registerResolver(e,t){if(!e||!t){Et.error("[MentionSystem] Cannot register resolver with invalid type or resolver");return}this.resolvers.has(e)&&Et.warn(`[MentionSystem] Overwriting existing resolver for type: ${e}`),this.resolvers.set(e,t),Et.debug(`[MentionSystem] Registered resolver for type: ${e}`)}findResolver(e){if(!e||typeof e!="string")return;const t=e.match(CO);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)}Et.debug(`[MentionSystem] No resolver found for URI pattern: ${e}`)}getBreadcrumbController(){return this.breadcrumbController}clearCache(){this.searchService.clearCache(),this.cachedResults.clear(),Et.debug("[MentionSystem] All caches cleared")}destroy(){try{this.searchService.destroy(),this.breadcrumbController.destroy(),this.cachedResults.clear(),this.resolvers.clear(),Et.debug("[MentionSystem] System destroyed successfully")}catch(e){Et.error("[MentionSystem] Error during destroy:",e)}}}let Yd=null;function PO(n){return Yd||(Yd=new RO(n),Et.debug("[MentionSystem] Created new instance with config:",n)),Yd}const IO=eP.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 aw(n={}){return IO.configure({validate:void 0,...n})}const uB=aw,Fm=n=>n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),LO={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},OO=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 LO[t]??e});function NO(n){const e=[];let t=0;for(const r of r1(n,"markdown",{decode:OO})){r.index>t&&e.push(n.slice(t,r.index));const s=r.parsed?s1(r.parsed):null;if(s){const i=s.attributes.map(([o,a])=>` ${o}="${Fm(a)}"`).join("");e.push(`<span${i} class="${s.className}">${Fm(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 DO=new Set(["code","pre","script","style","a"]);function $O(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("/>");(DO.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(NO(o)):e.push(o),t=i}return e.join("")}function BO(n){return n.replace(/^ +| +$/g,e=>" ".repeat(e.length)).replace(/ {2,}/g,e=>` ${" ".repeat(e.length-1)}`)}function zO(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function FO(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(zO).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 HO(n,e=[]){if(!n)return"";const t=n.trim();if(t.startsWith("<")&&!t.startsWith("<!--anchor:"))return n;const s=`<p>${n.split(`
166
- `).map(i=>{if(i==="")return"";const o=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return FO(BO(o),e)}).join("<br>")}</p>`;return $O(s)}function Aa(n){return(n?.getText({blockSeparator:`
167
-
168
- `,textSerializers:{hardBreak:()=>`
169
- `}})??"").replace(/\u00A0/g," ")}function UO(n,e){const t=e.replace(/\r\n?/g,`
170
- `),r=[];return t.split(`
171
- `).forEach((s,i)=>{i>0&&r.push(n.nodes.hardBreak.create()),s!==""&&r.push(n.text(s))}),[n.nodes.paragraph.create(null,r)]}const VO={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"},_l=new Wn("trailingHint");function Hm(n,e){n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),e.onActivate()})}function Um(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 WO(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",VO[e]),t.append(r),n.append(t)}function jO(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),Um(e,n.ariaLabel),Hm(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),Um(t,n.ariaLabel),WO(t,n.icon),Hm(t,n),e.append(t)}if(n.shortcut){const t=document.createElement("kbd");t.textContent=n.shortcut,e.append(t)}return e}function KO(n){let e=1;return n.descendants((t,r)=>{t.isText&&t.textContent.trim()&&(e=r+t.nodeSize)}),e}const GO=Kn.create({name:"trailingHint",addProseMirrorPlugins(){return[new An({key:_l,state:{init:()=>null,apply(n,e){const t=n.getMeta(_l);return t===void 0?e:t}},props:{handleKeyDown(n,e){const t=_l.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=_l.getState(n);if(!e)return rn.empty;const t=KO(n.doc);return rn.create(n.doc,[Nr.widget(t,()=>jO(e),{key:`prompt-trailing-hint-${e.kind}`,side:1,ignoreSelection:!0,stopEvent:r=>r.type==="mousedown"||r.type==="click"})])}}})]}});var qO=B('<div class="slash-skill-state svelte-m8tzng" role="status" aria-live="polite"> </div>'),JO=B('<div class="slash-skill-state svelte-m8tzng" role="alert"> <!></div>'),XO=B('<div class="slash-skill-state svelte-m8tzng" role="status"> </div>'),YO=B('<span class="type-body"> </span>'),QO=B('<div class="slash-skill-notice svelte-m8tzng" role="note"> </div>'),ZO=B('<div class="slash-skill-options svelte-m8tzng" role="listbox" tabindex="-1"></div> <!>',1),eN=B('<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 lw(n,e){const t=Ti();if(new.target)return It({component:lw,...n});Rt(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=he(0),g=he(void 0);const v=w(()=>!s()&&!i()&&r()[l(p)]?m(r()[l(p)]):void 0);function m(W){return`${t}-option-${encodeURIComponent(`${W.name}:${W.location}`)}`}ut(()=>{r(),s(),i(),k(p,0)}),ut(()=>{h()?.(l(v))});function C(){l(g)?.querySelector('[role="option"][aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})}function $(W){r().length!==0&&(k(p,(l(p)+W+r().length)%r().length),C())}function M(W){const Y=r()[W];Y&&!s()&&!i()&&u()(Y)}function S(W){if((s()||i())&&W.key!=="Escape")return!1;switch(W.key){case"ArrowUp":return r().length===0?!1:(W.preventDefault(),W.stopPropagation(),$(-1),!0);case"ArrowDown":return r().length===0?!1:(W.preventDefault(),W.stopPropagation(),$(1),!0);case"Enter":return r().length===0?!1:(W.preventDefault(),W.stopPropagation(),M(l(p)),!0);case"Escape":return W.preventDefault(),W.stopPropagation(),d()?.(),!0;default:return!1}}function D({event:W}){return S(W)}var I={onKeyDown:D,get items(){return r()},set items(W=[]){r(W),b()},get loading(){return s()},set loading(W=!1){s(W),b()},get error(){return i()},set error(W=null){i(W),b()},get listboxId(){return o()},set listboxId(W=`${t}-listbox`){o(W),b()},get emptyLabel(){return a()},set emptyLabel(W){a(W),b()},get notice(){return c()},set notice(W){c(W),b()},get onSelect(){return u()},set onSelect(W){u(W),b()},get onDismiss(){return d()},set onDismiss(W){d(W),b()},get onRetry(){return f()},set onRetry(W){f(W),b()},get onActiveOptionChange(){return h()},set onActiveOptionChange(W){h(W),b()},$set:Lt,$on:(W,Y)=>Ot(e,W,Y)},E=eN(),L=ne(E);{var ee=W=>{var Y=qO(),ce=re(Y,!0);N(pe=>H(ce,pe),[()=>_.chat_slashSkillSuggestionList_loading_label()]),x(W,Y)},U=W=>{var Y=JO(),ce=ne(Y),pe=A(ce);{var j=ue=>{Je(ue,{variant:"ghost",size:"sm",onpointerdown:P=>P.preventDefault(),get onclick(){return f()},children:(P,z)=>{$t();var le=zt();N(ge=>H(le,ge),[()=>_.ui_errorToast_retry_label()]),x(P,le)},$$slots:{default:!0}})};K(pe,ue=>{f()&&ue(j)})}Q(Y),N(ue=>H(ce,`${ue??""} `),[()=>_.chat_slashSkillSuggestionList_loadFailed_label()]),x(W,Y)},ie=W=>{var Y=XO(),ce=re(Y,!0);N(pe=>H(ce,pe),[()=>a()??_.chat_slashSkillSuggestionList_noResults_label()]),x(W,Y)},F=W=>{var Y=ZO(),ce=ae(Y);as(ce,23,r,ue=>`${ue.name}:${ue.location}`,(ue,P,z)=>{Hu(ue,{get content(){return l(P).description},side:"right",align:"start",size:"sm",class:"w-full",children:(le,ge)=>{{let ye=w(()=>m(l(P))),Z=w(()=>Mr(dh(),"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(z)&&"active")),oe=w(()=>l(p)===l(z));Je(le,{type:"button",get id(){return l(ye)},variant:"ghost",size:"sm",labelClass:"type-body",get class(){return l(Z)},role:"option",tabindex:-1,get"aria-label"(){return l(P).name},get"aria-selected"(){return l(oe)},onpointerenter:()=>k(p,l(z),!0),onpointerdown:V=>V.preventDefault(),onclick:()=>M(l(z)),children:(V,G)=>{var O=YO(),te=re(O,!0);N(()=>H(te,l(P).name)),x(V,O)},$$slots:{default:!0}})}},$$slots:{default:!0}})}),Q(ce),jn(ce,ue=>k(g,ue),()=>l(g));var pe=A(ce,2);{var j=ue=>{var P=QO(),z=re(P,!0);N(()=>H(z,c())),x(ue,P)};K(pe,ue=>{c()&&ue(j)})}N(ue=>{ot(ce,"id",o()),ot(ce,"aria-label",ue),ot(ce,"aria-activedescendant",l(v))},[()=>_.chat_slashSkillSuggestionList_ariaLabel()]),Qr("keydown",ce,S),x(W,Y)};K(L,W=>{s()?W(ee):i()?W(U,1):r().length===0?W(ie,2):W(F,-1)})}return Q(E),x(n,E),Pt(I)}Ro(["keydown"]);const Vm=/\s/u;function tN(n,e=n.length){if(e<0||e>n.length)return null;let t=e-1;for(;t>=0&&!Vm.test(n[t]);)t-=1;if(t+=1,n[t]!=="/"||e<t+1)return null;let r=t+1;for(;r<n.length&&!Vm.test(n[r]);)r+=1;return e>r?null:{query:n.slice(t+1,e),from:t,to:r}}function nN(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 Qd(n,e){const t=n.toLowerCase(),r=e.toLowerCase();return t<r?-1:t>r?1:n<e?-1:n>e?1:0}function rN(n,e){const t=e.toLowerCase();return n.map(r=>({skill:r,rank:nN(r,t)})).filter(r=>r.rank!==null).sort((r,s)=>r.rank-s.rank||Qd(r.skill.name,s.skill.name)||Qd(r.skill.location,s.skill.location)||Qd(r.skill.description,s.skill.description)).map(({skill:r})=>r)}var sN=B('<div class="tiptap-root svelte-bv9i3d"><!> <div></div></div>');function iN(n,e){const t=Ti();if(new.target)return It({component:iN,...n});Rt(e,!0);const r=DI.extend({parseHTML(){return[{tag:"span[data-mention]",getAttrs:R=>{const xe=R.getAttribute("data-meta");let Re={};if(xe)try{Re=JSON.parse(xe)}catch{Re={}}return{id:R.getAttribute("data-id")||R.textContent?.replace(/^@/,"")||null,label:R.getAttribute("data-label")||R.textContent?.replace(/^@/,"")||null,type:R.getAttribute("data-type")||"file",uri:R.getAttribute("data-uri")||"",meta:Re}}}]},addAttributes(){return{id:{default:null,parseHTML:R=>R.getAttribute?.("data-id")||R.textContent?.replace(/^@/,"")||null,renderHTML:R=>R.id?{"data-id":R.id}:{}},label:{default:null,parseHTML:R=>R.getAttribute?.("data-label")||R.textContent?.replace(/^@/,"")||null,renderHTML:R=>R.label?{"data-label":R.label}:{}},type:{default:"file",parseHTML:R=>R.getAttribute?.("data-type")||"file",renderHTML:R=>({"data-type":R.type||"file"})},uri:{default:"",parseHTML:R=>R.getAttribute?.("data-uri")||"",renderHTML:R=>R.uri?{"data-uri":R.uri}:{}},meta:{default:{},parseHTML:R=>{const xe=R.getAttribute?.("data-meta");if(!xe)return{};try{return JSON.parse(xe)}catch{return{}}},renderHTML:R=>({"data-meta":JSON.stringify(R.meta||{})})}}}}),s=ha("TipTapEditor"),i=PO();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),C=y(e,"autoFocus",7,!1),$=y(e,"onUpdate",7),M=y(e,"onSubmit",7),S=y(e,"onForceSubmit",7),D=y(e,"onEscape",7),I=y(e,"onHistoryPrev",7),E=y(e,"onHistoryNext",7),L=y(e,"onMentionStart",7),ee=y(e,"onMentionSelect",7),U=y(e,"onSelectionChange",7),ie=y(e,"contextItems",23,()=>[]),F=y(e,"trailingHint",7,null),W=y(e,"skills",23,()=>[]),Y=y(e,"skillsLoading",7,!1),ce=y(e,"skillsError",7,null),pe=y(e,"onSkillsRetry",7),j=y(e,"slashEmptyLabel",7),ue=y(e,"slashNotice",7),P=y(e,"unavailableSkillTitle",7),z=y(e,"screenReferences",7),le=y(e,"screenInsertions",23,()=>[]),ge=y(e,"screenInterim",23,()=>[]),ye=y(e,"screenSpeechActive",7,!1),Z=y(e,"onScreenInsertionApplied",7),oe=y(e,"onCompositionChange",7),V=y(e,"onUserTextInput",7),G=y(e,"onScreenReferencesEdited",7),O=y(e,"minHeight",7,80),te=y(e,"maxHeight",7,300);const ve=_v();let de=he(null);ut(()=>{if(!(!l(de)||!ve))return ve.register(l(de),()=>Ne())});const fe=w(()=>(!d()||f())&&!h()),ke=w(()=>!l(fe)&&!h());let be=he(void 0),J=he(null),Me=he(!1);const Be=new Set;function gt(){const R=l(J);if(!R||l(Me)||R.view.composing)return!1;if(!z())return!0;bL(R,z()),yL(R,z());for(const xe of le().slice(0,1)){if(Be.has(xe.id)){if(!Z())return!1;Z()(xe.id,Aa(R));continue}const Re=vo.getState(R.state)?.anchor;if(!Z()||!wL(R,xe,z(),Re))return!1;Be.add(xe.id),Z()(xe.id,Aa(R))}return le().length<=1}ut(()=>{c();const R=l(J);!u()||!R||R.isDestroyed||Zs(()=>R.view.dispatch(R.state.tr.setMeta("placeholder-refresh",!0)))}),ut(()=>{z(),le(),!(!l(J)||l(Me)||!l(fe))&&Zs(()=>gt())}),ut(()=>{const R=l(J),xe=ge(),Re=z(),ct=ye()||le().length>0;!R||!Re||l(Me)||R.view.composing||Zs(()=>{const Pe=vo.getState(R.state),Se=R.state.tr.setMeta(vo,xe.length||ct?{parts:xe,references:Re,anchor:Pe?.anchor??R.state.selection.from,ariaLabel:_.hardwareConsole_ptt_listening_label()}:null);R.view.dispatch(xe.length?Se.scrollIntoView():Se);const on=R.view.dom.querySelector("[data-screen-interim]"),{selection:an}=R.state;if(on?.parentNode&&R.view.hasFocus()&&an.empty&&an.from===vo.getState(R.state)?.anchor){const Ve=Array.prototype.indexOf.call(on.parentNode.childNodes,on);window.getSelection()?.collapse(on.parentNode,Ve+1)}})});let Ie=null,$e=null,ze;function vt(){ze?.(),ze=void 0,Ie&&uo(Ie),$e?.remove(),Ie=null,$e=null}let Vt=!1;ut(()=>{l(J)&&l(J).view.dom.setAttribute("aria-label",a())});let st=he(!1),Ae=he(null),Ce=he(null),we=he(null),Ue=he(null);const _t=`slash-skill-listbox-${t}`;let se=he(void 0);const Ze=w(()=>l(Ae)?rN(W(),l(Ae).query):[]),lt=w(()=>l(Ae)?`${l(Ae).from}:${l(Ae).to}:${l(Ae).query}`:null),et=w(()=>l(st)&&l(Ae)!==null&&l(lt)!==l(Ce)&&l(Ae).from!==l(we)&&(l(Ze).length>0||j()!==void 0&&l(Ae).query===""&&!Y())&&l(fe));ut(()=>{const R=l(J),xe=l(be),Re=P();if(!R||!xe)return;const ct=()=>{for(const Pe of xe.querySelectorAll('[data-type="skill-command"]')){const Se=Re?.(Pe.dataset.skillName??"");Pe.classList.toggle("skill-command-chip--unavailable",Se!==void 0),Se?Pe.title=Se:Pe.removeAttribute("title")}};return ct(),R.on("update",ct),()=>{R.off("update",ct)}}),ut(()=>{if(l(et))return fa(Ne)});function bt(R){return{...Fh(R.schema),hardBreak:()=>`
172
- `,pasteChip:()=>" "}}function Bt(R,xe){return zh(R.state.doc,{from:0,to:xe},{blockSeparator:`
173
-
174
- `,textSerializers:bt(R)}).replace(/\u00A0/g," ")}function Fe(R){return Bt(R,R.state.doc.content.size)}function Ke(R){return Bt(R,R.state.selection.from)}function Yt(R,xe){const Re=Fe(R),ct=tN(Re,Ke(R).length);(!ct||ct.from!==l(Ae)?.from)&&(k(Ce,null),k(we,null)),k(Ae,ct,!0),ct&&xe?.dismissNewContext&&k(Ce,l(lt),!0)}function Ne(){k(we,l(Ae)?.from??null,!0)}function en(R){R.preventDefault()}function Yn(R){if(!l(J)||!l(Ae))return;const xe=Fe(l(J)),Re=Ke(l(J)).length,ct={from:l(J).state.selection.from-l(Ae).query.length-1,to:l(J).state.selection.from+l(Ae).to-Re},Pe=l(Ae).to===xe.length||!/^\s/u.test(xe.slice(l(Ae).to)),Se=[{type:"skillCommand",attrs:{name:R.name}},...Pe?[{type:"text",text:" "}]:[]];l(J).chain().focus().insertContentAt(ct,Se).setTextSelection(ct.from+2).run()}function vn(R){const xe=HO(R,W().map(Re=>Re.name));return z()?vL(xe,z()):xe}function me(R){if(!l(et)||!l(Ue))return!1;const xe=!R.shiftKey&&!R.metaKey&&!R.ctrlKey&&!R.altKey&&["ArrowUp","ArrowDown","Enter"].includes(R.key);return R.key!=="Escape"&&!xe?!1:l(Ue).onKeyDown({event:R})?!0:R.key==="Enter"?(R.preventDefault(),!0):!1}function tt(){l(J)&&l(J).view&&l(J).chain().focus().insertContent("@").run()}function St(R){return l(J)&&l(J).view?(l(J).chain().focus().insertContent(R).run(),!0):!1}function sn(){if(h())return!1;if(l(J)&&l(J).view)try{if(l(J).view.hasFocus())return!0;const R=l(J),xe=document.activeElement;return requestAnimationFrame(()=>{if(l(J)!==R||R.isDestroyed||h()||R.view.hasFocus())return;const Re=document.activeElement;Re!==xe&&Re instanceof HTMLElement&&Sv(Re)&&!R.view.dom.contains(Re)||(R.view.focus(),R.commands.scrollIntoView())}),typeof l(J).view.hasFocus=="function"?l(J).view.hasFocus():!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focus:",R)}return!1}function jt(){if(h())return!1;if(l(J)&&l(J).view)try{return l(J).chain().focus("end").run(),!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focusEnd:",R)}return!1}function yt(){if(h())return!1;if(l(J)&&l(J).view)try{return l(J).chain().focus().selectAll().run(),!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",R)}return!1}function dt(){try{return l(J)?.getHTML?.()??""}catch(R){return s.error("[TipTapEditor] Error getting HTML:",R),l(J)?.getText?.()??""}}function Le(){l(J)&&(Vt=!0,l(J).commands.clearContent(!0),Vt=!1)}async function je(R){if(!l(J))return;const xe=vn(R||"");cu(xe,l(J).schema).eq(l(J).state.doc)||l(J).chain().command(({tr:Re})=>(Re.setMeta("external-update",!0),!0)).setContent(xe).run()}function qe(R,xe){l(J)&&l(J).view&&l(J).chain().focus().setImage({src:R,alt:xe||""}).createParagraphNear().focus().run()}function Ct(){if(!l(J))return s.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const R=[];return l(J).state.doc.descendants(xe=>{if(xe.type.name==="image"){const Re=xe.attrs.src;Re&&Re.startsWith("data:")&&R.push({src:Re,alt:xe.attrs.alt||void 0})}return!0}),s.debug("TipTapEditor: Extracted inline images",{imageCount:R.length,imageSources:R.map(xe=>({alt:xe.alt,srcLength:xe.src?.length||0}))}),R}function Ge(){return Aa(l(J))}function nt(R){if(s.debug("TipTapEditor: insertContextMention called",{hasEditor:!!l(J),hasEditorView:!!l(J)?.view,attrs:{itemType:R.itemType,identifier:R.identifier,title:R.title}}),l(J)&&l(J).view){const xe=l(J).chain().focus().insertContextMention(R).run();return s.debug("TipTapEditor: insertContextMention result",{result:xe}),xe}return s.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function Qe(R){if(!l(J)||!l(J).view)return s.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return l(J).chain().focus().insertContent({type:"mention",attrs:{id:R.id,label:R.label,type:R.type,uri:R.uri,meta:R.meta||{}}}).insertContent(" ").run(),!0}catch(xe){return s.error("TipTapEditor: insertMention failed",xe),!1}}function pt(){if(!l(J))return s.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const R=[];return l(J).state.doc.descendants(xe=>(xe.type.name==="mention"&&R.push({id:xe.attrs.id,label:xe.attrs.label,type:xe.attrs.type||"file",uri:xe.attrs.uri||"",meta:xe.attrs.meta||{}}),!0)),s.debug("TipTapEditor: Extracted mentions",{mentionCount:R.length,types:R.map(xe=>xe.type)}),R}function qt(){if(!l(J))return s.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const R=[];return l(J).state.doc.descendants(xe=>{if(xe.type.name==="contextMention"){const Re=xe.attrs;R.push({itemType:Re.itemType,provider:Re.provider,title:Re.title,url:Re.url,identifier:Re.identifier,contextId:Re.contextId,description:Re.description,metadata:Re.metadata})}return!0}),s.debug("TipTapEditor: Extracted context mentions",{mentionCount:R.length}),R}const Ht={char:"@",pluginKey:new Wn("mention"),items:async({query:R})=>{if(s.debug("Mention query:",R),L()?.(R),!v()&&m()){s.debug("No workspace but repoPath available, using async search:",m());const Re={workspaceId:void 0,repoPath:m(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const ct=await i.search(R,Re);return s.debug("Mention search results from repoPath:",ct.length),ct}catch(ct){s.error("Failed to search mentions with repoPath:",ct);const Pe=i.searchSync(R,Re);return s.debug("Fallback sync search results:",Pe.length),Pe}}if(!v())return s.debug("No workspace and no repoPath - returning empty results"),[];const xe={workspaceId:v().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Re=await i.search(R,xe);return s.debug("Mention search results:",Re.length),Re}catch(Re){return s.error("Failed to search mentions:",Re),[]}},render:()=>qL(ve),command:({editor:R,range:xe,props:Re})=>{const ct={id:Re.id,label:Re.label,type:Re.type,uri:Re.uri,meta:Re.meta||{}};R.view&&R.chain().focus().deleteRange(xe).insertContent({type:"mention",attrs:ct}).run(),ee()?.(Re)}};Fu(()=>{let R=!1;return(async()=>{const xe=vn(o()||"");if(R)return;const Re=l(be);if(!Re)return;k(J,new KA({element:Re,extensions:[...z()?[gL.configure({references:()=>z()??[]}),mL]:[],vI.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}),aw({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:Pe=>/^https?:\/\//.test(Pe)||Pe.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),bI.configure({placeholder:u()?({editor:Pe})=>vo.getState(Pe.state)?.parts.length?"":c():c(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),zI.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),GI.configure({workspaceId:v()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:Ht,renderHTML({node:Pe}){const Se=Vv(Pe.attrs,v()?.id,fS);return["span",{"data-mention":"true","data-type":Pe.attrs.type||"file","data-uri":Pe.attrs.uri||"","data-meta":JSON.stringify(Pe.attrs.meta||{}),"data-id":Pe.attrs.id,"data-label":Pe.attrs.label,class:"mention-chip",tabindex:"0"},Se]},renderText:({node:Pe})=>{const Se=Pe.attrs||{};try{return i1({type:Se.type,id:Se.id,label:Se.label,meta:Se.meta})}catch{return`@${Se?.meta?.fullPath||Se?.meta?.path||Se?.label||Se?.id||"item"}`}}}),uL.extend({renderText:({node:Pe})=>{const Se=Pe.attrs||{},on=JSON.stringify({provider:Se.provider||"browser",identifier:Se.identifier||"",title:Se.title||"",url:Se.url||"",description:Se.description||"",metadata:Se.metadata||"",itemType:Se.itemType||""});return`@context[${btoa(unescape(encodeURIComponent(on)))}]`}}),pL,kL,GO],content:xe,editable:l(fe),enableCoreExtensions:{delete:!1},onCreate:({editor:Pe})=>{Yt(Pe),C()&&requestAnimationFrame(()=>{if(Pe.isDestroyed)return;Pe.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:Pe})=>{Pe.docChanged&&Ie&&$e&&(uo(Ie),ze?.(),ze=void 0,$e.remove(),Ie=null,$e=null)},onUpdate:({editor:Pe,transaction:Se})=>{if(Se.getMeta("external-update")||Se.getMeta(rp)||Vt)return;const on=G()?xL(Se):null;on&&G()?.(on);const an=Aa(Pe);Yt(Pe,{dismissNewContext:Se.getMeta("uiEvent")==="paste"}),Se.getMeta(hd)?$()?.(an,{programmatic:!0}):$()?.(an)},onSelectionUpdate:({editor:Pe,transaction:Se})=>{Yt(Pe,{dismissNewContext:Se.getMeta("uiEvent")==="paste"});const{from:on,to:an,empty:Ve}=Pe.state.selection;if(Ve)U()?.(null);else{const dn=Pe.state.doc.textBetween(on,an," ");U()?.(dn.trim()||null)}},onFocus:({editor:Pe})=>{Zs(()=>{k(st,!0),Yt(Pe)})},onBlur:()=>{Zs(()=>{k(st,!1)})},editorProps:{handleDOMEvents:{compositionstart:()=>(Zs(()=>{k(Me,!0)}),oe()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!l(J)||l(J).isDestroyed||(Zs(()=>{k(Me,!1)}),oe()?.(!1),gt())})}),!1),beforeinput:()=>(V()?.(),!1)},attributes:{class:`tiptap-editor ${g()}`,role:"textbox","aria-multiline":"true","aria-label":a(),autocomplete:"off",spellcheck:"false",autocorrect:"off",autocapitalize:"off"},handlePaste:(Pe,Se)=>{if(SL(Se))return!0;const on=Se.clipboardData?.getData("text/plain");if(on){const an=on.split(`
175
- `);if(an.length>=5){const{state:Ve,dispatch:dn}=Pe,Mn=Ve.schema.nodes.pasteChip.create({content:on,lineCount:an.length}),Tn=Ve.tr.replaceSelectionWith(Mn).setMeta("uiEvent","paste");return dn(Tn),!0}if(/\r|\n/.test(on)){const{state:Ve,dispatch:dn}=Pe,Mn=UO(Ve.schema,on);if(Mn.length>0){const Tn=new We(_e.from(Mn),1,1);return dn(Ve.tr.replaceSelection(Tn).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(Pe,Se)=>_L(Se),handleKeyDown:(Pe,Se)=>{if(Pe.composing||Se.isComposing||Se.keyCode===229)return!1;if(me(Se))return!0;if(Se.key==="Escape"&&D())return Se.preventDefault(),D()(),!0;const on=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),an=Ve=>m_(Se,Xc(Ve),on);if(an("chat.mention-context")&&Xc("chat.mention-context")!=="@")return Se.preventDefault(),l(J)?.chain().focus().insertContent("@").run(),!0;if(on&&Se.ctrlKey&&!Se.metaKey){if(Se.key==="a"){Se.preventDefault();const{state:Ve,dispatch:dn}=Pe,Tn=Ve.selection.$head.start();return dn(Ve.tr.setSelection(Xe.create(Ve.doc,Tn))),!0}if(Se.key==="e"){Se.preventDefault();const{state:Ve,dispatch:dn}=Pe,Tn=Ve.selection.$head.end();return dn(Ve.tr.setSelection(Xe.create(Ve.doc,Tn))),!0}if(Se.key==="k"){Se.preventDefault();const{state:Ve,dispatch:dn}=Pe,Mn=Ve.selection.$head,Tn=Mn.pos,Os=Mn.end();return Tn<Os&&dn(Ve.tr.delete(Tn,Os)),!0}if(Se.key==="p"){Se.preventDefault();const Ve=window.getSelection();return Ve&&Ve.rangeCount>0&&Ve.modify("move","backward","line"),!0}if(Se.key==="n"){Se.preventDefault();const Ve=window.getSelection();return Ve&&Ve.rangeCount>0&&Ve.modify("move","forward","line"),!0}if(Se.key==="f"){Se.preventDefault();const Ve=window.getSelection();return Ve&&Ve.rangeCount>0&&Ve.modify("move","forward","character"),!0}if(Se.key==="b"){Se.preventDefault();const Ve=window.getSelection();return Ve&&Ve.rangeCount>0&&Ve.modify("move","backward","character"),!0}}if(Se.metaKey&&!Se.ctrlKey&&!Se.altKey){if(Se.key==="ArrowLeft"){Se.preventDefault();const Ve=window.getSelection();return Ve&&Ve.rangeCount>0&&Ve.modify(Se.shiftKey?"extend":"move","backward","lineboundary"),!0}if(Se.key==="ArrowRight"){Se.preventDefault();const Ve=window.getSelection();return Ve&&Ve.rangeCount>0&&Ve.modify(Se.shiftKey?"extend":"move","forward","lineboundary"),!0}if(Se.key==="ArrowUp"){Se.preventDefault();const{state:Ve,dispatch:dn}=Pe,Mn=1;if(Se.shiftKey){const{from:Tn}=Ve.selection;dn(Ve.tr.setSelection(Xe.create(Ve.doc,Mn,Tn)))}else dn(Ve.tr.setSelection(Xe.create(Ve.doc,Mn)));return!0}if(Se.key==="ArrowDown"){Se.preventDefault();const{state:Ve,dispatch:dn}=Pe,Mn=Ve.doc.content.size-1;if(Se.shiftKey){const{to:Tn}=Ve.selection;dn(Ve.tr.setSelection(Xe.create(Ve.doc,Tn,Mn)))}else dn(Ve.tr.setSelection(Xe.create(Ve.doc,Mn)));return!0}}if(an("chat.force-send"))return Se.preventDefault(),S()?.(),!0;if(an("chat.new-line"))return Se.preventDefault(),l(J)?.chain().setHardBreak().scrollIntoView().run(),!0;if(Se.key==="ArrowUp"&&I()&&!Se.shiftKey&&!Se.metaKey&&!Se.ctrlKey){if(Ht.pluginKey.getState(Pe.state)?.active)return!1;const{state:dn}=Pe,{from:Mn}=dn.selection,Tn=Mn<=1,Os=dn.doc.textContent.length===0;if(Tn||Os){const Ks=I()();if(Ks!==null)return Se.preventDefault(),l(J)?.chain().setContent(vn(Ks)).focus("end").run(),$()?.(Ks),!0}}if(Se.key==="ArrowDown"&&E()&&!Se.shiftKey&&!Se.metaKey&&!Se.ctrlKey){if(Ht.pluginKey.getState(Pe.state)?.active)return!1;const{state:dn}=Pe,{to:Mn}=dn.selection,Tn=dn.doc.content.size-1,Os=Mn>=Tn,Ks=dn.doc.textContent.length===0;if(Os||Ks){const Ms=E()();if(Ms!==null)return Se.preventDefault(),l(J)?.chain().setContent(vn(Ms)).focus("end").run(),$()?.(Ms),!0}}return an("chat.send")?Ht.pluginKey.getState(Pe.state)?.active?!1:M()?(Se.preventDefault(),M()(),!0):!1:!1}}}),!0),Re.addEventListener("mouseover",mt),Re.addEventListener("mouseout",Nt),Re.addEventListener("click",wr),l(J).view.dom.addEventListener("keydown",Br)})(),()=>{R=!0}});function mt(R){const xe=R.target,Re=Op(xe);if(Re){const ct=xe.getBoundingClientRect();if(!$e){$e=document.createElement("div"),(ve?.target()??document.body).appendChild($e);const Pe=Re.type||"file",Se=Re.label||xe.textContent||"",on={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};Ie=Cl(tw,{target:$e,props:{mention:{id:Re.id,type:Pe,label:Se,uri:Re.uri,meta:Re.meta,icon:on[Pe]||"📄"},position:{x:ct.left,y:ct.bottom+5},onClose:()=>{Ie&&$e&&(uo(Ie),ze?.(),ze=void 0,$e.remove(),Ie=null,$e=null)}}});const an=$e.firstElementChild;an instanceof HTMLElement&&(ze=ve?.register(an,vt)),$e.addEventListener("mouseout",Rn)}}}function Nt(R){const xe=R.target;R.relatedTarget?.closest(".mention-hover-preview")||xe.hasAttribute("data-mention")&&Ie&&$e&&(uo(Ie),ze?.(),ze=void 0,$e.remove(),Ie=null,$e=null)}function Rn(R){R.relatedTarget?.closest("[data-mention]")||Ie&&$e&&(uo(Ie),ze?.(),ze=void 0,$e.remove(),Ie=null,$e=null)}async function wr(R){const xe=Op(R.target);if(xe&&xe.type!=="member"){if(xe.intentUrl){R.preventDefault(),R.stopPropagation();const{handleIntentLink:Re}=await xs(async()=>{const{handleIntentLink:ct}=await import("./BuvdM8FN.js");return{handleIntentLink:ct}},__vite__mapDeps([53,1,2,43,9,5,4,3,6,0,7,8,10,11,12,25,44,14,15,16,17,18,45,22,46,47,48,21,23,24,51,32]),import.meta.url);await Re(xe.intentUrl);return}if(xe.type==="note"&&xe.note){if(R.preventDefault(),R.stopPropagation(),xe.note.workspaceId){const{handleIntentLink:Re}=await xs(async()=>{const{handleIntentLink:ct}=await import("./BuvdM8FN.js");return{handleIntentLink:ct}},__vite__mapDeps([53,1,2,43,9,5,4,3,6,0,7,8,10,11,12,25,44,14,15,16,17,18,45,22,46,47,48,21,23,24,51,32]),import.meta.url);await Re(o1(xe.note.id,xe.note.workspaceId))}else{const{navigateToNote:Re}=await xs(async()=>{const{navigateToNote:ct}=await import("./3KbBjGJm.js").then(Pe=>Pe.h);return{navigateToNote:ct}},__vite__mapDeps([54,27,2,55,56,38,21,11,5,1,14,15,16,17,3,18,9,22,8,4,6,23,0,7,10,12,24,25,32,52,57]),import.meta.url);await Re(xe.note.id)}return}if(xe.type==="file"&&xe.filePath){R.preventDefault(),R.stopPropagation();const{navigateToFile:Re}=await xs(async()=>{const{navigateToFile:ct}=await import("./3KbBjGJm.js").then(Pe=>Pe.h);return{navigateToFile:ct}},__vite__mapDeps([54,27,2,55,56,38,21,11,5,1,14,15,16,17,3,18,9,22,8,4,6,23,0,7,10,12,24,25,32,52,57]),import.meta.url);await Re(xe.filePath);return}}}function Br(R){if(!R.metaKey||R.ctrlKey||R.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(R.key)||!l(J))return;const{state:xe,dispatch:Re}=l(J).view;if(R.key==="ArrowLeft"){R.preventDefault(),R.stopPropagation();const ct=window.getSelection();ct&&ct.rangeCount>0&&ct.modify(R.shiftKey?"extend":"move","backward","lineboundary")}else if(R.key==="ArrowRight"){R.preventDefault(),R.stopPropagation();const ct=window.getSelection();ct&&ct.rangeCount>0&&ct.modify(R.shiftKey?"extend":"move","forward","lineboundary")}else if(R.key==="ArrowUp"){R.preventDefault(),R.stopPropagation();const ct=1;if(R.shiftKey){const{from:Pe}=xe.selection;Re(xe.tr.setSelection(Xe.create(xe.doc,ct,Pe)).scrollIntoView())}else Re(xe.tr.setSelection(Xe.create(xe.doc,ct)).scrollIntoView())}else if(R.key==="ArrowDown"){R.preventDefault(),R.stopPropagation();const ct=xe.doc.content.size-1;if(R.shiftKey){const{to:Pe}=xe.selection;Re(xe.tr.setSelection(Xe.create(xe.doc,Pe,ct)).scrollIntoView())}else Re(xe.tr.setSelection(Xe.create(xe.doc,ct)).scrollIntoView())}}sc(()=>{l(J)&&(l(J).view.dom.removeEventListener("keydown",Br),l(J).destroy()),l(be)&&(l(be).removeEventListener("mouseover",mt),l(be).removeEventListener("mouseout",Nt),l(be).removeEventListener("click",wr)),$e&&$e.removeEventListener("mouseout",Rn),Ie&&$e&&(uo(Ie),ze?.(),ze=void 0,$e.remove())});let ds=0;ut(()=>{if(!l(J))return;const R=Aa(l(J));if(o()===R)return;if(l(J).view.hasFocus()){ds+=1;return}const xe=l(J).view.hasFocus(),{from:Re}=l(J).state.selection,ct=++ds;(async()=>{const Pe=vn(o()||"");!l(J)||ct!==ds||Aa(l(J))===R&&l(J).chain().command(({tr:Se})=>(Se.setMeta("external-update",!0),!0)).setContent(Pe).command(({tr:Se,state:on})=>{if(xe)try{const an=on.doc.content.size,Ve=Math.min(Re,an);Se.setSelection(Xe.create(on.doc,Ve,Ve))}catch{}return!0}).run()})()}),ut(()=>{l(J)&&l(J).setEditable(l(fe),!1)}),ut(()=>{!l(J)||l(J).isDestroyed||l(J).view.dispatch(l(J).state.tr.setMeta(_l,F()))}),ut(()=>{const R=l(J)?.view.dom;R&&(R.setAttribute("aria-haspopup","listbox"),l(et)&&l(se)?(R.setAttribute("aria-controls",_t),R.setAttribute("aria-activedescendant",l(se))):(R.removeAttribute("aria-controls"),R.removeAttribute("aria-activedescendant")))});var xr={flushScreenEvidence:gt,insertAtSymbol:tt,insertText:St,focus:sn,focusEnd:jt,focusAndSelectAll:yt,getHTML:dt,clear:Le,setContent:je,insertImage:qe,getInlineImages:Ct,getTextContent:Ge,insertContextMention:nt,insertMention:Qe,getMentions:pt,getContextMentions:qt,get value(){return o()},set value(R=""){o(R),b()},get ariaLabel(){return a()},set ariaLabel(R=_.chat_richInput_editor_ariaLabel()){a(R),b()},get placeholder(){return c()},set placeholder(R=_.chat_richInput_askAnything_placeholder()){c(R),b()},get reactivePlaceholder(){return u()},set reactivePlaceholder(R=!1){u(R),b()},get disabled(){return d()},set disabled(R=!1){d(R),b()},get editableWhileDisabled(){return f()},set editableWhileDisabled(R=!1){f(R),b()},get inputLocked(){return h()},set inputLocked(R=!1){h(R),b()},get class(){return p()},set class(R=""){p(R),b()},get editorClassName(){return g()},set editorClassName(R=""){g(R),b()},get workspace(){return v()},set workspace(R){v(R),b()},get repoPath(){return m()},set repoPath(R){m(R),b()},get autoFocus(){return C()},set autoFocus(R=!1){C(R),b()},get onUpdate(){return $()},set onUpdate(R){$(R),b()},get onSubmit(){return M()},set onSubmit(R){M(R),b()},get onForceSubmit(){return S()},set onForceSubmit(R){S(R),b()},get onEscape(){return D()},set onEscape(R){D(R),b()},get onHistoryPrev(){return I()},set onHistoryPrev(R){I(R),b()},get onHistoryNext(){return E()},set onHistoryNext(R){E(R),b()},get onMentionStart(){return L()},set onMentionStart(R){L(R),b()},get onMentionSelect(){return ee()},set onMentionSelect(R){ee(R),b()},get onSelectionChange(){return U()},set onSelectionChange(R){U(R),b()},get contextItems(){return ie()},set contextItems(R=[]){ie(R),b()},get trailingHint(){return F()},set trailingHint(R=null){F(R),b()},get skills(){return W()},set skills(R=[]){W(R),b()},get skillsLoading(){return Y()},set skillsLoading(R=!1){Y(R),b()},get skillsError(){return ce()},set skillsError(R=null){ce(R),b()},get onSkillsRetry(){return pe()},set onSkillsRetry(R){pe(R),b()},get slashEmptyLabel(){return j()},set slashEmptyLabel(R){j(R),b()},get slashNotice(){return ue()},set slashNotice(R){ue(R),b()},get unavailableSkillTitle(){return P()},set unavailableSkillTitle(R){P(R),b()},get screenReferences(){return z()},set screenReferences(R){z(R),b()},get screenInsertions(){return le()},set screenInsertions(R=[]){le(R),b()},get screenInterim(){return ge()},set screenInterim(R=[]){ge(R),b()},get screenSpeechActive(){return ye()},set screenSpeechActive(R=!1){ye(R),b()},get onScreenInsertionApplied(){return Z()},set onScreenInsertionApplied(R){Z(R),b()},get onCompositionChange(){return oe()},set onCompositionChange(R){oe(R),b()},get onUserTextInput(){return V()},set onUserTextInput(R){V(R),b()},get onScreenReferencesEdited(){return G()},set onScreenReferencesEdited(R){G(R),b()},get minHeight(){return O()},set minHeight(R=80){O(R),b()},get maxHeight(){return te()},set maxHeight(R=300){te(R),b()},$set:Lt,$on:(R,xe)=>Ot(e,R,xe)},un=sN(),ri=ne(un),Wt=()=>l(et),ma=R=>!R&&Ne();xt(ri,()=>Jk,(R,xe)=>{xe(R,{get open(){return Wt()},set open(Re){ma(Re)},children:(Re,ct)=>{var Pe=Ye(),Se=ae(Pe);{let on=w(()=>ve?.target());xt(Se,()=>bv,(an,Ve)=>{Ve(an,{get to(){return l(on)},children:(dn,Mn)=>{var Tn=Ye(),Os=ae(Tn);{let Ks=w(()=>l(be)??null);xt(Os,()=>qk,(Ms,Ai)=>{Ai(Ms,{get customAnchor(){return l(Ks)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:en,onCloseAutoFocus:en,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return l(de)},set ref(Ri){k(de,Ri,!0)},children:(Ri,Ya)=>{jn(lw(Ri,{get listboxId(){return _t},get items(){return l(Ze)},get loading(){return Y()},get error(){return ce()},get emptyLabel(){return j()},get notice(){return ue()},get onRetry(){return pe()},onSelect:Yn,onDismiss:Ne,onActiveOptionChange:eo=>k(se,eo,!0)}),eo=>k(Ue,eo,!0),()=>l(Ue))},$$slots:{default:!0}})})}x(dn,Tn)},$$slots:{default:!0}})})}x(Re,Pe)},$$slots:{default:!0}})});var si=A(ri,2);let Cs;return jn(si,R=>k(be,R),()=>l(be)),Q(un),N(()=>{Cs=at(si,1,`tiptap-container ${p()??""}`,"svelte-bv9i3d",Cs,{"placeholder-suppressed":l(ke)}),Xi(si,`--tt-min-height:${O()}px;--tt-max-height:${te()}px`)}),x(n,un),Pt(xr)}class cw extends Error{constructor(t){super(t);it(this,"reason");this.name="EnhancePromptUnavailableError",this.reason=t}}function dB(n){return n instanceof cw&&n.reason.trim()?{description:n.reason}:void 0}function oN(n){return"available"in n&&n.available===!1}function fB(n){return n==="auggie"}function aN(n,e,{model:t,workspaceId:r}){return{prompt:n,mode:e,...t?{model:t}:{},...r?{workspaceId:r}:{}}}async function hB(n,e={}){const t=await yv("agent.enhancePrompt",aN(n,"enhance",e));if(oN(t))throw new cw(t.reason);return t}var lN=B('<span class="block truncate text-xs text-subtle" data-testid="start-on-locked-reason"> </span>'),cN=B('<span> </span> <span><span class="block truncate"> </span> <!></span> <!>',1),uN=B("<!> <!>",1),dN=B('<div data-testid="start-on-picker"><!></div>');function fN(n,e){const t=Ti();if(new.target)return It({component:fN,...n});Rt(e,!0);let r=y(e,"presentation",7,"form"),s=y(e,"value",7),i=y(e,"options",7),o=y(e,"onChange",7),a=y(e,"lockedReason",7),c=y(e,"label",23,()=>_.workspace_initialAgentPicker_startOn_label()),u=y(e,"open",15,!1);const d=`${t}-start-on-label`,f=`${t}-start-on-value`,h=Wu(),p=new ju;let g=he(!1),v=he(null),m=he(null);const C=w(()=>i().find(L=>L.id===s())??i()[0]),$=w(()=>i().map(L=>({value:`machine:${L.id}`,label:L.label,description:L.reason??L.hint??L.platform??void 0,disabled:L.disabled,data:L}))),M=w(()=>i().some(L=>L.kind==="cloud")),S=w(()=>l(M)?440:360);ut(()=>{if(u())return fa(L=>{L.isComposing||u(!1)})});var D={get presentation(){return r()},set presentation(L="form"){r(L),b()},get value(){return s()},set value(L){s(L),b()},get options(){return i()},set options(L){i(L),b()},get onChange(){return o()},set onChange(L){o(L),b()},get lockedReason(){return a()},set lockedReason(L){a(L),b()},get label(){return c()},set label(L=_.workspace_initialAgentPicker_startOn_label()){c(L),b()},get open(){return u()},set open(L=!1){u(L),b()},$set:Lt,$on:(L,ee)=>Ot(e,L,ee)},I=dN(),E=ne(I);return xt(E,()=>Vu,(L,ee)=>{ee(L,{onOpenChange:U=>{U&&k(g,!uh(l(v),l(S)))},get open(){return u()},set open(U){u(U)},children:(U,ie)=>{var F=uN(),W=ae(F);{const ce=(pe,j)=>{let ue=()=>(j?.()).props;{let P=w(()=>r()==="metadata"?"plain":"ghost"),z=w(()=>r()==="metadata"?void 0:"sm"),le=w(()=>!!a()),ge=w(()=>r()==="footer"?"h-9 min-w-0 max-w-36 gap-1 px-2 text-sm font-normal":r()==="metadata"?`${cn.bareTrigger} w-full`:cn.fieldTrigger);Je(pe,ks(ue,{get variant(){return l(P)},get size(){return l(z)},type:"button",wrapContent:!1,get disabled(){return l(le)},get"aria-labelledby"(){return`${d} ${f}`},get class(){return l(ge)},get ref(){return l(v)},set ref(ye){k(v,ye,!0)},children:(ye,Z)=>{var oe=cN(),V=ae(oe),G=re(V,!0),O=A(V,2),te=ne(O),ve=re(te,!0),de=A(te,2);{var fe=J=>{var Me=lN(),Be=re(Me,!0);N(()=>H(Be,a())),x(J,Me)};K(de,J=>{a()&&J(fe)})}Q(O);var ke=A(O,2);{var be=J=>{rt(J,{get icon(){return sa},get class(){return cn.bareChevron}})};K(ke,J=>{r()==="metadata"&&!a()&&J(be)})}N(()=>{at(V,1,Bn(r()==="form"?cn.fieldLabel:r()==="metadata"?"shrink-0 text-muted-foreground":"sr-only")),ot(V,"id",d),H(G,c()),at(O,1,Bn(r()==="metadata"?cn.bareValue:"min-w-0 flex-1 text-left")),ot(O,"id",f),H(ve,l(C)?.label)}),x(ye,oe)},$$slots:{default:!0}}))}};xt(W,()=>Ku,(pe,j)=>{j(pe,{child:ce,$$slots:{child:!0}})})}var Y=A(W,2);{let ce=w(()=>({to:h()})),pe=w(()=>r()==="footer"?"top":r()==="metadata"||p.current||l(g)?"bottom":"left"),j=w(()=>r()==="metadata"?"start":r()==="footer"||p.current||l(g)?"end":"start"),ue=w(()=>r()!=="form"||p.current||l(g)?4:24),P=w(()=>h()?"absolute":"fixed"),z=w(()=>l(M)?"w-110":"w-90");xt(Y,()=>Uu,(le,ge)=>{ge(le,{role:"dialog",get portalProps(){return l(ce)},get"aria-label"(){return c()},get side(){return l(pe)},get align(){return l(j)},get sideOffset(){return l(ue)},get strategy(){return l(P)},preventScroll:!1,get class(){return`flex min-h-0 max-w-[calc(100vw-1rem)] flex-col overflow-hidden p-0 ${l(z)??""}`},style:"max-height: min(440px, var(--bits-popover-content-available-height, calc(100dvh - 1rem)))",onOpenAutoFocus:ye=>{ye.preventDefault(),l(m)?.focus()},onCloseAutoFocus:ye=>{ye.preventDefault(),l(v)?.focus()},onkeydown:ye=>{ye.key==="Enter"&&ye.stopPropagation()},children:(ye,Z)=>{{const oe=(te,ve=Or)=>{{let de=w(()=>ve().data.kind==="cloud"?ix:ox);rt(te,{get icon(){return l(de)},get class(){return cn.icon}})}};let V=w(()=>l(C)?`machine:${l(C).id}`:void 0),G=w(()=>_.workspace_initialAgentPicker_searchMachines_placeholder()),O=w(()=>_.workspace_initialAgentPicker_searchMachines_placeholder());ch(ye,{get value(){return l(V)},get options(){return l($)},get open(){return u()},get ariaLabel(){return c()},get placeholder(){return l(G)},get searchPlaceholder(){return l(O)},staticPosition:!0,inputVariant:"search",size:"compact",class:"flex min-h-0 flex-1 flex-col gap-1 px-2 pt-1 pb-2",inputClass:"shrink-0",get rowClass(){return cn.row},viewportClass:"min-h-0 max-h-none flex-1 p-0",contentClass:"flex min-h-0 max-h-none flex-1 flex-col border-0 shadow-none",oncommit:(te,ve)=>{const de=ve.data;de.id!==s()&&o()(de.id),u(!1)},onopenchange:te=>{te||u(!1)},get inputRef(){return l(m)},set inputRef(te){k(m,te,!0)},optionIcon:oe,$$slots:{optionIcon:!0}})}},$$slots:{default:!0}})})}x(U,F)},$$slots:{default:!0}})}),Q(I),N(()=>at(I,1,Bn(r()==="footer"?"min-w-0":"w-full min-w-0"))),x(n,I),Pt(D)}function uw(n,{availability:e,enabledProviders:t,profiles:r}){return _k(n)&&!Sk(r,n)?!1:p_(e,Ck(n))&&!Ev({...t},n)}function pB(n,e){return e.availability?n.filter(t=>uw(t.id,e)).map(t=>({id:t.id})):[]}function gB({activeProviderId:n,defaultProviderId:e,availableProviders:t,...r}){const s=n||e;return!Ev({...r.enabledProviders},s)&&(!r.availability||uw(s,r))?s:t[0]?.id??""}function mB({specialist:n,provider:e,providerView:t,specialists:r,configuredModels:s,activeProviderId:i,selectedModel:o}){return n?t?t[n]?.resolvedModel:r.find(a=>a.id===n)?.resolvedModel:s[e]||(e===i?o:void 0)}const hN=ha("SpecialistDefaultPreviews");var rc,za;class vB{constructor(){ao(this,rc,he(Cr({})));ao(this,za,0)}get byProvider(){return l(rs(this,rc))}set byProvider(e){k(rs(this,rc),e,!0)}invalidate(){kp(this,za,rs(this,za)+1),this.byProvider={}}load(e){if(!e||e in this.byProvider)return;const t=rs(this,za);(async()=>{try{const r=await Vo.specialists.list(e);if(t!==rs(this,za)||r.length===0)return;const s={};for(const i of r)s[i.id]=i;this.byProvider={...this.byProvider,[e]:s}}catch(r){hN.debug("Failed to fetch resolved-model previews:",{provider:e,error:r})}})()}}rc=new WeakMap,za=new WeakMap;function qa(n){const e=n.replace(/\\/g,"/");return e.length>1?e.replace(/\/+$/,""):e}function pN(n,e){const t=qa(n),r=qa(e);return!t||!r?!1:t===r||t.startsWith(r==="/"?"/":`${r}/`)}function gN(n,e){let t=null;for(const r of e)r.type!=="local"||!r.path||pN(n,r.path)&&(!t||qa(r.path).length>qa(t.path).length)&&(t=r);return t}function bB(n,e){const t=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),r=qa(n);return t?r.endsWith(`/${t}`)?r.slice(0,-t.length-1)||"/":null:r||null}function yB(n,e){const t=n?.trim();if(!t||t==="HEAD"||!e)return null;if(e.branches.includes(t))return t;const r=e.remoteBranches??[];return r.includes(t)?t:r.find(i=>i.endsWith(`/${t}`))??null}function mN(n){return[n.title,n.cwd,n.gitBranch??"",n.sessionId,n.provider].filter(Boolean).join(" ")}function vN(n){const e=qa(n),t=e.lastIndexOf("/");return t>=0&&t<e.length-1?e.slice(t+1):e}function bN(n,e){return n.repoRoot?n.repoRoot:gN(n.cwd,e)?.path??null}function sp(n,e){if(new.target)return It({component:sp,...n});Rt(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:Lt,$on:(i,o)=>Ot(e,i,o)};return ax(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Pt(s)}var yN=new Set(["$$slots","$$events","$$legacy","ref","pressed","disabled","size","class","onclick","title","ariaLabel","ariaDescribedby","onChange","children"]);function dw(n,e){if(new.target)return It({component:dw,...n});Rt(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=Ei(e,yN);function g(M){r(M),f()?.(M),e.onPressedChange?.(M)}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(M=null){t(M),b()},get pressed(){return r()},set pressed(M=!1){r(M),b()},get disabled(){return s()},set disabled(M=!1){s(M),b()},get size(){return i()},set size(M="default"){i(M),b()},get class(){return o()},set class(M){o(M),b()},get onclick(){return a()},set onclick(M){a(M),b()},get title(){return c()},set title(M){c(M),b()},get ariaLabel(){return u()},set ariaLabel(M){u(M),b()},get ariaDescribedby(){return d()},set ariaDescribedby(M){d(M),b()},get onChange(){return f()},set onChange(M){f(M),b()},get children(){return h()},set children(M){h(M),b()},$set:Lt,$on:(M,S)=>Ot(e,M,S)},C=Ye(),$=ae(C);{let M=w(()=>Mr("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()));xt($,()=>Nv,(S,D)=>{D(S,ks({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(M)}},()=>p,{onPressedChange:g,get ref(){return t()},set ref(I){t(I)},get pressed(){return r()},set pressed(I){r(I)},children:(I,E)=>{var L=Ye(),ee=ae(L);Un(ee,()=>h()??Or),x(I,L)},$$slots:{default:!0}}))})}return x(n,C),Pt(m)}var wN=B('<span class="ml-auto shrink-0"> </span>'),xN=B('<span><!></span> <span class="min-w-0 truncate"> </span> <!> <!>',1),kN=B('<div role="status"> </div>'),Wm=B("<!> <!>",1),Ra=B("<span> </span>"),_N=B('<div><!> <!> <span class="truncate"> </span></div>'),SN=B('<span class="text-orange-500"> </span>'),CN=B('<span> </span> <span class="text-sm opacity-75 ml-1"> </span>',1),MN=B('<!> <span class="sr-only"> </span>',1),TN=B('<span class="w-1.5 h-1.5 ml-0.5 rounded-full bg-warning cursor-help"></span>'),EN=B('<div class="flex-0 flex flex-col"><!></div>'),AN=B('<div><!> <!> <span class="flex-1 text-left truncate min-w-0"><!></span> <!> <!></div>'),RN=B('<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>'),PN=B('<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>'),IN=B('<!> <span class="flex-1 min-w-0"><span class="text-subtle"> </span> <strong class="text-foreground ml-1 truncate"> </strong></span>',1),LN=B('<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),ON=B('<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>'),NN=B('<div><div class="text-sm text-danger"> </div> <div class="text-sm text-subtle mt-1"> </div></div>'),DN=B('<div class="text-sm text-subtle mt-1"> </div>'),$N=B('<div role="alert"><div class="text-sm text-danger"> </div> <!></div>'),BN=B("<!> ",1),zN=B('<div class="flex shrink-0 flex-wrap items-center gap-1 border-t border-border bg-popover px-2 py-1.5"><!> <!></div>'),FN=B('<!> <div class="min-h-16 overflow-hidden flex flex-1 flex-col" data-testid="branch-results"><!> <!></div> <!>',1),HN=B('<p class="type-caption mt-2 pl-6.5 text-muted-foreground"> </p>'),UN=B('<div class="shrink-0 border-t border-border p-2"><div class="px-3 py-2.5"><!> <!></div></div>'),VN=B("<!> <div><!></div> <!>",1),WN=B('<div class="relative min-w-0"><!></div>');function Sl(n,e){const t=Ti();if(new.target)return It({component:Sl,...n});Rt(e,!0);const r=()=>nn(C,"$branchByRepo$",o),s=()=>nn(h,"$connection$",o),i=()=>nn(f,"$hostMember$",o),[o,a]=Ja(),c=X=>{{let Oe=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel()),He=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());Je(X,{onclick:xe,variant:"ghost",size:"icon-sm",class:"shrink-0 text-muted-foreground",get disabled(){return l(ke)},get"aria-label"(){return l(Oe)},get tooltip(){return l(He)},children:(Mt,ft)=>{var Kt=Ye(),fn=ae(Kt);{var Ut=Dt=>{pi(Dt,{size:14})},De=Dt=>{rt(Dt,{get icon(){return Ip},class:"size-3.5!"})};K(fn,Dt=>{l(ke)?Dt(Ut):Dt(De,-1)})}x(Mt,Kt)},$$slots:{default:!0}})}},u=X=>{var Oe=Ye(),He=ae(Oe);{var Mt=Kt=>{mo(Kt,{size:16,get class(){return cn.icon}})},ft=Kt=>{mo(Kt,{size:14,class:"text-subtle"})};K(He,Kt=>{ie()?Kt(Mt):Kt(ft,-1)})}x(X,Oe)},d=(X,Oe=Or)=>{const He=w(()=>Ai(Oe()));var Mt=Wm(),ft=ae(Mt);{let Ut=w(()=>_.ui_groupedCombobox_toggleGroup_ariaLabel({group:Oe().label})),De=w(()=>ie()?`w-full justify-start gap-2 ${cn.group} h-auto`:"w-full justify-start gap-2 px-2 text-subtle");Je(ft,{variant:"ghost",size:"sm",wrapContent:!1,get"aria-expanded"(){return l(He)},get"data-branch-group"(){return Oe().key},get"aria-label"(){return l(Ut)},get class(){return l(De)},onclick:()=>Ri(Oe()),children:(Dt,Gn)=>{var bn=xN(),Qn=ae(bn),fs=ne(Qn);{let zn=w(()=>`${ie()?"size-4!":"size-3.5!"} shrink-0 ${l(He)?"":"-rotate-90"}`);rt(fs,{get icon(){return sa},get class(){return l(zn)}})}Q(Qn);var Ns=A(Qn,2),Lo=re(Ns,!0),vi=A(Ns,2);{var Oo=zn=>{Xk(zn,{size:"compact",class:"rounded-full px-1.5 font-normal text-subtle",children:(Ds,fr)=>{$t();var zr=zt();N(ii=>H(zr,ii),[()=>ws(Oe().options.length)]),x(Ds,zr)},$$slots:{default:!0}})};K(vi,zn=>{Oe().key!=="remote"&&zn(Oo)})}var es=A(vi,2);{var dr=zn=>{var Ds=wN(),fr=re(Ds,!0);N(zr=>{ot(Ds,"role",Oe().key==="remote"&&l(te)?"status":void 0),H(fr,zr)},[()=>l(te)?_.ui_combobox_loadingOptions_message():_.workspace_branchSelector_groupLoad_label()]),x(zn,Ds)};K(es,zn=>{Oe().key==="remote"&&(l(te)||!l(ve)&&l(G).length===0)&&zn(dr)})}N(()=>{at(Qn,1,`first-line-icon ${ie()?"w-4":"w-3.5"}`),H(Lo,Oe().label)}),x(Dt,bn)},$$slots:{default:!0}})}var Kt=A(ft,2);{var fn=Ut=>{var De=kN(),Dt=re(De,!0);N(Gn=>{at(De,1,`type-caption py-2 pr-3 text-muted-foreground ${ie()?"pl-8":"pl-6"}`),H(Dt,Gn)},[()=>_.workspace_branchSelector_noRemoteBranches_label()]),x(Ut,De)};K(Kt,Ut=>{Oe().key==="remote"&&l(He)&&!l(te)&&l(ve)&&Oe().options.length===0&&Ut(fn)})}x(X,Mt)},f=Yf(),h=kd();let p=null;const g=ha("BranchSelector"),v=Wu(),m=new ju,C=yx();let $=y(e,"variant",7,"underline"),M=y(e,"value",7,""),S=y(e,"repoPath",7),D=y(e,"repoType",7),I=y(e,"githubUrl",7),E=y(e,"disabled",7,!1),L=y(e,"dropUp",7,!1),ee=y(e,"portal",7,!0),U=y(e,"triggerClass",7),ie=y(e,"rowLabel",7),F=y(e,"hasTriggerIcon",7,!0),W=y(e,"description",7),Y=y(e,"skipIsolation",7,!1),ce=y(e,"suggestedBranch",7),pe=y(e,"onSkipIsolationChange",7),j=y(e,"onGitHubAuthNeededChange",7),ue=y(e,"onBranchStatusChange",7),P=y(e,"onBranchesLoaded",7),z=y(e,"onchange",7),le=y(e,"showUncommittedIndicator",7,!1),ge=y(e,"showTriggerChevron",7,!1),ye=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),Z=y(e,"triggerContentClass",7,"gap-0.75"),oe=he(""),V=he(Cr([])),G=he(Cr([])),O=he(!1),te=he(!1),ve=he(!1),de=he(""),fe=he(""),ke=he(!1),be=he(null),J=he(""),Me=null,Be=he(Cr([])),gt=0,Ie=0,$e=null,ze=he(null),vt=he(!1),Vt=he(!1),st=he(void 0),Ae=he(null),Ce=he(void 0),we=he(void 0),Ue=he(null),_t=he(void 0),se=he(void 0);const Ze=w(()=>D()==="local"&&typeof pe()=="function"&&!!l(fe));let lt=he(void 0);ut(()=>{l(vt)||(k(lt,void 0),k(se,void 0))}),ut(()=>{if(l(vt))return fa(X=>{X.isComposing||ma()})});let et=he("none"),bt=he(!1);const Bt=_.workspace_isolationMode_worktree_label(),Fe=w(()=>Y()&&D()==="local");let Ke=he(0),Yt=he(!1),Ne=he(!1),en=he(null),Yn=null;ut(()=>{if(typeof j()=="function"&&l(et)!==Yn){Yn=l(et);try{j()(l(et))}catch(X){g.error("Error in onGitHubAuthNeededChange callback",X)}}});const vn=w(()=>M()||l(oe)),me=w(()=>l(vn)===l(fe)&&l(fe)!=="");ut(()=>{if(!l(Fe)||!l(fe)||l(vn)===l(fe))return;const X=l(fe);Zs(()=>ri(X,{keepSkipIsolation:!0,keepOpen:!0}))});let tt=null;ut(()=>{if(typeof ue()=="function"&&l(vn)){const X=l(Ke),Oe=l(Yt),He=l(fe),Mt=l(me),ft=l(Ne);if(tt&&tt.behind===X&&tt.hasUncommittedChanges===Oe&&tt.currentBranch===He&&tt.isCurrentBranch===Mt&&tt.isLoading===ft)return;const Kt={behind:X,hasUncommittedChanges:Oe,currentBranch:He,isCurrentBranch:Mt,isLoading:ft};tt=Kt;try{ue()(Kt)}catch(fn){g.error("Error in onBranchStatusChange callback",fn)}}});const St=new Map,sn=300*1e3;let jt="",yt="local",dt,Le=null;const je=150;let qe=null,Ct=0;function Ge(){const X=kd.select(At.state);return X&&S()?{connection:X,repoPath:S(),repoType:D(),githubUrl:I(),generation:Ct,cacheKey:JSON.stringify([X,S(),D(),I()])}:null}function nt(X){return X.generation===Ct&&X.connection===kd.select(At.state)&&X.repoPath===S()&&X.repoType===D()&&X.githubUrl===I()}function Qe(){Le&&(clearTimeout(Le),Le=null),qe?.abort(),qe=null}sc(()=>{Ct++,gt++,Qe(),Me&&clearTimeout(Me)});function pt(X){return ka.get("enableFormPersistence")&&r()[X]||""}let qt="";ut(()=>{g.debug("Value prop effect triggered",{value:M(),repoPath:S(),internalSelectedBranch:l(oe)});const X=S()!==qt;qt=S(),M()?(g.debug("Setting internalSelectedBranch from value prop",{value:M()}),k(oe,M())):X&&(g.debug("Repo changed and value is empty, clearing internalSelectedBranch"),k(oe,""))});function Ht(){Qe(),k(ke,!0),k(be,null),Le=setTimeout(()=>{Le=null,Rn()},je)}ut(()=>{const X=s(),Oe=X!==p;p=X;const He=S(),Mt=D(),ft=I(),Kt=He!==jt,fn=Mt!==yt,Ut=ft!==dt;Oe&&St.clear();const De=Oe||Kt||He&&(fn||Ut);jt=He,yt=Mt,dt=ft,De&&(Ct++,Qe(),$e=null,k(G,[],!0),k(O,!1),k(te,!1),k(ve,!1),k(fe,""),k(et,"none"),gt++,k(Be,[],!0),k(be,null),xr(),R(),He&&X?(g.debug("Repo changed - resetting branch",{previousRepoPath:jt,currentRepoPath:He,previousInternalBranch:l(oe)}),k(oe,""),k(de,""),k(V,[],!0),Ht()):(k(V,[],!0),k(oe,""),k(de,""),k(ke,!1)))});function mt(){if(typeof P()=="function")try{P()({branches:[...l(V)],remoteBranches:[...l(G)],defaultBranch:l(de),currentBranch:l(fe)})}catch(X){g.error("Error in onBranchesLoaded callback",X)}}function Nt(){if(M()){un(M());return}const X=pt(S());X&&(l(V).includes(X)||l(G).includes(X))?un(X):l(de)?un(l(de)):un(l(V)[0])}async function Rn(){const X=Ge();if(!X){k(ke,!1);return}qe&&qe.abort();const Oe=new AbortController;qe=Oe;const He=()=>!Oe.signal.aborted&&nt(X);g.debug("fetchBranches called",{repoPath:S(),repoType:D(),githubUrl:I()}),Np.start(`fetchBranches-${S()}`,{repoType:D(),githubUrl:I()});let Mt=D(),ft=I();if(S()&&S().includes("/")&&!S().startsWith("/")&&!S().startsWith("~")&&!S().startsWith(".")&&!S().includes(":\\")&&S().split("/").length===2&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(S())&&(Mt="github",ft||(ft=`https://github.com/${S()}`,g.debug("Reconstructed GitHub URL from shorthand",{repoPath:S(),effectiveGithubUrl:ft}))),ka.get("enableBranchCaching")){const De=St.get(X.cacheKey);if(De&&Date.now()-De.timestamp<sn){if(k(V,De.branches,!0),k(G,De.remoteBranches||[],!0),k(de,De.default,!0),k(fe,De.current||"",!0),Mt==="github")Nt();else if(M())un(M());else{const Dt=pt(S());Dt&&(l(V).includes(Dt)||l(G).includes(Dt))?un(Dt):l(fe)&&l(V).includes(l(fe))?un(l(fe)):l(de)&&l(V).includes(l(de))?un(l(de)):l(V).length>0&&un(l(V)[0])}if(!He())return;mt(),k(ke,!1);return}}k(ke,!0),k(be,null);let fn=!1,Ut=!1;try{if(ka.get("simulateSlowNetwork")&&await new Promise(De=>setTimeout(De,ka.get("networkDelay")||0)),!He())return;if(Mt==="local"){const De=await Vo.git.getBranches(X.repoPath,!0);if(!He())return;if(De){if(k(V,De.branches,!0),k(G,De.remoteBranches,!0),k(de,De.defaultBranch||"",!0),k(fe,De.currentBranch||"",!0),M())un(M());else{const Dt=pt(S());Dt&&(l(V).includes(Dt)||l(G).includes(Dt))?un(Dt):l(fe)&&l(V).includes(l(fe))?un(l(fe)):l(de)&&l(V).includes(l(de))?un(l(de)):l(V).length>0&&un(l(V)[0])}fn=!0}else throw new Error("Failed to fetch branches")}else if(Mt==="github"&&ft){const De=jp(ft);if(!De)throw new Error("Invalid GitHub URL format");const{owner:Dt,repo:Gn}=De;Vo.integrations.githubBranchesCached(Dt,Gn).then(bn=>{if(!(!He()||Ut)&&bn.branches.length!==0){if(k(V,bn.branches,!0),k(de,bn.defaultBranch||"",!0),k(ke,!1),!$e){const Qn=pt(S()),fs=M(),Ns=Ie;if(Nt(),!He())return;$e={autoSelectedBranch:l(oe),valueBeforePaint:fs,savedBranchBeforePaint:Qn,explicitSelectionRevision:Ns}}mt(),g.debug("Rendered cached branches via github.branches.listCached",{owner:Dt,repo:Gn,count:bn.branches.length,source:bn.source})}});try{const bn=await Vo.integrations.githubBranches(Dt,Gn);if(!He()){g.debug("Branch fetch aborted after response");return}Ut=!0,k(V,bn.branches,!0),k(de,bn.defaultBranch||"",!0),k(et,"none"),fn=!0,g.debug("Fetched branches via daemon github.branches.list",{owner:Dt,repo:Gn,count:l(V).length})}catch(bn){if(!He())return;if(Ut=!0,i())throw bn;const Qn=bn instanceof Error?bn.message:String(bn);throw/not configured|not authenticated/i.test(Qn)?(k(et,"not-authenticated"),new Error("GITHUB_AUTH_REQUIRED")):/404|not found/i.test(Qn)?(k(et,"no-access"),new Error("GITHUB_NO_ACCESS")):bn}}if(!He())return;if(ka.get("enableBranchCaching")&&St.set(X.cacheKey,{branches:l(V),remoteBranches:l(G),default:l(de),current:l(fe),timestamp:Date.now()}),Mt==="github"&&l(V).length>0){const De=$e;if(De&&!De.valueBeforePaint){if(Ie===De.explicitSelectionRevision&&(!M()||M()===De.autoSelectedBranch)){const Dt=De.savedBranchBeforePaint,Gn=Dt&&(l(V).includes(Dt)||l(G).includes(Dt))?Dt:l(de)||l(V)[0];l(oe)!==Gn&&un(Gn)}}else Nt()}fn&&He()&&($e=null,mt())}catch(De){if(De instanceof Error&&De.name==="AbortError"){g.debug("Branch fetch aborted in outer catch (superseded by newer request)");return}if(!He()){g.debug("Branch fetch aborted; skipping error-state write");return}const Dt=De instanceof Error?De:new Error(String(De));if(g.error("Failed to fetch branches",Dt,{repoPath:S(),repoType:D(),githubUrl:I(),effectiveRepoType:Mt,effectiveGithubUrl:ft,githubAuthNeeded:l(et)}),De instanceof Error){if(De.message==="GITHUB_AUTH_REQUIRED"){k(be,null);return}else if(De.message==="GITHUB_NO_ACCESS"){k(be,_.workspace_branchSelector_noAccess_error(),!0),Bp.error(l(be));return}De.message.includes("private repo")||De.message.includes("authenticate with GitHub")||De.message.includes("access permissions")||De.message.includes("GitHub API error")?k(be,De.message,!0):De.message.includes("Git is not installed")||De.message.includes("ENOENT")||De.message.includes("spawn git")?k(be,_.workspace_branchSelector_gitNotInstalled_error(),!0):De.message.includes("rate limit")?k(be,_.workspace_branchSelector_rateLimit_error(),!0):De.message.includes("404")||De.message.includes("not found")?Mt==="github"?k(be,_.workspace_branchSelector_repoNotFoundGithub_error(),!0):k(be,_.workspace_branchSelector_repoNotFound_error(),!0):De.message.includes("network")||De.message.includes("fetch")?k(be,_.workspace_branchSelector_network_error(),!0):De.message.includes("permission")||De.message.includes("denied")?k(be,_.workspace_branchSelector_permissionDenied_error(),!0):k(be,De.message||_.workspace_branchSelector_fetchBranchesFailed_error(),!0)}else k(be,_.workspace_branchSelector_fetchBranchesFailedManual_error(),!0);Y()&&Mt==="local"||Bp.error(l(be)),k(V,[],!0)}finally{Np.end(`fetchBranches-${X.repoPath}`),qe===Oe&&He()&&(k(ke,!1),qe=null)}}async function wr(){const X=Ge();if(!(!X||X.repoType!=="local")&&!(l(te)||l(ve))){k(te,!0),k(ve,!0),g.debug("Fetching remote branches for",{repoPath:S()});try{const Oe=await Vo.git.getBranches(X.repoPath,!0);if(!nt(X))return;if(Oe){if(k(G,Oe.remoteBranches||[],!0),ka.get("enableBranchCaching")){const He=St.get(X.cacheKey);He&&St.set(X.cacheKey,{...He,remoteBranches:l(G)})}g.debug("Fetched remote branches",{count:l(G).length})}}catch(Oe){if(!nt(X))return;g.error("Failed to fetch remote branches",Oe)}finally{nt(X)&&k(te,!1)}}}function Br(){k(O,!l(O)),l(O)&&l(G).length===0&&!l(te)&&!l(ve)&&wr()}async function ds(X){const Oe=Ge();if(!X||!Oe||Oe.repoType!=="local"){k(Ke,0),k(Yt,!1),k(Ne,!1);return}k(en,X,!0),k(Ne,!0),g.debug("Fetching branch status",{branchName:X});try{if(v_()){const He=await Vo.git.branchStatus(Oe.repoPath,X);if(!nt(Oe)||l(en)!==X){g.debug("Ignoring stale branch status response",{requested:X,current:l(en)});return}He?(k(Ke,He.behind??0,!0),k(Yt,X===l(fe)?He.hasUncommittedChanges??!1:!1,!0),g.debug("Branch status fetched",{branchName:X,behind:l(Ke),hasUncommittedChanges:l(Yt),currentBranch:l(fe),isCurrentBranch:X===l(fe)})):(g.warn("Failed to get branch status",{branchName:X,repoPath:S()}),k(Ke,0),k(Yt,!1))}}catch(He){if(!nt(Oe)||l(en)!==X)return;g.error("Failed to fetch branch status",He),k(Ke,0),k(Yt,!1)}finally{nt(Oe)&&l(en)===X&&k(Ne,!1)}}function xr(){k(Ke,0),k(Yt,!1),k(Ne,!1),k(en,null)}function un(X){const Oe=Ge();if(Oe){k(oe,X,!0),g.debug("setInternalBranch called",{branchName:X,hasOnchange:typeof z()=="function"});try{typeof z()=="function"&&(g.debug("Calling onchange with branch",{branchName:X}),z()(new CustomEvent("change",{detail:{branch:X}})))}catch(He){g.error("Error in onchange callback",He)}nt(Oe)&&ds(X)}}function ri(X,{keepSkipIsolation:Oe=!1,keepOpen:He=!1}={}){Ie++,k(oe,X,!0),R();try{typeof z()=="function"&&z()(new CustomEvent("change",{detail:{branch:X}}))}catch(Mt){g.error("Error in onchange callback",Mt)}if(!Oe&&Y()&&typeof pe()=="function")try{pe()(!1)}catch(Mt){g.error("Error in onSkipIsolationChange callback",Mt)}ds(X),He||ma()}function Wt(X){const Oe=l(Ue)?.closest('[role="dialog"]');if(!l(lt)&&Oe&&l(Ae)){k(se,l(_t)?.getBoundingClientRect().height||void 0,!0);const He=l(Ae),Mt=He.getBoundingClientRect(),ft=Oe.getBoundingClientRect(),Kt=ft.left-Mt.left,fn=ft.top-Mt.top;k(lt,{contextElement:He,getBoundingClientRect:()=>{const Ut=He.getBoundingClientRect(),De=Math.max(_a,He.ownerDocument.documentElement.clientHeight-_a-ft.height),Dt=Math.min(Math.max(_a,Ut.top+fn),De),Gn=Math.max(_a,He.ownerDocument.documentElement.clientWidth-_a-ft.width),bn=Math.min(Math.max(_a,Ut.left+Kt),Gn);return new DOMRect(bn,Dt,0,0)}},!0)}try{pe()?.(!X)}catch(He){g.error("Error in onSkipIsolationChange callback",He)}!X&&l(fe)&&ri(l(fe),{keepSkipIsolation:!0,keepOpen:!0})}function ma(){const X=l(vt);k(vt,!1),X&&si()}async function si(){await Qo(),!l(vt)&&l(Ae)?.isConnected&&l(Ae).focus({preventScroll:!0})}function Cs(X){Me&&clearTimeout(Me),Me=setTimeout(()=>{k(J,X,!0)},100)}function R(){Me&&(clearTimeout(Me),Me=null),k(J,"")}async function xe(){const X=Ge();X&&St.delete(X.cacheKey),k(et,"none"),await Rn()}async function Re(){if(!i()){k(bt,!0),k(be,null);try{const{initializeGitHubAuth:X,startGitHubAuth:Oe}=await xs(async()=>{const{initializeGitHubAuth:Ut,startGitHubAuth:De}=await import("./D5ej8a-y.js").then(Dt=>Dt.o5);return{initializeGitHubAuth:Ut,startGitHubAuth:De}},__vite__mapDeps([14,15,2,16,17,5,3,1,18,11,9]),import.meta.url),{selectGitHubAuthIsAuthenticated:He,selectGitHubAuthIsAuthenticating:Mt,selectGitHubAuthError:ft}=await xs(async()=>{const{selectGitHubAuthIsAuthenticated:Ut,selectGitHubAuthIsAuthenticating:De,selectGitHubAuthError:Dt}=await import("./D5YUYmA3.js").then(Gn=>Gn.z);return{selectGitHubAuthIsAuthenticated:Ut,selectGitHubAuthIsAuthenticating:De,selectGitHubAuthError:Dt}},__vite__mapDeps([42,43,9,2,1,5,4,3,6,0,7,8,10,11,12,25,44,14,15,16,17,18,45,22,46,47,48,21,23,24,49,28,27,50,51,32,30,52]),import.meta.url),Kt=At;Kt.dispatch(X()),Kt.dispatch(Oe());const fn=setInterval(async()=>{const Ut=Kt.state;if(He.select(Ut))clearInterval(fn),k(bt,!1),k(et,"none"),await xe();else if(!Mt.select(Ut)){clearInterval(fn),k(bt,!1);const De=ft.select(Ut);De&&k(be,De,!0)}},1e3);setTimeout(()=>{l(bt)&&(clearInterval(fn),k(bt,!1),k(be,_.workspace_branchSelector_githubTimeout_error(),!0))},300*1e3)}catch(X){g.error("Failed to connect GitHub",X),k(bt,!1),k(be,X instanceof Error?X.message:_.workspace_branchSelector_githubConnectFailed_error(),!0)}}}let ct=he(!0),Pe=he(!0),Se=!1;ut(()=>{if(l(vt)){const X=!Se;X&&requestAnimationFrame(()=>{l(vt)&&!l(Fe)&&l(ze)&&(l(ze).focus(),l(ze).select())}),X&&(k(Vt,!uh(l(Ae),360)),l(vn)&&D()==="local"&&ds(l(vn)))}Se=l(vt)}),ut(()=>{l(J)&&(l(Os).length>0&&k(ct,!1),l(Tn).length>0&&k(Pe,!1),l(Ks).length>0&&k(O,!0))});function on(){const X=I()||(S()&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(S())?`https://github.com/${S()}`:void 0);return X?jp(X):null}ut(()=>{const X=s(),Oe=l(J).trim();if(!X||D()!=="github"||!Oe){gt++,k(Be,[],!0);return}const He=on();if(!He){gt++,k(Be,[],!0);return}const Mt=Ge();if(!Mt)return;const ft=++gt;k(Be,[],!0),Vo.integrations.githubBranches(He.owner,He.repo,Oe).then(Kt=>{!nt(Mt)||ft!==gt||k(Be,Kt.branches,!0)}).catch(()=>{})});function an(X){return X.startsWith("dependabot/")}function Ve(X){const Oe=X.trim(),He=Oe.startsWith("+ ")?Oe.substring(2):Oe;if(wx(He))return!0;if(X.startsWith("+ ")){const ft=X.substring(2);if(ft.startsWith("workspace")||ft.startsWith("ws/")||ft.startsWith("ws_"))return!0}return!!(He.startsWith("workspace-")||He.startsWith("workspace/")||He.startsWith("ws/")||He.startsWith("ws_")||/-\d{13}-[a-z0-9]+$/.test(He))}const dn=w(()=>l(Be).length>0?[...l(V),...l(Be).filter(X=>!l(V).includes(X))]:l(V)),Mn=w(()=>l(dn).filter(X=>!Ve(X)&&!an(X)&&X.toLowerCase().includes(l(J).toLowerCase())).sort((X,Oe)=>X===l(fe)?-1:Oe===l(fe)?1:X===l(de)?-1:Oe===l(de)?1:X.localeCompare(Oe))),Tn=w(()=>l(dn).filter(X=>an(X)&&X.toLowerCase().includes(l(J).toLowerCase())).sort((X,Oe)=>X.localeCompare(Oe))),Os=w(()=>l(dn).filter(X=>Ve(X)&&X.toLowerCase().includes(l(J).toLowerCase())).sort((X,Oe)=>{const He=Kt=>{const fn=Kt.match(/(\d{13})/);return fn?parseInt(fn[1]):null},Mt=He(X),ft=He(Oe);return Mt&&ft?ft-Mt:Mt&&!ft?-1:!Mt&&ft?1:X.localeCompare(Oe)})),Ks=w(()=>l(G).filter(X=>X.toLowerCase().includes(l(J).toLowerCase())).sort((X,Oe)=>X.localeCompare(Oe))),Ms=w(()=>{const X=(Oe,He=!1)=>Oe.map(Mt=>({value:Mt,label:Mt,class:ie()&&He?"pl-8":void 0,description:Mt===l(de)?_.workspace_branchSelector_default_label():Mt===l(fe)?_.workspace_branchSelector_current_label():void 0}));return[{key:"regular",label:"",options:X(l(Mn))},{key:"workspace",label:_.workspace_branchSelector_workspaceBranches_label(),options:X(l(Os),!0),collapsed:l(ct)},{key:"remote",label:_.workspace_branchSelector_remoteBranches_label(),options:X(l(Ks),!0),collapsed:!l(O),keepEmpty:D()==="local"},{key:"dependabot",label:_.workspace_branchSelector_dependabotBranches_label(),options:X(l(Tn),!0),collapsed:l(Pe)}].filter(Oe=>Oe.key!=="remote"||D()==="local")});function Ai(X){return!X.collapsed}function Ri(X){X.key==="workspace"?k(ct,!l(ct)):X.key==="remote"?Br():X.key==="dependabot"&&k(Pe,!l(Pe))}var Ya={get variant(){return $()},set variant(X="underline"){$(X),b()},get value(){return M()},set value(X=""){M(X),b()},get repoPath(){return S()},set repoPath(X){S(X),b()},get repoType(){return D()},set repoType(X){D(X),b()},get githubUrl(){return I()},set githubUrl(X){I(X),b()},get disabled(){return E()},set disabled(X=!1){E(X),b()},get dropUp(){return L()},set dropUp(X=!1){L(X),b()},get portal(){return ee()},set portal(X=!0){ee(X),b()},get triggerClass(){return U()},set triggerClass(X){U(X),b()},get rowLabel(){return ie()},set rowLabel(X){ie(X),b()},get hasTriggerIcon(){return F()},set hasTriggerIcon(X=!0){F(X),b()},get description(){return W()},set description(X){W(X),b()},get skipIsolation(){return Y()},set skipIsolation(X=!1){Y(X),b()},get suggestedBranch(){return ce()},set suggestedBranch(X){ce(X),b()},get onSkipIsolationChange(){return pe()},set onSkipIsolationChange(X){pe(X),b()},get onGitHubAuthNeededChange(){return j()},set onGitHubAuthNeededChange(X){j(X),b()},get onBranchStatusChange(){return ue()},set onBranchStatusChange(X){ue(X),b()},get onBranchesLoaded(){return P()},set onBranchesLoaded(X){P(X),b()},get onchange(){return z()},set onchange(X){z(X),b()},get showUncommittedIndicator(){return le()},set showUncommittedIndicator(X=!1){le(X),b()},get showTriggerChevron(){return ge()},set showTriggerChevron(X=!1){ge(X),b()},get triggerChevronClass(){return ye()},set triggerChevronClass(X="ml-2 opacity-50"){ye(X),b()},get triggerContentClass(){return Z()},set triggerContentClass(X="gap-0.75"){Z(X),b()},$set:Lt,$on:(X,Oe)=>Ot(e,X,Oe)},eo=Ye(),mi=ae(eo);{var va=X=>{var Oe=_N(),He=ne(Oe);{var Mt=De=>{var Dt=Ra(),Gn=re(Dt,!0);N(()=>{at(Dt,1,Bn(cn.fieldLabel)),H(Gn,ie())}),x(De,Dt)};K(He,De=>{ie()&&De(Mt)})}var ft=A(He,2);{var Kt=De=>{{let Dt=w(()=>ie()?16:12);mo(De,{get size(){return l(Dt)},class:"text-ghost shrink-0"})}};K(ft,De=>{F()&&De(Kt)})}var fn=A(ft,2),Ut=re(fn,!0);Q(Oe),N(De=>{at(Oe,1,`flex min-w-0 items-center gap-2 text-subtle text-sm ${ie()?"min-h-10 px-3 py-2":"py-1"}`),H(Ut,De)},[()=>l(vn)||M()||(l(Fe)?_.workspace_branchSelector_noIsolation_label({isolationLabel:Bt}):_.workspace_branchSelector_noBranchSelected_label())]),x(X,Oe)},dc=X=>{var Oe=WN(),He=ne(Oe);xt(He,()=>Vu,(Mt,ft)=>{ft(Mt,{get open(){return l(vt)},set open(Kt){k(vt,Kt,!0)},children:(Kt,fn)=>{var Ut=Wm(),De=ae(Ut);{const Gn=(bn,Qn)=>{let fs=()=>(Qn?.()).props;{let Ns=w(()=>$()==="default"?"outline":$()),Lo=w(()=>!ie()),vi=w(()=>`${_.workspace_branchSelector_selectBranch_label()}: ${l(vn)||M()}`),Oo=w(()=>`w-full text-muted-foreground ${U()} ${l(et)==="not-authenticated"?"ring-1 ring-orange-400 rounded-sm":ce()&&ce()!==l(oe)?"ring-1 ring-primary-ink rounded-sm":""}`);Je(bn,ks(fs,{get variant(){return l(Ns)},get wrapContent(){return l(Lo)},get"aria-label"(){return l(vi)},get class(){return l(Oo)},get ref(){return l(Ae)},set ref(es){k(Ae,es,!0)},children:(es,dr)=>{var zn=AN(),Ds=ne(zn);{var fr=Tt=>{var Jt=Ra(),kn=re(Jt,!0);N(()=>{at(Jt,1,Bn(cn.fieldLabel)),H(kn,ie())}),x(Tt,Jt)};K(Ds,Tt=>{ie()&&Tt(fr)})}var zr=A(Ds,2);{var ii=Tt=>{rt(Tt,{get icon(){return lx},class:"text-orange-500",size:"xs"})},$s=Tt=>{{let Jt=w(()=>ie()?16:12);mo(Tt,{get size(){return l(Jt)},class:"text-ghost shrink-0"})}};K(zr,Tt=>{l(et)==="not-authenticated"?Tt(ii):F()&&Tt($s,1)})}var Ts=A(zr,2),Qa=ne(Ts);{var Za=Tt=>{var Jt=SN(),kn=re(Jt,!0);N(ir=>H(kn,ir),[()=>_.workspace_branchSelector_connectGithub_label()]),x(Tt,Jt)},No=Tt=>{var Jt=CN(),kn=ae(Jt),ir=re(kn,!0),Bs=A(kn,2),ts=re(Bs,!0);N(ln=>{H(ir,l(vn)),H(ts,ln)},[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:Bt})]),x(Tt,Jt)},el=Tt=>{var Jt=Ra(),kn=re(Jt,!0);N(()=>H(kn,l(vn))),x(Tt,Jt)},ba=Tt=>{var Jt=Ra(),kn=re(Jt,!0);N(ir=>H(kn,ir),[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:Bt})]),x(Tt,Jt)},sr=Tt=>{var Jt=Ra(),kn=re(Jt,!0);N(ir=>H(kn,ir),[()=>_.workspace_branchSelector_selectRepoFirst_label()]),x(Tt,Jt)},hr=Tt=>{var Jt=MN(),kn=ae(Jt);pi(kn,{size:14,class:"text-ghost"});var ir=A(kn,2),Bs=re(ir,!0);N(ts=>H(Bs,ts),[()=>_.workspace_compactInitializer_waitingBranchSelection_label()]),x(Tt,Jt)},Fr=Tt=>{var Jt=Ra(),kn=re(Jt,!0);N(ir=>H(kn,ir),[()=>_.workspace_branchSelector_selectBranch_label()]),x(Tt,Jt)};K(Qa,Tt=>{l(et)==="not-authenticated"?Tt(Za):Y()&&l(vn)?Tt(No,1):l(vn)?Tt(el,2):l(Fe)&&S()?Tt(ba,3):S()?l(ke)?Tt(hr,5):Tt(Fr,-1):Tt(sr,4)})}Q(Ts);var hs=A(Ts,2);{var ps=Tt=>{var Jt=EN(),kn=ne(Jt);{let ir=w(()=>_.workspace_branchSelector_uncommittedChanges_tooltip());Hu(kn,{get content(){return l(ir)},side:"bottom",delayDuration:200,children:(Bs,ts)=>{var ln=TN();x(Bs,ln)},$$slots:{default:!0}})}Q(Jt),Ps(3,Jt,()=>Uo,()=>({axis:"x",tier:"moderate"})),x(Tt,Jt)};K(hs,Tt=>{le()&&!Y()&&l(vn)&&D()==="local"&&!l(Ne)&&l(Yt)&&l(me)&&Tt(ps)})}var Hr=A(hs,2);{var kr=Tt=>{rt(Tt,{get icon(){return sa},size:10,get class(){return ye()}})};K(Hr,Tt=>{ge()&&Tt(kr)})}Q(zn),N(()=>at(zn,1,`flex items-center truncate min-w-0 ${Z()}`)),x(es,zn)},$$slots:{default:!0}}))}};xt(De,()=>Ku,(bn,Qn)=>{Qn(bn,{child:Gn,$$slots:{child:!0}})})}var Dt=A(De,2);{let Gn=w(()=>ie()??_.workspace_branchSelector_whichBranch_label()),bn=w(()=>ie()?"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"),Qn=w(()=>!l(lt)),fs=w(()=>l(lt)?"bottom":ie()?m.current||l(Vt)?"bottom":"left":L()?"top":"bottom"),Ns=w(()=>l(lt)?"start":ie()?m.current||l(Vt)?"end":"start":"center"),Lo=w(()=>l(lt)?0:ie()?m.current||l(Vt)?4:24:void 0),vi=w(()=>({to:v()})),Oo=w(()=>v()?"absolute":"fixed");xt(Dt,()=>Uu,(es,dr)=>{dr(es,{role:"dialog",get"aria-label"(){return l(Gn)},get class(){return l(bn)},get customAnchor(){return l(lt)},get avoidCollisions(){return l(Qn)},get side(){return l(fs)},get align(){return l(Ns)},get sideOffset(){return l(Lo)},get portalProps(){return l(vi)},get strategy(){return l(Oo)},onOpenAutoFocus:zn=>{zn.preventDefault(),Qo().then(()=>{l(vt)&&(l(Fe)?l(Ue):l(ze))?.focus()})},get portal(){return ee()},children:(zn,Ds)=>{var fr=VN(),zr=ae(fr);{var ii=sr=>{var hr=RN(),Fr=ne(hr),hs=re(Fr,!0),ps=A(Fr,2),Hr=re(ps,!0);Q(hr),N((kr,Tt)=>{H(hs,kr),H(Hr,Tt)},[()=>_.workspace_branchSelector_whichBranch_label(),()=>W()||_.workspace_branchSelector_whichBranch_description()]),x(sr,hr)};K(zr,sr=>{ie()||sr(ii)})}var $s=A(zr,2);let Ts;var Qa=ne($s);{var Za=sr=>{var hr=PN(),Fr=ne(hr),hs=re(Fr,!0),ps=A(Fr,2),Hr=ne(ps);u(Hr);var kr=A(Hr,2),Tt=re(kr,!0),Jt=A(kr,2),kn=re(Jt,!0);Q(ps),Q(hr),N((ir,Bs)=>{H(hs,ir),at(ps,1,Bn(ie()?cn.row+" flex min-w-0":"type-caption flex min-w-0 items-center gap-2 px-2 py-1")),H(Tt,l(fe)),H(kn,Bs)},[()=>_.workspace_branchSelector_folderBranch_label(),()=>_.workspace_branchSelector_currentBranch_label()]),x(sr,hr)},No=sr=>{var hr=FN(),Fr=ae(hr);{var hs=ln=>{{let _n=w(()=>ie()?"bg-sidebar hover:bg-hover":"bg-primary/10 hover:bg-primary/15 border border-primary/20");Je(ln,{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(_n)??""}`},onclick:()=>ri(ce()),children:(hn,gs)=>{var Qt=IN(),In=ae(Qt);mo(In,{size:14,class:"text-primary-ink shrink-0"});var or=A(In,2),Ur=ne(or),Gs=re(Ur,!0),ms=A(Ur,2),zs=re(ms,!0);Q(or),N(Ar=>{H(Gs,Ar),H(zs,ce())},[()=>_.workspace_branchSelector_usePrBranch_label()]),x(hn,Qt)},$$slots:{default:!0}})}};K(Fr,ln=>{ce()&&ce()!==l(oe)&&ln(hs)})}var ps=A(Fr,2),Hr=ne(ps);{var kr=ln=>{{let _n=w(()=>ie()?"mx-2 rounded-(--radius-medium) bg-sidebar":"w-full border-l-2 border-primary bg-primary/5");Je(ln,{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(_n)??""}`},onclick:Re,children:(hn,gs)=>{var Qt=LN(),In=A(ae(Qt),2),or=ne(In),Ur=re(or,!0),Gs=A(or,2),ms=re(Gs,!0);Q(In),N((zs,Ar)=>{H(Ur,zs),H(ms,Ar)},[()=>_.workspace_branchSelector_connectWithGithub_label(),()=>_.workspace_branchSelector_connectWithGithub_description()]),x(hn,Qt)},$$slots:{default:!0}})}},Tt=ln=>{var _n=ON(),hn=ne(_n),gs=ne(hn);pi(gs,{size:20,class:"text-ghost"}),Q(hn);var Qt=A(hn,2),In=ne(Qt),or=re(In,!0),Ur=A(In,2),Gs=re(Ur,!0);Q(Qt),Q(_n),N((ms,zs)=>{at(_n,1,`px-3 py-3 flex items-start gap-3 ${ie()?"mx-2 rounded-(--radius-medium) bg-sidebar":"border-l-2 border-primary bg-primary/5"}`),H(or,ms),H(Gs,zs)},[()=>_.workspace_branchSelector_connectingGithub_label(),()=>_.workspace_branchSelector_completeAuth_description()]),x(ln,_n)},Jt=ln=>{var _n=NN(),hn=ne(_n),gs=re(hn,!0),Qt=A(hn,2),In=re(Qt,!0);Q(_n),N((or,Ur)=>{at(_n,1,`py-2 bg-danger-background/10 ${ie()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),H(gs,or),H(In,Ur)},[()=>_.workspace_branchSelector_noAccess_error(),()=>_.workspace_branchSelector_noAccess_description()]),x(ln,_n)},kn=ln=>{var _n=$N(),hn=ne(_n),gs=re(hn,!0),Qt=A(hn,2);{var In=or=>{var Ur=DN(),Gs=re(Ur,!0);N(ms=>H(Gs,ms),[()=>_.workspace_branchSelector_typeManually_description()]),x(or,Ur)};K(Qt,or=>{D()==="github"&&or(In)})}Q(_n),N(()=>{at(_n,1,`py-2 bg-danger-background/10 ${ie()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),H(gs,l(be))}),x(ln,_n)};K(Hr,ln=>{!i()&&l(et)==="not-authenticated"&&!l(bt)?ln(kr):l(bt)?ln(Tt,1):l(et)==="no-access"?ln(Jt,2):l(be)&&ln(kn,3)})}var ir=A(Hr,2);{let ln=w(()=>ie()?cn.row:void 0),_n=w(()=>_.workspace_branchSelector_selectBranch_label()),hn=w(()=>_.workspace_branchSelector_search_placeholder()),gs=w(()=>_.workspace_branchSelector_search_placeholder()),Qt=w(()=>_.workspace_branchSelector_noBranchesFound_label()),In=w(()=>l(ke)&&l(V).length===0),or=w(()=>ie()?"flex min-h-0 flex-1 flex-col gap-1 px-2":"flex min-h-0 flex-1 flex-col px-2 pb-1"),Ur=w(()=>ie()?"search":void 0),Gs=w(()=>ie()?c:void 0),ms=w(()=>ie()?"min-h-0 max-h-none flex-1 p-0 pb-2":"min-h-0 max-h-none flex-1"),zs=w(()=>ie()?"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");ch(ir,{get open(){return l(vt)},get value(){return l(oe)},get groups(){return l(Ms)},get groupHeader(){return d},get optionIcon(){return u},get rowClass(){return l(ln)},get ariaLabel(){return l(_n)},get placeholder(){return l(hn)},get searchPlaceholder(){return l(gs)},get emptyText(){return l(Qt)},get loading(){return l(In)},staticPosition:!0,allowCustom:!0,onquerychange:Cs,oncommit:Ar=>{typeof Ar=="string"&&ri(Ar)},oninteractoutside:Ar=>{Ar.target instanceof Node&&(l(Ce)?.contains(Ar.target)||l(we)?.contains(Ar.target))&&Ar.preventDefault()},get class(){return l(or)},get inputVariant(){return l(Ur)},get inputAction(){return l(Gs)},inputClass:"shrink-0",get viewportClass(){return l(ms)},size:"compact",get contentClass(){return l(zs)},get inputRef(){return l(ze)},set inputRef(Ar){k(ze,Ar,!0)}})}Q(ps);var Bs=A(ps,2);{var ts=ln=>{var _n=zN(),hn=ne(_n);as(hn,17,()=>l(Ms).filter(Qt=>Qt.key==="workspace"&&Qt.options.length>0||Qt.key==="remote"),Qt=>Qt.key,(Qt,In)=>{{let or=w(()=>Ai(l(In)));dw(Qt,{size:"sm",get pressed(){return l(or)},get ariaLabel(){return l(In).label},onChange:()=>Ri(l(In)),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:(Ur,Gs)=>{var ms=BN(),zs=ae(ms);{var Ar=Vr=>{rt(Vr,{get icon(){return gv},class:"size-3! text-primary-ink"})},pd=w(()=>Ai(l(In)));K(zs,Vr=>{l(pd)&&Vr(Ar)})}var tl=A(zs);N(()=>H(tl,` ${l(In).label??""}`)),x(Ur,ms)},$$slots:{default:!0}})}});var gs=A(hn,2);{let Qt=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());Je(gs,{onclick:xe,variant:"ghost",size:"icon-sm",class:"ml-auto shrink-0",get disabled(){return l(ke)},get"aria-label"(){return l(Qt)},children:(In,or)=>{rt(In,{get icon(){return Ip},class:"size-3.5!"})},$$slots:{default:!0}})}Q(_n),jn(_n,Qt=>k(Ce,Qt),()=>l(Ce)),x(ln,_n)};K(Bs,ln=>{ie()||ln(ts)})}x(sr,hr)};K(Qa,sr=>{l(Fe)&&l(fe)?sr(Za):sr(No,-1)})}Q($s),jn($s,sr=>k(_t,sr),()=>l(_t));var el=A($s,2);{var ba=sr=>{var hr=UN(),Fr=ne(hr),hs=ne(Fr);{const kr=ts=>{{let ln=w(()=>l(Fe)?ti:cx);rt(ts,{get icon(){return l(ln)},class:"size-4! text-subtle"})}},Tt=(ts,ln)=>{let _n=()=>(ln?.()).labelId,hn=()=>(ln?.()).descriptionId;{let gs=w(()=>`${t}-isolation`),Qt=w(()=>!Y());kv(ts,{get id(){return l(gs)},get checked(){return l(Qt)},get ariaLabelledby(){return _n()},get ariaDescribedby(){return hn()},class:"dark:[&_[data-switch-thumb][data-state=unchecked]]:bg-foreground",onCheckedChange:Wt,get ref(){return l(Ue)},set ref(In){k(Ue,In,!0)}})}};let Jt=w(()=>`${t}-isolation-row`),kn=w(()=>`${t}-isolation`),ir=w(()=>_.workspace_branchSelector_isolation_label({isolationLabel:Bt})),Bs=w(()=>l(Fe)?_.workspace_branchSelector_isolationOff_description():_.workspace_branchSelector_isolationOn_description());lk(hs,{get id(){return l(Jt)},get htmlFor(){return l(kn)},activateLabel:!0,get label(){return l(ir)},get description(){return l(Bs)},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:kr,control:Tt,$$slots:{leading:!0,control:!0}})}var ps=A(hs,2);{var Hr=kr=>{var Tt=HN(),Jt=re(Tt,!0);N(kn=>H(Jt,kn),[()=>_.workspace_branchSelector_directWarning_description()]),x(kr,Tt)};K(ps,kr=>{l(Fe)&&kr(Hr)})}Q(Fr),jn(Fr,kr=>k(we,kr),()=>l(we)),Q(hr),x(sr,hr)};K(el,sr=>{D()==="local"&&typeof pe()=="function"&&l(fe)&&sr(ba)})}N(()=>{at($s,1,`flex flex-col transition-none ${l(se)?"shrink-0":"flex-1"} ${l(Ze)?"min-h-52":"min-h-0"}`),Ts=Xi($s,"",Ts,{height:l(se)?`${l(se)}px`:void 0})}),x(zn,fr)},$$slots:{default:!0}})})}x(Kt,Ut)},$$slots:{default:!0}})}),Q(Oe),jn(Oe,Mt=>k(st,Mt),()=>l(st)),x(X,Oe)};K(mi,X=>{E()?X(va):X(dc,-1)})}x(n,eo);var fc=Pt(Ya);return a(),fc}var jN=B('<p class="type-caption text-muted-foreground px-2 py-1" role="status"> </p>');function Jf(n,e){if(new.target)return It({component:Jf,...n});Rt(e,!0);const t=()=>nn(a,"$member$",s),r=()=>nn(c,"$execution$",s),[s,i]=Ja();let o=y(e,"kind",7,"git-policy");const a=Yf(),c=a1(),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:Lt,$on:(v,m)=>Ot(e,v,m)},f=Ye(),h=ae(f);{var p=v=>{var m=jN(),C=re(m,!0);N(()=>H(C,l(u))),x(v,m)};K(h,v=>{l(u)&&v(p)})}x(n,f);var g=Pt(d);return i(),g}var KN=B('<div class="grid grid-cols-[minmax(0,1fr)_5rem] gap-3"><div><!> <!></div> <div><!> <!></div></div>'),GN=B("<div><!> <!></div>"),qN=B("<!> <!> <!>",1),JN=B('<div class="space-y-3"><h3 class="text-sm font-medium"> </h3> <!> <!> <!></div>'),XN=B('<div class="type-caption text-subtle"><p> </p></div>'),YN=B('<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 fw(n,e){if(new.target)return It({component:fw,...n});Rt(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=ha("AddRemoteSetupModal");let c=he(Cr(o()?.name??"")),u=he("ssh"),d=he(Cr(o()?.host??"")),f=he(Cr(o()?.port??22)),h=he(Cr(o()?.wsUrl??"")),p=he(Cr(o()?.username??"")),g=he(""),v=he(""),m=he("agent"),C=he(Cr(o()?.workspacePath??"")),$=he(Cr(o()?.branch??"main")),M=he("");const S=w(()=>l(c).trim()!==""&&(l(u)==="ssh"?l(d).trim()!==""&&l(f)>0&&l(f)<=65535:l(h).trim()!=="")&&l(p).trim()!==""&&l(C).trim()!==""&&(l(m)==="agent"||l(m)==="keyfile"&&l(v).trim()!==""||l(m)==="password"&&l(g).trim()!==""));function D(){if(!l(S)){k(M,_.workspace_addRemoteSetupModal_requiredFields_error(),!0);return}const F={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(C).trim(),transport:l(u),wsUrl:l(u)==="websocket"?l(h).trim():void 0,branch:l($).trim()||void 0};a.info("Saving new remote setup",{name:F.name,transport:F.transport}),s()(F),I(),r()()}function I(){k(c,""),k(u,"ssh"),k(d,""),k(f,22),k(h,""),k(p,""),k(g,""),k(v,""),k(m,"agent"),k(C,""),k($,"main"),k(M,"")}function E(){I(),r()()}var L={get isOpen(){return t()},set isOpen(F){t(F),b()},get onclose(){return r()},set onclose(F){r(F),b()},get onsave(){return s()},set onsave(F){s(F),b()},get inline(){return i()},set inline(F=!1){i(F),b()},get initialSetup(){return o()},set initialSetup(F){o(F),b()},$set:Lt,$on:(F,W)=>Ot(e,F,W)},ee=Ye(),U=ae(ee);{var ie=F=>{{let W=w(()=>_.workspace_addRemoteSetupModal_title()),Y=w(()=>_.workspace_addRemoteSetupModal_close_ariaLabel()),ce=w(()=>_.workspace_addRemoteSetupModal_addSetup_label()),pe=w(()=>_.workspace_addRemoteSetupModal_cancel_label());y_(F,{get open(){return t()},get static(){return i()},get title(){return l(W)},get closeLabel(){return l(Y)},get submitLabel(){return l(ce)},get cancelLabel(){return l(pe)},size:"lg",get canSubmit(){return l(S)},onSubmit:D,onCancel:E,children:(j,ue)=>{var P=YN(),z=ne(P),le=ne(z);Fo(le,{for:"name",children:(Ce,we)=>{$t();var Ue=zt();N(_t=>H(Ue,_t),[()=>_.workspace_addRemoteSetupModal_setupName_label()]),x(Ce,Ue)},$$slots:{default:!0}});var ge=A(le,2);{let Ce=w(()=>_.workspace_addRemoteSetupModal_setupName_placeholder());is(ge,{id:"name",get placeholder(){return l(Ce)},class:"mt-1",get value(){return l(c)},set value(we){k(c,we,!0)}})}Q(z);var ye=A(z,2),Z=ne(ye),oe=re(Z,!0),V=A(Z,2),G=ne(V);{let Ce=w(()=>l(u)==="ssh"),we=w(()=>l(u)==="ssh"?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:bg-muted");Je(G,{variant:"ghost",type:"button",get"aria-pressed"(){return l(Ce)},get class(){return`flex-1 px-3 py-1.5 text-sm rounded-md border transition-colors ${l(we)??""}`},onclick:()=>{l(u)!=="ssh"&&(I(),k(u,"ssh"))},children:(Ue,_t)=>{$t();var se=zt("SSH");x(Ue,se)},$$slots:{default:!0}})}var O=A(G,2);{let Ce=w(()=>l(u)==="websocket"),we=w(()=>l(u)==="websocket"?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:bg-muted");Je(O,{variant:"ghost",type:"button",get"aria-pressed"(){return l(Ce)},get class(){return`flex-1 px-3 py-1.5 text-sm rounded-md border transition-colors ${l(we)??""}`},onclick:()=>{l(u)!=="websocket"&&(I(),k(u,"websocket"))},children:(Ue,_t)=>{$t();var se=zt("WebSocket");x(Ue,se)},$$slots:{default:!0}})}Q(V);var te=A(V,2);{var ve=Ce=>{var we=KN(),Ue=ne(we),_t=ne(Ue);Fo(_t,{for:"host",children:(bt,Bt)=>{$t();var Fe=zt();N(Ke=>H(Fe,Ke),[()=>_.workspace_addRemoteSetupModal_host_label()]),x(bt,Fe)},$$slots:{default:!0}});var se=A(_t,2);is(se,{id:"host",placeholder:"dev.example.com",class:"mt-1",get value(){return l(d)},set value(bt){k(d,bt,!0)}}),Q(Ue);var Ze=A(Ue,2),lt=ne(Ze);Fo(lt,{for:"port",children:(bt,Bt)=>{$t();var Fe=zt();N(Ke=>H(Fe,Ke),[()=>_.workspace_addRemoteSetupModal_port_label()]),x(bt,Fe)},$$slots:{default:!0}});var et=A(lt,2);is(et,{id:"port",type:"number",placeholder:"22",class:"mt-1",get value(){return l(f)},set value(bt){k(f,bt,!0)}}),Q(Ze),Q(we),x(Ce,we)},de=Ce=>{var we=GN(),Ue=ne(we);Fo(Ue,{for:"wsUrl",children:(se,Ze)=>{$t();var lt=zt();N(et=>H(lt,et),[()=>_.workspace_addRemoteSetupModal_wsUrl_label()]),x(se,lt)},$$slots:{default:!0}});var _t=A(Ue,2);is(_t,{id:"wsUrl",placeholder:"wss://dev.example.com/ws",class:"mt-1",get value(){return l(h)},set value(se){k(h,se,!0)}}),Q(we),x(Ce,we)};K(te,Ce=>{l(u)==="ssh"?Ce(ve):Ce(de,-1)})}var fe=A(te,2),ke=ne(fe);Fo(ke,{for:"username",children:(Ce,we)=>{$t();var Ue=zt();N(_t=>H(Ue,_t),[()=>_.workspace_addRemoteSetupModal_username_label()]),x(Ce,Ue)},$$slots:{default:!0}});var be=A(ke,2);is(be,{id:"username",placeholder:"john",class:"mt-1",get value(){return l(p)},set value(Ce){k(p,Ce,!0)}}),Q(fe),Q(ye);var J=A(ye,2);{var Me=Ce=>{var we=JN(),Ue=ne(we),_t=re(Ue,!0),se=A(Ue,2),Ze=()=>l(m),lt=Ke=>{(Ke==="agent"||Ke==="keyfile"||Ke==="password")&&k(m,Ke,!0)};{let Ke=w(()=>_.workspace_addRemoteSetupModal_authentication_label());xt(se,()=>Iv,(Yt,Ne)=>{Ne(Yt,{type:"single",get value(){return Ze()},set value(en){lt(en)},get"aria-label"(){return l(Ke)},variant:"outline",class:"flex w-full",children:(en,Yn)=>{var vn=qN(),me=ae(vn);xt(me,()=>Ml,(sn,jt)=>{jt(sn,{value:"agent",class:"min-w-0 flex-1",onclick:yt=>{l(m)==="agent"&&yt.preventDefault()},onkeydown:yt=>{l(m)==="agent"&&["Enter"," "].includes(yt.key)&&yt.preventDefault()},children:(yt,dt)=>{$t();var Le=zt();N(je=>H(Le,je),[()=>_.workspace_addRemoteSetupModal_sshAgent_label()]),x(yt,Le)},$$slots:{default:!0}})});var tt=A(me,2);xt(tt,()=>Ml,(sn,jt)=>{jt(sn,{value:"keyfile",class:"min-w-0 flex-1",onclick:yt=>{l(m)==="keyfile"&&yt.preventDefault()},onkeydown:yt=>{l(m)==="keyfile"&&["Enter"," "].includes(yt.key)&&yt.preventDefault()},children:(yt,dt)=>{$t();var Le=zt();N(je=>H(Le,je),[()=>_.workspace_addRemoteSetupModal_keyFile_label()]),x(yt,Le)},$$slots:{default:!0}})});var St=A(tt,2);xt(St,()=>Ml,(sn,jt)=>{jt(sn,{value:"password",class:"min-w-0 flex-1",onclick:yt=>{l(m)==="password"&&yt.preventDefault()},onkeydown:yt=>{l(m)==="password"&&["Enter"," "].includes(yt.key)&&yt.preventDefault()},children:(yt,dt)=>{$t();var Le=zt();N(je=>H(Le,je),[()=>_.workspace_addRemoteSetupModal_password_label()]),x(yt,Le)},$$slots:{default:!0}})}),x(en,vn)},$$slots:{default:!0}})})}var et=A(se,2);{var bt=Ke=>{const Yt=w(()=>"~/.ssh/id_rsa");{let Ne=w(()=>_.workspace_addRemoteSetupModal_keyFile_label());is(Ke,{placeholder:l(Yt),get"aria-label"(){return l(Ne)},get value(){return l(v)},set value(en){k(v,en,!0)}})}};K(et,Ke=>{l(m)==="keyfile"&&Ke(bt)})}var Bt=A(et,2);{var Fe=Ke=>{{let Yt=w(()=>_.workspace_addRemoteSetupModal_password_label());is(Ke,{type:"password",placeholder:"••••••••",get"aria-label"(){return l(Yt)},get value(){return l(g)},set value(Ne){k(g,Ne,!0)}})}};K(Bt,Ke=>{l(m)==="password"&&Ke(Fe)})}Q(we),N(Ke=>H(_t,Ke),[()=>_.workspace_addRemoteSetupModal_authentication_label()]),x(Ce,we)},Be=Ce=>{var we=XN(),Ue=ne(we),_t=re(Ue,!0);Q(we),N(se=>H(_t,se),[()=>_.workspace_addRemoteSetupModal_websocketAuth_description()]),x(Ce,we)};K(J,Ce=>{l(u)==="ssh"?Ce(Me):Ce(Be,-1)})}var gt=A(J,2),Ie=ne(gt);Fo(Ie,{for:"workspacePath",children:(Ce,we)=>{$t();var Ue=zt();N(_t=>H(Ue,_t),[()=>_.workspace_addRemoteSetupModal_repoPath_label()]),x(Ce,Ue)},$$slots:{default:!0}});var $e=A(Ie,2);is($e,{id:"workspacePath",placeholder:"/home/user/myrepo",class:"mt-1",get value(){return l(C)},set value(Ce){k(C,Ce,!0)}}),Q(gt);var ze=A(gt,2),vt=ne(ze);Fo(vt,{for:"branch",children:(Ce,we)=>{$t();var Ue=zt();N(_t=>H(Ue,_t),[()=>_.workspace_addRemoteSetupModal_branch_label()]),x(Ce,Ue)},$$slots:{default:!0}});var Vt=A(vt,2);is(Vt,{id:"branch",placeholder:"main",class:"mt-1",get value(){return l($)},set value(Ce){k($,Ce,!0)}}),Q(ze);var st=A(ze,2);{var Ae=Ce=>{vk(Ce,{tone:"error",children:(we,Ue)=>{$t();var _t=zt();N(()=>H(_t,l(M))),x(we,_t)},$$slots:{default:!0}})};K(st,Ce=>{l(M)&&Ce(Ae)})}Q(P),N(Ce=>H(oe,Ce),[()=>_.workspace_addRemoteSetupModal_connectionDetails_label()]),x(j,P)},$$slots:{default:!0}})}};K(U,F=>{t()&&F(ie)})}return x(n,ee),Pt(L)}var QN=new Set(["$$slots","$$events","$$legacy","owner","name","suffix","provider","avatarUrl","local","showOwner","showForge","recent","option","selected","formStyle","checked","class"]),ZN=B('<span class="text-subtle mr-1"> </span>'),eD=B('<span class="text-subtle ml-1"> </span>'),tD=B('<span role="img" class="text-subtle shrink-0"><!></span>'),nD=B('<span><span class="truncate"><!> <!></span> <!></span>');function ip(n,e){if(new.target)return It({component:ip,...n});Rt(e,!0);const t=S=>{var D=Ye(),I=ae(D);{var E=L=>{{let ee=w(()=>Mr(cn.check,"self-center"));Av(L,{state:"checked",get class(){return l(ee)}})}};K(I,L=>{(v()??p())&&L(E)})}x(S,D)};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,""),C=Ei(e,QN);const $={github:"GitHub",gitlab:"GitLab"};var M={get owner(){return r()},set owner(S){r(S),b()},get name(){return s()},set name(S){s(S),b()},get suffix(){return i()},set suffix(S){i(S),b()},get provider(){return o()},set provider(S){o(S),b()},get avatarUrl(){return a()},set avatarUrl(S){a(S),b()},get local(){return c()},set local(S=!1){c(S),b()},get showOwner(){return u()},set showOwner(S=!0){u(S),b()},get showForge(){return d()},set showForge(S=!1){d(S),b()},get recent(){return f()},set recent(S=!1){f(S),b()},get option(){return h()},set option(S=!1){h(S),b()},get selected(){return p()},set selected(S=!1){p(S),b()},get formStyle(){return g()},set formStyle(S=!1){g(S),b()},get checked(){return v()},set checked(S){v(S),b()},get class(){return m()},set class(S=""){m(S),b()},$set:Lt,$on:(S,D)=>Ot(e,S,D)};{const S=ee=>{{let U=w(()=>g()?20:16);ph(ee,{get owner(){return r()},get provider(){return o()},get avatarUrl(){return a()},get local(){return c()},get size(){return l(U)}})}},D=ee=>{var U=nD(),ie=ne(U),F=ne(ie);{var W=P=>{var z=ZN(),le=re(z);N(()=>H(le,`${r()??""} /`)),x(P,z)};K(F,P=>{u()&&r()&&P(W)})}var Y=A(F),ce=A(Y);{var pe=P=>{var z=eD(),le=re(z);N(()=>H(le,`(${i()??""})`)),x(P,z)};K(ce,P=>{i()&&P(pe)})}Q(ie);var j=A(ie,2);{var ue=P=>{var z=tD(),le=ne(z);{let ge=w(()=>o()==="github"?Qf:Zf);rt(le,{get icon(){return l(ge)},size:12})}Q(z),N(()=>ot(z,"aria-label",$[o()])),x(P,z)};K(j,P=>{d()&&o()&&!g()&&P(ue)})}Q(U),N(()=>{at(U,1,`flex min-w-0 items-center gap-2 ${g()?"":"text-sm"}`),ot(ie,"data-recent-repo-label",f()?"":void 0),H(Y,` ${s()??""} `)}),x(ee,U)};let I=w(()=>g()?t:void 0),E=w(()=>h()?"option":void 0),L=w(()=>g()?Mr(cn.row,"cursor-pointer focus-visible:outline-none [--menu-icon-size:1.25rem]",m()):`gap-2 py-1.5 cursor-pointer ${m()}`);Dv(n,ks(()=>C,{get trailing(){return l(I)},get role(){return l(E)},get selected(){return p()},get class(){return l(L)},leading:S,title:D,$$slots:{leading:!0,title:!0}}))}return Pt(M)}var rD=B('<p class="mt-1"> </p>'),sD=B('<div role="alert" class="mt-2 px-1 text-sm text-subtle"><div class="flex items-center gap-2"><span> </span> <!></div> <!></div>'),iD=B('<div role="status"><!><span> </span></div>'),oD=B('<div role="listbox"></div>'),aD=B("<p> </p>");function op(n,e){const t=Ti();if(new.target)return It({component:op,...n});Rt(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),C=y(e,"onRetry",7),$=y(e,"onSelect",7),M=y(e,"selectedKey",7),S=y(e,"activeIndex",31,()=>-1),D=y(e,"scrollable",7,!0),I=y(e,"formStyle",7,!1),E=he(void 0),L="",ee=0;ut(()=>{S()>=s().length&&S(-1)});function U(P){S(Math.max(0,Math.min(s().length-1,P))),l(E)?.querySelectorAll('[role="option"]')[S()]?.focus()}function ie(P,z,le){if(!P.isComposing){if(["ArrowDown","ArrowUp","Home","End"].includes(P.key))P.preventDefault(),P.stopPropagation(),U(P.key==="Home"?0:P.key==="End"?s().length-1:le+(P.key==="ArrowDown"?1:-1));else if(P.key==="Enter"||P.key===" ")P.preventDefault(),P.stopPropagation(),$()(z);else if(P.key.length===1&&!P.metaKey&&!P.ctrlKey&&!P.altKey){const ge=Date.now();L=ge-ee>500?P.key:L+P.key,ee=ge;for(let ye=1;ye<=s().length;ye+=1){const Z=(le+ye)%s().length;if(`${o()(s()[Z])}/${a()(s()[Z])}`.toLowerCase().startsWith(L.toLowerCase())){P.preventDefault(),U(Z);break}}}}}var F={get id(){return r()},set id(P=t){r(P),b()},get items(){return s()},set items(P){s(P),b()},get getKey(){return i()},set getKey(P){i(P),b()},get getOwner(){return o()},set getOwner(P){o(P),b()},get getName(){return a()},set getName(P){a(P),b()},get getAvatarUrl(){return c()},set getAvatarUrl(P){c(P),b()},get provider(){return u()},set provider(P){u(P),b()},get label(){return d()},set label(P){d(P),b()},get loading(){return f()},set loading(P=!1){f(P),b()},get loadingLabel(){return h()},set loadingLabel(P){h(P),b()},get emptyLabel(){return p()},set emptyLabel(P){p(P),b()},get error(){return g()},set error(P){g(P),b()},get detail(){return v()},set detail(P){v(P),b()},get retryLabel(){return m()},set retryLabel(P){m(P),b()},get onRetry(){return C()},set onRetry(P){C(P),b()},get onSelect(){return $()},set onSelect(P){$(P),b()},get selectedKey(){return M()},set selectedKey(P){M(P),b()},get activeIndex(){return S()},set activeIndex(P=-1){S(P),b()},get scrollable(){return D()},set scrollable(P=!0){D(P),b()},get formStyle(){return I()},set formStyle(P=!1){I(P),b()},$set:Lt,$on:(P,z)=>Ot(e,P,z)},W=Ye(),Y=ae(W);{var ce=P=>{var z=sD(),le=ne(z),ge=ne(le),ye=re(ge,!0),Z=A(ge,2);{var oe=O=>{Je(O,{variant:"ghost",type:"button",class:"underline underline-offset-2 cursor-pointer hover:no-underline",get onclick(){return C()},children:(te,ve)=>{$t();var de=zt();N(()=>H(de,m())),x(te,de)},$$slots:{default:!0}})};K(Z,O=>{C()&&m()&&O(oe)})}Q(le);var V=A(le,2);{var G=O=>{var te=rD(),ve=re(te,!0);N(()=>H(ve,v())),x(O,te)};K(V,O=>{v()&&O(G)})}Q(z),N(()=>H(ye,g())),x(P,z)},pe=P=>{var z=iD(),le=ne(z);pi(le,{size:12});var ge=A(le),ye=re(ge,!0);Q(z),N(()=>{ot(z,"aria-label",h()),at(z,1,`mt-2 flex items-center gap-2 ${I()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),H(ye,h())}),x(P,z)},j=P=>{var z=oD();as(z,23,s,le=>i()(le),(le,ge,ye)=>{{let Z=w(()=>`${r()}-${l(ye)}`),oe=w(()=>`${o()(l(ge))}/${a()(l(ge))}`),V=w(()=>l(ye)===Math.max(0,S())?0:-1),G=w(()=>M()?i()(l(ge))===M():l(ye)===S()),O=w(()=>l(ye)===S()||i()(l(ge))===M()),te=w(()=>i()(l(ge))===M()),ve=w(()=>o()(l(ge))),de=w(()=>a()(l(ge))),fe=w(()=>c()?.(l(ge)));ip(le,{get id(){return l(Z)},option:!0,get"aria-label"(){return l(oe)},get tabindex(){return l(V)},get"aria-selected"(){return l(G)},get selected(){return l(O)},get checked(){return l(te)},get formStyle(){return I()},get owner(){return l(ve)},get name(){return l(de)},get avatarUrl(){return l(fe)},get provider(){return u()},onclick:()=>$()(l(ge)),onmousemove:()=>S(l(ye)),onfocus:()=>S(l(ye)),onkeydown:ke=>ie(ke,l(ge),l(ye))})}}),Q(z),jn(z,le=>k(E,le),()=>l(E)),N(()=>{ot(z,"id",r()),ot(z,"aria-label",d()),at(z,1,Bn(D()?"mt-2 max-h-56 overflow-y-auto":"mt-2"))}),x(P,z)},ue=P=>{var z=aD(),le=re(z,!0);N(()=>{at(z,1,`mt-2 ${I()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),H(le,p())}),x(P,z)};K(Y,P=>{g()?P(ce):f()?P(pe,1):s().length?P(j,2):P(ue,-1)})}return x(n,W),Pt(F)}var lD=B('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),cD=B('<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 hw(n,e){if(new.target)return It({component:hw,...n});Rt(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),C=he(void 0);function $(j){if(j.key!=="ArrowDown"||j.isComposing)return;const ue=l(C)?.querySelector('[role="option"]');ue&&(j.preventDefault(),j.stopPropagation(),ue.focus())}var M={get selectedProjectPath(){return t()},set selectedProjectPath(j){t(j),b()},get onSelect(){return r()},set onSelect(j){r(j),b()},get scopeKey(){return s()},set scopeKey(j){s(j),b()},get prefix(){return i()},set prefix(j){i(j),b()},get instanceBaseUrl(){return o()},set instanceBaseUrl(j){o(j),b()},get query(){return a()},set query(j){a(j),b()},get page(){return c()},set page(j){c(j),b()},get copy(){return u()},set copy(j){u(j),b()},get onSearch(){return d()},set onSearch(j){d(j),b()},get onSubmit(){return f()},set onSubmit(j){f(j),b()},get submitLabel(){return h()},set submitLabel(j){h(j),b()},get onMore(){return p()},set onMore(j){p(j),b()},get onRecover(){return g()},set onRecover(j){g(j),b()},get scrollable(){return v()},set scrollable(j=!0){v(j),b()},get formStyle(){return m()},set formStyle(j=!1){m(j),b()},$set:Lt,$on:(j,ue)=>Ot(e,j,ue)},S=cD(),D=ne(S);{var I=j=>{var ue=lD(),P=re(ue,!0);N(()=>H(P,o())),x(j,ue)};K(D,j=>{o()&&!i()&&j(I)})}var E=A(D,2),L=ne(E);{var ee=j=>{var ue=Ye(),P=ae(ue);Un(P,i),x(j,ue)};K(L,j=>{i()&&j(ee)})}var U=A(L,2);{var ie=j=>{{let ue=w(()=>!s());is(j,{type:"search",get"aria-label"(){return u().searchLabel},get value(){return a()},get disabled(){return l(ue)},get placeholder(){return u().searchPlaceholder},oninput:P=>d()(P.currentTarget.value,s()),onkeydown:$,class:"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm",noFocusStyle:!0})}};K(U,j=>{c().status!=="unavailable"&&j(ie)})}Q(E);var F=A(E,2);{var W=j=>{{let ue=w(()=>!a().trim()||c().status==="loading"||c().loadingMore);Je(j,{type:"button",variant:"secondary",class:"mt-2 w-full",get disabled(){return l(ue)},onclick:()=>f()?.(a(),s()),children:(P,z)=>{$t();var le=zt();N(()=>H(le,h())),x(P,le)},$$slots:{default:!0}})}};K(F,j=>{c().status!=="unavailable"&&f()&&h()&&j(W)})}var Y=A(F,2);fh(Y,s,j=>{{let ue=w(()=>c().status==="ready"?c().items:[]),P=w(()=>c().status==="loading"),z=w(()=>a()?u().emptySearchLabel:u().emptyLabel),le=w(()=>c().status==="unavailable"?c().message:void 0),ge=w(()=>c().status==="unavailable"?c().detail:void 0),ye=w(()=>c().status==="unavailable"?c().actionLabel:void 0),Z=w(()=>g()?()=>g()?.(s()):void 0);op(j,{get items(){return l(ue)},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(P)},get loadingLabel(){return u().loadingLabel},get emptyLabel(){return l(z)},get error(){return l(le)},get detail(){return l(ge)},get retryLabel(){return l(ye)},get onRetry(){return l(Z)},get selectedKey(){return t()},onSelect:oe=>r()(oe.projectPath,s())})}});var ce=A(Y,2);{var pe=j=>{Je(j,{type:"button",variant:"ghost",class:"mt-2 w-full",get disabled(){return c().loadingMore},onclick:()=>p()(s()),children:(ue,P)=>{$t();var z=zt();N(()=>H(z,c().loadingMore?u().loadingMoreLabel:u().loadMoreLabel)),x(ue,z)},$$slots:{default:!0}})};K(ce,j=>{c().status==="ready"&&(c().hasMore||c().loadingMore)&&j(pe)})}return Q(S),jn(S,j=>k(C,j),()=>l(C)),x(n,S),Pt(M)}var uD=B('<div class="py-2 px-2 flex items-center gap-2 text-xs text-emerald-500"><!> <span> </span></div>'),jm=B("<!> <span> </span>",1),dD=B('<div class="py-2 px-2 space-y-2"><p class="text-xs text-danger"> </p> <!></div>'),fD=B('<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>'),hD=B("<!> <span> </span> <!>",1),pD=B('<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>'),gD=B('<div class="py-2 px-2 flex items-center gap-2 text-xs text-subtle"><!> <span> </span></div>'),mD=B('<p class="type-caption whitespace-normal text-muted-foreground"> </p>'),vD=B('<div class="first-line-icon type-caption"><!></div> <div class="flex-1 min-w-0"><p> </p> <!></div>',1),Km=B("<div><!></div>");function pw(n,e){if(new.target)return It({component:pw,...n});Rt(e,!0);const t=()=>nn(g,"$isAuthenticated$",a),r=()=>nn(v,"$isAuthenticating$",a),s=()=>nn(m,"$deviceFlow$",a),i=()=>nn(C,"$error$",a),o=()=>nn($,"$requiresDaemonAuth$",a),[a,c]=Ja();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=Rv(),v=a_(),m=l_(),C=c_(),$=u_();let M=he(!1),S=he(!1),D=he(!1);Fu(()=>{At.dispatch(af()),p()&&I()});function I(){k(M,!0),At.dispatch(Mk())}function E(){l(M)&&(At.dispatch(Fp()),k(M,!1))}function L(){At.dispatch(Tk()),I()}function ee(){k(M,!1),k(D,!0),setTimeout(()=>{k(D,!1),typeof f()=="function"&&f()()},1e3)}async function U(){if(l(M)){if(t()){ee();return}k(S,!0);try{await xx.isAuthenticated()&&(At.dispatch(af()),ee())}catch{}finally{k(S,!1)}}}ut(()=>{!l(M)&&r()&&s()&&k(M,!0)}),ut(()=>{l(M)&&t()&&ee()}),ut(()=>{if(!l(M)||!s())return;const Z=()=>{U()};return window.addEventListener("focus",Z),()=>{window.removeEventListener("focus",Z)}}),sc(()=>{l(M)&&r()&&At.dispatch(Fp())});const ie=w(()=>l(M)&&r()),F=w(()=>l(M)&&s()),W=w(()=>l(M)&&i());var Y={get message(){return u()},set message(Z=_.lib_githubAuth_connect_label()){u(Z),b()},get compact(){return d()},set compact(Z=!1){d(Z),b()},get onSuccess(){return f()},set onSuccess(Z){f(Z),b()},get class(){return h()},set class(Z=""){h(Z),b()},get autoStart(){return p()},set autoStart(Z=!1){p(Z),b()},$set:Lt,$on:(Z,oe)=>Ot(e,Z,oe)},ce=Km(),pe=ne(ce);{var j=Z=>{var oe=uD(),V=ne(oe);rt(V,{get icon(){return gv},size:"xs"});var G=A(V,2),O=re(G,!0);Q(oe),N(te=>H(O,te),[()=>_.lib_githubAuth_connected_label()]),Ps(3,oe,()=>Uo,()=>({axis:"y",tier:"moderate"})),x(Z,oe)},ue=Z=>{var oe=dD(),V=ne(oe),G=re(V,!0),O=A(V,2);Je(O,{variant:"outline",size:"xs",onclick:L,children:(te,ve)=>{var de=jm(),fe=ae(de);rt(fe,{get icon(){return eh},size:"xs"});var ke=A(fe,2),be=re(ke,!0);N(J=>H(be,J),[()=>_.lib_githubAuth_tryAgain_label()]),x(te,de)},$$slots:{default:!0}}),Q(oe),N(()=>H(G,i())),Ps(3,oe,()=>Uo,()=>({axis:"y",tier:"moderate"})),x(Z,oe)},P=Z=>{var oe=fD(),V=ne(oe),G=re(V,!0),O=A(V,2),te=ne(O),ve=A(te,2);Q(O),Q(oe),N((de,fe,ke)=>{H(G,de),H(te,`${fe??""} `),H(ve,` ${ke??""}`)},[()=>_.lib_githubAuth_daemonAuthFirst_message(),()=>_.lib_githubAuth_run_before(),()=>_.lib_githubAuth_inYourTerminal_after()]),Ps(3,oe,()=>Uo,()=>({axis:"y",tier:"moderate"})),x(Z,oe)},z=Z=>{var oe=pD(),V=ne(oe),G=ne(V),O=re(G,!0),te=A(G,2);{let J=w(()=>_.lib_githubAuth_closeModal_ariaLabel());Je(te,{variant:"ghost-light",size:"icon-xs",class:"-mt-2 -mr-2",onclick:E,get"aria-label"(){return l(J)},children:(Me,Be)=>{rt(Me,{get icon(){return Ji},size:"xs"})},$$slots:{default:!0}})}Q(V);var ve=A(V,2);Yk(ve,{get userCode(){return s().userCode},get verificationUri(){return s().verificationUri},compact:!0});var de=A(ve,2),fe=ne(de);{var ke=J=>{var Me=jm(),Be=ae(Me);pi(Be,{size:12});var gt=A(Be,2),Ie=re(gt,!0);N($e=>H(Ie,$e),[()=>_.lib_githubAuth_checking_label()]),x(J,Me)},be=J=>{var Me=hD(),Be=ae(Me);pi(Be,{size:12});var gt=A(Be,2),Ie=re(gt,!0),$e=A(gt,2);Je($e,{type:"button",class:"cursor-pointer underline underline-offset-2 decoration-muted-foreground/20",onclick:U,children:(ze,vt)=>{$t();var Vt=zt();N(st=>H(Vt,st),[()=>_.lib_githubAuth_checkNow_label()]),x(ze,Vt)},$$slots:{default:!0}}),N(ze=>H(Ie,ze),[()=>_.lib_githubAuth_waitingForAuthorization_label()]),x(J,Me)};K(fe,J=>{l(S)?J(ke):J(be,-1)})}Q(de),Q(oe),N(J=>H(O,J),[()=>_.lib_githubAuth_enterCode_label()]),Ps(3,oe,()=>Uo,()=>({axis:"y",tier:"moderate"})),x(Z,oe)},le=Z=>{var oe=gD(),V=ne(oe);pi(V,{size:12});var G=A(V,2),O=re(G,!0);Q(oe),N(te=>H(O,te),[()=>_.lib_githubAuth_startingAuthentication_label()]),Ps(3,oe,()=>Uo,()=>({axis:"y",tier:"moderate"})),x(Z,oe)},ge=Z=>{var oe=Km(),V=ne(oe);{let G=w(()=>d()?"h-8":"h-auto items-start py-2");Je(V,{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(G)??""}`},onclick:I,children:(O,te)=>{var ve=vD(),de=ae(ve),fe=ne(de);gh(fe,{size:16,class:"text-ghost"}),Q(de);var ke=A(de,2),be=ne(ke),J=re(be,!0),Me=A(be,2);{var Be=gt=>{var Ie=mD(),$e=re(Ie,!0);N(ze=>H($e,ze),[()=>_.lib_githubAuth_enables_description()]),x(gt,Ie)};K(Me,gt=>{d()||gt(Be)})}Q(ke),N(()=>{at(be,1,`type-caption font-normal ${d()?"truncate":"whitespace-normal"}`),H(J,u())}),x(O,ve)},$$slots:{default:!0}})}Q(oe),Ps(3,oe,()=>Uo,()=>({axis:"y",tier:"moderate"})),x(Z,oe)};K(pe,Z=>{l(D)?Z(j):l(W)?Z(ue,1):o()?Z(P,2):l(F)&&s()?Z(z,3):l(ie)?Z(le,4):Z(ge,-1)})}Q(ce),N(()=>at(ce,1,`min-w-0 rounded-sm ${d()?"":"bg-sidebar"} ${h()??""}`)),x(n,ce);var ye=Pt(Y);return c(),ye}function bD(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 yD=B('<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 gw(n,e){if(new.target)return It({component:gw,...n});Rt(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(()=>bD(i())),c=w(()=>l(a).label),u=w(()=>l(a).description),d=`initialize-git-${crypto.randomUUID()}`;var f={get checked(){return t()},set checked(M){t(M),b()},get disabled(){return r()},set disabled(M=!1){r(M),b()},get onCheckedChange(){return s()},set onCheckedChange(M){s(M),b()},get folder(){return i()},set folder(M){i(M),b()},get class(){return o()},set class(M=""){o(M),b()},$set:Lt,$on:(M,S)=>Ot(e,M,S)},h=yD(),p=ne(h);{let M=w(()=>`${d}-switch`),S=w(()=>`${d}-label`),D=w(()=>`${d}-description`);kv(p,{get id(){return l(M)},get checked(){return t()},get disabled(){return r()},size:"sm",class:"mt-0.5 shrink-0",get ariaLabelledby(){return l(S)},get ariaDescribedby(){return l(D)},onCheckedChange:I=>s()(I)})}var g=A(p,2),v=ne(g),m=re(v,!0),C=A(v,2),$=re(C,!0);return Q(g),Q(h),N(()=>{at(h,1,`flex min-w-0 items-start gap-2.5 ${o()??""}`),ot(v,"id",`${d}-label`),ot(v,"for",`${d}-switch`),H(m,l(c)),ot(C,"id",`${d}-description`),H($,l(u))}),x(n,h),Pt(f)}function wD(n){return n.githubConnected||n.gitlabConnected||n.githubFailed||n.gitlabFailed?!0:!n.githubSettled||!n.gitlabSettled}function xD(n){return n.plainFoldersOffered?n.selected?n.selected:n.hasGitRepositoryEntry?"codebase":n.forgeState==="none"||n.hasPlainFolderEntry?"folder":"codebase":"codebase"}function kD(n){return n.githubConnected||n.gitlabConnected?"connected":n.githubFailed||!n.githubSettled||n.gitlabFailed||!n.gitlabSettled?"unknown":"none"}const _D=At.createSelector(n=>n.userPreferences?.labsPlainFolderWorkspacesEnabled===!0&&kx(n.daemonHealth?.stats?.protocolVersion)),wB=At.createSelector(n=>{const e=n.workspace?.workspaces?ah(n.workspace.workspaces).filter(s=>s.id!==Ek):[],t=n.gitlabAuth?.statusFailed===!0,r=_x({rememberedChoice:null,workspacesLoaded:n.workspace?.hasLoaded===!0,hasGitWorkspace:Sx(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"}),SD=At.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return wD({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})}),CD=At.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return kD({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})}),MD=At.createSelector(n=>n.githubRepos.repos),TD=At.createSelector(n=>ah(MD.select(n))),ED=At.createSelector(n=>n.githubRepos.loading),AD=At.createSelector(n=>n.githubRepos.error),RD=At.createSelector(n=>n.githubRepos.loaded),PD=At.createSelector(n=>n.githubRepoSearch.results),ID=At.createSelector(n=>ah(PD.select(n))),LD=At.createSelector(n=>n.githubRepoSearch.loading),OD=At.createSelector(n=>n.githubRepoSearch.lastQuery);var ND=B('<p class="type-caption text-muted-foreground"> </p>'),DD=B('<div class="flex flex-col gap-0.5" data-testid="import-session-provider-notes"></div>'),$D=B('<!> <span class="whitespace-nowrap"> </span>',1),BD=B("<!> <!>",1),zD=B('<div class="shrink-0 overflow-x-auto px-2 pt-2" data-testid="import-session-provider-filter"><!></div>'),FD=B('<div class="flex flex-col items-start gap-2 px-4 py-3" role="alert"><p class="type-caption text-muted-foreground" data-testid="import-session-error"> </p> <!></div>'),HD=B('<span aria-hidden="true">·</span> <time class="shrink-0"> </time>',1),UD=B('<span aria-hidden="true">·</span> <span class="min-w-0 shrink truncate" data-testid="import-session-disabled-reason"> </span>',1),VD=B('<span aria-hidden="true">·</span> <span class="min-w-0 max-w-1/3 shrink truncate"> </span>',1),WD=B('<span class="type-caption order-last flex min-w-0 basis-full items-center gap-1.5 ps-6 text-muted-foreground" data-testid="import-session-meta"><span class="shrink-0"> </span> <!> <span aria-hidden="true">·</span> <span class="min-w-0 truncate"> </span> <!></span>'),jD=B('<div class="flex min-h-0 flex-1 flex-col" data-testid="import-session-list"><!> <!></div>');function mw(n,e){if(new.target)return It({component:mw,...n});Rt(e,!0);const t=P=>{var z=DD();as(z,21,()=>l(E),le=>le.id,(le,ge)=>{var ye=ND(),Z=re(ye,!0);N(oe=>H(Z,oe),[()=>_.sessionImport_list_providerFailed_note({provider:l(ge).label})]),x(le,ye)}),Q(z),x(P,z)};let r=y(e,"status",7),s=y(e,"sessions",7),i=y(e,"onquerychange",7),o=y(e,"onselect",7),a=y(e,"onretry",7),c=y(e,"onclose",7),u=y(e,"providerLabel",7),d=y(e,"providers",23,()=>[]),f=y(e,"providerFilter",7,""),h=y(e,"onproviderchange",7),p=y(e,"open",7,!0),g=y(e,"inputRef",15,null),v=y(e,"disabledReason",7),m=y(e,"selectedKey",7,""),C=y(e,"interactionRoot",7,null),$=he(null);function M(P){const z=C()??l($);P.target instanceof Node&&z?.contains(P.target)&&P.preventDefault()}const S=P=>`session:${P}`;function D(P){return{value:S(Mv(P)),disabled:!!v()?.(P),label:P.title.trim()||_.sessionImport_list_untitled_label(),description:mN(P),data:P}}const I=w(()=>d().filter(P=>P.status==="ok")),E=w(()=>d().filter(P=>P.status==="error")),L=w(()=>s().filter(P=>!f()||P.provider===f()).map(D));function ee(P){return d().find(z=>z.id===P)?.label??u()?.(P)??P}let U=he("");function ie(P){if(P.updatedAt===null)return null;const z=new Date(P.updatedAt);return Number.isNaN(z.getTime())?null:z}var F={get status(){return r()},set status(P){r(P),b()},get sessions(){return s()},set sessions(P){s(P),b()},get onquerychange(){return i()},set onquerychange(P){i(P),b()},get onselect(){return o()},set onselect(P){o(P),b()},get onretry(){return a()},set onretry(P){a(P),b()},get onclose(){return c()},set onclose(P){c(P),b()},get providerLabel(){return u()},set providerLabel(P){u(P),b()},get providers(){return d()},set providers(P=[]){d(P),b()},get providerFilter(){return f()},set providerFilter(P=""){f(P),b()},get onproviderchange(){return h()},set onproviderchange(P){h(P),b()},get open(){return p()},set open(P=!0){p(P),b()},get inputRef(){return g()},set inputRef(P=null){g(P),b()},get disabledReason(){return v()},set disabledReason(P){v(P),b()},get selectedKey(){return m()},set selectedKey(P=""){m(P),b()},get interactionRoot(){return C()},set interactionRoot(P=null){C(P),b()},$set:Lt,$on:(P,z)=>Ot(e,P,z)},W=jD(),Y=ne(W);{var ce=P=>{var z=zD(),le=ne(z);{let ge=w(()=>f()||"all"),ye=w(()=>_.sessionImport_list_providerFilter_ariaLabel());xt(le,()=>Iv,(Z,oe)=>{oe(Z,{type:"single",variant:"flat",get value(){return l(ge)},onValueChange:V=>h()?.(!V||V==="all"?"":V),get"aria-label"(){return l(ye)},children:(V,G)=>{var O=BD(),te=ae(O);xt(te,()=>Ml,(de,fe)=>{fe(de,{value:"all",class:"type-caption h-7 px-2",children:(ke,be)=>{$t();var J=zt();N(Me=>H(J,Me),[()=>_.sessionImport_list_allProviders_label()]),x(ke,J)},$$slots:{default:!0}})});var ve=A(te,2);as(ve,17,()=>l(I),de=>de.id,(de,fe)=>{var ke=Ye(),be=ae(ke);xt(be,()=>Ml,(J,Me)=>{Me(J,{get value(){return l(fe).id},class:"type-caption h-7 gap-1.5 px-2",children:(Be,gt)=>{var Ie=$D(),$e=ae(Ie);{var ze=Ae=>{lf(Ae,{get providerId(){return l(fe).id},size:14,class:"size-3.5",monochrome:!0})},vt=w(()=>cf(l(fe).id));K($e,Ae=>{l(vt)&&Ae(ze)})}var Vt=A($e,2),st=re(Vt,!0);N(()=>H(st,l(fe).label)),x(Be,Ie)},$$slots:{default:!0}})}),x(de,ke)}),x(V,O)},$$slots:{default:!0}})})}Q(z),x(P,z)};K(Y,P=>{l(I).length>1&&r()!=="error"&&P(ce)})}var pe=A(Y,2);{var j=P=>{var z=FD(),le=ne(z),ge=re(le,!0),ye=A(le,2);Je(ye,{variant:"ghost",size:"sm",get onclick(){return a()},children:(Z,oe)=>{$t();var V=zt();N(G=>H(V,G),[()=>_.sessionImport_list_retry_label()]),x(Z,V)},$$slots:{default:!0}}),Q(z),N(Z=>H(ge,Z),[()=>_.sessionImport_list_loadFailed_error()]),x(P,z)},ue=P=>{{const z=(te,ve=Or)=>{const de=w(()=>ve().data.provider);var fe=Ye(),ke=ae(fe);{var be=Be=>{lf(Be,{get providerId(){return l(de)},size:16,class:"size-4"})},J=w(()=>cf(l(de))),Me=Be=>{rt(Be,{get icon(){return mv},get class(){return cn.icon}})};K(ke,Be=>{l(J)?Be(be):Be(Me,-1)})}x(te,fe)},le=(te,ve=Or)=>{const de=w(()=>ve().data),fe=w(()=>ie(l(de))),ke=w(()=>v()?.(l(de))??null);var be=WD(),J=ne(be),Me=re(J,!0),Be=A(J,2);{var gt=st=>{var Ae=HD(),Ce=A(ae(Ae),2),we=re(Ce,!0);N((Ue,_t)=>{ot(Ce,"datetime",l(de).updatedAt),ot(Ce,"title",Ue),H(we,_t)},[()=>p1(l(fe)),()=>g1(l(fe))]),x(st,Ae)};K(Be,st=>{l(fe)&&l(de).updatedAt&&st(gt)})}var Ie=A(Be,4),$e=re(Ie,!0),ze=A(Ie,2);{var vt=st=>{var Ae=UD(),Ce=A(ae(Ae),2),we=re(Ce,!0);N(()=>H(we,l(ke))),x(st,Ae)},Vt=st=>{var Ae=VD(),Ce=A(ae(Ae),2),we=re(Ce,!0);N(()=>{ot(Ce,"title",l(de).gitBranch),H(we,l(de).gitBranch)}),x(st,Ae)};K(ze,st=>{l(ke)?st(vt):l(de).gitBranch&&st(Vt,1)})}Q(be),N((st,Ae)=>{H(Me,st),ot(Ie,"title",l(de).cwd),H($e,Ae)},[()=>ee(l(de).provider),()=>vN(l(de).cwd)]),x(te,be)};let ge=w(()=>m()?S(m()):""),ye=w(()=>r()==="loading"),Z=w(()=>_.sessionImport_list_ariaLabel()),oe=w(()=>_.sessionImport_list_search_placeholder()),V=w(()=>_.sessionImport_list_search_placeholder()),G=w(()=>l(U).trim()?_.sessionImport_list_noResults_message():_.sessionImport_list_empty_message()),O=w(()=>l(E).length>0?t:void 0);ch(P,{get options(){return l(L)},get value(){return l(ge)},get open(){return p()},get loading(){return l(ye)},get ariaLabel(){return l(Z)},get placeholder(){return l(oe)},get searchPlaceholder(){return l(V)},get emptyText(){return l(G)},get footer(){return l(O)},staticPosition:!0,inputVariant:"search",size:"compact",class:"flex min-h-0 flex-1 flex-col gap-1 px-2 pt-1 pb-2",inputClass:"shrink-0",get rowClass(){return`${cn.row} flex-wrap`},viewportClass:"min-h-0 max-h-none flex-1 p-0",contentClass:"flex min-h-0 max-h-none flex-1 flex-col border-0 shadow-none",onquerychange:te=>{k(U,te,!0),i()?.(te)},oncommit:(te,ve)=>o()(ve.data),oninteractoutside:M,onopenchange:te=>{te||c()?.()},get inputRef(){return g()},set inputRef(te){g(te)},optionIcon:z,optionDescription:le,$$slots:{optionIcon:!0,optionDescription:!0}})}};K(pe,P=>{r()==="error"?P(j):P(ue,-1)})}return Q(W),jn(W,P=>k($,P),()=>l($)),N(()=>ot(W,"data-status",r())),x(n,W),Pt(F)}var KD=B("<!> ",1),GD=B('<div class="flex shrink-0 justify-end border-t border-border px-2 py-1"><!></div>'),qD=B('<div data-testid="import-session-tab"><!> <!></div>');function vw(n,e){if(new.target)return It({component:vw,...n});Rt(e,!0);const t=()=>nn(m,"$status$",i),r=()=>nn(v,"$sessions$",i),s=()=>nn(C,"$providers$",i),[i,o]=Ja();let a=y(e,"onselect",7),c=y(e,"knownRepos",23,()=>[]),u=y(e,"selectedKey",7,""),d=y(e,"autoload",7,!0),f=y(e,"inputRef",15,null),h=y(e,"onclose",7),p=y(e,"interactionRoot",7,null),g=y(e,"class",7,"");const v=Cx(),m=Mx(),C=Tx();let $=he(""),M=he(null),S="";const D=w(()=>t()==="error"?"error":(t()==="loading"||t()==="idle")&&r().length===0?"loading":"ready");function I(j,ue=l($)){S=j,At.dispatch(Ak(j,ue||void 0))}Fu(()=>{if(!d())return;const j=At.state.importableSessions;j&&(j.status==="ready"||j.status==="loading")&&j.query===""&&j.provider===""||Zs(()=>I(""))});function E(j){return l1.select(At.state,j)}function L(j){return bN(j,c())}function ee(j){return L(j)?null:_.sessionImport_list_noRepository_reason()}function U(j){const ue=L(j);ue&&a()(Rk(j,ue))}var ie={get onselect(){return a()},set onselect(j){a(j),b()},get knownRepos(){return c()},set knownRepos(j=[]){c(j),b()},get selectedKey(){return u()},set selectedKey(j=""){u(j),b()},get autoload(){return d()},set autoload(j=!0){d(j),b()},get inputRef(){return f()},set inputRef(j=null){f(j),b()},get onclose(){return h()},set onclose(j){h(j),b()},get interactionRoot(){return p()},set interactionRoot(j=null){p(j),b()},get class(){return g()},set class(j=""){g(j),b()},$set:Lt,$on:(j,ue)=>Ot(e,j,ue)},F=qD(),W=ne(F);{let j=w(()=>p()??l(M));mw(W,{get status(){return l(D)},get sessions(){return r()},providerLabel:E,get providers(){return s()},get providerFilter(){return l($)},onproviderchange:ue=>{k($,ue,!0),I(S,ue)},onquerychange:I,onselect:U,onretry:()=>I(S),get onclose(){return h()},disabledReason:ee,get selectedKey(){return u()},get interactionRoot(){return l(j)},get inputRef(){return f()},set inputRef(ue){f(ue)}})}var Y=A(W,2);{var ce=j=>{var ue=GD(),P=ne(ue);{let z=w(()=>t()==="loading");Je(P,{variant:"ghost",size:"sm",type:"button",get disabled(){return l(z)},onclick:()=>I(S),"data-testid":"import-session-refresh",children:(le,ge)=>{var ye=KD(),Z=ae(ye);rt(Z,{get icon(){return ux},class:"size-3.5"});var oe=A(Z);N(V=>H(oe,` ${V??""}`),[()=>_.sessionImport_list_refresh_label()]),x(le,ye)},$$slots:{default:!0}})}Q(ue),x(j,ue)};K(Y,j=>{l(D)!=="error"&&j(ce)})}Q(F),jn(F,j=>k(M,j),()=>l(M)),N(()=>at(F,1,`flex min-h-0 flex-col ${g()??""}`)),x(n,F);var pe=Pt(ie);return o(),pe}var JD=B('<div data-recent-repo-row=""><!> <!> <!></div>'),XD=B(" <!>",1),Oc=B("<!> <!>",1),YD=B('<span class="text-sm pl-3 shrink-0 select-none"> </span>'),Gm=B("<span> </span>"),QD=B('<!> <span class="min-w-0 flex-1 text-left truncate" data-testid="repo-selector-session-value"><span> </span></span>',1),qm=B('<span class="text-sm text-subtle ml-1"> </span>'),Jm=B("<span> </span> <!>",1),ZD=B('<span class="min-w-0 flex-1 text-left truncate"><!> <!></span>'),e$=B("<div><!> <!> <!> <!> <!></div>"),t$=B('<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>'),n$=B('<div role="status"></div>'),r$=B('<p class="type-body px-3 py-2 text-muted-foreground" role="status"> </p>'),Xm=B("<!> <span> </span>",1),s$=B('<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),i$=B('<div class="flex shrink-0 items-center gap-1 px-2 pt-2 pb-2"><!> <h2> </h2></div>'),o$=B('<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>'),a$=B('<div class="flex items-center justify-between gap-2 mt-2 px-1"><span class="text-sm text-subtle truncate flex-1"> </span> <!></div>'),l$=B('<!> <!> <div class="flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring"><!> <!></div> <!> <!>',1),c$=B('<span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <span><div class="truncate"> </div> <!></span>',1),u$=B('<div class="mt-2 px-1"><span class="text-sm text-danger"> </span></div>'),d$=B('<div class="flex items-center gap-2 text-sm text-subtle"><!> <span> </span></div>'),Nc=B('<div class="flex items-center justify-between gap-2"><span class="text-sm text-subtle"> </span> <!></div>'),f$=B('<div class="flex items-center justify-between gap-2"><span class="text-sm text-warning-ink"> </span> <!></div>'),h$=B('<div class="mt-2 px-1"><div class="text-sm text-subtle truncate mb-2"> </div> <!></div>'),p$=B('<!> <div class="flex items-center gap-3"><span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <!></div> <!>',1),g$=B('<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>'),m$=B('<div class="text-sm text-subtle px-3 py-2"> </div>'),v$=B("<!> ",1),b$=B('<div class="space-y-1"><!> <!> <!></div>'),y$=B('<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>'),w$=B('<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>'),x$=B('<div class="space-y-1"></div>'),k$=B('<div class="-mx-2" data-testid="recent-repositories"><!></div>'),_$=B('<div class="min-h-16 overflow-y-auto flex-1 px-4 pb-3 pt-2"><!> <!></div>'),S$=B("<!> <div><!> <!></div> <!> <!>",1),C$=B("<!> <!> <!>",1),M$=B('<div class="relative min-w-0"><!></div> <!> <!>',1);function Ys(n,e){const t=Ti();if(new.target)return It({component:Ys,...n});Rt(e,!0);const r=()=>nn(F,"$hostMember$",U),s=()=>nn(W,"$canAdministerHost$",U),i=()=>nn(ke,"$isGithubAuthenticated$",U),o=()=>nn(te,"$recentRepoRefresh$",U),a=()=>nn(Y,"$admission$",U),c=()=>nn(oe,"$workspaceInitializerRecentRepos$",U),u=()=>nn(ye,"$dismissedRecentRepoKeys$",U),d=()=>nn(ma,"$sessionImportSupported$",U),f=()=>nn(dn,"$cloneSourceVisible$",U),h=()=>nn(V,"$workspaceInitializerRemoteSetups$",U),p=()=>nn(Z,"$defaultParentPath$",U),g=()=>nn(ve,"$directoryStatusCheck$",U),v=()=>nn(Qa,"$plainFolderCreationAvailable$",U),m=()=>nn(Za,"$forgeConnectionState$",U),C=()=>nn(J,"$githubRepos$",U),$=()=>nn(ze,"$githubSearchLastQuery$",U),M=()=>nn(Ie,"$githubSearchResults$",U),S=()=>nn(Be,"$githubReposLoaded$",U),D=()=>nn(Me,"$githubReposLoading$",U),I=()=>nn(gt,"$githubReposError$",U),E=()=>nn(ge,"$initializerHydrated$",U),L=()=>nn(eo,"$remoteWorkspacesEnabled$",U),ee=()=>nn($e,"$githubSearchLoading$",U),[U,ie]=Ja(),F=Yf(),W=c1(),Y=u1(),ce=ha("RepoSelector"),pe=Wu(),j=new ju;let ue=he(null),P=he(!1);const z=_.workspace_isolationMode_worktree_label(),le=At.dispatch,ge=Ex(),ye=Ax(),Z=Rx(),oe=Px(),V=Ix(),G=crypto.randomUUID(),O=crypto.randomUUID(),te=Lx(G),ve=Ox(O);let de,fe;const ke=Rv(),be=w(()=>r()||s()&&i()),J=TD(),Me=ED(),Be=RD(),gt=AD(),Ie=ID(),$e=LD(),ze=OD();function vt(T,q){const Te=T.includes("\\")?"\\":"/";return`${T.replace(/[/\\]$/,"")}${Te}${q}`}let Vt=y(e,"variant",7,"ghost"),st=y(e,"value",7,""),Ae=y(e,"onchange",7),Ce=y(e,"triggerClass",7),we=y(e,"rowLabel",7),Ue=y(e,"displayValue",7),_t=y(e,"triggerSuffix",7),se=y(e,"triggerValueClass",7,"text-subtle"),Ze=y(e,"triggerContentClass",7,"gap-0.75"),lt=y(e,"emptyLabel",7),et=y(e,"showEmptyIcon",7,!1),bt=y(e,"showTriggerChevron",7,!1),Bt=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),Fe=y(e,"triggerIcon",7),Ke=y(e,"triggerAriaLabel",7),Yt=y(e,"onClear",7),Ne=y(e,"gitlab",7),en=y(e,"gitlabSelected",7,!1),Yn=y(e,"plainFolderMode",7,!1),vn=y(e,"plainFolderSelected",7,!1),me=y(e,"gitChoice",7),tt=y(e,"sessions",7);function St(T){zn++,Ae()&&Ae()(new CustomEvent("change",{detail:T}))}function sn(){l(qe)&&l(qe).focus()}function jt(T="local"){l(dt)&&!st()&&(k(dt,""),k(Le,""),k(Nt,"local"),k(Ut,"")),Qe=T,we()&&k(fr,"add"),k(Ge,!0)}function yt(){l(si)&&(Qe="sessions",k(fr,"add"),k(Ge,!0))}let dt=he(Cr(st())),Le=he(Cr(st())),je=he(""),qe=he(void 0),Ct=he(null),Ge=he(!1),nt=he(null),Qe=null,pt=he(!1);const qt=w(()=>!o()||o().admission===a()&&o().status==="pending");let Ht=he(!1),mt=he(!1),Nt=he(Cr(zs(st()))),Rn=he(""),wr=he(null);const Br=w(()=>{const T=c(),q=o();return!q||q.admission!==a()||At.dispatch!==le?T:Bx({saved:T,source:q,dismissed:u(),mode:we()?"all":"recent"})});async function ds(T,q){T.preventDefault(),T.stopPropagation();const Te=T.currentTarget,Ft=Te.closest("[data-recent-repo-row]"),Sn=Ft?.nextElementSibling??Ft?.previousElementSibling,oi=Te.closest('[role="dialog"]'),to=Sn?.querySelector("[data-remove-recent-repo]")??oi?.querySelector('[role="tab"][aria-selected="true"]')??oi?.querySelector("[data-repo-search]");At.dispatch(zk({path:q.path,type:q.type})),await Qo(),to?.focus()}let xr=he(null),un=he(null),ri=null,Wt=he("github");const ma=Nx(),si=w(()=>!!tt()&&!!we()&&d()),Cs=w(()=>tt()?.selected??null),R=w(()=>l(Br).filter(T=>T.type==="local").map(T=>({path:T.path,type:"local"})));ut(()=>{l(Wt)==="sessions"&&!l(si)&&k(Wt,"local")});function xe(){k(Wt,"sessions"),k(fr,"add")}function Re(T){tt()?.onSelect(T),k(Ge,!1)}let ct=he("github");const Pe=w(()=>[...i()?[{id:"github",label:"github.com/",icon:Qf}]:[],...Ne()?.authenticated&&Ne().instanceBaseUrl?[{id:"gitlab",label:`${Ne().instanceBaseUrl.replace(/^https:\/\//,"").replace(/\/$/,"")}/`,icon:Zf}]:[]]),Se=w(()=>l(Pe).find(T=>T.id===l(ct))??l(Pe)[0]),on=w(()=>l(Se)?.id??"github"),an=w(()=>l(Wt)==="github"||l(Wt)==="gitlab"),Ve=w(()=>l(Se)?.label??_.workspace_repoSelector_clone_tab()),dn=SD(),Mn=w(()=>f()||l(Pe).length>0||r());function Tn(T){return!l(Mn)&&(T==="github"||T==="gitlab")?"local":T}function Os(){k(Ge,!1),w_({tab:"connections",hash:"integrations"}).catch(T=>ce.error("Failed to open connection settings",T))}function Ks(T){l(Pe).some(q=>q.id===T)&&(k(ct,T,!0),k(Wt,T,!0))}ut(()=>{if(!(!l(Ge)||l(Wt)!=="gitlab"))return Zs(()=>{const T=Ne();if(T)return T.onOpenChange?.(!0,T.scopeKey),()=>Zs(()=>{const q=Ne()??T;q.onOpenChange?.(!1,q.scopeKey)})})}),ut(()=>{l(Ge)&&l(Wt)==="gitlab"&&!Ne()&&k(Ge,!1)}),ut(()=>{l(an)&&k(Wt,Tn(l(on)),!0)});let Ms=he(!1),Ai=he("select-repo"),Ri=he(Cr(_.workspace_repoSelector_selectFolder_title())),Ya=he(void 0);const eo=BS("remote-workspaces");let mi=he(Cr(h())),va=he(!1);ut(()=>{k(mi,h(),!0)});function dc(T=l(mi)){At.dispatch(Fk(b_(T)))}function fc(T){k(dt,T.name,!0),k(Le,""),k(Nt,"local"),k(Ht,!1),k(mt,!0);const q={path:T.workspacePath||T.name,type:"remote",remoteSetup:T,isNewRepo:!1,isValidPath:!0};St(q),k(Ge,!1)}function X(T){const q=l(mi).filter(Te=>Te.id!==T);k(mi,q,!0),dc(q)}function Oe(){k(va,!0)}function He(T){const q=[...l(mi),T];k(mi,q,!0),dc(q),k(va,!1)}let Mt=he(!1),ft=he(""),Kt=he("new-project"),fn=he(""),Ut=he("");function De(){return Cd(p(),Yn())}ut(()=>{const T=Yn(),q=p();Zs(()=>{l(ft)===Cd(q,!T)&&k(ft,Cd(q,T),!0)})});function Dt(T){At.dispatch($k(T))}function Gn(T){if(!T||T.trim().length===0)return;const q=T.trim();if(q.includes("/")||q.includes("\\"))return _.workspace_repoSelector_nameSeparators_error();if(q===".."||q==="."||/^\.+$/.test(q))return _.workspace_repoSelector_nameDots_error();if(q.includes("\0"))return _.workspace_repoSelector_nameNull_error();if(/[<>:"|?*]/.test(q))return _.workspace_repoSelector_nameInvalid_error();if(q.length>255)return _.workspace_repoSelector_nameTooLong_error()}const bn=w(()=>Gn(l(Kt))),Qn=w(()=>l(ft)&&l(Kt)&&!l(bn)?vt(l(ft),l(Kt)):""),fs=w(()=>g()?.admission===a()&&g().path===l(Qn)&&g().status==="ready"?g().result:null);let Ns=he(null);const Lo=w(()=>g()?.admission===a()&&g().path===l(Qn)&&(g().status==="failed"||g().status==="unsupported")),vi=w(()=>Yn()?l(Lo)?"existing":Fx(l(fs),l(Ns)?.parent===l(ft)?l(Ns).inRepo:null):null);ut(()=>{const T=l(ft);if(!Yn()||!T||l(Ns)?.parent===T)return;let q=!1;return Td("file:getDirectoryStatus",{path:T}).then(Te=>!!(Te?.success&&(Te.data?.isGitRepo||Te.data?.isSubdirectoryOfGitRepo))).catch(()=>!1).then(Te=>{q||k(Ns,{parent:T,inRepo:Te},!0)}),()=>{q=!0}});const Oo=w(()=>g()?.admission===a()&&g().path===l(Qn)&&g().status==="pending");let es=he(!1),dr=he(""),zn=0;const Ds=w(()=>()=>{const T=l(Br).filter(Te=>l(Wt)==="local"?Te.type==="local":l(an)&&Te.type==="github"),q=l(Wt)==="gitlab"?Ne()?.query??"":l(je);return q===""?T:T.filter(Te=>Dp(Te,q))});let fr=he("browse"),zr=he(""),ii=he(null),$s=he(void 0);const Ts=w(()=>{if(l(Br).some(Hr))return l(Br);let T;if(en()&&Ne()?.instanceBaseUrl&&Ne().selectedProjectPath){const q=Ne().selectedProjectPath,Te=`${Ne().instanceBaseUrl}/${q}`;T={path:Te,type:"github",githubUrl:Te,name:q.split("/").at(-1),owner:q.split("/").slice(0,-1).join("/"),repositoryIdentity:{provider:"gitlab",instanceBaseUrl:Ne().instanceBaseUrl,projectPath:q}}}else if(!en()&&l(dt)){const q=l(Nt)==="github"?Vr(l(Ut)||l(dt)):null;T=q?{path:`${q.owner}/${q.repo}`,type:"github",githubUrl:`https://github.com/${q.owner}/${q.repo}`,name:q.repo,owner:q.owner}:{path:l(dt),type:"local",name:Dx(l(dt)),...vn()?{plainFolder:!0}:{}}}return T?[T,...l(Br)]:l(Br)}),Qa=_D(),Za=CD(),No=T=>T.type==="local"&&T.plainFolder===!0,el=w(()=>{const T=l(Ts).find(Hr);return T?vn()||No(T)?"folder":"codebase":null}),ba=w(()=>we()?xD({plainFoldersOffered:v(),forgeState:l(Pe).length>0||r()?"connected":m(),hasGitRepositoryEntry:l(Ts).some(q=>!No(q)),hasPlainFolderEntry:l(Ts).some(No),selected:l(el)})==="folder"?_.workspace_compactInitializer_folder_label():we():void 0),sr=w(()=>v()?_.workspace_repoSelector_searchWithFolders_placeholder():_.workspace_repoSelector_search_placeholder()),hr=w(()=>v()?_.workspace_repoSelector_addRepositoryOrFolder_label():_.workspace_repoSelector_addRepository_label()),Fr=w(()=>lt()??(we()?l(hr):_.workspace_repoSelector_selectRepository_label())),hs=w(()=>l(zr).trim()===""?l(Ts):l(Ts).filter(T=>Dp(T,l(zr).trim())));function ps(T){const q=dl(T,Ne()?.instanceBaseUrl);return T.type!=="local"&&q?.provider==="gitlab"&&(!Ne()?.authenticated||q.instanceBaseUrl!==Ne().instanceBaseUrl||!Ne().scopeKey&&!Ne().onSelectRecent||Ne().page.status==="unavailable")}function Hr(T){const q=dl(T,Ne()?.instanceBaseUrl);return T.type!=="local"&&q?.provider==="gitlab"?en()&&Ne()?.instanceBaseUrl===q.instanceBaseUrl&&Ne().selectedProjectPath===q.projectPath:en()||!l(dt)?!1:T.type==="github"?l(Nt)==="github"&&Ar(T.githubUrl||T.path,l(Ut)||l(dt)):l(Nt)!=="github"&&T.path===l(dt)}function kr(){return[...l($s)?.querySelectorAll("[data-recent-repo-row]")??[]].map(T=>T.querySelector("button:not([data-remove-recent-repo])")).filter(T=>!!T&&!T.disabled)}function Tt(T){if(!T.isComposing){if(T.key==="ArrowDown"){const q=kr()[0];if(!q)return;T.preventDefault(),q.focus()}else if(T.key==="Enter"){T.preventDefault(),T.stopPropagation();const q=l(hs).find(Te=>!ps(Te));q&&dp(q)}}}function Jt(T){if(T.key!=="ArrowDown"&&T.key!=="ArrowUp")return;const q=kr(),Te=q.indexOf(document.activeElement);if(!(Te<0))if(T.preventDefault(),T.key==="ArrowUp"&&Te===0)l(ii)?.focus();else{const Ft=T.key==="ArrowDown"?1:-1;q[Math.min(q.length-1,Te+Ft)]?.focus()}}function kn(){const T=l(zr).trim();if(T&&l(Mn)){const q=Vr(lp(T));q?(k(ct,"github"),k(Wt,"github"),gd(`${q.owner}/${q.repo}`)):l(Wt)==="github"&&gd(T)}k(fr,"add"),Qo().then(()=>{l(Wt)==="github"&&l(Ct)?.focus()})}function ir(){k(fr,"browse"),Qo().then(()=>l(ii)?.focus())}function Bs(T){const q=T==="repository"?l(on):T;we()&&q==="local"&&Vr(l(Le))&&nl(""),k(Wt,q,!0)}const ts=w(()=>l(fn).trim()),ln=w(()=>{const T=C();if(!T.length)return[];const q=l(ts).toLowerCase();return q?T.filter(Te=>`${Te.owner}/${Te.name}`.toLowerCase().includes(q)):T}),_n=w(()=>{if($()!==l(ts))return[];const T=M();if(!T.length)return[];const q=new Set(C().map(Te=>Te.id));return T.filter(Te=>!q.has(Te.id))}),hn=w(()=>l(Wt)==="github"&&l(be)?[...l(ln),...l(_n)]:[]),gs=w(()=>{const T=l(xr);if(!T)return!1;const q=T.owner.toLowerCase(),Te=T.repo.toLowerCase();return l(hn).some(Ft=>Ft.owner.toLowerCase()===q&&Ft.name.toLowerCase()===Te)});let Qt=he(-1);ut(()=>{l(hn),k(Qt,-1)}),ut(()=>{l(Wt)==="github"&&l(be)&&!S()&&!D()&&!I()&&At.dispatch(Hp())});function In(){At.dispatch(Hp())}function or(T){k(fn,`${T.owner}/${T.name}`),k(xr,{owner:T.owner,repo:T.name,url:`https://github.com/${T.owner}/${T.name}`},!0),md()}function Ur(T){if(!T.isComposing){if(T.key==="Enter"){T.preventDefault(),T.stopPropagation(),Gs();return}if(T.key==="ArrowDown"){if(!l(hn).length)return;T.preventDefault(),k(Qt,Math.min(l(Qt)+1,l(hn).length-1),!0);return}if(T.key==="ArrowUp"){if(!l(hn).length)return;T.preventDefault(),k(Qt,Math.max(l(Qt)-1,-1),!0)}}}function Gs(){const T=l(Qt)>=0?l(hn)[l(Qt)]:void 0;T?or(T):md()}let ms=he(-1);ut(()=>{l(Ds)(),k(ms,-1)});function zs(T){return T&&Vr(T)?"github":"local"}function Ar(T,q){const Te=Vr(T),Ft=Vr(q);return!!Te&&!!Ft&&Te.owner.toLowerCase()===Ft.owner.toLowerCase()&&Te.repo.toLowerCase()===Ft.repo.toLowerCase()}ut(()=>{st()&&st()!==l(dt)&&(k(dt,st()),k(Le,st()),k(Nt,zs(st()),!0),l(Ut)&&!Ar(l(Ut),st())&&k(Ut,""))});function pd(){if(k(P,!uh(l(ue),360)),k(je,""),we()&&l(fr)==="browse")k(zr,""),requestAnimationFrame(()=>{l(Ge)&&l(fr)==="browse"&&l(ii)?.focus()});else if(we()){Qe&&(k(Wt,Qe,!0),Qe=null);return}const T=l(dt)||st();if(ce.info("Dropdown opened",{currentValue:T,selectedRepoType:l(Nt)}),Qe)k(Wt,Qe,!0),Qe=null;else if(en()&&l(Pe).some(q=>q.id==="gitlab"))k(ct,"gitlab"),k(Wt,"gitlab");else if(T){if(k(Wt,Tn(l(Nt)==="github"?l(on):l(Nt)),!0),l(Nt)==="github"&&l(Mn)&&l(Le)){const q=Vr(l(Le));q&&(k(fn,`${q.owner}/${q.repo}`),nl(`https://github.com/${q.owner}/${q.repo}`,""))}}else k(Wt,Tn(l(on)),!0);requestAnimationFrame(()=>{we()||l(Ge)&&l(Wt)!=="gitlab"&&l(qe)&&(l(qe).focus(),l(qe).select())})}let tl=!1;ut(()=>{const T=l(Ge);T&&!tl?pd():!T&&tl&&we()&&!l(pt)&&!l(Ms)&&k(fr,"browse"),tl=T}),ut(()=>{if(l(Ge))return fa(T=>{T.isComposing||k(Ge,!1)})}),ut(()=>{l(Wt)==="new"&&!l(ft)&&k(ft,De(),!0)}),ut(()=>{const T=l(Qn),q=a();!T||!l(ft)||!l(Kt)||!q||(fe=crypto.randomUUID(),At.dispatch(Pk(O,fe,q,T)))}),ut(()=>{s()&&At.dispatch(af())}),ut(()=>{const T=a(),q=Ne()?.instanceBaseUrl;E(),!(!T||At.dispatch!==le)&&(de=crypto.randomUUID(),At.dispatch(Ik(G,de,T,q)))}),sc(()=>{tt()&&le(Lk()),de&&le(Ok(G,de)),fe&&le(Nk(O,fe))});function Vr(T){const q=T.trim();if(!q)return null;if(q.startsWith("git@github.com:")){const Ft=q.slice(15).replace(/\.git$/,"").split("/");return Ft.length>=2&&Ft[0]&&Ft[1]?{owner:Ft[0],repo:Ft[1]}:null}try{const Te=new URL(q);if(Te.hostname!=="github.com"&&Te.hostname!=="www.github.com"||Te.protocol!=="http:"&&Te.protocol!=="https:")return null;const Ft=Te.pathname.split("/").filter(Boolean);if(Ft.length<2)return null;const Sn=Ft[0],oi=Ft[1].replace(/\.git$/,"");if(Sn&&oi)return{owner:Sn,repo:oi}}catch{}if(!q.includes("\\")&&!q.includes(":")&&!q.startsWith(".")&&!q.startsWith("/")){const Te=q.split("/");if(Te.length===2&&Te[0]&&Te[1]){const Ft=Sn=>/^[a-zA-Z0-9]([a-zA-Z0-9\-_\.]*[a-zA-Z0-9])?$/.test(Sn)||/^[a-zA-Z0-9]$/.test(Sn);if(Ft(Te[0])&&Ft(Te[1]))return{owner:Te[0],repo:Te[1]}}}return null}function lp(T){const q=T.trim();if(!q)return"";const Te=Vr(q);if(Te)return`${Te.owner}/${Te.repo}`;if(q.toLowerCase().startsWith("github.com/")){const Ft=q.slice(11),Sn=Ft.split("/").filter(Boolean);return Sn.length>=2?`${Sn[0]}/${Sn[1].replace(/\.git$/,"")}`:Ft.replace(/\/$/,"")}if(q.toLowerCase().startsWith("www.github.com/")){const Ft=q.slice(15),Sn=Ft.split("/").filter(Boolean);return Sn.length>=2?`${Sn[0]}/${Sn[1].replace(/\.git$/,"")}`:Ft.replace(/\/$/,"")}return q.replace(/\/$/,"").replace(/\.git$/,"")}function gd(T){let q=T;q.toLowerCase().startsWith("https://github.com/")?q=q.slice(19):q.toLowerCase().startsWith("http://github.com/")?q=q.slice(18):q.toLowerCase().startsWith("github.com/")&&(q=q.slice(11)),k(fn,q,!0),q?nl(`https://github.com/${q}`,q):nl(""),cp(q)}function cp(T){l(be)&&At.dispatch(Dk(T.trim()))}function yw(T){const q=T.clipboardData?.getData("text")||"";if(q){T.preventDefault();const Te=lp(q);k(fn,Te,!0),Te&&nl(`https://github.com/${Te}`,Te),cp(Te)}}async function up(T){try{const q=await Td("file:getDirectoryStatus",{path:T});q.success&&q.data&&(k(wr,q.data,!0),k(Ht,!q.data.exists&&!q.data.isSubdirectoryOfGitRepo,!0),q.data.exists&&!q.data.isDirectory&&k(mt,!1))}catch(q){ce.warn("Failed to check directory status",q)}}function nl(T,q=T){k(Le,T,!0),k(je,q,!0),ri&&clearTimeout(ri),k(xr,null),k(un,null),k(Rn,""),ri=setTimeout(()=>{xw(T)},300)}function ww(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 xw(T){if(!T||T.trim()===""){k(xr,null),k(un,null);return}if(T.startsWith("/")||T.startsWith("~")||T.includes(":\\")||T.startsWith("./")||T.startsWith("../")){k(xr,null),k(un,T,!0),await up(T);return}if(ww(T)){const q=Vr(T);if(q){const Te=`https://github.com/${q.owner}/${q.repo}`;k(un,null),k(xr,{owner:q.owner,repo:q.repo,url:Te},!0);return}}k(xr,null),k(un,null)}function dp(T){if(zn++,we()&&Hr(T)){k(Ge,!1);return}const q=dl(T,Ne()?.instanceBaseUrl);if(T.type!=="local"&&q?.provider==="gitlab"){if(!Ne()?.authenticated||q.instanceBaseUrl!==Ne().instanceBaseUrl||!Ne().scopeKey&&!Ne().onSelectRecent||Ne().page.status==="unavailable")return;Ne().onSelectRecent?Ne().onSelectRecent(q.projectPath,q.instanceBaseUrl):Ne().onSelect(q.projectPath,Ne().scopeKey),k(Ge,!1);return}if(T.type==="local"&&(Yn()||T.plainFolder===!0)){_w(T);return}fp(T)}async function kw(T){try{const q=await Td("file:getDirectoryStatus",{path:T});return q?.success&&q.data?q.data:null}catch(q){return ce.warn("Failed to check directory status",q),null}}async function _w(T){const q=zn,Te=await kw(T.path);if(q!==zn)return;const Ft=!!Te&&(Te.isGitRepo||!!Te.isSubdirectoryOfGitRepo);if(Te?Te.exists&&Te.isDirectory&&!Ft:T.plainFolder===!0||Yn()){if(Yn()){rl(T.path,"existing");return}k(dr,T.path,!0),k(es,!0);return}if(Yn()&&Te&&!Te.exists&&!Ft){rl(T.path,"new");return}fp(T,Te?.isSubdirectoryOfGitRepo?Te.relativePathFromGitRoot:"")}function fp(T,q=""){const Te=T.type==="github"&&T.githubUrl?Vr(T.githubUrl):null,Ft=Te?`${Te.owner}/${Te.repo}`:T.path;k(dt,Ft,!0),k(Le,T.type==="github"?T.githubUrl:T.path,!0),k(Nt,T.type,!0),k(Ut,T.type==="github"&&T.githubUrl||"",!0),k(Ht,!1),k(mt,!0),k(Rn,""),k(wr,null);const Sn={path:Ft,type:T.type,isNewRepo:!1,isValidPath:!0};q&&(Sn.scope=q),T.type==="github"&&T.githubUrl&&(Sn.githubUrl=T.githubUrl),St(Sn),k(Ge,!1)}function hp(T,q,Te){k(Ai,T,!0),k(Ri,q,!0),k(Ya,Te,!0),t_({title:q,defaultPath:Te,openModal:()=>k(Ms,!0),onSelect:pp})}function Sw(){hp("select-repo",_.workspace_repoSelector_selectRepoFolder_title(),typeof l(dt)=="string"?l(dt):void 0)}async function Cw(T){zn++;try{if(await up(T),l(wr)?.exists&&!l(wr)?.isGitRepo&&!l(wr)?.isSubdirectoryOfGitRepo){if(Yn()){rl(T,"existing");return}k(dr,T,!0),k(es,!0);return}k(dt,T,!0),k(Le,T,!0),k(Ut,""),k(Nt,"local"),k(mt,!0),k(Rn,"");const q={path:T,type:"local",isNewRepo:l(Ht),isValidPath:!0,scope:l(wr)?.relativePathFromGitRoot};St(q),k(Ge,!1)}catch(q){ce.error("Failed to select folder",q)}}function Mw(){k(pt,!0),hp("new-repo-parent",_.workspace_repoSelector_selectNewRepoParent_title(),l(ft)||void 0)}function ya(){if(!l(ft)||!l(Kt)||l(bn))return;const T=vt(l(ft),l(Kt));k(dt,T,!0),k(Le,T,!0),k(Ut,""),k(mt,!0),k(Rn,""),k(wr,null),k(Nt,"new");const q=l(fs)?.exists&&l(fs)?.isGitRepo,Te=l(vi);if(Te){rl(T,Te),k(Mt,!1);return}k(Ht,!q),St({path:T,type:"local",isNewRepo:!q,isValidPath:!0}),Dt(l(ft)),k(Mt,!1),k(Ge,!1)}async function pp(T){k(Ms,!1);const q=l(Ai);if(q==="select-repo"){await Cw(T);return}q==="new-repo-parent"&&(k(ft,T,!0),Dt(l(ft))),k(pt,!1),k(Ge,!0)}function Tw(){k(Ms,!1),l(Ai)!=="select-repo"&&(k(pt,!1),k(Ge,!0))}function md(){const T=Vr(l(fn));if(!T)return;const q={owner:T.owner,repo:T.repo,url:`https://github.com/${T.owner}/${T.repo}`},Te=`${q.owner}/${q.repo}`,Ft={path:Te,type:"github",githubUrl:q.url,isNewRepo:!1,isValidPath:!0};k(dt,Te),k(Le,q.url,!0),k(Ut,q.url,!0),k(Nt,"github"),k(mt,!0),k(Rn,""),St(Ft),k(Ge,!1)}function Ew(){if(!l(dr))return;k(dt,l(dr),!0),k(Le,l(dr),!0),k(Ut,""),k(Nt,"local"),k(Ht,!0),k(mt,!0),k(Rn,"");const T={path:l(dr),type:"local",isNewRepo:!0,isValidPath:!0};St(T),k(es,!1),k(dr,""),k(Ge,!1)}function rl(T,q){k(dt,T,!0),k(Le,T,!0),k(Ut,""),k(Nt,q==="new"?"new":"local",!0),k(Ht,!1),k(mt,!0),k(Rn,""),k(wr,null),St({path:T,type:"local",isNewRepo:!1,isValidPath:!0,plainFolder:q}),k(es,!1),k(dr,""),k(Ge,!1)}function Aw(T,q){const Te=q==="local"&&l(es)?l(dr):"";me()?.onCheckedChange(T,q),Te&&!T&&rl(Te,"existing")}function Rw(){k(es,!1),k(dr,""),k(un,null),k(wr,null),k(Le,""),k(je,"")}function Pw(){if(!l(dt))return _.workspace_repoSelector_selectRepository_label();if(l(Nt)==="github"&&l(Ut)){const q=Vr(l(Ut));if(q)return`${q.owner}/${q.repo}`}if(l(dt).match(/^[^\/]+\/[^\/]+$/)&&!l(dt).includes("\\")&&!l(dt).startsWith("/"))return l(dt);const T=l(dt).split(/[\/\\]/);return T[T.length-1]||l(dt)}const vd=w(()=>en()?Ue()??Ne()?.selectedProjectPath??"":Ue()??Pw()),hc=w(()=>en()?!!l(vd):!!l(dt)),bd=`${t}-github-suggestions`,gp=w(()=>en()&&Ne()?.authenticated&&Ne().scopeKey&&Ne().page.status!=="unavailable"&&Ne().selectedProject?.projectPath===Ne().selectedProjectPath?Ne().selectedProject:void 0),mp=w(()=>en()?null:$x({selectedValue:l(dt),selectedRepoType:l(Nt),confirmedGithubUrl:l(Ut)},Vr)),yd=w(()=>l(Ts).find(Hr)),wd=w(()=>l(yd)?dl(l(yd),Ne()?.instanceBaseUrl):null);function vp(T){if(!(T?.provider!=="gitlab"||!Ne()?.authenticated||!Ne().scopeKey||T.instanceBaseUrl!==Ne().instanceBaseUrl||Ne().page.status!=="ready"))return(Ne().page.items.find(q=>q.projectPath===T.projectPath)??(Ne().selectedProject?.projectPath===T.projectPath?Ne().selectedProject:void 0))?.ownerAvatarUrl}var Iw={focusInput:sn,openOnLocalTab:jt,openOnSessionsTab:yt,get variant(){return Vt()},set variant(T="ghost"){Vt(T),b()},get value(){return st()},set value(T=""){st(T),b()},get onchange(){return Ae()},set onchange(T){Ae(T),b()},get triggerClass(){return Ce()},set triggerClass(T){Ce(T),b()},get rowLabel(){return we()},set rowLabel(T){we(T),b()},get displayValue(){return Ue()},set displayValue(T){Ue(T),b()},get triggerSuffix(){return _t()},set triggerSuffix(T){_t(T),b()},get triggerValueClass(){return se()},set triggerValueClass(T="text-subtle"){se(T),b()},get triggerContentClass(){return Ze()},set triggerContentClass(T="gap-0.75"){Ze(T),b()},get emptyLabel(){return lt()},set emptyLabel(T){lt(T),b()},get showEmptyIcon(){return et()},set showEmptyIcon(T=!1){et(T),b()},get showTriggerChevron(){return bt()},set showTriggerChevron(T=!1){bt(T),b()},get triggerChevronClass(){return Bt()},set triggerChevronClass(T="ml-2 opacity-50"){Bt(T),b()},get triggerIcon(){return Fe()},set triggerIcon(T){Fe(T),b()},get triggerAriaLabel(){return Ke()},set triggerAriaLabel(T){Ke(T),b()},get onClear(){return Yt()},set onClear(T){Yt(T),b()},get gitlab(){return Ne()},set gitlab(T){Ne(T),b()},get gitlabSelected(){return en()},set gitlabSelected(T=!1){en(T),b()},get plainFolderMode(){return Yn()},set plainFolderMode(T=!1){Yn(T),b()},get plainFolderSelected(){return vn()},set plainFolderSelected(T=!1){vn(T),b()},get gitChoice(){return me()},set gitChoice(T){me(T),b()},get sessions(){return tt()},set sessions(T){tt(T),b()},$set:Lt,$on:(T,q)=>Ot(e,T,q)},bp=M$(),xd=ae(bp);{const T=(Te,Ft=Or,Sn=Or)=>{var oi=Ye(),to=ae(oi);as(to,19,Ft,Fs=>Bk(Fs),(Fs,pr,bi)=>{var qs=JD();{const ar=yn=>{{let mr=w(()=>l(gr)&&l(pr).type!=="local"?l(gr).projectPath.split("/").at(-1):l(vs).primary),Rr=w(()=>l(gr)?.provider),bs=w(()=>l(pr).type==="local"),qn=w(()=>l(pr).type!=="local"),wi=w(()=>Sn()(l(pr),l(bi))),Wr=w(()=>!!we()),jr=w(()=>l(pr).type!=="local"&&l(gr)?.provider==="gitlab"&&(!Ne()?.authenticated||l(gr).instanceBaseUrl!==Ne().instanceBaseUrl||!Ne().scopeKey&&!Ne().onSelectRecent||Ne().page.status==="unavailable"));ip(yn,{get owner(){return l(Ii)},get name(){return l(mr)},get suffix(){return l(vs).suffix},get provider(){return l(Rr)},get avatarUrl(){return l(li)},get local(){return l(bs)},get showOwner(){return l(qn)},showForge:!0,recent:!0,get selected(){return l(wi)},get formStyle(){return l(Wr)},class:"flex-1",onclick:()=>dp(l(pr)),get disabled(){return l(jr)}})}},vs=w(()=>Hx(l(pr))),gr=w(()=>dl(l(pr),Ne()?.instanceBaseUrl)),Ii=w(()=>l(gr)?l(gr).projectPath.split("/").slice(0,-1).join("/"):l(vs).ownerPrefix),Li=w(()=>zx(l(pr))),li=w(()=>vp(l(gr)));var yi=ne(qs);{var Do=yn=>{Hu(yn,{get content(){return l(Li)},delayDuration:300,side:"bottom",class:"flex min-w-0 flex-1",children:(mr,Rr)=>{ar(mr)},$$slots:{default:!0}})},wa=yn=>{ar(yn)};K(yi,yn=>{l(Li)?yn(Do):yn(wa,-1)})}var Pi=A(yi,2);{var no=yn=>{const mr=w(()=>`${l(gr).instanceBaseUrl.replace(/\/$/,"")}/${l(gr).projectPath}`);{let Rr=w(()=>_.browser_embedded_openExternal_tooltip()),bs=w(()=>_.browser_embedded_openExternal_ariaLabel());Je(yn,{variant:"ghost",size:"icon-compact",iconOnly:!0,get href(){return l(mr)},target:"_blank",rel:"noopener noreferrer",get tooltip(){return l(Rr)},get"aria-label"(){return l(bs)},class:"mr-1 shrink-0 text-subtle",onclick:qn=>{qn.preventDefault(),qn.stopPropagation(),lh(l(mr),{event:qn,forceExternal:!0})},children:(qn,wi)=>{rt(qn,{get icon(){return uv},size:12})},$$slots:{default:!0}})}};K(Pi,yn=>{we()&&l(gr)&&yn(no)})}var $o=A(Pi,2);{var ai=yn=>{{let mr=w(()=>_.workspace_repoSelector_removeRecent_ariaLabel({repository:l(pr).path})),Rr=w(()=>_.workspace_repoSelector_removeRecent_tooltip());Je(yn,{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(mr)},get title(){return l(Rr)},onclick:bs=>ds(bs,l(pr)),children:(bs,qn)=>{rt(bs,{get icon(){return Ji},size:12})},$$slots:{default:!0}})}};K($o,yn=>{we()||yn(ai)})}Q(qs)}N(ar=>at(qs,1,`group/recent-repo flex min-w-0 items-center ${we()?"rounded-(--radius-row)":""} ${ar??""}`),[()=>we()&&Sn()(l(pr),l(bi))?"bg-selected":""]),x(Fs,qs)}),x(Te,oi)},q=Te=>{var Ft=Ye(),Sn=ae(Ft);{var oi=Fs=>{var pr=Ye(),bi=ae(pr);xt(bi,()=>oh,(qs,yi)=>{yi(qs,{children:(Do,wa)=>{var Pi=Oc(),no=ae(Pi);{const ai=(ar,vs)=>{Je(ar,ks(()=>(vs?.()).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:(Ii,Li)=>{$t();var li=XD(),yn=ae(li),mr=A(yn);rt(mr,{get icon(){return sa},size:10,class:"absolute right-0 opacity-0 group-hover/forge:opacity-100 group-focus/forge:opacity-100"}),N(()=>H(yn,`${l(Ve)??""} `)),x(Ii,li)},$$slots:{default:!0}}))};xt(no,()=>sh,(ar,vs)=>{vs(ar,{child:ai,$$slots:{child:!0}})})}var $o=A(no,2);{let ai=w(()=>({to:pe()})),ar=w(()=>_.workspace_repoSelector_whichRepo_label());xt($o,()=>ih,(vs,gr)=>{gr(vs,{get portalProps(){return l(ai)},get"aria-label"(){return l(ar)},children:(Ii,Li)=>{var li=Ye(),yn=ae(li);{let mr=w(()=>l(Se)?.id);xt(yn,()=>uk,(Rr,bs)=>{bs(Rr,{get value(){return l(mr)},onValueChange:qn=>Ks(qn),children:(qn,wi)=>{var Wr=Ye(),jr=ae(Wr);as(jr,17,()=>l(Pe),ys=>ys.id,(ys,Gt)=>{var Ln=Ye(),Pr=ae(Ln);{const ns=tn=>{rt(tn,{get icon(){return l(Gt).icon},size:12})};xt(Pr,()=>dk,(tn,On)=>{On(tn,{get value(){return l(Gt).id},closeOnSelect:!0,leading:ns,children:(Kr,Fn)=>{$t();var Cn=zt();N(()=>H(Cn,l(Gt).label)),x(Kr,Cn)},$$slots:{leading:!0,default:!0}})})}x(ys,Ln)}),x(qn,Wr)},$$slots:{default:!0}})})}x(Ii,li)},$$slots:{default:!0}})})}x(Do,Pi)},$$slots:{default:!0}})}),x(Fs,pr)},to=Fs=>{var pr=YD(),bi=re(pr,!0);N(()=>H(bi,l(Se)?.label??"github.com/")),x(Fs,pr)};K(Sn,Fs=>{l(Pe).length>1?Fs(oi):Fs(to,-1)})}x(Te,Ft)};var Lw=ne(xd);xt(Lw,()=>Vu,(Te,Ft)=>{Ft(Te,{get open(){return l(Ge)},set open(Sn){k(Ge,Sn,!0)},children:(Sn,oi)=>{var to=Oc(),Fs=ae(to);{const bi=(qs,yi)=>{let Do=()=>(yi?.()).props;{let wa=w(()=>!we()),Pi=w(()=>`w-full ${Ce()??""}`),no=w(()=>Ke()??(we()?void 0:`${_.workspace_repoSelector_selectRepository_label()}: ${l(vd)}`)),$o=w(()=>we()&&!Ke()?`${t}-field-label ${t}-field-value`:void 0);Je(qs,ks(Do,{get variant(){return Vt()},get wrapContent(){return l(wa)},get class(){return l(Pi)},get"aria-label"(){return l(no)},get"aria-labelledby"(){return l($o)},get ref(){return l(ue)},set ref(ai){k(ue,ai,!0)},children:(ai,ar)=>{var vs=e$(),gr=ne(vs);{var Ii=Gt=>{var Ln=Gm(),Pr=re(Ln,!0);N(()=>{at(Ln,1,Bn(cn.fieldLabel)),ot(Ln,"id",`${t}-field-label`),H(Pr,l(ba))}),x(Gt,Ln)};K(gr,Gt=>{we()&&Gt(Ii)})}var Li=A(gr,2);{var li=Gt=>{var Ln=QD(),Pr=ae(Ln);{var ns=Nn=>{{let xi=w(()=>we()?20:16);lf(Nn,{get providerId(){return l(Cs).provider},get size(){return l(xi)},class:"shrink-0"})}},tn=w(()=>cf(l(Cs).provider)),On=Nn=>{Zo(Nn,{size:16,class:"shrink-0 text-muted-foreground"})};K(Pr,Nn=>{l(tn)?Nn(ns):Nn(On,-1)})}var Kr=A(Pr,2),Fn=ne(Kr),Cn=re(Fn,!0);Q(Kr),N(Nn=>{ot(Kr,"id",we()?`${t}-field-value`:void 0),at(Fn,1,Bn(se())),H(Cn,Nn)},[()=>l(Cs).title.trim()||_.sessionImport_list_untitled_label()]),x(Gt,Ln)},yn=Gt=>{rt(Gt,{get icon(){return Fe()},size:"xs"})},mr=Gt=>{Zo(Gt,{size:12,class:"text-ghost -mb-0.25 mr-1"})};K(Li,Gt=>{l(Cs)&&!Fe()?Gt(li):Fe()?Gt(yn,1):et()&&!l(hc)&&Gt(mr,2)})}var Rr=A(Li,2);{var bs=Gt=>{{let Ln=w(()=>l(wd)?.projectPath.split("/").slice(0,-1).join("/")||l(mp)||l(gp)?.namespace),Pr=w(()=>l(wd)?.provider??(en()?"gitlab":l(mp)?"github":void 0)),ns=w(()=>vp(l(wd))??l(gp)?.ownerAvatarUrl),tn=w(()=>l(yd)?.type==="local"||!en()&&l(Nt)!=="github"),On=w(()=>we()?20:16);ph(Gt,{get owner(){return l(Ln)},get provider(){return l(Pr)},get avatarUrl(){return l(ns)},get local(){return l(tn)},get size(){return l(On)}})}},qn=Gt=>{Zo(Gt,{size:16,class:"shrink-0 text-muted-foreground"})};K(Rr,Gt=>{!l(Cs)&&!Fe()&&l(hc)?Gt(bs):!l(Cs)&&!Fe()&&we()&&!et()&&Gt(qn,1)})}var wi=A(Rr,2);{var Wr=Gt=>{var Ln=ZD(),Pr=ne(Ln);{var ns=Fn=>{var Cn=Jm(),Nn=ae(Cn),xi=re(Nn,!0),ki=A(Nn,2);{var sl=Oi=>{var ro=qm(),il=re(ro,!0);N(so=>H(il,so),[()=>_.workspace_repoSelector_new_label()]),x(Oi,ro)};K(ki,Oi=>{l(Ht)&&!Ue()&&!en()&&Oi(sl)})}N(()=>{at(Nn,1,Bn(se())),H(xi,l(vd))}),x(Fn,Cn)},tn=Fn=>{var Cn=Gm(),Nn=re(Cn,!0);N(()=>{at(Cn,1,Bn(se())),H(Nn,l(Fr))}),x(Fn,Cn)};K(Pr,Fn=>{l(hc)?Fn(ns):Fn(tn,-1)})}var On=A(Pr,2);{var Kr=Fn=>{var Cn=qm(),Nn=re(Cn);N(()=>H(Nn,`(${_t()??""})`)),x(Fn,Cn)};K(On,Fn=>{_t()&&Fn(Kr)})}Q(Ln),N(()=>ot(Ln,"id",we()?`${t}-field-value`:void 0)),x(Gt,Ln)};K(wi,Gt=>{!l(Cs)&&!Fe()&&(l(hc)||l(Fr))&&Gt(Wr)})}var jr=A(wi,2);{var ys=Gt=>{rt(Gt,{get icon(){return sa},size:10,get class(){return Bt()}})};K(jr,Gt=>{bt()&&Gt(ys)})}Q(vs),N(()=>at(vs,1,`flex w-full min-w-0 items-center truncate ${Ze()}`)),x(ai,vs)},$$slots:{default:!0}}))}};xt(Fs,()=>Ku,(qs,yi)=>{yi(qs,{child:bi,$$slots:{child:!0}})})}var pr=A(Fs,2);{let bi=w(()=>l(ba)??_.workspace_repoSelector_whichRepo_label()),qs=w(()=>we()?`${l(fr)==="add"?"w-110":"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(fr)==="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"),yi=w(()=>we()?j.current||l(P)?"bottom":"left":void 0),Do=w(()=>we()?j.current||l(P)?4:24:void 0),wa=w(()=>we()?j.current||l(P)?"end":"start":void 0),Pi=w(()=>({to:pe()})),no=w(()=>pe()?"absolute":"fixed");xt(pr,()=>Uu,($o,ai)=>{ai($o,{role:"dialog",get"aria-label"(){return l(bi)},get class(){return l(qs)},get side(){return l(yi)},get sideOffset(){return l(Do)},get align(){return l(wa)},onkeydown:ar=>{we()&&l(fr)==="browse"&&ar.target instanceof Node&&l($s)?.contains(ar.target)&&Jt(ar),ar.key==="Enter"&&ar.stopPropagation()},get portalProps(){return l(Pi)},get strategy(){return l(no)},portal:!0,get ref(){return l(nt)},set ref(ar){k(nt,ar,!0)},children:(ar,vs)=>{var gr=Ye(),Ii=ae(gr);{var Li=yn=>{var mr=s$(),Rr=ae(mr),bs=ne(Rr);{let tn=w(()=>`${t}-form-repos`);is(bs,{variant:"search",type:"text",role:"searchbox","data-repo-search":!0,"data-testid":"repo-form-search",get value(){return l(zr)},oninput:On=>k(zr,On.currentTarget.value,!0),onkeydown:Tt,get placeholder(){return l(sr)},get"aria-label"(){return l(sr)},get"aria-controls"(){return l(tn)},get ref(){return l(ii)},set ref(On){k(ii,On,!0)}})}Q(Rr);var qn=A(Rr,2),wi=ne(qn);{var Wr=tn=>{var On=n$();as(On,20,()=>[1,2,3],$c,(Kr,Fn)=>{var Cn=t$();x(Kr,Cn)}),Q(On),x(tn,On)},jr=tn=>{var On=r$(),Kr=re(On,!0);N(Fn=>H(Kr,Fn),[()=>_.hud_filter_noRepositories_label()]),x(tn,On)},ys=tn=>{T(tn,()=>l(hs),()=>On=>Hr(On))};K(wi,tn=>{l(qt)&&l(Ts).length===0?tn(Wr):l(hs).length===0?tn(jr,1):tn(ys,-1)})}Q(qn),jn(qn,tn=>k($s,tn),()=>l($s));var Gt=A(qn,2),Ln=ne(Gt);Je(Ln,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-add",get class(){return`${cn.row} w-full`},onclick:kn,children:(tn,On)=>{var Kr=Xm(),Fn=ae(Kr);rt(Fn,{get icon(){return qc},class:"size-4 shrink-0"});var Cn=A(Fn,2),Nn=re(Cn,!0);N(()=>H(Nn,l(hr))),x(tn,Kr)},$$slots:{default:!0}});var Pr=A(Ln,2);{var ns=tn=>{Je(tn,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-import-session",get class(){return`${cn.row} w-full`},onclick:xe,children:(On,Kr)=>{var Fn=Xm(),Cn=ae(Fn);rt(Cn,{get icon(){return mv},class:"size-4 shrink-0"});var Nn=A(Cn,2),xi=re(Nn,!0);N(ki=>H(xi,ki),[()=>_.sessionImport_picker_none_label()]),x(On,Fn)},$$slots:{default:!0}})};K(Pr,tn=>{l(si)&&tn(ns)})}Q(Gt),N(tn=>{ot(qn,"id",`${t}-form-repos`),ot(qn,"aria-label",tn)},[()=>_.workspace_repoSelector_recent_label()]),x(yn,mr)},li=yn=>{var mr=Oc(),Rr=ae(mr);{var bs=Wr=>{var jr=i$(),ys=ne(jr);{let Pr=w(()=>_.ui_navButtons_goBack_tooltip());Je(ys,{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(Pr)},onclick:ir,children:(ns,tn)=>{rt(ns,{get icon(){return dx},class:"size-3.5!"})},$$slots:{default:!0}})}var Gt=A(ys,2),Ln=re(Gt,!0);Q(jr),N(()=>{at(Gt,1,`${cn.title} min-w-0 truncate`),H(Ln,l(hr))}),x(Wr,jr)},qn=Wr=>{var jr=o$(),ys=ne(jr),Gt=re(ys,!0),Ln=A(ys,2),Pr=re(Ln,!0);Q(jr),N((ns,tn)=>{H(Gt,ns),H(Pr,tn)},[()=>_.workspace_repoSelector_whichRepo_label(),()=>_.workspace_repoSelector_whichRepo_description()]),x(Wr,jr)};K(Rr,Wr=>{we()?Wr(bs):Wr(qn,-1)})}var wi=A(Rr,2);{let Wr=w(()=>l(an)?"repository":l(Wt)),jr=w(()=>we()?"shrink-0":"min-h-0");xt(wi,()=>Qk,(ys,Gt)=>{Gt(ys,{get value(){return l(Wr)},onValueChange:Bs,get class(){return`flex flex-col ${l(jr)??""}`},children:(Ln,Pr)=>{var ns=C$(),tn=ae(ns);{let Cn=w(()=>_.workspace_repoSelector_whichRepo_label());xt(tn,()=>Zk,(Nn,xi)=>{xi(Nn,{get"aria-label"(){return l(Cn)},class:"flex shrink-0 gap-0 mx-3 mb-3 bg-sidebar rounded-lg p-1",children:(ki,sl)=>{var Oi=Oc(),ro=ae(Oi);{var il=io=>{var Ni=Ye(),xa=ae(Ni);{let ol=w(()=>l(an)?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");xt(xa,()=>Vp,(al,ll)=>{ll(al,{value:"repository",get class(){return`flex-auto 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(ol)??""}`},children:(cl,pc)=>{$t();var ul=zt();N(Bo=>H(ul,Bo),[()=>_.workspace_repoSelector_clone_tab()]),x(cl,ul)},$$slots:{default:!0}})})}x(io,Ni)};K(ro,io=>{l(Mn)&&io(il)})}var so=A(ro,2);as(so,1,()=>[{id:"local",label:_.workspace_repoSelector_existingFolder_tab()},{id:"new",label:_.workspace_repoSelector_new_tab()},...l(si)?[{id:"sessions",label:_.sessionImport_tab_label()}]:[],...L()?[{id:"remote",label:_.workspace_repoSelector_remoteServer_tab()}]:[]],$c,(io,Ni)=>{var xa=Ye(),ol=ae(xa);{let al=w(()=>l(Wt)===l(Ni).id?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");xt(ol,()=>Vp,(ll,cl)=>{cl(ll,{get value(){return l(Ni).id},get class(){return`flex-auto 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(al)??""}`},children:(pc,ul)=>{$t();var Bo=zt();N(()=>H(Bo,l(Ni).label)),x(pc,Bo)},$$slots:{default:!0}})})}x(io,xa)}),x(ki,Oi)},$$slots:{default:!0}})})}var On=A(tn,2);{var Kr=Cn=>{Je(Cn,{type:"button",variant:"link",size:"sm",class:"mx-3 -mt-1 mb-2 h-auto self-start p-0 text-xs",onclick:Os,children:(Nn,xi)=>{$t();var ki=zt();N(sl=>H(ki,sl),[()=>_.workspace_repoSelector_connectForgeToClone_label()]),x(Nn,ki)},$$slots:{default:!0}})};K(On,Cn=>{!l(Mn)&&s()&&Cn(Kr)})}var Fn=A(On,2);{let Cn=w(()=>l(an)?"repository":l(Wt));xt(Fn,()=>$v,(Nn,xi)=>{xi(Nn,{get value(){return l(Cn)},class:"mt-0 min-h-0 flex flex-col",children:(ki,sl)=>{var Oi=S$(),ro=ae(Oi);{var il=gn=>{{let Dn=w(()=>l(Cs)?Mv(l(Cs)):"");vw(gn,{class:"h-80 max-h-[min(320px,calc(100dvh-14rem))]",get knownRepos(){return l(R)},get selectedKey(){return l(Dn)},onselect:Re,get interactionRoot(){return l(nt)},onclose:()=>k(Ge,!1)})}};K(ro,gn=>{l(Wt)==="sessions"&&l(si)&&gn(il)})}var so=A(ro,2);let io;var Ni=ne(so);{var xa=gn=>{const Dn=w(()=>l(Wt)),vr=w(()=>l(Dn)==="new"?"new":l(es)&&l(dr)?"folder":me().folder??null);{let lr=w(()=>l(vr)==="git-repo"?me().worktree!==!1:me().checked);gw(gn,{class:"mb-3 px-1",get folder(){return l(vr)},get checked(){return l(lr)},get disabled(){return me().disabled},onCheckedChange:cr=>Aw(cr,l(Dn))})}};K(Ni,gn=>{me()&&(l(Wt)==="local"||l(Wt)==="new")&&gn(xa)})}var ol=A(Ni,2);{var al=gn=>{{let Dn=w(()=>!we()),vr=w(()=>!!we());hw(gn,ks(Ne,{get scrollable(){return l(Dn)},get formStyle(){return l(vr)},get prefix(){return q},onSelect:(lr,cr)=>{zn++,Ne()?.onSelect(lr,cr),k(Ge,!1)}}))}},ll=gn=>{Je(gn,{type:"button",class:"w-full flex items-center justify-between px-3 py-2.5 rounded-lg border-0 text-left cursor-pointer",onclick:Sw,children:(Dn,vr)=>{var lr=Jm(),cr=ae(lr),Es=re(cr,!0),$n=A(cr,2);rt($n,{get icon(){return ti},class:"text-ghost opacity-50"}),N(pn=>{at(cr,1,`text-sm truncate ${l(Le)?"text-foreground":"text-muted-foreground"}`),H(Es,pn)},[()=>l(Le)||_.workspace_repoSelector_selectAFolder_placeholder()]),x(Dn,lr)},$$slots:{default:!0}})},cl=gn=>{var Dn=l$(),vr=ae(Dn);Jf(vr,{kind:"repository"});var lr=A(vr,2);Jf(lr,{});var cr=A(lr,2),Es=ne(cr);q(Es);var $n=A(Es,2);{let En=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Zn=w(()=>l(hn).length>0?bd:void 0),Ir=w(()=>l(hn).length>0),Gr=w(()=>l(hn)[l(Qt)]?`${bd}-${l(Qt)}`:void 0);jn(is($n,{placeholder:"owner/repo",type:"text",oninput:er=>gd(er.currentTarget.value),onpaste:yw,onkeydown:Ur,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(En)},"aria-autocomplete":"list",get"aria-controls"(){return l(Zn)},get"aria-expanded"(){return l(Ir)},get"aria-activedescendant"(){return l(Gr)},get ref(){return l(Ct)},set ref(er){k(Ct,er,!0)},get value(){return l(fn)},set value(er){k(fn,er,!0)}}),er=>k(qe,er,!0),()=>l(qe))}Q(cr);var pn=A(cr,2);{var Jn=En=>{{let Zn=w(()=>_.workspace_repoSelector_githubSignIn_description());pw(En,{class:"mt-2",get message(){return l(Zn)}})}},_r=En=>{{let Zn=w(()=>!!we()),Ir=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Gr=w(()=>!l(hn).length&&(D()||!!(l(ts)&&ee()))),er=w(()=>l(ts)?_.workspace_repoSelector_searchingGithub_label({query:l(ts)}):_.gitlabCheckout_loading_label()),Js=w(()=>_.hud_filter_noRepositories_label()),zo=w(()=>I()?r()?I():_.workspace_repoSelector_suggestionsUnavailable_label():void 0),oo=w(()=>_.workspace_repoSelector_retrySuggestions_label());op(En,{get formStyle(){return l(Zn)},get id(){return bd},get items(){return l(hn)},getKey:Hs=>Hs.id,getOwner:Hs=>Hs.owner,getName:Hs=>Hs.name,provider:"github",get label(){return l(Ir)},get loading(){return l(Gr)},get loadingLabel(){return l(er)},get emptyLabel(){return l(Js)},get error(){return l(zo)},get retryLabel(){return l(oo)},onRetry:In,onSelect:or,get activeIndex(){return l(Qt)},set activeIndex(Hs){k(Qt,Hs,!0)}})}};K(pn,En=>{!l(be)&&s()?En(Jn):l(be)&&En(_r,1)})}var mn=A(pn,2);{var Sr=En=>{var Zn=a$(),Ir=ne(Zn),Gr=re(Ir),er=A(Ir,2);Je(er,{size:"sm",onclick:md,class:"shrink-0",children:(Js,zo)=>{$t();var oo=zt();N(Hs=>H(oo,Hs),[()=>_.workspace_repoSelector_select_label()]),x(Js,oo)},$$slots:{default:!0}}),Q(Zn),N(()=>H(Gr,`${l(xr).owner??""}/${l(xr).repo??""}`)),x(En,Zn)};K(mn,En=>{l(xr)&&!l(gs)&&En(Sr)})}x(gn,Dn)},pc=gn=>{var Dn=p$(),vr=ae(Dn);Je(vr,{type:"button",variant:"plain",wrapContent:!1,class:"w-full flex items-center gap-3 mb-2 text-left cursor-pointer",onclick:Mw,children:(mn,Sr)=>{var En=c$(),Zn=ae(En),Ir=re(Zn,!0),Gr=A(Zn,2),er=ne(Gr),Js=re(er,!0),zo=A(er,2);rt(zo,{get icon(){return ti},class:"text-ghost shrink-0 opacity-50"}),Q(Gr),N((oo,Hs)=>{H(Ir,oo),at(Gr,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(ft)?"text-foreground":"text-subtle"} truncate`),H(Js,Hs)},[()=>_.workspace_repoSelector_parentFolder_label(),()=>l(ft)||_.workspace_repoSelector_select_placeholder()]),x(mn,En)},$$slots:{default:!0}});var lr=A(vr,2),cr=ne(lr),Es=re(cr,!0),$n=A(cr,2);is($n,{placeholder:"new-project",type:"text",onkeydown:mn=>{mn.key==="Enter"&&!mn.isComposing&&(mn.preventDefault(),mn.stopPropagation(),ya())},class:"bg-sidebar border-none",noFocusStyle:!0,get value(){return l(Kt)},set value(mn){k(Kt,mn,!0)}}),Q(lr);var pn=A(lr,2);{var Jn=mn=>{var Sr=u$(),En=ne(Sr),Zn=re(En,!0);Q(Sr),N(()=>H(Zn,l(bn))),x(mn,Sr)},_r=mn=>{var Sr=h$(),En=ne(Sr),Zn=re(En,!0),Ir=A(En,2);{var Gr=Lr=>{var Xn=d$(),qr=ne(Xn);pi(qr,{size:14});var ci=A(qr,2),ui=re(ci,!0);Q(Xn),N(ur=>H(ui,ur),[()=>_.workspace_repoSelector_checking_label()]),x(Lr,Xn)},er=Lr=>{var Xn=Nc(),qr=ne(Xn),ci=re(qr,!0),ui=A(qr,2);Je(ui,{size:"sm",onclick:ya,class:"shrink-0",children:(ur,gc)=>{$t();var As=zt();N(Di=>H(As,Di),[()=>_.workspace_repoSelector_select_label()]),x(ur,As)},$$slots:{default:!0}}),Q(Xn),N(ur=>H(ci,ur),[()=>_.workspace_repoSelector_repoExists_label({isolationLabel:z})]),x(Lr,Xn)},Js=Lr=>{var Xn=Nc(),qr=ne(Xn),ci=re(qr,!0),ui=A(qr,2);Je(ui,{size:"sm",onclick:ya,class:"shrink-0",children:(ur,gc)=>{$t();var As=zt();N(Di=>H(As,Di),[()=>_.workspace_repoSelector_select_label()]),x(ur,As)},$$slots:{default:!0}}),Q(Xn),N(ur=>H(ci,ur),[()=>_.onboarding_localRepoTab_plainFolder_description()]),x(Lr,Xn)},zo=Lr=>{var Xn=Nc(),qr=ne(Xn),ci=re(qr,!0),ui=A(qr,2);Je(ui,{size:"sm",variant:"primary",onclick:ya,class:"shrink-0",children:(ur,gc)=>{$t();var As=zt();N(Di=>H(As,Di),[()=>_.workspace_repoSelector_create_label()]),x(ur,As)},$$slots:{default:!0}}),Q(Xn),N(ur=>H(ci,ur),[()=>_.workspace_repoSelector_newFolderWillBeCreated_label()]),x(Lr,Xn)},oo=Lr=>{var Xn=f$(),qr=ne(Xn),ci=re(qr,!0),ui=A(qr,2);Je(ui,{size:"sm",variant:"primary",onclick:ya,class:"shrink-0",disabled:!0,children:(ur,gc)=>{$t();var As=zt();N(Di=>H(As,Di),[()=>_.workspace_repoSelector_create_label()]),x(ur,As)},$$slots:{default:!0}}),Q(Xn),N(ur=>H(ci,ur),[()=>_.workspace_repoSelector_folderNotGitRepo_label()]),x(Lr,Xn)},Hs=Lr=>{var Xn=Nc(),qr=ne(Xn),ci=re(qr,!0),ui=A(qr,2);Je(ui,{size:"sm",variant:"primary",onclick:ya,class:"shrink-0",children:(ur,gc)=>{$t();var As=zt();N(Di=>H(As,Di),[()=>_.workspace_repoSelector_create_label()]),x(ur,As)},$$slots:{default:!0}}),Q(Xn),N(ur=>H(ci,ur),[()=>_.workspace_repoSelector_newRepoWillBeCreated_label()]),x(Lr,Xn)};K(Ir,Lr=>{l(Oo)?Lr(Gr):l(fs)?.exists&&l(fs)?.isGitRepo?Lr(er,1):l(vi)==="existing"?Lr(Js,2):l(vi)==="new"?Lr(zo,3):l(fs)?.exists&&!l(fs)?.isGitRepo?Lr(oo,4):Lr(Hs,-1)})}Q(Sr),N(()=>H(Zn,l(Qn))),x(mn,Sr)};K(pn,mn=>{l(bn)?mn(Jn):l(Qn)&&mn(_r,1)})}N(mn=>H(Es,mn),[()=>_.workspace_repoSelector_folderName_label()]),x(gn,Dn)},ul=gn=>{var Dn=b$(),vr=ne(Dn);as(vr,17,()=>l(mi),$n=>$n.id,($n,pn)=>{var Jn=g$(),_r=ne(Jn);sp(_r,{size:14,class:"text-ghost shrink-0"});var mn=A(_r,2),Sr=ne(mn),En=re(Sr,!0),Zn=A(Sr,2),Ir=re(Zn,!0);Q(mn);var Gr=A(mn,2);{let er=w(()=>_.workspace_repoSelector_removeSetup_tooltip());Je(Gr,{variant:"ghost",type:"button",size:"icon-compact",iconOnly:!0,onclick:Js=>{Js.stopPropagation(),Js.preventDefault(),X(l(pn).id)},class:"ml-1 rounded text-muted-foreground hover:text-danger hover:bg-danger-background/10",get title(){return l(er)},children:(Js,zo)=>{rt(Js,{get icon(){return Ji},size:"xs"})},$$slots:{default:!0}})}Q(Jn),N(()=>{H(En,l(pn).name),H(Ir,l(pn).transport==="websocket"?l(pn).wsUrl:`${l(pn).username}@${l(pn).host}:${l(pn).port}`)}),Qr("click",Jn,()=>fc(l(pn))),Qr("keydown",Jn,er=>{(er.key==="Enter"||er.key===" ")&&(er.preventDefault(),fc(l(pn)))}),x($n,Jn)});var lr=A(vr,2);{var cr=$n=>{var pn=m$(),Jn=re(pn,!0);N(_r=>H(Jn,_r),[()=>_.workspace_repoSelector_noRemoteSetups_label()]),x($n,pn)};K(lr,$n=>{l(mi).length===0&&$n(cr)})}var Es=A(lr,2);Je(Es,{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:Oe,children:($n,pn)=>{var Jn=v$(),_r=ae(Jn);rt(_r,{get icon(){return qc},size:"sm"});var mn=A(_r);N(Sr=>H(mn,` ${Sr??""}`),[()=>_.workspace_repoSelector_addRemoteSetup_label()]),x($n,Jn)},$$slots:{default:!0}}),Q(Dn),x(gn,Dn)};K(ol,gn=>{l(Wt)==="gitlab"&&Ne()?gn(al):l(Wt)==="local"?gn(ll,1):l(Wt)==="github"?gn(cl,2):l(Wt)==="new"?gn(pc,3):l(Wt)==="remote"&&gn(ul,4)})}Q(so);var Bo=A(so,2);{var $w=gn=>{var Dn=y$(),vr=ne(Dn),lr=ne(vr);rt(lr,{get icon(){return ti},class:"text-ghost shrink-0 mt-0.5"});var cr=A(lr,2),Es=ne(cr),$n=re(Es,!0),pn=A(Es,2),Jn=re(pn,!0),_r=A(pn,2),mn=ne(_r);Je(mn,{size:"sm",variant:"secondary",onclick:Ew,children:(En,Zn)=>{$t();var Ir=zt();N(Gr=>H(Ir,Gr),[()=>_.workspace_repoSelector_initializeGit_label()]),x(En,Ir)},$$slots:{default:!0}});var Sr=A(mn,2);Je(Sr,{size:"sm",variant:"secondary",onclick:Rw,children:(En,Zn)=>{$t();var Ir=zt();N(Gr=>H(Ir,Gr),[()=>_.workspace_repoSelector_chooseDifferentFolder_label()]),x(En,Ir)},$$slots:{default:!0}}),Q(_r),Q(cr),Q(vr),Q(Dn),N((En,Zn)=>{ot(Es,"title",l(dr)),H($n,En),H(Jn,Zn)},[()=>l(dr).split("/").pop()||l(dr),()=>_.workspace_repoSelector_notGitRepository_label()]),x(gn,Dn)};K(Bo,gn=>{l(Wt)!=="gitlab"&&l(Wt)!=="sessions"&&l(es)&&l(dr)&&gn($w)})}var Bw=A(Bo,2);{var zw=gn=>{var Dn=_$(),vr=ne(Dn);ck(vr,{size:5,class:"mb-2",children:($n,pn)=>{$t();var Jn=zt();N(_r=>H(Jn,_r),[()=>_.workspace_repoSelector_recent_label()]),x($n,Jn)},$$slots:{default:!0}});var lr=A(vr,2);{var cr=$n=>{var pn=x$();as(pn,20,()=>[1,2,3],$c,(Jn,_r)=>{var mn=w$();x(Jn,mn)}),Q(pn),x($n,pn)},Es=$n=>{var pn=k$(),Jn=ne(pn);{let _r=w(()=>l(Ds)());T(Jn,()=>l(_r),()=>(mn,Sr)=>Sr===l(ms))}Q(pn),x($n,pn)};K(lr,$n=>{l(qt)&&l(Br).length===0?$n(cr):$n(Es,-1)})}Q(Dn),x(gn,Dn)},Fw=w(()=>!we()&&(l(Wt)==="local"||l(an))&&(l(qt)||l(Ds)().length>0));K(Bw,gn=>{l(Fw)&&gn(zw)})}N(()=>io=at(so,1,"shrink-0 px-3 mb-3",null,io,{hidden:l(Wt)==="sessions"})),x(ki,Oi)},$$slots:{default:!0}})})}x(Ln,ns)},$$slots:{default:!0}})})}x(yn,mr)};K(Ii,yn=>{we()&&l(fr)==="browse"?yn(Li):yn(li,-1)})}x(ar,gr)},$$slots:{default:!0}})})}x(Sn,to)},$$slots:{default:!0}})}),Q(xd)}var yp=A(xd,2);{var Ow=T=>{fw(T,{get isOpen(){return l(va)},onclose:()=>k(va,!1),onsave:He})};K(yp,T=>{L()&&T(Ow)})}var Nw=A(yp,2);e_(Nw,{get open(){return l(Ms)},get title(){return l(Ri)},get initialPath(){return l(Ya)},selectLabel:"Select folder",onSelect:pp,onClose:Tw}),x(n,bp);var Dw=Pt(Iw);return ie(),Dw}Ro(["click","keydown"]);var T$=B('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),E$=B('<div class="flex items-center rounded-lg bg-sidebar"><!></div>'),A$=B('<span class="mt-1 block"> </span>'),R$=B("<span> </span> <!>",1),Ym=B("<!> <!>",1),P$=B("<div><!> <!></div>"),I$=B("<!> <!> <!>",1),L$=B('<div data-testid="gitlab-picker-list"><!> <!></div>');function bw(n,e){if(new.target)return It({component:bw,...n});Rt(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),C=y(e,"row",7),$=y(e,"compact",7,!1),M=he(void 0);function S(F){if(F.key!=="ArrowDown"||F.isComposing)return;const W=l(M)?.querySelector('[data-slot="list-view-item"]');W&&(F.preventDefault(),F.stopPropagation(),W.focus())}var D={get scopeKey(){return t()},set scopeKey(F){t(F),b()},get prefix(){return r()},set prefix(F){r(F),b()},get instanceBaseUrl(){return s()},set instanceBaseUrl(F){s(F),b()},get query(){return i()},set query(F){i(F),b()},get page(){return o()},set page(F){o(F),b()},get copy(){return a()},set copy(F){a(F),b()},get onSearch(){return c()},set onSearch(F){c(F),b()},get onSubmit(){return u()},set onSubmit(F){u(F),b()},get submitLabel(){return d()},set submitLabel(F){d(F),b()},get onMore(){return f()},set onMore(F){f(F),b()},get onRecover(){return h()},set onRecover(F){h(F),b()},get selectedKey(){return p()},set selectedKey(F){p(F),b()},get getKey(){return g()},set getKey(F){g(F),b()},get getText(){return v()},set getText(F){v(F),b()},get onSelect(){return m()},set onSelect(F){m(F),b()},get row(){return C()},set row(F){C(F),b()},get compact(){return $()},set compact(F=!1){$(F),b()},$set:Lt,$on:(F,W)=>Ot(e,F,W)},I=L$(),E=ne(I);{var L=F=>{var W=T$(),Y=re(W,!0);N(()=>H(Y,s())),x(F,W)};K(E,F=>{s()&&!r()&&!$()&&F(L)})}var ee=A(E,2);{var U=F=>{var W=Ym(),Y=ae(W);{var ce=j=>{var ue=E$(),P=ne(ue);Un(P,r),Q(ue),x(j,ue)};K(Y,j=>{r()&&j(ce)})}var pe=A(Y,2);{const j=z=>{var le=R$(),ge=ae(le),ye=re(ge,!0),Z=A(ge,2);{var oe=V=>{var G=A$(),O=re(G,!0);N(()=>H(O,o().detail)),x(V,G)};K(Z,V=>{o().detail&&V(oe)})}N(()=>H(ye,o().message)),x(z,le)};let ue=w(()=>h()?o().actionLabel:void 0),P=w(()=>h()&&o().actionLabel?()=>h()?.(t()):void 0);fk(pe,{density:"compact",get retryLabel(){return l(ue)},get onRetry(){return l(P)},message:j,$$slots:{message:!0}})}x(F,W)},ie=F=>{var W=I$(),Y=ae(W);{var ce=ge=>{{let ye=w(()=>!t());is(ge,{variant:"search",type:"text",role:"searchbox",get"aria-label"(){return a().searchLabel},get value(){return i()},get disabled(){return l(ye)},get placeholder(){return a().searchPlaceholder},oninput:Z=>c()(Z.currentTarget.value,t()),onkeydown:S,class:"shrink-0"})}},pe=ge=>{n_(ge,{get label(){return a().searchLabel},control:(Z,oe=Or)=>{var V=P$(),G=ne(V);{var O=ve=>{var de=Ye(),fe=ae(de);Un(fe,r),x(ve,de)};K(G,ve=>{r()&&ve(O)})}var te=A(G,2);{let ve=w(()=>!t()),de=w(()=>r()?"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm":void 0);is(te,ks(oe,{type:"search",get value(){return i()},get disabled(){return l(ve)},get placeholder(){return a().searchPlaceholder},oninput:fe=>c()(fe.currentTarget.value,t()),onkeydown:S,get class(){return l(de)}}))}Q(V),N(()=>at(V,1,Bn(r()?"flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring":void 0))),x(Z,V)},$$slots:{control:!0}})};K(Y,ge=>{$()?ge(ce):ge(pe,-1)})}var j=A(Y,2);{var ue=ge=>{{let ye=w(()=>!i().trim()||o().status==="loading"||o().loadingMore);Je(ge,{type:"button",variant:"secondary",class:"w-full shrink-0",get disabled(){return l(ye)},onclick:()=>u()?.(i(),t()),children:(Z,oe)=>{$t();var V=zt();N(()=>H(V,d())),x(Z,V)},$$slots:{default:!0}})}};K(j,ge=>{u()&&d()&&ge(ue)})}var P=A(j,2);{var z=ge=>{hk(ge,{get label(){return a().loadingLabel},density:"compact"})},le=ge=>{var ye=Ym(),Z=ae(ye);fh(Z,t,G=>{{const O=fe=>{gk(fe,{density:"compact",description:be=>{$t();var J=zt();N(()=>H(J,i()?a().emptySearchLabel:a().emptyLabel)),x(be,J)},$$slots:{description:!0}})};let te=w(()=>p()?[p()]:[]),ve=w(()=>$()?"min-h-0 flex-1":"max-h-56"),de=w(()=>$()?40:void 0);pk(G,{get items(){return o().items},get getKey(){return g()},get getText(){return v()},selectable:"single",get selectedKeys(){return l(te)},onActivate:fe=>m()(fe,t()),get ariaLabel(){return a().listLabel},get class(){return l(ve)},get rowHeight(){return l(de)},get row(){return C()},empty:O,$$slots:{empty:!0}})}});var oe=A(Z,2);{var V=G=>{Je(G,{type:"button",variant:"ghost",class:"w-full shrink-0",get disabled(){return o().loadingMore},onclick:()=>f()(t()),children:(O,te)=>{$t();var ve=zt();N(()=>H(ve,o().loadingMore?a().loadingMoreLabel:a().loadMoreLabel)),x(O,ve)},$$slots:{default:!0}})};K(oe,G=>{(o().hasMore||o().loadingMore)&&G(V)})}x(ge,ye)};K(P,ge=>{o().status==="loading"?ge(z):ge(le,-1)})}x(F,W)};K(ee,F=>{o().status==="unavailable"?F(U):F(ie,-1)})}return Q(I),jn(I,F=>k(M,F),()=>l(M)),N(()=>at(I,1,Bn($()?"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"))),x(n,I),Pt(D)}var O$=new Set(["$$slots","$$events","$$legacy","projectPath","selectedBranch","placeholder","protectedLabel","triggerClass","rowLabel","isLoading","showTriggerChevron","triggerChevronClass","onSelect","onOpenChange"]),N$=B("<span> </span>"),D$=B('<!> <span class="sr-only"> </span>',1),$$=B('<span class="flex-1 min-w-0 text-left truncate"> </span>'),B$=B("<span><!> <!> <!></span>"),z$=B('<p class="break-all type-caption text-foreground"> </p>'),F$=B('<span class="type-caption shrink-0 text-muted-foreground"> </span>'),H$=B('<div><!> <span class="min-w-0 flex-1 truncate"> </span> <!> <!></div>'),Qm=B("<!> <!>",1);function Kc(n,e){if(new.target)return It({component:Kc,...n});Rt(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=Ei(e,O$),g=he(!1);const v=Wu(),m=new ju,C=w(()=>c()||e.page.status==="loading");var $={get projectPath(){return t()},set projectPath(D){t(D),b()},get selectedBranch(){return r()},set selectedBranch(D){r(D),b()},get placeholder(){return s()},set placeholder(D){s(D),b()},get protectedLabel(){return i()},set protectedLabel(D){i(D),b()},get triggerClass(){return o()},set triggerClass(D){o(D),b()},get rowLabel(){return a()},set rowLabel(D){a(D),b()},get isLoading(){return c()},set isLoading(D=!1){c(D),b()},get showTriggerChevron(){return u()},set showTriggerChevron(D=!1){u(D),b()},get triggerChevronClass(){return d()},set triggerChevronClass(D){d(D),b()},get onSelect(){return f()},set onSelect(D){f(D),b()},get onOpenChange(){return h()},set onOpenChange(D){h(D),b()},$set:Lt,$on:(D,I)=>Ot(e,D,I)},M=Ye(),S=ae(M);return xt(S,()=>Vu,(D,I)=>{I(D,{onOpenChange:E=>h()?.(E,e.scopeKey),get open(){return l(g)},set open(E){k(g,E,!0)},children:(E,L)=>{var ee=Qm(),U=ae(ee);{const F=(W,Y)=>{let ce=()=>(Y?.()).props;{let pe=w(()=>`min-w-0 max-w-full text-muted-foreground ${o()??""}`),j=w(()=>!a());Je(W,ks(ce,{variant:"ghost",type:"button",get class(){return l(pe)},get"aria-busy"(){return l(C)},get wrapContent(){return l(j)},children:(ue,P)=>{var z=B$(),le=ne(z);{var ge=O=>{var te=N$(),ve=re(te,!0);N(()=>{at(te,1,Bn(cn.fieldLabel)),H(ve,a())}),x(O,te)};K(le,O=>{a()&&O(ge)})}var ye=A(le,2);{var Z=O=>{var te=D$(),ve=ae(te);pi(ve,{size:14,class:"text-ghost"});var de=A(ve,2),fe=re(de,!0);N(()=>H(fe,e.copy.loadingLabel)),x(O,te)},oe=O=>{var te=$$(),ve=re(te,!0);N(()=>H(ve,r()?.name||s())),x(O,te)};K(ye,O=>{!r()&&l(C)?O(Z):O(oe,-1)})}var V=A(ye,2);{var G=O=>{rt(O,{get icon(){return sa},size:10,get class(){return d()}})};K(V,O=>{u()&&!l(C)&&O(G)})}Q(z),N(()=>at(z,1,`flex w-full min-w-0 items-center truncate ${a()?"gap-2":"gap-0.75"}`)),x(ue,z)},$$slots:{default:!0}}))}};xt(U,()=>Ku,(W,Y)=>{Y(W,{child:F,$$slots:{child:!0}})})}var ie=A(U,2);{let F=w(()=>a()??e.copy.listLabel),W=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"),Y=w(()=>a()?m.current?"bottom":"left":void 0),ce=w(()=>a()?m.current?4:24:void 0),pe=w(()=>a()&&m.current?"end":"start"),j=w(()=>({to:v()})),ue=w(()=>v()?"absolute":"fixed");xt(ie,()=>Uu,(P,z)=>{z(P,{role:"dialog",get"aria-label"(){return l(F)},get class(){return l(W)},get side(){return l(Y)},get sideOffset(){return l(ce)},get align(){return l(pe)},get portalProps(){return l(j)},get strategy(){return l(ue)},onkeydown:le=>{le.key==="Enter"&&le.stopPropagation()},children:(le,ge)=>{var ye=Qm(),Z=ae(ye);{var oe=G=>{var O=z$(),te=re(O,!0);N(()=>H(te,t())),x(G,O)};K(Z,G=>{a()||G(oe)})}var V=A(Z,2);{const G=(ve,de)=>{let fe=()=>(de?.()).item,ke=()=>(de?.()).selected;var be=Ye(),J=ae(be);{var Me=gt=>{var Ie=H$(),$e=ne(Ie);mo($e,{size:16,get class(){return cn.icon}});var ze=A($e,2),vt=re(ze,!0),Vt=A(ze,2);{var st=Ce=>{var we=F$(),Ue=re(we,!0);N(()=>H(Ue,i())),x(Ce,we)};K(Vt,Ce=>{fe().protected&&Ce(st)})}var Ae=A(Vt,2);{let Ce=w(()=>ke()?"checked":"empty");Av(Ae,{get state(){return l(Ce)},get class(){return cn.check}})}Q(Ie),N(()=>{at(Ie,1,`flex ${cn.row}`),H(vt,fe().name)}),x(gt,Ie)},Be=gt=>{r_(gt,{title:ze=>{$t();var vt=zt();N(()=>H(vt,fe().name)),x(ze,vt)},meta:ze=>{$t();var vt=zt();N(()=>H(vt,fe().protected?i():"")),x(ze,vt)},$$slots:{title:!0,meta:!0}})};K(J,gt=>{a()?gt(Me):gt(Be,-1)})}x(ve,be)};let O=w(()=>!!a()),te=w(()=>r()?.name);bw(V,ks(()=>p,{get compact(){return l(O)},get selectedKey(){return l(te)},getKey:ve=>ve.name,getText:ve=>ve.name,onSelect:(ve,de)=>{f()({name:ve.name,commitSha:ve.commitSha},de),k(g,!1)},row:G,$$slots:{row:!0}}))}x(le,ye)},$$slots:{default:!0}})})}x(E,ee)},$$slots:{default:!0}})}),x(n,M),Pt($)}var U$=B('<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>'),V$=B('<div class="min-w-0"><!></div>'),W$=B('<label class="flex items-center gap-2 py-2 text-sm text-muted-foreground"><!> </label>'),j$=B('<p class="min-w-0 truncate text-sm text-muted-foreground"> </p> <!>',1),Zd=B("<!> <!> <!>",1),K$=B('<div class="relative min-w-0"><!> <!></div>'),di=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>'),Zm=B('<!> <span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>',1),Dc=B("<!> <!>",1),ev=B("<!> <!> <!> <!> <!>",1),G$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pr-1"> </span>'),q$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 px-1"> </span>'),J$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pl-1"> </span>'),X$=B('<!> <span class="text-ui text-subtle whitespace-nowrap"> </span>',1),Y$=B('<!> <!> <!> <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),Q$=B("<div><!></div>");function Z$(n,e){if(new.target)return It({component:Z$,...n});Rt(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),C=y(e,"onBranchStatusChange",7),$=y(e,"onBranchesLoaded",7),M=y(e,"presentation",7,"default"),S=y(e,"field",7,"both"),D=y(e,"isLoading",7,!1),I=y(e,"detectedGitHubOwner",7,null),E=y(e,"detectedGitHubRepo",7,null),L=y(e,"plainFolderMode",7,!1),ee=y(e,"plainFolder",7,null),U=y(e,"gitChoice",7),ie=y(e,"sessions",7);const F=w(()=>M()==="metadata"),W=w(()=>M()==="form"),Y="\0",ce=me=>me.split(Y).map(tt=>tt.trim()),pe=w(()=>ce(_.workspace_repoAndBranchPicker_workOnRepo_label({repo:Y}))),j=w(()=>ce(_.workspace_repoAndBranchPicker_workOnRepoOffBranch_label({repo:Y,branch:Y}))),ue=w(()=>ce(_.workspace_repoAndBranchPicker_repoOffBranch_label({repo:Y,branch:Y}))),P=w(()=>ce(_.workspace_repoAndBranchPicker_cloneRepoAndWorkOffBranch_label({repo:Y,branch:Y}))),z=w(()=>ce(_.workspace_repoAndBranchPicker_workInFolder_label({repo:Y}))),le=w(()=>ce((c()?_.workspace_repoAndBranchPicker_workOnRemoteOnBranch_label:_.workspace_repoAndBranchPicker_workOnRemoteOffBranch_label)({repo:Y,path:Y,branch:Y}))),ge=w(()=>l(F)?"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"),ye=cn.metadataTriggerSurface,Z=w(()=>l(F)?`${cn.metadataTrigger} ${ye}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium)"),oe=w(()=>l(F)?`${cn.metadataTrigger} w-full overflow-hidden ${ye}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium) overflow-hidden"),V=cn.metadataChevron,G="text-foreground font-normal",O="text-muted-foreground",te="main",ve=w(()=>l(F)&&S()==="branch"&&D()),de=w(()=>f()?`${f().username}@${f().host}:${f().workspacePath}`:"");function fe(me){const tt=me.split(/[\\/]/).filter(Boolean);return tt[tt.length-1]||me}function ke(me){const tt=me.trim().replace(/^git@github\.com:/,"https://github.com/");try{const St=new URL(tt.startsWith("http")?tt:`https://${tt}`);return St.hostname!=="github.com"?fe(me):St.pathname.replace(/^\//,"").replace(/\.git$/,"")||fe(me)}catch{return fe(me.replace(/\.git$/,""))}}const be=w(()=>s()==="gitlab"?i()?.selectedProjectPath??"":s()==="remote"&&f()?f().name:s()==="github"&&a()?ke(a()):fe(t())),J=w(()=>s()==="gitlab"?o()?.selectedBranch?.name??"":s()==="remote"&&f()&&f().branch||r()||te),Me=w(()=>l(be)?`${l(be)}/${l(J)}`:""),Be=w(()=>s()==="gitlab"?"":s()==="remote"&&f()?f().name:s()==="github"&&a()?a():t()),gt=w(()=>l(F)?l(be):void 0),Ie=w(()=>I()&&E()?`${I()}/${E()}`:void 0),$e=w(()=>t()||(s()==="remote"&&f()?f().workspacePath:""));function ze(me){p()?.(me)}function vt(me){g()?.(me)}const Vt=w(()=>s()==="gitlab"||!!t()||s()==="github"&&!!a()||s()==="remote"&&!!f());let st=he(void 0);function Ae(){l(st)?.focusInput?.()}function Ce(me="local"){l(st)?.openOnLocalTab?.(me)}var we={focusInput:Ae,openFolderSelection:Ce,get repoPath(){return t()},set repoPath(me=""){t(me),b()},get branch(){return r()},set branch(me=""){r(me),b()},get repoType(){return s()},set repoType(me="local"){s(me),b()},get gitlab(){return i()},set gitlab(me){i(me),b()},get gitlabBranch(){return o()},set gitlabBranch(me){o(me),b()},get githubUrl(){return a()},set githubUrl(me=""){a(me),b()},get skipIsolation(){return c()},set skipIsolation(me=!1){c(me),b()},get isNewRepo(){return u()},set isNewRepo(me=!1){u(me),b()},get suggestedBranch(){return d()},set suggestedBranch(me){d(me),b()},get remoteSetup(){return f()},set remoteSetup(me=null){f(me),b()},get onRemoteSetupChange(){return h()},set onRemoteSetupChange(me){h(me),b()},get onRepoChange(){return p()},set onRepoChange(me){p(me),b()},get onBranchChange(){return g()},set onBranchChange(me){g(me),b()},get onSkipIsolationChange(){return v()},set onSkipIsolationChange(me){v(me),b()},get onGitHubAuthNeededChange(){return m()},set onGitHubAuthNeededChange(me){m(me),b()},get onBranchStatusChange(){return C()},set onBranchStatusChange(me){C(me),b()},get onBranchesLoaded(){return $()},set onBranchesLoaded(me){$(me),b()},get presentation(){return M()},set presentation(me="default"){M(me),b()},get field(){return S()},set field(me="both"){S(me),b()},get isLoading(){return D()},set isLoading(me=!1){D(me),b()},get detectedGitHubOwner(){return I()},set detectedGitHubOwner(me=null){I(me),b()},get detectedGitHubRepo(){return E()},set detectedGitHubRepo(me=null){E(me),b()},get plainFolderMode(){return L()},set plainFolderMode(me=!1){L(me),b()},get plainFolder(){return ee()},set plainFolder(me=null){ee(me),b()},get gitChoice(){return U()},set gitChoice(me){U(me),b()},get sessions(){return ie()},set sessions(me){ie(me),b()},$set:Lt,$on:(me,tt)=>Ot(e,me,tt)},Ue=Q$(),_t=ne(Ue);{var se=me=>{var tt=Zd(),St=ae(tt);{let Le=w(()=>s()==="gitlab"),je=w(()=>!!ee()&&s()==="local"),qe=w(()=>_.workspace_compactInitializer_repository_label()),Ct=w(()=>l(be)||void 0);jn(Ys(St,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},get sessions(){return ie()},variant:"ghost",get gitlabSelected(){return l(Le)},get plainFolderSelected(){return l(je)},get value(){return l(Be)},onchange:ze,get rowLabel(){return l(qe)},get triggerClass(){return cn.fieldTrigger},get displayValue(){return l(Ct)},triggerValueClass:"text-foreground",triggerContentClass:"gap-1"}),Ge=>k(st,Ge,!0),()=>l(st))}var sn=A(St,2);{var jt=Le=>{var je=V$(),qe=ne(je);{var Ct=Qe=>{var pt=Ye(),qt=ae(pt);{var Ht=mt=>{{let Nt=w(()=>_.workspace_compactInitializer_branch_label());Kc(mt,ks(o,{get rowLabel(){return l(Nt)},get triggerClass(){return cn.fieldTrigger},showTriggerChevron:!1}))}};K(qt,mt=>{o()&&mt(Ht)})}x(Qe,pt)},Ge=Qe=>{var pt=U$(),qt=ne(pt),Ht=re(qt,!0),mt=A(qt,2),Nt=re(mt,!0);Q(pt),N(Rn=>{at(qt,1,Bn(cn.fieldLabel)),H(Ht,Rn),H(Nt,f().branch||"main")},[()=>_.workspace_compactInitializer_branch_label()]),x(Qe,pt)},nt=Qe=>{{let pt=w(()=>_.workspace_compactInitializer_branch_label()),qt=w(()=>!l(Vt));Sl(Qe,{variant:"ghost",get rowLabel(){return l(pt)},get triggerClass(){return cn.fieldTrigger},get value(){return r()},get repoPath(){return l($e)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(qt)},showUncommittedIndicator:!0,triggerContentClass:"w-full gap-2",onSkipIsolationChange:Ht=>v()?.(Ht),onGitHubAuthNeededChange:Ht=>m()?.(Ht),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return $()},onchange:vt})}};K(qe,Qe=>{s()==="gitlab"?Qe(Ct):s()==="remote"&&f()?Qe(Ge,1):Qe(nt,-1)})}Q(je),x(Le,je)};K(sn,Le=>{!u()&&l(Vt)&&!(ee()&&s()==="local")&&Le(jt)})}var yt=A(sn,2);{var dt=Le=>{var je=j$(),qe=ae(je),Ct=re(qe,!0);Fl(qe,(Qe,pt)=>uf?.(Qe,pt),()=>l(de));var Ge=A(qe,2);{var nt=Qe=>{var pt=W$(),qt=ne(pt);Kp(qt,{get checked(){return c()},onCheckedChange:mt=>v()?.(mt)});var Ht=A(qt);Q(pt),N(mt=>H(Ht,` ${mt??""}`),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),x(Qe,pt)};K(Ge,Qe=>{typeof v()=="function"&&Qe(nt)})}N(()=>H(Ct,l(de))),x(Le,je)};K(yt,Le=>{s()==="remote"&&f()&&Le(dt)})}x(me,tt)},Ze=me=>{{let tt=w(()=>s()==="gitlab"),St=w(()=>l(F)?G:O),sn=w(()=>l(F)?"gap-1.5":"gap-0.75");jn(Ys(me,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",get gitlabSelected(){return l(tt)},get value(){return l(Be)},onchange:ze,get triggerClass(){return l(Z)},get displayValue(){return l(gt)},get triggerValueClass(){return l(St)},get triggerContentClass(){return l(sn)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}),jt=>k(st,jt,!0),()=>l(st))}},lt=me=>{var tt=Ye(),St=ae(tt);{var sn=jt=>{Kc(jt,ks(o,{get triggerClass(){return l(oe)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}))};K(St,jt=>{o()&&jt(sn)})}x(me,tt)},et=me=>{var tt=K$(),St=ne(tt);{let yt=w(()=>l(F)&&!l(ve)),dt=w(()=>l(F)?`w-full gap-1.5 ${l(ve)?"pr-5":""}`:void 0);Sl(St,{variant:"ghost",get triggerClass(){return l(oe)},get value(){return l(J)},get repoPath(){return l($e)},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(yt)},get triggerChevronClass(){return V},get triggerContentClass(){return l(dt)},onSkipIsolationChange:Le=>v()?.(Le),onGitHubAuthNeededChange:Le=>m()?.(Le),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return $()},onchange:vt})}var sn=A(St,2);{var jt=yt=>{pi(yt,{size:16,class:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-subtle"})};K(sn,yt=>{l(ve)&&yt(jt)})}Q(tt),x(me,tt)},bt=me=>{var tt=Zd(),St=ae(tt);{var sn=Le=>{var je=di(),qe=re(je,!0);N(()=>H(qe,l(pe)[0])),x(Le,je)};K(St,Le=>{!l(F)&&l(pe)[0]&&Le(sn)})}var jt=A(St,2);{let Le=w(()=>l(F)?G:O),je=w(()=>l(F)?"gap-1.5":"gap-0.75");jn(Ys(jt,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",value:"",onchange:ze,get triggerClass(){return l(Z)},get triggerValueClass(){return l(Le)},get triggerContentClass(){return l(je)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}),qe=>k(st,qe,!0),()=>l(st))}var yt=A(jt,2);{var dt=Le=>{var je=di(),qe=re(je,!0);N(()=>H(qe,l(pe)[1])),x(Le,je)};K(yt,Le=>{!l(F)&&l(pe)[1]&&Le(dt)})}x(me,tt)},Bt=me=>{var tt=Zd(),St=ae(tt);{var sn=Le=>{var je=Ye(),qe=ae(je);{var Ct=nt=>{var Qe=Zm(),pt=ae(Qe);rt(pt,{get icon(){return qc},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var qt=A(pt,2),Ht=re(qt,!0);N(mt=>H(Ht,mt),[()=>_.workspace_repoAndBranchPicker_createFolder_label()]),x(nt,Qe)},Ge=nt=>{var Qe=di(),pt=re(Qe,!0);N(()=>H(pt,l(z)[0])),x(nt,Qe)};K(qe,nt=>{ee()==="new"?nt(Ct):l(z)[0]&&nt(Ge,1)})}x(Le,je)};K(St,Le=>{l(F)||Le(sn)})}var jt=A(St,2);{let Le=w(()=>l(F)?l(be):void 0),je=w(()=>l(F)?G:O),qe=w(()=>l(F)?"gap-1.5":"gap-0.75");Ys(jt,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:ze,get triggerClass(){return l(Z)},get displayValue(){return l(Le)},get triggerValueClass(){return l(je)},get triggerContentClass(){return l(qe)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var yt=A(jt,2);{var dt=Le=>{var je=di(),qe=re(je,!0);N(()=>H(qe,l(z)[1])),x(Le,je)};K(yt,Le=>{!l(F)&&ee()!=="new"&&l(z)[1]&&Le(dt)})}x(me,tt)},Fe=me=>{var tt=Dc(),St=ae(tt);{var sn=yt=>{var dt=Zm(),Le=ae(dt);rt(Le,{get icon(){return qc},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var je=A(Le,2),qe=re(je,!0);N(Ct=>H(qe,Ct),[()=>_.workspace_repoAndBranchPicker_createNewRepo_label()]),x(yt,dt)};K(St,yt=>{l(F)||yt(sn)})}var jt=A(St,2);{let yt=w(()=>l(F)?l(Me):void 0),dt=w(()=>l(F)?G:O),Le=w(()=>l(F)?"gap-1.5":"gap-0.75");Ys(jt,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:ze,get triggerClass(){return l(Z)},get displayValue(){return l(yt)},get triggerValueClass(){return l(dt)},get triggerContentClass(){return l(Le)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}x(me,tt)},Ke=me=>{{let tt=w(()=>s()==="gitlab"),St=w(()=>s()==="gitlab"?"":t());Ys(me,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},get gitlabSelected(){return l(tt)},variant:"ghost",get value(){return l(St)},onchange:ze,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:G,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})}},Yt=me=>{var tt=ev(),St=ae(tt);{var sn=nt=>{var Qe=Dc(),pt=ae(Qe);Zo(pt,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var qt=A(pt,2);{var Ht=mt=>{var Nt=di(),Rn=re(Nt,!0);N(()=>H(Rn,l(P)[0])),x(mt,Nt)};K(qt,mt=>{l(P)[0]&&mt(Ht)})}x(nt,Qe)};K(St,nt=>{l(F)||nt(sn)})}var jt=A(St,2);{let nt=w(()=>s()==="gitlab"),Qe=w(()=>s()==="gitlab"?"":t()),pt=w(()=>l(F)?G:O);Ys(jt,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},get gitlabSelected(){return l(nt)},variant:"ghost",get value(){return l(Qe)},onchange:ze,get triggerClass(){return l(Z)},get triggerValueClass(){return l(pt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var yt=A(jt,2);{var dt=nt=>{var Qe=di(),pt=re(Qe,!0);N(()=>H(pt,l(F)?l(ue)[1]:l(P)[1])),x(nt,Qe)};K(yt,nt=>{(l(F)?l(ue)[1]:l(P)[1])&&nt(dt)})}var Le=A(yt,2);{var je=nt=>{var Qe=Ye(),pt=ae(Qe);{var qt=Ht=>{Kc(Ht,ks(o,{get triggerClass(){return l(oe)}}))};K(pt,Ht=>{o()&&Ht(qt)})}x(nt,Qe)},qe=nt=>{{let Qe=w(()=>t()||""),pt=w(()=>!t()),qt=w(()=>l(F)?"w-full gap-1.5":void 0);Sl(nt,{variant:"ghost",get triggerClass(){return l(oe)},get value(){return r()},get repoPath(){return l(Qe)},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(F)},get triggerChevronClass(){return V},get triggerContentClass(){return l(qt)},onSkipIsolationChange:Ht=>v()?.(Ht),onGitHubAuthNeededChange:Ht=>m()?.(Ht),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return $()},onchange:vt})}};K(Le,nt=>{s()==="gitlab"?nt(je):nt(qe,-1)})}var Ct=A(Le,2);{var Ge=nt=>{var Qe=di(),pt=re(Qe,!0);N(()=>H(pt,l(F)?l(ue)[2]:l(P)[2])),x(nt,Qe)};K(Ct,nt=>{(l(F)?l(ue)[2]:l(P)[2])&&nt(Ge)})}x(me,tt)},Ne=me=>{Ys(me,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",get value(){return f().name},onchange:ze,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:G,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})},en=me=>{var tt=Y$(),St=ae(tt);{var sn=mt=>{var Nt=Dc(),Rn=ae(Nt);sp(Rn,{size:16,class:"text-ghost ml-0.75 -mb-px mr-2 shrink-0"});var wr=A(Rn,2);{var Br=ds=>{var xr=di(),un=re(xr,!0);N(()=>H(un,l(le)[0])),x(ds,xr)};K(wr,ds=>{l(le)[0]&&ds(Br)})}x(mt,Nt)};K(St,mt=>{l(F)||mt(sn)})}var jt=A(St,2);{let mt=w(()=>l(F)?G:O);Ys(jt,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",get value(){return f().name},onchange:ze,get triggerClass(){return l(Z)},get triggerValueClass(){return l(mt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var yt=A(jt,2);{var dt=mt=>{var Nt=G$(),Rn=re(Nt,!0);N(()=>H(Rn,l(le)[1])),x(mt,Nt)};K(yt,mt=>{l(le)[1]&&mt(dt)})}var Le=A(yt,2),je=re(Le,!0);Fl(Le,(mt,Nt)=>uf?.(mt,Nt),()=>l(de));var qe=A(Le,2);{var Ct=mt=>{var Nt=q$(),Rn=re(Nt,!0);N(()=>H(Rn,l(le)[2])),x(mt,Nt)};K(qe,mt=>{l(le)[2]&&mt(Ct)})}var Ge=A(qe,2),nt=re(Ge,!0),Qe=A(Ge,2);{var pt=mt=>{var Nt=J$(),Rn=re(Nt,!0);N(()=>H(Rn,l(le)[3])),x(mt,Nt)};K(Qe,mt=>{l(le)[3]&&mt(pt)})}var qt=A(Qe,2);{var Ht=mt=>{Je(mt,{variant:"ghost",type:"button",onclick:()=>v()?.(!c()),class:"flex items-center gap-1.5 ml-3 shrink-0 cursor-pointer",children:(Nt,Rn)=>{var wr=X$(),Br=ae(wr);Kp(Br,{get checked(){return c()},class:"-mb-0.5",onCheckedChange:un=>v()?.(un)});var ds=A(Br,2),xr=re(ds,!0);N(un=>H(xr,un),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),x(Nt,wr)},$$slots:{default:!0}})};K(qt,mt=>{typeof v()=="function"&&mt(Ht)})}N(()=>{H(je,l(de)),H(nt,f().branch||"main")}),x(me,tt)},Yn=me=>{Ys(me,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:ze,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:G,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})},vn=me=>{var tt=ev(),St=ae(tt);{var sn=Ct=>{var Ge=Dc(),nt=ae(Ge);Zo(nt,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var Qe=A(nt,2);{var pt=qt=>{var Ht=di(),mt=re(Ht,!0);N(()=>H(mt,l(j)[0])),x(qt,Ht)};K(Qe,qt=>{l(j)[0]&&qt(pt)})}x(Ct,Ge)};K(St,Ct=>{l(F)||Ct(sn)})}var jt=A(St,2);{let Ct=w(()=>l(F)?G:O);Ys(jt,{get gitlab(){return i()},get plainFolderMode(){return L()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:ze,get triggerClass(){return l(Z)},get triggerSuffix(){return l(Ie)},get triggerValueClass(){return l(Ct)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var yt=A(jt,2);{var dt=Ct=>{var Ge=di(),nt=re(Ge,!0);N(()=>H(nt,l(j)[1])),x(Ct,Ge)};K(yt,Ct=>{l(j)[1]&&Ct(dt)})}var Le=A(yt,2);{let Ct=w(()=>t()||""),Ge=w(()=>!t()),nt=w(()=>l(F)?"w-full gap-1.5":void 0);Sl(Le,{variant:"ghost",get triggerClass(){return l(oe)},get value(){return r()},get repoPath(){return l(Ct)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(Ge)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V},get triggerContentClass(){return l(nt)},onSkipIsolationChange:Qe=>v()?.(Qe),onGitHubAuthNeededChange:Qe=>m()?.(Qe),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return $()},onchange:vt})}var je=A(Le,2);{var qe=Ct=>{var Ge=di(),nt=re(Ge,!0);N(()=>H(nt,l(j)[2])),x(Ct,Ge)};K(je,Ct=>{l(j)[2]&&Ct(qe)})}x(me,tt)};K(_t,me=>{l(W)?me(se):S()==="repo"?me(Ze,1):S()==="branch"&&s()==="gitlab"?me(lt,2):S()==="branch"?me(et,3):l(Vt)?ee()&&s()==="local"?me(Bt,5):u()?me(Fe,6):(s()==="github"&&a()||s()==="gitlab")&&l(F)?me(Ke,7):s()==="github"&&a()||s()==="gitlab"?me(Yt,8):s()==="remote"&&f()&&l(F)?me(Ne,9):s()==="remote"&&f()?me(en,10):l(F)?me(Yn,11):me(vn,-1):me(bt,4)})}return Q(Ue),N(()=>at(Ue,1,Bn(l(W)?"grid min-w-0 gap-1":l(ge)))),x(n,Ue),Pt(we)}const e3=/^[\w.-]+\/[\w.-]+$/;function tv(n){return n.replace(/[\\/]+$/,"")||n.slice(0,1)}function nv(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 xB(n){switch(n.type){case"github":{const e=n.githubUrl&&nv(n.githubUrl)||(n.path&&e3.test(n.path.trim())?nv(n.path):null);return e?`github:${e}`:null}case"local":{const e=n.path?.trim();return e?`local:${tv(e)}`:null}case"remote":{const e=n.remote?.host?.trim().toLowerCase(),t=(n.remote?.workspacePath||n.path)?.trim();return e&&t?`remote:${e}:${tv(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 kB(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 ef="data:",rv=";base64,";function t3(n){if(!n.startsWith(ef))return null;const e=n.indexOf(rv,ef.length);if(e===-1)return null;const t=n.slice(ef.length,e),r=n.slice(e+rv.length);return!t.startsWith("image/")||r.length===0?null:{mimeType:t,data:r}}const sv=ha("image-context-items");let n3=0;const _B=30*1024*1024,SB=10*1024*1024;function r3(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 s3(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 CB(n,e){const{maxBytes:t,readFile:r=s3,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=t3(c);if(!u)throw new Error("Invalid data URL format");const{mimeType:d,data:f}=u,h=Date.now(),p=a.name||Ux(d,`image-${h}`);i.push({id:`file-upload-${h}-${++n3}-${p}`,type:"file",label:p,description:`${d} • ${r3(a.size)}`,path:p,file:a,imageData:f,imageMimeType:d,...vv(d)?{}:{placementFileName:p}})}catch(c){if(s?.aborted)return[];sv.error("Failed to add image to context",{fileName:a.name,error:c}),Rs.error(_.chat_richInput_addImageFailed_error({name:a.name}))}}return s?.aborted?[]:(i.length>0&&sv.debug(`Added ${i.length} image(s) to context`),o.length>0&&Rs.error(_.chat_richInput_filesTooLarge_error({names:o.join(", ")})),i)}var i3=B('<img class="w-full h-full object-cover"/>'),o3=B('<div class="flex size-full items-center justify-center bg-muted text-subtle"><!></div>'),a3=B("<div><!> <!></div> <!>",1),l3=B('<span class="tabular-nums opacity-70 shrink-0" data-testid="attachment-upload-progress"> </span>'),c3=B("<!> <!>",1),u3=B('<div class="w-4 h-4 rounded overflow-hidden shrink-0"><img class="w-full h-full object-cover"/></div>'),d3=B('<div><!> <span class="font-medium truncate max-w-30"> </span> <!> <!></div>');function f3(n,e){if(new.target)return It({component:f3,...n});Rt(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,"thumbnailClass",7,"w-16 h-16"),p=y(e,"disabled",7,!1),g=y(e,"placementStatus",7,void 0),v=y(e,"placementProgress",7,void 0),m=y(e,"placementError",7,void 0),C=y(e,"onRetry",7),$=he(null);const M=w(()=>vv(c()||s()||o()?.type));let S=he(null);const D=w(()=>l(M)?a()&&c()?`data:${Md(c())};base64,${a()}`:l(S):null);ut(()=>{if(l(M)&&!(a()&&c())&&o()){const z=URL.createObjectURL(o());return k(S,z,!0),()=>URL.revokeObjectURL(z)}k(S,null)});const I=w(()=>{if(s()==="folder")return ti;const z=Md(s()||c()||o()?.type);return z.startsWith("image")?Gc:z.includes("javascript")||z.includes("typescript")||z.includes("json")?of:z.includes("text")||z.includes("markdown")?nh:jo}),E=w(()=>Md(s()||c()||o()?.type).startsWith("image")),L=w(()=>{if(g()!=="failed")return;const z=_.chat_attachmentPreview_placementFailed_tooltip({name:r()});return m()?`${z} — ${m()}`:z}),ee=w(()=>{if(g()!=="placing"||v()===void 0)return;const z=Math.max(0,Math.min(1,v()));return av(z,{style:"percent",maximumFractionDigits:0})});let U=he(!1),ie=he(null);function F(){f()==="thumbnail"&&l(E)&&l(D)&&k(U,!0)}function W(z){(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),F())}function Y(z){z.stopPropagation(),u()?.(t())}var ce={get id(){return t()},set id(z){t(z),b()},get name(){return r()},set name(z){r(z),b()},get type(){return s()},set type(z=""){s(z),b()},get size(){return i()},set size(z){i(z),b()},get file(){return o()},set file(z){o(z),b()},get imageData(){return a()},set imageData(z){a(z),b()},get imageMimeType(){return c()},set imageMimeType(z){c(z),b()},get onRemove(){return u()},set onRemove(z){u(z),b()},get class(){return d()},set class(z=""){d(z),b()},get variant(){return f()},set variant(z="chip"){f(z),b()},get thumbnailClass(){return h()},set thumbnailClass(z="w-16 h-16"){h(z),b()},get disabled(){return p()},set disabled(z=!1){p(z),b()},get placementStatus(){return g()},set placementStatus(z=void 0){g(z),b()},get placementProgress(){return v()},set placementProgress(z=void 0){v(z),b()},get placementError(){return m()},set placementError(z=void 0){m(z),b()},get onRetry(){return C()},set onRetry(z){C(z),b()},$set:Lt,$on:(z,le)=>Ot(e,z,le)},pe=Ye(),j=ae(pe);{var ue=z=>{var le=a3(),ge=ae(le),ye=ne(ge);{let G=w(()=>_.chat_attachmentPreview_viewFullSize_ariaLabel({name:r()})),O=w(()=>p()||!l(D));Je(ye,{variant:"plain",wrapContent:!1,type:"button",get class(){return`${h()??""} rounded-lg overflow-hidden cursor-pointer hover:opacity-90 transition-opacity`},onclick:F,onkeydown:W,get"aria-label"(){return l(G)},get title(){return r()},get disabled(){return l(O)},get ref(){return l(ie)},set ref(te){k(ie,te,!0)},children:(te,ve)=>{var de=Ye(),fe=ae(de);{var ke=J=>{var Me=i3();N(()=>{ot(Me,"src",l(D)),ot(Me,"alt",r())}),To("error",Me,()=>k($,l(D),!0)),tf(Me),x(J,Me)},be=J=>{var Me=o3(),Be=ne(Me);rt(Be,{get icon(){return Gc},size:"15"}),Q(Me),x(J,Me)};K(fe,J=>{l(D)?J(ke):J(be,-1)})}x(te,de)},$$slots:{default:!0}})}var Z=A(ye,2);{var oe=G=>{{let O=w(()=>_.chat_attachmentPreview_remove_ariaLabel({name:r()}));Je(G,{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(O)},children:(te,ve)=>{rt(te,{get icon(){return Ji},size:"10"})},$$slots:{default:!0}})}};K(Z,G=>{u()&&G(oe)})}Q(ge);var V=A(ge,2);{let G=w(()=>l(D)??"");qv(V,{get imageUrl(){return l(G)},get imageName(){return r()},get openerElement(){return l(ie)},get open(){return l(U)},set open(O){k(U,O,!0)}})}N(()=>at(ge,1,`relative group shrink-0 ${d()??""}`)),Ps(1,ge,()=>rf,()=>({tier:"moderate",y:0,scale:.9})),Ps(2,ge,()=>sf,()=>({tier:"fast"})),x(z,le)},P=z=>{var le=d3(),ge=ne(le);{var ye=ke=>{var be=c3(),J=ae(be);pi(J,{size:15,class:"opacity-50 shrink-0"});var Me=A(J,2);{var Be=gt=>{var Ie=l3(),$e=re(Ie,!0);N(()=>H($e,l(ee))),x(gt,Ie)};K(Me,gt=>{l(ee)!==void 0&&gt(Be)})}x(ke,be)},Z=ke=>{rt(ke,{get icon(){return lv},size:"15",class:"shrink-0"})},oe=ke=>{var be=u3(),J=re(be);N(()=>{ot(J,"src",l(D)),ot(J,"alt",r())}),To("error",J,()=>k($,l(D),!0)),tf(J),x(ke,be)},V=ke=>{rt(ke,{get icon(){return l(I)},size:"15",class:"opacity-30 shrink-0"})};K(ge,ke=>{g()==="placing"?ke(ye):g()==="failed"?ke(Z,1):l(E)&&l(D)&&l($)!==l(D)?ke(oe,2):ke(V,-1)})}var G=A(ge,2),O=re(G,!0),te=A(G,2);{var ve=ke=>{{let be=w(()=>_.chat_attachmentPreview_retryPlacement_ariaLabel({name:r()}));Je(ke,{variant:"ghost-light",size:"icon-xs",class:"shrink-0 -my-1",onclick:J=>{J.stopPropagation(),C()(t())},get"aria-label"(){return l(be)},"data-testid":"attachment-retry",children:(J,Me)=>{rt(J,{get icon(){return eh},size:"10"})},$$slots:{default:!0}})}};K(te,ke=>{g()==="failed"&&C()&&ke(ve)})}var de=A(te,2);{var fe=ke=>{{let be=w(()=>g()==="failed"?"":"opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),J=w(()=>_.chat_attachmentPreview_removeAttachment_ariaLabel());Je(ke,{variant:"ghost-light",size:"icon-xs",get class(){return`shrink-0 ${l(be)??""} transition-opacity duration-spring-fast ease-spring-fast motion-reduce:transition-none -my-1 -mr-1`},onclick:()=>u()(t()),get"aria-label"(){return l(J)},children:(Me,Be)=>{rt(Me,{get icon(){return Ji},size:"10"})},$$slots:{default:!0}})}};K(de,ke=>{u()&&ke(fe)})}Q(le),N(()=>{at(le,1,`flex items-center gap-1.5 px-2 py-0.5 rounded text-xs whitespace-nowrap group shrink-0 ${g()==="failed"?"bg-danger-background/10 text-danger border border-danger/40":"bg-muted/70 text-subtle"} ${d()??""}`),ot(le,"data-placement-status",g()),ot(le,"title",l(L)),H(O,r())}),Ps(1,le,()=>rf,()=>({tier:"moderate",y:0,scale:.9})),Ps(2,le,()=>sf,()=>({tier:"fast"})),x(z,le)};K(j,z=>{f()==="thumbnail"&&l(E)&&l(M)&&(!l(D)||l($)!==l(D))?z(ue):z(P,-1)})}return x(n,pe),Pt(ce)}export{Xe as $,Fv as A,Sl as B,lR as C,pa as D,KA as E,_e as F,mo as G,Jf as H,SB as I,Wn as J,Lv as K,Z$ as L,ga as M,J0 as N,ph as O,HS as P,OC as Q,_B as R,Xt as S,cS as T,We as U,vB as V,fN as W,np as X,$v as Y,DP as Z,$P as _,f3 as a,kB as a$,iN as a0,hh as a1,Eb as a2,Ku as a3,Yc as a4,Jv as a5,Gv as a6,xB as a7,pB as a8,eB as a9,_L as aA,uw as aB,Z3 as aC,lB as aD,Ay as aE,gN as aF,Vv as aG,xn as aH,t3 as aI,Gu as aJ,Ea as aK,rB as aL,sB as aM,SD as aN,oB as aO,OD as aP,LD as aQ,ID as aR,TD as aS,AD as aT,RD as aU,ED as aV,iB as aW,wB as aX,BS as aY,_D as aZ,yB as a_,wn as aa,qL as ab,uB as ac,gB as ad,nB as ae,hB as af,dB as ag,aB as ah,JT as ai,Uv as aj,r3 as ak,Q3 as al,Z_ as am,Gp as an,rS as ao,Xc as ap,ht as aq,PO as ar,ca as as,tB as at,zh as au,Fh as av,bB as aw,CB as ax,mB as ay,fB as az,dR as b,zI as b0,DI as b1,vI as b2,bI as b3,fS as b4,gf as b5,hf as b6,Y3 as b7,Ga as b8,uL as c,qf as d,rO as e,Nr as f,rn as g,cw as h,Kn as i,pw as j,Bv as k,gh as l,Kv as m,qv as n,vw as o,gw as p,uc as q,mh as r,Xv as s,Dv as t,yr as u,wt as v,JA as w,fd as x,GI as y,An as z};