@intent-hq/web 2.355.0 → 2.355.1

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 (143) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{CQOzxS37.js → 1SLrhPyO.js} +1 -1
  3. package/web/app/immutable/chunks/{DRu2SmqZ.js → 2ZC36t6Y.js} +1 -1
  4. package/web/app/immutable/chunks/{DDrNrLrU.js → 4i5EVueM.js} +1 -1
  5. package/web/app/immutable/chunks/{ZdkLfBer.js → B5JG9cuN.js} +3 -3
  6. package/web/app/immutable/chunks/{CR5Y4liG.js → B5UEHKfc.js} +1 -1
  7. package/web/app/immutable/chunks/{NXv_P5Qh.js → B72MJ3vu.js} +1 -1
  8. package/web/app/immutable/chunks/{BtgXG1bI.js → B8V3vzpb.js} +1 -1
  9. package/web/app/immutable/chunks/{by6bEb9-.js → BCvsQuki.js} +1 -1
  10. package/web/app/immutable/chunks/{CYsqduek.js → BE6Tebnn.js} +1 -1
  11. package/web/app/immutable/chunks/{Cngz4SkV.js → BGKbam_q.js} +1 -1
  12. package/web/app/immutable/chunks/{CRPVb-NN.js → BHE9A9Ku.js} +1 -1
  13. package/web/app/immutable/chunks/{CPjDbn62.js → BHIhrgF3.js} +1 -1
  14. package/web/app/immutable/chunks/{Bdy7vCm7.js → BHV_SpF_.js} +1 -1
  15. package/web/app/immutable/chunks/{C6D71HVX.js → BIu3EK4M.js} +1 -1
  16. package/web/app/immutable/chunks/{FfneHBLs.js → BKPuOauG.js} +1 -1
  17. package/web/app/immutable/chunks/{DLMRD5TK.js → BLIddJz7.js} +1 -1
  18. package/web/app/immutable/chunks/{DVWLaxba.js → BLep2lYT.js} +1 -1
  19. package/web/app/immutable/chunks/{BnqQcpEI.js → BMG-wHCR.js} +1 -1
  20. package/web/app/immutable/chunks/{D1DEK8H6.js → BMdFflzZ.js} +1 -1
  21. package/web/app/immutable/chunks/{qj_ON81L.js → BQ1baLcx.js} +1 -1
  22. package/web/app/immutable/chunks/{hERCQx8m.js → BRbLIP91.js} +1 -1
  23. package/web/app/immutable/chunks/{CG3T6SOf.js → BTiw_PQQ.js} +1 -1
  24. package/web/app/immutable/chunks/{D6mw8KEc.js → BXaHAPIM.js} +1 -1
  25. package/web/app/immutable/chunks/{C6w2676x.js → BXopNUzR.js} +1 -1
  26. package/web/app/immutable/chunks/{CO9yyopN.js → BYQLxhbC.js} +1 -1
  27. package/web/app/immutable/chunks/{DaoeY9LL.js → BZ5mOiI-.js} +4 -4
  28. package/web/app/immutable/chunks/{BAUmJitx.js → BbzW_OaY.js} +1 -1
  29. package/web/app/immutable/chunks/{BvDhoV5o.js → Bl9yzXPP.js} +1 -1
  30. package/web/app/immutable/chunks/{C7UD9DTe.js → BoHKKVF_.js} +1 -1
  31. package/web/app/immutable/chunks/{CY3bfIXG.js → Bun1NnOh.js} +1 -1
  32. package/web/app/immutable/chunks/{k2N4NU1e.js → BwSRi0uX.js} +1 -1
  33. package/web/app/immutable/chunks/{BxEOqX92.js → BwUXkhFN.js} +2 -2
  34. package/web/app/immutable/chunks/{Di9HvUJO.js → BxggGvVh.js} +1 -1
  35. package/web/app/immutable/chunks/{Bw7J4KV9.js → Bxhar1lK.js} +1 -1
  36. package/web/app/immutable/chunks/{C7viSic6.js → C0WbqnMl.js} +1 -1
  37. package/web/app/immutable/chunks/{5dP06dgt.js → C0dDMWyG.js} +1 -1
  38. package/web/app/immutable/chunks/{D_AW5_kx.js → C1NTmdzU.js} +1 -1
  39. package/web/app/immutable/chunks/{B1XU-ZD5.js → C1ZyPKke.js} +1 -1
  40. package/web/app/immutable/chunks/{DCaO1n-G.js → C1ymNXYM.js} +1 -1
  41. package/web/app/immutable/chunks/{TH1qr9eA.js → C2Biyw3j.js} +1 -1
  42. package/web/app/immutable/chunks/{DYtlrgPM.js → C9mvCLYS.js} +1 -1
  43. package/web/app/immutable/chunks/{Cq29Q7UD.js → CAv7yxiQ.js} +1 -1
  44. package/web/app/immutable/chunks/{DC3A_b9e.js → CBiyyn5t.js} +2 -2
  45. package/web/app/immutable/chunks/{DUPxOfKr.js → CCIeFHqh.js} +2 -2
  46. package/web/app/immutable/chunks/{CMSbEsNG.js → CCqa4XPE.js} +1 -1
  47. package/web/app/immutable/chunks/{C9GcP6Mx.js → CDjHQ3KR.js} +1 -1
  48. package/web/app/immutable/chunks/{BIpPAEmZ.js → CEdeKEH5.js} +1 -1
  49. package/web/app/immutable/chunks/{BYp96700.js → CFQNYbfN.js} +1 -1
  50. package/web/app/immutable/chunks/{RjC8XXem.js → CGue0_9O.js} +1 -1
  51. package/web/app/immutable/chunks/{D2WHu0uY.js → CJR-fJTC.js} +1 -1
  52. package/web/app/immutable/chunks/{D_J0qIRM.js → CKBKzqDD.js} +1 -1
  53. package/web/app/immutable/chunks/{CD7UFjMG.js → CMYENl61.js} +1 -1
  54. package/web/app/immutable/chunks/{DZoAvL0T.js → CO531tLI.js} +2 -2
  55. package/web/app/immutable/chunks/{D-G_JMag.js → COcPdiz-.js} +1 -1
  56. package/web/app/immutable/chunks/{DtWyzoyb.js → CPxXU1c_.js} +1 -1
  57. package/web/app/immutable/chunks/{CrsAEKLD.js → CRBm_KYe.js} +1 -1
  58. package/web/app/immutable/chunks/{BMxVcrc0.js → CRHxLu94.js} +1 -1
  59. package/web/app/immutable/chunks/{Dgmf6bXZ.js → CSor2xJT.js} +1 -1
  60. package/web/app/immutable/chunks/{CAEUGHBT.js → CTZYeLTN.js} +1 -1
  61. package/web/app/immutable/chunks/{BYBXBR1N.js → CTmPV4px.js} +1 -1
  62. package/web/app/immutable/chunks/{DyOfGZJq.js → CXpE7H_z.js} +1 -1
  63. package/web/app/immutable/chunks/{Dm1FlVyV.js → C__IofCN.js} +1 -1
  64. package/web/app/immutable/chunks/{Dl6iJg2m.js → Cfxk9qsj.js} +1 -1
  65. package/web/app/immutable/chunks/{D8EgnPWP.js → CiNDhRnQ.js} +1 -1
  66. package/web/app/immutable/chunks/{CCnb8u7s.js → CkojcfYz.js} +1 -1
  67. package/web/app/immutable/chunks/{PRsCy7Qn.js → Clbb1Quu.js} +1 -1
  68. package/web/app/immutable/chunks/{B-wDyvq6.js → CmIH9pPA.js} +1 -1
  69. package/web/app/immutable/chunks/{DctTjn6B.js → CnXKtYEY.js} +2 -2
  70. package/web/app/immutable/chunks/{sOLB01Xt.js → Cr4Z84ZQ.js} +1 -1
  71. package/web/app/immutable/chunks/{fudQlx_N.js → CwV6KdwG.js} +4 -4
  72. package/web/app/immutable/chunks/{B8_K0Ghc.js → D1dKOodV.js} +1 -1
  73. package/web/app/immutable/chunks/{jycTRRr5.js → D2rJR8Kd.js} +1 -1
  74. package/web/app/immutable/chunks/{Bgxu_Ykz.js → D3XAqchb.js} +1 -1
  75. package/web/app/immutable/chunks/{B9hBNK3g.js → D5-76Omb.js} +3 -3
  76. package/web/app/immutable/chunks/{D553PbG6.js → D50spOQl.js} +1 -1
  77. package/web/app/immutable/chunks/{Bml5bnEZ.js → D7r3X1aQ.js} +4 -4
  78. package/web/app/immutable/chunks/{DJfkZVoc.js → D8PRNAXi.js} +1 -1
  79. package/web/app/immutable/chunks/{Dt8ynTh_.js → D9KC2q61.js} +1 -1
  80. package/web/app/immutable/chunks/{BLwi8VLk.js → DBVCVTUu.js} +1 -1
  81. package/web/app/immutable/chunks/{CjamSASN.js → DMUY6wr5.js} +1 -1
  82. package/web/app/immutable/chunks/{_0Akk0N0.js → DNrb54jP.js} +1 -1
  83. package/web/app/immutable/chunks/{DLpY8t6L.js → DRLHEDtz.js} +3 -3
  84. package/web/app/immutable/chunks/{C7SD_h7y.js → DU4lRwyV.js} +1 -1
  85. package/web/app/immutable/chunks/{D6ipXFWq.js → DUbC3YzM.js} +1 -1
  86. package/web/app/immutable/chunks/{Ddr1cDmN.js → DVSI7mFz.js} +1 -1
  87. package/web/app/immutable/chunks/{dFx_WDK9.js → DXABAlso.js} +2 -2
  88. package/web/app/immutable/chunks/{XrSyKhRq.js → Dfr1lQjm.js} +1 -1
  89. package/web/app/immutable/chunks/{DZXtxMhn.js → DgjOoN_L.js} +3 -3
  90. package/web/app/immutable/chunks/{CL0gh7eK.js → DhCMgQKK.js} +1 -1
  91. package/web/app/immutable/chunks/{Bh0MKrtC.js → DhZb2otX.js} +2 -2
  92. package/web/app/immutable/chunks/{CdJ-iQAl.js → Dk-bN4j5.js} +1 -1
  93. package/web/app/immutable/chunks/{DmU6qPbC.js → DmbFU-Mr.js} +1 -1
  94. package/web/app/immutable/chunks/{C8dy9jKV.js → DopZSVYu.js} +3 -3
  95. package/web/app/immutable/chunks/{CfTDrXA4.js → Drm-NnN7.js} +1 -1
  96. package/web/app/immutable/chunks/{DdxORfnM.js → DsxARKI6.js} +1 -1
  97. package/web/app/immutable/chunks/{DyOpBWO8.js → DtPkoBHn.js} +1 -1
  98. package/web/app/immutable/chunks/{Xy4NAXmR.js → DtjTeVR3.js} +1 -1
  99. package/web/app/immutable/chunks/{B61jFDO7.js → Dvrk45ey.js} +1 -1
  100. package/web/app/immutable/chunks/{0Mjcgdi0.js → Dxky5vdm.js} +1 -1
  101. package/web/app/immutable/chunks/{Bm6HvQFF.js → Et4hs9LJ.js} +1 -1
  102. package/web/app/immutable/chunks/{Ct4AnE7x.js → GYf7TgLR.js} +1 -1
  103. package/web/app/immutable/chunks/{CxusERHp.js → LMcS9iRR.js} +1 -1
  104. package/web/app/immutable/chunks/{3mLiyzqh.js → MbKR475z.js} +12 -12
  105. package/web/app/immutable/chunks/{CBdpCMGg.js → N-kFoWep.js} +1 -1
  106. package/web/app/immutable/chunks/{CWGWxjkW.js → NBerdmKr.js} +1 -1
  107. package/web/app/immutable/chunks/{ClOnGfh3.js → OiAhH10D.js} +1 -1
  108. package/web/app/immutable/chunks/{D_1OUHe5.js → QyVBgWLE.js} +1 -1
  109. package/web/app/immutable/chunks/{lXkefv0c.js → R5yad3fN.js} +1 -1
  110. package/web/app/immutable/chunks/{B76B2CEw.js → RGAGry1B.js} +1 -1
  111. package/web/app/immutable/chunks/{DJhxftTm.js → VjUdQEa_.js} +2 -2
  112. package/web/app/immutable/chunks/{1en6Nskf.js → Vjje40Nh.js} +1 -1
  113. package/web/app/immutable/chunks/{B3RPp65M.js → Wr7HSEko.js} +1 -1
  114. package/web/app/immutable/chunks/{B8AiWRnD.js → baTnhfkt.js} +57 -57
  115. package/web/app/immutable/chunks/{DXbxXgMb.js → cVDYGNk_.js} +1 -1
  116. package/web/app/immutable/chunks/{BE4fmbrd.js → d49NjlCP.js} +1 -1
  117. package/web/app/immutable/chunks/{D0r9nh2D.js → e_SMT_cB.js} +1 -1
  118. package/web/app/immutable/chunks/{SnkT67dh.js → fdHhQhtv.js} +1 -1
  119. package/web/app/immutable/chunks/{9bB63VdN.js → glNSRCnV.js} +1 -1
  120. package/web/app/immutable/chunks/{B1ZZGqDR.js → hG4jjZYI.js} +1 -1
  121. package/web/app/immutable/chunks/{Ck3PfCWY.js → i609sim6.js} +1 -1
  122. package/web/app/immutable/chunks/{Derdn26w.js → iiHO66OG.js} +1 -1
  123. package/web/app/immutable/chunks/{DDxnJah0.js → pNljm9DY.js} +1 -1
  124. package/web/app/immutable/chunks/{DzLsS9D8.js → prO6MIJE.js} +1 -1
  125. package/web/app/immutable/chunks/{CZoruBq7.js → xaGNRYm_.js} +2 -2
  126. package/web/app/immutable/entry/{app.DsedXxCq.js → app.C7Gp5ffn.js} +2 -2
  127. package/web/app/immutable/entry/start.DtQdIacO.js +1 -0
  128. package/web/app/immutable/nodes/{0.DFm0uMPD.js → 0.DIDJMd84.js} +1 -1
  129. package/web/app/immutable/nodes/{1.CwLJr2Fx.js → 1.CEx193fD.js} +1 -1
  130. package/web/app/immutable/nodes/{10.DUkyiyGM.js → 10.CL_rI79-.js} +1 -1
  131. package/web/app/immutable/nodes/{14.DuebugBg.js → 14.CCcTMEGX.js} +1 -1
  132. package/web/app/immutable/nodes/{18.DoKSJAmC.js → 18.p26LUwMf.js} +2 -2
  133. package/web/app/immutable/nodes/{2.Bxl6SY_3.js → 2.CoVXK-19.js} +4 -4
  134. package/web/app/immutable/nodes/{3.Bjzt-5x5.js → 3.BRZLUORO.js} +1 -1
  135. package/web/app/immutable/nodes/{4.DbwSRbcy.js → 4.VF3kCDJt.js} +1 -1
  136. package/web/app/immutable/nodes/{5.CeIP8x-e.js → 5.CSUxVeR1.js} +1 -1
  137. package/web/app/immutable/nodes/{6.m9XvDOSk.js → 6.dTQ4Ln2C.js} +1 -1
  138. package/web/app/immutable/nodes/{7.CkOI-QWK.js → 7.AOpiD-Qu.js} +1 -1
  139. package/web/app/immutable/nodes/{8.D324-VCX.js → 8.ByKmjaRv.js} +4 -4
  140. package/web/app/immutable/nodes/{9.CoElnN-I.js → 9.DlsfDUD5.js} +4 -4
  141. package/web/app/version.json +1 -1
  142. package/web/index.html +9 -9
  143. package/web/app/immutable/entry/start.WXVbrDoR.js +0 -1
@@ -1,39 +1,39 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BU46x7E3.js","/app/immutable/chunks/CVtvGnj8.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/CGpelL0C.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/BE35_Kwj.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/BT-leRNV.js","/app/immutable/chunks/CR_DYxzQ.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/BlKpyqxv.js","/app/immutable/chunks/CQNY8AIr.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/B64lZ_-k.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/BooXdurD.js","/app/immutable/chunks/BwmV4u5a.js","/app/immutable/chunks/PnRQRSpt.js","/app/immutable/chunks/tOQ0MdfM.js","/app/immutable/chunks/DKs05YEr.js","/app/immutable/chunks/DGvhYwwC.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/CeW1xZTK.js","/app/immutable/chunks/sj0eQTm1.js","/app/immutable/chunks/BYrBvRoU.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CXWGcPvu.js","/app/immutable/chunks/DBWsr7gt.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/6uQ5KuWX.js","/app/immutable/chunks/Co2eSgEE.js","/app/immutable/chunks/BRi4x9cL.js","/app/immutable/chunks/BVCXyPuq.js","/app/immutable/chunks/ps4UtGok.js","/app/immutable/chunks/Cd3Pq_q3.js","/app/immutable/assets/register.CUyDR59i.css","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/Bjx82_QL.js","/app/immutable/assets/terminal-manager.MhP_vFvK.css","/app/immutable/chunks/DtWyzoyb.js","/app/immutable/chunks/B8_K0Ghc.js","/app/immutable/chunks/Hx_Q5ZY_.js","/app/immutable/chunks/CDX6j4QU.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/CN90kKWF.js","/app/immutable/chunks/BMJmYye_.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/rfzg_0PW.js","/app/immutable/chunks/DIlUp7xT.js","/app/immutable/chunks/CTZhg0JI.js","/app/immutable/chunks/DC3A_b9e.js","/app/immutable/chunks/DctTjn6B.js","/app/immutable/chunks/BYBXBR1N.js","/app/immutable/chunks/dFx_WDK9.js","/app/immutable/chunks/CL0gh7eK.js","/app/immutable/chunks/CMSbEsNG.js"])))=>i.map(i=>d[i]);
2
- var zw=Object.defineProperty;var bp=n=>{throw TypeError(n)};var Fw=(n,e,t)=>e in n?zw(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var rt=(n,e,t)=>Fw(n,typeof e!="symbol"?e+"":e,t),yp=(n,e,t)=>e.has(n)||bp("Cannot "+t);var ts=(n,e,t)=>(yp(n,e,"read from private field"),t?t.call(n):e.get(n)),ao=(n,e,t)=>e.has(n)?bp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),wp=(n,e,t,r)=>(yp(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t);import{aa as Hw,cd as Uw,bK as xp,Q as kp,bJ as _p,O as Sp,at as Vw,by as Ww,au as jw,aE as Kw,bo as Ji,bs as It,a7 as Ze,ay as ue,W as x,bn as Lt,aA as b,aD as l,a5 as ne,bf as Jr,bA as Y,c9 as w,aB as B,bH as k,bS as A,b_ as L,bl as se,bO as H,cb as Gw,bV as he,aw as To,bz as tf,be as Pt,b$ as zt,aC as Xi,bv as Cp,al as qw,ai as Ro,ca as ct,aj as qr,br as Sr,bb as kl,c3 as uo,aG as Jw,bk as Fu,c0 as Qo,bj as tc,c5 as Xs}from"./DYhIMPy1.js";import{dS as rv,G as Xw,F as Yw,Z as Qw,R as Jf,S as Zw,i as nf,aC as e1,ab as t1,U as n1,dT as r1,a0 as s1,ca as Xf,cE as kd,b_ as i1,cS as o1,aT as a1,cD as l1}from"./BwmV4u5a.js";import{t as Ot,bo as y,bw as Nt,b as Dt,bp as Yi,bm as _,br as gs,bu as Mp,bq as Ka,bs as nn,_ as ps}from"./CVtvGnj8.js";import{t as hs,I as Ms,g as c1,i as sv,u as iv,j as u1,v as d1,F as rf,c as sf,D as Ho,s as f1,l as h1}from"./sj0eQTm1.js";import{az as ov,cP as p1,ay as g1,bD as m1,F as tt,c$ as Ki,bk as Qs,bq as Yf,br as Qf,aO as v1,aP as _d,bT as b1,bU as y1,cm as w1,bC as Kc,cn as Zf,aW as av,a5 as lv,co as x1,aw as k1,at as sa,b8 as _1,bs as eh,be as th,t as S1,bB as C1,aF as Tp,bd as Wo,cV as cv,cS as M1,cj as uv,cG as dv,ah as T1,as as fv,av as Ep,am as E1,ag as A1,ap as R1,cT as P1,aK as Sd,ck as I1,bu as L1,c7 as O1,cu as Ap,T as N1,cD as D1,aq as $1,bR as B1,an as z1,c3 as F1,bK as H1,cW as U1,ai as V1,bi as W1,aY as j1,c_ as K1,aj as G1,bP as q1,aQ as J1,aZ as X1,bZ as Y1,ba as Q1,ct as Z1,cz as ex,bO as tx,bl as nx,bf as of,aI as rx,a_ as sx,w as ix,b7 as ox,cl as Rp,aN as ax,ar as hv,bx as pv,a9 as lx,c9 as Gc,Z as cx}from"./PnRQRSpt.js";import{aJ as ux,az as dx,av as fx,ai as hx,Q as px,c_ as gx,aE as mx,cM as Pp,aR as Ip,cw as vx,aG as Lp,s as wa,ap as bx,a2 as yx,cV as wx,aU as xx,a5 as kx,bN as _x,bO as Sx,bM as Cx,cD as Mx,cz as Tx,cx as Ex,cJ as Ax,cL as Rx,cI as Px,cy as Ix,ce as Lx,aC as Cd,ax as Op,Y as Ox,T as ll,O as Nx,ay as Dx,X as $x,m as Bx,V as zx,a6 as Fx,al as gv,j as Md}from"./9bB63VdN.js";import{b as Ga,e as Cr,g as Gi,f as at,c as $n,s as st}from"./BT-leRNV.js";import{s as Xn}from"./CR_DYxzQ.js";import{h as mv}from"./BU46x7E3.js";import{a as Hx,z as da,P as Ux,p as nh,h as rh,i as jo,K as vv,l as bv,M as sh,u as Vx,s as Wx,v as yv,L as zo,H as jx,R as Kx,k as Gx,d as qx,f as Jx,e as Xx,E as Yx}from"./FYq6LgZ3.js";import{i as j}from"./DKs05YEr.js";import{az as qc,av as Ko,aQ as wv,an as Qx,at as Zx,ar as ek,aq as tk,ay as nk,aS as Np,af as rk,ak as sk,al as ik,a1 as xv,ai as ok,aj as ak,f as qe,aT as lk,aB as ck,ao as uk,aw as dk,ab as fk,ae as Hu}from"./CDX6j4QU.js";import{i as kv,f as hk,I as rs,a as pk}from"./CF1bQLZh.js";import"./DQh0old4.js";import{c as wt}from"./tOQ0MdfM.js";import{b as sr}from"./BaIAhI85.js";import{a as _v}from"./CC7to1B5.js";import{e as gk,g as mk}from"./Dg5rAMu7.js";import{h as vk,e as $l,g as ss,i as Nc,I as fi}from"./DGvhYwwC.js";import{f as bk,k as Cs,t as Dp}from"./Hx_Q5ZY_.js";import{c as fa,l as St}from"./ChTqQfQN.js";import"./BMJmYye_.js";import{nk as yk,e as Dc,IA as At,nx as wk,bf as Sv,BQ as $p,rt as xk,n9 as kk,y4 as _k,qA as af,Iq as Sk,ec as Bp,fT as Ck,ny as ih,i as Mk,qm as Cv,qq as Tk,J0 as Ek,s9 as zp,Lg as Ak,Lv as Rk,qr as Pk,Lu as Ik,Lf as Lk,Ck as Ok,H0 as Nk,yI as Dk,k2 as $k,H6 as Bk}from"./CQNY8AIr.js";import{p as zk,o as Mv,w as Fp,e as Fk,t as Hk,y as oh,L as Uk,S as Vk,x as Wk,k as jk,P as Kk,s as Uu,l as Vu,C as ah,X as dn,m as Wu,H as Tv,B as Gk,G as qk,f as lf,z as cf,T as Jk,q as Xk,r as Hp,D as Yk,O as Qk,F as Zk,j as e_}from"./DUPxOfKr.js";import{t as uf,k as lh,O as xa,M as Ev}from"./BgPqfjSP.js";import{cu as Jc,I as Up,bJ as t_,bQ as n_,Y as Vp,aQ as Av,aR as r_,aO as s_,aP as i_,aU as o_}from"./B8_K0Ghc.js";import{a as ch,m as a_,u as ju}from"./ChC2njK7.js";import{c5 as l_,ay as c_,J as u_}from"./DIlUp7xT.js";import{g as d_}from"./CMiilI_P.js";import{N as Rv,G as f_,z as h_}from"./CGpelL0C.js";import"./BLLNPhaG.js";import{I as Ku}from"./lkH5RFQO.js";import{d as Uo}from"./DBWsr7gt.js";import{s as p_,C as Wp}from"./CoRl8mzp.js";import"./BtTrP9fj.js";import"./7NnWOZ1A.js";import"./BMGEbk-i.js";import{i as Td}from"./rfzg_0PW.js";import{b as g_,c as _l,T as Pv}from"./BxLr8uYz.js";import{k as uh}from"./CN90kKWF.js";import{d as m_}from"./BYBXBR1N.js";function J3(n,e){var t=Sp,r=kp,s=n();return{subscribe:Uw(s,o=>{var a=s!==n(),c,u=kp,d=Sp;xp(r),_p(t);try{c=Vw(()=>{Ww(()=>{const f=n();a&&o(f)})})}finally{xp(u),_p(d)}return a=!0,c}).subscribe}}function X3(n){let e;const t=Hw(s=>{let i=!1;const o=n.subscribe(a=>{e=a,i&&s()});return i=!0,o});function r(){return jw()?(t(),e):Kw(n)}return"set"in n?{get current(){return r()},set current(s){n.set(s)}}:{get current(){return r()}}}var v_=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","value"]),b_=B("<div><!></div>");function Iv(n,e){const t=Ji();if(new.target)return Ot({component:Iv,...n});It(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>qc(t)),o=y(e,"ref",15,null),a=y(e,"value",7),c=Yi(e,v_);const u=zk.create({value:Ko(()=>a()),id:Ko(()=>i()),ref:Ko(()=>o(),v=>o(v))}),d=w(()=>wv(c,u.props));var f={get children(){return r()},set children(v){r(v),b()},get child(){return s()},set child(v){s(v),b()},get id(){return i()},set id(v=qc(t)){i(v),b()},get ref(){return o()},set ref(v=null){o(v),b()},get value(){return a()},set value(v){a(v),b()},$set:Nt,$on:(v,C)=>Dt(e,v,C)},h=Ze(),p=ue(h);{var g=v=>{var C=Ze(),z=ue(C);Xn(z,s,()=>({props:l(d)})),x(v,C)},m=v=>{var C=b_();Ga(C,()=>({...l(d)}));var z=ne(C);Xn(z,()=>r()??Jr),Y(C),x(v,C)};j(p,v=>{s()?v(g):v(m,-1)})}return x(n,h),Lt(f)}const y_=nk({component:"toggle",parts:["root"]});var Jl,Xl;const ip=class ip{constructor(e){rt(this,"opts");rt(this,"attachment");ao(this,Jl,w(()=>({pressed:this.opts.pressed.current})));ao(this,Xl,w(()=>({[y_.root]:"",id:this.opts.id.current,"data-disabled":tk(this.opts.disabled.current),"aria-pressed":ek(this.opts.pressed.current),"data-state":w_(this.opts.pressed.current),disabled:Zx(this.opts.disabled.current),onclick:this.onclick,...this.attachment})));this.opts=e,this.attachment=Qx(this.opts.ref),this.onclick=this.onclick.bind(this)}static create(e){return new ip(e)}onclick(e){this.opts.disabled.current||(this.opts.pressed.current=!this.opts.pressed.current)}get snippetProps(){return l(ts(this,Jl))}set snippetProps(e){k(ts(this,Jl),e)}get props(){return l(ts(this,Xl))}set props(e){k(ts(this,Xl),e)}};Jl=new WeakMap,Xl=new WeakMap;let df=ip;function w_(n){return n?"on":"off"}var x_=new Set(["$$slots","$$events","$$legacy","ref","id","pressed","onPressedChange","disabled","type","children","child"]),k_=B("<button><!></button>");function Lv(n,e){const t=Ji();if(new.target)return Ot({component:Lv,...n});It(e,!0);let r=y(e,"ref",15,null),s=y(e,"id",23,()=>qc(t)),i=y(e,"pressed",15,!1),o=y(e,"onPressedChange",7,Np),a=y(e,"disabled",7,!1),c=y(e,"type",7,"button"),u=y(e,"children",7),d=y(e,"child",7),f=Yi(e,x_);const h=df.create({pressed:Ko(()=>i(),M=>{i(M),o()(M)}),disabled:Ko(()=>a()??!1),id:Ko(()=>s()),ref:Ko(()=>r(),M=>r(M))}),p=w(()=>wv(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=qc(t)){s(M),b()},get pressed(){return i()},set pressed(M=!1){i(M),b()},get onPressedChange(){return o()},set onPressedChange(M=Np){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:Nt,$on:(M,S)=>Dt(e,M,S)},m=Ze(),v=ue(m);{var C=M=>{var S=Ze(),O=ue(S);{let N=w(()=>({props:l(p),...h.snippetProps}));Xn(O,d,()=>l(N))}x(M,S)},z=M=>{var S=k_();Ga(S,()=>({...l(p)}));var O=ne(S);Xn(O,()=>u()??Jr,()=>h.snippetProps),Y(S),x(M,S)};j(v,M=>{d()?M(C):M(z,-1)})}return x(n,m),Lt(g)}var __=B('<h4 class="type-body font-medium"> </h4>'),S_=B('<div class="flex items-start gap-2"><!> <!></div>'),C_=B("<p> </p>"),M_=B('<div class="type-caption"><!></div>'),T_=B("<div><!></div>"),E_=B("<div></div>"),A_=B('<div class="relative"><!> <div><!> <!> <!></div> <!></div> <!>',1),R_=B("<!><!>",1);function dh(n,e){if(new.target)return Ot({component:dh,...n});It(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),m=y(e,"class",7,""),v=y(e,"contentClass",7,""),C=y(e,"contentContainerClass",7,""),z=y(e,"showArrow",7,!0),M=y(e,"showClose",7,!1),S=y(e,"onClose",7),O=y(e,"variant",7,"default"),N=y(e,"maxWidth",7,"20rem"),E=y(e,"interactive",7,!1),D=y(e,"disableAnimation",7,!1),ee=y(e,"children",7),U=y(e,"trigger",7),oe=y(e,"icon",7),F=y(e,"footer",7),W=y(e,"iconClass",7,""),X=y(e,"footerClass",7,""),le=y(e,"descriptionClass",7,""),re=y(e,"onclick",7);const Q={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:m1,iconColor:"text-info"},success:{bg:"bg-popover",text:"text-success",border:"border border-success/40",icon:g1,iconColor:"text-success"},warning:{bg:"bg-popover",text:"text-warning-ink",border:"border border-warning/40",icon:p1,iconColor:"text-warning-ink"},error:{bg:"bg-danger",text:"text-danger-background",border:"border border-danger/40",icon:ov,iconColor:"text-danger-background"},custom:{bg:"",text:"",border:"",icon:null,iconColor:""}},me=w(()=>Q[O()]),P=w(()=>oe()||l(me).icon),$=w(()=>Cr("overlay-surface z-(--layer-tooltip)",!D()&&"tooltip-motion",l(me).bg,l(me).text,l(me).border,v()));function ce(V){p(V),g()?.(V)}function pe(){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 m()},set class(V=""){m(V),b()},get contentClass(){return v()},set contentClass(V=""){v(V),b()},get contentContainerClass(){return C()},set contentContainerClass(V=""){C(V),b()},get showArrow(){return z()},set showArrow(V=!0){z(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 O()},set variant(V="default"){O(V),b()},get maxWidth(){return N()},set maxWidth(V="20rem"){N(V),b()},get interactive(){return E()},set interactive(V=!1){E(V),b()},get disableAnimation(){return D()},set disableAnimation(V=!1){D(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 oe()},set icon(V){oe(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 X()},set footerClass(V=""){X(V),b()},get descriptionClass(){return le()},set descriptionClass(V=""){le(V),b()},get onclick(){return re()},set onclick(V){re(V),b()},$set:Nt,$on:(V,K)=>Dt(e,V,K)},Z=Ze(),ae=ue(Z);{let V=w(()=>E()?0:u());wt(ae,()=>ak,(K,I)=>{I(K,{get delayDuration(){return l(V)},children:(te,ve)=>{var de=Ze(),fe=ue(de);{let ke=w(()=>E()?0:u()),be=w(()=>!E()&&d());wt(fe,()=>rk,(q,Me)=>{Me(q,{onOpenChange:ce,get delayDuration(){return l(ke)},get disableHoverableContent(){return l(be)},get disableCloseOnTriggerClick(){return f()},get open(){return p()},set open(ze){p(ze)},children:(ze,gt)=>{var Le=R_(),De=ue(Le);{const Vt=(Pe,Ce)=>{let we=()=>(Ce?.()).props;ik(Pe,{get triggerProps(){return we()},children:(Ve,Mt)=>{var ie=Ze(),$e=ue(ie);{var lt=mt=>{var Tt=Ze(),We=ue(Tt);Xn(We,()=>U()??Jr),x(mt,Tt)},yt=mt=>{var Tt=Ze(),We=ue(Tt);Xn(We,()=>ee()??Jr),x(mt,Tt)};j($e,mt=>{U()?mt(lt):ee()&&mt(yt,1)})}x(Ve,ie)},$$slots:{default:!0}})};let nt=w(()=>Cr("inline-flex",m()));wt(De,()=>sk,(Pe,Ce)=>{Ce(Pe,{get class(){return l(nt)},get disabled(){return h()},get onclick(){return re()},"data-tooltip-trigger":!0,child:Vt,$$slots:{child:!0}})})}var Fe=A(De);{var vt=Vt=>{var nt=Ze(),Pe=ue(nt);wt(Pe,()=>xv,(Ce,we)=>{we(Ce,{children:(Ve,Mt)=>{var ie=Ze(),$e=ue(ie);wt($e,()=>ok,(lt,yt)=>{yt(lt,{role:"tooltip",get side(){return i()},get align(){return o()},get sideOffset(){return a()},get alignOffset(){return c()},get class(){return l($)},"data-tooltip-content":!0,"data-overlay-surface":!0,onFocusOutside:()=>{},children:(mt,Tt)=>{var We=A_(),Ge=ue(We),Yt=ne(Ge);{var Be=He=>{{let Xe=w(()=>_.ui_tooltipRich_close_ariaLabel());qe(He,{variant:"ghost",size:"icon-compact",onclick:pe,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(Xe)},children:(pt,Qe)=>{tt(pt,{get icon(){return Ki},size:"xs",class:"w-3 h-3"})},$$slots:{default:!0}})}};j(Yt,He=>{M()&&He(Be)})}var jt=A(Yt,2),Yn=ne(jt);{var Bn=He=>{var Xe=S_(),pt=ne(Xe);{var Qe=xt=>{{let Ft=w(()=>Cr("w-4 h-4 mt-0.5 flex-shrink-0",l(me).iconColor,W()));tt(xt,{get icon(){return l(P)},size:"1x",get class(){return l(Ft)}})}};j(pt,xt=>{l(P)&&xt(Qe)})}var et=A(pt,2);{var it=xt=>{var Ft=__(),$t=se(Ft,!0);L(()=>H($t,t())),x(xt,Ft)};j(et,xt=>{t()&&xt(it)})}Y(Xe),x(He,Xe)};j(Yn,He=>{(t()||l(P))&&He(Bn)})}var ge=A(Yn,2);{var ft=He=>{var Xe=C_(),pt=se(Xe,!0);L(Qe=>{at(Xe,1,Qe),H(pt,r())},[()=>$n(Cr("type-body opacity-90",le()))]),x(He,Xe)};j(ge,He=>{r()&&He(ft)})}var Rt=A(ge,2);{var an=He=>{var Xe=M_(),pt=ne(Xe);Xn(pt,()=>s()??Jr),Y(Xe),x(He,Xe)};j(Rt,He=>{s()&&He(an)})}Y(jt);var Gt=A(jt,2);{var ut=He=>{var Xe=T_(),pt=ne(Xe);Xn(pt,()=>F()??Jr),Y(Xe),L(Qe=>at(Xe,1,Qe),[()=>$n(Cr("px-3 py-2",X()))]),x(He,Xe)};j(Gt,He=>{F()&&He(ut)})}Y(Ge);var ht=A(Ge,2);{var Ie=He=>{var Xe=Ze(),pt=ue(Xe);{const Qe=(et,it)=>{let xt=()=>(it?.()).props;var Ft=E_();Ga(Ft,$t=>({class:$t,...xt()}),[()=>Cr("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(et,Ft)};wt(pt,()=>bk,(et,it)=>{it(et,{child:Qe,$$slots:{child:!0}})})}x(He,Xe)};j(ht,He=>{z()&&He(Ie)})}L(()=>{Gi(Ge,`max-width: ${N()??""};`),at(jt,1,`px-3 py-2 space-y-1 ${C()??""}`)}),x(mt,We)},$$slots:{default:!0}})}),x(Ve,ie)},$$slots:{default:!0}})}),x(Vt,nt)};j(Fe,Vt=>{!h()&&(t()||r()||s())&&Vt(vt)})}x(ze,Le)},$$slots:{default:!0}})})}x(te,de)},$$slots:{default:!0}})})}return x(n,Z),Lt(ye)}var P_=new Set(["$$slots","$$events","$$legacy","leading","title","description","trailing","selected","disabled","class"]),I_=B('<span data-slot="action-row-leading" class="first-line-icon w-(--menu-icon-size)"><!></span>'),L_=B('<span data-slot="action-row-description"><!></span>'),O_=B('<span data-slot="action-row-trailing" class="first-line-icon gap-2"><!></span>'),N_=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 Ov(n,e){if(new.target)return Ot({component:Ov,...n});It(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=Yi(e,P_);var d={get leading(){return t()},set leading(O){t(O),b()},get title(){return r()},set title(O){r(O),b()},get description(){return s()},set description(O){s(O),b()},get trailing(){return i()},set trailing(O){i(O),b()},get selected(){return o()},set selected(O=!1){o(O),b()},get disabled(){return a()},set disabled(O=!1){a(O),b()},get class(){return c()},set class(O){c(O),b()},$set:Nt,$on:(O,N)=>Dt(e,O,N)},f=N_();Ga(f,O=>({type:"button",...u,disabled:a(),"data-slot":"menu-action-row","data-selected":o()?"":void 0,class:O}),[()=>Cr(ch(),"items-start whitespace-normal font-medium 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=O=>{var N=I_(),E=ne(N);Xn(E,t),Y(N),x(O,N)};j(h,O=>{t()&&O(p)})}var g=A(h,2),m=ne(g),v=ne(m);Xn(v,r),Y(m);var C=A(m,2);{var z=O=>{var N=L_(),E=ne(N);Xn(E,s),Y(N),L(()=>at(N,1,`min-w-0 break-words ${a_}`)),x(O,N)};j(C,O=>{s()&&O(z)})}Y(g);var M=A(g,2);{var S=O=>{var N=O_(),E=ne(N);Xn(E,i),Y(N),x(O,N)};j(M,O=>{i()&&O(S)})}return Y(f),x(n,f),Lt(d)}var D_=new Set(["$$slots","$$events","$$legacy","value","class","children"]);function Nv(n,e){if(new.target)return Ot({component:Nv,...n});It(e,!0);let t=y(e,"value",7),r=y(e,"class",7),s=y(e,"children",7),i=Yi(e,D_);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:Nt,$on:(u,d)=>Dt(e,u,d)},a=Ze(),c=ue(a);{let u=w(()=>Cr("mt-3",r()));wt(c,()=>Iv,(d,f)=>{f(d,gs({get value(){return t()},get class(){return l(u)}},()=>i,{children:(h,p)=>{var g=Ze(),m=ue(g);Xn(m,()=>s()??Jr),x(h,g)},$$slots:{default:!0}}))})}return x(n,a),Lt(o)}var $_=B('<img loading="lazy"/>');function Dv(n,e){if(new.target)return Ot({component:Dv,...n});It(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}`);Gw(()=>{t(),l(u),k(c,!1)});var d={get identity(){return t()},set identity(m){t(m),b()},get avatarUrl(){return r()},set avatarUrl(m){r(m),b()},get size(){return s()},set size(m=16){s(m),b()},get class(){return i()},set class(m=""){i(m),b()},get alt(){return o()},set alt(m){o(m),b()},get fallback(){return a()},set fallback(m){a(m),b()},$set:Nt,$on:(m,v)=>Dt(e,m,v)},f=Ze(),h=ue(f);{var p=m=>{var v=Ze(),C=ue(v);Xn(C,()=>a()??Jr),x(m,v)},g=m=>{var v=$_();L(()=>{st(v,"src",l(u)),st(v,"width",s()),st(v,"height",s()),st(v,"alt",o()??""),st(v,"aria-hidden",o()===void 0?"true":void 0),at(v,1,$n(i()))}),To("error",v,()=>{k(c,!0)}),tf(v),x(m,v)};j(h,m=>{l(c)?m(p):m(g,-1)})}return x(n,f),Lt(d)}var B_=new Set(["$$slots","$$events","$$legacy","children"]),z_=Xi('<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>'),F_=Xi('<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),H_=Xi('<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>'),U_=Xi('<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>'),V_=Xi('<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>'),W_=Xi('<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>'),j_=Xi('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function $v(n,e){if(new.target)return Ot({component:$v,...n});It(e,!0);const t=vk();let r=y(e,"children",7),s=Yi(e,B_),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(N){let{weight:E,color:D,size:ee,mirrored:U,...oe}=N;return oe}var d={get children(){return r()},set children(N){r(N),b()},$set:Nt,$on:(N,E)=>Dt(e,N,E)},f=j_();Ga(f,(N,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",...N,...E}),[()=>u(t),()=>u(s)]);var h=ne(f);{var p=N=>{var E=Ze(),D=ue(E);Xn(D,r),x(N,E)};j(h,N=>{r()&&N(p)})}var g=A(h,2);{var m=N=>{var E=z_();x(N,E)},v=N=>{var E=F_();Pt(),x(N,E)},C=N=>{var E=H_();x(N,E)},z=N=>{var E=U_();x(N,E)},M=N=>{var E=V_();x(N,E)},S=N=>{var E=W_();x(N,E)},O=N=>{var E=zt();E.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),x(N,E)};j(g,N=>{l(i)==="bold"?N(m):l(i)==="duotone"?N(v,1):l(i)==="fill"?N(C,2):l(i)==="light"?N(z,3):l(i)==="regular"?N(M,4):l(i)==="thin"?N(S,5):N(O,-1)})}return Y(f),x(n,f),Lt(d)}function Zo(n,e){if(new.target)return Ot({component:Zo,...n});It(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:Nt,$on:(i,o)=>Dt(e,i,o)};return $v(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Lt(s)}function fh(n,e){if(new.target)return Ot({component:fh,...n});It(e,!0);const t=g=>{var m=Ze(),v=ue(m);{var C=S=>{tt(S,{get icon(){return Qs},get size(){return a()},class:"shrink-0 text-muted-foreground"})},z=S=>{{let O=w(()=>s()==="github"?Yf:Qf);tt(S,{get icon(){return l(O)},get size(){return a()},class:"shrink-0 text-muted-foreground"})}},M=S=>{Zo(S,{get size(){return a()},class:"shrink-0 text-muted-foreground"})};j(v,S=>{o()?S(C):s()?S(z,1):S(M,-1)})}x(g,m)};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:Nt,$on:(g,m)=>Dt(e,g,m)},u=Ze(),d=ue(u);{var f=g=>{Dv(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 m=w(()=>r()??"");Mv(g,{get avatarUrl(){return i()},get label(){return l(m)},get size(){return a()},referrerpolicy:"no-referrer"})}},p=g=>{t(g)};j(d,g=>{r()&&s()==="github"?g(f):i()?g(h,1):g(p,-1)})}return x(n,u),Lt(c)}var K_=Xi('<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 hh(n,e){if(new.target)return Ot({component:hh,...n});It(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:Nt,$on:(o,a)=>Dt(e,o,a)},i=K_();return L(()=>{st(i,"width",t()),st(i,"height",t()),at(i,0,$n(r()))}),x(n,i),Lt(s)}function G_(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 q_=B('<span class="agent-avatar-unread-dot svelte-v6mebl" data-avatar-unread-dot=""></span>'),J_=B('<span role="img" data-agent-avatar-with-state="" data-agent-avatar-surface=""><!> <!></span>');function Bv(n,e){if(new.target)return Ot({component:Bv,...n});It(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,Fp),a=y(e,"size",7,void 0),c=y(e,"state",7,"idle"),u=y(e,"class",7,"");const d=w(()=>G_(c())),f=w(()=>a()??Hk[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=Fp){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:Nt,$on:(M,S)=>Dt(e,M,S)},g=J_();let m;var v=ne(g);Fk(v,{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(v,2);{var z=M=>{var S=q_();x(M,S)};j(C,M=>{c()==="unread"&&M(z)})}return Y(g),L(()=>{at(g,1,`agent-avatar-with-state agent-avatar-with-state--${c()??""} ${u()??""}`,"svelte-v6mebl"),st(g,"aria-label",l(d)),st(g,"title",l(d)),st(g,"data-avatar-state",c()),st(g,"data-avatar-variant",l(h)?o():void 0),m=Gi(g,"",m,{width:l(h)?void 0:`${l(f)}px`,height:l(h)?void 0:`${l(f)}px`})}),x(n,g),Lt(p)}function ff(n){return Xw(n)}function X_(n){return Yw(n)}function jp(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===Dc.Error||n.status==="failed"?"failed":o?"question":a?"needs-permission":c==="discussion"?"attention-discussion":c==="blocker"?"attention-blocker":X_(n)?"waiting":ff(n)?"running":t&&!r?"unread":"idle"}function Y_(n,e={}){if(!n)return jp({},e);const t=yk(n),r=n.status===Dc.Completed||String(n.status).toLowerCase()==="completed",s=n.status===Dc.Error||n.status===Dc.Deleted||String(n.status).toLowerCase()==="failed";return jp(rv(n),{...e,hasQuestion:l_(n)||e.hasQuestion===!0,hasUnread:e.hasUnread??n.hasUnread,isCompleted:e.isCompleted??r,isFailed:e.isFailed??s,attentionKind:e.attentionKind??t?.kind??null})}function Y3(n){return n?ff(rv(n)):!1}function Q_(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=hs(n.ciStatus.total);if(n.ciStatus.failed>0){const i=hs(n.ciStatus.failed);e.push(n.ciStatus.pending>0?_.workspace_prStatus_checksFailingRunning_tooltip({failed:i,total:s,pending:hs(n.ciStatus.pending)}):_.workspace_prStatus_checksFailing_tooltip({failed:i,total:s}))}else n.ciStatus.pending>0?e.push(_.workspace_prStatus_checksRunning_tooltip({pending:hs(n.ciStatus.pending),total:s})):t.push(_.workspace_prStatus_checksPassing_tooltip({passed:hs(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=hs(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 Z_={queued:0,draft:1,open:2,merged:3,closed:4};function zv(n,e){return n?`${n}#${e}`:String(e)}function Ed(n,e){return zv(n?.toLowerCase(),e)}function eS(n,e){return n&&e?e.localeCompare(n):n?-1:e?1:0}function tS(n,e){return n==="merged"?{statusIcon:v1,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 Q3({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(ux(h.url)??r,h.number),h])),u=dx(fx(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),m=h.resource?void 0:c.get(g),v=m?.isDraft?"draft":h.status,C=hx({...h,status:v});return{pr:h,repo:p,identity:g,source:m,status:v,queued:C,rank:Z_[C?"queued":v]}}).sort((h,p)=>h.rank-p.rank||eS(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:m,queued:v})=>{const C=h.monitorSnapshot?"":Q_(g);return{identity:h.monitorIdentity??zv(p,h.number),resource:h.resource,monitorAvailability:h.monitorAvailability,numberLabel:Qw(h,h.number),number:h.number,title:h.title,url:h.url,repo:p,repoContext:h.crossRepo?h.crossRepoDisplay??h.crossRepo:void 0,status:m,queued:v,...tS(m,v),details:[px({...h,status:m}),C].filter(Boolean).join(`
4
- `),monitorAgentId:h.monitorAgentId,monitorOnly:h.monitorOnly===!0}})}function nS(n){return"type"in n&&n.type==="separator"}function Z3(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 $c(n,e,t=""){let r=0;const s=[];for(const[o,a]of n.entries()){if(nS(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(p=>p.checked!==void 0),d=a.submenu.filter(p=>p.checked===void 0),f=u.map(p=>({kind:"radio",id:p.id,value:p.id,label:p.label,swatch:p.swatch,icon:p.icon,disabled:p.disabled,disabledReason:p.disabledReason,shortcut:p.shortcut,closeOnSelect:p.closeOnSelect})),h={kind:"radio-group",id:`${a.id}-selection`,label:a.label,value:u.find(p=>p.checked)?.id??"",presentation:a.presentation,children:f};if(a.presentation==="swatches"){s.push({...c,...h},...$c(d).map(p=>({...p,group:String(r)})));continue}s.push({...c,kind:"submenu",children:[...f.length>0?[h]:[],...$c(d)]})}else s.push({...c,kind:"submenu",children:$c(a.submenu)});else a.checked!==void 0?s.push({...c,kind:"checkbox",checked:a.checked,indicator:a.indicator}):s.push({...c,kind:"action",destructive:a.destructive})}if(e!=="single")return s;const i=[];for(const o of s){if(o.kind!=="checkbox"){i.push(o);continue}const a=i.at(-1),c={...o,kind:"radio",checked:void 0,value:o.id};a?.kind==="radio-group"&&a.group===o.group?(a.children=[...a.children,c],o.checked&&(a.value=o.id)):i.push({kind:"radio-group",id:`${o.id}-selection`,label:t,group:o.group,value:o.checked?o.id:"",children:[c]})}return i}function Fv(n,e){for(const t of n){if("type"in t)continue;if(t.id===e)return t;const r=t.submenu?Fv(t.submenu,e):void 0;if(r)return r}}function rS(n,e){if(new.target)return Ot({component:rS,...n});It(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,()=>Mp()),a=y(e,"returnFocus",7),c=y(e,"selection",7);const u=w(()=>$c(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=Mp()){o(f),b()},get returnFocus(){return a()},set returnFocus(f){a(f),b()},get selection(){return c()},set selection(f){c(f),b()},$set:Nt,$on:(f,h)=>Dt(e,f,h)};{let f=w(()=>({x:t(),y:r(),returnFocus:a()}));Hx(n,{get actions(){return l(u)},get ariaLabel(){return o()},get contextMenu(){return l(f)},onAction:h=>Fv(s(),h)?.onClick(),onOpenChange:h=>{h||i()?.()}})}return Lt(d)}function sS(){try{return At.state.userPreferences?.shortcutOverrides??{}}catch{return{}}}function Xc(n){return Rv(n,sS())}function eB(n){if(typeof At.getReadableState!="function")return Cp(Xc(n));try{return qw(At.getReadableState(),e=>Rv(n,e.userPreferences?.shortcutOverrides??{}))}catch{return Cp(Xc(n))}}function iS(n,e){return n?.isExternalLink===!0&&typeof n.workspaceId=="string"&&n.workspaceId?n.workspaceId:e||void 0}function Hv(n,e,t){const r=n.label||n.id||"mention";if(n.type==="member")return Jf(r);if(n.type==="note"&&n.id&&t){const s=iS(n.meta,e),i=s?t(s,n.id)?.trim():void 0;if(i)return i}return r}function tB(n,e,t){if(typeof document>"u"||!n.includes('data-type="note"'))return n;const r=document.createElement("template");r.innerHTML=n;let s=!1;for(const i of r.content.querySelectorAll('[data-mention][data-type="note"]')){let o=null;try{o=JSON.parse(i.getAttribute("data-meta")||"{}")}catch{o=null}const a=i.textContent??"",c=Hv({type:"note",id:i.getAttribute("data-id"),label:a,meta:o},e,t);c!==a&&(i.textContent=c,s=!0)}return s?r.innerHTML:n}const oS=(n,e)=>{let t;try{t=d_().state}catch{return}const r=t?.workspaceNotes?.byWorkspaceId?.[n]?.notes;return r?wk(r,e)?.title:void 0};var aS=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>'),lS=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 ph(n,e){if(new.target)return Ot({component:ph,...n});It(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=kv(),p=hk(v);let g=he(null),m=he(null);function v(){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')||v()}function z(E){if(d()?.(E),E.defaultPrevented||E.key!=="Tab"||!l(g))return;const D=Array.from(l(g).querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),ee=D[0],U=D[D.length-1];!ee||!U||(E.shiftKey&&document.activeElement===ee?(E.preventDefault(),U.focus()):!E.shiftKey&&document.activeElement===U&&(E.preventDefault(),ee.focus()))}ct(()=>{if(t())return da(v)}),ct(()=>{!t()||!l(m)||requestAnimationFrame(()=>l(m)?.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:Nt,$on:(E,D)=>Dt(e,E,D)},S=Ze(),O=ue(S);{var N=E=>{{let D=w(()=>h?.target()??"body");Ux(E,{get target(){return l(D)},zIndex:1e3,children:(ee,U)=>{var oe=lS(),F=ne(oe),W=ne(F);{var X=$=>{var ce=Ze(),pe=ue(ce);Xn(pe,c),x($,ce)};j(W,$=>{c()&&$(X)})}var le=A(W,2);qe(le,{variant:"ghost",size:"icon",class:"text-white hover:bg-white/20 hover:text-white",onclick:v,get"aria-label"(){return s()},get ref(){return l(m)},set ref($){k(m,$,!0)},children:($,ce)=>{tt($,{get icon(){return Ki},size:"lg"})},$$slots:{default:!0}}),Y(F),$l(F,$=>p?.($));var re=A(F,2),Q=ne(re);Xn(Q,a),Y(re),$l(re,$=>p?.($));var me=A(re,2);{var P=$=>{var ce=aS(),pe=se(ce,!0);L(()=>H(pe,u())),x($,ce)};j(me,$=>{u()&&$(P)})}Y(oe),sr(oe,$=>k(g,$),()=>l(g)),L(()=>st(oe,"aria-label",r())),qr("click",oe,C),qr("keydown",oe,z),To("copy",oe,function(...$){f()?.apply(this,$)}),Ms(3,oe,()=>c1,()=>({tier:"moderate"})),x(ee,oe)},$$slots:{default:!0}})}};j(O,E=>{t()&&E(N)})}return x(n,S),Lt(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 Uv(n){try{return new URL(n).protocol==="https:"}catch{return!1}}function hf(n){const e=/^data:([^;,]+);base64,(.*)$/s.exec(n);return e?{mimeType:e[1],base64:e[2]}:null}function pf(n){return Uv(n)||Gu(n)!==null||/^workspace-asset:\/\/[^/?#]+/.test(n)||/^data:image\/[a-z0-9.+-]+(?:;[^,]*)?,/i.test(n)}function Vv(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 cS(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 uS={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};function dS(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&&uS[t]||"png";return`${e}.${r}`}var fS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-dimensions"> </div>'),hS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-size"> </div>'),pS=B("<!> <!> <!>",1),gS=B("<!> <!> <!> <!>",1),mS=B("<!> <!>",1);function Wv(n,e){if(new.target)return Ot({component:Wv,...n});It(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(()=>hf(t())),c=w(()=>Gu(t())),u=w(()=>Uv(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)?Vv(l(a).base64):null,!0);const oe=new Image;oe.onload=()=>{h===U&&k(d,{width:oe.naturalWidth,height:oe.naturalHeight},!0)},oe.src=t(),l(a)||fetch(t()).then(F=>F.ok?F.blob():null).then(F=>{F&&h===U&&k(f,F.size,!0)}).catch(()=>{})}ct(()=>{s()&&p()}),ct(()=>{if(s())return da(()=>{s(!1)})});async function g(U=t()){const oe=hf(U);if(oe)return cS(oe.base64,oe.mimeType);const F=await fetch(U);if(!F.ok)throw new Error(`Image fetch failed: ${F.status}`);return await F.blob()}async function m(){let U=null;try{let oe=t(),F=l(a)?.mimeType;if(!l(a)){const X=await g();F=X.type,U=URL.createObjectURL(X),oe=U}const W=document.createElement("a");W.href=oe,W.download=dS({workspacePath:l(c)?.path,imageName:r(),mimeType:F}),document.body.appendChild(W);try{W.click()}finally{W.remove()}}catch{Cs.error(_.ui_imageActionsMenu_downloadFailed_error())}finally{U&&URL.revokeObjectURL(U)}}async function v(){if(l(c))try{await Jc(l(c).path),Cs.success(_.ui_imageActionsMenu_pathCopied_label())}catch{Cs.error(_.ui_imageActionsMenu_copyFailed_error())}}async function C(){if(l(u))try{await Jc(t()),Cs.success(_.ui_imageActionsMenu_linkCopied_label())}catch{Cs.error(_.ui_imageActionsMenu_copyFailed_error())}}async function z(U){let oe,F;try{let W;if(U.type.split(";")[0].trim()==="image/svg+xml"){F=URL.createObjectURL(U);const re=new Image;re.src=F,await re.decode(),W=re}else W=oe=await createImageBitmap(U);const X=document.createElement("canvas");X.width=W instanceof HTMLImageElement?W.naturalWidth:W.width,X.height=W instanceof HTMLImageElement?W.naturalHeight:W.height;const le=X.getContext("2d");if(!le)throw new Error("2d canvas context unavailable");return le.drawImage(W,0,0),await new Promise((re,Q)=>{X.toBlob(me=>me?re(me):Q(new Error("canvas toBlob failed")),"image/png")})}finally{oe?.close(),F&&URL.revokeObjectURL(F)}}async function M(U=t()){try{let oe=await g(U);oe.type!=="image/png"&&(oe=await z(oe)),await navigator.clipboard.write([new ClipboardItem({"image/png":oe})]),Cs.success(_.ui_imageActionsMenu_imageCopied_label())}catch{Cs.error(_.ui_imageActionsMenu_copyFailed_error())}}function S(U,oe=t()){return U.defaultPrevented||!pf(oe)||U instanceof KeyboardEvent&&(U.key.toLowerCase()!=="c"||!(U.metaKey||U.ctrlKey)||U.altKey||U.shiftKey||U.isComposing)||_v(U.target)||document.getSelection()?.toString()?!1:(U.preventDefault(),U.stopPropagation(),U instanceof KeyboardEvent&&U.repeat||(M(oe),s(!1)),!0)}var O={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:Nt,$on:(U,oe)=>Dt(e,U,oe)},N=Ze(),E=ue(N);{var D=U=>{var oe=Ze(),F=ue(oe);wt(F,()=>sh,(W,X)=>{X(W,{get open(){return s()},set open(le){s(le)},children:(le,re)=>{var Q=mS(),me=ue(Q);{const $=(pe,ye)=>{let Z=()=>(ye?.()).props;{let ae=w(()=>_.ui_imageActionsMenu_trigger_ariaLabel());qe(pe,gs(Z,{variant:"plain",size:"icon-sm",wrapContent:!1,get active(){return s()},get"aria-label"(){return l(ae)},children:(V,K)=>{vv(V,{class:"size-3.5"})},$$slots:{default:!0}}))}};let ce=w(()=>Cr("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",i()));wt(me,()=>nh,(pe,ye)=>{ye(pe,{get class(){return l(ce)},onclick:Z=>Z.stopPropagation(),onkeydown:Z=>S(Z),oncopy:Z=>S(Z),child:$,$$slots:{child:!0}})})}var P=A(me,2);wt(P,()=>rh,($,ce)=>{ce($,{get class(){return o()},align:"end",onkeydown:pe=>S(pe),oncopy:pe=>S(pe),children:(pe,ye)=>{var Z=gS(),ae=ue(Z);wt(ae,()=>jo,(fe,ke)=>{ke(fe,{onSelect:()=>void m(),children:(be,q)=>{Pt();var Me=zt();L(ze=>H(Me,ze),[()=>_.ui_imageActionsMenu_download_label()]),x(be,Me)},$$slots:{default:!0}})});var V=A(ae,2);wt(V,()=>jo,(fe,ke)=>{ke(fe,{onSelect:()=>void M(),children:(be,q)=>{Pt();var Me=zt();L(ze=>H(Me,ze),[()=>_.ui_imageActionsMenu_copyImage_label()]),x(be,Me)},$$slots:{default:!0}})});var K=A(V,2);{var I=fe=>{var ke=Ze(),be=ue(ke);wt(be,()=>jo,(q,Me)=>{Me(q,{onSelect:()=>void v(),children:(ze,gt)=>{Pt();var Le=zt();L(De=>H(Le,De),[()=>_.ui_imageActionsMenu_copyPath_label()]),x(ze,Le)},$$slots:{default:!0}})}),x(fe,ke)},te=fe=>{var ke=Ze(),be=ue(ke);wt(be,()=>jo,(q,Me)=>{Me(q,{onSelect:()=>void C(),children:(ze,gt)=>{Pt();var Le=zt();L(De=>H(Le,De),[()=>_.ui_imageActionsMenu_copyLink_label()]),x(ze,Le)},$$slots:{default:!0}})}),x(fe,ke)};j(K,fe=>{l(c)?fe(I):l(u)&&fe(te,1)})}var ve=A(K,2);{var de=fe=>{var ke=pS(),be=ue(ke);wt(be,()=>bv,(Le,De)=>{De(Le,{})});var q=A(be,2);{var Me=Le=>{var De=fS(),Fe=se(De,!0);L(vt=>H(Fe,vt),[()=>_.ui_imageActionsMenu_dimensions_label({width:hs(l(d).width),height:hs(l(d).height)})]),x(Le,De)};j(q,Le=>{l(d)&&Le(Me)})}var ze=A(q,2);{var gt=Le=>{var De=hS(),Fe=se(De,!0);L(vt=>H(Fe,vt),[()=>sv(l(f))]),x(Le,De)};j(ze,Le=>{l(f)!==null&&Le(gt)})}x(fe,ke)};j(ve,fe=>{(l(d)||l(f)!==null)&&fe(de)})}x(pe,Z)},$$slots:{default:!0}})}),x(le,Q)},$$slots:{default:!0}})}),x(U,oe)},ee=w(()=>pf(t()));j(E,U=>{l(ee)&&U(D)})}return x(n,N),Lt(O)}var vS=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 jv(n,e){if(new.target)return Ot({component:jv,...n});It(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);ct(()=>{i()?.(l(d))});let m=null,v=0,C=0,z=0,M=!1;const S=w(()=>iv(l(d),{style:"percent",maximumFractionDigits:0}));function O(I){return Math.min(s(),Math.max(r(),I))}function N(I,te,ve){const de=O(ve),fe=l(g)?.getBoundingClientRect(),ke=fe?I-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(I){const te=l(g)?.getBoundingClientRect();te?N(te.left+te.width/2,te.top+te.height/2,I):k(d,O(I),!0)}function D(){k(d,1),k(f,0),k(h,0)}function ee(I){I.preventDefault();const te=I.ctrlKey?c:a;N(I.clientX,I.clientY,l(d)*Math.exp(-I.deltaY*te))}ct(()=>{const I=l(g);if(I)return I.addEventListener("wheel",ee,{passive:!1}),()=>I.removeEventListener("wheel",ee)});function U(I){if(I.metaKey||I.ctrlKey||I.altKey)return!1;if(I.key==="+"||I.key==="=")E(l(d)*o);else if(I.key==="-")E(l(d)/o);else if(I.key==="0")D();else return!1;return I.preventDefault(),!0}function oe(I){if(I.button>0)return;k(p,!0),m=I.pointerId,v=I.clientX,C=I.clientY,z=0;const te=I.currentTarget;typeof te.setPointerCapture=="function"&&te.setPointerCapture(I.pointerId)}function F(I){if(!l(p)||I.pointerId!==m)return;const te=I.clientX-v,ve=I.clientY-C;z+=Math.abs(te)+Math.abs(ve),k(f,l(f)+te),k(h,l(h)+ve),v=I.clientX,C=I.clientY}function W(I){if(!l(p)||I.pointerId!==m)return;k(p,!1),m=null,z>u&&(M=!0);const te=I.currentTarget;typeof te.hasPointerCapture=="function"&&typeof te.releasePointerCapture=="function"&&te.hasPointerCapture(I.pointerId)&&te.releasePointerCapture(I.pointerId)}function X(I){M&&(M=!1,I.preventDefault(),I.stopPropagation())}function le(I){const te=Number.parseFloat(I.currentTarget.value);Number.isFinite(te)&&E(te)}var re={handleKeydown:U,get children(){return t()},set children(I){t(I),b()},get minZoom(){return r()},set minZoom(I=.25){r(I),b()},get maxZoom(){return s()},set maxZoom(I=8){s(I),b()},get onScaleChange(){return i()},set onScaleChange(I){i(I),b()},$set:Nt,$on:(I,te)=>Dt(e,I,te)},Q=vS(),me=ne(Q),P=ne(me);Xn(P,t),Y(me);var $=A(me,2),ce=ne($);{let I=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel());qe(ce,{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(I)},get title(){return l(te)},children:(ve,de)=>{tt(ve,{get icon(){return b1}})},$$slots:{default:!0}})}var pe=A(ce,2),ye=ne(pe);{let I=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel());Vx(ye,{class:"accent-white",get min(){return r()},get max(){return s()},step:"0.01",get value(){return l(d)},oninput:le,get"aria-label"(){return l(I)},get title(){return l(te)},"data-testid":"zoom-pan-slider"})}Y(pe);var Z=A(pe,2);{let I=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel());qe(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(I)},get title(){return l(te)},children:(ve,de)=>{tt(ve,{get icon(){return y1}})},$$slots:{default:!0}})}var ae=A(Z,2),V=se(ae,!0),K=A(ae,2);{let I=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel());qe(K,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:D,get"aria-label"(){return l(I)},get title(){return l(te)},children:(ve,de)=>{tt(ve,{get icon(){return w1}})},$$slots:{default:!0}})}return Y($),Y(Q),sr(Q,I=>k(g,I),()=>l(g)),L((I,te)=>{at(Q,1,`relative h-full w-full touch-none select-none overflow-hidden ${l(p)?"cursor-grabbing":"cursor-grab"}`),st(Q,"aria-label",I),Gi(me,`transform: translate(${l(f)??""}px, ${l(h)??""}px) scale(${l(d)??""}); transform-origin: 0 0;`),st($,"aria-label",te),H(V,l(S))},[()=>_.ui_zoomPanViewport_viewport_ariaLabel(),()=>_.ui_zoomPanViewport_controls_ariaLabel()]),qr("pointerdown",Q,oe),qr("pointermove",Q,F),qr("pointerup",Q,W),To("pointercancel",Q,W),To("click",Q,X,!0),qr("keydown",Q,U),qr("pointerdown",$,I=>I.stopPropagation()),x(n,Q),Lt(re)}Ro(["pointerdown","pointermove","pointerup","keydown"]);var bS=B('<img class="max-h-[90vh] max-w-[90vw] rounded-lg object-contain" draggable="false" data-media-lightbox-content=""/>');function Kv(n,e){if(new.target)return Ot({component:Kv,...n});It(e,!0);const t=v=>{var C=Ze(),z=ue(C);{var M=S=>{sr(Wv(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(O){k(f,O,!0)}}),O=>k(d,O,!0),()=>l(d))};j(z,S=>{c()&&S(M)})}x(v,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);ct(()=>{r()||k(f,!1)});function h(v){p(v),v.defaultPrevented||l(u)?.handleKeydown(v)}function p(v){r()&&c()&&l(d)?.handleCopy(v)}function g(v){!c()||!pf(s())||(v.preventDefault(),v.stopPropagation(),k(f,!0))}var m={get open(){return r()},set open(v=!1){r(v),b()},get imageUrl(){return s()},set imageUrl(v){s(v),b()},get imageName(){return i()},set imageName(v=_.ui_imageLightbox_image_alt()){i(v),b()},get onClose(){return o()},set onClose(v){o(v),b()},get openerElement(){return a()},set openerElement(v=null){a(v),b()},get showActionsMenu(){return c()},set showActionsMenu(v=!1){c(v),b()},$set:Nt,$on:(v,C)=>Dt(e,v,C)};{let v=w(()=>_.ui_imageLightbox_preview_ariaLabel()),C=w(()=>_.ui_imageLightbox_close_ariaLabel());ph(n,{get ariaLabel(){return l(v)},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(z){r(z)},children:(z,M)=>{var S=Ze(),O=ue(S);uh(O,s,N=>{sr(jv(N,{children:(E,D)=>{var ee=bS();L(()=>{st(ee,"src",s()),st(ee,"alt",i())}),qr("contextmenu",ee,g),x(E,ee)},$$slots:{default:!0}}),E=>k(u,E,!0),()=>l(u))}),x(z,S)},$$slots:{default:!0}})}return Lt(m)}Ro(["contextmenu"]);var yS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-duration"> </div>'),wS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-dimensions"> </div>'),xS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-size"> </div>'),kS=B("<!> <!> <!> <!>",1),_S=B("<!> <!> <!>",1),SS=B("<!> <!>",1);function Yc(n,e){if(new.target)return Ot({component:Yc,...n});It(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(()=>hf(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),m=null;function v(){if(m===t())return;const E=m=t();k(h,null),k(p,null),k(g,l(u)?Vv(l(u).base64):null,!0);const D=document.createElement("video");D.preload="metadata",D.onloadedmetadata=()=>{m===E&&(Number.isFinite(D.duration)&&D.duration>0&&k(h,D.duration,!0),D.videoWidth>0&&D.videoHeight>0&&k(p,{width:D.videoWidth,height:D.videoHeight},!0))},D.src=t(),l(u)||fetch(t()).then(ee=>ee.ok?ee.blob():null).then(ee=>{ee&&m===E&&k(g,ee.size,!0)}).catch(()=>{})}function C(){const E=l(d)?.path.split("/").pop();if(E)return E;const D=(r()||"video").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(D))return D;const ee=(i()??l(u)?.mimeType)==="video/webm"?"webm":"mp4";return`${D}.${ee}`}async function z(){let E=null;try{let D=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()),D=E}const ee=document.createElement("a");ee.href=D,ee.download=C(),document.body.appendChild(ee),ee.click(),ee.remove(),E&&URL.revokeObjectURL(E)}catch{E&&URL.revokeObjectURL(E),Cs.error(_.ui_videoActionsMenu_downloadFailed_error())}}async function M(E,D){try{await Jc(E),Cs.success(D)}catch{Cs.error(_.ui_videoActionsMenu_copyFailed_error())}}ct(()=>{o()&&v()}),ct(()=>{if(o())return da(()=>{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:Nt,$on:(E,D)=>Dt(e,E,D)},O=Ze(),N=ue(O);return wt(N,()=>sh,(E,D)=>{D(E,{get open(){return o()},set open(ee){o(ee)},children:(ee,U)=>{var oe=SS(),F=ue(oe);{let X=w(()=>Cr("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",a())),le=w(()=>_.ui_videoActionsMenu_trigger_ariaLabel());wt(F,()=>nh,(re,Q)=>{Q(re,{get class(){return l(X)},get"aria-label"(){return l(le)},onclick:me=>me.stopPropagation(),children:(me,P)=>{vv(me,{class:"size-3.5"})},$$slots:{default:!0}})})}var W=A(F,2);wt(W,()=>rh,(X,le)=>{le(X,{get class(){return c()},align:"end",children:(re,Q)=>{var me=_S(),P=ue(me);wt(P,()=>jo,(ae,V)=>{V(ae,{onSelect:()=>void z(),children:(K,I)=>{Pt();var te=zt();L(ve=>H(te,ve),[()=>_.ui_videoActionsMenu_download_label()]),x(K,te)},$$slots:{default:!0}})});var $=A(P,2);{var ce=ae=>{var V=Ze(),K=ue(V);wt(K,()=>jo,(I,te)=>{te(I,{onSelect:()=>void M(l(d).path,_.ui_videoActionsMenu_pathCopied_label()),children:(ve,de)=>{Pt();var fe=zt();L(ke=>H(fe,ke),[()=>_.ui_videoActionsMenu_copyPath_label()]),x(ve,fe)},$$slots:{default:!0}})}),x(ae,V)},pe=ae=>{var V=Ze(),K=ue(V);wt(K,()=>jo,(I,te)=>{te(I,{onSelect:()=>void M(t(),_.ui_videoActionsMenu_linkCopied_label()),children:(ve,de)=>{Pt();var fe=zt();L(ke=>H(fe,ke),[()=>_.ui_videoActionsMenu_copyLink_label()]),x(ve,fe)},$$slots:{default:!0}})}),x(ae,V)};j($,ae=>{l(f)==="workspace"&&l(d)?ae(ce):l(f)==="remote"&&ae(pe,1)})}var ye=A($,2);{var Z=ae=>{var V=kS(),K=ue(V);wt(K,()=>bv,(be,q)=>{q(be,{})});var I=A(K,2);{var te=be=>{var q=yS(),Me=se(q,!0);L(ze=>H(Me,ze),[()=>_.ui_videoActionsMenu_duration_label({duration:u1(l(h)*1e3)})]),x(be,q)};j(I,be=>{l(h)!==null&&be(te)})}var ve=A(I,2);{var de=be=>{var q=wS(),Me=se(q,!0);L(ze=>H(Me,ze),[()=>_.ui_videoActionsMenu_dimensions_label({width:hs(l(p).width),height:hs(l(p).height)})]),x(be,q)};j(ve,be=>{l(p)&&be(de)})}var fe=A(ve,2);{var ke=be=>{var q=xS(),Me=se(q,!0);L(ze=>H(Me,ze),[()=>sv(l(g))]),x(be,q)};j(fe,be=>{l(g)!==null&&be(ke)})}x(ae,V)};j(ye,ae=>{(l(h)!==null||l(p)||l(g)!==null)&&ae(Z)})}x(re,me)},$$slots:{default:!0}})}),x(ee,oe)},$$slots:{default:!0}})}),x(n,O),Lt(S)}var CS=B('<p class="type-body text-white/80" role="status"> </p>'),MS=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 Gv(n,e){if(new.target)return Ot({component:Gv,...n});It(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);ct(()=>{!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:Nt,$on:(p,g)=>Dt(e,p,g)};{let p=w(()=>_.chat_videoBlock_dialog_title({name:i()})),g=w(()=>_.chat_videoBlock_close_ariaLabel());ph(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(m){r(m)},children:(m,v)=>{var C=MS(),z=ne(C),M=se(z,!0),S=A(z,2);{var O=N=>{var E=CS(),D=se(E,!0);L(ee=>H(D,ee),[()=>_.chat_videoBlock_unavailable_description()]),x(N,E)};j(S,N=>{l(f)&&N(O)})}Y(C),L(N=>{st(z,"src",s()),st(z,"poster",o()),st(z,"aria-label",i()),H(M,N)},[()=>_.chat_videoBlock_unsupported_description()]),To("error",z,()=>k(f,!0)),x(m,C)},$$slots:{default:!0}})}return Lt(h)}var TS=B('<span class="block truncate text-foreground"> </span>'),ES=B("<!> ",1),AS=B("<!> <!>",1),RS=B('<span class="flex shrink-0 flex-wrap items-center gap-1"><!> <!></span>'),PS=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 qv(n,e){if(new.target)return Ot({component:qv,...n});It(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(D){D.preventDefault(),D.stopPropagation()}function u(D){c(D),o()?.()}async function d(D){if(c(D),!!s())try{await Jc(s()),Cs.success(_.ui_imageActionsMenu_pathCopied_label())}catch{Cs.error(_.ui_imageActionsMenu_copyFailed_error())}}function f(D){if(c(D),!s()||!i())return;const ee=s().split("/").map(encodeURIComponent).join("/");oh(`intent://local/file/${ee}`,{workspaceId:Sv(i())})}var h={get name(){return t()},set name(D){t(D),b()},get reason(){return r()},set reason(D){r(D),b()},get path(){return s()},set path(D){s(D),b()},get workspaceId(){return i()},set workspaceId(D){i(D),b()},get onRetry(){return o()},set onRetry(D){o(D),b()},$set:Nt,$on:(D,ee)=>Dt(e,D,ee)},p=PS(),g=ne(p),m=ne(g),v=ne(m);tt(v,{get icon(){return Kc},class:"size-3.5"}),Y(m);var C=A(m,2),z=ne(C);{var M=D=>{var ee=TS(),U=se(ee,!0);$l(ee,(oe,F)=>uf?.(oe,F),t),L(()=>H(U,t())),x(D,ee)};j(z,D=>{t()&&D(M)})}var S=A(z,2),O=se(S,!0);Y(C),Y(g);var N=A(g,2);{var E=D=>{var ee=RS(),U=ne(ee);{var oe=X=>{{let le=w(()=>_.chat_shared_retry_label());qe(X,{variant:"ghost",size:"icon-compact",get tooltip(){return l(le)},onclick:u,children:(re,Q)=>{tt(re,{get icon(){return Zf},size:"xs"})},$$slots:{default:!0}})}};j(U,X=>{o()&&X(oe)})}var F=A(U,2);{var W=X=>{var le=AS(),re=ue(le);{var Q=P=>{qe(P,{variant:"ghost",size:"compact",onclick:f,children:($,ce)=>{var pe=ES(),ye=ue(pe);tt(ye,{get icon(){return lv},size:"xs"});var Z=A(ye);L(ae=>H(Z,` ${ae??""}`),[()=>_.chat_changesPanel_openFile_tooltip()]),x($,pe)},$$slots:{default:!0}})};j(re,P=>{i()&&r()!=="other-workspace"&&r()!=="invalid-link"&&P(Q)})}var me=A(re,2);{let P=w(()=>_.ui_imageActionsMenu_copyPath_label());qe(me,{variant:"ghost",size:"icon-compact",get tooltip(){return l(P)},onclick:d,children:($,ce)=>{tt($,{get icon(){return av},size:"xs"})},$$slots:{default:!0}})}x(X,le)};j(F,X=>{s()&&X(W)})}Y(ee),x(D,ee)};j(N,D=>{(o()||s())&&D(E)})}return Y(p),L(()=>{st(p,"data-reason",r()),H(O,l(a))}),x(n,p),Lt(h)}const nB=At.createSelector(n=>n.featureCodes.activeFeatures),IS=At.createSelector((n,e)=>n.featureCodes.activeFeatures.includes(e)),rB=At.createSelector(n=>n.featureCodes.activeFeatures.length>0),sB=At.createSelector(n=>n.featureCodes.dialogOpen);var LS=B("<span> </span>"),OS=B('<div role="search"><div><!> <!> <!></div> <div><!> <!> <!></div></div>');function NS(n,e){if(new.target)return Ot({component:NS,...n});It(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),m=y(e,"resultText",7,void 0),v=y(e,"emptyResultText",23,()=>_.ui_panelFindBar_noMatches_label()),C=y(e,"showResultText",7,!0),z=y(e,"showResultWhenQueryEmpty",7,!1),M=y(e,"resultFormat",7,"slash"),S=y(e,"resultVariant",7,void 0),O=y(e,"searchAriaLabel",23,()=>_.ui_panelFindBar_search_ariaLabel()),N=y(e,"previousLabel",23,()=>_.ui_panelFindBar_previous_label()),E=y(e,"previousShortcutLabel",7,"Shift+Enter"),D=y(e,"previousKeyShortcuts",7,"Shift+Enter"),ee=y(e,"previousTitle",7,void 0),U=y(e,"nextLabel",23,()=>_.ui_panelFindBar_next_label()),oe=y(e,"nextShortcutLabel",7,"Enter"),F=y(e,"nextKeyShortcuts",7,"Enter"),W=y(e,"nextTitle",7,void 0),X=y(e,"closeLabel",23,()=>_.ui_panelFindBar_close_label()),le=y(e,"closeShortcutLabel",7,"Esc"),re=y(e,"closeKeyShortcuts",7,"Escape"),Q=y(e,"closeTitle",7,void 0),me=y(e,"layout",7,"floating"),P=y(e,"class",7),$=y(e,"inputWrapperClass",7),ce=y(e,"inputClass",7),pe=y(e,"actionsClass",7),ye=y(e,"onPrevious",7),Z=y(e,"onNext",7),ae=y(e,"onClose",7),V=y(e,"onQueryChange",7),K=y(e,"onInput",7),I=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(m()!==void 0)return m();if(!C()||!l(te)&&!z()||typeof g()!="number")return null;if(g()<=0)return l(te)?v():null;const ie=Math.min(Math.max(p()+1,1),g());return M()==="of"?_.ui_panelFindBar_matchOf_label({current:ie,total:g()}):`${ie} / ${g()}`}),fe=w(()=>S()??(typeof g()=="number"&&g()<=0&&l(te)?"destructive":"muted"));ct(()=>{(d()||h()!==void 0)&&r()&&!i()&&!o()&&(r().focus(),f()&&r().select())});function ke(){r()?.focus()}function be(){r()?.blur()}function q(){r()?.select()}function Me(ie,$e){return $e?`${ie} (${$e})`:ie}function ze(ie){t(ie.currentTarget.value),V()?.(t(),ie),K()?.(ie)}function gt(ie){I()?.(ie),!ie.defaultPrevented&&(ie.key==="Escape"&&ae()&&!c()&&!i()?(ie.preventDefault(),ae()(ie)):ie.key==="Enter"&&!l(ve)&&(ie.preventDefault(),ie.shiftKey?ye()?.(t(),ie):Z()?.(t(),ie)))}var Le={focus:ke,blur:be,select:q,get query(){return t()},set query(ie=""){t(ie),b()},get inputRef(){return r()},set inputRef(ie=null){r(ie),b()},get placeholder(){return s()},set placeholder(ie=_.ui_panelFindBar_find_placeholder()){s(ie),b()},get disabled(){return i()},set disabled(ie=!1){i(ie),b()},get inputDisabled(){return o()},set inputDisabled(ie=!1){o(ie),b()},get navigationDisabled(){return a()},set navigationDisabled(ie=!1){a(ie),b()},get closeDisabled(){return c()},set closeDisabled(ie=!1){c(ie),b()},get disableNavigationWhenNoMatches(){return u()},set disableNavigationWhenNoMatches(ie=!0){u(ie),b()},get autofocus(){return d()},set autofocus(ie=!1){d(ie),b()},get selectOnFocus(){return f()},set selectOnFocus(ie=!0){f(ie),b()},get focusTrigger(){return h()},set focusTrigger(ie){h(ie),b()},get currentMatchIndex(){return p()},set currentMatchIndex(ie=0){p(ie),b()},get totalMatches(){return g()},set totalMatches(ie){g(ie),b()},get resultText(){return m()},set resultText(ie=void 0){m(ie),b()},get emptyResultText(){return v()},set emptyResultText(ie=_.ui_panelFindBar_noMatches_label()){v(ie),b()},get showResultText(){return C()},set showResultText(ie=!0){C(ie),b()},get showResultWhenQueryEmpty(){return z()},set showResultWhenQueryEmpty(ie=!1){z(ie),b()},get resultFormat(){return M()},set resultFormat(ie="slash"){M(ie),b()},get resultVariant(){return S()},set resultVariant(ie=void 0){S(ie),b()},get searchAriaLabel(){return O()},set searchAriaLabel(ie=_.ui_panelFindBar_search_ariaLabel()){O(ie),b()},get previousLabel(){return N()},set previousLabel(ie=_.ui_panelFindBar_previous_label()){N(ie),b()},get previousShortcutLabel(){return E()},set previousShortcutLabel(ie="Shift+Enter"){E(ie),b()},get previousKeyShortcuts(){return D()},set previousKeyShortcuts(ie="Shift+Enter"){D(ie),b()},get previousTitle(){return ee()},set previousTitle(ie=void 0){ee(ie),b()},get nextLabel(){return U()},set nextLabel(ie=_.ui_panelFindBar_next_label()){U(ie),b()},get nextShortcutLabel(){return oe()},set nextShortcutLabel(ie="Enter"){oe(ie),b()},get nextKeyShortcuts(){return F()},set nextKeyShortcuts(ie="Enter"){F(ie),b()},get nextTitle(){return W()},set nextTitle(ie=void 0){W(ie),b()},get closeLabel(){return X()},set closeLabel(ie=_.ui_panelFindBar_close_label()){X(ie),b()},get closeShortcutLabel(){return le()},set closeShortcutLabel(ie="Esc"){le(ie),b()},get closeKeyShortcuts(){return re()},set closeKeyShortcuts(ie="Escape"){re(ie),b()},get closeTitle(){return Q()},set closeTitle(ie=void 0){Q(ie),b()},get layout(){return me()},set layout(ie="floating"){me(ie),b()},get class(){return P()},set class(ie){P(ie),b()},get inputWrapperClass(){return $()},set inputWrapperClass(ie){$(ie),b()},get inputClass(){return ce()},set inputClass(ie){ce(ie),b()},get actionsClass(){return pe()},set actionsClass(ie){pe(ie),b()},get onPrevious(){return ye()},set onPrevious(ie){ye(ie),b()},get onNext(){return Z()},set onNext(ie){Z(ie),b()},get onClose(){return ae()},set onClose(ie){ae(ie),b()},get onQueryChange(){return V()},set onQueryChange(ie){V(ie),b()},get onInput(){return K()},set onInput(ie){K(ie),b()},get onKeydown(){return I()},set onKeydown(ie){I(ie),b()},$set:Nt,$on:(ie,$e)=>Dt(e,ie,$e)},De=OS(),Fe=ne(De),vt=ne(Fe);tt(vt,{get icon(){return x1},class:"size-3 shrink-0 text-muted-foreground"});var Vt=A(vt,2);{let ie=w(()=>i()||o()),$e=w(()=>Cr("h-6 w-36 border-0 bg-transparent px-0 py-0 text-sm shadow-none","placeholder:text-muted-foreground",ce()));rs(Vt,{type:"text",get placeholder(){return s()},get disabled(){return l(ie)},noFocusStyle:!0,get class(){return l($e)},get"aria-label"(){return O()},oninput:ze,onkeydown:gt,get ref(){return r()},set ref(lt){r(lt)},get value(){return t()},set value(lt){t(lt)}})}var nt=A(Vt,2);{var Pe=ie=>{var $e=LS(),lt=se($e,!0);L(yt=>{at($e,1,yt),H(lt,l(de))},[()=>$n(Cr("whitespace-nowrap text-xs tabular-nums",l(fe)==="destructive"?"text-danger":"text-muted-foreground"))]),x(ie,$e)};j(nt,ie=>{l(de)&&ie(Pe)})}Y(Fe);var Ce=A(Fe,2),we=ne(Ce);{let ie=w(()=>ee()??Me(N(),E()));qe(we,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:$e=>ye()?.(t(),$e),get disabled(){return l(ve)},get"aria-label"(){return N()},get"aria-keyshortcuts"(){return D()},get title(){return l(ie)},children:($e,lt)=>{tt($e,{get icon(){return k1},class:"size-3"})},$$slots:{default:!0}})}var Ve=A(we,2);{let ie=w(()=>W()??Me(U(),oe()));qe(Ve,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:$e=>Z()?.(t(),$e),get disabled(){return l(ve)},get"aria-label"(){return U()},get"aria-keyshortcuts"(){return F()},get title(){return l(ie)},children:($e,lt)=>{tt($e,{get icon(){return sa},class:"size-3"})},$$slots:{default:!0}})}var Mt=A(Ve,2);{let ie=w(()=>i()||c()),$e=w(()=>Q()??Me(X(),le()));qe(Mt,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:lt=>ae()?.(lt),get disabled(){return l(ie)},get"aria-label"(){return X()},get"aria-keyshortcuts"(){return re()},get title(){return l($e)},children:(lt,yt)=>{tt(lt,{get icon(){return Ki},class:"size-3.5"})},$$slots:{default:!0}})}return Y(Ce),Y(De),L((ie,$e,lt)=>{st(De,"aria-label",O()),at(De,1,ie),at(Fe,1,$e),at(Ce,1,lt)},[()=>$n(Cr("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",me()==="floating"&&"absolute top-2 right-4 z-50",i()&&"pointer-events-none opacity-60",P())),()=>$n(Cr("flex h-7 min-w-0 items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2",$())),()=>$n(Cr("flex items-center gap-0.5",pe()))]),x(n,De),Lt(Le)}var Kp=Object.defineProperty,DS=(n,e)=>{let t={};for(var r in n)Kp(t,r,{get:n[r],enumerable:!0});return Kp(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 Jv(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&&Qv(o.charCodeAt(c-1))&&Yv(o.charCodeAt(c))&&t--,t}if(s.content.size||i.content.size){let o=Jv(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Xv(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&&Qv(u.charCodeAt(f-1))&&Yv(u.charCodeAt(f))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let u=Xv(o.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}function Yv(n){return n>=56320&&n<57344}function Qv(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 Jv(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Xv(this,e,t,r)}findIndex(e){if(e==0)return pc(0,e);if(e==this.size)return pc(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?pc(t+1,i):pc(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 pc(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 Rn=class gf{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 gf.none;if(e instanceof gf)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};Rn.none=[];class Bl extends Error{}class je{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=eb(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new je(r,this.openStart,this.openEnd)}removeBetween(e,t){return new je(Zv(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 je.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 je(_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 je(e,r,s)}}je.empty=new je(_e.empty,0,0);function Zv(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(Zv(i.content,e-s-1,t-s-1)))}function eb(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=eb(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 $S(n,e,t){if(t.openStart>n.depth)throw new Bl("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Bl("Inconsistent open depths");return tb(n,e,t,0)}function tb(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=tb(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}=BS(t,n);return ta(i,rb(n,o,a,e,r))}else return ta(i,Zc(n,e,r))}function nb(n,e){if(!e.type.compatibleContent(n.type))throw new Bl("Cannot join "+e.type.name+" onto "+n.type.name)}function mf(n,e,t){let r=n.node(t);return nb(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 Sl(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 Bl("Invalid content for node "+n.type.name);return n.copy(e)}function rb(n,e,t,r,s){let i=n.depth>s&&mf(n,e,s+1),o=r.depth>s&&mf(t,r,s+1),a=[];return Sl(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(nb(i,o),ea(ta(i,rb(n,e,t,r,s+1)),a)):(i&&ea(ta(i,Zc(n,e,s+1)),a),Sl(e,t,s,a),o&&ea(ta(o,Zc(t,r,s+1)),a)),Sl(r,null,s,a),new _e(a)}function Zc(n,e,t){let r=[];if(Sl(null,n,t,r),n.depth>t){let s=mf(n,e,t+1);ea(ta(s,Zc(n,e,t+1)),r)}return Sl(e,null,t,r),new _e(r)}function BS(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 zl{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 Rn.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 zl(t,r,i)}static resolveCached(e,t){let r=Gp.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 Gp.set(e,r=new zS);let s=r.elts[r.i]=zl.resolve(e,t);return r.i=(r.i+1)%FS,s}}class zS{constructor(){this.elts=[],this.i=0}}const FS=12,Gp=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 HS=Object.create(null);let wo=class vf{constructor(e,t,r,s=Rn.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||HS)&&Rn.sameSet(this.marks,r||Rn.none)}copy(e=null){return e==this.content?this:new vf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vf(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 je.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 je(u,s.depth-o,i.depth-o)}replace(e,t,r){return $S(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 zl.resolveCached(this,e)}resolveNoCache(e){return zl.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()+")"),sb(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),qp(this.type.attrs,this.attrs,"node",this.type.name);let e=Rn.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];qp(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Rn.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):sb(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 sb(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function qp(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 US(e,t);if(r.next==null)return ia.empty;let s=ib(r);r.next&&r.err("Unexpected trailing text");let i=JS(qS(s));return XS(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 US{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 ib(n){let e=[];do e.push(VS(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function VS(n){let e=[];do e.push(WS(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function WS(n){let e=GS(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=jS(n,e);else break;return e}function Jp(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function jS(n,e){let t=Jp(n),r=t;return n.eat(",")&&(n.next!="}"?r=Jp(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function KS(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 GS(n){if(n.eat("(")){let e=ib(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=KS(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 qS(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 ob(n,e){return e-n}function Xp(n,e){let t=[];return r(e),t.sort(ob);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 JS(n){let e=Object.create(null);return t(Xp(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]);Xp(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(ob);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function XS(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 ab(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 lb(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 cb(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new QS(n,r,e[r]);return t}let Yp=class ub{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=cb(e,r.attrs),this.defaultAttrs=ab(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:lb(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),Rn.setFrom(r))}createChecked(e=null,t,r){return t=_e.from(t),this.checkContent(t),new wo(this,this.computeAttrs(e),t,Rn.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),Rn.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:Rn.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ub(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 YS(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 QS{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?YS(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=cb(e,s.attrs),this.excluded=null;let i=ab(this.attrs);this.instance=i?new Rn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Rn(this,lb(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 Bc{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=Yp.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?Qp(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==""?[]:Qp(this,o.split(" "))}this.nodeFromJSON=s=>wo.fromJSON(this,s),this.markFromJSON=s=>Rn.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 Yp){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,Rn.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 Qp(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 ZS(n){return n.tag!=null}function eC(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(ZS(s))this.tags.push(s);else if(eC(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 eg(this,t,!1);return r.addAll(e,Rn.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new eg(this,t,!0);return r.addAll(e,Rn.none,t.from,t.to),je.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(rC(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=tg(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=tg(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 db={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},tC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},fb={ol:!0,ul:!0},Fl=1,bf=2,Cl=4;function Zp(n,e,t){return e!=null?(e?Fl:0)|(e==="full"?bf:0):n&&n.whitespace=="pre"?Fl|bf:t&~Cl}class gc{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=Rn.none,this.match=i||(o&Cl?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&Fl)){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&&!db.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class eg{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=Zp(null,t.preserveWhitespace,0)|(r?Cl:0);s?i=new gc(s.type,s.attrs,Rn.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new gc(null,null,Rn.none,!0,null,o):i=new gc(e.schema.topNodeType,null,Rn.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&bf?"full":this.localPreserveWS||(s.options&Fl)>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;fb.hasOwnProperty(o)&&this.parser.normalizeLists&&nC(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:tC.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(db.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=Rn.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):ng(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=Zp(e,i,o.options);o.options&Cl&&o.content.length==0&&(a|=Cl);let c=Rn.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):ng(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new gc(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|=Fl)}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 nC(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&fb.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function rC(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function tg(n){let e={};for(let t in n)e[t]=n[t];return e}function ng(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 ha{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=mc(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 mc(t).createTextNode(e.text);let{dom:r,contentDOM:s}=zc(mc(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&&zc(mc(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return typeof t=="string"?{dom:e.createTextNode(t)}:zc(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ha(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=rg(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return rg(e.marks)}}function rg(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function mc(n){return n.document||window.document}const sg=new WeakMap;function sC(n){let e=sg.get(n);return e===void 0&&sg.set(n,e=iC(n)),e}function iC(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 zc(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=sC(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}=zc(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 hb=65535,pb=Math.pow(2,16);function oC(n,e){return n+e*pb}function ig(n){return n&hb}function aC(n){return(n-(n&hb))/pb}const gb=1,mb=2,Fc=4,vb=8;class yf{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&vb)>0}get deletedBefore(){return(this.delInfo&(gb|Fc))>0}get deletedAfter(){return(this.delInfo&(mb|Fc))>0}get deletedAcross(){return(this.delInfo&Fc)>0}}class Bs{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Bs.empty)return Bs.empty}recover(e){let t=0,r=ig(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+aC(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:oC(a/3,e-c),m=0;return u&&(m|=e==c?mb:e==f?gb:Fc,(t<0?e!=c:e!=f)&&(m|=vb)),new yf(p,m,g)}s+=d-u}return r?e+s:new yf(e+s,0,null)}touches(e,t){let r=0,s=ig(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 Bs(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Bs.empty:new Bs(e<0?[0,-e,0]:[0,0,e])}}Bs.empty=new Bs([]);class Hl{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 Hl(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 Hl;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 yf(e,s,null)}}const Rd=Object.create(null);class ls{getMap(){return Bs.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 vr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new vr(e,null)}static fail(e){return new vr(null,e)}static fromReplace(e,t,r,s){try{return vr.ok(e.replace(t,r,s))}catch(i){if(i instanceof Bl)return vr.fail(i.message);throw i}}}function gh(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(gh(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return _e.fromArray(r)}class bo extends ls{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 je(gh(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 vr.fromReplace(e,this.from,this.to,i)}invert(){return new di(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))}}ls.jsonID("addMark",bo);class di extends ls{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 je(gh(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return vr.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 di(t.pos,r.pos,this.mark)}merge(e){return e instanceof di&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new di(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 di(t.from,t.to,e.markFromJSON(t.mark))}}ls.jsonID("removeMark",di);class yo extends ls{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return vr.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return vr.fromReplace(e,this.pos,this.pos+1,new je(_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))}}ls.jsonID("addNodeMark",yo);class oa extends ls{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return vr.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return vr.fromReplace(e,this.pos,this.pos+1,new je(_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))}}ls.jsonID("removeNodeMark",oa);class nr extends ls{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&wf(e,this.from,this.to)?vr.fail("Structure replace would overwrite content"):vr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Bs([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?je.empty:new je(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?je.empty:new je(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,je.fromJSON(e,t.slice),!!t.structure)}}nr.MAP_BIAS=1;ls.jsonID("replace",nr);class Nr extends ls{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&&(wf(e,this.from,this.gapFrom)||wf(e,this.gapTo,this.to)))return vr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return vr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?vr.fromReplace(e,this.from,this.to,r):vr.fail("Content does not fit in gap")}getMap(){return new Bs([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 Nr(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 Nr(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 Nr(t.from,t.to,t.gapFrom,t.gapTo,je.fromJSON(e,t.slice),t.insert,!!t.structure)}}ls.jsonID("replaceAround",Nr);function wf(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 lC(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 m=0;m<f.length;m++)f[m].isInSet(g)||(o&&o.to==h&&o.mark.eq(f[m])?o.to=p:s.push(o=new di(h,p,f[m])));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 cC(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 di(o.from,o.to,o.style)))}function mh(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,je.empty));else{r=f;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new di(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 je(_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 je(c,0,0))}for(let c=o.length-1;c>=0;c--)n.step(o[c])}function uC(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function qa(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+s,c=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(a,c,t))return r;if(r==0||o.type.spec.isolating||!uC(o,a,c))break;a&&(s=1),c<o.childCount&&(i=1)}return null}function dC(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,m=!1;g>t;g--)m||r.index(g)>0?(m=!0,d=_e.from(r.node(g).copy(d)),f++):c--;let h=_e.empty,p=0;for(let g=i,m=!1;g>t;g--)m||s.after(g+1)<s.end(g)?(m=!0,h=_e.from(s.node(g).copy(h)),p++):u++;n.step(new Nr(c,u,o,a,new je(d.append(h),f,p),d.size-f,!0))}function vh(n,e,t=null,r=n){let s=fC(n,e),i=s&&hC(r,e);return i?s.map(og).concat({type:e,attrs:t}).concat(i.map(og)):null}function og(n){return{type:n,attrs:null}}function fC(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 hC(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 pC(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 Nr(s,i,s,i,new je(r,0,0),t.length,!0))}function gC(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)&&mC(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&&yb(n,o,a,i),mh(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 Nr(f,h,f+1,h-1,new je(_e.from(r.create(c,null,o.marks)),0,0),1,!0)),u===!0&&bb(n,o,a,i),!1}})}function bb(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 yb(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 mC(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function vC(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 Nr(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new je(_e.from(o),0,0),1,!0))}function Wi(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 m=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!m.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 bC(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 je(i.append(o),t,t),!0))}function Po(n,e){let t=n.resolve(e),r=t.index();return wb(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function yC(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 wb(n,e){return!!(n&&e&&!n.isLeaf&&yC(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&&wb(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 wC(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);yb(n,d.node(),d.before(),a)}o.inlineContent&&mh(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),je.empty,!0)),r===!0){let d=n.doc.resolve(u);bb(n,d.node(),d.before(),n.steps.length)}return n}function xC(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 xb(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=je.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return kb(s,i,r)?new nr(e,t,r):new kC(s,i,r).fit()}function kb(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class kC{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 je(i,o,a);return e>-1?new Nr(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=ag(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 lg(e,-1)<=t?!1:(this.unplaced.size>1&&lg(e,1)>r&&r++,this.unplaced=new je(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=ag(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new je(gl(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new je(gl(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 m=0;m<i.length;m++)this.openFrontierNode(i[m]);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 m=0;m<s.childCount;m++)d.push(s.child(m));f=f.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let m=a.child(u),v=f.matchType(m.type);if(!v)break;u++,(u>1||c==0||m.content.size)&&(f=v,d.push(_b(m.mark(h.allowedMarks(m.marks)),u==1?c:0,u==a.childCount?p:-1)))}let g=u==a.childCount;g||(p=-1),this.placed=ml(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 m=0,v=a;m<p;m++){let C=v.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),v=C.content}this.unplaced=g?e==0?je.empty:new je(gl(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new je(gl(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=ml(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=ml(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=ml(this.placed,this.frontier.length,t))}}function gl(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(gl(n.firstChild.content,e-1,t)))}function ml(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ml(n.lastChild.content,e-1,t)))}function ag(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function _b(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,_b(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&&!_C(t,i.content,o)?a:null}function _C(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function SC(n){return n.spec.defining||n.spec.definingForContent}function lg(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 CC(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(kb(s,i,r))return n.step(new nr(e,t,r));let o=Cb(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=SC(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 m=0;m<o.length;m++){let v=o[(m+c)%o.length],C=!0;v<0&&(C=!1,v=-v);let z=s.node(v-1),M=s.index(v-1);if(z.canReplaceWith(M,M,g.type,g.marks))return n.replace(s.before(v),C?i.after(v):t,new je(Sb(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 Sb(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Sb(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 MC(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=xC(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new je(_e.from(r),0,0))}function TC(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=Cb(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 Cb(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 Oa extends ls{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 vr.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 vr.fromReplace(e,this.pos,this.pos+1,new je(_e.from(s),0,t.isLeaf?0:1))}getMap(){return Bs.empty}invert(e){return new Oa(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 Oa(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 Oa(t.pos,t.attr,t.value)}}ls.jsonID("attr",Oa);class Ul extends ls{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 vr.ok(r)}getMap(){return Bs.empty}invert(e){return new Ul(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 Ul(t.attr,t.value)}}ls.jsonID("docAttr",Ul);let Ba=class extends Error{};Ba=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ba.prototype=Object.create(Error.prototype);Ba.prototype.constructor=Ba;Ba.prototype.name="TransformError";class Mb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ba(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=je.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 je(_e.from(r),0,0))}delete(e,t){return this.replace(e,t,je.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return CC(this,e,t,r),this}replaceRangeWith(e,t,r){return MC(this,e,t,r),this}deleteRange(e,t){return TC(this,e,t),this}lift(e,t){return dC(this,e,t),this}join(e,t=1){return wC(this,e,t),this}wrap(e,t){return pC(this,e,t),this}setBlockType(e,t=e,r,s=null){return gC(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return vC(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new Oa(e,t,r)),this}setDocAttribute(e,t){return this.step(new Ul(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 Rn)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 bC(this,e,t,r),this}addMark(e,t,r){return lC(this,e,t,r),this}removeMark(e,t,r){return cC(this,e,t,r),this}clearIncompatible(e,t,r){return mh(this,e,t,r),this}}const Id=Object.create(null);class Jt{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new EC(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=je.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?je.empty:t),a==0&&dg(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),dg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new Je(e):Aa(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?Aa(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Aa(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 zs(e.node(0))}static atStart(e){return Aa(e,e,0,0,1)||new zs(e)}static atEnd(e){return Aa(e,e,e.content.size,e.childCount,-1)||new zs(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 Je.between(this.$anchor,this.$head).getBookmark()}}Jt.prototype.visible=!0;class EC{constructor(e,t){this.$from=e,this.$to=t}}let cg=!1;function ug(n){!cg&&!n.parent.inlineContent&&(cg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Je extends Jt{constructor(e,t=e){ug(e),ug(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Jt.near(r);let s=e.resolve(t.map(this.anchor));return new Je(s.parent.inlineContent?s:r,r)}replace(e,t=je.empty){if(super.replace(e,t),t==je.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Je&&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 Je(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=Jt.findFrom(t,r,!0)||Jt.findFrom(t,-r,!0);if(i)t=i.$head;else return Jt.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(Jt.findFrom(e,-r,!0)||Jt.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new Je(e,t)}}Jt.jsonID("text",Je);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 Je.between(e.resolve(this.anchor),e.resolve(this.head))}}class bt extends Jt{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?Jt.near(i):new bt(i)}content(){return new je(_e.from(this.node),0,0)}eq(e){return e instanceof bt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new bh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new bt(e.resolve(t.anchor))}static create(e,t){return new bt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}bt.prototype.visible=!1;Jt.jsonID("node",bt);class bh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yu(r,r):new bh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&bt.isSelectable(r)?new bt(t):Jt.near(t)}}class zs extends Jt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=je.empty){if(t==je.empty){e.delete(0,e.doc.content.size);let r=Jt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new zs(e)}map(e){return new zs(e)}eq(e){return e instanceof zs}getBookmark(){return AC}}Jt.jsonID("all",zs);const AC={map(){return this},resolve(n){return new zs(n)}};function Aa(n,e,t,r,s,i=!1){if(e.inlineContent)return Je.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&&bt.isSelectable(a))return bt.create(n,t-(s<0?a.nodeSize:0))}else{let c=Aa(n,a,t+s,s<0?a.childCount:0,s,i);if(c)return c}t+=a.nodeSize*s}return null}function dg(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof nr||s instanceof Nr))return;let i=n.mapping.maps[r],o;i.forEach((a,c,u,d)=>{o==null&&(o=d)}),n.setSelection(Jt.near(n.doc.resolve(o),t))}const fg=1,vc=2,hg=4;class RC extends Mb{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|fg)&~vc,this.storedMarks=null,this}get selectionSet(){return(this.updated&fg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=vc,this}ensureMarks(e){return Rn.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&vc)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~vc,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)||Rn.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(t);i=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(Jt.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=hg,this}get scrolledIntoView(){return(this.updated&hg)>0}}function pg(n,e){return!e||!n?n:n.bind(e)}class vl{constructor(e,t,r){this.name=e,this.init=pg(t.init,r),this.apply=pg(t.apply,r)}}const PC=[new vl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new vl("selection",{init(n,e){return n.selection||Jt.atStart(e.doc)},apply(n){return n.selection}}),new vl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new vl("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=PC.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 vl(r.key,r.spec.state,r))})}}class Hi{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 Hi(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 RC(this)}static create(e){let t=new Ld(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Hi(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 Hi(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 Hi(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=Jt.fromJSON(i.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[o.name]=u.fromJSON.call(c,e,t[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function Tb(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Tb(s,e,{})),t[r]=s}return t}class Tn{constructor(e){this.spec=e,this.props={},e.props&&Tb(e.props,this,this.props),this.key=e.key?e.key.key:Eb("plugin")}getState(e){return e[this.key]}}const Od=Object.create(null);function Eb(n){return n in Od?n+"$"+ ++Od[n]:(Od[n]=0,n+"$")}class Vn{constructor(e="key"){this.key=Eb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ab=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Rb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Pb=(n,e,t)=>{let r=Rb(n,t);if(!r)return!1;let s=yh(r);if(!s){let o=r.blockRange(),a=o&&qa(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(Ub(n,s,e,-1))return!0;if(r.parent.content.size==0&&(za(i,"end")||bt.isSelectable(i)))for(let o=r.depth;;o--){let a=Xu(n.doc,r.before(o),r.after(o),je.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(za(i,"end")?Jt.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):bt.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},Ib=(n,e,t)=>{let r=Rb(n,t);if(!r)return!1;let s=yh(r);return s?Ob(n,s,e):!1},Lb=(n,e,t)=>{let r=Db(n,t);if(!r)return!1;let s=wh(r);return s?Ob(n,s,e):!1};function Ob(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,je.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(Je.create(d.doc,i)),t(d.scrollIntoView())}return!0}function za(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 Nb=(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=yh(r)}let o=i&&i.nodeBefore;return!o||!bt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(bt.create(n.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function yh(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 Db(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const $b=(n,e,t)=>{let r=Db(n,t);if(!r)return!1;let s=wh(r);if(!s)return!1;let i=s.nodeAfter;if(Ub(n,s,e,1))return!0;if(r.parent.content.size==0&&(za(i,"start")||bt.isSelectable(i))){let o=Xu(n.doc,r.before(),r.after(),je.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(za(i,"start")?Jt.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):bt.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},Bb=(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=wh(r)}let o=i&&i.nodeAfter;return!o||!bt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(bt.create(n.doc,i.pos)).scrollIntoView()),!0)};function wh(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 IC=(n,e)=>{let t=n.selection,r=t instanceof bt,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(bt.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},LC=(n,e)=>{let t=n.selection,r;if(t instanceof bt){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},OC=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&qa(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},zb=(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 xh(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 NC=(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=xh(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,o.createAndFill());c.setSelection(Jt.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},Fb=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof zs||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=xh(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(Je.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Hb=(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(Wi(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&qa(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function DC(n){return(e,t)=>{if(e.selection instanceof bt&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!Wi(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 Je||e.selection instanceof zs)&&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=xh(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=Wi(r.doc,f,o.length,o);if(h||(o[0]=c?{type:c}:null,h=Wi(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)),m=r.doc.resolve(g);c&&s.node(a-1).canReplaceWith(m.index(),m.index()+1,c)&&r.setNodeMarkup(p.map(s.before(a)),c)}return t&&t(r.scrollIntoView()),!0}}const $C=DC(),BC=(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(bt.create(n.doc,s))),!0)};function zC(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 Ub(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,c=s.type.spec.isolating||i.type.spec.isolating;if(!c&&zC(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 m=n.tr.step(new Nr(e.pos-1,p,e.pos,p,new je(g,1,0),o.length,!0)),v=m.doc.resolve(p+2*o.length);v.nodeAfter&&v.nodeAfter.type==s.type&&Po(m.doc,v.pos)&&m.join(v.pos),t(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&c?null:Jt.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&qa(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&za(i,"start",!0)&&za(s,"end")){let p=s,g=[];for(;g.push(p),!p.isTextblock;)p=p.lastChild;let m=i,v=1;for(;!m.isTextblock;m=m.firstChild)v++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let C=_e.empty;for(let M=g.length-1;M>=0;M--)C=_e.from(g[M].copy(C));let z=n.tr.step(new Nr(e.pos-g.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new je(C,g.length,0),0,!0));t(z.scrollIntoView())}return!0}}return!1}function Vb(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(Je.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const FC=Vb(-1),HC=Vb(1);function UC(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i),a=o&&vh(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function gg(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 kh(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}kh(Ab,Pb,Nb);kh(Ab,$b,Bb);kh(zb,Fb,Hb,$C);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function VC(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 WC(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function WC(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=vh(i,t,r,e);return a?(n&&jC(n,e,a,s,t),!0):!1}function jC(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 Nr(e.start-(r?2:0),e.end,e.start,e.end,new je(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&&Wi(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return n}function KC(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?GC(e,t,n,i):qC(e,t,i):!0:!1}}function GC(n,e,t,r){let s=n.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Nr(i-1,o,i,o,new je(_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=qa(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 qC(n,e,t){let r=n.tr,s=t.parent;for(let p=t.end,g=t.endIndex-1,m=t.startIndex;g>m;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 Nr(f-(a?1:0),h+(c?1:0),f+1,h-1,new je((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 JC(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 je(_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 Nr(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const Kr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Fa=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let xf=null;const Fi=function(n,e,t){let r=xf||(xf=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},XC=function(){xf=null},aa=function(n,e,t,r){return t&&(mg(n,e,t,r,-1)||mg(n,e,t,r,1))},YC=/^(img|br|input|textarea|hr)$/i;function mg(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:is(n))){let o=n.parentNode;if(!o||!_t(o)||nc(n)||YC.test(n.nodeName)||n.contentEditable=="false")return!1;e=Kr(n)+(s<0?0:1),n=o}else if(_t(n)){let o=n.childNodes[e+(s<0?-1:0)];if(_t(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?is(n):0}else return!1}}function is(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function _t(n){return n.nodeType==1}function Mr(n){return n.nodeType==3}function la(n,e){return e?n.contains(_t(e)?e:e.parentNode):!1}function QC(n,e){for(;;){if(Mr(n)&&e)return n;if(_t(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=is(n)}else if(n.parentNode&&!nc(n))e=Kr(n),n=n.parentNode;else return null}}function ZC(n,e){for(;;){if(Mr(n)&&e<n.nodeValue.length)return n;if(_t(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!nc(n))e=Kr(n)+1,n=n.parentNode;else return null}}function eM(n,e,t){for(let r=e==0,s=e==is(n);r||s;){if(n==t)return!0;let i=Kr(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==is(n)}}function nc(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 Vo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function tM(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function nM(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(is(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(is(r.startContainer),r.startOffset)}}}const _i=typeof navigator<"u"?navigator:null,vg=typeof document<"u"?document:null,Io=_i&&_i.userAgent||"",kf=/Edge\/(\d+)/.exec(Io),Wb=/MSIE \d/.exec(Io),_f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Io),Es=!!(Wb||_f||kf),ko=Wb?document.documentMode:_f?+_f[1]:kf?+kf[1]:0,Fs=!Es&&/gecko\/(\d+)/i.test(Io);Fs&&+(/Firefox\/(\d+)/.exec(Io)||[0,0])[1];const Sf=!Es&&/Chrome\/(\d+)/.exec(Io),Xr=!!Sf,jb=Sf?+Sf[1]:0,as=!Es&&!!_i&&/Apple Computer/.test(_i.vendor),Ha=as&&(/Mobile\/\w+/.test(Io)||!!_i&&_i.maxTouchPoints>2),Ys=Ha||(_i?/Mac/.test(_i.platform):!1),Kb=_i?/Win/.test(_i.platform):!1,Ui=/Android \d/.test(Io),Zu=!!vg&&"webkitFontSmoothing"in vg.documentElement.style,rM=Zu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function sM(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 Oi(n,e){return typeof n=="number"?n:n[e]}function iM(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 bg(n,e,t){if(!Cf(e)&&e.left==0)return;let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(!_t(o)){o=Fa(o);continue}let a=o==i.body,c=a?sM(i):iM(o),u=0,d=0;if(e.top<c.top+Oi(r,"top")?d=-(c.top-e.top+Oi(s,"top")):e.bottom>c.bottom-Oi(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Oi(s,"top")-c.top:e.bottom-c.bottom+Oi(s,"bottom")),e.left<c.left+Oi(r,"left")?u=-(c.left-e.left+Oi(s,"left")):e.right>c.right-Oi(r,"right")&&(u=e.right-c.right+Oi(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,m=o.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Fa(o)}}function oM(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:Gb(n.dom)}}function Gb(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Fa(r));return e}function aM({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;qb(t,r==0?0:r-e)}function qb(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:i}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let ka=null;function lM(n){if(n.setActive)return n.setActive();if(ka)return n.focus(ka);let e=Gb(n);n.focus(ka==null?{get preventScroll(){return ka={preventScroll:!0},!0}}:void 0),ka||(ka=!1,qb(e,0))}function Jb(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(_t(d))h=d.getClientRects();else if(Mr(d))h=Fi(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 m=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(m<r){t=d,r=m,s=m&&Mr(t)?{left:g.right<e.left?g.right:g.left,top:e.top}:e,_t(d)&&m&&(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&&Mr(t)?cM(t,s):!t||r?{node:n,offset:i}:Jb(t,s)}function cM(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&&_h(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 _h(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function uM(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function dM(n,e,t){let{node:r,offset:s}=Jb(e,t),i=-1;if(_t(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 fM(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(_t(a.dom)&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&c.left>r.left||c.top>r.top?s=a.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function Xb(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=s;;){let o=n.childNodes[i];if(_t(o)){let a=o.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(_h(e,u))return Xb(o,e,u)}}if((i=(i+1)%r)==s)break}return n}function hM(n,e){let t=n.dom.ownerDocument,r,s=0,i=nM(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(!_h(e,u)||(o=Xb(n.dom,e,u),!o))return null}if(as)for(let u=o;r&&u;u=Fa(u))u.draggable&&(r=void 0);if(o=uM(o,e),r){if(Fs&&_t(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&&_t(r)&&_t(u=r.childNodes[s-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&_t(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(s==0||!_t(r)||r.childNodes[s-1].nodeName!="BR")&&(a=fM(n,r,s,e))}a==null&&(a=dM(n,o,e));let c=n.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Cf(n){return n.top<n.bottom||n.left<n.right}function co(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Cf(r))return r}return Array.prototype.find.call(t,Cf)||n.getBoundingClientRect()}const pM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Yb(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),o=Zu||Fs;if(Mr(r))if(o&&(pM.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let c=co(Fi(r,s,s),t);if(Fs&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=co(Fi(r,s-1,s-1),-1);if(u.top==c.top){let d=co(Fi(r,s,s+1),-1);if(d.top!=c.top)return cl(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++,cl(co(Fi(r,c,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==is(r))){let c=r.childNodes[s-1];if(_t(c))return Nd(c.getBoundingClientRect(),!1)}if(i==null&&s<is(r)){let c=r.childNodes[s];if(_t(c))return Nd(c.getBoundingClientRect(),!0)}return Nd(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==is(r))){let c=r.childNodes[s-1],u=Mr(c)?Fi(c,is(c)-(o?0:1)):_t(c)&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return cl(co(u,1),!1)}if(i==null&&s<is(r)){let c=r.childNodes[s];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?Mr(c)?Fi(c,0,o?0:1):_t(c)?c:null:null;if(u)return cl(co(u,-1),!0)}return cl(co(Mr(r)?Fi(r):r,-t),t>=0)}function cl(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 Qb(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 gM(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return Qb(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=Yb(n,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let c;if(_t(a))c=a.getClientRects();else if(Mr(a))c=Fi(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 mM=/[\u0590-\u08ac]/;function vM(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?!mM.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:o:Qb(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:m}=n.domSelectionRange(),v=g&&!la(p,g)||c==g&&u==m;try{a.collapse(d,f),c&&(c!=d||u!=f)&&a.extend&&a.extend(c,u)}catch{}return h!=null&&(a.caretBidiLevel=h),v}):r.pos==r.start()||r.pos==r.end()}let yg=null,wg=null,xg=!1;function bM(n,e,t){return yg==e&&wg==t?xg:(yg=e,wg=t,xg=t=="up"||t=="down"?gM(n,e,t):vM(n,e,t))}const Zs=0,kg=1,Go=2,hi=3;class rc{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=Zs,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>Kr(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)&&!(_t(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 ey||i instanceof Zb&&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?Kr(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?Kr(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=Kr(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=Kr(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(!_t(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 m=this.children[p],v=g+m.size;if(i>g&&o<v)return m.setSelection(e-g-m.border,t-g-m.border,r,s);g=v}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((Fs||as)&&e==t){let{node:p,offset:g}=a;if(Mr(p)){if(f=!!(g&&p.nodeValue[g-1]==`
10
- `),f&&g==p.nodeValue.length)for(let m=p,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(a=c={node:v.parentNode,offset:Kr(v)+1});break}let C=m.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let m=p.childNodes[g-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Fs&&d.focusNode&&d.focusNode!=c.node&&_t(d.focusNode)){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||f&&as)&&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&&Fs)){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:kg,e==a&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=hi:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Go:hi}r=o}this.dirty=Go}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Go:kg;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Zb extends rc{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=_t(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==Zs&&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 yM extends rc{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 rc{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=ha.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&hi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=hi&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Zs){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Zs}}slice(e,t,r){let s=_o.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;t<o&&(i=Tf(i,t,o,r)),e>0&&(i=Tf(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 rc{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(!Mr(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=ha.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=ry(d,r,t),u?c=new wM(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=>_t(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==Zs&&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 kM(this,o&&o.node,e),u=this.node.inlineContent,d=u&&this.node.isBlock;CM(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?Rn.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 m;c.findNodeMatch(f,h,p,g)||a&&e.state.selection.from>s&&e.state.selection.to<s+f.nodeSize&&(m=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(f,h,p,m,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),ty(this.contentDOM,this.children,e),Ha&&MM(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Je)||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=TM(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 yM(this,i,t,s);e.input.compositionNodes.push(o),this.children=Tf(this.children,r,r+s.length,e,o)}update(e,t,r,s){return this.dirty==hi||!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=Zs}updateOuterDeco(e){if(nu(e,this.outerDeco))return;let t=!_t(this.nodeDOM),r=this.dom;this.dom=ny(this.dom,this.nodeDOM,Mf(this.outerDeco,this.node,t),Mf(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){_t(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){_t(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 _g(n,e,t,r,s){ry(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==hi||this.dirty!=Zs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Zs||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=Zs,!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=hi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ey extends rc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Zs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class wM 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==hi)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 ty(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=Sg(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(a,r);if(o instanceof _o){let c=r?r.previousSibling:n.lastChild;ty(o.contentDOM,o.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=Sg(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Ml=function(n){n&&(this.nodeName=n)};Ml.prototype=Object.create(null);const qo=[new Ml];function Mf(n,e,t){if(n.length==0)return qo;let r=t?qo[0]:new Ml,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new Ml(o.nodeName));for(let a in o){let c=o[a];c!=null&&(t&&s.length==1&&s.push(r=new Ml(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 ny(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}xM(s,a||qo[0],o)}return s}function xM(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 ry(n,e,t){return ny(n,n,qo,Mf(e,t,!_t(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 Sg(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class kM{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=_M(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=Zs,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!=hi&&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==hi&&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!=hi&&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=Zs),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 Zb(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))&&((as||Xr)&&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 ey(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||_t(e)&&e.contains(this.lock.parentNode))}}function _M(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 SM(n,e){return n.type.side-e.type.side}function CM(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 v=s[o++];v.widget&&(d?(f||(f=[d])).push(v):d=v)}if(d)if(f){f.sort(SM);for(let v=0;v<f.length;v++)t(f[v],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 v=0;v<a.length;v++)a[v].to<=i&&a.splice(v--,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 v=g;o<s.length&&s[o].from<v&&(v=s[o].from);for(let C=0;C<a.length;C++)a[C].to<v&&(v=a[C].to);v<g&&(c=h.cut(v-i),h=h.cut(0,v-i),g=v,p=-1)}else for(;o<s.length&&s[o].to<g;)o++;let m=h.isInline&&!h.isLeaf?a.filter(v=>!v.inline):a.slice();r(h,m,e.forChild(i,h),p),i=g}}function MM(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 TM(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 Tf(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 Sh(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&&bt.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&eM(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;u=new bt(o==f?a:r.resolve(f))}else if(Fs&&e=="key"&&o>n.state.selection.to&&_t(t.focusNode)&&t.focusOffset==t.focusNode.childNodes.length&&s&&s.posAtStart>n.state.selection.to)for(let f=t.focusNode;;f=f.parentNode){if(getComputedStyle(f).overflow!="visible"){u=Jt.findFrom(r.resolve(s.posAtStart),1);break}if(f==s.dom||f.nextSibling||!f.parentNode||!_t(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=Ch(n,d,a,f)}return u}function sy(n){return n.editable?n.hasFocus():oy(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function ji(n,e=!1){let t=n.state.selection;if(iy(n,t),!sy(n))return;let r=n.input.mouseDown;if(!e&&Xr&&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)AM(n);else{let{anchor:s,head:i}=t,o,a;Cg&&!(t instanceof Je)&&(t.$from.parent.inlineContent||(o=Mg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Mg(n,t.to))),n.docView.setSelection(s,i,n,e),Cg&&(o&&Tg(o),a&&Tg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&EM(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const Cg=as||Xr&&jb<63;function Mg(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(as&&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",as&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Tg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function EM(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(()=>{(!sy(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function AM(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Kr(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Es&&ko<=11&&(t.disabled=!0,t.disabled=!1)}function iy(n,e){if(e instanceof bt){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Eg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Eg(n)}function Eg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ch(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||Je.between(e,t,r)}function Ag(n){return n.editable&&!n.hasFocus()?!1:oy(n)}function oy(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 RM(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 Ef(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&Jt.findFrom(i,e)}function fo(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Rg(n,e,t){let r=n.state.selection;if(r instanceof Je)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 Je(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Ef(n.state,e);return s&&s instanceof bt?fo(n,s):!1}else if(!(Ys&&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?bt.isSelectable(i)?fo(n,new bt(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):fo(n,new Je(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof bt&&r.node.isInline)return fo(n,new Je(e>0?r.$to:r.$from));{let s=Ef(n.state,e);return s?fo(n,s):!1}}}function Tl(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):_t(n)&&n.contentEditable=="false"}function _a(n,e){return e<0?PM(n):IM(n)}function PM(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Fs&&_t(t)&&r<is(t)&&Tl(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!_t(t))break;let a=t.childNodes[r-1];if(Tl(a,-1))s=t,i=--r;else if(Mr(a))t=a,r=t.nodeValue.length;else break}else{if(ay(t))break;{let a=t.previousSibling;for(;a&&Tl(a,-1);)s=t.parentNode,i=Kr(a),a=a.previousSibling;if(a)t=a,r=is(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Af(n,t,r):s&&Af(n,s,i)}function IM(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=is(t),i,o;for(;;)if(r<s){if(!_t(t))break;let a=t.childNodes[r];if(Tl(a,1))i=t,o=++r;else break}else{if(ay(t))break;{let a=t.nextSibling;for(;a&&Tl(a,1);)i=a.parentNode,o=Kr(a)+1,a=a.nextSibling;if(a)t=a,r=0,s=is(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&Af(n,i,o)}function ay(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function LM(n,e){for(;n&&e==n.childNodes.length&&!nc(n);)e=Kr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(Mr(t))return t;if(_t(t)&&t.contentEditable=="false")break;n=t,e=0}}function OM(n,e){for(;n&&!e&&!nc(n);)e=Kr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(Mr(t))return t;if(_t(t)&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Af(n,e,t){if(!Mr(e)){let i,o;(o=LM(e,t))?(e=o,t=0):(i=OM(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&&ji(n)},50)}function Pg(n,e){let t=n.state.doc.resolve(e);if(!(Xr||Kb)&&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 Ig(n,e,t){let r=n.state.selection;if(r instanceof Je&&!r.empty||t.indexOf("s")>-1||Ys&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Ef(n.state,e);if(o&&o instanceof bt)return fo(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof zs?Jt.near(o,e):Jt.findFrom(o,e);return a?fo(n,a):!1}return!1}function Lg(n,e){if(!(n.state.selection instanceof Je))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 Og(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function NM(n){if(!as||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&_t(e)&&t==0&&e.firstChild&&_t(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Og(n,r,"true"),setTimeout(()=>Og(n,r,"false"),20)}return!1}function DM(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function $M(n,e){let t=e.keyCode,r=DM(e);if(t==8||Ys&&t==72&&r=="c")return Lg(n,-1)||_a(n,-1);if(t==46&&!e.shiftKey||Ys&&t==68&&r=="c")return Lg(n,1)||_a(n,1);if(t==13||t==27)return!0;if(t==37||Ys&&t==66&&r=="c"){let s=t==37?Pg(n,n.state.selection.from)=="ltr"?-1:1:-1;return Rg(n,s,r)||_a(n,s)}else if(t==39||Ys&&t==70&&r=="c"){let s=t==39?Pg(n,n.state.selection.from)=="ltr"?1:-1:1;return Rg(n,s,r)||_a(n,s)}else{if(t==38||Ys&&t==80&&r=="c")return Ig(n,-1,r)||_a(n,-1);if(t==40||Ys&&t==78&&r=="c")return NM(n)||Ig(n,1,r)||_a(n,1);if(r==(Ys?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Mh(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")||ha.fromSchema(n.state.schema),a=hy(),c=a.createElement("div");c.appendChild(o.serializeFragment(r,{document:a}));let u=c.firstChild,d,f=0;for(;u&&_t(u)&&(d=fy[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&&_t(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 ly(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 je(_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=ha.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=o.appendChild(document.createElement("p"));m&&v.appendChild(g.serializeNode(p.text(m,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=HM(t),Zu&&UM(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&&!_t(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&&!BM.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=VM(Ng(a,+d[1],+d[2]),d[4]);else if(a=je.maxOpen(zM(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=Ng(a,f,h)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const BM=/^(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 zM(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&&uy(c,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=dy(o[o.length-1],i.length));let d=cy(a,c);o.push(d),s=s.matchType(d.type),i=c}}),o)return _e.from(o)}return n}function cy(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,_e.from(n));return n}function uy(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=uy(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(cy(t,n,s+1))))}}function dy(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,dy(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(_e.empty,!0);return n.copy(t.append(r))}function Rf(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=Rf(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 Ng(n,e,t){return e<n.openStart&&(n=new je(Rf(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new je(Rf(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const fy={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 hy(){return document.implementation.createHTMLDocument("title")}let ul=null;function FM(n){let e=window.trustedTypes;if(!e)return n;if(!ul){if(ul=e.defaultPolicy)try{return ul.createHTML(n)}catch{}ul=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return ul.createHTML(n)}function HM(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=hy(),r=t.body,s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&fy[s[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=FM(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 UM(n){let e=n.querySelectorAll(Xr?"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 VM(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 je(s,i,o)}const ms={},vs={},WM={touchstart:!0,touchmove:!0};class jM{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 KM(n){for(let e in ms){let t=ms[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{qM(n,r)&&!Th(n,r)&&(n.editable||!(r.type in vs))&&t(n,r)},WM[e]?{passive:!0}:void 0)}as&&n.dom.addEventListener("input",()=>null),Pf(n)}function Vi(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function GM(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 Pf(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Th(n,r))})}function Th(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function qM(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 JM(n,e){!Th(n,e)&&ms[e.type]&&(n.editable||!(e.type in vs))&&ms[e.type](n,e)}vs.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!vy(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ui&&Xr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ha&&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,Vo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||$M(n,t)?t.preventDefault():Vi(n,"key")};vs.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};vs.keypress=(n,e)=>{let t=e;if(vy(n)||!t.charCode||t.ctrlKey&&!t.altKey||Ys&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof Je)||!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 sc(n){return{left:n.clientX,top:n.clientY}}function XM(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Eh(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 ic(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 YM(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&bt.isSelectable(r)?(ic(n,new bt(t)),!0):!1}function QM(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof bt&&(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(bt.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?(ic(n,bt.create(n.state.doc,s)),!0):!1}function ZM(n,e,t,r,s){return Eh(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?QM(n,t):YM(n,t))}function e2(n,e,t,r){return Eh(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function t2(n,e,t,r){return Eh(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||n2(n,t,r)}function n2(n,e,t){if(t.button!=0)return!1;let r=py(n,e,!0),s=n.state.doc;return r?(ic(n,r),r instanceof Je&&s.eq(n.state.doc)&&(n.input.mouseDown=new s2(n,r)),!0):!1}function py(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?Je.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 Je.create(r,a+1,a+1+o.content.size);if(t&&bt.isSelectable(o))return bt.create(r,a)}return null}function Ah(n){return ru(n)}const gy=Ys?"metaKey":"ctrlKey";ms.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Ah(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&XM(t,n.input.lastClick)&&!t[gy]&&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(sc(t));o&&(i=="singleClick"?n.input.mouseDown=new r2(n,o,t,!!r):(i=="doubleClick"?e2:t2)(n,o.pos,o.inside,t)?t.preventDefault():Vi(n,"pointer"))};class my{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 r2 extends my{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[gy],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&&_t(c.nodeDOM)?c.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof bt&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fs&&!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()),Vi(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||ji(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(sc(e))),this.updateAllowDefault(e),this.allowDefault||!t?Vi(this.view,"pointer"):ZM(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||as&&this.mightDrag&&!this.mightDrag.node.isAtom||Xr&&!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)?(ic(this.view,Jt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Vi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Vi(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 s2 extends my{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(),Vi(this.view,"pointer");let t=this.view.posAtCoords(sc(e)),r=t&&py(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];ic(this.view,Je.create(s,o,a))}}ms.touchstart=n=>{n.input.lastTouch=Date.now(),Ah(n),Vi(n,"pointer")};ms.touchmove=n=>{n.input.lastTouch=Date.now(),Vi(n,"pointer")};ms.contextmenu=n=>Ah(n);function vy(n,e){return n.composing?!0:as&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const i2=Ui?5e3:-1;vs.compositionstart=vs.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Je&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Xr&&Kb&&o2(n)))n.markCursor=n.state.storedMarks||t.marks(),ru(n,!0),n.markCursor=null;else if(ru(n,!e.selection.empty),Fs&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&_t(s)&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(Mr(o)){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}by(n,i2)};function o2(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||!_t(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return _t(r)&&r.contentEditable=="false"}vs.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++,by(n,20))};function by(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ru(n),e))}function yy(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function a2(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=QC(e.focusNode,e.focusOffset),r=ZC(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(!(Ui&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),yy(n),e||n.docView&&n.docView.dirty){let t=Sh(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 l2(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 Vl=Es&&ko<15||Ha&&rM<604;ms.copy=vs.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Vl?null:t.clipboardData,o=r.content(),{dom:a,text:c}=Mh(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):l2(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function c2(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function u2(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?Wl(n,r.value,null,s,e):Wl(n,r.textContent,r.innerHTML,s,e)},50)}function Wl(n,e,t,r,s){let i=ly(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,s,i||je.empty)))return!0;if(!i)return!1;let o=c2(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 wy(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," "):""}vs.paste=(n,e)=>{let t=e;if(n.composing&&!Ui)return;let r=Vl?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Wl(n,wy(r),r.getData("text/html"),s,t)?t.preventDefault():u2(n,t)};class xy{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const d2=Ys?"altKey":"ctrlKey";function ky(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[d2]}ms.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(sc(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof bt?s.to-1:s.to))){if(r&&r.mightDrag)o=bt.create(n.state.doc,r.mightDrag.pos);else if(t.target&&_t(t.target)){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=bt.create(n.state.doc,f.posBefore))}}let a=(o||n.state.selection).content(),{dom:c,text:u,slice:d}=Mh(n,a);(!t.dataTransfer.files.length||!Xr||jb>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Vl?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Vl||t.dataTransfer.setData("text/plain",u),n.dragging=new xy(d,ky(n,t),o)};ms.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};vs.dragover=vs.dragenter=(n,e)=>e.preventDefault();vs.drop=(n,e)=>{try{f2(n,e,n.dragging)}finally{n.dragging=null}};function f2(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(sc(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=ly(n,wy(e.dataTransfer),Vl?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&ky(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||je.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?xb(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&&bt.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new bt(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,v,C)=>p=C),c.setSelection(Ch(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}ms.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())&&ji(n)},20))};ms.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)};ms.beforeinput=(n,e)=>{if(Ui&&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,Vo(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 vs)ms[n]=vs[n];function jl(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 Or(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&&jl(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 Or(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Co&&jl(this.attrs,e.attrs)&&jl(this.spec,e.spec)}static is(e){return e.type instanceof Co}destroy(){}}class Rh{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 Or(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 Rh&&jl(this.attrs,e.attrs)&&jl(this.spec,e.spec)}destroy(){}}class Or{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Or(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 Or(e,e,new su(t,r))}static inline(e,t,r,s){return new Or(e,t,new Co(r,s))}static node(e,t,r,s){return new Or(e,t,new Rh(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Co}get widget(){return this.type instanceof su}}const Ra=[],na={};class on{constructor(e,t){this.local=e.length?e:Ra,this.children=t.length?t:Ra}static create(e,t){return t.length?iu(t,e,0,na):ns}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==ns||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?h2(this.children,o||[],e,t,r,s,i):o?new on(o.sort(ra),Ra):ns}add(e,t){return t.length?this==ns?on.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=Sy(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=_y(i?Cy(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new on(o.length?this.local.concat(o).sort(ra):this.local,s||this.children)}remove(e){return e.length==0||this==ns?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!=ns?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 on(s,r):ns}forChild(e,t){if(this==ns)return this;if(t.isLeaf)return on.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 on(s.sort(ra),Ra);return r?new go([a,r]):a}return r||ns}eq(e){if(this==e)return!0;if(!(e instanceof on)||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 Ph(this.localsInner(e))}localsInner(e){if(this==ns)return Ra;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)}}on.empty=new on([],[]);on.removeOverlap=Ph;const ns=on.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 on.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=ns&&(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?Ph(r?t:t.sort(ra)):Ra}static from(e){switch(e.length){case 0:return ns;case 1:return e[0];default:return new go(e.every(t=>t instanceof on)?e:e.reduce((t,r)=>t.concat(r instanceof on?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function h2(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,m)=>{let v=m-g-(p-h);for(let C=0;C<a.length;C+=3){let z=a[C+1];if(z<0||h>z+d-f)continue;let M=a[C]+d-f;p>=M?a[C+1]=h<=M?-2:-1:h>=d&&v&&(a[C]+=v,a[C+1]+=v)}f+=v}),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:m}=r.content.findIndex(f),v=r.maybeChild(g);if(v&&m==f&&m+v.nodeSize==p){let C=a[u+2].mapInner(t,v,d+1,n[u]+i+1,o);C!=ns?(a[u]=f,a[u+1]=p,a[u+2]=C):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=p2(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 on(e.sort(ra),a)}function _y(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 Or(s.from+e,s.to+e,s.type))}return t}function p2(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 Sy(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 Cy(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=Sy(n,a,c+t);if(u){i=!0;let d=iu(u,a,t+c+1,r);d!=ns&&s.push(c,c+a.nodeSize,d)}});let o=_y(i?Cy(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 on(o,s):ns}function ra(n,e){return n.from-e.from||n.to-e.to}function Ph(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),Dg(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),Dg(e,s,r.copy(i.from,r.to)));break}}}return e}function Dg(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!=ns&&e.push(r)}),n.cursorWrapper&&e.push(on.create(n.state.doc,[n.cursorWrapper.deco])),go.from(e)}const g2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},m2=Es&&ko<=11;class v2{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 b2{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new v2,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]);Es&&ko<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():as&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),m2&&(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,g2)),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(Ag(this.view)){if(this.suppressingSelectionUpdates)return ji(this.view);if(Es&&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=Fa(i))t.add(i);for(let i=e.anchorNode;i;i=Fa(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:Mr(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)&&Ag(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||Xr&&(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&&_t(f);){if(f.contentEditable=="false"){d.parentNode.removeChild(d);break}f=f.firstChild}}}else if(Fs&&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||x2(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=Sh(e))&&u.eq(Jt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ji(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),y2(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,k2(e,c)),this.handleDOMChange(i,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ji(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),Mr(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(Es&&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?Kr(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),c=i&&i.parentNode==e.target?Kr(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 $g=new WeakMap,Bg=!1;function y2(n){if(!$g.has(n)&&($g.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Fs,Bg)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."),Bg=!0}}function zg(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 w2(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return zg(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?zg(n,t):null}function x2(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 k2(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||!_t(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 _2(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})),Xr&&n.input.lastKeyCode===8)for(let C=o;C>i;C--){let z=s.childNodes[C-1],M=z.pmViewDesc;if(z.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),m=null,v=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:S2(r),context:g});if(d&&d[0].pos!=null){let C=d[0].pos,z=d[1]&&d[1].pos;z==null&&(z=C),m={anchor:C+a,head:z+a}}return{doc:v,sel:m,from:a,to:c}}const S2=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(as&&/^(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||as&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},C2=/^(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 M2(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,D=Sh(n,E);if(D&&!n.state.selection.eq(D)){if(Xr&&Ui&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",U=>U(n,Vo(13,"Enter"))))return;let ee=n.state.tr.setSelection(D);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=_2(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=R2(f.content,u.doc.content,u.from,h,p);if(g&&n.input.domChangeCount++,(Ha&&n.input.lastIOSEnter>Date.now()-225||Ui)&&s.some(E=>_t(E)&&!C2.test(E.nodeName))&&(!g||g.endA>=g.endB)&&n.someProp("handleKeyDown",E=>E(n,Vo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!g)if(r&&c instanceof Je&&!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=Fg(n,n.state.doc,u.sel);if(E&&!E.eq(n.state.selection)){let D=n.state.tr.setSelection(E);i&&D.setMeta("composition",i),n.dispatch(D)}}return}n.state.selection.from<n.state.selection.to&&g.start==g.endB&&n.state.selection instanceof Je&&(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)),Es&&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 m=u.doc.resolveNoCache(g.start-u.from),v=u.doc.resolveNoCache(g.endB-u.from),C=d.resolve(g.start),z=m.sameParent(v)&&m.parent.inlineContent&&C.end()>=g.endA;if((Ha&&n.input.lastIOSEnter>Date.now()-225&&(!z||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!z&&A2(u.doc,m.pos,v.pos))&&n.someProp("handleKeyDown",E=>E(n,Vo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>g.start&&E2(d,g.start,g.endA,m,v)&&n.someProp("handleKeyDown",E=>E(n,Vo(8,"Backspace")))){Ui&&Xr&&n.domObserver.suppressSelectionUpdates();return}Xr&&g.endB==g.start&&(n.input.lastChromeDelete=Date.now()),Ui&&!z&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,v=u.doc.resolveNoCache(g.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,Vo(13,"Enter"))})},20));let M=g.start,S=g.endA,O=E=>{let D=E||n.state.tr.replace(M,S,u.doc.slice(g.start-u.from,g.endB-u.from));if(u.sel){let ee=Fg(n,D.doc,u.sel);ee&&!(Xr&&n.composing&&ee.empty&&(g.start!=g.endB||n.input.lastChromeDelete<Date.now()-100)&&(ee.head==M||ee.head==D.mapping.map(S)-1)||Es&&ee.empty&&ee.head==M)&&D.setSelection(ee)}return i&&D.setMeta("composition",i),D.scrollIntoView()},N;if(z)if(m.pos==v.pos){Es&&ko<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>ji(n),20));let E=O(n.state.tr.delete(M,S)),D=d.resolve(g.start).marksAcross(d.resolve(g.endA));D&&E.ensureMarks(D),n.dispatch(E)}else if(g.endA==g.endB&&(N=T2(m.parent.content.cut(m.parentOffset,v.parentOffset),C.parent.content.cut(C.parentOffset,g.endA-C.start())))){let E=O(n.state.tr);N.type=="add"?E.addMark(M,S,N.mark):E.removeMark(M,S,N.mark),n.dispatch(E)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,v.parentOffset),D=()=>O(n.state.tr.insertText(E,M,S));n.someProp("handleTextInput",ee=>ee(n,M,S,E,D))||n.dispatch(D())}else n.dispatch(O());else n.dispatch(O())}function Fg(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ch(n,e.resolve(t.anchor),e.resolve(t.head))}function T2(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 E2(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 A2(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 R2(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 My{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 jM,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(jg),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=Vg(this),Ug(this),this.nodeViews=Wg(this),this.docView=_g(this.state.doc,Hg(this),$d(this),this.dom,this),this.domObserver=new b2(this,(r,s,i,o)=>M2(this,r,s,i,o)),this.domObserver.start(),KM(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&&Pf(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(jg),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&&(yy(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=Wg(this);I2(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Pf(this),this.editable=Vg(this),Ug(this);let c=$d(this),u=Hg(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&&oM(this);if(o){this.domObserver.stop();let p=f&&(Es||Xr)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&P2(s.selection,e.selection);if(f){let m=Xr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=a2(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=_g(e.doc,u,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let g=this.input.mouseDown;p||!(g&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&RM(this)&&g.delaySelUpdate())?ji(this,p):(iy(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&&aM(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 bt){let t=this.docView.domAfterPos(this.state.selection.from);_t(t)&&bg(this,t.getBoundingClientRect(),e)}else bg(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 xy(e.slice,e.move,s<0?void 0:bt.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(Es){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&&lM(this.dom),ji(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 hM(this,e)}coordsAtPos(e,t=1){return Yb(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 bM(this,t||this.state,e)}pasteHTML(e,t){return Wl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Wl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Mh(this,e)}destroy(){this.docView&&(GM(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,XC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return JM(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?as&&this.root.nodeType===11&&tM(this.dom.ownerDocument)==this.dom&&w2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}My.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Hg(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"),[Or.node(0,n.state.doc.content.size,e)]}function Ug(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:Or.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Vg(n){return!n.someProp("editable",e=>e(n.state)===!1)}function P2(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 Wg(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 I2(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 jg(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:'"'},L2=typeof navigator<"u"&&/Mac/.test(navigator.platform),O2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Gr=0;Gr<10;Gr++)Eo[48+Gr]=Eo[96+Gr]=String(Gr);for(var Gr=1;Gr<=24;Gr++)Eo[Gr+111]="F"+Gr;for(var Gr=65;Gr<=90;Gr++)Eo[Gr]=String.fromCharCode(Gr+32),ou[Gr]=String.fromCharCode(Gr);for(var zd in Eo)ou.hasOwnProperty(zd)||(ou[zd]=Eo[zd]);function N2(n){var e=L2&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||O2&&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 D2=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),$2=typeof navigator<"u"&&/Win/.test(navigator.platform);function B2(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))D2?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 z2(n){let e=Object.create(null);for(let t in n)e[B2(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 F2(n){return new Tn({props:{handleKeyDown:Ty(n)}})}function Ty(n){let e=z2(n);return function(t,r){let s=N2(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)&&!($2&&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,Dr=function(){};Dr.prototype.append=function(e){return e.length?(e=Dr.from(e),!this.length&&e||e.length<au&&this.leafAppend(e)||this.length<au&&e.leafPrepend(this)||this.appendInner(e)):this};Dr.prototype.prepend=function(e){return e.length?Dr.from(e).append(this):this};Dr.prototype.appendInner=function(e){return new H2(this,e)};Dr.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Dr.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Dr.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Dr.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)};Dr.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};Dr.from=function(e){return e instanceof Dr?e:e&&e.length?new Ey(e):Dr.empty};var Ey=(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})(Dr);Dr.empty=new Ey([]);var H2=(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})(Dr);const U2=500;class ui{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 wi(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 wi(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 ui(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 wi(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>W2&&(a=V2(a,u),o-=u),new ui(a.append(i),o)}remapping(e,t){let r=new Hl;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 ui(this.items.append(e.map(t=>new wi(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 m=e.steps[p].invert(e.docs[p]),v=h.selection&&h.selection.map(i.slice(c+1,p));v&&a++,r.push(new wi(g,m,v))}else r.push(new wi(g))},s);let u=[];for(let h=t;h<o;h++)u.push(new wi(i.maps[h]));let d=this.items.slice(0,s).append(u).append(r),f=new ui(d,a);return f.emptyItemCount()>U2&&(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 wi(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 ui(Dr.from(s.reverse()),i)}}ui.empty=new ui(Dr.empty,0);function V2(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class wi{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 wi(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 W2=20;function j2(n,e,t,r){let s=t.getMeta(Mo),i;if(s)return s.historyState;t.getMeta(Ay)&&(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,Hc(e)),n.undone,Kg(t.mapping.maps),n.prevTime,n.prevComposition):new ho(n.done,n.undone.addTransform(t,void 0,r,Hc(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||!K2(t,n.prevRanges)),u=o?Hd(n.prevRanges,t.mapping):Kg(t.mapping.maps);return new ho(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Hc(e)),ui.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 K2(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 Kg(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 G2(n,e,t){let r=Hc(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,Gg=null;function Hc(n){let e=n.plugins;if(Gg!=e){Ud=!1,Gg=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ud=!0;break}}return Ud}function q2(n){return n.setMeta(Ay,!0)}const Mo=new Vn("history"),Ay=new Vn("closeHistory");function J2(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Tn({key:Mo,state:{init(){return new ho(ui.empty,ui.empty,null,0,-1)},apply(e,t,r){return j2(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Py:r=="historyRedo"?Iy:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Ry(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=G2(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Py=Ry(!1,!0),Iy=Ry(!0,!0);function X2(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 Na=class Ly{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,(...m)=>{const v=this.buildProps(u,t),C=p(...m)(v);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=Ly.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 Y2=()=>({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),Q2=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Z2=()=>({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 m=p,v=n.mapping.slice(p);const C=g.map(a),z=g.map(c);if(h.nodesBetween(C,z,(M,S)=>{if(M.type.isText)return;n.mapping.maps.length!==m&&(m=n.mapping.maps.length,v=n.mapping.slice(p));const O=n.doc.resolve(v.map(S)),N=n.doc.resolve(v.map(S+M.nodeSize)),E=O.blockRange(N);if(!E)return;const D=qa(E);if(M.type.isTextblock){const{defaultType:ee}=O.parent.contentMatchAt(O.index()),U=n.doc.nodeAt(E.start);ee&&U&&!U.hasMarkup(ee)&&ee.validContent(U.content)&&n.setNodeMarkup(E.start,ee)}(D||D===0)&&n.lift(E,D)}),n.doc.eq(h))break}}),!0},eT=n=>e=>n(e),tT=()=>({state:n,dispatch:e})=>Fb(n,e),nT=(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 Je(r.doc.resolve(Math.max(o-1,0)))),!0},rT=()=>({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 Tr(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 sT=n=>({tr:e,state:t,dispatch:r})=>{const s=Tr(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},iT=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},oT=n=>n.content?/^text(\*|\+)/.test(n.content):!1,qg=(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 oT(r)?t==="left"?n.start()-1:n.end()+1:n.pos},aT=(n,e,t)=>({from:qg(n,t,"left"),to:qg(e,t,"right")}),lT=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,s=n.selection instanceof Je?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}=aT(c,u,n.schema);t.deleteRange(d,f)}),t.selection.empty||t.setSelection(Je.near(t.doc.resolve(t.selection.from))),s&&t.ensureMarks(s),t.scrollIntoView(),e(t)}return!0},cT=()=>({commands:n})=>n.keyboardShortcut("Enter"),uT=()=>({state:n,dispatch:e})=>NC(n,e);function Ih(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]:Ih(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function Oy(n,e,t={}){return n.find(r=>r.type===e&&lu(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Jg(n,e,t={}){return!!Oy(n,e,t)}function Lh(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(!Oy([...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&&Jg([...n.parent.child(s-1).marks],e,t);)s-=1,i-=n.parent.child(s).nodeSize;for(;o<n.parent.childCount&&Jg([...n.parent.child(o).marks],e,t);)a+=n.parent.child(o).nodeSize,o+=1;return{from:i,to:a}}function Qi(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 dT=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=Qi(n,r.schema),{doc:o,selection:a}=t,{$from:c,from:u,to:d}=a;if(s){const f=Lh(c,i,e);if(f&&f.from<=u&&f.to>=d){const h=Je.create(o,f.from,f.to);t.setSelection(h)}}return!0},fT=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 Ny(n){return n instanceof Je}function Jo(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function If(n,e=null){if(!e)return null;const t=Jt.atStart(n),r=Jt.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?Je.create(n,Jo(0,s,i),Jo(n.content.size,s,i)):Je.create(n,Jo(e,s,i),Jo(e,s,i))}function Lf(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Kl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function hT(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const pT=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Kl()||Lf())&&r.dom.focus(),hT()&&!Kl()&&!Lf()&&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&&!Ny(t.state.selection))return o(),!0;const a=If(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},gT=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),mT=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Dy=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&&Dy(r)}return n};function bc(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 Dy(t)}function $y(n){return typeof n?.nodesBetween=="function"}function Ua(n,e,t){if($y(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),Ua("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const c=new Bc({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(bc(n),t.parseOptions):xo.fromSchema(c).parse(bc(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(bc(n),t.parseOptions).content:i.parse(bc(n),t.parseOptions)}return Ua("",e,t)}function By(n){return!("type"in n)}function zy(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof nr||s instanceof Nr))return;const i=n.mapping.maps[r];let o=0;i.forEach((a,c,u,d)=>{o===0&&(o=d)}),n.setSelection(Jt.near(n.doc.resolve(o),t))}const vT=(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=v=>{i.emit("contentError",{editor:i,error:v,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{Ua(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(v){c(v)}try{var o;a=Ua(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(v){return c(v),!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=By(a)?a.content:[a];if(g.forEach(v=>{v.check(),h=h?v.isText&&v.marks.length===0:!1,p=p?v.isBlock:!1}),d===f&&p){const{parent:v}=r.doc.resolve(d);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(d-=1,f+=1)}let m;if(h)Array.isArray(e)?m=e.map(v=>v.text||"").join(""):$y(e)?m=g.map(v=>{var C;return(C=v.text)!==null&&C!==void 0?C:""}).join(""):typeof e=="object"&&e&&e.text?m=e.text:m=e,r.insertText(m,d,f);else{m=_e.from(g);const v=r.doc.resolve(d),C=v.node(),z=v.parentOffset===0,M=C.isText||C.isTextblock,S=C.content.size>0;z&&M&&S&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}t.updateSelection&&zy(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0};function Fy(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 bT=(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=Fy(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=Ua(o,r.schema);h=u.createAndFill(f,p)}else h=u.createAndFill(f);return h?(t&&(e.insert(c.pos,h),a&&zy(e,e.steps.length-1,-1)),!0):!1},yT=()=>({state:n,dispatch:e})=>IC(n,e),wT=()=>({state:n,dispatch:e})=>LC(n,e),xT=()=>({state:n,dispatch:e})=>Pb(n,e),kT=()=>({state:n,dispatch:e})=>$b(n,e),Hy=(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},_T=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ju(n.doc,n.selection.$from.pos,-1);return r==null||!Hy(n.doc,r)?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ST=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ju(n.doc,n.selection.$from.pos,1);return r==null||!Hy(n.doc,r)?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},CT=()=>({state:n,dispatch:e})=>Ib(n,e),MT=()=>({state:n,dispatch:e})=>Lb(n,e);function Uy(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function TT(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))Kl()||Uy()?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 ET=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=TT(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 qi(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?Tr(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 AT=(n,e={})=>({state:t,dispatch:r})=>qi(t,Tr(n,t.schema),e)?OC(t,r):!1,RT=()=>({state:n,dispatch:e})=>Hb(n,e),PT=n=>({state:e,dispatch:t})=>{const r=Tr(n,e.schema);return KC(r)(e,t)},IT=()=>({state:n,dispatch:e})=>zb(n,e);function nd(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Xg(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 LT=(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=Tr(n,r.schema)),a==="mark"&&(o=Qi(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,Xg(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(Xg(h.attrs,e))))})})}),c},OT=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),NT=()=>({tr:n,dispatch:e})=>{if(e){const t=new zs(n.doc);n.setSelection(t)}return!0},DT=()=>({state:n,dispatch:e})=>Nb(n,e),$T=()=>({state:n,dispatch:e})=>Bb(n,e),BT=()=>({state:n,dispatch:e})=>BC(n,e),zT=()=>({state:n,dispatch:e})=>HC(n,e),FT=()=>({state:n,dispatch:e})=>FC(n,e);function cu(n,e,t={},r={}){return Ua(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const HT=(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=By(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 Vy(n,e){const t=Qi(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 Wy(n,e){const t=new Mb(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function iB(n,e){const t=[];return n.descendants((r,s)=>{e(r)&&t.push({node:r,pos:s})}),t}function UT(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function VT(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=>VT(e.$from,n)}function dt(n,e,t){return n.config[e]===void 0&&n.parent?dt(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?dt(n.parent,e,t):null}):n.config[e]}function Oh(n){return n.map(e=>{const t=dt(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Oh(t())]:e}).flat(10)}function Nh(n,e){const t=ha.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function jy(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 WT={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"},jT={inclusive:"boolean",excludes:"string",group:"string",spanning:"boolean",code:"boolean"};function KT(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 Yg(n,e,t,r){return{...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="attrs"&&!Object.hasOwn(r,s))),...KT(t,r,n),attrs:t.attrs}}function Qg(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 GT(n,e){Qg(n.nodes,e.nodes,"node"),Qg(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,Yg(s,n.nodes[s],i,WT))}),e.spec.marks.forEach((s,i)=>{r=r.update(s,Yg(s,n.marks[s],i,jT))}),{topNode:e.topNodeType.name,nodes:t,marks:r}}function Ky(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Va(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function Dh(n){const e=[],{nodeExtensions:t,markExtensions:r}=Va(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=dt(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,m])=>{e.push({type:p,name:g,attribute:{...i,...m}})})})})}),s.forEach(u=>{const d=dt(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 Of(n){return typeof n=="function"}function vn(n,e=void 0,...t){return Of(n)?e?n.bind(e)(...t):n(...t):n}function qT(n={}){return Object.keys(n).length===0&&n.constructor===Object}function JT(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 Zg(n){const e=[],t=JT(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 bn(...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([...Zg(r[s]),...Zg(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)=>bn(t,r),{})}function XT(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function em(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):XT(t.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function tm(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&qT(t)?!1:t!=null))}function nm(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 rm(n,e,t=Dh(n)){var r;const{nodeExtensions:s,markExtensions:i}=Va(n);return{topNode:(r=s.find(o=>dt(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=tm({...n.reduce((p,g)=>{const m=dt(g,"extendNodeSchema",c);return{...p,...m?m(o):{}}},{}),content:vn(dt(o,"content",c)),marks:vn(dt(o,"marks",c)),group:vn(dt(o,"group",c)),inline:vn(dt(o,"inline",c)),atom:vn(dt(o,"atom",c)),selectable:vn(dt(o,"selectable",c)),draggable:vn(dt(o,"draggable",c)),code:vn(dt(o,"code",c)),whitespace:vn(dt(o,"whitespace",c)),linebreakReplacement:vn(dt(o,"linebreakReplacement",c)),defining:vn(dt(o,"defining",c)),isolating:vn(dt(o,"isolating",c)),attrs:Object.fromEntries(a.map(nm))}),d=vn(dt(o,"parseHTML",c));d&&(u.parseDOM=d.map(p=>em(p,a)));const f=dt(o,"renderHTML",c);f&&(u.toDOM=p=>f({node:p,HTMLAttributes:ca(p,a)}));const h=dt(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=tm({...n.reduce((h,p)=>{const g=dt(p,"extendMarkSchema",c);return{...h,...g?g(o):{}}},{}),inclusive:vn(dt(o,"inclusive",c)),excludes:vn(dt(o,"excludes",c)),group:vn(dt(o,"group",c)),spanning:vn(dt(o,"spanning",c)),code:vn(dt(o,"code",c)),attrs:Object.fromEntries(a.map(nm))}),d=vn(dt(o,"parseHTML",c));d&&(u.parseDOM=d.map(h=>em(h,a)));const f=dt(o,"renderHTML",c);return f&&(u.toDOM=h=>f({mark:h,HTMLAttributes:ca(h,a)})),[o.name,u]}))}}function YT(n,e,t){if(t===void 0)return new Bc(rm(n,e));const r=Ky(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 Bc(t),i=rm(n,e,jy(Dh(n),s));return new Bc(GT(i,s))}function El(n){return n.sort((t,r)=>{const s=dt(t,"priority")||100,i=dt(r,"priority")||100;return s>i?-1:s<i?1:0})}function Gy(n){const e=El(Oh(n)),t=Ky(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 $h(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 QT(n,e){return $h(n,{from:0,to:n.content.size},e)}function Bh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function ZT(n,e){const t=Tr(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 qy(n,e){const t=nd(typeof e=="string"?e:e.name,n.schema);return t==="node"?ZT(n,e):t==="mark"?Vy(n,e):{}}function eE(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 tE(n){const e=eE(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}})})}),tE(r)}function id(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=Lh(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 nE=(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]},rE=n=>{const e=n.depth-1;if(e<0)return null;const t=n.index(e);return t===0?null:n.node(e).child(t-1)};function Sa(n,e){return e.nodes[n]||e.marks[n]||null}function Uc(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 sE=(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 Nf(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?Qi(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,m)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const v=Math.max(h,m),C=Math.min(p,m+g.nodeSize),z=C-v;o+=z,a.push(...g.marks.map(M=>({mark:M,from:v,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 iE(n,e,t={}){if(!e)return qi(n,null,t)||Nf(n,null,t);const r=nd(e,n.schema);return r==="node"?qi(n,e,t):r==="mark"?Nf(n,e,t):!1}const oE=(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)},aE=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function sm(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function dl(n,e){const{nodeExtensions:t}=Va(e),r=t.find(i=>i.name===n);if(!r)return!1;const s=vn(dt(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function oc(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&&(oc(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function Jy(n){return n instanceof bt}function lE(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 cE(n){if(n===null||typeof n!="object")return!1;const e=n;if(!lE(e))return!1;const t=e.toJSON();return!(t===null||typeof t!="object"||t.stepType!=="replace")}var Xy=class Yy{constructor(e){this.position=e}static fromJSON(e){return new Yy(e.position)}toJSON(){return{position:this.position}}};function uE(n,e){const t=e.mapping.mapResult(n.position);return{position:new Xy(t.pos),mapResult:t}}function dE(n){return new Xy(n)}function fE(n,e,t){const{selection:r}=e;let s=null;if(Ny(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(m=>m.type.excludes(t));u=p&&g}return!u}),u})}const hE=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:a}=i,c=Qi(n,r.schema);if(s)if(o){const u=Vy(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),m=Math.min(p+h.nodeSize,f);h.marks.find(v=>v.type===c)?h.marks.forEach(v=>{c===v.type&&t.addMark(g,m,c.create({...v.attrs,...e}))}):t.addMark(g,m,c.create(e))})});return fE(r,t,c)},pE=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),gE=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=Tr(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})=>gg(i,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>gg(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},mE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Jo(n,0,r.content.size),i=bt.create(r,s);e.setSelection(i)}return!0},vE=(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},bE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=Je.atStart(r).from,a=Je.atEnd(r).to,c=Jo(s,o,a),u=Jo(i,o,a),d=Je.create(r,c,u);e.setSelection(d)}return!0},yE=n=>({state:e,dispatch:t})=>{const r=Tr(n,e.schema);return JC(r)(e,t)};function im(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 wE=({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=Uc(u,a.node().type.name,a.node().attrs);if(i instanceof bt&&i.node.isBlock)return!a.parentOffset||!Wi(o,a.pos)?!1:(r&&(n&&im(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:Fy(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0;const g=i instanceof Je&&!i.empty?Hi.create({doc:e.doc,selection:i}).tr.deleteSelection():null,m=g?g.doc:e.doc,v=g?g.mapping.map(a.pos):a.pos;let C=Wi(m,v,1,p);if(!p&&!C&&Wi(m,v,1,h?[{type:h}]:void 0)&&(C=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(C){const z=e.steps.length;if(i instanceof Je&&e.deleteSelection(),e.split(e.mapping.slice(z).map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h){const M=e.mapping.slice(z).map(a.before()),S=e.doc.resolve(M);a.node(-1).canReplaceWith(S.index(),S.index()+1,h)&&e.setNodeMarkup(e.mapping.slice(z).map(a.before()),h)}}n&&im(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return C},xE=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{const o=Tr(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 O=a.index(-1)?1:a.index(-2)?2:3;for(let oe=a.depth-O;oe>=a.depth-3;oe-=1)S=_e.from(a.node(oe).copy(S));const N=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...Uc(f,a.node().type.name,a.node().attrs),...e},D=((h=o.contentMatch.defaultType)===null||h===void 0?void 0:h.createAndFill(E))||void 0;S=S.append(_e.from(o.createAndFill(null,D)||void 0));const ee=a.before(a.depth-(O-1));t.replace(ee,a.after(-N),new je(S,4-O,0));let U=-1;t.doc.nodesBetween(ee,t.doc.content.size,(oe,F)=>{if(U>-1)return!1;oe.isTextblock&&oe.content.size===0&&(U=F+1)}),U>-1&&t.setSelection(Je.near(t.doc.resolve(U))),t.scrollIntoView()}return!0}const p=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,g={...Uc(f,d.type.name,d.attrs),...e},m={...Uc(f,a.node().type.name,a.node().attrs),...e},v=a.parentOffset===0&&a.index(-1)===0,C=a.before(-1);t.delete(a.pos,c.pos);const z=v?d.attrs:g,M=p?[{type:o,attrs:z},{type:p,attrs:m}]:[{type:o,attrs:z}];if(!Wi(t.doc,a.pos,2))return!1;if(s){const{selection:S,storedMarks:O}=r,{splittableMarks:N}=i.extensionManager,E=O||S.$to.parentOffset&&S.$from.marks();if(t.split(a.pos,2,M).scrollIntoView(),v&&t.setNodeMarkup(C,void 0,g),!E||!s)return!0;const D=E.filter(ee=>N.includes(ee.type.name));t.ensureMarks(D)}return!0};function Qy(n,e,t){if(!n.validContent(e))return null;try{return n.create(t,e)}catch{return null}}function zh(n,e){if(n.pendingContent.length===0)return!0;const t=Qy(e,_e.from(n.pendingContent));return t?(n.items.push(t),n.pendingContent=[],!0):!1}function kE(n,e,t){return t.validContent(_e.from([...e.pendingContent,n]))?(e.pendingContent.push(n),!0):!zh(e,t)||!t.validContent(_e.from(n))?!1:(e.pendingContent.push(n),!0)}function _E(n,e,t,r){const s=r(n,t);if(!s)return!1;const i=Qy(t.listType,_e.from(s),n.attrs);return i?t.itemType.validContent(_e.from([...e.pendingContent,i]))?(e.pendingContent.push(i),!0):zh(e,t.itemType)?(e.items.push(...s),!0):!1:!1}function SE(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)?_E(i,r,e,t):kE(i,r,e.itemType)))return null}return zh(r,e.itemType)?r.items:null}function Zy(n,e){const t=[];for(let r=0;r<n.childCount;r+=1){const s=SE(n.child(r),e,Zy);if(!s)return null;t.push(...s)}return t}function om(n,e){let t=null;return n.descendants((r,s)=>r!==e?!0:(t=s,!1)),t}function am(n){return!n||n==="1"?null:n}function e0(n,e){return am(n)===am(e)}const yc=(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))||!e0(t.node.attrs.type,s?.attrs.type)||n.join(t.pos),!0},wc=(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))||!e0(t.node.attrs.type,s?.attrs.type)||n.join(r),!0};function CE(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return Je.between(r,s)}const ME=(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=Tr(n,o.schema),g=Tr(e,o.schema),{selection:m,storedMarks:v}=o,{$from:C,$to:z}=m,M=C.blockRange(z),S=v||m.$to.parentOffset&&m.$from.marks();if(!M)return!1;const O=rd(X=>dl(X.type.name,f))(m),N=m.from===0&&m.to===o.doc.content.size,E=o.doc.content.content,D=E.length===1?E[0]:null,ee=N&&D&&dl(D.type.name,f)?{node:D,pos:0}:null,U=O??ee,oe=!!O&&M.depth>=1&&M.depth-O.depth<=1,F=!!ee;if((oe||F)&&U){if(U.node.type===p)return N&&F?c().command(({tr:X,dispatch:le})=>{const re=CE(X);return re?(X.setSelection(re),le&&le(X),!0):!1}).liftListItem(g).run():u.liftListItem(g);if(dl(U.node.type.name,f)&&p.validContent(U.node.content))return c().command(()=>(i.setNodeMarkup(U.pos,p),!0)).command(()=>yc(i,p)).command(()=>wc(i,p)).run();if(dl(U.node.type.name,f)){var W;const X=(W=U.node.firstChild)===null||W===void 0?void 0:W.type;if(X&&X!==g){const le=Zy(U.node,{listType:p,itemType:g,isListNode:Q=>dl(Q.type.name,f)}),re=le?_e.from(le):null;return!re||!p.validContent(re)?!1:c().command(()=>{const{$anchor:Q,$head:me}=i.selection,P=Q.parent,$=me.parent,ce=Q.parentOffset,pe=me.parentOffset;let ye;try{ye=p.create(r,re)}catch{return!1}if(i.replaceWith(U.pos,U.pos+U.node.nodeSize,ye),P.inlineContent&&$.inlineContent){const Z=om(ye,P),ae=om(ye,$);if(Z!==null&&ae!==null){const V=U.pos+Z+2+ce,K=U.pos+ae+2+pe;i.setSelection(Je.create(i.doc,V,K))}}return!0}).command(()=>yc(i,p)).command(()=>wc(i,p)).run()}}}return!t||!S||!a?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>yc(i,p)).command(()=>wc(i,p)).run():c().command(()=>{const X=d().wrapInList(p,r),le=S.filter(re=>h.includes(re.type.name));return i.ensureMarks(le),X?!0:u.clearNodes()}).wrapInList(p,r).command(()=>yc(i,p)).command(()=>wc(i,p)).run()},TE=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=Qi(n,r.schema);return Nf(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},EE=(n,e,t={})=>({state:r,commands:s})=>{const i=Tr(n,r.schema),o=Tr(e,r.schema),a=qi(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})},AE=(n,e={})=>({state:t,commands:r})=>{const s=Tr(n,t.schema);return qi(t,s,e)?r.lift(s):r.wrapIn(s,e)},RE=()=>({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},PE=(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},IE=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=t,a=Qi(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=Lh(c,a,(f=c.marks().find(m=>m.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},LE=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},OE=(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=Tr(n,r.schema)),a==="mark"&&(o=Qi(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,m;t.selection.empty?r.doc.nodesBetween(d,f,(v,C)=>{i&&i===v.type&&(c=!0,g=Math.max(C,d),m=Math.min(C+v.nodeSize,f),h=C,p=v)}):r.doc.nodesBetween(d,f,(v,C)=>{C<d&&i&&i===v.type&&(c=!0,g=Math.max(C,d),m=Math.min(C+v.nodeSize,f),h=C,p=v),C>=d&&C<=f&&(i&&i===v.type&&(c=!0,s&&t.setNodeMarkup(C,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(z=>{if(o===z.type&&(c=!0,s)){const M=Math.max(C,d),S=Math.min(C+v.nodeSize,f);t.addMark(M,S,o.create({...z.attrs,...e}))}}))}),p&&(h!==void 0&&s&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(v=>{o===v.type&&s&&t.addMark(g,m,o.create({...v.attrs,...e}))}))}),c},Pa=new Vn("__tiptap_decorations__"),NE=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(Pa,{type:"force",name:n}),!0),DE=(n,e={})=>({state:t,dispatch:r})=>{const s=Tr(n,t.schema);return UC(s,e)(t,r)},$E=(n,e={})=>({state:t,dispatch:r})=>{const s=Tr(n,t.schema);return VC(s,e)(t,r)};var BE=DS({blur:()=>Y2,clearContent:()=>Q2,clearNodes:()=>Z2,command:()=>eT,createParagraphNear:()=>tT,cut:()=>nT,deleteCurrentNode:()=>rT,deleteNode:()=>sT,deleteRange:()=>iT,deleteSelection:()=>lT,enter:()=>cT,exitCode:()=>uT,extendMarkRange:()=>dT,first:()=>fT,focus:()=>pT,forEach:()=>gT,insertContent:()=>mT,insertContentAt:()=>vT,insertDefaultBlock:()=>bT,joinBackward:()=>xT,joinDown:()=>wT,joinForward:()=>kT,joinItemBackward:()=>_T,joinItemForward:()=>ST,joinTextblockBackward:()=>CT,joinTextblockForward:()=>MT,joinUp:()=>yT,keyboardShortcut:()=>ET,lift:()=>AT,liftEmptyBlock:()=>RT,liftListItem:()=>PT,newlineInCode:()=>IT,resetAttributes:()=>LT,scrollIntoView:()=>OT,selectAll:()=>NT,selectNodeBackward:()=>DT,selectNodeForward:()=>$T,selectParentNode:()=>BT,selectTextblockEnd:()=>zT,selectTextblockStart:()=>FT,setContent:()=>HT,setMark:()=>hE,setMeta:()=>pE,setNode:()=>gE,setNodeSelection:()=>mE,setTextDirection:()=>vE,setTextSelection:()=>bE,sinkListItem:()=>yE,splitBlock:()=>wE,splitListItem:()=>xE,toggleList:()=>ME,toggleMark:()=>TE,toggleNode:()=>EE,toggleWrap:()=>AE,undoInputRule:()=>RE,unsetAllMarks:()=>PE,unsetMark:()=>IE,unsetTextDirection:()=>LE,updateAttributes:()=>OE,updateDecorations:()=>NE,wrapIn:()=>DE,wrapInList:()=>$E});const fl=new WeakMap;function zE(n,e){var t;fl.set(n,((t=fl.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const s=((r=fl.get(n))!==null&&r!==void 0?r:1)-1;s>0?fl.set(n,s):fl.delete(n)}}var FE=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 HE(n){return n.kind==="widget"}function t0(n,e){const t=[],r=new Set;for(const s of n)s.kind==="widget"&&HE(s)&&r.add(s.key),t.push(s.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function UE(n,e,t){const{decorations:r,widgetKeys:s}=t0(e,t);return{set:on.create(n,r),widgetKeys:s}}function n0({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function VE({decorations:n,from:e,to:t,docSize:r,extensionName:s,warnedExtensions:i}){return n.filter(o=>n0({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 WE(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function r0(n){return n.jsonID==="attr"}function jE(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||r0(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function KE(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 GE(n,e){if(n.steps.some(i=>!jE(i)))return{type:"full"};const t=sd(n).map(({newRange:i})=>i);n.steps.forEach((i,o)=>{if(!r0(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=KE(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 s0(n,e,t,r){return n.map(e,t,{onRemove:s=>{const i=s?.key;typeof i=="string"&&r.delete(i)}})}function qE(n,e,t){var r,s;const i=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:on.empty,o=new Set((s=e.widgetKeysByExtension[n])!==null&&s!==void 0?s:[]);return{set:s0(i,t.mapping,t.doc,o),widgetKeys:o}}function lm(n,e){const t=Object.values(e).flatMap(r=>r.find());return on.create(n,t)}function cm(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function JE(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 XE(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const YE=new Set;var QE=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=Pa.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>JE(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=Pa.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:YE}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 Tn({key:Pa,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:cm(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,s,i)=>{const o=t.getMeta(Pa),a=o?.type==="force"&&!o.name,c=o?.type==="force"?o.name:void 0,u={},d={},f=new Set;return zE(n,()=>{for(const{name:h,spec:p}of e){const g=a||c===h;if(XE(p,{editor:n,tr:t,oldState:s,newState:i},g))if(p.update==="changedRanges"&&t.docChanged&&!g){const m=this.applyChangedRangesRecompute(h,p,r,t,i);u[h]=m.set,d[h]=m.widgetKeys,f.add(h)}else{const{set:m,widgetKeys:v}=this.buildFullSet(h,p,i);u[h]=m,d[h]=v,f.add(h)}else{const m=qE(h,r,t);u[h]=m.set,d[h]=m.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:cm(d)}}},props:{decorations(t){var r,s;return(r=(s=Pa.getState(t))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:on.empty}}})}applyChangedRangesRecompute(n,e,t,r,s){const i=GE(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:on.empty,u=new Set((a=t.widgetKeysByExtension[n])!==null&&a!==void 0?a:[]);let d=s0(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=>n0({position:C.from,from:h,to:p,docSize:f}));for(const C of g){const z=WE(C);z&&u.delete(z)}d=d.remove(g);const{decorations:m,widgetKeys:v}=t0(VE({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,m);for(const C of v)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 UE(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]]:lm(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):lm(t.doc,r)}};function ZE(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof bt){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 eA(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 um(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function tA(n){return typeof n=="number"}function nA(n){return Object.prototype.toString.call(n).slice(8,-1)}function xc(n){return nA(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function oB(n){return typeof n=="string"&&n.trim().length>0&&!/[;{}]/.test(n)}function Fh(n){return/\s/.test(n)}function i0(n){return/^\w$/.test(n)}function rA(n,e){for(;e<n.length&&Fh(n[e]);)e+=1;return e}function od(n,e){for(;e<n.length&&!Fh(n[e]);)e+=1;return e}function sA(n,e,t){for(;e<n.length&&(i0(n[e])||t);)e+=1;return e}function iA(n,e){const t=n.indexOf(n[e],e+1);return{nextIndex:od(n,t===-1?e:t+1)}}function oA(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 aA(n,e,t){const r=t==="pandoc",s=sA(n,e+1,r),i=n.slice(e,s),o=oA(n,i,s);if(o)return o;const a=s===n.length||Fh(n[s]);return{token:r&&a?{type:"boolean",name:i}:void 0,nextIndex:t==="shortcode"?od(n,s):s}}function lA(n,e,t){const r=n[e];return r==='"'||r==="'"?iA(n,e):i0(r)?aA(n,e,t):{nextIndex:od(n,e)}}function cA(n,e){const t=[];let r=0;for(;r<n.length&&(r=rA(n,r),!(r>=n.length));){const s=lA(n,r,e);s.token&&t.push(s.token),r=s.nextIndex}return t}function uA(n){const e={};return cA(n,"shortcode").forEach(t=>{t.type==="keyValue"&&(e[t.name]=t.value)}),e}function dA(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function fA(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=uA,serializeAttributes:i=dA,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:c}=n,u=t||e,d=h=>{if(!c)return h;const p={};return c.forEach(g=>{const m=typeof g=="string"?g:g.name,v=typeof g=="string"?void 0:g.skipIfDefault;if(m in h){const C=h[m];if(v!==void 0&&C===v)return;p[m]=C}}),p},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const g={...o,...h.attributes};if(a)return p.createNode(e,g);const m=r?r(h):h.content||"";return m?p.createNode(e,g,[p.createTextNode(m)]):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),m=g?.index;return m!==void 0?m:-1},tokenize(h,p,g){const m=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),v=h.match(m);if(!v)return;let C="",z="";if(a){const[,S]=v;z=S}else{const[,S,O]=v;z=S,C=O||""}const M=s(z.trim());return{type:e,raw:v[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||{}),m=i(g),v=m?` ${m}`:"";return a?`[${u}${v}]`:`[${u}${v}]${p}[/${u}]`}}}function hA(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 pA(n,e){const t=`text
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BU46x7E3.js","/app/immutable/chunks/CVtvGnj8.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/CGpelL0C.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/BE35_Kwj.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/BT-leRNV.js","/app/immutable/chunks/CR_DYxzQ.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/BlKpyqxv.js","/app/immutable/chunks/CQNY8AIr.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/B64lZ_-k.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/BooXdurD.js","/app/immutable/chunks/BwmV4u5a.js","/app/immutable/chunks/PnRQRSpt.js","/app/immutable/chunks/tOQ0MdfM.js","/app/immutable/chunks/DKs05YEr.js","/app/immutable/chunks/DGvhYwwC.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/CeW1xZTK.js","/app/immutable/chunks/sj0eQTm1.js","/app/immutable/chunks/BYrBvRoU.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CXWGcPvu.js","/app/immutable/chunks/DBWsr7gt.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/6uQ5KuWX.js","/app/immutable/chunks/Co2eSgEE.js","/app/immutable/chunks/BRi4x9cL.js","/app/immutable/chunks/BVCXyPuq.js","/app/immutable/chunks/ps4UtGok.js","/app/immutable/chunks/Cd3Pq_q3.js","/app/immutable/assets/register.CUyDR59i.css","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/Bjx82_QL.js","/app/immutable/assets/terminal-manager.MhP_vFvK.css","/app/immutable/chunks/CPxXU1c_.js","/app/immutable/chunks/D1dKOodV.js","/app/immutable/chunks/Hx_Q5ZY_.js","/app/immutable/chunks/CDX6j4QU.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/CN90kKWF.js","/app/immutable/chunks/BMJmYye_.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/rfzg_0PW.js","/app/immutable/chunks/DIlUp7xT.js","/app/immutable/chunks/CTZhg0JI.js","/app/immutable/chunks/CBiyyn5t.js","/app/immutable/chunks/CnXKtYEY.js","/app/immutable/chunks/CTmPV4px.js","/app/immutable/chunks/DXABAlso.js","/app/immutable/chunks/DhCMgQKK.js","/app/immutable/chunks/CCqa4XPE.js"])))=>i.map(i=>d[i]);
2
+ var Fw=Object.defineProperty;var yp=n=>{throw TypeError(n)};var Hw=(n,e,t)=>e in n?Fw(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var rt=(n,e,t)=>Hw(n,typeof e!="symbol"?e+"":e,t),wp=(n,e,t)=>e.has(n)||yp("Cannot "+t);var ns=(n,e,t)=>(wp(n,e,"read from private field"),t?t.call(n):e.get(n)),ao=(n,e,t)=>e.has(n)?yp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),xp=(n,e,t,r)=>(wp(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t);import{aa as Uw,cd as Vw,bK as kp,Q as _p,bJ as Sp,O as Cp,at as Ww,by as jw,au as Kw,aE as Gw,bo as Ji,bs as It,a7 as Ze,ay as ue,W as x,bn as Lt,aA as b,aD as l,a5 as ne,bf as Xr,bA as Y,c9 as w,aB as B,bH as k,bS as A,b_ as L,bl as se,bO as H,cb as qw,bV as he,aw as Mo,bz as tf,be as Pt,b$ as zt,aC as Xi,bv as Mp,al as Jw,ai as Ao,ca as ct,aj as Jr,br as Sr,bb as xl,c3 as uo,aG as Xw,bk as Fu,c0 as Yo,bj as tc,c5 as Xs}from"./DYhIMPy1.js";import{dS as sv,G as Yw,F as Qw,Z as Zw,R as Xf,S as e1,i as nf,aC as t1,ab as n1,U as r1,dT as s1,a0 as i1,ca as Yf,cE as kd,b_ as o1,cS as a1,aT as l1,cD as c1}from"./BwmV4u5a.js";import{t as Ot,bo as y,bw as Nt,b as Dt,bp as Yi,bm as _,br as ms,bu as Tp,bq as ja,bs as rn,_ as gs}from"./CVtvGnj8.js";import{t as ps,I as Ts,g as u1,i as iv,u as ov,j as d1,v as f1,F as rf,c as sf,D as Fo,s as h1,l as p1}from"./sj0eQTm1.js";import{az as av,cP as g1,ay as m1,bD as v1,F as tt,c$ as Ki,bk as Qs,bq as Qf,br as Zf,aO as b1,aP as _d,bT as y1,bU as w1,cm as x1,bC as Kc,cn as eh,aW as lv,a5 as cv,co as k1,aw as _1,at as ra,b8 as S1,bs as th,be as nh,t as C1,bB as M1,aF as Ep,bd as Vo,cV as uv,cS as T1,cj as dv,cG as fv,ah as E1,as as hv,av as Ap,am as A1,ag as R1,ap as P1,cT as I1,aK as Sd,ck as L1,bu as O1,c7 as N1,cu as Rp,T as D1,cD as $1,aq as B1,bR as z1,an as F1,c3 as H1,bK as U1,cW as V1,ai as W1,bi as j1,aY as K1,c_ as G1,aj as q1,bP as J1,aQ as X1,aZ as Y1,bZ as Q1,ba as Z1,ct as ex,cz as tx,bO as nx,bl as rx,bf as of,aI as sx,a_ as ix,w as ox,b7 as ax,cl as Pp,aN as lx,ar as pv,bx as gv,a9 as cx,c9 as Gc,Z as ux}from"./PnRQRSpt.js";import{aJ as dx,az as fx,av as hx,ai as px,Q as gx,c_ as mx,aE as vx,cM as Ip,aR as Lp,cw as bx,aG as Op,s as ya,ap as yx,a2 as wx,cV as xx,aU as kx,a5 as _x,bN as Sx,bO as Cx,bM as Mx,cD as Tx,cz as Ex,cx as Ax,cJ as Rx,cL as Px,cI as Ix,cy as Lx,ce as Ox,aC as Cd,ax as Np,Y as Nx,T as al,O as Dx,ay as $x,X as Bx,m as zx,V as Fx,a6 as Hx,al as mv,j as Md}from"./glNSRCnV.js";import{b as Ka,e as Cr,g as Gi,f as at,c as $n,s as st}from"./BT-leRNV.js";import{s as Xn}from"./CR_DYxzQ.js";import{h as vv}from"./BU46x7E3.js";import{a as Ux,z as ua,P as Vx,p as rh,h as sh,i as Wo,K as bv,l as yv,M as ih,u as Wx,s as jx,v as wv,L as Bo,H as Kx,R as Gx,k as qx,d as Jx,f as Xx,e as Yx,E as Qx}from"./FYq6LgZ3.js";import{i as j}from"./DKs05YEr.js";import{az as qc,av as jo,aQ as xv,an as Zx,at as ek,ar as tk,aq as nk,ay as rk,aS as Dp,af as sk,ak as ik,al as ok,a1 as kv,ai as ak,aj as lk,f as qe,aT as ck,aB as uk,ao as dk,aw as fk,ab as hk,ae as Hu}from"./CDX6j4QU.js";import{i as _v,f as pk,I as ss,a as gk}from"./CF1bQLZh.js";import"./DQh0old4.js";import{c as wt}from"./tOQ0MdfM.js";import{b as sr}from"./BaIAhI85.js";import{a as Sv}from"./CC7to1B5.js";import{e as mk,g as vk}from"./Dg5rAMu7.js";import{h as bk,e as $l,g as is,i as Nc,I as fi}from"./DGvhYwwC.js";import{f as yk,k as Ms,t as $p}from"./Hx_Q5ZY_.js";import{c as da,l as St}from"./ChTqQfQN.js";import"./BMJmYye_.js";import{nk as wk,e as Dc,IA as At,nx as xk,bf as Cv,BQ as Bp,rt as kk,n9 as _k,y4 as Sk,qA as af,Iq as Ck,ec as zp,fT as Mk,ny as oh,i as Tk,qm as Mv,qq as Ek,J0 as Ak,s9 as Fp,Lg as Rk,Lv as Pk,qr as Ik,Lu as Lk,Lf as Ok,Ck as Nk,H0 as Dk,yI as $k,k2 as Bk,H6 as zk}from"./CQNY8AIr.js";import{p as Fk,o as Tv,w as Hp,e as Hk,t as Uk,y as ah,L as Vk,S as Wk,x as jk,k as Kk,P as Gk,s as Uu,l as Vu,C as lh,X as dn,m as Wu,H as Ev,B as qk,G as Jk,f as lf,z as cf,T as Xk,q as Yk,r as Up,D as Qk,O as Zk,F as e_,j as t_}from"./CCIeFHqh.js";import{t as uf,k as ch,O as wa,M as Av}from"./BgPqfjSP.js";import{cu as Jc,I as Vp,bJ as n_,bQ as r_,Y as Wp,aQ as Rv,aR as s_,aO as i_,aP as o_,aU as a_}from"./D1dKOodV.js";import{a as uh,m as l_,u as ju}from"./ChC2njK7.js";import{c5 as c_,ay as u_,J as d_}from"./DIlUp7xT.js";import{g as f_}from"./CMiilI_P.js";import{N as Pv,G as h_,z as p_}from"./CGpelL0C.js";import"./BLLNPhaG.js";import{I as Ku}from"./lkH5RFQO.js";import{d as Ho}from"./DBWsr7gt.js";import{s as g_,C as jp}from"./CoRl8mzp.js";import"./BtTrP9fj.js";import"./7NnWOZ1A.js";import"./BMGEbk-i.js";import{i as Td}from"./rfzg_0PW.js";import{b as m_,c as kl,T as Iv}from"./BxLr8uYz.js";import{k as dh}from"./CN90kKWF.js";import{d as v_}from"./CTmPV4px.js";function Q3(n,e){var t=Cp,r=_p,s=n();return{subscribe:Vw(s,o=>{var a=s!==n(),c,u=_p,d=Cp;kp(r),Sp(t);try{c=Ww(()=>{jw(()=>{const f=n();a&&o(f)})})}finally{kp(u),Sp(d)}return a=!0,c}).subscribe}}function Z3(n){let e;const t=Uw(s=>{let i=!1;const o=n.subscribe(a=>{e=a,i&&s()});return i=!0,o});function r(){return Kw()?(t(),e):Gw(n)}return"set"in n?{get current(){return r()},set current(s){n.set(s)}}:{get current(){return r()}}}var b_=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","value"]),y_=B("<div><!></div>");function Lv(n,e){const t=Ji();if(new.target)return Ot({component:Lv,...n});It(e,!0);let r=y(e,"children",7),s=y(e,"child",7),i=y(e,"id",23,()=>qc(t)),o=y(e,"ref",15,null),a=y(e,"value",7),c=Yi(e,b_);const u=Fk.create({value:jo(()=>a()),id:jo(()=>i()),ref:jo(()=>o(),v=>o(v))}),d=w(()=>xv(c,u.props));var f={get children(){return r()},set children(v){r(v),b()},get child(){return s()},set child(v){s(v),b()},get id(){return i()},set id(v=qc(t)){i(v),b()},get ref(){return o()},set ref(v=null){o(v),b()},get value(){return a()},set value(v){a(v),b()},$set:Nt,$on:(v,C)=>Dt(e,v,C)},h=Ze(),p=ue(h);{var g=v=>{var C=Ze(),z=ue(C);Xn(z,s,()=>({props:l(d)})),x(v,C)},m=v=>{var C=y_();Ka(C,()=>({...l(d)}));var z=ne(C);Xn(z,()=>r()??Xr),Y(C),x(v,C)};j(p,v=>{s()?v(g):v(m,-1)})}return x(n,h),Lt(f)}const w_=rk({component:"toggle",parts:["root"]});var Jl,Xl;const op=class op{constructor(e){rt(this,"opts");rt(this,"attachment");ao(this,Jl,w(()=>({pressed:this.opts.pressed.current})));ao(this,Xl,w(()=>({[w_.root]:"",id:this.opts.id.current,"data-disabled":nk(this.opts.disabled.current),"aria-pressed":tk(this.opts.pressed.current),"data-state":x_(this.opts.pressed.current),disabled:ek(this.opts.disabled.current),onclick:this.onclick,...this.attachment})));this.opts=e,this.attachment=Zx(this.opts.ref),this.onclick=this.onclick.bind(this)}static create(e){return new op(e)}onclick(e){this.opts.disabled.current||(this.opts.pressed.current=!this.opts.pressed.current)}get snippetProps(){return l(ns(this,Jl))}set snippetProps(e){k(ns(this,Jl),e)}get props(){return l(ns(this,Xl))}set props(e){k(ns(this,Xl),e)}};Jl=new WeakMap,Xl=new WeakMap;let df=op;function x_(n){return n?"on":"off"}var k_=new Set(["$$slots","$$events","$$legacy","ref","id","pressed","onPressedChange","disabled","type","children","child"]),__=B("<button><!></button>");function Ov(n,e){const t=Ji();if(new.target)return Ot({component:Ov,...n});It(e,!0);let r=y(e,"ref",15,null),s=y(e,"id",23,()=>qc(t)),i=y(e,"pressed",15,!1),o=y(e,"onPressedChange",7,Dp),a=y(e,"disabled",7,!1),c=y(e,"type",7,"button"),u=y(e,"children",7),d=y(e,"child",7),f=Yi(e,k_);const h=df.create({pressed:jo(()=>i(),M=>{i(M),o()(M)}),disabled:jo(()=>a()??!1),id:jo(()=>s()),ref:jo(()=>r(),M=>r(M))}),p=w(()=>xv(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=qc(t)){s(M),b()},get pressed(){return i()},set pressed(M=!1){i(M),b()},get onPressedChange(){return o()},set onPressedChange(M=Dp){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:Nt,$on:(M,S)=>Dt(e,M,S)},m=Ze(),v=ue(m);{var C=M=>{var S=Ze(),O=ue(S);{let N=w(()=>({props:l(p),...h.snippetProps}));Xn(O,d,()=>l(N))}x(M,S)},z=M=>{var S=__();Ka(S,()=>({...l(p)}));var O=ne(S);Xn(O,()=>u()??Xr,()=>h.snippetProps),Y(S),x(M,S)};j(v,M=>{d()?M(C):M(z,-1)})}return x(n,m),Lt(g)}var S_=B('<h4 class="type-body font-medium"> </h4>'),C_=B('<div class="flex items-start gap-2"><!> <!></div>'),M_=B("<p> </p>"),T_=B('<div class="type-caption"><!></div>'),E_=B("<div><!></div>"),A_=B("<div></div>"),R_=B('<div class="relative"><!> <div><!> <!> <!></div> <!></div> <!>',1),P_=B("<!><!>",1);function fh(n,e){if(new.target)return Ot({component:fh,...n});It(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),m=y(e,"class",7,""),v=y(e,"contentClass",7,""),C=y(e,"contentContainerClass",7,""),z=y(e,"showArrow",7,!0),M=y(e,"showClose",7,!1),S=y(e,"onClose",7),O=y(e,"variant",7,"default"),N=y(e,"maxWidth",7,"20rem"),E=y(e,"interactive",7,!1),D=y(e,"disableAnimation",7,!1),ee=y(e,"children",7),U=y(e,"trigger",7),oe=y(e,"icon",7),F=y(e,"footer",7),W=y(e,"iconClass",7,""),X=y(e,"footerClass",7,""),le=y(e,"descriptionClass",7,""),re=y(e,"onclick",7);const Q={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:v1,iconColor:"text-info"},success:{bg:"bg-popover",text:"text-success",border:"border border-success/40",icon:m1,iconColor:"text-success"},warning:{bg:"bg-popover",text:"text-warning-ink",border:"border border-warning/40",icon:g1,iconColor:"text-warning-ink"},error:{bg:"bg-danger",text:"text-danger-background",border:"border border-danger/40",icon:av,iconColor:"text-danger-background"},custom:{bg:"",text:"",border:"",icon:null,iconColor:""}},me=w(()=>Q[O()]),P=w(()=>oe()||l(me).icon),$=w(()=>Cr("overlay-surface z-(--layer-tooltip)",!D()&&"tooltip-motion",l(me).bg,l(me).text,l(me).border,v()));function ce(V){p(V),g()?.(V)}function pe(){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 m()},set class(V=""){m(V),b()},get contentClass(){return v()},set contentClass(V=""){v(V),b()},get contentContainerClass(){return C()},set contentContainerClass(V=""){C(V),b()},get showArrow(){return z()},set showArrow(V=!0){z(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 O()},set variant(V="default"){O(V),b()},get maxWidth(){return N()},set maxWidth(V="20rem"){N(V),b()},get interactive(){return E()},set interactive(V=!1){E(V),b()},get disableAnimation(){return D()},set disableAnimation(V=!1){D(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 oe()},set icon(V){oe(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 X()},set footerClass(V=""){X(V),b()},get descriptionClass(){return le()},set descriptionClass(V=""){le(V),b()},get onclick(){return re()},set onclick(V){re(V),b()},$set:Nt,$on:(V,K)=>Dt(e,V,K)},Z=Ze(),ae=ue(Z);{let V=w(()=>E()?0:u());wt(ae,()=>lk,(K,I)=>{I(K,{get delayDuration(){return l(V)},children:(te,ve)=>{var de=Ze(),fe=ue(de);{let ke=w(()=>E()?0:u()),be=w(()=>!E()&&d());wt(fe,()=>sk,(q,Me)=>{Me(q,{onOpenChange:ce,get delayDuration(){return l(ke)},get disableHoverableContent(){return l(be)},get disableCloseOnTriggerClick(){return f()},get open(){return p()},set open(ze){p(ze)},children:(ze,gt)=>{var Le=P_(),De=ue(Le);{const Vt=(Pe,Ce)=>{let we=()=>(Ce?.()).props;ok(Pe,{get triggerProps(){return we()},children:(Ve,Mt)=>{var ie=Ze(),$e=ue(ie);{var lt=mt=>{var Tt=Ze(),We=ue(Tt);Xn(We,()=>U()??Xr),x(mt,Tt)},yt=mt=>{var Tt=Ze(),We=ue(Tt);Xn(We,()=>ee()??Xr),x(mt,Tt)};j($e,mt=>{U()?mt(lt):ee()&&mt(yt,1)})}x(Ve,ie)},$$slots:{default:!0}})};let nt=w(()=>Cr("inline-flex",m()));wt(De,()=>ik,(Pe,Ce)=>{Ce(Pe,{get class(){return l(nt)},get disabled(){return h()},get onclick(){return re()},"data-tooltip-trigger":!0,child:Vt,$$slots:{child:!0}})})}var Fe=A(De);{var vt=Vt=>{var nt=Ze(),Pe=ue(nt);wt(Pe,()=>kv,(Ce,we)=>{we(Ce,{children:(Ve,Mt)=>{var ie=Ze(),$e=ue(ie);wt($e,()=>ak,(lt,yt)=>{yt(lt,{role:"tooltip",get side(){return i()},get align(){return o()},get sideOffset(){return a()},get alignOffset(){return c()},get class(){return l($)},"data-tooltip-content":!0,"data-overlay-surface":!0,onFocusOutside:()=>{},children:(mt,Tt)=>{var We=R_(),Ke=ue(We),Qt=ne(Ke);{var Be=He=>{{let Xe=w(()=>_.ui_tooltipRich_close_ariaLabel());qe(He,{variant:"ghost",size:"icon-compact",onclick:pe,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(Xe)},children:(pt,Qe)=>{tt(pt,{get icon(){return Ki},size:"xs",class:"w-3 h-3"})},$$slots:{default:!0}})}};j(Qt,He=>{M()&&He(Be)})}var jt=A(Qt,2),Yn=ne(jt);{var Bn=He=>{var Xe=C_(),pt=ne(Xe);{var Qe=xt=>{{let Ft=w(()=>Cr("w-4 h-4 mt-0.5 flex-shrink-0",l(me).iconColor,W()));tt(xt,{get icon(){return l(P)},size:"1x",get class(){return l(Ft)}})}};j(pt,xt=>{l(P)&&xt(Qe)})}var et=A(pt,2);{var it=xt=>{var Ft=S_(),$t=se(Ft,!0);L(()=>H($t,t())),x(xt,Ft)};j(et,xt=>{t()&&xt(it)})}Y(Xe),x(He,Xe)};j(Yn,He=>{(t()||l(P))&&He(Bn)})}var ge=A(Yn,2);{var ft=He=>{var Xe=M_(),pt=se(Xe,!0);L(Qe=>{at(Xe,1,Qe),H(pt,r())},[()=>$n(Cr("type-body opacity-90",le()))]),x(He,Xe)};j(ge,He=>{r()&&He(ft)})}var Rt=A(ge,2);{var ln=He=>{var Xe=T_(),pt=ne(Xe);Xn(pt,()=>s()??Xr),Y(Xe),x(He,Xe)};j(Rt,He=>{s()&&He(ln)})}Y(jt);var Gt=A(jt,2);{var ut=He=>{var Xe=E_(),pt=ne(Xe);Xn(pt,()=>F()??Xr),Y(Xe),L(Qe=>at(Xe,1,Qe),[()=>$n(Cr("px-3 py-2",X()))]),x(He,Xe)};j(Gt,He=>{F()&&He(ut)})}Y(Ke);var ht=A(Ke,2);{var Ie=He=>{var Xe=Ze(),pt=ue(Xe);{const Qe=(et,it)=>{let xt=()=>(it?.()).props;var Ft=A_();Ka(Ft,$t=>({class:$t,...xt()}),[()=>Cr("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(et,Ft)};wt(pt,()=>yk,(et,it)=>{it(et,{child:Qe,$$slots:{child:!0}})})}x(He,Xe)};j(ht,He=>{z()&&He(Ie)})}L(()=>{Gi(Ke,`max-width: ${N()??""};`),at(jt,1,`px-3 py-2 space-y-1 ${C()??""}`)}),x(mt,We)},$$slots:{default:!0}})}),x(Ve,ie)},$$slots:{default:!0}})}),x(Vt,nt)};j(Fe,Vt=>{!h()&&(t()||r()||s())&&Vt(vt)})}x(ze,Le)},$$slots:{default:!0}})})}x(te,de)},$$slots:{default:!0}})})}return x(n,Z),Lt(ye)}var I_=new Set(["$$slots","$$events","$$legacy","leading","title","description","trailing","selected","disabled","class"]),L_=B('<span data-slot="action-row-leading" class="first-line-icon w-(--menu-icon-size)"><!></span>'),O_=B('<span data-slot="action-row-description"><!></span>'),N_=B('<span data-slot="action-row-trailing" class="first-line-icon gap-2"><!></span>'),D_=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 Nv(n,e){if(new.target)return Ot({component:Nv,...n});It(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=Yi(e,I_);var d={get leading(){return t()},set leading(O){t(O),b()},get title(){return r()},set title(O){r(O),b()},get description(){return s()},set description(O){s(O),b()},get trailing(){return i()},set trailing(O){i(O),b()},get selected(){return o()},set selected(O=!1){o(O),b()},get disabled(){return a()},set disabled(O=!1){a(O),b()},get class(){return c()},set class(O){c(O),b()},$set:Nt,$on:(O,N)=>Dt(e,O,N)},f=D_();Ka(f,O=>({type:"button",...u,disabled:a(),"data-slot":"menu-action-row","data-selected":o()?"":void 0,class:O}),[()=>Cr(uh(),"items-start whitespace-normal font-medium 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=O=>{var N=L_(),E=ne(N);Xn(E,t),Y(N),x(O,N)};j(h,O=>{t()&&O(p)})}var g=A(h,2),m=ne(g),v=ne(m);Xn(v,r),Y(m);var C=A(m,2);{var z=O=>{var N=O_(),E=ne(N);Xn(E,s),Y(N),L(()=>at(N,1,`min-w-0 break-words ${l_}`)),x(O,N)};j(C,O=>{s()&&O(z)})}Y(g);var M=A(g,2);{var S=O=>{var N=N_(),E=ne(N);Xn(E,i),Y(N),x(O,N)};j(M,O=>{i()&&O(S)})}return Y(f),x(n,f),Lt(d)}var $_=new Set(["$$slots","$$events","$$legacy","value","class","children"]);function Dv(n,e){if(new.target)return Ot({component:Dv,...n});It(e,!0);let t=y(e,"value",7),r=y(e,"class",7),s=y(e,"children",7),i=Yi(e,$_);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:Nt,$on:(u,d)=>Dt(e,u,d)},a=Ze(),c=ue(a);{let u=w(()=>Cr("mt-3",r()));wt(c,()=>Lv,(d,f)=>{f(d,ms({get value(){return t()},get class(){return l(u)}},()=>i,{children:(h,p)=>{var g=Ze(),m=ue(g);Xn(m,()=>s()??Xr),x(h,g)},$$slots:{default:!0}}))})}return x(n,a),Lt(o)}var B_=B('<img loading="lazy"/>');function $v(n,e){if(new.target)return Ot({component:$v,...n});It(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}`);qw(()=>{t(),l(u),k(c,!1)});var d={get identity(){return t()},set identity(m){t(m),b()},get avatarUrl(){return r()},set avatarUrl(m){r(m),b()},get size(){return s()},set size(m=16){s(m),b()},get class(){return i()},set class(m=""){i(m),b()},get alt(){return o()},set alt(m){o(m),b()},get fallback(){return a()},set fallback(m){a(m),b()},$set:Nt,$on:(m,v)=>Dt(e,m,v)},f=Ze(),h=ue(f);{var p=m=>{var v=Ze(),C=ue(v);Xn(C,()=>a()??Xr),x(m,v)},g=m=>{var v=B_();L(()=>{st(v,"src",l(u)),st(v,"width",s()),st(v,"height",s()),st(v,"alt",o()??""),st(v,"aria-hidden",o()===void 0?"true":void 0),at(v,1,$n(i()))}),Mo("error",v,()=>{k(c,!0)}),tf(v),x(m,v)};j(h,m=>{l(c)?m(p):m(g,-1)})}return x(n,f),Lt(d)}var z_=new Set(["$$slots","$$events","$$legacy","children"]),F_=Xi('<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>'),H_=Xi('<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),U_=Xi('<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>'),V_=Xi('<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>'),W_=Xi('<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>'),j_=Xi('<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>'),K_=Xi('<svg><!><rect width="256" height="256" fill="none"></rect><!></svg>');function Bv(n,e){if(new.target)return Ot({component:Bv,...n});It(e,!0);const t=bk();let r=y(e,"children",7),s=Yi(e,z_),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(N){let{weight:E,color:D,size:ee,mirrored:U,...oe}=N;return oe}var d={get children(){return r()},set children(N){r(N),b()},$set:Nt,$on:(N,E)=>Dt(e,N,E)},f=K_();Ka(f,(N,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",...N,...E}),[()=>u(t),()=>u(s)]);var h=ne(f);{var p=N=>{var E=Ze(),D=ue(E);Xn(D,r),x(N,E)};j(h,N=>{r()&&N(p)})}var g=A(h,2);{var m=N=>{var E=F_();x(N,E)},v=N=>{var E=H_();Pt(),x(N,E)},C=N=>{var E=U_();x(N,E)},z=N=>{var E=V_();x(N,E)},M=N=>{var E=W_();x(N,E)},S=N=>{var E=j_();x(N,E)},O=N=>{var E=zt();E.nodeValue=(console.error('Unsupported icon weight. Choose from "thin", "light", "regular", "bold", "fill", or "duotone".'),""),x(N,E)};j(g,N=>{l(i)==="bold"?N(m):l(i)==="duotone"?N(v,1):l(i)==="fill"?N(C,2):l(i)==="light"?N(z,3):l(i)==="regular"?N(M,4):l(i)==="thin"?N(S,5):N(O,-1)})}return Y(f),x(n,f),Lt(d)}function Qo(n,e){if(new.target)return Ot({component:Qo,...n});It(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:Nt,$on:(i,o)=>Dt(e,i,o)};return Bv(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Lt(s)}function hh(n,e){if(new.target)return Ot({component:hh,...n});It(e,!0);const t=g=>{var m=Ze(),v=ue(m);{var C=S=>{tt(S,{get icon(){return Qs},get size(){return a()},class:"shrink-0 text-muted-foreground"})},z=S=>{{let O=w(()=>s()==="github"?Qf:Zf);tt(S,{get icon(){return l(O)},get size(){return a()},class:"shrink-0 text-muted-foreground"})}},M=S=>{Qo(S,{get size(){return a()},class:"shrink-0 text-muted-foreground"})};j(v,S=>{o()?S(C):s()?S(z,1):S(M,-1)})}x(g,m)};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:Nt,$on:(g,m)=>Dt(e,g,m)},u=Ze(),d=ue(u);{var f=g=>{$v(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 m=w(()=>r()??"");Tv(g,{get avatarUrl(){return i()},get label(){return l(m)},get size(){return a()},referrerpolicy:"no-referrer"})}},p=g=>{t(g)};j(d,g=>{r()&&s()==="github"?g(f):i()?g(h,1):g(p,-1)})}return x(n,u),Lt(c)}var G_=Xi('<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 ph(n,e){if(new.target)return Ot({component:ph,...n});It(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:Nt,$on:(o,a)=>Dt(e,o,a)},i=G_();return L(()=>{st(i,"width",t()),st(i,"height",t()),at(i,0,$n(r()))}),x(n,i),Lt(s)}function q_(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 J_=B('<span class="agent-avatar-unread-dot svelte-v6mebl" data-avatar-unread-dot=""></span>'),X_=B('<span role="img" data-agent-avatar-with-state="" data-agent-avatar-surface=""><!> <!></span>');function zv(n,e){if(new.target)return Ot({component:zv,...n});It(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,Hp),a=y(e,"size",7,void 0),c=y(e,"state",7,"idle"),u=y(e,"class",7,"");const d=w(()=>q_(c())),f=w(()=>a()??Uk[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=Hp){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:Nt,$on:(M,S)=>Dt(e,M,S)},g=X_();let m;var v=ne(g);Hk(v,{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(v,2);{var z=M=>{var S=J_();x(M,S)};j(C,M=>{c()==="unread"&&M(z)})}return Y(g),L(()=>{at(g,1,`agent-avatar-with-state agent-avatar-with-state--${c()??""} ${u()??""}`,"svelte-v6mebl"),st(g,"aria-label",l(d)),st(g,"title",l(d)),st(g,"data-avatar-state",c()),st(g,"data-avatar-variant",l(h)?o():void 0),m=Gi(g,"",m,{width:l(h)?void 0:`${l(f)}px`,height:l(h)?void 0:`${l(f)}px`})}),x(n,g),Lt(p)}function ff(n){return Yw(n)}function Y_(n){return Qw(n)}function Kp(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===Dc.Error||n.status==="failed"?"failed":o?"question":a?"needs-permission":c==="discussion"?"attention-discussion":c==="blocker"?"attention-blocker":Y_(n)?"waiting":ff(n)?"running":t&&!r?"unread":"idle"}function Q_(n,e={}){if(!n)return Kp({},e);const t=wk(n),r=n.status===Dc.Completed||String(n.status).toLowerCase()==="completed",s=n.status===Dc.Error||n.status===Dc.Deleted||String(n.status).toLowerCase()==="failed";return Kp(sv(n),{...e,hasQuestion:c_(n)||e.hasQuestion===!0,hasUnread:e.hasUnread??n.hasUnread,isCompleted:e.isCompleted??r,isFailed:e.isFailed??s,attentionKind:e.attentionKind??t?.kind??null})}function eB(n){return n?ff(sv(n)):!1}function Z_(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=ps(n.ciStatus.total);if(n.ciStatus.failed>0){const i=ps(n.ciStatus.failed);e.push(n.ciStatus.pending>0?_.workspace_prStatus_checksFailingRunning_tooltip({failed:i,total:s,pending:ps(n.ciStatus.pending)}):_.workspace_prStatus_checksFailing_tooltip({failed:i,total:s}))}else n.ciStatus.pending>0?e.push(_.workspace_prStatus_checksRunning_tooltip({pending:ps(n.ciStatus.pending),total:s})):t.push(_.workspace_prStatus_checksPassing_tooltip({passed:ps(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=ps(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 eS={queued:0,draft:1,open:2,merged:3,closed:4};function Fv(n,e){return n?`${n}#${e}`:String(e)}function Ed(n,e){return Fv(n?.toLowerCase(),e)}function tS(n,e){return n&&e?e.localeCompare(n):n?-1:e?1:0}function nS(n,e){return n==="merged"?{statusIcon:b1,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 tB({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(dx(h.url)??r,h.number),h])),u=fx(hx(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),m=h.resource?void 0:c.get(g),v=m?.isDraft?"draft":h.status,C=px({...h,status:v});return{pr:h,repo:p,identity:g,source:m,status:v,queued:C,rank:eS[C?"queued":v]}}).sort((h,p)=>h.rank-p.rank||tS(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:m,queued:v})=>{const C=h.monitorSnapshot?"":Z_(g);return{identity:h.monitorIdentity??Fv(p,h.number),resource:h.resource,monitorAvailability:h.monitorAvailability,numberLabel:Zw(h,h.number),number:h.number,title:h.title,url:h.url,repo:p,repoContext:h.crossRepo?h.crossRepoDisplay??h.crossRepo:void 0,status:m,queued:v,...nS(m,v),details:[gx({...h,status:m}),C].filter(Boolean).join(`
4
+ `),monitorAgentId:h.monitorAgentId,monitorOnly:h.monitorOnly===!0}})}function rS(n){return"type"in n&&n.type==="separator"}function nB(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 $c(n,e,t=""){let r=0;const s=[];for(const[o,a]of n.entries()){if(rS(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(p=>p.checked!==void 0),d=a.submenu.filter(p=>p.checked===void 0),f=u.map(p=>({kind:"radio",id:p.id,value:p.id,label:p.label,swatch:p.swatch,icon:p.icon,disabled:p.disabled,disabledReason:p.disabledReason,shortcut:p.shortcut,closeOnSelect:p.closeOnSelect})),h={kind:"radio-group",id:`${a.id}-selection`,label:a.label,value:u.find(p=>p.checked)?.id??"",presentation:a.presentation,children:f};if(a.presentation==="swatches"){s.push({...c,...h},...$c(d).map(p=>({...p,group:String(r)})));continue}s.push({...c,kind:"submenu",children:[...f.length>0?[h]:[],...$c(d)]})}else s.push({...c,kind:"submenu",children:$c(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 Hv(n,e){for(const t of n){if("type"in t)continue;if(t.id===e)return t;const r=t.submenu?Hv(t.submenu,e):void 0;if(r)return r}}function sS(n,e){if(new.target)return Ot({component:sS,...n});It(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,()=>Tp()),a=y(e,"returnFocus",7),c=y(e,"selection",7);const u=w(()=>$c(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=Tp()){o(f),b()},get returnFocus(){return a()},set returnFocus(f){a(f),b()},get selection(){return c()},set selection(f){c(f),b()},$set:Nt,$on:(f,h)=>Dt(e,f,h)};{let f=w(()=>({x:t(),y:r(),returnFocus:a()}));Ux(n,{get actions(){return l(u)},get ariaLabel(){return o()},get contextMenu(){return l(f)},onAction:h=>Hv(s(),h)?.onClick(),onOpenChange:h=>{h||i()?.()}})}return Lt(d)}function iS(){try{return At.state.userPreferences?.shortcutOverrides??{}}catch{return{}}}function Xc(n){return Pv(n,iS())}function rB(n){if(typeof At.getReadableState!="function")return Mp(Xc(n));try{return Jw(At.getReadableState(),e=>Pv(n,e.userPreferences?.shortcutOverrides??{}))}catch{return Mp(Xc(n))}}function oS(n,e){return n?.isExternalLink===!0&&typeof n.workspaceId=="string"&&n.workspaceId?n.workspaceId:e||void 0}function Uv(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=oS(n.meta,e),i=s?t(s,n.id)?.trim():void 0;if(i)return i}return r}function sB(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=Uv({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 aS=(n,e)=>{let t;try{t=f_().state}catch{return}const r=t?.workspaceNotes?.byWorkspaceId?.[n]?.notes;return r?xk(r,e)?.title:void 0};var lS=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>'),cS=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 gh(n,e){if(new.target)return Ot({component:gh,...n});It(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=pk(v);let g=he(null),m=he(null);function v(){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')||v()}function z(E){if(d()?.(E),E.defaultPrevented||E.key!=="Tab"||!l(g))return;const D=Array.from(l(g).querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),ee=D[0],U=D[D.length-1];!ee||!U||(E.shiftKey&&document.activeElement===ee?(E.preventDefault(),U.focus()):!E.shiftKey&&document.activeElement===U&&(E.preventDefault(),ee.focus()))}ct(()=>{if(t())return ua(v)}),ct(()=>{!t()||!l(m)||requestAnimationFrame(()=>l(m)?.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:Nt,$on:(E,D)=>Dt(e,E,D)},S=Ze(),O=ue(S);{var N=E=>{{let D=w(()=>h?.target()??"body");Vx(E,{get target(){return l(D)},zIndex:1e3,children:(ee,U)=>{var oe=cS(),F=ne(oe),W=ne(F);{var X=$=>{var ce=Ze(),pe=ue(ce);Xn(pe,c),x($,ce)};j(W,$=>{c()&&$(X)})}var le=A(W,2);qe(le,{variant:"ghost",size:"icon",class:"text-white hover:bg-white/20 hover:text-white",onclick:v,get"aria-label"(){return s()},get ref(){return l(m)},set ref($){k(m,$,!0)},children:($,ce)=>{tt($,{get icon(){return Ki},size:"lg"})},$$slots:{default:!0}}),Y(F),$l(F,$=>p?.($));var re=A(F,2),Q=ne(re);Xn(Q,a),Y(re),$l(re,$=>p?.($));var me=A(re,2);{var P=$=>{var ce=lS(),pe=se(ce,!0);L(()=>H(pe,u())),x($,ce)};j(me,$=>{u()&&$(P)})}Y(oe),sr(oe,$=>k(g,$),()=>l(g)),L(()=>st(oe,"aria-label",r())),Jr("click",oe,C),Jr("keydown",oe,z),Mo("copy",oe,function(...$){f()?.apply(this,$)}),Ts(3,oe,()=>u1,()=>({tier:"moderate"})),x(ee,oe)},$$slots:{default:!0}})}};j(O,E=>{t()&&E(N)})}return x(n,S),Lt(M)}Ao(["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 Vv(n){try{return new URL(n).protocol==="https:"}catch{return!1}}function hf(n){const e=/^data:([^;,]+);base64,(.*)$/s.exec(n);return e?{mimeType:e[1],base64:e[2]}:null}function pf(n){return Vv(n)||Gu(n)!==null||/^workspace-asset:\/\/[^/?#]+/.test(n)||/^data:image\/[a-z0-9.+-]+(?:;[^,]*)?,/i.test(n)}function Wv(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 uS(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 dS={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};function fS(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&&dS[t]||"png";return`${e}.${r}`}var hS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-dimensions"> </div>'),pS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-size"> </div>'),gS=B("<!> <!> <!>",1),mS=B("<!> <!> <!> <!>",1),vS=B("<!> <!>",1);function jv(n,e){if(new.target)return Ot({component:jv,...n});It(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(()=>hf(t())),c=w(()=>Gu(t())),u=w(()=>Vv(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)?Wv(l(a).base64):null,!0);const oe=new Image;oe.onload=()=>{h===U&&k(d,{width:oe.naturalWidth,height:oe.naturalHeight},!0)},oe.src=t(),l(a)||fetch(t()).then(F=>F.ok?F.blob():null).then(F=>{F&&h===U&&k(f,F.size,!0)}).catch(()=>{})}ct(()=>{s()&&p()}),ct(()=>{if(s())return ua(()=>{s(!1)})});async function g(U=t()){const oe=hf(U);if(oe)return uS(oe.base64,oe.mimeType);const F=await fetch(U);if(!F.ok)throw new Error(`Image fetch failed: ${F.status}`);return await F.blob()}async function m(){let U=null;try{let oe=t(),F=l(a)?.mimeType;if(!l(a)){const X=await g();F=X.type,U=URL.createObjectURL(X),oe=U}const W=document.createElement("a");W.href=oe,W.download=fS({workspacePath:l(c)?.path,imageName:r(),mimeType:F}),document.body.appendChild(W);try{W.click()}finally{W.remove()}}catch{Ms.error(_.ui_imageActionsMenu_downloadFailed_error())}finally{U&&URL.revokeObjectURL(U)}}async function v(){if(l(c))try{await Jc(l(c).path),Ms.success(_.ui_imageActionsMenu_pathCopied_label())}catch{Ms.error(_.ui_imageActionsMenu_copyFailed_error())}}async function C(){if(l(u))try{await Jc(t()),Ms.success(_.ui_imageActionsMenu_linkCopied_label())}catch{Ms.error(_.ui_imageActionsMenu_copyFailed_error())}}async function z(U){let oe,F;try{let W;if(U.type.split(";")[0].trim()==="image/svg+xml"){F=URL.createObjectURL(U);const re=new Image;re.src=F,await re.decode(),W=re}else W=oe=await createImageBitmap(U);const X=document.createElement("canvas");X.width=W instanceof HTMLImageElement?W.naturalWidth:W.width,X.height=W instanceof HTMLImageElement?W.naturalHeight:W.height;const le=X.getContext("2d");if(!le)throw new Error("2d canvas context unavailable");return le.drawImage(W,0,0),await new Promise((re,Q)=>{X.toBlob(me=>me?re(me):Q(new Error("canvas toBlob failed")),"image/png")})}finally{oe?.close(),F&&URL.revokeObjectURL(F)}}async function M(U=t()){try{let oe=await g(U);oe.type!=="image/png"&&(oe=await z(oe)),await navigator.clipboard.write([new ClipboardItem({"image/png":oe})]),Ms.success(_.ui_imageActionsMenu_imageCopied_label())}catch{Ms.error(_.ui_imageActionsMenu_copyFailed_error())}}function S(U,oe=t()){return U.defaultPrevented||!pf(oe)||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(oe),s(!1)),!0)}var O={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:Nt,$on:(U,oe)=>Dt(e,U,oe)},N=Ze(),E=ue(N);{var D=U=>{var oe=Ze(),F=ue(oe);wt(F,()=>ih,(W,X)=>{X(W,{get open(){return s()},set open(le){s(le)},children:(le,re)=>{var Q=vS(),me=ue(Q);{const $=(pe,ye)=>{let Z=()=>(ye?.()).props;{let ae=w(()=>_.ui_imageActionsMenu_trigger_ariaLabel());qe(pe,ms(Z,{variant:"plain",size:"icon-sm",wrapContent:!1,get active(){return s()},get"aria-label"(){return l(ae)},children:(V,K)=>{bv(V,{class:"size-3.5"})},$$slots:{default:!0}}))}};let ce=w(()=>Cr("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",i()));wt(me,()=>rh,(pe,ye)=>{ye(pe,{get class(){return l(ce)},onclick:Z=>Z.stopPropagation(),onkeydown:Z=>S(Z),oncopy:Z=>S(Z),child:$,$$slots:{child:!0}})})}var P=A(me,2);wt(P,()=>sh,($,ce)=>{ce($,{get class(){return o()},align:"end",onkeydown:pe=>S(pe),oncopy:pe=>S(pe),children:(pe,ye)=>{var Z=mS(),ae=ue(Z);wt(ae,()=>Wo,(fe,ke)=>{ke(fe,{onSelect:()=>void m(),children:(be,q)=>{Pt();var Me=zt();L(ze=>H(Me,ze),[()=>_.ui_imageActionsMenu_download_label()]),x(be,Me)},$$slots:{default:!0}})});var V=A(ae,2);wt(V,()=>Wo,(fe,ke)=>{ke(fe,{onSelect:()=>void M(),children:(be,q)=>{Pt();var Me=zt();L(ze=>H(Me,ze),[()=>_.ui_imageActionsMenu_copyImage_label()]),x(be,Me)},$$slots:{default:!0}})});var K=A(V,2);{var I=fe=>{var ke=Ze(),be=ue(ke);wt(be,()=>Wo,(q,Me)=>{Me(q,{onSelect:()=>void v(),children:(ze,gt)=>{Pt();var Le=zt();L(De=>H(Le,De),[()=>_.ui_imageActionsMenu_copyPath_label()]),x(ze,Le)},$$slots:{default:!0}})}),x(fe,ke)},te=fe=>{var ke=Ze(),be=ue(ke);wt(be,()=>Wo,(q,Me)=>{Me(q,{onSelect:()=>void C(),children:(ze,gt)=>{Pt();var Le=zt();L(De=>H(Le,De),[()=>_.ui_imageActionsMenu_copyLink_label()]),x(ze,Le)},$$slots:{default:!0}})}),x(fe,ke)};j(K,fe=>{l(c)?fe(I):l(u)&&fe(te,1)})}var ve=A(K,2);{var de=fe=>{var ke=gS(),be=ue(ke);wt(be,()=>yv,(Le,De)=>{De(Le,{})});var q=A(be,2);{var Me=Le=>{var De=hS(),Fe=se(De,!0);L(vt=>H(Fe,vt),[()=>_.ui_imageActionsMenu_dimensions_label({width:ps(l(d).width),height:ps(l(d).height)})]),x(Le,De)};j(q,Le=>{l(d)&&Le(Me)})}var ze=A(q,2);{var gt=Le=>{var De=pS(),Fe=se(De,!0);L(vt=>H(Fe,vt),[()=>iv(l(f))]),x(Le,De)};j(ze,Le=>{l(f)!==null&&Le(gt)})}x(fe,ke)};j(ve,fe=>{(l(d)||l(f)!==null)&&fe(de)})}x(pe,Z)},$$slots:{default:!0}})}),x(le,Q)},$$slots:{default:!0}})}),x(U,oe)},ee=w(()=>pf(t()));j(E,U=>{l(ee)&&U(D)})}return x(n,N),Lt(O)}var bS=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 Kv(n,e){if(new.target)return Ot({component:Kv,...n});It(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);ct(()=>{i()?.(l(d))});let m=null,v=0,C=0,z=0,M=!1;const S=w(()=>ov(l(d),{style:"percent",maximumFractionDigits:0}));function O(I){return Math.min(s(),Math.max(r(),I))}function N(I,te,ve){const de=O(ve),fe=l(g)?.getBoundingClientRect(),ke=fe?I-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(I){const te=l(g)?.getBoundingClientRect();te?N(te.left+te.width/2,te.top+te.height/2,I):k(d,O(I),!0)}function D(){k(d,1),k(f,0),k(h,0)}function ee(I){I.preventDefault();const te=I.ctrlKey?c:a;N(I.clientX,I.clientY,l(d)*Math.exp(-I.deltaY*te))}ct(()=>{const I=l(g);if(I)return I.addEventListener("wheel",ee,{passive:!1}),()=>I.removeEventListener("wheel",ee)});function U(I){if(I.metaKey||I.ctrlKey||I.altKey)return!1;if(I.key==="+"||I.key==="=")E(l(d)*o);else if(I.key==="-")E(l(d)/o);else if(I.key==="0")D();else return!1;return I.preventDefault(),!0}function oe(I){if(I.button>0)return;k(p,!0),m=I.pointerId,v=I.clientX,C=I.clientY,z=0;const te=I.currentTarget;typeof te.setPointerCapture=="function"&&te.setPointerCapture(I.pointerId)}function F(I){if(!l(p)||I.pointerId!==m)return;const te=I.clientX-v,ve=I.clientY-C;z+=Math.abs(te)+Math.abs(ve),k(f,l(f)+te),k(h,l(h)+ve),v=I.clientX,C=I.clientY}function W(I){if(!l(p)||I.pointerId!==m)return;k(p,!1),m=null,z>u&&(M=!0);const te=I.currentTarget;typeof te.hasPointerCapture=="function"&&typeof te.releasePointerCapture=="function"&&te.hasPointerCapture(I.pointerId)&&te.releasePointerCapture(I.pointerId)}function X(I){M&&(M=!1,I.preventDefault(),I.stopPropagation())}function le(I){const te=Number.parseFloat(I.currentTarget.value);Number.isFinite(te)&&E(te)}var re={handleKeydown:U,get children(){return t()},set children(I){t(I),b()},get minZoom(){return r()},set minZoom(I=.25){r(I),b()},get maxZoom(){return s()},set maxZoom(I=8){s(I),b()},get onScaleChange(){return i()},set onScaleChange(I){i(I),b()},$set:Nt,$on:(I,te)=>Dt(e,I,te)},Q=bS(),me=ne(Q),P=ne(me);Xn(P,t),Y(me);var $=A(me,2),ce=ne($);{let I=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomOut_ariaLabel());qe(ce,{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(I)},get title(){return l(te)},children:(ve,de)=>{tt(ve,{get icon(){return y1}})},$$slots:{default:!0}})}var pe=A(ce,2),ye=ne(pe);{let I=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomSlider_ariaLabel());Wx(ye,{class:"accent-white",get min(){return r()},get max(){return s()},step:"0.01",get value(){return l(d)},oninput:le,get"aria-label"(){return l(I)},get title(){return l(te)},"data-testid":"zoom-pan-slider"})}Y(pe);var Z=A(pe,2);{let I=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_zoomIn_ariaLabel());qe(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(I)},get title(){return l(te)},children:(ve,de)=>{tt(ve,{get icon(){return w1}})},$$slots:{default:!0}})}var ae=A(Z,2),V=se(ae,!0),K=A(ae,2);{let I=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel()),te=w(()=>_.ui_zoomPanViewport_resetZoom_ariaLabel());qe(K,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:D,get"aria-label"(){return l(I)},get title(){return l(te)},children:(ve,de)=>{tt(ve,{get icon(){return x1}})},$$slots:{default:!0}})}return Y($),Y(Q),sr(Q,I=>k(g,I),()=>l(g)),L((I,te)=>{at(Q,1,`relative h-full w-full touch-none select-none overflow-hidden ${l(p)?"cursor-grabbing":"cursor-grab"}`),st(Q,"aria-label",I),Gi(me,`transform: translate(${l(f)??""}px, ${l(h)??""}px) scale(${l(d)??""}); transform-origin: 0 0;`),st($,"aria-label",te),H(V,l(S))},[()=>_.ui_zoomPanViewport_viewport_ariaLabel(),()=>_.ui_zoomPanViewport_controls_ariaLabel()]),Jr("pointerdown",Q,oe),Jr("pointermove",Q,F),Jr("pointerup",Q,W),Mo("pointercancel",Q,W),Mo("click",Q,X,!0),Jr("keydown",Q,U),Jr("pointerdown",$,I=>I.stopPropagation()),x(n,Q),Lt(re)}Ao(["pointerdown","pointermove","pointerup","keydown"]);var yS=B('<img class="max-h-[90vh] max-w-[90vw] rounded-lg object-contain" draggable="false" data-media-lightbox-content=""/>');function Gv(n,e){if(new.target)return Ot({component:Gv,...n});It(e,!0);const t=v=>{var C=Ze(),z=ue(C);{var M=S=>{sr(jv(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(O){k(f,O,!0)}}),O=>k(d,O,!0),()=>l(d))};j(z,S=>{c()&&S(M)})}x(v,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);ct(()=>{r()||k(f,!1)});function h(v){p(v),v.defaultPrevented||l(u)?.handleKeydown(v)}function p(v){r()&&c()&&l(d)?.handleCopy(v)}function g(v){!c()||!pf(s())||(v.preventDefault(),v.stopPropagation(),k(f,!0))}var m={get open(){return r()},set open(v=!1){r(v),b()},get imageUrl(){return s()},set imageUrl(v){s(v),b()},get imageName(){return i()},set imageName(v=_.ui_imageLightbox_image_alt()){i(v),b()},get onClose(){return o()},set onClose(v){o(v),b()},get openerElement(){return a()},set openerElement(v=null){a(v),b()},get showActionsMenu(){return c()},set showActionsMenu(v=!1){c(v),b()},$set:Nt,$on:(v,C)=>Dt(e,v,C)};{let v=w(()=>_.ui_imageLightbox_preview_ariaLabel()),C=w(()=>_.ui_imageLightbox_close_ariaLabel());gh(n,{get ariaLabel(){return l(v)},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(z){r(z)},children:(z,M)=>{var S=Ze(),O=ue(S);dh(O,s,N=>{sr(Kv(N,{children:(E,D)=>{var ee=yS();L(()=>{st(ee,"src",s()),st(ee,"alt",i())}),Jr("contextmenu",ee,g),x(E,ee)},$$slots:{default:!0}}),E=>k(u,E,!0),()=>l(u))}),x(z,S)},$$slots:{default:!0}})}return Lt(m)}Ao(["contextmenu"]);var wS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-duration"> </div>'),xS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-dimensions"> </div>'),kS=B('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-size"> </div>'),_S=B("<!> <!> <!> <!>",1),SS=B("<!> <!> <!>",1),CS=B("<!> <!>",1);function Yc(n,e){if(new.target)return Ot({component:Yc,...n});It(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(()=>hf(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),m=null;function v(){if(m===t())return;const E=m=t();k(h,null),k(p,null),k(g,l(u)?Wv(l(u).base64):null,!0);const D=document.createElement("video");D.preload="metadata",D.onloadedmetadata=()=>{m===E&&(Number.isFinite(D.duration)&&D.duration>0&&k(h,D.duration,!0),D.videoWidth>0&&D.videoHeight>0&&k(p,{width:D.videoWidth,height:D.videoHeight},!0))},D.src=t(),l(u)||fetch(t()).then(ee=>ee.ok?ee.blob():null).then(ee=>{ee&&m===E&&k(g,ee.size,!0)}).catch(()=>{})}function C(){const E=l(d)?.path.split("/").pop();if(E)return E;const D=(r()||"video").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(D))return D;const ee=(i()??l(u)?.mimeType)==="video/webm"?"webm":"mp4";return`${D}.${ee}`}async function z(){let E=null;try{let D=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()),D=E}const ee=document.createElement("a");ee.href=D,ee.download=C(),document.body.appendChild(ee),ee.click(),ee.remove(),E&&URL.revokeObjectURL(E)}catch{E&&URL.revokeObjectURL(E),Ms.error(_.ui_videoActionsMenu_downloadFailed_error())}}async function M(E,D){try{await Jc(E),Ms.success(D)}catch{Ms.error(_.ui_videoActionsMenu_copyFailed_error())}}ct(()=>{o()&&v()}),ct(()=>{if(o())return ua(()=>{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:Nt,$on:(E,D)=>Dt(e,E,D)},O=Ze(),N=ue(O);return wt(N,()=>ih,(E,D)=>{D(E,{get open(){return o()},set open(ee){o(ee)},children:(ee,U)=>{var oe=CS(),F=ue(oe);{let X=w(()=>Cr("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",a())),le=w(()=>_.ui_videoActionsMenu_trigger_ariaLabel());wt(F,()=>rh,(re,Q)=>{Q(re,{get class(){return l(X)},get"aria-label"(){return l(le)},onclick:me=>me.stopPropagation(),children:(me,P)=>{bv(me,{class:"size-3.5"})},$$slots:{default:!0}})})}var W=A(F,2);wt(W,()=>sh,(X,le)=>{le(X,{get class(){return c()},align:"end",children:(re,Q)=>{var me=SS(),P=ue(me);wt(P,()=>Wo,(ae,V)=>{V(ae,{onSelect:()=>void z(),children:(K,I)=>{Pt();var te=zt();L(ve=>H(te,ve),[()=>_.ui_videoActionsMenu_download_label()]),x(K,te)},$$slots:{default:!0}})});var $=A(P,2);{var ce=ae=>{var V=Ze(),K=ue(V);wt(K,()=>Wo,(I,te)=>{te(I,{onSelect:()=>void M(l(d).path,_.ui_videoActionsMenu_pathCopied_label()),children:(ve,de)=>{Pt();var fe=zt();L(ke=>H(fe,ke),[()=>_.ui_videoActionsMenu_copyPath_label()]),x(ve,fe)},$$slots:{default:!0}})}),x(ae,V)},pe=ae=>{var V=Ze(),K=ue(V);wt(K,()=>Wo,(I,te)=>{te(I,{onSelect:()=>void M(t(),_.ui_videoActionsMenu_linkCopied_label()),children:(ve,de)=>{Pt();var fe=zt();L(ke=>H(fe,ke),[()=>_.ui_videoActionsMenu_copyLink_label()]),x(ve,fe)},$$slots:{default:!0}})}),x(ae,V)};j($,ae=>{l(f)==="workspace"&&l(d)?ae(ce):l(f)==="remote"&&ae(pe,1)})}var ye=A($,2);{var Z=ae=>{var V=_S(),K=ue(V);wt(K,()=>yv,(be,q)=>{q(be,{})});var I=A(K,2);{var te=be=>{var q=wS(),Me=se(q,!0);L(ze=>H(Me,ze),[()=>_.ui_videoActionsMenu_duration_label({duration:d1(l(h)*1e3)})]),x(be,q)};j(I,be=>{l(h)!==null&&be(te)})}var ve=A(I,2);{var de=be=>{var q=xS(),Me=se(q,!0);L(ze=>H(Me,ze),[()=>_.ui_videoActionsMenu_dimensions_label({width:ps(l(p).width),height:ps(l(p).height)})]),x(be,q)};j(ve,be=>{l(p)&&be(de)})}var fe=A(ve,2);{var ke=be=>{var q=kS(),Me=se(q,!0);L(ze=>H(Me,ze),[()=>iv(l(g))]),x(be,q)};j(fe,be=>{l(g)!==null&&be(ke)})}x(ae,V)};j(ye,ae=>{(l(h)!==null||l(p)||l(g)!==null)&&ae(Z)})}x(re,me)},$$slots:{default:!0}})}),x(ee,oe)},$$slots:{default:!0}})}),x(n,O),Lt(S)}var MS=B('<p class="type-body text-white/80" role="status"> </p>'),TS=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 qv(n,e){if(new.target)return Ot({component:qv,...n});It(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);ct(()=>{!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:Nt,$on:(p,g)=>Dt(e,p,g)};{let p=w(()=>_.chat_videoBlock_dialog_title({name:i()})),g=w(()=>_.chat_videoBlock_close_ariaLabel());gh(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(m){r(m)},children:(m,v)=>{var C=TS(),z=ne(C),M=se(z,!0),S=A(z,2);{var O=N=>{var E=MS(),D=se(E,!0);L(ee=>H(D,ee),[()=>_.chat_videoBlock_unavailable_description()]),x(N,E)};j(S,N=>{l(f)&&N(O)})}Y(C),L(N=>{st(z,"src",s()),st(z,"poster",o()),st(z,"aria-label",i()),H(M,N)},[()=>_.chat_videoBlock_unsupported_description()]),Mo("error",z,()=>k(f,!0)),x(m,C)},$$slots:{default:!0}})}return Lt(h)}var ES=B('<span class="block truncate text-foreground"> </span>'),AS=B("<!> ",1),RS=B("<!> <!>",1),PS=B('<span class="flex shrink-0 flex-wrap items-center gap-1"><!> <!></span>'),IS=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 Jv(n,e){if(new.target)return Ot({component:Jv,...n});It(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(D){D.preventDefault(),D.stopPropagation()}function u(D){c(D),o()?.()}async function d(D){if(c(D),!!s())try{await Jc(s()),Ms.success(_.ui_imageActionsMenu_pathCopied_label())}catch{Ms.error(_.ui_imageActionsMenu_copyFailed_error())}}function f(D){if(c(D),!s()||!i())return;const ee=s().split("/").map(encodeURIComponent).join("/");ah(`intent://local/file/${ee}`,{workspaceId:Cv(i())})}var h={get name(){return t()},set name(D){t(D),b()},get reason(){return r()},set reason(D){r(D),b()},get path(){return s()},set path(D){s(D),b()},get workspaceId(){return i()},set workspaceId(D){i(D),b()},get onRetry(){return o()},set onRetry(D){o(D),b()},$set:Nt,$on:(D,ee)=>Dt(e,D,ee)},p=IS(),g=ne(p),m=ne(g),v=ne(m);tt(v,{get icon(){return Kc},class:"size-3.5"}),Y(m);var C=A(m,2),z=ne(C);{var M=D=>{var ee=ES(),U=se(ee,!0);$l(ee,(oe,F)=>uf?.(oe,F),t),L(()=>H(U,t())),x(D,ee)};j(z,D=>{t()&&D(M)})}var S=A(z,2),O=se(S,!0);Y(C),Y(g);var N=A(g,2);{var E=D=>{var ee=PS(),U=ne(ee);{var oe=X=>{{let le=w(()=>_.chat_shared_retry_label());qe(X,{variant:"ghost",size:"icon-compact",get tooltip(){return l(le)},onclick:u,children:(re,Q)=>{tt(re,{get icon(){return eh},size:"xs"})},$$slots:{default:!0}})}};j(U,X=>{o()&&X(oe)})}var F=A(U,2);{var W=X=>{var le=RS(),re=ue(le);{var Q=P=>{qe(P,{variant:"ghost",size:"compact",onclick:f,children:($,ce)=>{var pe=AS(),ye=ue(pe);tt(ye,{get icon(){return cv},size:"xs"});var Z=A(ye);L(ae=>H(Z,` ${ae??""}`),[()=>_.chat_changesPanel_openFile_tooltip()]),x($,pe)},$$slots:{default:!0}})};j(re,P=>{i()&&r()!=="other-workspace"&&r()!=="invalid-link"&&P(Q)})}var me=A(re,2);{let P=w(()=>_.ui_imageActionsMenu_copyPath_label());qe(me,{variant:"ghost",size:"icon-compact",get tooltip(){return l(P)},onclick:d,children:($,ce)=>{tt($,{get icon(){return lv},size:"xs"})},$$slots:{default:!0}})}x(X,le)};j(F,X=>{s()&&X(W)})}Y(ee),x(D,ee)};j(N,D=>{(o()||s())&&D(E)})}return Y(p),L(()=>{st(p,"data-reason",r()),H(O,l(a))}),x(n,p),Lt(h)}const iB=At.createSelector(n=>n.featureCodes.activeFeatures),LS=At.createSelector((n,e)=>n.featureCodes.activeFeatures.includes(e)),oB=At.createSelector(n=>n.featureCodes.activeFeatures.length>0),aB=At.createSelector(n=>n.featureCodes.dialogOpen);var OS=B("<span> </span>"),NS=B('<div role="search"><div><!> <!> <!></div> <div><!> <!> <!></div></div>');function DS(n,e){if(new.target)return Ot({component:DS,...n});It(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),m=y(e,"resultText",7,void 0),v=y(e,"emptyResultText",23,()=>_.ui_panelFindBar_noMatches_label()),C=y(e,"showResultText",7,!0),z=y(e,"showResultWhenQueryEmpty",7,!1),M=y(e,"resultFormat",7,"slash"),S=y(e,"resultVariant",7,void 0),O=y(e,"searchAriaLabel",23,()=>_.ui_panelFindBar_search_ariaLabel()),N=y(e,"previousLabel",23,()=>_.ui_panelFindBar_previous_label()),E=y(e,"previousShortcutLabel",7,"Shift+Enter"),D=y(e,"previousKeyShortcuts",7,"Shift+Enter"),ee=y(e,"previousTitle",7,void 0),U=y(e,"nextLabel",23,()=>_.ui_panelFindBar_next_label()),oe=y(e,"nextShortcutLabel",7,"Enter"),F=y(e,"nextKeyShortcuts",7,"Enter"),W=y(e,"nextTitle",7,void 0),X=y(e,"closeLabel",23,()=>_.ui_panelFindBar_close_label()),le=y(e,"closeShortcutLabel",7,"Esc"),re=y(e,"closeKeyShortcuts",7,"Escape"),Q=y(e,"closeTitle",7,void 0),me=y(e,"layout",7,"floating"),P=y(e,"class",7),$=y(e,"inputWrapperClass",7),ce=y(e,"inputClass",7),pe=y(e,"actionsClass",7),ye=y(e,"onPrevious",7),Z=y(e,"onNext",7),ae=y(e,"onClose",7),V=y(e,"onQueryChange",7),K=y(e,"onInput",7),I=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(m()!==void 0)return m();if(!C()||!l(te)&&!z()||typeof g()!="number")return null;if(g()<=0)return l(te)?v():null;const ie=Math.min(Math.max(p()+1,1),g());return M()==="of"?_.ui_panelFindBar_matchOf_label({current:ie,total:g()}):`${ie} / ${g()}`}),fe=w(()=>S()??(typeof g()=="number"&&g()<=0&&l(te)?"destructive":"muted"));ct(()=>{(d()||h()!==void 0)&&r()&&!i()&&!o()&&(r().focus(),f()&&r().select())});function ke(){r()?.focus()}function be(){r()?.blur()}function q(){r()?.select()}function Me(ie,$e){return $e?`${ie} (${$e})`:ie}function ze(ie){t(ie.currentTarget.value),V()?.(t(),ie),K()?.(ie)}function gt(ie){I()?.(ie),!ie.defaultPrevented&&(ie.key==="Escape"&&ae()&&!c()&&!i()?(ie.preventDefault(),ae()(ie)):ie.key==="Enter"&&!l(ve)&&(ie.preventDefault(),ie.shiftKey?ye()?.(t(),ie):Z()?.(t(),ie)))}var Le={focus:ke,blur:be,select:q,get query(){return t()},set query(ie=""){t(ie),b()},get inputRef(){return r()},set inputRef(ie=null){r(ie),b()},get placeholder(){return s()},set placeholder(ie=_.ui_panelFindBar_find_placeholder()){s(ie),b()},get disabled(){return i()},set disabled(ie=!1){i(ie),b()},get inputDisabled(){return o()},set inputDisabled(ie=!1){o(ie),b()},get navigationDisabled(){return a()},set navigationDisabled(ie=!1){a(ie),b()},get closeDisabled(){return c()},set closeDisabled(ie=!1){c(ie),b()},get disableNavigationWhenNoMatches(){return u()},set disableNavigationWhenNoMatches(ie=!0){u(ie),b()},get autofocus(){return d()},set autofocus(ie=!1){d(ie),b()},get selectOnFocus(){return f()},set selectOnFocus(ie=!0){f(ie),b()},get focusTrigger(){return h()},set focusTrigger(ie){h(ie),b()},get currentMatchIndex(){return p()},set currentMatchIndex(ie=0){p(ie),b()},get totalMatches(){return g()},set totalMatches(ie){g(ie),b()},get resultText(){return m()},set resultText(ie=void 0){m(ie),b()},get emptyResultText(){return v()},set emptyResultText(ie=_.ui_panelFindBar_noMatches_label()){v(ie),b()},get showResultText(){return C()},set showResultText(ie=!0){C(ie),b()},get showResultWhenQueryEmpty(){return z()},set showResultWhenQueryEmpty(ie=!1){z(ie),b()},get resultFormat(){return M()},set resultFormat(ie="slash"){M(ie),b()},get resultVariant(){return S()},set resultVariant(ie=void 0){S(ie),b()},get searchAriaLabel(){return O()},set searchAriaLabel(ie=_.ui_panelFindBar_search_ariaLabel()){O(ie),b()},get previousLabel(){return N()},set previousLabel(ie=_.ui_panelFindBar_previous_label()){N(ie),b()},get previousShortcutLabel(){return E()},set previousShortcutLabel(ie="Shift+Enter"){E(ie),b()},get previousKeyShortcuts(){return D()},set previousKeyShortcuts(ie="Shift+Enter"){D(ie),b()},get previousTitle(){return ee()},set previousTitle(ie=void 0){ee(ie),b()},get nextLabel(){return U()},set nextLabel(ie=_.ui_panelFindBar_next_label()){U(ie),b()},get nextShortcutLabel(){return oe()},set nextShortcutLabel(ie="Enter"){oe(ie),b()},get nextKeyShortcuts(){return F()},set nextKeyShortcuts(ie="Enter"){F(ie),b()},get nextTitle(){return W()},set nextTitle(ie=void 0){W(ie),b()},get closeLabel(){return X()},set closeLabel(ie=_.ui_panelFindBar_close_label()){X(ie),b()},get closeShortcutLabel(){return le()},set closeShortcutLabel(ie="Esc"){le(ie),b()},get closeKeyShortcuts(){return re()},set closeKeyShortcuts(ie="Escape"){re(ie),b()},get closeTitle(){return Q()},set closeTitle(ie=void 0){Q(ie),b()},get layout(){return me()},set layout(ie="floating"){me(ie),b()},get class(){return P()},set class(ie){P(ie),b()},get inputWrapperClass(){return $()},set inputWrapperClass(ie){$(ie),b()},get inputClass(){return ce()},set inputClass(ie){ce(ie),b()},get actionsClass(){return pe()},set actionsClass(ie){pe(ie),b()},get onPrevious(){return ye()},set onPrevious(ie){ye(ie),b()},get onNext(){return Z()},set onNext(ie){Z(ie),b()},get onClose(){return ae()},set onClose(ie){ae(ie),b()},get onQueryChange(){return V()},set onQueryChange(ie){V(ie),b()},get onInput(){return K()},set onInput(ie){K(ie),b()},get onKeydown(){return I()},set onKeydown(ie){I(ie),b()},$set:Nt,$on:(ie,$e)=>Dt(e,ie,$e)},De=NS(),Fe=ne(De),vt=ne(Fe);tt(vt,{get icon(){return k1},class:"size-3 shrink-0 text-muted-foreground"});var Vt=A(vt,2);{let ie=w(()=>i()||o()),$e=w(()=>Cr("h-6 w-36 border-0 bg-transparent px-0 py-0 text-sm shadow-none","placeholder:text-muted-foreground",ce()));ss(Vt,{type:"text",get placeholder(){return s()},get disabled(){return l(ie)},noFocusStyle:!0,get class(){return l($e)},get"aria-label"(){return O()},oninput:ze,onkeydown:gt,get ref(){return r()},set ref(lt){r(lt)},get value(){return t()},set value(lt){t(lt)}})}var nt=A(Vt,2);{var Pe=ie=>{var $e=OS(),lt=se($e,!0);L(yt=>{at($e,1,yt),H(lt,l(de))},[()=>$n(Cr("whitespace-nowrap text-xs tabular-nums",l(fe)==="destructive"?"text-danger":"text-muted-foreground"))]),x(ie,$e)};j(nt,ie=>{l(de)&&ie(Pe)})}Y(Fe);var Ce=A(Fe,2),we=ne(Ce);{let ie=w(()=>ee()??Me(N(),E()));qe(we,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:$e=>ye()?.(t(),$e),get disabled(){return l(ve)},get"aria-label"(){return N()},get"aria-keyshortcuts"(){return D()},get title(){return l(ie)},children:($e,lt)=>{tt($e,{get icon(){return _1},class:"size-3"})},$$slots:{default:!0}})}var Ve=A(we,2);{let ie=w(()=>W()??Me(U(),oe()));qe(Ve,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:$e=>Z()?.(t(),$e),get disabled(){return l(ve)},get"aria-label"(){return U()},get"aria-keyshortcuts"(){return F()},get title(){return l(ie)},children:($e,lt)=>{tt($e,{get icon(){return ra},class:"size-3"})},$$slots:{default:!0}})}var Mt=A(Ve,2);{let ie=w(()=>i()||c()),$e=w(()=>Q()??Me(X(),le()));qe(Mt,{type:"button",variant:"ghost-light",size:"icon-xs",class:"rounded-sm",onclick:lt=>ae()?.(lt),get disabled(){return l(ie)},get"aria-label"(){return X()},get"aria-keyshortcuts"(){return re()},get title(){return l($e)},children:(lt,yt)=>{tt(lt,{get icon(){return Ki},class:"size-3.5"})},$$slots:{default:!0}})}return Y(Ce),Y(De),L((ie,$e,lt)=>{st(De,"aria-label",O()),at(De,1,ie),at(Fe,1,$e),at(Ce,1,lt)},[()=>$n(Cr("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",me()==="floating"&&"absolute top-2 right-4 z-50",i()&&"pointer-events-none opacity-60",P())),()=>$n(Cr("flex h-7 min-w-0 items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2",$())),()=>$n(Cr("flex items-center gap-0.5",pe()))]),x(n,De),Lt(Le)}var Gp=Object.defineProperty,$S=(n,e)=>{let t={};for(var r in n)Gp(t,r,{get:n[r],enumerable:!0});return Gp(t,Symbol.toStringTag,{value:"Module"}),t};function Kr(n){this.content=n}Kr.prototype={constructor:Kr,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 Kr(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 Kr(t)},addToStart:function(n,e){return new Kr([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Kr(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 Kr(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=Kr.from(n),n.size?new Kr(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Kr.from(n),n.size?new Kr(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Kr.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}};Kr.from=function(n){if(n instanceof Kr)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Kr(e)};function Xv(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){let o=s.text,a=i.text,c=0;for(;o[c]==a[c];c++)t++;return c&&c<o.length&&c<a.length&&Zv(o.charCodeAt(c-1))&&Qv(o.charCodeAt(c))&&t--,t}if(s.content.size||i.content.size){let o=Xv(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Yv(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&&Zv(u.charCodeAt(f-1))&&Qv(u.charCodeAt(f))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let u=Yv(o.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}function Qv(n){return n>=56320&&n<57344}function Zv(n){return n>=55296&&n<56320}class Se{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 Se(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 Se(r,s)}cutByIndex(e,t){return e==t?Se.empty:e==0&&t==this.content.length?this:new Se(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 Se(s,i)}addToStart(e){return new Se([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Se(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Xv(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Yv(this,e,t,r)}findIndex(e){if(e==0)return pc(0,e);if(e==this.size)return pc(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?pc(t+1,i):pc(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 Se.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return Se.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Se.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 Se(t||e,r)}static from(e){if(!e)return Se.empty;if(e instanceof Se)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Se([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Se.empty=new Se([],0);const Ad={index:0,offset:0};function pc(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 Rn=class gf{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 gf.none;if(e instanceof gf)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};Rn.none=[];class Bl extends Error{}class je{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=tb(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new je(r,this.openStart,this.openEnd)}removeBetween(e,t){return new je(eb(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 je.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 je(Se.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 je(e,r,s)}}je.empty=new je(Se.empty,0,0);function eb(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(eb(i.content,e-s-1,t-s-1)))}function tb(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=tb(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 BS(n,e,t){if(t.openStart>n.depth)throw new Bl("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Bl("Inconsistent open depths");return nb(n,e,t,0)}function nb(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=nb(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 ea(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=zS(t,n);return ea(i,sb(n,o,a,e,r))}else return ea(i,Zc(n,e,r))}function rb(n,e){if(!e.type.compatibleContent(n.type))throw new Bl("Cannot join "+e.type.name+" onto "+n.type.name)}function mf(n,e,t){let r=n.node(t);return rb(r,e.node(t)),r}function Zo(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 _l(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&&(Zo(n.nodeAfter,r),i++));for(let a=i;a<o;a++)Zo(s.child(a),r);e&&e.depth==t&&e.textOffset&&Zo(e.nodeBefore,r)}function ea(n,e){if(!n.type.validContent(e))throw new Bl("Invalid content for node "+n.type.name);return n.copy(e)}function sb(n,e,t,r,s){let i=n.depth>s&&mf(n,e,s+1),o=r.depth>s&&mf(t,r,s+1),a=[];return _l(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(rb(i,o),Zo(ea(i,sb(n,e,t,r,s+1)),a)):(i&&Zo(ea(i,Zc(n,e,s+1)),a),_l(e,t,s,a),o&&Zo(ea(o,Zc(t,r,s+1)),a)),_l(r,null,s,a),new Se(a)}function Zc(n,e,t){let r=[];if(_l(null,n,t,r),n.depth>t){let s=mf(n,e,t+1);Zo(ea(s,Zc(n,e,t+1)),r)}return _l(e,null,t,r),new Se(r)}function zS(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(Se.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class zl{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 Rn.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 zl(t,r,i)}static resolveCached(e,t){let r=qp.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 qp.set(e,r=new FS);let s=r.elts[r.i]=zl.resolve(e,t);return r.i=(r.i+1)%HS,s}}class FS{constructor(){this.elts=[],this.i=0}}const HS=12,qp=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 US=Object.create(null);let wo=class vf{constructor(e,t,r,s=Rn.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||Se.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||US)&&Rn.sameSet(this.marks,r||Rn.none)}copy(e=null){return e==this.content?this:new vf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vf(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 je.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 je(u,s.depth-o,i.depth-o)}replace(e,t,r){return BS(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 zl.resolveCached(this,e)}resolveNoCache(e){return zl.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()+")"),ib(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=Se.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),Jp(this.type.attrs,this.attrs,"node",this.type.name);let e=Rn.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];Jp(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Rn.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=Se.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):ib(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 ib(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Jp(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 sa{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new VS(e,t);if(r.next==null)return sa.empty;let s=ob(r);r.next&&r.err("Unexpected trailing text");let i=XS(JS(s));return YS(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 Se.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
+ `)}}sa.empty=new sa(!0);class VS{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 ob(n){let e=[];do e.push(WS(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function WS(n){let e=[];do e.push(jS(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jS(n){let e=qS(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=KS(n,e);else break;return e}function Xp(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function KS(n,e){let t=Xp(n),r=t;return n.eat(",")&&(n.next!="}"?r=Xp(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function GS(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 qS(n){if(n.eat("(")){let e=ob(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=GS(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 JS(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 ab(n,e){return e-n}function Yp(n,e){let t=[];return r(e),t.sort(ab);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 XS(n){let e=Object.create(null);return t(Yp(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]);Yp(n,c).forEach(d=>{u||s.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new sa(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(ab);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function YS(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 lb(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 cb(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 ub(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ZS(n,r,e[r]);return t}let Qp=class db{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=ub(e,r.attrs),this.defaultAttrs=lb(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==sa.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:cb(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),Se.from(t),Rn.setFrom(r))}createChecked(e=null,t,r){return t=Se.from(t),this.checkContent(t),new wo(this,this.computeAttrs(e),t,Rn.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=Se.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(Se.empty,!0);return i?new wo(this,e,t.append(i),Rn.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:Rn.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new db(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 QS(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 ZS{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?QS(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=ub(e,s.attrs),this.excluded=null;let i=lb(this.attrs);this.instance=i?new Rn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Rn(this,cb(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 Bc{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=Kr.from(e.nodes),t.marks=Kr.from(e.marks||{}),this.nodes=Qp.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]=sa.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?Zp(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==""?[]:Zp(this,o.split(" "))}this.nodeFromJSON=s=>wo.fromJSON(this,s),this.markFromJSON=s=>Rn.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 Qp){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,Rn.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 Zp(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 eC(n){return n.tag!=null}function tC(n){return n.style!=null}let Sl=class bf{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(eC(s))this.tags.push(s);else if(tC(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 tg(this,t,!1);return r.addAll(e,Rn.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new tg(this,t,!0);return r.addAll(e,Rn.none,t.from,t.to),je.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(sC(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=ng(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=ng(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new bf(e,bf.schemaRules(e)))}};const fb={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},nC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hb={ol:!0,ul:!0},Fl=1,yf=2,Cl=4;function eg(n,e,t){return e!=null?(e?Fl:0)|(e==="full"?yf:0):n&&n.whitespace=="pre"?Fl|yf:t&~Cl}class gc{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=Rn.none,this.match=i||(o&Cl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Se.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&Fl)){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=Se.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Se.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&&!fb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class tg{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=eg(null,t.preserveWhitespace,0)|(r?Cl:0);s?i=new gc(s.type,s.attrs,Rn.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new gc(null,null,Rn.none,!0,null,o):i=new gc(e.schema.topNodeType,null,Rn.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&Fl)>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;hb.hasOwnProperty(o)&&this.parser.normalizeLists&&rC(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:nC.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(fb.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=Rn.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):rg(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=eg(e,i,o.options);o.options&Cl&&o.content.length==0&&(a|=Cl);let c=Rn.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):rg(u.type,e))?(c=u.addToSet(c),!1):!0),this.nodes.push(new gc(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|=Fl)}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 rC(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&hb.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function sC(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ng(n){let e={};for(let t in n)e[t]=n[t];return e}function rg(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 fa{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=mc(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 mc(t).createTextNode(e.text);let{dom:r,contentDOM:s}=zc(mc(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&&zc(mc(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return typeof t=="string"?{dom:e.createTextNode(t)}:zc(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new fa(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=sg(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return sg(e.marks)}}function sg(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function mc(n){return n.document||window.document}const ig=new WeakMap;function iC(n){let e=ig.get(n);return e===void 0&&ig.set(n,e=oC(n)),e}function oC(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 zc(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=iC(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}=zc(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 pb=65535,gb=Math.pow(2,16);function aC(n,e){return n+e*gb}function og(n){return n&pb}function lC(n){return(n-(n&pb))/gb}const mb=1,vb=2,Fc=4,bb=8;class wf{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&bb)>0}get deletedBefore(){return(this.delInfo&(mb|Fc))>0}get deletedAfter(){return(this.delInfo&(vb|Fc))>0}get deletedAcross(){return(this.delInfo&Fc)>0}}class Bs{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Bs.empty)return Bs.empty}recover(e){let t=0,r=og(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+lC(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:aC(a/3,e-c),m=0;return u&&(m|=e==c?vb:e==f?mb:Fc,(t<0?e!=c:e!=f)&&(m|=bb)),new wf(p,m,g)}s+=d-u}return r?e+s:new wf(e+s,0,null)}touches(e,t){let r=0,s=og(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 Bs(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Bs.empty:new Bs(e<0?[0,-e,0]:[0,0,e])}}Bs.empty=new Bs([]);class Hl{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 Hl(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 Hl;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 cs{getMap(){return Bs.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 vr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new vr(e,null)}static fail(e){return new vr(null,e)}static fromReplace(e,t,r,s){try{return vr.ok(e.replace(t,r,s))}catch(i){if(i instanceof Bl)return vr.fail(i.message);throw i}}}function mh(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(mh(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return Se.fromArray(r)}class bo extends cs{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 je(mh(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 vr.fromReplace(e,this.from,this.to,i)}invert(){return new di(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))}}cs.jsonID("addMark",bo);class di extends cs{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 je(mh(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return vr.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 di(t.pos,r.pos,this.mark)}merge(e){return e instanceof di&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new di(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 di(t.from,t.to,e.markFromJSON(t.mark))}}cs.jsonID("removeMark",di);class yo extends cs{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return vr.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return vr.fromReplace(e,this.pos,this.pos+1,new je(Se.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 ia(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))}}cs.jsonID("addNodeMark",yo);class ia extends cs{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return vr.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return vr.fromReplace(e,this.pos,this.pos+1,new je(Se.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 ia(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 ia(t.pos,e.markFromJSON(t.mark))}}cs.jsonID("removeNodeMark",ia);class nr extends cs{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)?vr.fail("Structure replace would overwrite content"):vr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Bs([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?je.empty:new je(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?je.empty:new je(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,je.fromJSON(e,t.slice),!!t.structure)}}nr.MAP_BIAS=1;cs.jsonID("replace",nr);class Nr extends cs{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 vr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return vr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?vr.fromReplace(e,this.from,this.to,r):vr.fail("Content does not fit in gap")}getMap(){return new Bs([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 Nr(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 Nr(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 Nr(t.from,t.to,t.gapFrom,t.gapTo,je.fromJSON(e,t.slice),t.insert,!!t.structure)}}cs.jsonID("replaceAround",Nr);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 cC(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 m=0;m<f.length;m++)f[m].isInSet(g)||(o&&o.to==h&&o.mark.eq(f[m])?o.to=p:s.push(o=new di(h,p,f[m])));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 uC(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 di(o.from,o.to,o.style)))}function vh(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,je.empty));else{r=f;for(let h=0;h<u.marks.length;h++)t.allowsMarkType(u.marks[h].type)||n.step(new di(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 je(Se.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(Se.empty,!0);n.replace(a,a,new je(c,0,0))}for(let c=o.length-1;c>=0;c--)n.step(o[c])}function dC(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ga(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||!dC(o,a,c))break;a&&(s=1),c<o.childCount&&(i=1)}return null}function fC(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=Se.empty,f=0;for(let g=i,m=!1;g>t;g--)m||r.index(g)>0?(m=!0,d=Se.from(r.node(g).copy(d)),f++):c--;let h=Se.empty,p=0;for(let g=i,m=!1;g>t;g--)m||s.after(g+1)<s.end(g)?(m=!0,h=Se.from(s.node(g).copy(h)),p++):u++;n.step(new Nr(c,u,o,a,new je(d.append(h),f,p),d.size-f,!0))}function bh(n,e,t=null,r=n){let s=hC(n,e),i=s&&pC(r,e);return i?s.map(ag).concat({type:e,attrs:t}).concat(i.map(ag)):null}function ag(n){return{type:n,attrs:null}}function hC(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 pC(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 gC(n,e,t){let r=Se.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=Se.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new Nr(s,i,s,i,new je(r,0,0),t.length,!0))}function mC(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)&&vC(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&&wb(n,o,a,i),vh(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 Nr(f,h,f+1,h-1,new je(Se.from(r.create(c,null,o.marks)),0,0),1,!0)),u===!0&&yb(n,o,a,i),!1}})}function yb(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 wb(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 vC(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function bC(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 Nr(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new je(Se.from(o),0,0),1,!0))}function Wi(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 m=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!m.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 yC(n,e,t=1,r){let s=n.doc.resolve(e),i=Se.empty,o=Se.empty;for(let a=s.depth,c=s.depth-t,u=t-1;a>c;a--,u--){i=Se.from(s.node(a).copy(i));let d=r&&r[u];o=Se.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}n.step(new nr(e,e,new je(i.append(o),t,t),!0))}function Ro(n,e){let t=n.resolve(e),r=t.index();return xb(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function wC(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 xb(n,e){return!!(n&&e&&!n.isLeaf&&wC(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&&xb(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 xC(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);wb(n,d.node(),d.before(),a)}o.inlineContent&&vh(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),je.empty,!0)),r===!0){let d=n.doc.resolve(u);yb(n,d.node(),d.before(),n.steps.length)}return n}function kC(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 kb(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=je.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return _b(s,i,r)?new nr(e,t,r):new _C(s,i,r).fit()}function _b(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class _C{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=Se.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=Se.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 je(i,o,a);return e>-1?new Nr(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=lg(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(Se.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 cg(e,-1)<=t?!1:(this.unplaced.size>1&&cg(e,1)>r&&r++,this.unplaced=new je(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=lg(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new je(pl(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new je(pl(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 m=0;m<i.length;m++)this.openFrontierNode(i[m]);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 m=0;m<s.childCount;m++)d.push(s.child(m));f=f.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let m=a.child(u),v=f.matchType(m.type);if(!v)break;u++,(u>1||c==0||m.content.size)&&(f=v,d.push(Sb(m.mark(h.allowedMarks(m.marks)),u==1?c:0,u==a.childCount?p:-1)))}let g=u==a.childCount;g||(p=-1),this.placed=gl(this.placed,t,Se.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 m=0,v=a;m<p;m++){let C=v.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),v=C.content}this.unplaced=g?e==0?je.empty:new je(pl(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new je(pl(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=gl(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=gl(this.placed,this.depth,Se.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(Se.empty,!0);t.childCount&&(this.placed=gl(this.placed,this.frontier.length,t))}}function pl(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(pl(n.firstChild.content,e-1,t)))}function gl(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(gl(n.lastChild.content,e-1,t)))}function lg(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Sb(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Sb(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(Se.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&&!SC(t,i.content,o)?a:null}function SC(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function CC(n){return n.spec.defining||n.spec.definingForContent}function cg(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 MC(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(_b(s,i,r))return n.step(new nr(e,t,r));let o=Mb(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=CC(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 m=0;m<o.length;m++){let v=o[(m+c)%o.length],C=!0;v<0&&(C=!1,v=-v);let z=s.node(v-1),M=s.index(v-1);if(z.canReplaceWith(M,M,g.type,g.marks))return n.replace(s.before(v),C?i.after(v):t,new je(Cb(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 Cb(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Cb(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(Se.empty,!0))}return n}function TC(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=kC(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new je(Se.from(r),0,0))}function EC(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=Mb(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 Mb(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let i=n.start(s);if(i<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&t.push(s)}return t}class La extends cs{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 vr.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 vr.fromReplace(e,this.pos,this.pos+1,new je(Se.from(s),0,t.isLeaf?0:1))}getMap(){return Bs.empty}invert(e){return new La(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new La(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new La(t.pos,t.attr,t.value)}}cs.jsonID("attr",La);class Ul extends cs{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 vr.ok(r)}getMap(){return Bs.empty}invert(e){return new Ul(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 Ul(t.attr,t.value)}}cs.jsonID("docAttr",Ul);let $a=class extends Error{};$a=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};$a.prototype=Object.create(Error.prototype);$a.prototype.constructor=$a;$a.prototype.name="TransformError";class Tb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new $a(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=je.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 je(Se.from(r),0,0))}delete(e,t){return this.replace(e,t,je.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return MC(this,e,t,r),this}replaceRangeWith(e,t,r){return TC(this,e,t,r),this}deleteRange(e,t){return EC(this,e,t),this}lift(e,t){return fC(this,e,t),this}join(e,t=1){return xC(this,e,t),this}wrap(e,t){return gC(this,e,t),this}setBlockType(e,t=e,r,s=null){return mC(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return bC(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new La(e,t,r)),this}setDocAttribute(e,t){return this.step(new Ul(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 Rn)t.isInSet(r.marks)&&this.step(new ia(e,t));else{let s=r.marks,i,o=[];for(;i=t.isInSet(s);)o.push(new ia(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 yC(this,e,t,r),this}addMark(e,t,r){return cC(this,e,t,r),this}removeMark(e,t,r){return uC(this,e,t,r),this}clearIncompatible(e,t,r){return vh(this,e,t,r),this}}const Id=Object.create(null);class Jt{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new AC(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=je.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?je.empty:t),a==0&&fg(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),fg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new Je(e):Ea(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?Ea(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Ea(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new zs(e.node(0))}static atStart(e){return Ea(e,e,0,0,1)||new zs(e)}static atEnd(e){return Ea(e,e,e.content.size,e.childCount,-1)||new zs(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 Je.between(this.$anchor,this.$head).getBookmark()}}Jt.prototype.visible=!0;class AC{constructor(e,t){this.$from=e,this.$to=t}}let ug=!1;function dg(n){!ug&&!n.parent.inlineContent&&(ug=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Je extends Jt{constructor(e,t=e){dg(e),dg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Jt.near(r);let s=e.resolve(t.map(this.anchor));return new Je(s.parent.inlineContent?s:r,r)}replace(e,t=je.empty){if(super.replace(e,t),t==je.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Je&&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 Je(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=Jt.findFrom(t,r,!0)||Jt.findFrom(t,-r,!0);if(i)t=i.$head;else return Jt.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(Jt.findFrom(e,-r,!0)||Jt.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new Je(e,t)}}Jt.jsonID("text",Je);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 Je.between(e.resolve(this.anchor),e.resolve(this.head))}}class bt extends Jt{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?Jt.near(i):new bt(i)}content(){return new je(Se.from(this.node),0,0)}eq(e){return e instanceof bt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new yh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new bt(e.resolve(t.anchor))}static create(e,t){return new bt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}bt.prototype.visible=!1;Jt.jsonID("node",bt);class yh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yu(r,r):new yh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&bt.isSelectable(r)?new bt(t):Jt.near(t)}}class zs extends Jt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=je.empty){if(t==je.empty){e.delete(0,e.doc.content.size);let r=Jt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new zs(e)}map(e){return new zs(e)}eq(e){return e instanceof zs}getBookmark(){return RC}}Jt.jsonID("all",zs);const RC={map(){return this},resolve(n){return new zs(n)}};function Ea(n,e,t,r,s,i=!1){if(e.inlineContent)return Je.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&&bt.isSelectable(a))return bt.create(n,t-(s<0?a.nodeSize:0))}else{let c=Ea(n,a,t+s,s<0?a.childCount:0,s,i);if(c)return c}t+=a.nodeSize*s}return null}function fg(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof nr||s instanceof Nr))return;let i=n.mapping.maps[r],o;i.forEach((a,c,u,d)=>{o==null&&(o=d)}),n.setSelection(Jt.near(n.doc.resolve(o),t))}const hg=1,vc=2,pg=4;class PC extends Tb{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|hg)&~vc,this.storedMarks=null,this}get selectionSet(){return(this.updated&hg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=vc,this}ensureMarks(e){return Rn.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&vc)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~vc,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)||Rn.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(t);i=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(Jt.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=pg,this}get scrolledIntoView(){return(this.updated&pg)>0}}function gg(n,e){return!e||!n?n:n.bind(e)}class ml{constructor(e,t,r){this.name=e,this.init=gg(t.init,r),this.apply=gg(t.apply,r)}}const IC=[new ml("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ml("selection",{init(n,e){return n.selection||Jt.atStart(e.doc)},apply(n){return n.selection}}),new ml("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ml("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=IC.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 ml(r.key,r.spec.state,r))})}}class Hi{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 Hi(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 PC(this)}static create(e){let t=new Ld(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Hi(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 Hi(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 Hi(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=Jt.fromJSON(i.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[o.name]=u.fromJSON.call(c,e,t[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function Eb(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Eb(s,e,{})),t[r]=s}return t}class Tn{constructor(e){this.spec=e,this.props={},e.props&&Eb(e.props,this,this.props),this.key=e.key?e.key.key:Ab("plugin")}getState(e){return e[this.key]}}const Od=Object.create(null);function Ab(n){return n in Od?n+"$"+ ++Od[n]:(Od[n]=0,n+"$")}class Vn{constructor(e="key"){this.key=Ab(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Rb=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Pb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Ib=(n,e,t)=>{let r=Pb(n,t);if(!r)return!1;let s=wh(r);if(!s){let o=r.blockRange(),a=o&&Ga(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(Vb(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Ba(i,"end")||bt.isSelectable(i)))for(let o=r.depth;;o--){let a=Xu(n.doc,r.before(o),r.after(o),je.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Ba(i,"end")?Jt.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):bt.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},Lb=(n,e,t)=>{let r=Pb(n,t);if(!r)return!1;let s=wh(r);return s?Nb(n,s,e):!1},Ob=(n,e,t)=>{let r=$b(n,t);if(!r)return!1;let s=xh(r);return s?Nb(n,s,e):!1};function Nb(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,je.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(Je.create(d.doc,i)),t(d.scrollIntoView())}return!0}function Ba(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 Db=(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=wh(r)}let o=i&&i.nodeBefore;return!o||!bt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(bt.create(n.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function wh(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 $b(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Bb=(n,e,t)=>{let r=$b(n,t);if(!r)return!1;let s=xh(r);if(!s)return!1;let i=s.nodeAfter;if(Vb(n,s,e,1))return!0;if(r.parent.content.size==0&&(Ba(i,"start")||bt.isSelectable(i))){let o=Xu(n.doc,r.before(),r.after(),je.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Ba(i,"start")?Jt.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):bt.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},zb=(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=xh(r)}let o=i&&i.nodeAfter;return!o||!bt.isSelectable(o)?!1:(e&&e(n.tr.setSelection(bt.create(n.doc,i.pos)).scrollIntoView()),!0)};function xh(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 LC=(n,e)=>{let t=n.selection,r=t instanceof bt,s;if(r){if(t.node.isTextblock||!Ro(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(bt.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},OC=(n,e)=>{let t=n.selection,r;if(t instanceof bt){if(t.node.isTextblock||!Ro(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},NC=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&Ga(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},Fb=(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 kh(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 DC=(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=kh(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,o.createAndFill());c.setSelection(Jt.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},Hb=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof zs||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=kh(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(Je.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Ub=(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(Wi(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&Ga(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function $C(n){return(e,t)=>{if(e.selection instanceof bt&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!Wi(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 Je||e.selection instanceof zs)&&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=kh(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=Wi(r.doc,f,o.length,o);if(h||(o[0]=c?{type:c}:null,h=Wi(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)),m=r.doc.resolve(g);c&&s.node(a-1).canReplaceWith(m.index(),m.index()+1,c)&&r.setNodeMarkup(p.map(s.before(a)),c)}return t&&t(r.scrollIntoView()),!0}}const BC=$C(),zC=(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(bt.create(n.doc,s))),!0)};function FC(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||Ro(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Vb(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,c=s.type.spec.isolating||i.type.spec.isolating;if(!c&&FC(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=Se.empty;for(let C=o.length-1;C>=0;C--)g=Se.from(o[C].create(null,g));g=Se.from(s.copy(g));let m=n.tr.step(new Nr(e.pos-1,p,e.pos,p,new je(g,1,0),o.length,!0)),v=m.doc.resolve(p+2*o.length);v.nodeAfter&&v.nodeAfter.type==s.type&&Ro(m.doc,v.pos)&&m.join(v.pos),t(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&c?null:Jt.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),h=f&&Ga(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(u&&Ba(i,"start",!0)&&Ba(s,"end")){let p=s,g=[];for(;g.push(p),!p.isTextblock;)p=p.lastChild;let m=i,v=1;for(;!m.isTextblock;m=m.firstChild)v++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let C=Se.empty;for(let M=g.length-1;M>=0;M--)C=Se.from(g[M].copy(C));let z=n.tr.step(new Nr(e.pos-g.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new je(C,g.length,0),0,!0));t(z.scrollIntoView())}return!0}}return!1}function Wb(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(Je.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const HC=Wb(-1),UC=Wb(1);function VC(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i),a=o&&bh(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function mg(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 _h(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}_h(Rb,Ib,Db);_h(Rb,Bb,zb);_h(Fb,Hb,Ub,BC);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function WC(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 jC(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function jC(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=bh(i,t,r,e);return a?(n&&KC(n,e,a,s,t),!0):!1}function KC(n,e,t,r,s){let i=Se.empty;for(let d=t.length-1;d>=0;d--)i=Se.from(t[d].type.create(t[d].attrs,i));n.step(new Nr(e.start-(r?2:0),e.end,e.start,e.end,new je(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&&Wi(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=u.child(d).nodeSize;return n}function GC(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?qC(e,t,n,i):JC(e,t,i):!0:!1}}function qC(n,e,t,r){let s=n.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Nr(i-1,o,i,o,new je(Se.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=Ga(r);if(a==null)return!1;s.lift(r,a);let c=s.doc.resolve(s.mapping.map(i,-1)-1);return Ro(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),e(s.scrollIntoView()),!0}function JC(n,e,t){let r=n.tr,s=t.parent;for(let p=t.end,g=t.endIndex-1,m=t.startIndex;g>m;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?Se.empty:Se.from(s))))return!1;let f=i.pos,h=f+o.nodeSize;return r.step(new Nr(f-(a?1:0),h+(c?1:0),f+1,h-1,new je((a?Se.empty:Se.from(s.copy(Se.empty))).append(c?Se.empty:Se.from(s.copy(Se.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function XC(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=Se.from(u?n.create():null),f=new je(Se.from(n.create(null,Se.from(a.type.create(null,d)))),u?3:1,0),h=i.start,p=i.end;t(e.tr.step(new Nr(h-(u?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const Gr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},za=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let kf=null;const Fi=function(n,e,t){let r=kf||(kf=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},YC=function(){kf=null},oa=function(n,e,t,r){return t&&(vg(n,e,t,r,-1)||vg(n,e,t,r,1))},QC=/^(img|br|input|textarea|hr)$/i;function vg(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;if(e==(s<0?0:as(n))){let o=n.parentNode;if(!o||!_t(o)||nc(n)||QC.test(n.nodeName)||n.contentEditable=="false")return!1;e=Gr(n)+(s<0?0:1),n=o}else if(_t(n)){let o=n.childNodes[e+(s<0?-1:0)];if(_t(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?as(n):0}else return!1}}function as(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function _t(n){return n.nodeType==1}function Mr(n){return n.nodeType==3}function aa(n,e){return e?n.contains(_t(e)?e:e.parentNode):!1}function ZC(n,e){for(;;){if(Mr(n)&&e)return n;if(_t(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=as(n)}else if(n.parentNode&&!nc(n))e=Gr(n),n=n.parentNode;else return null}}function eM(n,e){for(;;){if(Mr(n)&&e<n.nodeValue.length)return n;if(_t(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!nc(n))e=Gr(n)+1,n=n.parentNode;else return null}}function tM(n,e,t){for(let r=e==0,s=e==as(n);r||s;){if(n==t)return!0;let i=Gr(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==as(n)}}function nc(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&&oa(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Uo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function nM(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rM(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(as(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(as(r.startContainer),r.startOffset)}}}const _i=typeof navigator<"u"?navigator:null,bg=typeof document<"u"?document:null,Po=_i&&_i.userAgent||"",_f=/Edge\/(\d+)/.exec(Po),jb=/MSIE \d/.exec(Po),Sf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Po),As=!!(jb||Sf||_f),xo=jb?document.documentMode:Sf?+Sf[1]:_f?+_f[1]:0,Fs=!As&&/gecko\/(\d+)/i.test(Po);Fs&&+(/Firefox\/(\d+)/.exec(Po)||[0,0])[1];const Cf=!As&&/Chrome\/(\d+)/.exec(Po),Yr=!!Cf,Kb=Cf?+Cf[1]:0,ls=!As&&!!_i&&/Apple Computer/.test(_i.vendor),Fa=ls&&(/Mobile\/\w+/.test(Po)||!!_i&&_i.maxTouchPoints>2),Ys=Fa||(_i?/Mac/.test(_i.platform):!1),Gb=_i?/Win/.test(_i.platform):!1,Ui=/Android \d/.test(Po),Zu=!!bg&&"webkitFontSmoothing"in bg.documentElement.style,sM=Zu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function iM(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 Oi(n,e){return typeof n=="number"?n:n[e]}function oM(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 yg(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(!_t(o)){o=za(o);continue}let a=o==i.body,c=a?iM(i):oM(o),u=0,d=0;if(e.top<c.top+Oi(r,"top")?d=-(c.top-e.top+Oi(s,"top")):e.bottom>c.bottom-Oi(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Oi(s,"top")-c.top:e.bottom-c.bottom+Oi(s,"bottom")),e.left<c.left+Oi(r,"left")?u=-(c.left-e.left+Oi(s,"left")):e.right>c.right-Oi(r,"right")&&(u=e.right-c.right+Oi(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,m=o.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:za(o)}}function aM(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:qb(n.dom)}}function qb(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=za(r));return e}function lM({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Jb(t,r==0?0:r-e)}function Jb(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 xa=null;function cM(n){if(n.setActive)return n.setActive();if(xa)return n.focus(xa);let e=qb(n);n.focus(xa==null?{get preventScroll(){return xa={preventScroll:!0},!0}}:void 0),xa||(xa=!1,Jb(e,0))}function Xb(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(_t(d))h=d.getClientRects();else if(Mr(d))h=Fi(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 m=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(m<r){t=d,r=m,s=m&&Mr(t)?{left:g.right<e.left?g.right:g.left,top:e.top}:e,_t(d)&&m&&(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&&Mr(t)?uM(t,s):!t||r?{node:n,offset:i}:Xb(t,s)}function uM(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&&Sh(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 Sh(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function dM(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function fM(n,e,t){let{node:r,offset:s}=Xb(e,t),i=-1;if(_t(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 hM(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(_t(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 Yb(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(_t(o)){let a=o.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(Sh(e,u))return Yb(o,e,u)}}if((i=(i+1)%r)==s)break}return n}function pM(n,e){let t=n.dom.ownerDocument,r,s=0,i=rM(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(!Sh(e,u)||(o=Yb(n.dom,e,u),!o))return null}if(ls)for(let u=o;r&&u;u=za(u))u.draggable&&(r=void 0);if(o=dM(o,e),r){if(Fs&&_t(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&&_t(r)&&_t(u=r.childNodes[s-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&_t(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(s==0||!_t(r)||r.childNodes[s-1].nodeName!="BR")&&(a=hM(n,r,s,e))}a==null&&(a=fM(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 gM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Qb(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),o=Zu||Fs;if(Mr(r))if(o&&(gM.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let c=co(Fi(r,s,s),t);if(Fs&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=co(Fi(r,s-1,s-1),-1);if(u.top==c.top){let d=co(Fi(r,s,s+1),-1);if(d.top!=c.top)return ll(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++,ll(co(Fi(r,c,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==as(r))){let c=r.childNodes[s-1];if(_t(c))return Nd(c.getBoundingClientRect(),!1)}if(i==null&&s<as(r)){let c=r.childNodes[s];if(_t(c))return Nd(c.getBoundingClientRect(),!0)}return Nd(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==as(r))){let c=r.childNodes[s-1],u=Mr(c)?Fi(c,as(c)-(o?0:1)):_t(c)&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return ll(co(u,1),!1)}if(i==null&&s<as(r)){let c=r.childNodes[s];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?Mr(c)?Fi(c,0,o?0:1):_t(c)?c:null:null;if(u)return ll(co(u,-1),!0)}return ll(co(Mr(r)?Fi(r):r,-t),t>=0)}function ll(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 Zb(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 mM(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return Zb(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=Qb(n,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let c;if(_t(a))c=a.getClientRects();else if(Mr(a))c=Fi(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 vM=/[\u0590-\u08ac]/;function bM(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?!vM.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:o:Zb(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:m}=n.domSelectionRange(),v=g&&!aa(p,g)||c==g&&u==m;try{a.collapse(d,f),c&&(c!=d||u!=f)&&a.extend&&a.extend(c,u)}catch{}return h!=null&&(a.caretBidiLevel=h),v}):r.pos==r.start()||r.pos==r.end()}let wg=null,xg=null,kg=!1;function yM(n,e,t){return wg==e&&xg==t?kg:(wg=e,xg=t,kg=t=="up"||t=="down"?mM(n,e,t):bM(n,e,t))}const Zs=0,_g=1,Ko=2,hi=3;class rc{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=Zs,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&&aa(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>Gr(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)&&!(_t(o)?aa(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 ty||i instanceof ey&&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?Gr(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?Gr(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=Gr(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=Gr(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(!_t(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 m=this.children[p],v=g+m.size;if(i>g&&o<v)return m.setSelection(e-g-m.border,t-g-m.border,r,s);g=v}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((Fs||ls)&&e==t){let{node:p,offset:g}=a;if(Mr(p)){if(f=!!(g&&p.nodeValue[g-1]==`
10
+ `),f&&g==p.nodeValue.length)for(let m=p,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(a=c={node:v.parentNode,offset:Gr(v)+1});break}let C=m.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let m=p.childNodes[g-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Fs&&d.focusNode&&d.focusNode!=c.node&&_t(d.focusNode)){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||f&&ls)&&oa(a.node,a.offset,d.anchorNode,d.anchorOffset)&&oa(c.node,c.offset,d.focusNode,d.focusOffset))return;let h=!1;if((u.extend||e==t)&&!(f&&Fs)){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?Ko:_g,e==a&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=hi:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ko:hi}r=o}this.dirty=Ko}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Ko:_g;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ey extends rc{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=_t(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==Zs&&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 wM extends rc{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 ko extends rc{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=fa.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new ko(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&hi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=hi&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Zs){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Zs}}slice(e,t,r){let s=ko.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 _o extends rc{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(!Mr(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=fa.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=sy(d,r,t),u?c=new xM(e,t,r,s,d,f||null,h,u):t.isText?new ed(e,t,r,s,d,h):new _o(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=>_t(s)&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?t.contentElement=r:t.getContent=()=>Se.empty}}return t}matchesNode(e,t,r){return this.dirty==Zs&&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 _M(this,o&&o.node,e),u=this.node.inlineContent,d=u&&this.node.isBlock;MM(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?Rn.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 m;c.findNodeMatch(f,h,p,g)||a&&e.state.selection.from>s&&e.state.selection.to<s+f.nodeSize&&(m=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(f,h,p,m,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==Ko)&&(o&&this.protectLocalComposition(e,o),ny(this.contentDOM,this.children,e),Fa&&TM(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Je)||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=EM(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 wM(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==hi||!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=Zs}updateOuterDeco(e){if(nu(e,this.outerDeco))return;let t=!_t(this.nodeDOM),r=this.dom;this.dom=ry(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(){_t(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){_t(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 Sg(n,e,t,r,s){sy(r,e,n);let i=new _o(void 0,n,e,t,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class ed extends _o{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==hi||this.dirty!=Zs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Zs||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=Zs,!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=hi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ty extends rc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Zs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class xM extends _o{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==hi)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 ny(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=Cg(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(a,r);if(o instanceof ko){let c=r?r.previousSibling:n.lastChild;ny(o.contentDOM,o.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=Cg(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Ml=function(n){n&&(this.nodeName=n)};Ml.prototype=Object.create(null);const Go=[new Ml];function Tf(n,e,t){if(n.length==0)return Go;let r=t?Go[0]:new Ml,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new Ml(o.nodeName));for(let a in o){let c=o[a];c!=null&&(t&&s.length==1&&s.push(r=new Ml(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 ry(n,e,t,r){if(t==Go&&r==Go)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=Go[0]),s=c}kM(s,a||Go[0],o)}return s}function kM(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 sy(n,e,t){return ry(n,n,Go,Tf(e,t,!_t(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 Cg(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class _M{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=SM(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=Zs,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 ko&&d.dirty!=hi&&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=ko.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==hi&&o.dom==o.contentDOM&&(o.dirty=Ko),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 _o){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!=hi&&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=Ko,f.updateChildren(s,o+1),f.dirty=Zs),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=_o.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=_o.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 ey(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 ko;)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))&&((ls||Yr)&&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 ty(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||_t(e)&&e.contains(this.lock.parentNode))}}function SM(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 ko)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 CM(n,e){return n.type.side-e.type.side}function MM(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 v=s[o++];v.widget&&(d?(f||(f=[d])).push(v):d=v)}if(d)if(f){f.sort(CM);for(let v=0;v<f.length;v++)t(f[v],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 v=0;v<a.length;v++)a[v].to<=i&&a.splice(v--,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 v=g;o<s.length&&s[o].from<v&&(v=s[o].from);for(let C=0;C<a.length;C++)a[C].to<v&&(v=a[C].to);v<g&&(c=h.cut(v-i),h=h.cut(0,v-i),g=v,p=-1)}else for(;o<s.length&&s[o].to<g;)o++;let m=h.isInline&&!h.isLeaf?a.filter(v=>!v.inline):a.slice();r(h,m,e.forChild(i,h),p),i=g}}function TM(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 EM(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 Ch(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&&bt.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&tM(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;u=new bt(o==f?a:r.resolve(f))}else if(Fs&&e=="key"&&o>n.state.selection.to&&_t(t.focusNode)&&t.focusOffset==t.focusNode.childNodes.length&&s&&s.posAtStart>n.state.selection.to)for(let f=t.focusNode;;f=f.parentNode){if(getComputedStyle(f).overflow!="visible"){u=Jt.findFrom(r.resolve(s.posAtStart),1);break}if(f==s.dom||f.nextSibling||!f.parentNode||!_t(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=Mh(n,d,a,f)}return u}function iy(n){return n.editable?n.hasFocus():ay(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function ji(n,e=!1){let t=n.state.selection;if(oy(n,t),!iy(n))return;let r=n.input.mouseDown;if(!e&&Yr&&r){let s=n.domSelectionRange(),i=n.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&oa(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)RM(n);else{let{anchor:s,head:i}=t,o,a;Mg&&!(t instanceof Je)&&(t.$from.parent.inlineContent||(o=Tg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Tg(n,t.to))),n.docView.setSelection(s,i,n,e),Mg&&(o&&Eg(o),a&&Eg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&AM(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const Mg=ls||Yr&&Kb<63;function Tg(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(ls&&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",ls&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Eg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function AM(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(()=>{(!iy(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function RM(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Gr(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&As&&xo<=11&&(t.disabled=!0,t.disabled=!1)}function oy(n,e){if(e instanceof bt){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ag(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ag(n)}function Ag(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Mh(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||Je.between(e,t,r)}function Rg(n){return n.editable&&!n.hasFocus()?!1:ay(n)}function ay(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return aa(n.dom,e.anchorNode)&&(n.editable||aa(n.dom,e.focusNode))}catch{return!1}}function PM(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return oa(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&&Jt.findFrom(i,e)}function fo(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Pg(n,e,t){let r=n.state.selection;if(r instanceof Je)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 Je(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Af(n.state,e);return s&&s instanceof bt?fo(n,s):!1}else if(!(Ys&&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?bt.isSelectable(i)?fo(n,new bt(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):fo(n,new Je(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof bt&&r.node.isInline)return fo(n,new Je(e>0?r.$to:r.$from));{let s=Af(n.state,e);return s?fo(n,s):!1}}}function Tl(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):_t(n)&&n.contentEditable=="false"}function ka(n,e){return e<0?IM(n):LM(n)}function IM(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Fs&&_t(t)&&r<as(t)&&Tl(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!_t(t))break;let a=t.childNodes[r-1];if(Tl(a,-1))s=t,i=--r;else if(Mr(a))t=a,r=t.nodeValue.length;else break}else{if(ly(t))break;{let a=t.previousSibling;for(;a&&Tl(a,-1);)s=t.parentNode,i=Gr(a),a=a.previousSibling;if(a)t=a,r=as(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Rf(n,t,r):s&&Rf(n,s,i)}function LM(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=as(t),i,o;for(;;)if(r<s){if(!_t(t))break;let a=t.childNodes[r];if(Tl(a,1))i=t,o=++r;else break}else{if(ly(t))break;{let a=t.nextSibling;for(;a&&Tl(a,1);)i=a.parentNode,o=Gr(a)+1,a=a.nextSibling;if(a)t=a,r=0,s=as(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&Rf(n,i,o)}function ly(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function OM(n,e){for(;n&&e==n.childNodes.length&&!nc(n);)e=Gr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(Mr(t))return t;if(_t(t)&&t.contentEditable=="false")break;n=t,e=0}}function NM(n,e){for(;n&&!e&&!nc(n);)e=Gr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(Mr(t))return t;if(_t(t)&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Rf(n,e,t){if(!Mr(e)){let i,o;(o=OM(e,t))?(e=o,t=0):(i=NM(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&&ji(n)},50)}function Ig(n,e){let t=n.state.doc.resolve(e);if(!(Yr||Gb)&&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 Lg(n,e,t){let r=n.state.selection;if(r instanceof Je&&!r.empty||t.indexOf("s")>-1||Ys&&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 bt)return fo(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof zs?Jt.near(o,e):Jt.findFrom(o,e);return a?fo(n,a):!1}return!1}function Og(n,e){if(!(n.state.selection instanceof Je))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 Ng(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function DM(n){if(!ls||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&_t(e)&&t==0&&e.firstChild&&_t(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ng(n,r,"true"),setTimeout(()=>Ng(n,r,"false"),20)}return!1}function $M(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function BM(n,e){let t=e.keyCode,r=$M(e);if(t==8||Ys&&t==72&&r=="c")return Og(n,-1)||ka(n,-1);if(t==46&&!e.shiftKey||Ys&&t==68&&r=="c")return Og(n,1)||ka(n,1);if(t==13||t==27)return!0;if(t==37||Ys&&t==66&&r=="c"){let s=t==37?Ig(n,n.state.selection.from)=="ltr"?-1:1:-1;return Pg(n,s,r)||ka(n,s)}else if(t==39||Ys&&t==70&&r=="c"){let s=t==39?Ig(n,n.state.selection.from)=="ltr"?1:-1:1;return Pg(n,s,r)||ka(n,s)}else{if(t==38||Ys&&t==80&&r=="c")return Lg(n,-1,r)||ka(n,-1);if(t==40||Ys&&t==78&&r=="c")return DM(n)||Lg(n,1,r)||ka(n,1);if(r==(Ys?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Th(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")||fa.fromSchema(n.state.schema),a=py(),c=a.createElement("div");c.appendChild(o.serializeFragment(r,{document:a}));let u=c.firstChild,d,f=0;for(;u&&_t(u)&&(d=hy[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&&_t(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 cy(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 je(Se.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=fa.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=o.appendChild(document.createElement("p"));m&&v.appendChild(g.serializeNode(p.text(m,h)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=UM(t),Zu&&VM(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&&!_t(h);)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||Sl.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!zM.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=WM(Dg(a,+d[1],+d[2]),d[4]);else if(a=je.maxOpen(FM(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=Dg(a,f,h)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const zM=/^(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 FM(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&&dy(c,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=fy(o[o.length-1],i.length));let d=uy(a,c);o.push(d),s=s.matchType(d.type),i=c}}),o)return Se.from(o)}return n}function uy(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,Se.from(n));return n}function dy(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=dy(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(Se.from(uy(t,n,s+1))))}}function fy(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,fy(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(Se.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(Se.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Dg(n,e,t){return e<n.openStart&&(n=new je(Pf(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new je(Pf(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const hy={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 py(){return document.implementation.createHTMLDocument("title")}let cl=null;function HM(n){let e=window.trustedTypes;if(!e)return n;if(!cl){if(cl=e.defaultPolicy)try{return cl.createHTML(n)}catch{}cl=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return cl.createHTML(n)}function UM(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=py(),r=t.body,s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&hy[s[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=HM(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 VM(n){let e=n.querySelectorAll(Yr?"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 WM(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=Se.from(c.create(r[a+1],s))}catch{break}i++,o++}return new je(s,i,o)}const vs={},bs={},jM={touchstart:!0,touchmove:!0};class KM{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 GM(n){for(let e in vs){let t=vs[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{JM(n,r)&&!Eh(n,r)&&(n.editable||!(r.type in bs))&&t(n,r)},jM[e]?{passive:!0}:void 0)}ls&&n.dom.addEventListener("input",()=>null),If(n)}function Vi(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function qM(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=>Eh(n,r))})}function Eh(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function JM(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 XM(n,e){!Eh(n,e)&&vs[e.type]&&(n.editable||!(e.type in bs))&&vs[e.type](n,e)}bs.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!by(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ui&&Yr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Fa&&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,Uo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||BM(n,t)?t.preventDefault():Vi(n,"key")};bs.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};bs.keypress=(n,e)=>{let t=e;if(by(n)||!t.charCode||t.ctrlKey&&!t.altKey||Ys&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof Je)||!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 sc(n){return{left:n.clientX,top:n.clientY}}function YM(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Ah(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 ic(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 QM(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&bt.isSelectable(r)?(ic(n,new bt(t)),!0):!1}function ZM(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof bt&&(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(bt.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?(ic(n,bt.create(n.state.doc,s)),!0):!1}function e2(n,e,t,r,s){return Ah(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?ZM(n,t):QM(n,t))}function t2(n,e,t,r){return Ah(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function n2(n,e,t,r){return Ah(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||r2(n,t,r)}function r2(n,e,t){if(t.button!=0)return!1;let r=gy(n,e,!0),s=n.state.doc;return r?(ic(n,r),r instanceof Je&&s.eq(n.state.doc)&&(n.input.mouseDown=new i2(n,r)),!0):!1}function gy(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?Je.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 Je.create(r,a+1,a+1+o.content.size);if(t&&bt.isSelectable(o))return bt.create(r,a)}return null}function Rh(n){return ru(n)}const my=Ys?"metaKey":"ctrlKey";vs.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Rh(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&YM(t,n.input.lastClick)&&!t[my]&&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(sc(t));o&&(i=="singleClick"?n.input.mouseDown=new s2(n,o,t,!!r):(i=="doubleClick"?t2:n2)(n,o.pos,o.inside,t)?t.preventDefault():Vi(n,"pointer"))};class vy{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 s2 extends vy{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[my],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&&_t(c.nodeDOM)?c.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof bt&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fs&&!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()),Vi(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||ji(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(sc(e))),this.updateAllowDefault(e),this.allowDefault||!t?Vi(this.view,"pointer"):e2(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ls&&this.mightDrag&&!this.mightDrag.node.isAtom||Yr&&!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)?(ic(this.view,Jt.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Vi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Vi(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 i2 extends vy{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(),Vi(this.view,"pointer");let t=this.view.posAtCoords(sc(e)),r=t&&gy(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];ic(this.view,Je.create(s,o,a))}}vs.touchstart=n=>{n.input.lastTouch=Date.now(),Rh(n),Vi(n,"pointer")};vs.touchmove=n=>{n.input.lastTouch=Date.now(),Vi(n,"pointer")};vs.contextmenu=n=>Rh(n);function by(n,e){return n.composing?!0:ls&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const o2=Ui?5e3:-1;bs.compositionstart=bs.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Je&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Yr&&Gb&&a2(n)))n.markCursor=n.state.storedMarks||t.marks(),ru(n,!0),n.markCursor=null;else if(ru(n,!e.selection.empty),Fs&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&_t(s)&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(Mr(o)){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}yy(n,o2)};function a2(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||!_t(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return _t(r)&&r.contentEditable=="false"}bs.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++,yy(n,20))};function yy(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ru(n),e))}function wy(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function l2(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=ZC(e.focusNode,e.focusOffset),r=eM(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(!(Ui&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),wy(n),e||n.docView&&n.docView.dirty){let t=Ch(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 c2(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 Vl=As&&xo<15||Fa&&sM<604;vs.copy=bs.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Vl?null:t.clipboardData,o=r.content(),{dom:a,text:c}=Th(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",c)):c2(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function u2(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function d2(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?Wl(n,r.value,null,s,e):Wl(n,r.textContent,r.innerHTML,s,e)},50)}function Wl(n,e,t,r,s){let i=cy(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,s,i||je.empty)))return!0;if(!i)return!1;let o=u2(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 xy(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," "):""}bs.paste=(n,e)=>{let t=e;if(n.composing&&!Ui)return;let r=Vl?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Wl(n,xy(r),r.getData("text/html"),s,t)?t.preventDefault():d2(n,t)};class ky{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const f2=Ys?"altKey":"ctrlKey";function _y(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[f2]}vs.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(sc(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof bt?s.to-1:s.to))){if(r&&r.mightDrag)o=bt.create(n.state.doc,r.mightDrag.pos);else if(t.target&&_t(t.target)){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=bt.create(n.state.doc,f.posBefore))}}let a=(o||n.state.selection).content(),{dom:c,text:u,slice:d}=Th(n,a);(!t.dataTransfer.files.length||!Yr||Kb>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Vl?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Vl||t.dataTransfer.setData("text/plain",u),n.dragging=new ky(d,_y(n,t),o)};vs.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};bs.dragover=bs.dragenter=(n,e)=>e.preventDefault();bs.drop=(n,e)=>{try{h2(n,e,n.dragging)}finally{n.dragging=null}};function h2(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(sc(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=cy(n,xy(e.dataTransfer),Vl?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&_y(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||je.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?kb(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&&bt.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new bt(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,v,C)=>p=C),c.setSelection(Mh(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}vs.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())&&ji(n)},20))};vs.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)};vs.beforeinput=(n,e)=>{if(Ui&&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,Uo(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 bs)vs[n]=bs[n];function jl(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||ta,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 Or(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&&jl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class So{constructor(e,t){this.attrs=e,this.spec=t||ta}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 Or(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof So&&jl(this.attrs,e.attrs)&&jl(this.spec,e.spec)}static is(e){return e.type instanceof So}destroy(){}}class Ph{constructor(e,t){this.attrs=e,this.spec=t||ta}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 Or(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 Ph&&jl(this.attrs,e.attrs)&&jl(this.spec,e.spec)}destroy(){}}class Or{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Or(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 Or(e,e,new su(t,r))}static inline(e,t,r,s){return new Or(e,t,new So(r,s))}static node(e,t,r,s){return new Or(e,t,new Ph(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof So}get widget(){return this.type instanceof su}}const Aa=[],ta={};class an{constructor(e,t){this.local=e.length?e:Aa,this.children=t.length?t:Aa}static create(e,t){return t.length?iu(t,e,0,ta):rs}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==rs||e.maps.length==0?this:this.mapInner(e,t,0,0,r||ta)}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?p2(this.children,o||[],e,t,r,s,i):o?new an(o.sort(na),Aa):rs}add(e,t){return t.length?this==rs?an.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=Cy(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,ta)),i+=3}});let o=Sy(i?My(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new an(o.length?this.local.concat(o).sort(na):this.local,s||this.children)}remove(e){return e.length==0||this==rs?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!=rs?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 an(s,r):rs}forChild(e,t){if(this==rs)return this;if(t.isLeaf)return an.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 So){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 an(s.sort(na),Aa);return r?new go([a,r]):a}return r||rs}eq(e){if(this==e)return!0;if(!(e instanceof an)||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 Ih(this.localsInner(e))}localsInner(e){if(this==rs)return Aa;if(e.inlineContent||!this.local.some(So.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof So||t.push(this.local[r]);return t}forEachSet(e){e(this)}}an.empty=new an([],[]);an.removeOverlap=Ih;const rs=an.empty;class go{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,ta));return go.from(r)}forChild(e,t){if(t.isLeaf)return an.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=rs&&(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?Ih(r?t:t.sort(na)):Aa}static from(e){switch(e.length){case 0:return rs;case 1:return e[0];default:return new go(e.every(t=>t instanceof an)?e:e.reduce((t,r)=>t.concat(r instanceof an?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function p2(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,m)=>{let v=m-g-(p-h);for(let C=0;C<a.length;C+=3){let z=a[C+1];if(z<0||h>z+d-f)continue;let M=a[C]+d-f;p>=M?a[C+1]=h<=M?-2:-1:h>=d&&v&&(a[C]+=v,a[C+1]+=v)}f+=v}),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:m}=r.content.findIndex(f),v=r.maybeChild(g);if(v&&m==f&&m+v.nodeSize==p){let C=a[u+2].mapInner(t,v,d+1,n[u]+i+1,o);C!=rs?(a[u]=f,a[u+1]=p,a[u+2]=C):(a[u+1]=-2,c=!0)}else c=!0}if(c){let u=g2(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 an(e.sort(na),a)}function Sy(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 Or(s.from+e,s.to+e,s.type))}return t}function g2(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 Cy(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 My(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=Cy(n,a,c+t);if(u){i=!0;let d=iu(u,a,t+c+1,r);d!=rs&&s.push(c,c+a.nodeSize,d)}});let o=Sy(i?My(n):n,-t).sort(na);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 an(o,s):rs}function na(n,e){return n.from-e.from||n.to-e.to}function Ih(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),$g(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),$g(e,s,r.copy(i.from,r.to)));break}}}return e}function $g(n,e,t){for(;e<n.length&&na(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!=rs&&e.push(r)}),n.cursorWrapper&&e.push(an.create(n.state.doc,[n.cursorWrapper.deco])),go.from(e)}const m2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},v2=As&&xo<=11;class b2{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 y2{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new b2,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]);As&&xo<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():ls&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),v2&&(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,m2)),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(Rg(this.view)){if(this.suppressingSelectionUpdates)return ji(this.view);if(As&&xo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&oa(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=za(i))t.add(i);for(let i=e.anchorNode;i;i=za(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:Mr(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)&&Rg(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||Yr&&(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&&_t(f);){if(f.contentEditable=="false"){d.parentNode.removeChild(d);break}f=f.firstChild}}}else if(Fs&&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||k2(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=Ch(e))&&u.eq(Jt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ji(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),w2(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,_2(e,c)),this.handleDOMChange(i,o,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ji(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),Mr(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(As&&xo<=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?Gr(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),c=i&&i.parentNode==e.target?Gr(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 Bg=new WeakMap,zg=!1;function w2(n){if(!Bg.has(n)&&(Bg.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Fs,zg)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."),zg=!0}}function Fg(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return oa(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function x2(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Fg(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?Fg(n,t):null}function k2(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 _2(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||!_t(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 S2(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&&aa(n.dom,f)&&(d=[{node:f,offset:u.anchorOffset}],Qu(u)||d.push({node:u.focusNode,offset:u.focusOffset})),Yr&&n.input.lastKeyCode===8)for(let C=o;C>i;C--){let z=s.childNodes[C-1],M=z.pmViewDesc;if(z.nodeName=="BR"&&!M){o=C;break}if(!M||M.size)break}let h=n.state.doc,p=n.someProp("domParser")||Sl.fromSchema(n.state.schema),g=h.resolve(a),m=null,v=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:C2(r),context:g});if(d&&d[0].pos!=null){let C=d[0].pos,z=d[1]&&d[1].pos;z==null&&(z=C),m={anchor:C+a,head:z+a}}return{doc:v,sel:m,from:a,to:c}}const C2=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(ls&&/^(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||ls&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},M2=/^(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 T2(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,D=Ch(n,E);if(D&&!n.state.selection.eq(D)){if(Yr&&Ui&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",U=>U(n,Uo(13,"Enter"))))return;let ee=n.state.tr.setSelection(D);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=S2(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=P2(f.content,u.doc.content,u.from,h,p);if(g&&n.input.domChangeCount++,(Fa&&n.input.lastIOSEnter>Date.now()-225||Ui)&&s.some(E=>_t(E)&&!M2.test(E.nodeName))&&(!g||g.endA>=g.endB)&&n.someProp("handleKeyDown",E=>E(n,Uo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!g)if(r&&c instanceof Je&&!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=Hg(n,n.state.doc,u.sel);if(E&&!E.eq(n.state.selection)){let D=n.state.tr.setSelection(E);i&&D.setMeta("composition",i),n.dispatch(D)}}return}n.state.selection.from<n.state.selection.to&&g.start==g.endB&&n.state.selection instanceof Je&&(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)),As&&xo<=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 m=u.doc.resolveNoCache(g.start-u.from),v=u.doc.resolveNoCache(g.endB-u.from),C=d.resolve(g.start),z=m.sameParent(v)&&m.parent.inlineContent&&C.end()>=g.endA;if((Fa&&n.input.lastIOSEnter>Date.now()-225&&(!z||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!z&&R2(u.doc,m.pos,v.pos))&&n.someProp("handleKeyDown",E=>E(n,Uo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>g.start&&A2(d,g.start,g.endA,m,v)&&n.someProp("handleKeyDown",E=>E(n,Uo(8,"Backspace")))){Ui&&Yr&&n.domObserver.suppressSelectionUpdates();return}Yr&&g.endB==g.start&&(n.input.lastChromeDelete=Date.now()),Ui&&!z&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,v=u.doc.resolveNoCache(g.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,Uo(13,"Enter"))})},20));let M=g.start,S=g.endA,O=E=>{let D=E||n.state.tr.replace(M,S,u.doc.slice(g.start-u.from,g.endB-u.from));if(u.sel){let ee=Hg(n,D.doc,u.sel);ee&&!(Yr&&n.composing&&ee.empty&&(g.start!=g.endB||n.input.lastChromeDelete<Date.now()-100)&&(ee.head==M||ee.head==D.mapping.map(S)-1)||As&&ee.empty&&ee.head==M)&&D.setSelection(ee)}return i&&D.setMeta("composition",i),D.scrollIntoView()},N;if(z)if(m.pos==v.pos){As&&xo<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>ji(n),20));let E=O(n.state.tr.delete(M,S)),D=d.resolve(g.start).marksAcross(d.resolve(g.endA));D&&E.ensureMarks(D),n.dispatch(E)}else if(g.endA==g.endB&&(N=E2(m.parent.content.cut(m.parentOffset,v.parentOffset),C.parent.content.cut(C.parentOffset,g.endA-C.start())))){let E=O(n.state.tr);N.type=="add"?E.addMark(M,S,N.mark):E.removeMark(M,S,N.mark),n.dispatch(E)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,v.parentOffset),D=()=>O(n.state.tr.insertText(E,M,S));n.someProp("handleTextInput",ee=>ee(n,M,S,E,D))||n.dispatch(D())}else n.dispatch(O());else n.dispatch(O())}function Hg(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Mh(n,e.resolve(t.anchor),e.resolve(t.head))}function E2(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(Se.from(u).eq(n))return{mark:a,type:o}}function A2(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 R2(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 P2(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 Ty{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 KM,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Kg),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=Wg(this),Vg(this),this.nodeViews=jg(this),this.docView=Sg(this.state.doc,Ug(this),$d(this),this.dom,this),this.domObserver=new y2(this,(r,s,i,o)=>T2(this,r,s,i,o)),this.domObserver.start(),GM(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(Kg),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&&(wy(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=jg(this);L2(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&If(this),this.editable=Wg(this),Vg(this);let c=$d(this),u=Ug(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&&aM(this);if(o){this.domObserver.stop();let p=f&&(As||Yr)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&I2(s.selection,e.selection);if(f){let m=Yr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=l2(this)),(i||!this.docView.update(e.doc,u,c,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Sg(e.doc,u,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let g=this.input.mouseDown;p||!(g&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&PM(this)&&g.delaySelUpdate())?ji(this,p):(oy(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&&lM(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!aa(this.dom,e))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof bt){let t=this.docView.domAfterPos(this.state.selection.from);_t(t)&&yg(this,t.getBoundingClientRect(),e)}else yg(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 ky(e.slice,e.move,s<0?void 0:bt.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(As){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&&cM(this.dom),ji(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 pM(this,e)}coordsAtPos(e,t=1){return Qb(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 yM(this,t||this.state,e)}pasteHTML(e,t){return Wl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Wl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Th(this,e)}destroy(){this.docView&&(qM(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,YC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return XM(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?ls&&this.root.nodeType===11&&nM(this.dom.ownerDocument)==this.dom&&x2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Ty.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Ug(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"),[Or.node(0,n.state.doc.content.size,e)]}function Vg(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:Or.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Wg(n){return!n.someProp("editable",e=>e(n.state)===!1)}function I2(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 jg(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 L2(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 Kg(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 To={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:'"'},O2=typeof navigator<"u"&&/Mac/.test(navigator.platform),N2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qr=0;qr<10;qr++)To[48+qr]=To[96+qr]=String(qr);for(var qr=1;qr<=24;qr++)To[qr+111]="F"+qr;for(var qr=65;qr<=90;qr++)To[qr]=String.fromCharCode(qr+32),ou[qr]=String.fromCharCode(qr);for(var zd in To)ou.hasOwnProperty(zd)||(ou[zd]=To[zd]);function D2(n){var e=O2&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||N2&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ou:To)[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 $2=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),B2=typeof navigator<"u"&&/Win/.test(navigator.platform);function z2(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))$2?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 F2(n){let e=Object.create(null);for(let t in n)e[z2(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 H2(n){return new Tn({props:{handleKeyDown:Ey(n)}})}function Ey(n){let e=F2(n);return function(t,r){let s=D2(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)&&!(B2&&r.ctrlKey&&r.altKey)&&(i=To[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,Dr=function(){};Dr.prototype.append=function(e){return e.length?(e=Dr.from(e),!this.length&&e||e.length<au&&this.leafAppend(e)||this.length<au&&e.leafPrepend(this)||this.appendInner(e)):this};Dr.prototype.prepend=function(e){return e.length?Dr.from(e).append(this):this};Dr.prototype.appendInner=function(e){return new U2(this,e)};Dr.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Dr.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Dr.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Dr.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)};Dr.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};Dr.from=function(e){return e instanceof Dr?e:e&&e.length?new Ay(e):Dr.empty};var Ay=(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})(Dr);Dr.empty=new Ay([]);var U2=(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})(Dr);const V2=500;class ui{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 wi(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 wi(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 ui(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 wi(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>j2&&(a=W2(a,u),o-=u),new ui(a.append(i),o)}remapping(e,t){let r=new Hl;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 ui(this.items.append(e.map(t=>new wi(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 m=e.steps[p].invert(e.docs[p]),v=h.selection&&h.selection.map(i.slice(c+1,p));v&&a++,r.push(new wi(g,m,v))}else r.push(new wi(g))},s);let u=[];for(let h=t;h<o;h++)u.push(new wi(i.maps[h]));let d=this.items.slice(0,s).append(u).append(r),f=new ui(d,a);return f.emptyItemCount()>V2&&(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 wi(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 ui(Dr.from(s.reverse()),i)}}ui.empty=new ui(Dr.empty,0);function W2(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class wi{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 wi(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 j2=20;function K2(n,e,t,r){let s=t.getMeta(Co),i;if(s)return s.historyState;t.getMeta(Ry)&&(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(Co))return o.getMeta(Co).redo?new ho(n.done.addTransform(t,void 0,r,Hc(e)),n.undone,Gg(t.mapping.maps),n.prevTime,n.prevComposition):new ho(n.done,n.undone.addTransform(t,void 0,r,Hc(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||!G2(t,n.prevRanges)),u=o?Hd(n.prevRanges,t.mapping):Gg(t.mapping.maps);return new ho(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Hc(e)),ui.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 G2(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 Gg(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 q2(n,e,t){let r=Hc(e),s=Co.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(Co,{redo:t,historyState:c})}let Ud=!1,qg=null;function Hc(n){let e=n.plugins;if(qg!=e){Ud=!1,qg=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ud=!0;break}}return Ud}function J2(n){return n.setMeta(Ry,!0)}const Co=new Vn("history"),Ry=new Vn("closeHistory");function X2(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Tn({key:Co,state:{init(){return new ho(ui.empty,ui.empty,null,0,-1)},apply(e,t,r){return K2(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Iy:r=="historyRedo"?Ly:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function Py(n,e){return(t,r)=>{let s=Co.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=q2(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Iy=Py(!1,!0),Ly=Py(!0,!0);function Y2(n){return n.getMeta(Co)!=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 Oa=class Oy{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,(...m)=>{const v=this.buildProps(u,t),C=p(...m)(v);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=Oy.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 Q2=()=>({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),Z2=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),eT=()=>({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 m=p,v=n.mapping.slice(p);const C=g.map(a),z=g.map(c);if(h.nodesBetween(C,z,(M,S)=>{if(M.type.isText)return;n.mapping.maps.length!==m&&(m=n.mapping.maps.length,v=n.mapping.slice(p));const O=n.doc.resolve(v.map(S)),N=n.doc.resolve(v.map(S+M.nodeSize)),E=O.blockRange(N);if(!E)return;const D=Ga(E);if(M.type.isTextblock){const{defaultType:ee}=O.parent.contentMatchAt(O.index()),U=n.doc.nodeAt(E.start);ee&&U&&!U.hasMarkup(ee)&&ee.validContent(U.content)&&n.setNodeMarkup(E.start,ee)}(D||D===0)&&n.lift(E,D)}),n.doc.eq(h))break}}),!0},tT=n=>e=>n(e),nT=()=>({state:n,dispatch:e})=>Hb(n,e),rT=(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 Je(r.doc.resolve(Math.max(o-1,0)))),!0},sT=()=>({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 Tr(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 iT=n=>({tr:e,state:t,dispatch:r})=>{const s=Tr(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},oT=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},aT=n=>n.content?/^text(\*|\+)/.test(n.content):!1,Jg=(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 aT(r)?t==="left"?n.start()-1:n.end()+1:n.pos},lT=(n,e,t)=>({from:Jg(n,t,"left"),to:Jg(e,t,"right")}),cT=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,s=n.selection instanceof Je?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}=lT(c,u,n.schema);t.deleteRange(d,f)}),t.selection.empty||t.setSelection(Je.near(t.doc.resolve(t.selection.from))),s&&t.ensureMarks(s),t.scrollIntoView(),e(t)}return!0},uT=()=>({commands:n})=>n.keyboardShortcut("Enter"),dT=()=>({state:n,dispatch:e})=>DC(n,e);function Lh(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]:Lh(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function Ny(n,e,t={}){return n.find(r=>r.type===e&&lu(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Xg(n,e,t={}){return!!Ny(n,e,t)}function Oh(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(!Ny([...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&&Xg([...n.parent.child(s-1).marks],e,t);)s-=1,i-=n.parent.child(s).nodeSize;for(;o<n.parent.childCount&&Xg([...n.parent.child(o).marks],e,t);)a+=n.parent.child(o).nodeSize,o+=1;return{from:i,to:a}}function Qi(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 fT=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=Qi(n,r.schema),{doc:o,selection:a}=t,{$from:c,from:u,to:d}=a;if(s){const f=Oh(c,i,e);if(f&&f.from<=u&&f.to>=d){const h=Je.create(o,f.from,f.to);t.setSelection(h)}}return!0},hT=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 Dy(n){return n instanceof Je}function qo(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=Jt.atStart(n),r=Jt.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?Je.create(n,qo(0,s,i),qo(n.content.size,s,i)):Je.create(n,qo(e,s,i),qo(e,s,i))}function Of(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Kl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function pT(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const gT=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Kl()||Of())&&r.dom.focus(),pT()&&!Kl()&&!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&&!Dy(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},mT=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),vT=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),$y=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&&$y(r)}return n};function bc(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 $y(t)}function By(n){return typeof n?.nodesBetween=="function"}function Ha(n,e,t){if(By(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 Se.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),Ha("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const c=new Bc({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?Sl.fromSchema(c).parseSlice(bc(n),t.parseOptions):Sl.fromSchema(c).parse(bc(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Sl.fromSchema(e);return t.slice?i.parseSlice(bc(n),t.parseOptions).content:i.parse(bc(n),t.parseOptions)}return Ha("",e,t)}function zy(n){return!("type"in n)}function Fy(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof nr||s instanceof Nr))return;const i=n.mapping.maps[r];let o=0;i.forEach((a,c,u,d)=>{o===0&&(o=d)}),n.setSelection(Jt.near(n.doc.resolve(o),t))}const bT=(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=v=>{i.emit("contentError",{editor:i,error:v,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{Ha(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(v){c(v)}try{var o;a=Ha(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(v){return c(v),!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=zy(a)?a.content:[a];if(g.forEach(v=>{v.check(),h=h?v.isText&&v.marks.length===0:!1,p=p?v.isBlock:!1}),d===f&&p){const{parent:v}=r.doc.resolve(d);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(d-=1,f+=1)}let m;if(h)Array.isArray(e)?m=e.map(v=>v.text||"").join(""):By(e)?m=g.map(v=>{var C;return(C=v.text)!==null&&C!==void 0?C:""}).join(""):typeof e=="object"&&e&&e.text?m=e.text:m=e,r.insertText(m,d,f);else{m=Se.from(g);const v=r.doc.resolve(d),C=v.node(),z=v.parentOffset===0,M=C.isText||C.isTextblock,S=C.content.size>0;z&&M&&S&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,f,g)}t.updateSelection&&Fy(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0};function Hy(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 yT=(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=Hy(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=Ha(o,r.schema);h=u.createAndFill(f,p)}else h=u.createAndFill(f);return h?(t&&(e.insert(c.pos,h),a&&Fy(e,e.steps.length-1,-1)),!0):!1},wT=()=>({state:n,dispatch:e})=>LC(n,e),xT=()=>({state:n,dispatch:e})=>OC(n,e),kT=()=>({state:n,dispatch:e})=>Ib(n,e),_T=()=>({state:n,dispatch:e})=>Bb(n,e),Uy=(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},ST=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ju(n.doc,n.selection.$from.pos,-1);return r==null||!Uy(n.doc,r)?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},CT=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ju(n.doc,n.selection.$from.pos,1);return r==null||!Uy(n.doc,r)?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},MT=()=>({state:n,dispatch:e})=>Lb(n,e),TT=()=>({state:n,dispatch:e})=>Ob(n,e);function Vy(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ET(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))Kl()||Vy()?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 AT=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=ET(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 qi(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?Tr(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 RT=(n,e={})=>({state:t,dispatch:r})=>qi(t,Tr(n,t.schema),e)?NC(t,r):!1,PT=()=>({state:n,dispatch:e})=>Ub(n,e),IT=n=>({state:e,dispatch:t})=>{const r=Tr(n,e.schema);return GC(r)(e,t)},LT=()=>({state:n,dispatch:e})=>Fb(n,e);function nd(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Yg(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 OT=(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=Tr(n,r.schema)),a==="mark"&&(o=Qi(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,Yg(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(Yg(h.attrs,e))))})})}),c},NT=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),DT=()=>({tr:n,dispatch:e})=>{if(e){const t=new zs(n.doc);n.setSelection(t)}return!0},$T=()=>({state:n,dispatch:e})=>Db(n,e),BT=()=>({state:n,dispatch:e})=>zb(n,e),zT=()=>({state:n,dispatch:e})=>zC(n,e),FT=()=>({state:n,dispatch:e})=>UC(n,e),HT=()=>({state:n,dispatch:e})=>HC(n,e);function cu(n,e,t={},r={}){return Ha(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const UT=(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=zy(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 Wy(n,e){const t=Qi(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 jy(n,e){const t=new Tb(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function lB(n,e){const t=[];return n.descendants((r,s)=>{e(r)&&t.push({node:r,pos:s})}),t}function VT(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function WT(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=>WT(e.$from,n)}function dt(n,e,t){return n.config[e]===void 0&&n.parent?dt(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?dt(n.parent,e,t):null}):n.config[e]}function Nh(n){return n.map(e=>{const t=dt(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Nh(t())]:e}).flat(10)}function Dh(n,e){const t=fa.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Ky(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 jT={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"},KT={inclusive:"boolean",excludes:"string",group:"string",spanning:"boolean",code:"boolean"};function GT(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 Qg(n,e,t,r){return{...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="attrs"&&!Object.hasOwn(r,s))),...GT(t,r,n),attrs:t.attrs}}function Zg(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 qT(n,e){Zg(n.nodes,e.nodes,"node"),Zg(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,Qg(s,n.nodes[s],i,jT))}),e.spec.marks.forEach((s,i)=>{r=r.update(s,Qg(s,n.marks[s],i,KT))}),{topNode:e.topNodeType.name,nodes:t,marks:r}}function Gy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Ua(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function $h(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ua(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=dt(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,m])=>{e.push({type:p,name:g,attribute:{...i,...m}})})})})}),s.forEach(u=>{const d=dt(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 vn(n,e=void 0,...t){return Nf(n)?e?n.bind(e)(...t):n(...t):n}function JT(n={}){return Object.keys(n).length===0&&n.constructor===Object}function XT(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 em(n){const e=[],t=XT(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 bn(...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([...em(r[s]),...em(i)]);r[s]=Array.from(o.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[s]=i}),r},{})}function la(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)=>bn(t,r),{})}function YT(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function tm(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):YT(t.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function nm(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&JT(t)?!1:t!=null))}function rm(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 sm(n,e,t=$h(n)){var r;const{nodeExtensions:s,markExtensions:i}=Ua(n);return{topNode:(r=s.find(o=>dt(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=nm({...n.reduce((p,g)=>{const m=dt(g,"extendNodeSchema",c);return{...p,...m?m(o):{}}},{}),content:vn(dt(o,"content",c)),marks:vn(dt(o,"marks",c)),group:vn(dt(o,"group",c)),inline:vn(dt(o,"inline",c)),atom:vn(dt(o,"atom",c)),selectable:vn(dt(o,"selectable",c)),draggable:vn(dt(o,"draggable",c)),code:vn(dt(o,"code",c)),whitespace:vn(dt(o,"whitespace",c)),linebreakReplacement:vn(dt(o,"linebreakReplacement",c)),defining:vn(dt(o,"defining",c)),isolating:vn(dt(o,"isolating",c)),attrs:Object.fromEntries(a.map(rm))}),d=vn(dt(o,"parseHTML",c));d&&(u.parseDOM=d.map(p=>tm(p,a)));const f=dt(o,"renderHTML",c);f&&(u.toDOM=p=>f({node:p,HTMLAttributes:la(p,a)}));const h=dt(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=nm({...n.reduce((h,p)=>{const g=dt(p,"extendMarkSchema",c);return{...h,...g?g(o):{}}},{}),inclusive:vn(dt(o,"inclusive",c)),excludes:vn(dt(o,"excludes",c)),group:vn(dt(o,"group",c)),spanning:vn(dt(o,"spanning",c)),code:vn(dt(o,"code",c)),attrs:Object.fromEntries(a.map(rm))}),d=vn(dt(o,"parseHTML",c));d&&(u.parseDOM=d.map(h=>tm(h,a)));const f=dt(o,"renderHTML",c);return f&&(u.toDOM=h=>f({mark:h,HTMLAttributes:la(h,a)})),[o.name,u]}))}}function QT(n,e,t){if(t===void 0)return new Bc(sm(n,e));const r=Gy(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 Bc(t),i=sm(n,e,Ky($h(n),s));return new Bc(qT(i,s))}function El(n){return n.sort((t,r)=>{const s=dt(t,"priority")||100,i=dt(r,"priority")||100;return s>i?-1:s<i?1:0})}function qy(n){const e=El(Nh(n)),t=Gy(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 Bh(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 ZT(n,e){return Bh(n,{from:0,to:n.content.size},e)}function zh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function eE(n,e){const t=Tr(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 Jy(n,e){const t=nd(typeof e=="string"?e:e.name,n.schema);return t==="node"?eE(n,e):t==="mark"?Wy(n,e):{}}function tE(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 nE(n){const e=tE(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}})})}),nE(r)}function id(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=Oh(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 rE=(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]},sE=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 _a(n,e){return e.nodes[n]||e.marks[n]||null}function Uc(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 iE=(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?Qi(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,m)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const v=Math.max(h,m),C=Math.min(p,m+g.nodeSize),z=C-v;o+=z,a.push(...g.marks.map(M=>({mark:M,from:v,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 oE(n,e,t={}){if(!e)return qi(n,null,t)||Df(n,null,t);const r=nd(e,n.schema);return r==="node"?qi(n,e,t):r==="mark"?Df(n,e,t):!1}const aE=(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)},lE=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function im(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function ul(n,e){const{nodeExtensions:t}=Ua(e),r=t.find(i=>i.name===n);if(!r)return!1;const s=vn(dt(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function oc(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&&(oc(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function Xy(n){return n instanceof bt}function cE(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 uE(n){if(n===null||typeof n!="object")return!1;const e=n;if(!cE(e))return!1;const t=e.toJSON();return!(t===null||typeof t!="object"||t.stepType!=="replace")}var Yy=class Qy{constructor(e){this.position=e}static fromJSON(e){return new Qy(e.position)}toJSON(){return{position:this.position}}};function dE(n,e){const t=e.mapping.mapResult(n.position);return{position:new Yy(t.pos),mapResult:t}}function fE(n){return new Yy(n)}function hE(n,e,t){const{selection:r}=e;let s=null;if(Dy(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(m=>m.type.excludes(t));u=p&&g}return!u}),u})}const pE=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:a}=i,c=Qi(n,r.schema);if(s)if(o){const u=Wy(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),m=Math.min(p+h.nodeSize,f);h.marks.find(v=>v.type===c)?h.marks.forEach(v=>{c===v.type&&t.addMark(g,m,c.create({...v.attrs,...e}))}):t.addMark(g,m,c.create(e))})});return hE(r,t,c)},gE=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),mE=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=Tr(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})=>mg(i,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>mg(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},vE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=qo(n,0,r.content.size),i=bt.create(r,s);e.setSelection(i)}return!0},bE=(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},yE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=Je.atStart(r).from,a=Je.atEnd(r).to,c=qo(s,o,a),u=qo(i,o,a),d=Je.create(r,c,u);e.setSelection(d)}return!0},wE=n=>({state:e,dispatch:t})=>{const r=Tr(n,e.schema);return XC(r)(e,t)};function om(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 xE=({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=Uc(u,a.node().type.name,a.node().attrs);if(i instanceof bt&&i.node.isBlock)return!a.parentOffset||!Wi(o,a.pos)?!1:(r&&(n&&om(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:Hy(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0;const g=i instanceof Je&&!i.empty?Hi.create({doc:e.doc,selection:i}).tr.deleteSelection():null,m=g?g.doc:e.doc,v=g?g.mapping.map(a.pos):a.pos;let C=Wi(m,v,1,p);if(!p&&!C&&Wi(m,v,1,h?[{type:h}]:void 0)&&(C=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(C){const z=e.steps.length;if(i instanceof Je&&e.deleteSelection(),e.split(e.mapping.slice(z).map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h){const M=e.mapping.slice(z).map(a.before()),S=e.doc.resolve(M);a.node(-1).canReplaceWith(S.index(),S.index()+1,h)&&e.setNodeMarkup(e.mapping.slice(z).map(a.before()),h)}}n&&om(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return C},kE=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{const o=Tr(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=Se.empty;const O=a.index(-1)?1:a.index(-2)?2:3;for(let oe=a.depth-O;oe>=a.depth-3;oe-=1)S=Se.from(a.node(oe).copy(S));const N=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...Uc(f,a.node().type.name,a.node().attrs),...e},D=((h=o.contentMatch.defaultType)===null||h===void 0?void 0:h.createAndFill(E))||void 0;S=S.append(Se.from(o.createAndFill(null,D)||void 0));const ee=a.before(a.depth-(O-1));t.replace(ee,a.after(-N),new je(S,4-O,0));let U=-1;t.doc.nodesBetween(ee,t.doc.content.size,(oe,F)=>{if(U>-1)return!1;oe.isTextblock&&oe.content.size===0&&(U=F+1)}),U>-1&&t.setSelection(Je.near(t.doc.resolve(U))),t.scrollIntoView()}return!0}const p=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,g={...Uc(f,d.type.name,d.attrs),...e},m={...Uc(f,a.node().type.name,a.node().attrs),...e},v=a.parentOffset===0&&a.index(-1)===0,C=a.before(-1);t.delete(a.pos,c.pos);const z=v?d.attrs:g,M=p?[{type:o,attrs:z},{type:p,attrs:m}]:[{type:o,attrs:z}];if(!Wi(t.doc,a.pos,2))return!1;if(s){const{selection:S,storedMarks:O}=r,{splittableMarks:N}=i.extensionManager,E=O||S.$to.parentOffset&&S.$from.marks();if(t.split(a.pos,2,M).scrollIntoView(),v&&t.setNodeMarkup(C,void 0,g),!E||!s)return!0;const D=E.filter(ee=>N.includes(ee.type.name));t.ensureMarks(D)}return!0};function Zy(n,e,t){if(!n.validContent(e))return null;try{return n.create(t,e)}catch{return null}}function Fh(n,e){if(n.pendingContent.length===0)return!0;const t=Zy(e,Se.from(n.pendingContent));return t?(n.items.push(t),n.pendingContent=[],!0):!1}function _E(n,e,t){return t.validContent(Se.from([...e.pendingContent,n]))?(e.pendingContent.push(n),!0):!Fh(e,t)||!t.validContent(Se.from(n))?!1:(e.pendingContent.push(n),!0)}function SE(n,e,t,r){const s=r(n,t);if(!s)return!1;const i=Zy(t.listType,Se.from(s),n.attrs);return i?t.itemType.validContent(Se.from([...e.pendingContent,i]))?(e.pendingContent.push(i),!0):Fh(e,t.itemType)?(e.items.push(...s),!0):!1:!1}function CE(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)?SE(i,r,e,t):_E(i,r,e.itemType)))return null}return Fh(r,e.itemType)?r.items:null}function e0(n,e){const t=[];for(let r=0;r<n.childCount;r+=1){const s=CE(n.child(r),e,e0);if(!s)return null;t.push(...s)}return t}function am(n,e){let t=null;return n.descendants((r,s)=>r!==e?!0:(t=s,!1)),t}function lm(n){return!n||n==="1"?null:n}function t0(n,e){return lm(n)===lm(e)}const yc=(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&&Ro(n.doc,t.pos))||!t0(t.node.attrs.type,s?.attrs.type)||n.join(t.pos),!0},wc=(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&&Ro(n.doc,r))||!t0(t.node.attrs.type,s?.attrs.type)||n.join(r),!0};function ME(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return Je.between(r,s)}const TE=(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=Tr(n,o.schema),g=Tr(e,o.schema),{selection:m,storedMarks:v}=o,{$from:C,$to:z}=m,M=C.blockRange(z),S=v||m.$to.parentOffset&&m.$from.marks();if(!M)return!1;const O=rd(X=>ul(X.type.name,f))(m),N=m.from===0&&m.to===o.doc.content.size,E=o.doc.content.content,D=E.length===1?E[0]:null,ee=N&&D&&ul(D.type.name,f)?{node:D,pos:0}:null,U=O??ee,oe=!!O&&M.depth>=1&&M.depth-O.depth<=1,F=!!ee;if((oe||F)&&U){if(U.node.type===p)return N&&F?c().command(({tr:X,dispatch:le})=>{const re=ME(X);return re?(X.setSelection(re),le&&le(X),!0):!1}).liftListItem(g).run():u.liftListItem(g);if(ul(U.node.type.name,f)&&p.validContent(U.node.content))return c().command(()=>(i.setNodeMarkup(U.pos,p),!0)).command(()=>yc(i,p)).command(()=>wc(i,p)).run();if(ul(U.node.type.name,f)){var W;const X=(W=U.node.firstChild)===null||W===void 0?void 0:W.type;if(X&&X!==g){const le=e0(U.node,{listType:p,itemType:g,isListNode:Q=>ul(Q.type.name,f)}),re=le?Se.from(le):null;return!re||!p.validContent(re)?!1:c().command(()=>{const{$anchor:Q,$head:me}=i.selection,P=Q.parent,$=me.parent,ce=Q.parentOffset,pe=me.parentOffset;let ye;try{ye=p.create(r,re)}catch{return!1}if(i.replaceWith(U.pos,U.pos+U.node.nodeSize,ye),P.inlineContent&&$.inlineContent){const Z=am(ye,P),ae=am(ye,$);if(Z!==null&&ae!==null){const V=U.pos+Z+2+ce,K=U.pos+ae+2+pe;i.setSelection(Je.create(i.doc,V,K))}}return!0}).command(()=>yc(i,p)).command(()=>wc(i,p)).run()}}}return!t||!S||!a?c().command(()=>d().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>yc(i,p)).command(()=>wc(i,p)).run():c().command(()=>{const X=d().wrapInList(p,r),le=S.filter(re=>h.includes(re.type.name));return i.ensureMarks(le),X?!0:u.clearNodes()}).wrapInList(p,r).command(()=>yc(i,p)).command(()=>wc(i,p)).run()},EE=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=Qi(n,r.schema);return Df(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},AE=(n,e,t={})=>({state:r,commands:s})=>{const i=Tr(n,r.schema),o=Tr(e,r.schema),a=qi(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})},RE=(n,e={})=>({state:t,commands:r})=>{const s=Tr(n,t.schema);return qi(t,s,e)?r.lift(s):r.wrapIn(s,e)},PE=()=>({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},IE=(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},LE=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=t,a=Qi(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=Oh(c,a,(f=c.marks().find(m=>m.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},OE=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},NE=(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=Tr(n,r.schema)),a==="mark"&&(o=Qi(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,m;t.selection.empty?r.doc.nodesBetween(d,f,(v,C)=>{i&&i===v.type&&(c=!0,g=Math.max(C,d),m=Math.min(C+v.nodeSize,f),h=C,p=v)}):r.doc.nodesBetween(d,f,(v,C)=>{C<d&&i&&i===v.type&&(c=!0,g=Math.max(C,d),m=Math.min(C+v.nodeSize,f),h=C,p=v),C>=d&&C<=f&&(i&&i===v.type&&(c=!0,s&&t.setNodeMarkup(C,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(z=>{if(o===z.type&&(c=!0,s)){const M=Math.max(C,d),S=Math.min(C+v.nodeSize,f);t.addMark(M,S,o.create({...z.attrs,...e}))}}))}),p&&(h!==void 0&&s&&t.setNodeMarkup(h,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(v=>{o===v.type&&s&&t.addMark(g,m,o.create({...v.attrs,...e}))}))}),c},Ra=new Vn("__tiptap_decorations__"),DE=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(Ra,{type:"force",name:n}),!0),$E=(n,e={})=>({state:t,dispatch:r})=>{const s=Tr(n,t.schema);return VC(s,e)(t,r)},BE=(n,e={})=>({state:t,dispatch:r})=>{const s=Tr(n,t.schema);return WC(s,e)(t,r)};var zE=$S({blur:()=>Q2,clearContent:()=>Z2,clearNodes:()=>eT,command:()=>tT,createParagraphNear:()=>nT,cut:()=>rT,deleteCurrentNode:()=>sT,deleteNode:()=>iT,deleteRange:()=>oT,deleteSelection:()=>cT,enter:()=>uT,exitCode:()=>dT,extendMarkRange:()=>fT,first:()=>hT,focus:()=>gT,forEach:()=>mT,insertContent:()=>vT,insertContentAt:()=>bT,insertDefaultBlock:()=>yT,joinBackward:()=>kT,joinDown:()=>xT,joinForward:()=>_T,joinItemBackward:()=>ST,joinItemForward:()=>CT,joinTextblockBackward:()=>MT,joinTextblockForward:()=>TT,joinUp:()=>wT,keyboardShortcut:()=>AT,lift:()=>RT,liftEmptyBlock:()=>PT,liftListItem:()=>IT,newlineInCode:()=>LT,resetAttributes:()=>OT,scrollIntoView:()=>NT,selectAll:()=>DT,selectNodeBackward:()=>$T,selectNodeForward:()=>BT,selectParentNode:()=>zT,selectTextblockEnd:()=>FT,selectTextblockStart:()=>HT,setContent:()=>UT,setMark:()=>pE,setMeta:()=>gE,setNode:()=>mE,setNodeSelection:()=>vE,setTextDirection:()=>bE,setTextSelection:()=>yE,sinkListItem:()=>wE,splitBlock:()=>xE,splitListItem:()=>kE,toggleList:()=>TE,toggleMark:()=>EE,toggleNode:()=>AE,toggleWrap:()=>RE,undoInputRule:()=>PE,unsetAllMarks:()=>IE,unsetMark:()=>LE,unsetTextDirection:()=>OE,updateAttributes:()=>NE,updateDecorations:()=>DE,wrapIn:()=>$E,wrapInList:()=>BE});const dl=new WeakMap;function FE(n,e){var t;dl.set(n,((t=dl.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const s=((r=dl.get(n))!==null&&r!==void 0?r:1)-1;s>0?dl.set(n,s):dl.delete(n)}}var HE=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 UE(n){return n.kind==="widget"}function n0(n,e){const t=[],r=new Set;for(const s of n)s.kind==="widget"&&UE(s)&&r.add(s.key),t.push(s.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function VE(n,e,t){const{decorations:r,widgetKeys:s}=n0(e,t);return{set:an.create(n,r),widgetKeys:s}}function r0({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function WE({decorations:n,from:e,to:t,docSize:r,extensionName:s,warnedExtensions:i}){return n.filter(o=>r0({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 jE(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function s0(n){return n.jsonID==="attr"}function KE(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||s0(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function GE(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 qE(n,e){if(n.steps.some(i=>!KE(i)))return{type:"full"};const t=sd(n).map(({newRange:i})=>i);n.steps.forEach((i,o)=>{if(!s0(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=GE(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 i0(n,e,t,r){return n.map(e,t,{onRemove:s=>{const i=s?.key;typeof i=="string"&&r.delete(i)}})}function JE(n,e,t){var r,s;const i=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:an.empty,o=new Set((s=e.widgetKeysByExtension[n])!==null&&s!==void 0?s:[]);return{set:i0(i,t.mapping,t.doc,o),widgetKeys:o}}function cm(n,e){const t=Object.values(e).flatMap(r=>r.find());return an.create(n,t)}function um(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function XE(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 YE(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const QE=new Set;var ZE=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=Ra.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>XE(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,e;return(n=(e=Ra.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:QE}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 Tn({key:Ra,state:{init:(t,r)=>{const s={},i={};for(const{name:a,spec:c}of e){const{set:u,widgetKeys:d}=this.buildFullSet(a,c,r);s[a]=u,i[a]=d}const o={decorationSetsByExtension:s,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:um(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,s,i)=>{const o=t.getMeta(Ra),a=o?.type==="force"&&!o.name,c=o?.type==="force"?o.name:void 0,u={},d={},f=new Set;return FE(n,()=>{for(const{name:h,spec:p}of e){const g=a||c===h;if(YE(p,{editor:n,tr:t,oldState:s,newState:i},g))if(p.update==="changedRanges"&&t.docChanged&&!g){const m=this.applyChangedRangesRecompute(h,p,r,t,i);u[h]=m.set,d[h]=m.widgetKeys,f.add(h)}else{const{set:m,widgetKeys:v}=this.buildFullSet(h,p,i);u[h]=m,d[h]=v,f.add(h)}else{const m=JE(h,r,t);u[h]=m.set,d[h]=m.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:um(d)}}},props:{decorations(t){var r,s;return(r=(s=Ra.getState(t))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:an.empty}}})}applyChangedRangesRecompute(n,e,t,r,s){const i=qE(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:an.empty,u=new Set((a=t.widgetKeysByExtension[n])!==null&&a!==void 0?a:[]);let d=i0(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=>r0({position:C.from,from:h,to:p,docSize:f}));for(const C of g){const z=jE(C);z&&u.delete(z)}d=d.remove(g);const{decorations:m,widgetKeys:v}=n0(WE({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,m);for(const C of v)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 VE(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]]:cm(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):cm(t.doc,r)}};function eA(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof bt){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 tA(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 dm(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function nA(n){return typeof n=="number"}function rA(n){return Object.prototype.toString.call(n).slice(8,-1)}function xc(n){return rA(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function cB(n){return typeof n=="string"&&n.trim().length>0&&!/[;{}]/.test(n)}function Hh(n){return/\s/.test(n)}function o0(n){return/^\w$/.test(n)}function sA(n,e){for(;e<n.length&&Hh(n[e]);)e+=1;return e}function od(n,e){for(;e<n.length&&!Hh(n[e]);)e+=1;return e}function iA(n,e,t){for(;e<n.length&&(o0(n[e])||t);)e+=1;return e}function oA(n,e){const t=n.indexOf(n[e],e+1);return{nextIndex:od(n,t===-1?e:t+1)}}function aA(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 lA(n,e,t){const r=t==="pandoc",s=iA(n,e+1,r),i=n.slice(e,s),o=aA(n,i,s);if(o)return o;const a=s===n.length||Hh(n[s]);return{token:r&&a?{type:"boolean",name:i}:void 0,nextIndex:t==="shortcode"?od(n,s):s}}function cA(n,e,t){const r=n[e];return r==='"'||r==="'"?oA(n,e):o0(r)?lA(n,e,t):{nextIndex:od(n,e)}}function uA(n,e){const t=[];let r=0;for(;r<n.length&&(r=sA(n,r),!(r>=n.length));){const s=cA(n,r,e);s.token&&t.push(s.token),r=s.nextIndex}return t}function dA(n){const e={};return uA(n,"shortcode").forEach(t=>{t.type==="keyValue"&&(e[t.name]=t.value)}),e}function fA(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function hA(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=dA,serializeAttributes:i=fA,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:c}=n,u=t||e,d=h=>{if(!c)return h;const p={};return c.forEach(g=>{const m=typeof g=="string"?g:g.name,v=typeof g=="string"?void 0:g.skipIfDefault;if(m in h){const C=h[m];if(v!==void 0&&C===v)return;p[m]=C}}),p},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const g={...o,...h.attributes};if(a)return p.createNode(e,g);const m=r?r(h):h.content||"";return m?p.createNode(e,g,[p.createTextNode(m)]):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),m=g?.index;return m!==void 0?m:-1},tokenize(h,p,g){const m=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),v=h.match(m);if(!v)return;let C="",z="";if(a){const[,S]=v;z=S}else{const[,S,O]=v;z=S,C=O||""}const M=s(z.trim());return{type:e,raw:v[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||{}),m=i(g),v=m?` ${m}`:"";return a?`[${u}${v}]`:`[${u}${v}]${p}[/${u}]`}}}function pA(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 gA(n,e){const t=`text
16
16
  ${n}
17
- `,r=e(t)[0];return(r?.type==="paragraph"||r?.type==="text")&&r.raw===t}function gA(n,e,t){var r;const s=e.split(`
18
- `),i=(r=t.isParagraphContinuation)!==null&&r!==void 0?r:(a=>pA(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(`
17
+ `,r=e(t)[0];return(r?.type==="paragraph"||r?.type==="text")&&r.raw===t}function mA(n,e,t){var r;const s=e.split(`
18
+ `),i=(r=t.isParagraphContinuation)!==null&&r!==void 0?r:(a=>gA(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
19
  `),nestedContent:s.slice(o).join(`
20
- `)}}function dm(n,e,t){const r=n.split(`
20
+ `)}}function fm(n,e,t){const r=n.split(`
21
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
22
  `;continue}else return}const h=e.extractItemData(f),{indentLevel:p,mainContent:g}=h;i=`${i}${d}
23
23
  `;const m=[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(O=>O.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){m.push(M),i=`${i}${M}
24
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)m.push(M),i=`${i}${M}
25
- `,o+=1;else break}let v;const C=m.slice(1);if(C.length>0){const M=gA(g,C.map(O=>hA(O,p+a)).join(`
26
- `),t);h.mainContent=M.mainContent;const S=M.nestedContent;S.trim()&&(e.customNestedParser?v=e.customNestedParser(S):v=t.blockTokens(S))}const z=e.createToken(h,v);s.push(z)}if(s.length!==0)return{items:s,raw:i.slice(0,n.length)}}const fm=4;function hm(n){let e=0;for(const t of n)e=t===" "?e+fm-e%fm:e+1;return e}function o0(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(`
25
+ `,o+=1;else break}let v;const C=m.slice(1);if(C.length>0){const M=mA(g,C.map(O=>pA(O,p+a)).join(`
26
+ `),t);h.mainContent=M.mainContent;const S=M.nestedContent;S.trim()&&(e.customNestedParser?v=e.customNestedParser(S):v=t.blockTokens(S))}const z=e.createToken(h,v);s.push(z)}if(s.length!==0)return{items:s,raw:i.slice(0,n.length)}}const hm=4;function pm(n){let e=0;for(const t of n)e=t===" "?e+hm-e%hm:e+1;return e}function a0(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
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 m=C=>{if(!s?.alignNestedToPrefix)return e.indent(C);const z=e.indent(""),M=hm(i);return(hm(z)>=M?z:" ".repeat(M))+C},v=g.split(`
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 m=C=>{if(!s?.alignNestedToPrefix)return e.indent(C);const z=e.indent(""),M=pm(i);return(pm(z)>=M?z:" ".repeat(M))+C},v=g.split(`
29
29
  `).map(C=>m(C||"")).join(`
30
30
  `);u+=d.type==="paragraph"?`
31
31
 
32
32
  ${v}`:`
33
- ${v}`}}),u}function a0(n,e){const t={...n};return xc(n)&&xc(e)&&Object.keys(e).forEach(r=>{xc(e[r])&&xc(n[r])?t[r]=a0(n[r],e[r]):t[r]=e[r]}),t}function mA(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 ac=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 vA=(n,e)=>{if(Ih(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 bA(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:Hi.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function yA(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}=bA({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:m,chain:v,can:C}=new Na({editor:e,state:p});return i.handler({state:p,range:g,match:o,commands:m,chain:v,can:C})===null||!f.steps.length?!1:(d&&(u.dispatch(d),!u.state.doc.eq(d.doc))||(q2(f),f.setMeta("inputRule",!0),i.undoable&&f.setMeta(a,{transform:f,from:t,to:h,text:s}),u.dispatch(f)),!0)}function wA(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 kc(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=sE(d)+i;for(const h of o){const p=vA(f,h.find);if(!(!p||!wA(d,p,i))&&yA({editor:t,from:r,to:s,text:i,rule:h,match:p,plugin:a,insertText:c}))return!0}return!1}function xA(n){const{editor:e,rules:t}=n,r=new Tn({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=Nh(_e.from(u),o.schema);const{from:d}=c,f=d+u.length;kc({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 kc({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&&kc({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?kc({editor:e,from:o.pos,to:o.pos,text:`
34
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}var Hh=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{...vn(dt(this,"addOptions",{name:this.name}))}}get storage(){return{...vn(dt(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>a0(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}},pa=class l0 extends Hh{constructor(...e){super(...e),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new l0(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)}},c0=class{constructor(n){this.find=n.find,this.handler=n.handler}};const kA=(n,e,t)=>{if(Ih(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 _A(n){const{editor:e,state:t,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=n,{commands:c,chain:u,can:d}=new Na({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,s,(h,p)=>{var g,m,v,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 z=(m=(v=(C=h.content)===null||C===void 0?void 0:C.size)!==null&&v!==void 0?v:h.nodeSize)!==null&&m!==void 0?m:0,M=Math.max(r,p),S=Math.min(s,p+z);if(M>=S)return;const O=h.isText?h.text||"":h.textBetween(M-p,S-p,void 0,"");kA(O,i.find,o).forEach(N=>{if(N.index===void 0)return;const E=M+N.index+1,D=E+N[0].length,ee={from:t.tr.mapping.map(E),to:t.tr.mapping.map(D)},U=i.handler({state:t,range:ee,match:N,commands:c,chain:u,can:d,pasteEvent:o,dropEvent:a});f.push(U)})}),f.every(h=>h!==null)}let Ca=null;const SA=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 CA(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,m=td({state:u,transaction:g});if(!(!_A({editor:e,state:m,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",()=>{Ca===e&&(Ca=null)}),t.map(u=>new Tn({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&&(Ca=e)},h=()=>{Ca&&(Ca=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=Ca;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,m=p.getMeta("uiEvent")==="drop"&&!i,v=p.getMeta("applyPasteRules"),C=!!v;if(!g&&!m&&!C)return;if(C){let{text:S}=v;typeof S=="string"?S=S:S=Nh(_e.from(S),h.schema);const{from:O}=v,N=O+S.length,E=SA(S);return c({rule:u,state:h,from:O,to:{b:N},pasteEvt:E})}const z=f.doc.content.findDiffStart(h.doc.content),M=f.doc.content.findDiffEnd(h.doc.content);if(!(!tA(z)||!M||z===M.b))return c({rule:u,state:h,from:z,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=Gy(n),this.hasSchemaSpec=e.options.schemaSpec!==void 0,this.schema=YT(this.extensions,e,e.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t=dt(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Sa(e.name,this.schema)});return t?{...n,...t()}:n},{})}get plugins(){const{editor:n}=this,e=El([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Sa(r.name,this.schema)},i=[],o=dt(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&dt(r,"exitable",s)&&(a.ArrowRight=()=>pa.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=F2(a);i.push(c);const u=dt(r,"addInputRules",s);if(sm(r,n.options.enableInputRules)&&u){const h=u();if(h&&h.length){const p=xA({editor:n,rules:h}),g=Array.isArray(p)?p:[p];i.push(...g)}}const d=dt(r,"addPasteRules",s);if(sm(r,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const p=CA({editor:n,rules:h});i.push(...p)}}const f=dt(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=dt(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Sa(r.name,this.schema)});s&&t.push({name:r.name,addDecorations:s})}),this.decorationManager=new QE({editor:e,entries:t}),this.decorationManager.plugin}get attributes(){const n=Dh(this.extensions);return this.hasSchemaSpec?jy(n,this.schema):n}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Va(this.extensions);return Object.fromEntries(e.filter(t=>!!dt(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),s=dt(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Tr(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 El([...this.extensions].reverse()).reduceRight((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Sa(r.name,this.schema)},i=dt(r,"dispatchTransaction",s);return i?o=>{i.call(s,{transaction:o,next:t})}:t},n)}transformPastedHTML(n){const{editor:e}=this;return El([...this.extensions]).reduce((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Sa(r.name,this.schema)},i=dt(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}=Va(this.extensions);return Object.fromEntries(e.filter(t=>!!dt(t,"addMarkView")).map(t=>{const r=this.attributes.filter(o=>o.type===t.name),s=dt(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Qi(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=>{mA(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:Sa(e.name,this.schema)};if(e.type==="mark"){var r,s;(!((r=vn(dt(e,"keepOnSplit",t)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((s=vn(dt(e,"clearable",t)))!==null&&s!==void 0)||s||this.nonClearableMarks.push(e.name)}const i=dt(e,"onBeforeCreate",t),o=dt(e,"onCreate",t),a=dt(e,"onUpdate",t),c=dt(e,"onSelectionUpdate",t),u=dt(e,"onTransaction",t),d=dt(e,"onFocus",t),f=dt(e,"onBlur",t),h=dt(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=Gy;ad.sort=El;ad.flatten=Oh;var jn=class u0 extends Hh{constructor(...e){super(...e),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new u0(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};const MA=jn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Tn({key:new Vn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,i=Bh(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})=>$h(r,{from:c.pos,to:u.pos},a)).join(o??`
33
+ ${v}`}}),u}function l0(n,e){const t={...n};return xc(n)&&xc(e)&&Object.keys(e).forEach(r=>{xc(e[r])&&xc(n[r])?t[r]=l0(n[r],e[r]):t[r]=e[r]}),t}function vA(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 ac=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 bA=(n,e)=>{if(Lh(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 yA(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:Hi.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function wA(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}=yA({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:m,chain:v,can:C}=new Oa({editor:e,state:p});return i.handler({state:p,range:g,match:o,commands:m,chain:v,can:C})===null||!f.steps.length?!1:(d&&(u.dispatch(d),!u.state.doc.eq(d.doc))||(J2(f),f.setMeta("inputRule",!0),i.undoable&&f.setMeta(a,{transform:f,from:t,to:h,text:s}),u.dispatch(f)),!0)}function xA(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 kc(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=iE(d)+i;for(const h of o){const p=bA(f,h.find);if(!(!p||!xA(d,p,i))&&wA({editor:t,from:r,to:s,text:i,rule:h,match:p,plugin:a,insertText:c}))return!0}return!1}function kA(n){const{editor:e,rules:t}=n,r=new Tn({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=Dh(Se.from(u),o.schema);const{from:d}=c,f=d+u.length;kc({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 kc({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&&kc({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?kc({editor:e,from:o.pos,to:o.pos,text:`
34
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}var Uh=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{...vn(dt(this,"addOptions",{name:this.name}))}}get storage(){return{...vn(dt(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>l0(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}},ha=class c0 extends Uh{constructor(...e){super(...e),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new c0(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)}},u0=class{constructor(n){this.find=n.find,this.handler=n.handler}};const _A=(n,e,t)=>{if(Lh(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 SA(n){const{editor:e,state:t,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=n,{commands:c,chain:u,can:d}=new Oa({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,s,(h,p)=>{var g,m,v,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 z=(m=(v=(C=h.content)===null||C===void 0?void 0:C.size)!==null&&v!==void 0?v:h.nodeSize)!==null&&m!==void 0?m:0,M=Math.max(r,p),S=Math.min(s,p+z);if(M>=S)return;const O=h.isText?h.text||"":h.textBetween(M-p,S-p,void 0,"");_A(O,i.find,o).forEach(N=>{if(N.index===void 0)return;const E=M+N.index+1,D=E+N[0].length,ee={from:t.tr.mapping.map(E),to:t.tr.mapping.map(D)},U=i.handler({state:t,range:ee,match:N,commands:c,chain:u,can:d,pasteEvent:o,dropEvent:a});f.push(U)})}),f.every(h=>h!==null)}let Sa=null;const CA=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 MA(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,m=td({state:u,transaction:g});if(!(!SA({editor:e,state:m,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",()=>{Sa===e&&(Sa=null)}),t.map(u=>new Tn({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&&(Sa=e)},h=()=>{Sa&&(Sa=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=Sa;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,m=p.getMeta("uiEvent")==="drop"&&!i,v=p.getMeta("applyPasteRules"),C=!!v;if(!g&&!m&&!C)return;if(C){let{text:S}=v;typeof S=="string"?S=S:S=Dh(Se.from(S),h.schema);const{from:O}=v,N=O+S.length,E=CA(S);return c({rule:u,state:h,from:O,to:{b:N},pasteEvt:E})}const z=f.doc.content.findDiffStart(h.doc.content),M=f.doc.content.findDiffEnd(h.doc.content);if(!(!nA(z)||!M||z===M.b))return c({rule:u,state:h,from:z,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=qy(n),this.hasSchemaSpec=e.options.schemaSpec!==void 0,this.schema=QT(this.extensions,e,e.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t=dt(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_a(e.name,this.schema)});return t?{...n,...t()}:n},{})}get plugins(){const{editor:n}=this,e=El([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:_a(r.name,this.schema)},i=[],o=dt(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&dt(r,"exitable",s)&&(a.ArrowRight=()=>ha.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=H2(a);i.push(c);const u=dt(r,"addInputRules",s);if(im(r,n.options.enableInputRules)&&u){const h=u();if(h&&h.length){const p=kA({editor:n,rules:h}),g=Array.isArray(p)?p:[p];i.push(...g)}}const d=dt(r,"addPasteRules",s);if(im(r,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const p=MA({editor:n,rules:h});i.push(...p)}}const f=dt(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=dt(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:_a(r.name,this.schema)});s&&t.push({name:r.name,addDecorations:s})}),this.decorationManager=new ZE({editor:e,entries:t}),this.decorationManager.plugin}get attributes(){const n=$h(this.extensions);return this.hasSchemaSpec?Ky(n,this.schema):n}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Ua(this.extensions);return Object.fromEntries(e.filter(t=>!!dt(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),s=dt(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Tr(t.name,this.schema)});if(!s)return[];const i=s();if(!i)return[];const o=(a,c,u,d,f)=>{const h=la(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 El([...this.extensions].reverse()).reduceRight((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:_a(r.name,this.schema)},i=dt(r,"dispatchTransaction",s);return i?o=>{i.call(s,{transaction:o,next:t})}:t},n)}transformPastedHTML(n){const{editor:e}=this;return El([...this.extensions]).reduce((t,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:_a(r.name,this.schema)},i=dt(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}=Ua(this.extensions);return Object.fromEntries(e.filter(t=>!!dt(t,"addMarkView")).map(t=>{const r=this.attributes.filter(o=>o.type===t.name),s=dt(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Qi(t.name,this.schema)});if(!s)return[];const i=(o,a,c)=>{const u=la(o,r);return s()({mark:o,view:a,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{vA(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:_a(e.name,this.schema)};if(e.type==="mark"){var r,s;(!((r=vn(dt(e,"keepOnSplit",t)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((s=vn(dt(e,"clearable",t)))!==null&&s!==void 0)||s||this.nonClearableMarks.push(e.name)}const i=dt(e,"onBeforeCreate",t),o=dt(e,"onCreate",t),a=dt(e,"onUpdate",t),c=dt(e,"onSelectionUpdate",t),u=dt(e,"onTransaction",t),d=dt(e,"onFocus",t),f=dt(e,"onBlur",t),h=dt(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=qy;ad.sort=El;ad.flatten=Nh;var jn=class d0 extends Uh{constructor(...e){super(...e),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new d0(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};const TA=jn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Tn({key:new Vn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,i=zh(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})=>Bh(r,{from:c.pos,to:u.pos},a)).join(o??`
35
35
 
36
- `)}}})]}}),TA=jn.create({name:"commands",addCommands(){return{...BE}}}),EA=jn.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=Wy(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 di){var h,p;const g=u.slice(f).map(d.from,-1),m=u.slice(f).map(d.to),v=u.invert().map(g,-1),C=u.invert().map(m),z=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(m))===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:v,to:C},newRange:{from:g,to:m},partial:!!(M||z),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()}}),AA=jn.create({name:"drop",addProseMirrorPlugins(){return[new Tn({key:new Vn("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),RA=jn.create({name:"editable",addProseMirrorPlugins(){return[new Tn({key:new Vn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),PA=new Vn("focusEvents"),IA=jn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Tn({key:PA,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}}}})]}}),LA=jn.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,m=g.parent.type.spec.isolating,v=f.pos-f.parentOffset,C=m&&g.parent.childCount===1?v===f.pos:Jt.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 Kl()||Uy()?i:s},addProseMirrorPlugins(){return[new Tn({key:new Vn("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=Jt.atStart(e.doc).from,u=Jt.atEnd(e.doc).to;if(i||!(o===c&&a===u)||!oc(t.doc))return;const d=t.tr,f=td({state:t,transaction:d}),{commands:h}=new Na({editor:this.editor,state:f});if(h.clearNodes(),!!d.steps.length)return d}})]}}),OA=jn.create({name:"paste",addProseMirrorPlugins(){return[new Tn({key:new Vn("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),NA=jn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Tn({key:new Vn("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"}}}})]}}),DA=jn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Va(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 Tn({key:new Vn("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let pm=!1;function $A(n){if(pm)return;pm=!0;let e;try{const t=nr.fromJSON(n,{from:0,to:0});if(!cE(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 BA=class bl{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 bl(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 bl(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 bl(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 bl(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 zA=`.ProseMirror {
36
+ `)}}})]}}),EA=jn.create({name:"commands",addCommands(){return{...zE}}}),AA=jn.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=jy(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 di){var h,p;const g=u.slice(f).map(d.from,-1),m=u.slice(f).map(d.to),v=u.invert().map(g,-1),C=u.invert().map(m),z=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(m))===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:v,to:C},newRange:{from:g,to:m},partial:!!(M||z),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()}}),RA=jn.create({name:"drop",addProseMirrorPlugins(){return[new Tn({key:new Vn("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),PA=jn.create({name:"editable",addProseMirrorPlugins(){return[new Tn({key:new Vn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),IA=new Vn("focusEvents"),LA=jn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Tn({key:IA,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}}}})]}}),OA=jn.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,m=g.parent.type.spec.isolating,v=f.pos-f.parentOffset,C=m&&g.parent.childCount===1?v===f.pos:Jt.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 Kl()||Vy()?i:s},addProseMirrorPlugins(){return[new Tn({key:new Vn("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=Jt.atStart(e.doc).from,u=Jt.atEnd(e.doc).to;if(i||!(o===c&&a===u)||!oc(t.doc))return;const d=t.tr,f=td({state:t,transaction:d}),{commands:h}=new Oa({editor:this.editor,state:f});if(h.clearNodes(),!!d.steps.length)return d}})]}}),NA=jn.create({name:"paste",addProseMirrorPlugins(){return[new Tn({key:new Vn("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),DA=jn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Tn({key:new Vn("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"}}}})]}}),$A=jn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Ua(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 Tn({key:new Vn("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let gm=!1;function BA(n){if(gm)return;gm=!0;let e;try{const t=nr.fromJSON(n,{from:0,to:0});if(!uE(t))return;e=t.slice.content}catch{return}e instanceof Se||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 zA=class vl{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 vl(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 vl(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 vl(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 vl(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 FA=`.ProseMirror {
37
37
  position: relative;
38
38
  }
39
39
 
@@ -103,13 +103,13 @@ img.ProseMirror-separator {
103
103
 
104
104
  .ProseMirror-focused .ProseMirror-gapcursor {
105
105
  display: block;
106
- }`;var FA=class extends FE{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:uE,createMappablePosition:dE},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=If(t,this.options.autofocus);this.editorState=Hi.create({doc:t,schema:this.schema,selection:r||void 0})}$A(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():Na.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Na.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=eA(zA,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=Of(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?[RA,MA.configure({blockSeparator:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),TA,IA,LA,NA.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),AA,OA,EA,DA.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 Na({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=Hi.create({doc:r,schema:this.schema,selection:If(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 Of(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 My(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 qy(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,s=typeof e=="string"?t:e;return iE(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Nh(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
106
+ }`;var HA=class extends HE{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:dE,createMappablePosition:fE},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=Hi.create({doc:t,schema:this.schema,selection:r||void 0})}BA(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Oa.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Oa.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=tA(FA,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?[PA,TA.configure({blockSeparator:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),EA,LA,OA,DA.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),RA,NA,AA,$A.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 Oa({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=Hi.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 Ty(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 Jy(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,s=typeof e=="string"?t:e;return oE(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Dh(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
107
107
 
108
- `,textSerializers:r={}}=e||{};return QT(this.state.doc,{blockSeparator:t,textSerializers:{...Bh(this.schema),...r}})}get isEmpty(){return oc(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 BA(t,this,!1,r)}get $doc(){return this.$pos(0)}};function ua(n){return new ac({find:n.find,handler:({state:e,range:t,match:r})=>{const s=vn(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 d0(n){return new ac({find:n.find,handler:({state:e,range:t,match:r})=>{const s=vn(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 Df(n){return new ac({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=vn(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 Wa(n){return new ac({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=vn(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&vh(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(m=>h.includes(m.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 HA=n=>"touches"in n;var UA=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,HA(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}}},br=class f0 extends Hh{constructor(...e){super(...e),this.type="node"}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)}},VA=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 z=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,O=(d=n.offsetY)!==null&&d!==void 0?d:(f=n.nativeEvent)===null||f===void 0?void 0:f.offsetY;o=M.x-z.x+S,a=M.y-z.y+O}const h=this.dom.cloneNode(!0);try{const z=this.dom.getBoundingClientRect();h.style.width=`${Math.round(z.width)}px`,h.style.height=`${Math.round(z.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 m=this.getPos();if(typeof m!="number")return;const v=bt.create(r.state.doc,m),C=r.state.tr.setSelection(v);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=bt.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"&&(Kl()||Lf())&&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 c0({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=vn(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 h0=new WeakSet,p0=new WeakSet;function Fo(n){const e=n;return h0.add(e),e}function $f(n){return Array.isArray(n)&&h0.has(n)}function g0(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&p0.has(e)&&!$f(e)?g0(e):[e])}function WA(n,e){if(n==="slot")return 0;if(n instanceof Function){const s=n(e);return Array.isArray(s)&&!$f(s)&&!p0.has(s)?Fo(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($f(t))return Fo([n,r,t]);if(t.length===0)return Fo([n,r]);const s=g0(t);return s.length===0?Fo([n,r]):Fo([n,r,...s])}return t!=null?Fo([n,r,t]):Fo([n,r])}const uu=(n,e)=>WA(n,e),jA=(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 je(p,0,0);return f.replace(d,i.after(),g),f.setSelection(Je.create(f.doc,d+p.size)),f.scrollIntoView(),h(f),!0})},KA=/^\s*>\s$/,GA=br.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return uu("blockquote",{...bn(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(`
108
+ `,textSerializers:r={}}=e||{};return ZT(this.state.doc,{blockSeparator:t,textSerializers:{...zh(this.schema),...r}})}get isEmpty(){return oc(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 zA(t,this,!1,r)}get $doc(){return this.$pos(0)}};function ca(n){return new ac({find:n.find,handler:({state:e,range:t,match:r})=>{const s=vn(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 f0(n){return new ac({find:n.find,handler:({state:e,range:t,match:r})=>{const s=vn(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 ac({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=vn(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 Va(n){return new ac({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=vn(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&bh(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(m=>h.includes(m.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&&Ro(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)},undoable:n.undoable})}const UA=n=>"touches"in n;var VA=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,UA(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}}},br=class h0 extends Uh{constructor(...e){super(...e),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new h0(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},WA=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 z=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,O=(d=n.offsetY)!==null&&d!==void 0?d:(f=n.nativeEvent)===null||f===void 0?void 0:f.offsetY;o=M.x-z.x+S,a=M.y-z.y+O}const h=this.dom.cloneNode(!0);try{const z=this.dom.getBoundingClientRect();h.style.width=`${Math.round(z.width)}px`,h.style.height=`${Math.round(z.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 m=this.getPos();if(typeof m!="number")return;const v=bt.create(r.state.doc,m),C=r.state.tr.setSelection(v);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=bt.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"&&(Kl()||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 Eo(n){return new u0({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=vn(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 p0=new WeakSet,g0=new WeakSet;function zo(n){const e=n;return p0.add(e),e}function Bf(n){return Array.isArray(n)&&p0.has(n)}function m0(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&g0.has(e)&&!Bf(e)?m0(e):[e])}function jA(n,e){if(n==="slot")return 0;if(n instanceof Function){const s=n(e);return Array.isArray(s)&&!Bf(s)&&!g0.has(s)?zo(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 zo([n,r,t]);if(t.length===0)return zo([n,r]);const s=m0(t);return s.length===0?zo([n,r]):zo([n,r,...s])}return t!=null?zo([n,r,t]):zo([n,r])}const uu=(n,e)=>jA(n,e),KA=(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 je(p,0,0);return f.replace(d,i.after(),g),f.setSelection(Je.create(f.doc,d+p.size)),f.scrollIntoView(),h(f),!0})},GA=/^\s*>\s$/,qA=br.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return uu("blockquote",{...bn(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
109
  `).map(u=>u.trim()===""?t:`${t} ${u}`);r.push(c.join(`
110
110
  `))}),r.join(`
111
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:()=>jA(this.editor,this.type)}},addInputRules(){return[Wa({find:KA,type:this.type})]}}),qA=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,JA=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,XA=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,YA=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,QA=pa.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",{...bn(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:qA,type:this.type}),ua({find:XA,type:this.type})]},addPasteRules(){return[Ao({find:JA,type:this.type}),Ao({find:YA,type:this.type})]}}),ZA=n=>{const e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},eR=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 tR(n){const e=new Set((n.match(/`+/g)||[]).map(r=>r.length));let t=1;for(;e.has(t);)t+=1;return t}const nR=pa.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",bn(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(tR(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:ZA,type:this.type})]},addPasteRules(){return[Ao({find:eR,type:this.type})]}}),Vd=4,rR=/^```([a-z]+)?[\s\n]$/,sR=/^~~~([a-z]+)?[\s\n]$/,iR=br.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",bn(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(`
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:()=>KA(this.editor,this.type)}},addInputRules(){return[Va({find:GA,type:this.type})]}}),JA=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,XA=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,YA=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,QA=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ZA=ha.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",{...bn(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[ca({find:JA,type:this.type}),ca({find:YA,type:this.type})]},addPasteRules(){return[Eo({find:XA,type:this.type}),Eo({find:QA,type:this.type})]}}),eR=n=>{const e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},tR=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 nR(n){const e=new Set((n.match(/`+/g)||[]).map(r=>r.length));let t=1;for(;e.has(t);)t+=1;return t}const rR=ha.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",bn(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(nR(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[ca({find:eR,type:this.type})]},addPasteRules(){return[Eo({find:tR,type:this.type})]}}),Vd=4,sR=/^```([a-z]+)?[\s\n]$/,iR=/^~~~([a-z]+)?[\s\n]$/,oR=br.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",bn(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
113
  `):r=`\`\`\`${s}
114
114
 
115
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,`
@@ -125,51 +125,51 @@ ${t}
125
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
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
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(Jt.near(r.resolve(o))),!0)):n.commands.exitCode()}}},addInputRules(){return[Df({find:rR,type:this.type,getAttributes:n=>({language:n[1]})}),Df({find:sR,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Tn({key:new Vn("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(Je.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),oR=br.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
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(Jt.near(r.resolve(o))),!0)):n.commands.exitCode()}}},addInputRules(){return[$f({find:sR,type:this.type,getAttributes:n=>({language:n[1]})}),$f({find:iR,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Tn({key:new Vn("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(Je.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),aR=br.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
130
130
 
131
- `):""}),aR=br.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",bn(this.options.HTMLAttributes,n)]},renderText(){return`
131
+ `):""}),lR=br.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",bn(this.options.HTMLAttributes,n)]},renderText(){return`
132
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()}}}),lR=br.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]}`,bn(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=>Df({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),cR=br.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",bn(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!ZE(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return Jy(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(Je.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(bt.create(o.doc,c.pos)):o.setSelection(Je.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(Je.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[d0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),uR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,dR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,fR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,hR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,pR=pa.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",bn(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:uR,type:this.type}),ua({find:fR,type:this.type})]},addPasteRules(){return[Ao({find:dR,type:this.type}),Ao({find:hR,type:this.type})]}}),gR="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",mR="ελ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",Bf="numeric",zf="ascii",Ff="alpha",Al="asciinumeric",yl="alphanumeric",Hf="domain",m0="emoji",vR="scheme",bR="slashscheme",Wd="whitespace";function yR(n,e){return n in e||(e[n]=[]),e[n]}function Xo(n,e,t){e[Bf]&&(e[Al]=!0,e[yl]=!0),e[zf]&&(e[Al]=!0,e[Ff]=!0),e[Al]&&(e[yl]=!0),e[Ff]&&(e[yl]=!0),e[yl]&&(e[Hf]=!0),e[m0]&&(e[Hf]=!0);for(const r in e){const s=yR(r,t);s.indexOf(n)<0&&s.push(n)}}function wR(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ts(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ts.groups={};Ts.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||Ts.groups;let s;return e&&e.j?s=e:(s=new Ts(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||Ts.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 Ts,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Ts,i){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(wR(o.t,r),t);Xo(i,c,r)}else t&&Xo(i,t,r);o.t=i}return s.j[n]=o,o}};const Xt=(n,e,t,r,s)=>n.ta(e,t,r,s),tr=(n,e,t,r,s)=>n.tr(e,t,r,s),gm=(n,e,t,r,s)=>n.ts(e,t,r,s),Re=(n,e,t,r,s)=>n.tt(e,t,r,s),Bi="WORD",Uf="UWORD",v0="ASCIINUMERICAL",b0="ALPHANUMERICAL",Gl="LOCALHOST",Vf="TLD",Wf="UTLD",Vc="SCHEME",Ia="SLASH_SCHEME",Uh="NUM",jf="WS",Vh="NL",Rl="OPENBRACE",Pl="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",Wh="COMMA",Pu="DOLLAR",xi="DOT",Iu="EQUALS",jh="EXCLAMATION",Js="HYPHEN",Il="PERCENT",Lu="PIPE",Ou="PLUS",Nu="POUND",Ll="QUERY",Kh="QUOTE",y0="FULLWIDTHMIDDLEDOT",Gh="SEMI",ki="SLASH",Ol="TILDE",Du="UNDERSCORE",w0="EMOJI",$u="SYM";var x0=Object.freeze({__proto__:null,ALPHANUMERICAL:b0,AMPERSAND:Cu,APOSTROPHE:Mu,ASCIINUMERICAL:v0,ASTERISK:Tu,AT:po,BACKSLASH:Eu,BACKTICK:Au,CARET:Ru,CLOSEANGLEBRACKET:mu,CLOSEBRACE:Pl,CLOSEBRACKET:fu,CLOSEPAREN:pu,COLON:Yo,COMMA:Wh,DOLLAR:Pu,DOT:xi,EMOJI:w0,EQUALS:Iu,EXCLAMATION:jh,FULLWIDTHGREATERTHAN:Su,FULLWIDTHLEFTPAREN:vu,FULLWIDTHLESSTHAN:_u,FULLWIDTHMIDDLEDOT:y0,FULLWIDTHRIGHTPAREN:bu,HYPHEN:Js,LEFTCORNERBRACKET:yu,LEFTWHITECORNERBRACKET:xu,LOCALHOST:Gl,NL:Vh,NUM:Uh,OPENANGLEBRACKET:gu,OPENBRACE:Rl,OPENBRACKET:du,OPENPAREN:hu,PERCENT:Il,PIPE:Lu,PLUS:Ou,POUND:Nu,QUERY:Ll,QUOTE:Kh,RIGHTCORNERBRACKET:wu,RIGHTWHITECORNERBRACKET:ku,SCHEME:Vc,SEMI:Gh,SLASH:ki,SLASH_SCHEME:Ia,SYM:$u,TILDE:Ol,TLD:Vf,UNDERSCORE:Du,UTLD:Wf,UWORD:Uf,WORD:Bi,WS:jf});const Ni=/[a-z]/,hl=/\p{L}/u,jd=/\p{Emoji}/u,Di=/\d/,Kd=/\s/,mm="\r",Gd=`
134
- `,xR="️",kR="‍",qd="";let _c=null,Sc=null;function _R(n=[]){const e={};Ts.groups=e;const t=new Ts;_c==null&&(_c=vm(gR)),Sc==null&&(Sc=vm(mR)),Re(t,"'",Mu),Re(t,"{",Rl),Re(t,"}",Pl),Re(t,"[",du),Re(t,"]",fu),Re(t,"(",hu),Re(t,")",pu),Re(t,"<",gu),Re(t,">",mu),Re(t,"(",vu),Re(t,")",bu),Re(t,"「",yu),Re(t,"」",wu),Re(t,"『",xu),Re(t,"』",ku),Re(t,"<",_u),Re(t,">",Su),Re(t,"&",Cu),Re(t,"*",Tu),Re(t,"@",po),Re(t,"`",Au),Re(t,"^",Ru),Re(t,":",Yo),Re(t,",",Wh),Re(t,"$",Pu),Re(t,".",xi),Re(t,"=",Iu),Re(t,"!",jh),Re(t,"-",Js),Re(t,"%",Il),Re(t,"|",Lu),Re(t,"+",Ou),Re(t,"#",Nu),Re(t,"?",Ll),Re(t,'"',Kh),Re(t,"/",ki),Re(t,";",Gh),Re(t,"~",Ol),Re(t,"_",Du),Re(t,"\\",Eu),Re(t,"・",y0);const r=tr(t,Di,Uh,{[Bf]:!0});tr(r,Di,r);const s=tr(r,Ni,v0,{[Al]:!0}),i=tr(r,hl,b0,{[yl]:!0}),o=tr(t,Ni,Bi,{[zf]:!0});tr(o,Di,s),tr(o,Ni,o),tr(s,Di,s),tr(s,Ni,s);const a=tr(t,hl,Uf,{[Ff]:!0});tr(a,Ni),tr(a,Di,i),tr(a,hl,a),tr(i,Di,i),tr(i,Ni),tr(i,hl,i);const c=Re(t,Gd,Vh,{[Wd]:!0}),u=Re(t,mm,jf,{[Wd]:!0}),d=tr(t,Kd,jf,{[Wd]:!0});Re(t,qd,d),Re(u,Gd,c),Re(u,qd,d),tr(u,Kd,d),Re(d,mm),Re(d,Gd),tr(d,Kd,d),Re(d,qd,d);const f=tr(t,jd,w0,{[m0]:!0});Re(f,"#"),tr(f,jd,f),Re(f,xR,f);const h=Re(f,kR);Re(h,"#"),tr(h,jd,f);const p=[[Ni,o],[Di,s]],g=[[Ni,null],[hl,a],[Di,i]];for(let m=0;m<_c.length;m++)lo(t,_c[m],Vf,Bi,p);for(let m=0;m<Sc.length;m++)lo(t,Sc[m],Wf,Uf,g);Xo(Vf,{tld:!0,ascii:!0},e),Xo(Wf,{utld:!0,alpha:!0},e),lo(t,"file",Vc,Bi,p),lo(t,"mailto",Vc,Bi,p),lo(t,"http",Ia,Bi,p),lo(t,"https",Ia,Bi,p),lo(t,"ftp",Ia,Bi,p),lo(t,"ftps",Ia,Bi,p),Xo(Vc,{scheme:!0,ascii:!0},e),Xo(Ia,{slashscheme:!0,ascii:!0},e),n=n.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<n.length;m++){const v=n[m][0],z=n[m][1]?{[vR]:!0}:{[bR]:!0};v.indexOf("-")>=0?z[Hf]=!0:Ni.test(v)?Di.test(v)?z[Al]=!0:z[zf]=!0:z[Bf]=!0,gm(t,v,v,z)}return gm(t,"localhost",Gl,{ascii:!0}),t.jd=new Ts($u),{start:t,tokens:Object.assign({groups:e},x0)}}function k0(n,e){const t=SR(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 SR(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 Ts(r),i.jr=s.slice(),n.j[c]=i),n=i}return i=new Ts(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function vm(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 ql={defaultProtocol:"http",events:null,format:bm,formatHref:bm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function qh(n,e=null){let t=Object.assign({},ql);n&&(t=Object.assign(t,n instanceof qh?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}qh.prototype={o:ql,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]:ql[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 bm(n){return n}function _0(n,e){this.t="token",this.v=n,this.tk=e}_0.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=ql.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 _0{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 CR=ld("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ym=ld("text"),MR=ld("nl"),Cc=ld("url",{isLink:!0,toHref(n=ql.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Gl&&n[1].t===Yo}}),Gs=n=>new Ts(n);function TR({groups:n}){const e=n.domain.concat([Cu,Tu,po,Eu,Au,Ru,Pu,Iu,Js,Uh,Il,Lu,Ou,Nu,ki,$u,Ol,Du]),t=[Mu,Yo,Wh,xi,jh,Il,Ll,Kh,Gh,gu,mu,Rl,Pl,fu,du,hu,pu,vu,bu,yu,wu,xu,ku,_u,Su],r=[Cu,Mu,Tu,Eu,Au,Ru,Pu,Iu,Js,Rl,Pl,Il,Lu,Ou,Nu,Ll,ki,$u,Ol,Du],s=Gs(),i=Re(s,Ol);Xt(i,r,i),Xt(i,n.domain,i);const o=Gs(),a=Gs(),c=Gs();Xt(s,n.domain,o),Xt(s,n.scheme,a),Xt(s,n.slashscheme,c),Xt(o,r,i),Xt(o,n.domain,o);const u=Re(o,po);Re(i,po,u),Re(a,po,u),Re(c,po,u);const d=Re(i,xi);Xt(d,r,i),Xt(d,n.domain,i);const f=Gs();Xt(u,n.domain,f),Xt(f,n.domain,f);const h=Re(f,xi);Xt(h,n.domain,f);const p=Gs(CR);Xt(h,n.tld,p),Xt(h,n.utld,p),Re(u,Gl,p);const g=Re(f,Js);Re(g,Js,g),Xt(g,n.domain,f),Xt(p,n.domain,f),Re(p,xi,h),Re(p,Js,g);const m=Re(o,Js),v=Re(o,xi);Re(m,Js,m),Xt(m,n.domain,o),Xt(v,r,i),Xt(v,n.domain,o);const C=Gs(Cc);Xt(v,n.tld,C),Xt(v,n.utld,C),Xt(C,n.domain,o),Xt(C,r,i),Re(C,xi,v),Re(C,Js,m),Re(C,po,u);const z=Re(C,Yo),M=Gs(Cc);Xt(z,n.numeric,M);const S=Gs(Cc),O=Gs();Xt(S,e,S),Xt(S,t,O),Xt(O,e,S),Xt(O,t,O),Re(C,ki,S),Re(M,ki,S);const N=Re(a,Yo),E=Re(c,Yo),D=Re(E,ki),ee=Re(D,ki);Xt(a,n.domain,o),Re(a,xi,v),Re(a,Js,m),Xt(c,n.domain,o),Re(c,xi,v),Re(c,Js,m),Xt(N,n.domain,S),Re(N,ki,S),Re(N,Ll,S),Xt(ee,n.domain,S),Xt(ee,e,S),Re(ee,ki,S);const U=[[Rl,Pl],[du,fu],[hu,pu],[gu,mu],[vu,bu],[yu,wu],[xu,ku],[_u,Su]];for(let oe=0;oe<U.length;oe++){const[F,W]=U[oe],X=Re(S,F);Re(O,F,X);const le=Gs(Cc);Xt(X,e,le);const re=Gs();Xt(X,t,re),Re(X,W,S),Xt(le,e,le),Xt(le,t,re),Xt(re,e,le),Xt(re,t,re),Re(le,W,S),Re(re,W,S)}return Re(s,Gl,C),Re(s,Vh,MR),{start:s,tokens:x0}}function ER(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(ym,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(ym,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 AR=typeof console<"u"&&console&&console.warn||(()=>{}),RR="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 PR(){return Ts.groups={},Hn.scanner=null,Hn.parser=null,Hn.tokenQueue=[],Hn.pluginQueue=[],Hn.customSchemes=[],Hn.initialized=!1,Hn}function wm(n,e=!1){if(Hn.initialized&&AR(`linkifyjs: already initialized - will not register custom scheme "${n}" ${RR}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
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()}}}),cR=br.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]}`,bn(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}}))}}),uR=br.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",bn(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!eA(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return Xy(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(Je.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(bt.create(o.doc,c.pos)):o.setSelection(Je.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(Je.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[f0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),dR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,fR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,hR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,pR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,gR=ha.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",bn(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[ca({find:dR,type:this.type}),ca({find:hR,type:this.type})]},addPasteRules(){return[Eo({find:fR,type:this.type}),Eo({find:pR,type:this.type})]}}),mR="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",vR="ελ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",Al="asciinumeric",bl="alphanumeric",Uf="domain",v0="emoji",bR="scheme",yR="slashscheme",Wd="whitespace";function wR(n,e){return n in e||(e[n]=[]),e[n]}function Jo(n,e,t){e[zf]&&(e[Al]=!0,e[bl]=!0),e[Ff]&&(e[Al]=!0,e[Hf]=!0),e[Al]&&(e[bl]=!0),e[Hf]&&(e[bl]=!0),e[bl]&&(e[Uf]=!0),e[v0]&&(e[Uf]=!0);for(const r in e){const s=wR(r,t);s.indexOf(n)<0&&s.push(n)}}function xR(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Es(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Es.groups={};Es.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||Es.groups;let s;return e&&e.j?s=e:(s=new Es(e),t&&r&&Jo(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const i=n.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(n[o]);return s.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||Es.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 Es,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Es,i){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(xR(o.t,r),t);Jo(i,c,r)}else t&&Jo(i,t,r);o.t=i}return s.j[n]=o,o}};const Yt=(n,e,t,r,s)=>n.ta(e,t,r,s),tr=(n,e,t,r,s)=>n.tr(e,t,r,s),mm=(n,e,t,r,s)=>n.ts(e,t,r,s),Re=(n,e,t,r,s)=>n.tt(e,t,r,s),Bi="WORD",Vf="UWORD",b0="ASCIINUMERICAL",y0="ALPHANUMERICAL",Gl="LOCALHOST",Wf="TLD",jf="UTLD",Vc="SCHEME",Pa="SLASH_SCHEME",Vh="NUM",Kf="WS",Wh="NL",Rl="OPENBRACE",Pl="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",Xo="COLON",jh="COMMA",Pu="DOLLAR",xi="DOT",Iu="EQUALS",Kh="EXCLAMATION",Js="HYPHEN",Il="PERCENT",Lu="PIPE",Ou="PLUS",Nu="POUND",Ll="QUERY",Gh="QUOTE",w0="FULLWIDTHMIDDLEDOT",qh="SEMI",ki="SLASH",Ol="TILDE",Du="UNDERSCORE",x0="EMOJI",$u="SYM";var k0=Object.freeze({__proto__:null,ALPHANUMERICAL:y0,AMPERSAND:Cu,APOSTROPHE:Mu,ASCIINUMERICAL:b0,ASTERISK:Tu,AT:po,BACKSLASH:Eu,BACKTICK:Au,CARET:Ru,CLOSEANGLEBRACKET:mu,CLOSEBRACE:Pl,CLOSEBRACKET:fu,CLOSEPAREN:pu,COLON:Xo,COMMA:jh,DOLLAR:Pu,DOT:xi,EMOJI:x0,EQUALS:Iu,EXCLAMATION:Kh,FULLWIDTHGREATERTHAN:Su,FULLWIDTHLEFTPAREN:vu,FULLWIDTHLESSTHAN:_u,FULLWIDTHMIDDLEDOT:w0,FULLWIDTHRIGHTPAREN:bu,HYPHEN:Js,LEFTCORNERBRACKET:yu,LEFTWHITECORNERBRACKET:xu,LOCALHOST:Gl,NL:Wh,NUM:Vh,OPENANGLEBRACKET:gu,OPENBRACE:Rl,OPENBRACKET:du,OPENPAREN:hu,PERCENT:Il,PIPE:Lu,PLUS:Ou,POUND:Nu,QUERY:Ll,QUOTE:Gh,RIGHTCORNERBRACKET:wu,RIGHTWHITECORNERBRACKET:ku,SCHEME:Vc,SEMI:qh,SLASH:ki,SLASH_SCHEME:Pa,SYM:$u,TILDE:Ol,TLD:Wf,UNDERSCORE:Du,UTLD:jf,UWORD:Vf,WORD:Bi,WS:Kf});const Ni=/[a-z]/,fl=/\p{L}/u,jd=/\p{Emoji}/u,Di=/\d/,Kd=/\s/,vm="\r",Gd=`
134
+ `,kR="️",_R="‍",qd="";let _c=null,Sc=null;function SR(n=[]){const e={};Es.groups=e;const t=new Es;_c==null&&(_c=bm(mR)),Sc==null&&(Sc=bm(vR)),Re(t,"'",Mu),Re(t,"{",Rl),Re(t,"}",Pl),Re(t,"[",du),Re(t,"]",fu),Re(t,"(",hu),Re(t,")",pu),Re(t,"<",gu),Re(t,">",mu),Re(t,"(",vu),Re(t,")",bu),Re(t,"「",yu),Re(t,"」",wu),Re(t,"『",xu),Re(t,"』",ku),Re(t,"<",_u),Re(t,">",Su),Re(t,"&",Cu),Re(t,"*",Tu),Re(t,"@",po),Re(t,"`",Au),Re(t,"^",Ru),Re(t,":",Xo),Re(t,",",jh),Re(t,"$",Pu),Re(t,".",xi),Re(t,"=",Iu),Re(t,"!",Kh),Re(t,"-",Js),Re(t,"%",Il),Re(t,"|",Lu),Re(t,"+",Ou),Re(t,"#",Nu),Re(t,"?",Ll),Re(t,'"',Gh),Re(t,"/",ki),Re(t,";",qh),Re(t,"~",Ol),Re(t,"_",Du),Re(t,"\\",Eu),Re(t,"・",w0);const r=tr(t,Di,Vh,{[zf]:!0});tr(r,Di,r);const s=tr(r,Ni,b0,{[Al]:!0}),i=tr(r,fl,y0,{[bl]:!0}),o=tr(t,Ni,Bi,{[Ff]:!0});tr(o,Di,s),tr(o,Ni,o),tr(s,Di,s),tr(s,Ni,s);const a=tr(t,fl,Vf,{[Hf]:!0});tr(a,Ni),tr(a,Di,i),tr(a,fl,a),tr(i,Di,i),tr(i,Ni),tr(i,fl,i);const c=Re(t,Gd,Wh,{[Wd]:!0}),u=Re(t,vm,Kf,{[Wd]:!0}),d=tr(t,Kd,Kf,{[Wd]:!0});Re(t,qd,d),Re(u,Gd,c),Re(u,qd,d),tr(u,Kd,d),Re(d,vm),Re(d,Gd),tr(d,Kd,d),Re(d,qd,d);const f=tr(t,jd,x0,{[v0]:!0});Re(f,"#"),tr(f,jd,f),Re(f,kR,f);const h=Re(f,_R);Re(h,"#"),tr(h,jd,f);const p=[[Ni,o],[Di,s]],g=[[Ni,null],[fl,a],[Di,i]];for(let m=0;m<_c.length;m++)lo(t,_c[m],Wf,Bi,p);for(let m=0;m<Sc.length;m++)lo(t,Sc[m],jf,Vf,g);Jo(Wf,{tld:!0,ascii:!0},e),Jo(jf,{utld:!0,alpha:!0},e),lo(t,"file",Vc,Bi,p),lo(t,"mailto",Vc,Bi,p),lo(t,"http",Pa,Bi,p),lo(t,"https",Pa,Bi,p),lo(t,"ftp",Pa,Bi,p),lo(t,"ftps",Pa,Bi,p),Jo(Vc,{scheme:!0,ascii:!0},e),Jo(Pa,{slashscheme:!0,ascii:!0},e),n=n.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<n.length;m++){const v=n[m][0],z=n[m][1]?{[bR]:!0}:{[yR]:!0};v.indexOf("-")>=0?z[Uf]=!0:Ni.test(v)?Di.test(v)?z[Al]=!0:z[Ff]=!0:z[zf]=!0,mm(t,v,v,z)}return mm(t,"localhost",Gl,{ascii:!0}),t.jd=new Es($u),{start:t,tokens:Object.assign({groups:e},k0)}}function _0(n,e){const t=CR(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 CR(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 Es(r),i.jr=s.slice(),n.j[c]=i),n=i}return i=new Es(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function bm(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 ql={defaultProtocol:"http",events:null,format:ym,formatHref:ym,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Jh(n,e=null){let t=Object.assign({},ql);n&&(t=Object.assign(t,n instanceof Jh?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}Jh.prototype={o:ql,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]:ql[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 ym(n){return n}function S0(n,e){this.t="token",this.v=n,this.tk=e}S0.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=ql.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 S0{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 MR=ld("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),wm=ld("text"),TR=ld("nl"),Cc=ld("url",{isLink:!0,toHref(n=ql.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Gl&&n[1].t===Xo}}),Gs=n=>new Es(n);function ER({groups:n}){const e=n.domain.concat([Cu,Tu,po,Eu,Au,Ru,Pu,Iu,Js,Vh,Il,Lu,Ou,Nu,ki,$u,Ol,Du]),t=[Mu,Xo,jh,xi,Kh,Il,Ll,Gh,qh,gu,mu,Rl,Pl,fu,du,hu,pu,vu,bu,yu,wu,xu,ku,_u,Su],r=[Cu,Mu,Tu,Eu,Au,Ru,Pu,Iu,Js,Rl,Pl,Il,Lu,Ou,Nu,Ll,ki,$u,Ol,Du],s=Gs(),i=Re(s,Ol);Yt(i,r,i),Yt(i,n.domain,i);const o=Gs(),a=Gs(),c=Gs();Yt(s,n.domain,o),Yt(s,n.scheme,a),Yt(s,n.slashscheme,c),Yt(o,r,i),Yt(o,n.domain,o);const u=Re(o,po);Re(i,po,u),Re(a,po,u),Re(c,po,u);const d=Re(i,xi);Yt(d,r,i),Yt(d,n.domain,i);const f=Gs();Yt(u,n.domain,f),Yt(f,n.domain,f);const h=Re(f,xi);Yt(h,n.domain,f);const p=Gs(MR);Yt(h,n.tld,p),Yt(h,n.utld,p),Re(u,Gl,p);const g=Re(f,Js);Re(g,Js,g),Yt(g,n.domain,f),Yt(p,n.domain,f),Re(p,xi,h),Re(p,Js,g);const m=Re(o,Js),v=Re(o,xi);Re(m,Js,m),Yt(m,n.domain,o),Yt(v,r,i),Yt(v,n.domain,o);const C=Gs(Cc);Yt(v,n.tld,C),Yt(v,n.utld,C),Yt(C,n.domain,o),Yt(C,r,i),Re(C,xi,v),Re(C,Js,m),Re(C,po,u);const z=Re(C,Xo),M=Gs(Cc);Yt(z,n.numeric,M);const S=Gs(Cc),O=Gs();Yt(S,e,S),Yt(S,t,O),Yt(O,e,S),Yt(O,t,O),Re(C,ki,S),Re(M,ki,S);const N=Re(a,Xo),E=Re(c,Xo),D=Re(E,ki),ee=Re(D,ki);Yt(a,n.domain,o),Re(a,xi,v),Re(a,Js,m),Yt(c,n.domain,o),Re(c,xi,v),Re(c,Js,m),Yt(N,n.domain,S),Re(N,ki,S),Re(N,Ll,S),Yt(ee,n.domain,S),Yt(ee,e,S),Re(ee,ki,S);const U=[[Rl,Pl],[du,fu],[hu,pu],[gu,mu],[vu,bu],[yu,wu],[xu,ku],[_u,Su]];for(let oe=0;oe<U.length;oe++){const[F,W]=U[oe],X=Re(S,F);Re(O,F,X);const le=Gs(Cc);Yt(X,e,le);const re=Gs();Yt(X,t,re),Re(X,W,S),Yt(le,e,le),Yt(le,t,re),Yt(re,e,le),Yt(re,t,re),Re(le,W,S),Re(re,W,S)}return Re(s,Gl,C),Re(s,Wh,TR),{start:s,tokens:k0}}function AR(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(wm,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(wm,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 RR=typeof console<"u"&&console&&console.warn||(()=>{}),PR="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 IR(){return Es.groups={},Hn.scanner=null,Hn.parser=null,Hn.tokenQueue=[],Hn.pluginQueue=[],Hn.customSchemes=[],Hn.initialized=!1,Hn}function xm(n,e=!1){if(Hn.initialized&&RR(`linkifyjs: already initialized - will not register custom scheme "${n}" ${PR}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
135
135
  1. Must only contain digits, lowercase ASCII letters or "-"
136
136
  2. Cannot start or end with "-"
137
- 3. "-" cannot repeat`);Hn.customSchemes.push([n,e])}function IR(){Hn.scanner=_R(Hn.customSchemes);for(let n=0;n<Hn.tokenQueue.length;n++)Hn.tokenQueue[n][1]({scanner:Hn.scanner});Hn.parser=TR(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 Jh(n){return Hn.initialized||IR(),ER(Hn.parser.start,n,k0(Hn.scanner.start,n))}Jh.scan=k0;function S0(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 qh(t),s=Jh(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  ]",LR=new RegExp(cd),OR=new RegExp(`${cd}$`),NR=new RegExp(`${cd}+$`),DR=new RegExp(cd,"g");function $R(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(NR))===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 BR(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function zR(n){return new Tn({key:new Vn("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=Wy(t.doc,[...e]);if(!e.some(X2)){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=>$R(o,u,n.type))}if(sd(a).forEach(({newRange:c})=>{const u=UT(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(!OR.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(LR).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 m=Jh(p).map(v=>v.toObject(n.defaultProtocol));if(!BR(m))return!1;m.filter(v=>v.isLink).map(v=>({...v,from:g+v.start+1,to:g+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>n.validate(v.value)).filter(v=>n.shouldAutoLink(v.value)).forEach(v=>{id(v.from,v.to,r.doc).some(C=>C.mark.type===n.type)||o.addMark(v.from,v.to,n.type.create({href:v.href}))})}}),!!o.steps.length)return o}})}function FR(n){return new Tn({key:new Vn("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=qy(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 HR=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,UR=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function C0(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function VR(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&C0(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 M0(n,e,t){var r,s;const[,i,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||C0(n,(r=e.index)!==null&&r!==void 0?r:0)||VR(n,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&t(o)}function T0(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 WR(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function E0(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 jR(n){const e=ua({find:t=>{const r=HR.exec(t);return!r||!M0(t,r,n.isAllowedHref)?null:T0(r)},type:n.type,getAttributes:E0});return new ac({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 KR(n){const e=Ao({find:t=>{var r,s;const i=[];for(const a of t.matchAll(UR))M0(t,a,n.isAllowedHref)&&i.push(T0(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=>WR(c,a)));return[...i,...o]},type:n.type,getAttributes:E0});return new c0({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 GR(n){return new Tn({key:new Vn("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=S0(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 $i(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(DR,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const A0=pa.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"){wm(n);return}wm(n.scheme,n.optionalSlashes)})},onDestroy(){PR()},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)=>!!$i(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=>!!$i(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=>!!$i(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bn(this.options.HTMLAttributes,n),0]:["a",bn(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=>!!$i(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=>!!$i(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?[jR({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!$i(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;S0(e,{defaultProtocol:s}).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!$i(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?[KR({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!$i(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(zR({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!$i(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(FR({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(GR({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}});var qR=A0;const JR="listItem",xm="textStyle",km=/^\s*([-+*])\s$/,R0=br.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",bn(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(JR,this.editor.getAttributes(xm)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Wa({find:km,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Wa({find:km,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(xm),editor:this.editor})),[n]}}),XR=(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}},YR=(n,e,t,r)=>{const s=XR(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},QR=(n,e,t)=>YR(n.state,n.view.dispatch,e,t),P0=(n,e)=>jn.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>QR(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),I0=[[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"]],Mc="abcdefghijklmnopqrstuvwxyz",L0=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function ud(n){let e=n,t="";for(const[r,s]of I0)for(;e>=r;)t+=s,e-=r;return t}function Xh(n){return ud(n).toUpperCase()}function O0(n){const e=n.toLowerCase();let t=0,r=0;for(;t<e.length;){let s=!1;for(const[i,o]of I0)if(e.startsWith(o,t)){r+=i,t+=o.length,s=!0;break}if(!s)return 0}return r}function ZR(n){if(!/^[ivxlcdmIVXLCDM]+$/.test(n))return!1;const e=O0(n);return e<=0?!1:(n===n.toLowerCase()?ud(e):Xh(e))===n}function eP(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 Mc[n-1];const e=Math.floor((n-1)/26)-1,t=(n-1)%26;return e<0?Mc[t]:Mc[e]+Mc[t]}function dd(n){if(!(!n||/^\d+$/.test(n))){if(ZR(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 Yh(n){if(/^\d+$/.test(n))return parseInt(n,10);const e=dd(n);if(e==="i"||e==="I")return O0(n);if(e==="a"||e==="A"){const r=eP(n);return r>0?r:1}const t=parseInt(n,10);return Number.isNaN(t)?1:t}function tP(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 Xh(e);default:return String(e)}}function nP(n){var e;if(n.length===0)return!1;const t=(e=dd(n[0]))!==null&&e!==void 0?e:"numeric",r=Yh(n[0]);if(r<1)return!1;for(let s=0;s<n.length;s++){const i=tP(t,r+s);if(n[s]!==i)return!1}return!0}function rP(n){return{type:dd(n),start:Yh(n)}}function sP(n){const{type:e,start:t}=rP(n),r={};return e&&(r.type=e),t!==1&&(r.start=t),r}function iP(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`${Xh(r)}${t}`;default:return`${r}${t}`}}function oP(n){return!n[0]||n[0].type==="paragraph"?n:[{type:"paragraph",content:[]},...n]}function aP(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 lP="&nbsp;",_m=1,cP=n=>{var e;return((e=n?.level)!==null&&e!==void 0?e:_m)>_m};function uP(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 dP(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}const N0=br.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",bn(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(uP(n))return{type:"listItem",content:[{type:"paragraph",content:dP(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:oP(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 iP((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=o0(n,e,r,t,{alignNestedToPrefix:t?.parentType==="orderedList"});if(!aP(n)||!cP(t))return s;const i=r(t);return`${i}${lP}${s.slice(i.length)}`},addExtensions(){return[P0(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)}}}),Qh=(n,e)=>{const{$from:t}=e.selection,r=Tr(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}},D0=(n,e)=>{const t=Qh(n,e);if(!t)return!1;const[,r]=nE(e,n,t.$pos.pos+4);return r},fP=(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))},Sm=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!qi(n.state,e)&&fP(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(Je.create(d.doc,f+1)),!0}).command(({state:d,dispatch:f})=>(Ib(d,f),!0)).run()}if(!qi(n.state,e)||!aE(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()},hP=(n,e)=>{const t=D0(n,e),r=Qh(n,e);return!r||!t?!1:t>r.depth},pP=(n,e)=>{const t=D0(n,e),r=Qh(n,e);return!r||!t?!1:t<r.depth},Cm=(n,e)=>!qi(n.state,e)||!oE(n.state,e)||!n.state.selection.empty?!1:hP(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():pP(e,n.state)?n.commands.command(({state:t,dispatch:r})=>Lb(t,r)):n.commands.joinItemForward(),gP=(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||qi(r,e))return!1;const o=rE(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(Je.create(h.doc,f+1)),h.scrollIntoView()),!0))},$0=jn.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&&Cm(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&&Cm(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&&Sm(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&&Sm(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&&gP(n,e,t))return!0;return!1}}}}),zu=new RegExp(`^(\\s*)(${L0})([.)])\\s+(.*)$`),mP=/^\s/,La={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function vP(n){return zu.test(n.trimStart())}function bP(n){const e=n.trimStart();return La.bulletItem.test(e)||vP(e)||La.heading.test(e)||La.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||La.codeFence.test(e)||La.blockMath.test(e)}function yP(n){return Object.values(La).some(e=>e.test(n))}function wP(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&&bP(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function Mm(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)?Yh(a):f,g=[u];let m=t+1;const v=[s];let C=!1;for(;m<n.length;){const z=n[m];if(z.match(zu))break;if(z.trim()==="")v.push(z),g.push(""),C=!0,m+=1;else if(z.match(mP)){const M=z.length-z.trimStart().length,S=d+a.length+1;v.push(z),g.push(z.slice(Math.min(M,S))),m+=1}else{if(C||yP(z))break;v.push(z),g.push(z),m+=1}}e.push({indent:d,number:p,type:h,content:g.join(`
137
+ 3. "-" cannot repeat`);Hn.customSchemes.push([n,e])}function LR(){Hn.scanner=SR(Hn.customSchemes);for(let n=0;n<Hn.tokenQueue.length;n++)Hn.tokenQueue[n][1]({scanner:Hn.scanner});Hn.parser=ER(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 Xh(n){return Hn.initialized||LR(),AR(Hn.parser.start,n,_0(Hn.scanner.start,n))}Xh.scan=_0;function C0(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 Jh(t),s=Xh(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  ]",OR=new RegExp(cd),NR=new RegExp(`${cd}$`),DR=new RegExp(`${cd}+$`),$R=new RegExp(cd,"g");function BR(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(DR))===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 zR(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function FR(n){return new Tn({key:new Vn("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=jy(t.doc,[...e]);if(!e.some(Y2)){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=>BR(o,u,n.type))}if(sd(a).forEach(({newRange:c})=>{const u=VT(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(!NR.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(OR).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 m=Xh(p).map(v=>v.toObject(n.defaultProtocol));if(!zR(m))return!1;m.filter(v=>v.isLink).map(v=>({...v,from:g+v.start+1,to:g+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>n.validate(v.value)).filter(v=>n.shouldAutoLink(v.value)).forEach(v=>{id(v.from,v.to,r.doc).some(C=>C.mark.type===n.type)||o.addMark(v.from,v.to,n.type.create({href:v.href}))})}}),!!o.steps.length)return o}})}function HR(n){return new Tn({key:new Vn("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=Jy(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 UR=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,VR=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function M0(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function WR(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&M0(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 T0(n,e,t){var r,s;const[,i,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||M0(n,(r=e.index)!==null&&r!==void 0?r:0)||WR(n,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&t(o)}function E0(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 jR(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function A0(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 KR(n){const e=ca({find:t=>{const r=UR.exec(t);return!r||!T0(t,r,n.isAllowedHref)?null:E0(r)},type:n.type,getAttributes:A0});return new ac({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 GR(n){const e=Eo({find:t=>{var r,s;const i=[];for(const a of t.matchAll(VR))T0(t,a,n.isAllowedHref)&&i.push(E0(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=>jR(c,a)));return[...i,...o]},type:n.type,getAttributes:A0});return new u0({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 qR(n){return new Tn({key:new Vn("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=C0(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 $i(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($R,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const R0=ha.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"){xm(n);return}xm(n.scheme,n.optionalSlashes)})},onDestroy(){IR()},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)=>!!$i(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=>!!$i(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=>!!$i(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bn(this.options.HTMLAttributes,n),0]:["a",bn(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=>!!$i(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=>!!$i(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?[KR({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!$i(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;C0(e,{defaultProtocol:s}).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!$i(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?[GR({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!$i(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:n})]:[Eo({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(FR({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!$i(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(HR({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(qR({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}});var JR=R0;const XR="listItem",km="textStyle",_m=/^\s*([-+*])\s$/,P0=br.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",bn(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(XR,this.editor.getAttributes(km)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Va({find:_m,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Va({find:_m,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(km),editor:this.editor})),[n]}}),YR=(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}},QR=(n,e,t,r)=>{const s=YR(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,Se.from(u)),d.setSelection(i.map(d.doc,d.mapping)),e&&e(d),!0},ZR=(n,e,t)=>QR(n.state,n.view.dispatch,e,t),I0=(n,e)=>jn.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>ZR(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),L0=[[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"]],Mc="abcdefghijklmnopqrstuvwxyz",O0=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function ud(n){let e=n,t="";for(const[r,s]of L0)for(;e>=r;)t+=s,e-=r;return t}function Yh(n){return ud(n).toUpperCase()}function N0(n){const e=n.toLowerCase();let t=0,r=0;for(;t<e.length;){let s=!1;for(const[i,o]of L0)if(e.startsWith(o,t)){r+=i,t+=o.length,s=!0;break}if(!s)return 0}return r}function eP(n){if(!/^[ivxlcdmIVXLCDM]+$/.test(n))return!1;const e=N0(n);return e<=0?!1:(n===n.toLowerCase()?ud(e):Yh(e))===n}function tP(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 Mc[n-1];const e=Math.floor((n-1)/26)-1,t=(n-1)%26;return e<0?Mc[t]:Mc[e]+Mc[t]}function dd(n){if(!(!n||/^\d+$/.test(n))){if(eP(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 Qh(n){if(/^\d+$/.test(n))return parseInt(n,10);const e=dd(n);if(e==="i"||e==="I")return N0(n);if(e==="a"||e==="A"){const r=tP(n);return r>0?r:1}const t=parseInt(n,10);return Number.isNaN(t)?1:t}function nP(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 Yh(e);default:return String(e)}}function rP(n){var e;if(n.length===0)return!1;const t=(e=dd(n[0]))!==null&&e!==void 0?e:"numeric",r=Qh(n[0]);if(r<1)return!1;for(let s=0;s<n.length;s++){const i=nP(t,r+s);if(n[s]!==i)return!1}return!0}function sP(n){return{type:dd(n),start:Qh(n)}}function iP(n){const{type:e,start:t}=sP(n),r={};return e&&(r.type=e),t!==1&&(r.start=t),r}function oP(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`${Yh(r)}${t}`;default:return`${r}${t}`}}function aP(n){return!n[0]||n[0].type==="paragraph"?n:[{type:"paragraph",content:[]},...n]}function lP(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 cP="&nbsp;",Sm=1,uP=n=>{var e;return((e=n?.level)!==null&&e!==void 0?e:Sm)>Sm};function dP(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 fP(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}const D0=br.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",bn(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(dP(n))return{type:"listItem",content:[{type:"paragraph",content:fP(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:aP(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 oP((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=a0(n,e,r,t,{alignNestedToPrefix:t?.parentType==="orderedList"});if(!lP(n)||!uP(t))return s;const i=r(t);return`${i}${cP}${s.slice(i.length)}`},addExtensions(){return[I0(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)}}}),Zh=(n,e)=>{const{$from:t}=e.selection,r=Tr(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}},$0=(n,e)=>{const t=Zh(n,e);if(!t)return!1;const[,r]=rE(e,n,t.$pos.pos+4);return r},hP=(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))},Cm=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!qi(n.state,e)&&hP(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(Je.create(d.doc,f+1)),!0}).command(({state:d,dispatch:f})=>(Lb(d,f),!0)).run()}if(!qi(n.state,e)||!lE(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()},pP=(n,e)=>{const t=$0(n,e),r=Zh(n,e);return!r||!t?!1:t>r.depth},gP=(n,e)=>{const t=$0(n,e),r=Zh(n,e);return!r||!t?!1:t<r.depth},Mm=(n,e)=>!qi(n.state,e)||!aE(n.state,e)||!n.state.selection.empty?!1:pP(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():gP(e,n.state)?n.commands.command(({state:t,dispatch:r})=>Ob(t,r)):n.commands.joinItemForward(),mP=(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||qi(r,e))return!1;const o=sE(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,Se.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,Se.from(c)),h.setSelection(Je.create(h.doc,f+1)),h.scrollIntoView()),!0))},B0=jn.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&&Mm(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&&Mm(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&&Cm(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&&Cm(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&&mP(n,e,t))return!0;return!1}}}}),zu=new RegExp(`^(\\s*)(${O0})([.)])\\s+(.*)$`),vP=/^\s/,Ia={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function bP(n){return zu.test(n.trimStart())}function yP(n){const e=n.trimStart();return Ia.bulletItem.test(e)||bP(e)||Ia.heading.test(e)||Ia.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Ia.codeFence.test(e)||Ia.blockMath.test(e)}function wP(n){return Object.values(Ia).some(e=>e.test(n))}function xP(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&&yP(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function Tm(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)?Qh(a):f,g=[u];let m=t+1;const v=[s];let C=!1;for(;m<n.length;){const z=n[m];if(z.match(zu))break;if(z.trim()==="")v.push(z),g.push(""),C=!0,m+=1;else if(z.match(vP)){const M=z.length-z.trimStart().length,S=d+a.length+1;v.push(z),g.push(z.slice(Math.min(M,S))),m+=1}else{if(C||wP(z))break;v.push(z),g.push(z),m+=1}}e.push({indent:d,number:p,type:h,content:g.join(`
139
139
  `).trim(),contentLines:g,raw:v.join(`
140
- `)}),r=m,t=m}return[e,r]}const xP=new RegExp(`^(${L0})([.)])\\s+(.+)$`);function kP(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(xP);if(!s)return null;t.push({marker:s[1],content:s[3]})}return nP(t.map(r=>r.marker))?{type:"orderedList",attrs:sP(t[0].marker),content:t.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function B0(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}=wP(i.contentLines),c=o.join(`
140
+ `)}),r=m,t=m}return[e,r]}const kP=new RegExp(`^(${O0})([.)])\\s+(.+)$`);function _P(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(kP);if(!s)return null;t.push({marker:s[1],content:s[3]})}return rP(t.map(r=>r.marker))?{type:"orderedList",attrs:iP(t[0].marker),content:t.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function z0(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}=xP(i.contentLines),c=o.join(`
142
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=B0(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 _P(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 SP=64;function Tm(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 CP(n){const e=n.indexOf(`
146
- `),t=e===-1?n:n.slice(0,e);if(!zu.test(t))return[[],0,[]];let r=SP,s=Tm(n,r),i=Mm(s);for(;i[1]===s.length&&s.length===r;)r*=2,s=Tm(n,r),i=Mm(s);return[i[0],i[1],s]}const MP="listItem",Em="textStyle",Am=/^(\d+)\.\s$/;function Rm(n){const e=n.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const z0=br.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>{const e=n.getAttribute("type");if(e)return e;const t=n.getAttribute("style");if(t){const s=Rm(t);if(s)return s}const r=n.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=Rm(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,type:t,...r}=n,s=bn(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?_P(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]=CP(n);if(i.length===0)return;const c=B0(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(MP,this.editor.getAttributes(Em)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Tn({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=kP(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=Wa({find:Am,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:n});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Wa({find:Am,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Em)}),joinPredicate:n,editor:this.editor})),[e]}}),TP=/^\s*(\[([( |x])?\])\s$/,EP="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",AP=(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"}`},RP=br.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",bn(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 o0(n,e,r,void 0,{indentMainContent:!0})},addExtensions(){return this.options.nested?[P0(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=EP;const u=f=>{const h=AP(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 m=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...m?.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)),m=this.options.HTMLAttributes;return d.forEach(v=>{g.has(v)||(v in m?s.setAttribute(v,m[v]):s.removeAttribute(v))}),Object.entries(p).forEach(([v,C])=>{C==null?v in m?s.setAttribute(v,m[v]):s.removeAttribute(v):s.setAttribute(v,C)}),d=g,!0}}}},addInputRules(){return[Wa({find:TP,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),PP=br.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",bn(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=dm(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=dm(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()}}});jn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(R0.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(N0.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push($0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(z0.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(RP.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(PP.configure(this.options.taskList)),n}});const Tc="&nbsp;",Xd=" ",IP=br.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",bn(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===Tc||t[0].text===Tc||t[0].raw===Xd||t[0].text===Xd)&&r.length===1&&r[0].type==="text"&&(r[0].text===Tc||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?Tc:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),LP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,OP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,NP=pa.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",bn(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:LP,type:this.type})]},addPasteRules(){return[Ao({find:OP,type:this.type})]}}),DP=br.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),$P=pa.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",bn(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 BP(n={}){return new Tn({view(e){return new zP(e,n)}})}class zP{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(),m=f?g.bottom:g.top;f&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*a;r={left:g.left,right:g.right,top:m-v,bottom:m+v}}}}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=xb(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 Jt{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return rr.valid(r)?new rr(r):Jt.near(r)}content(){return je.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 Zh(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!FP(e)||!HP(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&&!bt.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;Jt.jsonID("gapcursor",rr);class Zh{constructor(e){this.pos=e}map(e){return new Zh(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return rr.valid(t)?new rr(t):Jt.near(t)}}function F0(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function FP(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||F0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function HP(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||F0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function UP(){return new Tn({props:{decorations:KP,createSelectionBetween(n,e,t){return e.pos==t.pos&&rr.valid(t)?new rr(t):null},handleClick:WP,handleKeyDown:VP,handleDOMEvents:{beforeinput:jP}}})}const VP=Ty({ArrowLeft:Ec("horiz",-1),ArrowRight:Ec("horiz",1),ArrowUp:Ec("vert",-1),ArrowDown:Ec("vert",1)});function Ec(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 Je){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 WP(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&&bt.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new rr(r))),!0)}function jP(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 je(s,0,0));return i.setSelection(Je.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function KP(n){if(!(n.selection instanceof rr))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",on.create(n.doc,[Or.widget(n.selection.head,e,{key:"gapcursor"})])}jn.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 Tn({key:new Vn("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 GP=jn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[BP(this.options)]}});jn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Tn({key:new Vn("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return on.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(Or.node(u,u+c.nodeSize,{class:this.options.className}))}),on.create(n,i)}}})]}});const qP=jn.create({name:"gapCursor",addProseMirrorPlugins(){return[UP()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=vn(dt(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),H0="placeholder",Pm=new Vn("tiptap__placeholder");function U0(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),Or.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:a}):t})}function V0(n,e){return typeof n=="function"?n(e):n}function W0({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&&oc(d);return d.type.isTextblock&&(h||!e.showOnlyCurrent)&&p&&c.push(U0({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:V0(e.emptyNodeClass,{editor:n,node:d,pos:f,hasAnchor:h})},node:d,pos:f})),e.includeChildren}),c}function j0({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&&oc(u)){const f=i>=d&&i<=d+u.nodeSize;o.push(U0({editor:n,isEmptyDoc:a,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:V0(e.emptyNodeClass,{editor:n,node:u,pos:d,hasAnchor:f})},node:u,pos:d}))}}else o.push(...W0({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:0,to:r.content.size}));return on.create(r,o)}function Nl(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 Dl(n,e){return{from:Math.max(0,e.from),to:Math.min(n.content.size,e.to)}}function JP(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 XP(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 YP(n,e){const t=JP(n,e.from,e.to);return t.push(Dl(n,Nl(n,e.from))),e.to>e.from?t.push(Dl(n,Nl(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(Dl(n,Nl(n,Math.min(e.from+1,n.content.size)))),t}function QP(n,e,t){const r=[];if(n.docChanged){const s=sd(n);for(const i of s)r.push(...YP(t.doc,i.newRange))}return n.selectionSet&&(r.push(Dl(t.doc,Nl(t.doc,n.mapping.map(e.selection.anchor)))),r.push(Dl(t.doc,Nl(t.doc,t.selection.anchor)))),XP(r)}function ZP(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 eI({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}=ZP(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=W0({editor:t,options:r,dataAttribute:s,doc:i,selection:o,from:u,to:d});h.length&&(a=a.add(i,h))}return a}function tI({editor:n,options:e,dataAttribute:t}){return{init(r,s){const i=j0({editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection});return i??on.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:eI({decorations:s.map(r.mapping,r.doc),ranges:QP(r,i,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function nI(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function rI({editor:n,options:e}){const t=e.dataAttribute?`data-${nI(e.dataAttribute)}`:`data-${H0}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Tn({key:Pm,...r?{}:{state:tI({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:s,selection:i})=>j0({editor:n,options:e,dataAttribute:t,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?on.empty:(i=Pm.getState(s))!==null&&i!==void 0?i:on.empty}}})}const sI=jn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:H0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[rI({editor:this.editor,options:this.options})]}});function Kf(n,e){return!n.selection.empty&&!Jy(n.selection)&&e.isEditable}function iI(n,e){return Kf(n,e)&&!e.isFocused&&!e.view.dragging}function oI(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function aI(n){n.focus()}jn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Tn({key:new Vn("selection"),props:{decorations(t){return iI(t,n)?on.create(t.doc,[Or.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return Kf(t.state,n)&&oI(),!1},focus(t){return Kf(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&aI(t)}),!1}}}})]}});function Im({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const lI=jn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Vn(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 Tn({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!Im({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Im({node:o,types:r})}}})]}}),cI=jn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Py(n,e),redo:()=>({state:n,dispatch:e})=>Iy(n,e)}},addProseMirrorPlugins(){return[J2(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()}}}),uI=jn.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(QA.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(GA.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(R0.configure(this.options.bulletList)),this.options.code!==!1&&n.push(nR.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(iR.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(oR.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(GP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(qP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(aR.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(lR.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(cI.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(cR.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(pR.configure(this.options.italic)),this.options.listItem!==!1&&n.push(N0.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push($0.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(A0.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(z0.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(IP.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(NP.configure(this.options.strike)),this.options.text!==!1&&n.push(DP.configure(this.options.text)),this.options.underline!==!1){var r;n.push($P.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;n.push(lI.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return n}});var dI=uI,fI=sI;function hI(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:a}=n,c=r&&!s,u=um(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 m=a.pos-g.length,v=Array.from(g.matchAll(p)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const C=v.input.slice(Math.max(0,v.index-1),v.index),z=new RegExp(`^[${i?.map(um).join("")}\0]?$`).test(C);if(i!==null&&!z)return null;const M=m+v.index;let S=M+v[0].length;return c&&d.test(g.slice(S-1,S+1))&&(v[0]+=" ",S+=1),M<a.pos&&S>=a.pos?{range:{from:M,to:S},query:v[0].slice(t.length),text:v[0]}:null}function pI(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 gI(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 mI(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}:gI(n)}function vI({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&&!pI(r)}function bI({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function yI({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),on.create(a.doc,[Or.inline(u.from,u.to,{nodeName:e,class:p.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":r})])}}}function wI({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:m}=n,{composing:v}=n.view,{selection:C}=f,{empty:z,from:M}=C,S={...h},O=f.getMeta(d);if(O&&O.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=v,f.docChanged&&S.dismissedRange!==null&&(S.dismissedRange={from:f.mapping.map(S.dismissedRange.from),to:f.mapping.map(S.dismissedRange.to)}),m&&(z||n.view.composing)){(M<h.range.from||M>h.range.to)&&!v&&!h.composing&&(S.active=!1);const N=o({char:e,allowSpaces:t,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:C.$from}),E=`id_${Math.floor(Math.random()*4294967295)}`;N&&a({editor:n,state:g,range:N.range,isActive:h.active})&&(!c||c({editor:n,range:N.range,query:N.query,text:N.text,transaction:f}))?(S.dismissedRange!==null&&!u({match:N,dismissedRange:S.dismissedRange,state:g,transaction:f})&&(S.dismissedRange=null),S.dismissedRange===null?(S.active=!0,S.decorationId=h.decorationId||E,S.range=N.range,S.query=N.query,S.text=N.text):S.active=!1):(N||(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 xI({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 kI({placement:n,offset:e,flip:t,floatingUi:r}){var s,i,o,a;const c=[lk({mainAxis:(s=e.mainAxis)!==null&&s!==void 0?s:4,crossAxis:(i=e.crossAxis)!==null&&i!==void 0?i:0})];return t&&c.push(ck()),!(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 _I(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 SI({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&&_I(r).appendChild(o),a.onPosition||(o.style.visibility="hidden",o.style.width="max-content");const h=uk(c,o,()=>{dk(c,o,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:g,y:m,placement:v,strategy:C})=>{if(a.onPosition){a.onPosition({x:g,y:m,placement:v,strategy:C});return}Object.assign(o.style,{position:C,left:`${g}px`,top:`${m}px`}),u||(u=!0,o.style.visibility="")})},a.autoUpdate);let p;return s&&(p=g=>{const m=g.target;!(m instanceof Node)||o.contains(m)||e.contains(m)||i()},document.addEventListener("pointerdown",p,!0)),()=>{h(),p&&document.removeEventListener("pointerdown",p,!0),d&&o.remove()}}}function CI({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:m}){let v;const C=xI({editor:n,items:t}),z=kI({placement:a,offset:c,flip:d,floatingUi:f});function M(S,O){switch(S){case"started":var N;r==null||(N=r.onStart)===null||N===void 0||N.call(r,O);break;case"updated":var E;r==null||(E=r.onUpdate)===null||E===void 0||E.call(r,O);break;case"stopped":var D;r==null||(D=r.onExit)===null||D===void 0||D.call(r,O)}}return{update:async(S,O)=>{var N,E;const D=e.getState(O),ee=e.getState(S.state);if(!D||!ee)return;let U=null;const oe=D.query!==ee.query,F=D.text!==ee.text,W=D.range.from!==ee.range.from||D.range.to!==ee.range.to,X=oe||F||W;if(!D.active&&ee.active)U="started";else if(D.active&&!ee.active)U="stopped";else if(ee.active&&X)U="updated";else return;const le=U==="stopped"?D:ee,re=S.dom.querySelector(`[data-decoration-id="${le.decorationId}"]`),Q=g(S,re),me=s===0||(le.query?le.query.length>=s:!1),P=(U==="started"||U==="updated")&&me;if(v={editor:n,range:le.range,query:le.query||"",text:le.text||"",items:o??[],command:pe=>p({editor:n,range:le.range,props:pe}),decorationNode:re,clientRect:Q,loading:P,placement:a,offset:{mainAxis:(N=c.mainAxis)!==null&&N!==void 0?N:4,crossAxis:(E=c.crossAxis)!==null&&E!==void 0?E:0},container:u,flip:d,floatingUi:z,mount:SI({getReferenceRect:Q,contextElement:S.dom,config:z,container:u,dismissOnOutsideClick:h,dismiss:()=>m(n.view)})},U==="started"){var $;r==null||($=r.onBeforeStart)===null||$===void 0||$.call(r,v)}if(U==="updated"){var ce;r==null||(ce=r.onBeforeUpdate)===null||ce===void 0||ce.call(r,v)}if(U==="started"&&M(U,v),U==="started"||U==="updated")if(!P)C.abort(),v={...v,items:o??[],loading:!1};else{v={...v,items:o??[],loading:!0},U="updated",M(U,v);const pe=await C.fetch(le.query||"",i);if(pe.status==="aborted")return;const ye=e.getState(S.state);if(!ye?.active){C.abort();return}v=pe.status==="resolved"?{...v,items:pe.items,loading:!1}:{...v,loading:!1}}if(U==="stopped"){C.abort(),M(U,v),v=void 0;return}U==="updated"&&M(U,v)},destroy:()=>{var S;C.abort(),v&&(r==null||(S=r.onExit)===null||S===void 0||S.call(r,v))}}}const MI=new Vn("suggestion");function TI({pluginKey:n=MI,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:m,placement:v="bottom-start",offset:C={},container:z,flip:M=!0,floatingUi:S,dismissOnOutsideClick:O=!0,render:N=()=>({}),allow:E=()=>!0,findSuggestionMatch:D=hI,shouldShow:ee,shouldResetDismissed:U}){const oe=N?.(),F=r&&!s,W=(re,Q)=>mI(e,re,Q,n);function X(re){return vI({...re,editor:e,shouldResetDismissed:U,effectiveAllowSpaces:F})}const le=re=>bI({view:re,pluginKeyRef:n});return new Tn({key:n,view:()=>CI({editor:e,pluginKey:n,items:h,renderer:oe,minQueryLength:p,debounce:g,initialItems:m,placement:v,offset:C,container:z,flip:M,floatingUi:S,dismissOnOutsideClick:O,command:f,clientRectFor:W,dispatchExit:le}),state:wI({editor:e,char:t,effectiveAllowSpaces:F,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:D,allow:E,shouldShow:ee,shouldKeepDismissed:X,pluginKey:n}),props:yI({pluginKey:n,decorationTag:a,decorationClass:c,decorationContent:u,decorationEmptyClass:d,renderer:oe,dispatchExit:le})})}function EI({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){return{editor:n,char:r,pluginKey:new Vn,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 K0(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>EI({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function Lm(n,e){const t=K0(n),r=t.find(s=>s.char===e);return r||(t.length?t[0]:null)}const AI=br.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",bn(this.HTMLAttributes,n.HTMLAttributes),`${(r=t?.char)!==null&&r!==void 0?r:"@"}${(s=e.attrs.label)!==null&&s!==void 0?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=Lm(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bn({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=bn({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof s=="string"?["span",bn({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...fA({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(?:^|\s)(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,i,o]=r;e[s==="char"?"mentionSuggestionChar":s]=i??o,r=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:Lm(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:s,anchor:i}=r;if(!s)return!1;let o=new 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 K0(this).map(TI)}});var RI=AI;const PI=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,II=br.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",bn(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=bn(this.options.HTMLAttributes,a);Object.entries(d).forEach(([C,z])=>{if(z!=null)switch(C){case"src":case"width":case"height":break;default:u.setAttribute(C,z)}}),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 z=c.extensionManager.attributes.filter(S=>S.type===C.type.name),M=ca(C,z);return Object.keys(f).forEach(S=>{!s.has(S)&&!(S in M)&&u.removeAttribute(S)}),Object.entries(M).forEach(([S,O])=>{s.has(S)||(O!=null?u.setAttribute(S,O):u.removeAttribute(S))}),h(M.src),f=M,!0},g=new UA({element:u,editor:c,node:i,getPos:o,onResize:(C,z)=>{u.style.width=`${C}px`,u.style.height=`${z}px`},onCommit:(C,z)=>{const M=o();M!==void 0&&this.editor.chain().setNodeSelection(M).updateAttributes(this.name,{width:C,height:z}).run()},onUpdate:p,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),m=g.dom,v=()=>{m.style.visibility="",m.style.pointerEvents=""};return m.style.visibility="hidden",m.style.pointerEvents="none",u.complete&&u.naturalWidth>0?v():(u.onload=v,u.onerror=v),g}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[d0({find:PI,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var LI=II;const G0="TipTapNodeView";class OI{constructor(e,{element:t,props:r}){rt(this,"component");rt(this,"props");rt(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 NI extends VA{mount(){const e=this.component,t=Sr({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 fk;r.set(G0,{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=kl(e,{target:i,props:t,context:r});this.renderer=new OI(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 ep(n,e){return t=>new NI(n,t,e)}var DI=new Set(["$$slots","$$events","$$legacy","as","children"]);function fd(n,e){if(new.target)return Ot({component:fd,...n});It(e,!0);const t=y(e,"as",7,"div"),r=y(e,"children",7),s=Yi(e,DI),i=Jw(G0);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:Nt,$on:(d,f)=>Dt(e,d,f)},c=Ze(),u=ue(c);return gk(u,t,!1,(d,f)=>{sr(d,m=>o=m,()=>o),Ga(d,()=>({"data-node-view-wrapper":"",role:"none",...s,ondragstart:i?.onDragStart}));var h=Ze(),p=ue(h);{var g=m=>{var v=Ze(),C=ue(v);Xn(C,r),x(m,v)};j(p,m=>{r()&&m(g)})}x(f,h)}),x(n,c),Lt(a)}var $I=B('<div class="flex items-center gap-2" contenteditable="false"><!> <!></div>'),BI=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),zI=B('<div class="group relative inline-block max-w-full"><!></div>'),FI=B("<!> <!>",1);function q0(n,e){if(new.target)return Ot({component:q0,...n});It(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(()=>gx(l(o),l(f))?.mimeType),p=w(()=>Gu(l(o))),g=w(()=>mx(l(o),l(f))),m=w(()=>l(p)?.path??l(g)?.path),v=w(()=>l(p)?.workspaceId??l(g)?.workspaceId??l(f));function C(N){N.preventDefault(),N.stopPropagation(),k(u,N.currentTarget instanceof HTMLElement?N.currentTarget:s().view.dom,!0),k(c,!0)}var z={get node(){return t()},set node(N){t(N),b()},get selected(){return r()},set selected(N){r(N),b()},get editor(){return s()},set editor(N){s(N),b()},get extension(){return i()},set extension(N){i(N),b()},$set:Nt,$on:(N,E)=>Dt(e,N,E)},M=FI(),S=ue(M);{let N=w(()=>`note-video-node${r()?" selected":""}`);fd(S,{get class(){return l(N)},children:(E,D)=>{var ee=zI(),U=ne(ee);{var oe=W=>{var X=$I(),le=ne(X);qv(le,{get name(){return l(a)},reason:"load-failed",get path(){return l(m)},get workspaceId(){return l(v)}});var re=A(le,2);Yc(re,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Y(X),x(W,X)},F=W=>{var X=BI(),le=ue(X),re=A(le,2),Q=ne(re);{let P=w(()=>_.chat_videoBlock_play_ariaLabel({name:l(a)}));qe(Q,{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:($,ce)=>{tt($,{get icon(){return _1},size:"sm"})},$$slots:{default:!0}})}var me=A(Q,2);Yc(me,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Y(re),L(()=>{st(le,"src",l(o)),st(le,"aria-label",l(a))}),To("error",le,()=>k(d,l(o),!0)),x(W,X)};j(U,W=>{l(d)===l(o)?W(oe):W(F,-1)})}Y(ee),x(E,ee)},$$slots:{default:!0}})}var O=A(S,2);return Gv(O,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace",get openerElement(){return l(u)},get open(){return l(c)},set open(N){k(c,N,!0)}}),x(n,M),Lt(z)}const HI=br.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",bn(n,{class:"markdown-video",controls:"",preload:"metadata",playsinline:""})]},addNodeView(){return ep(q0)}}),UI={note:"internal","linear-issue":"linear","github-issue":"github","github-pr":"github","sentry-issue":"sentry","browser-url":"browser"};var Om=B("<span><!></span>");function Gf(n,e){if(new.target)return Ot({component:Gf,...n});It(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()?UI[r()]:"internal"));var a={get provider(){return t()},set provider(m){t(m),b()},get itemType(){return r()},set itemType(m){r(m),b()},get size(){return s()},set size(m=16){s(m),b()},get class(){return i()},set class(m=""){i(m),b()},$set:Nt,$on:(m,v)=>Dt(e,m,v)},c=Ze(),u=ue(c);{var d=m=>{Uk(m,{get size(){return s()},get class(){return i()}})},f=m=>{hh(m,{get size(){return s()},get class(){return i()}})},h=m=>{Vk(m,{get size(){return s()},get class(){return i()}})},p=m=>{var v=Om(),C=ne(v);tt(C,{get icon(){return eh},get size(){return`${s()??""}px`}}),Y(v),L(()=>{at(v,1,$n(i())),Gi(v,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),x(m,v)},g=m=>{var v=Om(),C=ne(v);tt(C,{get icon(){return th},get size(){return`${s()??""}px`}}),Y(v),L(()=>{at(v,1,$n(i())),Gi(v,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),x(m,v)};j(u,m=>{l(o)==="linear"?m(d):l(o)==="github"?m(f,1):l(o)==="sentry"?m(h,2):l(o)==="browser"?m(p,3):m(g,-1)})}return x(n,c),Lt(a)}function mo(n,e){if(new.target)return Ot({component:mo,...n});It(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:Nt,$on:(i,o)=>Dt(e,i,o)};return S1(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Lt(s)}var VI=B('<span class="text-subtle shrink-0"> </span>'),WI=B('<span><!> <!> <span class="max-w-[180px] truncate"> </span></span>'),jI=B('<span class="text-ui font-medium text-subtle">·</span> <span class="text-ui font-medium text-subtle"> </span>',1),KI=B('<div class="text-sm font-medium text-foreground leading-snug"> </div>'),Ac=B("<span> </span>"),GI=B('<span class="text-ui"> </span>'),Rc=B('<span class="text-ui text-subtle"> </span>'),qI=B('<div class="flex flex-wrap items-center gap-1.5"><!> <!> <!> <!></div>'),JI=B('<span class="px-1.5 py-0.5 rounded-full text-ui font-medium bg-muted/50 text-subtle"> </span>'),XI=B('<div class="flex flex-wrap gap-1"><!> <!></div>'),YI=B('<div class="flex items-center gap-3 text-ui text-subtle"><!> <!></div>'),QI=B('<div class="text-xs text-subtle line-clamp-6"> </div>'),ZI=B('<span class="text-ui text-subtle ml-auto"> </span>'),eL=B('<div class="flex items-center gap-2 pt-1 border-t border-border"><!> <!> <!></div>'),tL=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>'),nL=Xi('<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>'),rL=B('<span class="context-mention-wrapper group/pill relative inline-flex items-center svelte-1qhjkt1"><!> <!></span> <!>',1);function J0(n,e){if(new.target)return Ot({component:J0,...n});It(e,!0);const t=mk()?.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);ct(()=>{const W=X=>{k(o,X.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),m=w(()=>()=>{const W=r().attrs.metadata;if(!W)return null;try{return JSON.parse(W)}catch{return null}}),v=w(()=>()=>{if(l(u)==="github"&&l(h)){const W=l(h).match(/^([^/]+)\/([^#]+)#(\d+)$/);if(W){const[,X,le,re]=W,me=!!l(m)()?.sourceBranch?"pull":"issues";return`https://github.com/${X}/${le}/${me}/${re}`}}return l(p)}),C=w(()=>()=>{const W=l(m)()?.sourceBranch;return W&&W.length>0?W:null}),z=w(()=>l(u)==="github"&&(l(d)==="github-pr"||l(d)==="github-issue")&&l(C)()!==null),M=w(()=>l(a)&&l(z)&&l(C)()&&l(C)()!==l(o));function S(W){W.preventDefault(),W.stopPropagation();const X=l(C)();if(X){const le=new CustomEvent("switch-to-pr-branch",{detail:{branch:X,prIdentifier:l(h)},bubbles:!0});document.dispatchEvent(le)}}function O(W){return W?d1(W,{style:"narrow"}):""}function N(W){if(!W)return"bg-muted text-subtle";const X=W.toLowerCase();return X.includes("progress")||X.includes("active")||X.includes("open")?"bg-blue-500/15 text-blue-500":X.includes("done")||X.includes("resolved")||X.includes("closed")||X.includes("complete")?"bg-green-500/15 text-green-500":X.includes("backlog")||X.includes("todo")||X.includes("triage")?"bg-muted text-subtle":X.includes("block")||X.includes("error")||X.includes("cancel")?"bg-red-500/15 text-red-500":"bg-muted text-subtle"}function E(W){if(!W)return null;const X=W.toLowerCase();return X.includes("urgent")||X==="1"?{color:"bg-red-500",label:"🔴"}:X.includes("high")||X==="2"?{color:"bg-orange-500",label:"🟠"}:X.includes("medium")||X==="3"?{color:"bg-warning",label:"🟡"}:X.includes("low")||X==="4"?{color:"bg-blue-500",label:"🔵"}:null}function D(W){if(!W)return"";const X=W.toLowerCase();return X==="error"||X==="fatal"?"text-danger":X==="warning"?"text-warning-ink":"text-subtle"}const ee=w(()=>()=>l(d)==="browser-url"?l(f)||l(v)():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 oe(W){W.preventDefault(),W.stopPropagation();const X=l(v)();X&&t&&await oh(X,{workspaceId:Sv(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:Nt,$on:(W,X)=>Dt(e,W,X)};return fd(n,{as:"span",class:"inline",children:(W,X)=>{var le=rL(),re=ue(le),Q=ne(re);dh(Q,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"20rem",trigger:ye=>{var Z=WI(),ae=ne(Z);Gf(ae,{get provider(){return l(u)},size:12,class:"shrink-0 opacity-30"});var V=A(ae,2);{var K=ve=>{var de=VI(),fe=se(de,!0);L(()=>H(fe,l(h))),x(ve,de)};j(V,ve=>{l(h)&&l(d)!=="browser-url"&&ve(K)})}var I=A(V,2),te=se(I,!0);Y(Z),L(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(m)()),ae=w(()=>l(Z)?E(l(Z).priority):null);var V=tL(),K=ne(V),I=ne(K);Gf(I,{get provider(){return l(u)},size:10,class:"opacity-40"});var te=A(I,2),ve=se(te,!0),de=A(te,2);{var fe=Pe=>{var Ce=jI(),we=A(ue(Ce),2),Ve=se(we,!0);L(()=>H(Ve,l(h))),x(Pe,Ce)};j(de,Pe=>{l(h)&&l(d)!=="browser-url"&&Pe(fe)})}Y(K);var ke=A(K,2);{var be=Pe=>{var Ce=KI(),we=se(Ce,!0);L(()=>H(we,l(f))),x(Pe,Ce)};j(ke,Pe=>{l(f)&&Pe(be)})}var q=A(ke,2);{var Me=Pe=>{var Ce=qI(),we=ne(Ce);{var Ve=Tt=>{var We=Ac(),Ge=se(We,!0);L(Yt=>{at(We,1,`px-1.5 py-0.5 rounded text-ui font-medium ${Yt??""}`,"svelte-1qhjkt1"),H(Ge,l(Z).state)},[()=>N(l(Z).state)]),x(Tt,We)};j(we,Tt=>{l(Z).state&&Tt(Ve)})}var Mt=A(we,2);{var ie=Tt=>{var We=GI(),Ge=se(We,!0);L(()=>H(Ge,l(ae).label)),x(Tt,We)};j(Mt,Tt=>{l(ae)&&Tt(ie)})}var $e=A(Mt,2);{var lt=Tt=>{var We=Ac(),Ge=se(We,!0);L(Yt=>{at(We,1,`text-ui font-medium ${Yt??""}`,"svelte-1qhjkt1"),H(Ge,l(Z).level)},[()=>D(l(Z).level)]),x(Tt,We)};j($e,Tt=>{l(Z).level&&l(u)==="sentry"&&Tt(lt)})}var yt=A($e,2);{var mt=Tt=>{var We=Rc(),Ge=se(We);L(()=>H(Ge,`→ ${l(Z).assignee??""}`)),x(Tt,We)};j(yt,Tt=>{l(Z).assignee&&Tt(mt)})}Y(Ce),x(Pe,Ce)};j(q,Pe=>{l(Z)&&(l(Z).state||l(ae)||l(Z).assignee)&&Pe(Me)})}var ze=A(q,2);{var gt=Pe=>{var Ce=XI(),we=ne(Ce);ss(we,17,()=>l(Z).labels.split(",").map($e=>$e.trim()).filter(Boolean).slice(0,5),Nc,($e,lt)=>{var yt=JI(),mt=se(yt,!0);L(()=>H(mt,l(lt))),x($e,yt)});var Ve=A(we,2);{var Mt=$e=>{var lt=Rc(),yt=se(lt);L(mt=>H(yt,`+${mt??""}`),[()=>l(Z).labels.split(",").length-5]),x($e,lt)},ie=w(()=>l(Z).labels.split(",").length>5);j(Ve,$e=>{l(ie)&&$e(Mt)})}Y(Ce),x(Pe,Ce)};j(ze,Pe=>{l(Z)?.labels&&Pe(gt)})}var Le=A(ze,2);{var De=Pe=>{var Ce=YI(),we=ne(Ce);{var Ve=$e=>{var lt=Ac(),yt=se(lt,!0);L(mt=>H(yt,mt),[()=>_.tiptap_contextMention_events_label({count:l(Z).count})]),x($e,lt)};j(we,$e=>{l(Z).count&&$e(Ve)})}var Mt=A(we,2);{var ie=$e=>{var lt=Ac(),yt=se(lt,!0);L(mt=>H(yt,mt),[()=>_.tiptap_contextMention_users_label({count:l(Z).userCount})]),x($e,lt)};j(Mt,$e=>{l(Z).userCount&&$e(ie)})}Y(Ce),x(Pe,Ce)};j(Le,Pe=>{l(Z)&&l(u)==="sentry"&&(l(Z).count||l(Z).userCount)&&Pe(De)})}var Fe=A(Le,2);{var vt=Pe=>{var Ce=QI(),we=se(Ce,!0);L(()=>H(we,l(g))),x(Pe,Ce)};j(Fe,Pe=>{l(g)&&Pe(vt)})}var Vt=A(Fe,2);{var nt=Pe=>{var Ce=eL(),we=ne(Ce);{var Ve=yt=>{var mt=Rc(),Tt=se(mt,!0);L(()=>H(Tt,l(Z).project)),x(yt,mt)};j(we,yt=>{l(Z).project&&yt(Ve)})}var Mt=A(we,2);{var ie=yt=>{var mt=Rc(),Tt=se(mt,!0);L(We=>H(Tt,We),[()=>_.tiptap_contextMention_byAuthor_label({author:l(Z).author})]),x(yt,mt)};j(Mt,yt=>{l(Z).author&&yt(ie)})}var $e=A(Mt,2);{var lt=yt=>{var mt=ZI(),Tt=se(mt,!0);L(We=>H(Tt,We),[()=>O(l(Z).createdAt)]),x(yt,mt)};j($e,yt=>{l(Z).createdAt&&yt(lt)})}Y(Ce),x(Pe,Ce)};j(Vt,Pe=>{l(Z)&&(l(Z).project||l(Z).createdAt||l(Z).author)&&Pe(nt)})}Y(V),L(Pe=>H(ve,Pe),[()=>l(U)()]),x(ye,V)},$$slots:{trigger:!0,content:!0}});var me=A(Q,2);{let ce=w(()=>s()?"bg-primary/20 hover:bg-primary/30":"bg-muted/60 hover:bg-muted"),pe=w(()=>_.tiptap_contextMention_remove_ariaLabel());qe(me,{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
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=z0(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 SP(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 CP=64;function Em(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 MP(n){const e=n.indexOf(`
146
+ `),t=e===-1?n:n.slice(0,e);if(!zu.test(t))return[[],0,[]];let r=CP,s=Em(n,r),i=Tm(s);for(;i[1]===s.length&&s.length===r;)r*=2,s=Em(n,r),i=Tm(s);return[i[0],i[1],s]}const TP="listItem",Am="textStyle",Rm=/^(\d+)\.\s$/;function Pm(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 F0=br.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=Pm(t);if(s)return s}const r=n.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=Pm(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,type:t,...r}=n,s=bn(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?SP(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]=MP(n);if(i.length===0)return;const c=z0(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(TP,this.editor.getAttributes(Am)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Tn({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=_P(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=Va({find:Rm,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:n});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Va({find:Rm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Am)}),joinPredicate:n,editor:this.editor})),[e]}}),EP=/^\s*(\[([( |x])?\])\s$/,AP="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",RP=(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"}`},PP=br.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",bn(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 a0(n,e,r,void 0,{indentMainContent:!0})},addExtensions(){return this.options.nested?[I0(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=AP;const u=f=>{const h=RP(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 m=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...m?.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=la(f,h),g=new Set(Object.keys(p)),m=this.options.HTMLAttributes;return d.forEach(v=>{g.has(v)||(v in m?s.setAttribute(v,m[v]):s.removeAttribute(v))}),Object.entries(p).forEach(([v,C])=>{C==null?v in m?s.setAttribute(v,m[v]):s.removeAttribute(v):s.setAttribute(v,C)}),d=g,!0}}}},addInputRules(){return[Va({find:EP,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),IP=br.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",bn(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=fm(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=fm(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()}}});jn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(P0.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(D0.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(B0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(F0.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(PP.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(IP.configure(this.options.taskList)),n}});const Tc="&nbsp;",Xd=" ",LP=br.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",bn(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===Tc||t[0].text===Tc||t[0].raw===Xd||t[0].text===Xd)&&r.length===1&&r[0].type==="text"&&(r[0].text===Tc||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?Tc:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),OP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,NP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,DP=ha.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",bn(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[ca({find:OP,type:this.type})]},addPasteRules(){return[Eo({find:NP,type:this.type})]}}),$P=br.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),BP=ha.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",bn(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 zP(n={}){return new Tn({view(e){return new FP(e,n)}})}class FP{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(),m=f?g.bottom:g.top;f&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*a;r={left:g.left,right:g.right,top:m-v,bottom:m+v}}}}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=kb(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 Jt{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return rr.valid(r)?new rr(r):Jt.near(r)}content(){return je.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 ep(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!HP(e)||!UP(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&&!bt.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;Jt.jsonID("gapcursor",rr);class ep{constructor(e){this.pos=e}map(e){return new ep(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return rr.valid(t)?new rr(t):Jt.near(t)}}function H0(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function HP(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||H0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function UP(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||H0(s.type))return!0;if(s.inlineContent)return!1}}return!0}function VP(){return new Tn({props:{decorations:GP,createSelectionBetween(n,e,t){return e.pos==t.pos&&rr.valid(t)?new rr(t):null},handleClick:jP,handleKeyDown:WP,handleDOMEvents:{beforeinput:KP}}})}const WP=Ey({ArrowLeft:Ec("horiz",-1),ArrowRight:Ec("horiz",1),ArrowUp:Ec("vert",-1),ArrowDown:Ec("vert",1)});function Ec(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 Je){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 jP(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&&bt.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new rr(r))),!0)}function KP(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=Se.empty;for(let o=r.length-1;o>=0;o--)s=Se.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new je(s,0,0));return i.setSelection(Je.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function GP(n){if(!(n.selection instanceof rr))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",an.create(n.doc,[Or.widget(n.selection.head,e,{key:"gapcursor"})])}jn.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 Tn({key:new Vn("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 qP=jn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[zP(this.options)]}});jn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Tn({key:new Vn("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return an.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(Or.node(u,u+c.nodeSize,{class:this.options.className}))}),an.create(n,i)}}})]}});const JP=jn.create({name:"gapCursor",addProseMirrorPlugins(){return[VP()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=vn(dt(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),U0="placeholder",Im=new Vn("tiptap__placeholder");function V0(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),Or.node(s,s+i.nodeSize,{class:d.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:a}):t})}function W0(n,e){return typeof n=="function"?n(e):n}function j0({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&&oc(d);return d.type.isTextblock&&(h||!e.showOnlyCurrent)&&p&&c.push(V0({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:W0(e.emptyNodeClass,{editor:n,node:d,pos:f,hasAnchor:h})},node:d,pos:f})),e.includeChildren}),c}function K0({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&&oc(u)){const f=i>=d&&i<=d+u.nodeSize;o.push(V0({editor:n,isEmptyDoc:a,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:W0(e.emptyNodeClass,{editor:n,node:u,pos:d,hasAnchor:f})},node:u,pos:d}))}}else o.push(...j0({editor:n,options:e,dataAttribute:t,doc:r,selection:s,from:0,to:r.content.size}));return an.create(r,o)}function Nl(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 Dl(n,e){return{from:Math.max(0,e.from),to:Math.min(n.content.size,e.to)}}function XP(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 YP(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 QP(n,e){const t=XP(n,e.from,e.to);return t.push(Dl(n,Nl(n,e.from))),e.to>e.from?t.push(Dl(n,Nl(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(Dl(n,Nl(n,Math.min(e.from+1,n.content.size)))),t}function ZP(n,e,t){const r=[];if(n.docChanged){const s=sd(n);for(const i of s)r.push(...QP(t.doc,i.newRange))}return n.selectionSet&&(r.push(Dl(t.doc,Nl(t.doc,n.mapping.map(e.selection.anchor)))),r.push(Dl(t.doc,Nl(t.doc,t.selection.anchor)))),YP(r)}function eI(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 tI({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}=eI(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=j0({editor:t,options:r,dataAttribute:s,doc:i,selection:o,from:u,to:d});h.length&&(a=a.add(i,h))}return a}function nI({editor:n,options:e,dataAttribute:t}){return{init(r,s){const i=K0({editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection});return i??an.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:tI({decorations:s.map(r.mapping,r.doc),ranges:ZP(r,i,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function rI(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function sI({editor:n,options:e}){const t=e.dataAttribute?`data-${rI(e.dataAttribute)}`:`data-${U0}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Tn({key:Im,...r?{}:{state:nI({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:s,selection:i})=>K0({editor:n,options:e,dataAttribute:t,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?an.empty:(i=Im.getState(s))!==null&&i!==void 0?i:an.empty}}})}const iI=jn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:U0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[sI({editor:this.editor,options:this.options})]}});function Gf(n,e){return!n.selection.empty&&!Xy(n.selection)&&e.isEditable}function oI(n,e){return Gf(n,e)&&!e.isFocused&&!e.view.dragging}function aI(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function lI(n){n.focus()}jn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Tn({key:new Vn("selection"),props:{decorations(t){return oI(t,n)?an.create(t.doc,[Or.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return Gf(t.state,n)&&aI(),!1},focus(t){return Gf(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&lI(t)}),!1}}}})]}});function Lm({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const cI=jn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new Vn(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 Tn({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!Lm({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Lm({node:o,types:r})}}})]}}),uI=jn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Iy(n,e),redo:()=>({state:n,dispatch:e})=>Ly(n,e)}},addProseMirrorPlugins(){return[X2(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()}}}),dI=jn.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(ZA.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(qA.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(P0.configure(this.options.bulletList)),this.options.code!==!1&&n.push(rR.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(oR.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(aR.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(qP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(JP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(lR.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(cR.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(uI.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(uR.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(gR.configure(this.options.italic)),this.options.listItem!==!1&&n.push(D0.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push(B0.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(R0.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(F0.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(LP.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(DP.configure(this.options.strike)),this.options.text!==!1&&n.push($P.configure(this.options.text)),this.options.underline!==!1){var r;n.push(BP.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;n.push(cI.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return n}});var fI=dI,hI=iI;function pI(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:a}=n,c=r&&!s,u=dm(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 m=a.pos-g.length,v=Array.from(g.matchAll(p)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const C=v.input.slice(Math.max(0,v.index-1),v.index),z=new RegExp(`^[${i?.map(dm).join("")}\0]?$`).test(C);if(i!==null&&!z)return null;const M=m+v.index;let S=M+v[0].length;return c&&d.test(g.slice(S-1,S+1))&&(v[0]+=" ",S+=1),M<a.pos&&S>=a.pos?{range:{from:M,to:S},query:v[0].slice(t.length),text:v[0]}:null}function gI(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 mI(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 vI(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}:mI(n)}function bI({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&&!gI(r)}function yI({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function wI({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),an.create(a.doc,[Or.inline(u.from,u.to,{nodeName:e,class:p.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":r})])}}}function xI({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:m}=n,{composing:v}=n.view,{selection:C}=f,{empty:z,from:M}=C,S={...h},O=f.getMeta(d);if(O&&O.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=v,f.docChanged&&S.dismissedRange!==null&&(S.dismissedRange={from:f.mapping.map(S.dismissedRange.from),to:f.mapping.map(S.dismissedRange.to)}),m&&(z||n.view.composing)){(M<h.range.from||M>h.range.to)&&!v&&!h.composing&&(S.active=!1);const N=o({char:e,allowSpaces:t,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:C.$from}),E=`id_${Math.floor(Math.random()*4294967295)}`;N&&a({editor:n,state:g,range:N.range,isActive:h.active})&&(!c||c({editor:n,range:N.range,query:N.query,text:N.text,transaction:f}))?(S.dismissedRange!==null&&!u({match:N,dismissedRange:S.dismissedRange,state:g,transaction:f})&&(S.dismissedRange=null),S.dismissedRange===null?(S.active=!0,S.decorationId=h.decorationId||E,S.range=N.range,S.query=N.query,S.text=N.text):S.active=!1):(N||(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 kI({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 _I({placement:n,offset:e,flip:t,floatingUi:r}){var s,i,o,a;const c=[ck({mainAxis:(s=e.mainAxis)!==null&&s!==void 0?s:4,crossAxis:(i=e.crossAxis)!==null&&i!==void 0?i:0})];return t&&c.push(uk()),!(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 SI(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 CI({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&&SI(r).appendChild(o),a.onPosition||(o.style.visibility="hidden",o.style.width="max-content");const h=dk(c,o,()=>{fk(c,o,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:g,y:m,placement:v,strategy:C})=>{if(a.onPosition){a.onPosition({x:g,y:m,placement:v,strategy:C});return}Object.assign(o.style,{position:C,left:`${g}px`,top:`${m}px`}),u||(u=!0,o.style.visibility="")})},a.autoUpdate);let p;return s&&(p=g=>{const m=g.target;!(m instanceof Node)||o.contains(m)||e.contains(m)||i()},document.addEventListener("pointerdown",p,!0)),()=>{h(),p&&document.removeEventListener("pointerdown",p,!0),d&&o.remove()}}}function MI({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:m}){let v;const C=kI({editor:n,items:t}),z=_I({placement:a,offset:c,flip:d,floatingUi:f});function M(S,O){switch(S){case"started":var N;r==null||(N=r.onStart)===null||N===void 0||N.call(r,O);break;case"updated":var E;r==null||(E=r.onUpdate)===null||E===void 0||E.call(r,O);break;case"stopped":var D;r==null||(D=r.onExit)===null||D===void 0||D.call(r,O)}}return{update:async(S,O)=>{var N,E;const D=e.getState(O),ee=e.getState(S.state);if(!D||!ee)return;let U=null;const oe=D.query!==ee.query,F=D.text!==ee.text,W=D.range.from!==ee.range.from||D.range.to!==ee.range.to,X=oe||F||W;if(!D.active&&ee.active)U="started";else if(D.active&&!ee.active)U="stopped";else if(ee.active&&X)U="updated";else return;const le=U==="stopped"?D:ee,re=S.dom.querySelector(`[data-decoration-id="${le.decorationId}"]`),Q=g(S,re),me=s===0||(le.query?le.query.length>=s:!1),P=(U==="started"||U==="updated")&&me;if(v={editor:n,range:le.range,query:le.query||"",text:le.text||"",items:o??[],command:pe=>p({editor:n,range:le.range,props:pe}),decorationNode:re,clientRect:Q,loading:P,placement:a,offset:{mainAxis:(N=c.mainAxis)!==null&&N!==void 0?N:4,crossAxis:(E=c.crossAxis)!==null&&E!==void 0?E:0},container:u,flip:d,floatingUi:z,mount:CI({getReferenceRect:Q,contextElement:S.dom,config:z,container:u,dismissOnOutsideClick:h,dismiss:()=>m(n.view)})},U==="started"){var $;r==null||($=r.onBeforeStart)===null||$===void 0||$.call(r,v)}if(U==="updated"){var ce;r==null||(ce=r.onBeforeUpdate)===null||ce===void 0||ce.call(r,v)}if(U==="started"&&M(U,v),U==="started"||U==="updated")if(!P)C.abort(),v={...v,items:o??[],loading:!1};else{v={...v,items:o??[],loading:!0},U="updated",M(U,v);const pe=await C.fetch(le.query||"",i);if(pe.status==="aborted")return;const ye=e.getState(S.state);if(!ye?.active){C.abort();return}v=pe.status==="resolved"?{...v,items:pe.items,loading:!1}:{...v,loading:!1}}if(U==="stopped"){C.abort(),M(U,v),v=void 0;return}U==="updated"&&M(U,v)},destroy:()=>{var S;C.abort(),v&&(r==null||(S=r.onExit)===null||S===void 0||S.call(r,v))}}}const TI=new Vn("suggestion");function EI({pluginKey:n=TI,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:m,placement:v="bottom-start",offset:C={},container:z,flip:M=!0,floatingUi:S,dismissOnOutsideClick:O=!0,render:N=()=>({}),allow:E=()=>!0,findSuggestionMatch:D=pI,shouldShow:ee,shouldResetDismissed:U}){const oe=N?.(),F=r&&!s,W=(re,Q)=>vI(e,re,Q,n);function X(re){return bI({...re,editor:e,shouldResetDismissed:U,effectiveAllowSpaces:F})}const le=re=>yI({view:re,pluginKeyRef:n});return new Tn({key:n,view:()=>MI({editor:e,pluginKey:n,items:h,renderer:oe,minQueryLength:p,debounce:g,initialItems:m,placement:v,offset:C,container:z,flip:M,floatingUi:S,dismissOnOutsideClick:O,command:f,clientRectFor:W,dispatchExit:le}),state:xI({editor:e,char:t,effectiveAllowSpaces:F,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:D,allow:E,shouldShow:ee,shouldKeepDismissed:X,pluginKey:n}),props:wI({pluginKey:n,decorationTag:a,decorationClass:c,decorationContent:u,decorationEmptyClass:d,renderer:oe,dispatchExit:le})})}function AI({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){return{editor:n,char:r,pluginKey:new Vn,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 G0(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>AI({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function Om(n,e){const t=G0(n),r=t.find(s=>s.char===e);return r||(t.length?t[0]:null)}const RI=br.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",bn(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=Om(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bn({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=bn({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof s=="string"?["span",bn({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...hA({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:Om(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 G0(this).map(EI)}});var PI=RI;const II=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,LI=br.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",bn(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=bn(this.options.HTMLAttributes,a);Object.entries(d).forEach(([C,z])=>{if(z!=null)switch(C){case"src":case"width":case"height":break;default:u.setAttribute(C,z)}}),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 z=c.extensionManager.attributes.filter(S=>S.type===C.type.name),M=la(C,z);return Object.keys(f).forEach(S=>{!s.has(S)&&!(S in M)&&u.removeAttribute(S)}),Object.entries(M).forEach(([S,O])=>{s.has(S)||(O!=null?u.setAttribute(S,O):u.removeAttribute(S))}),h(M.src),f=M,!0},g=new VA({element:u,editor:c,node:i,getPos:o,onResize:(C,z)=>{u.style.width=`${C}px`,u.style.height=`${z}px`},onCommit:(C,z)=>{const M=o();M!==void 0&&this.editor.chain().setNodeSelection(M).updateAttributes(this.name,{width:C,height:z}).run()},onUpdate:p,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),m=g.dom,v=()=>{m.style.visibility="",m.style.pointerEvents=""};return m.style.visibility="hidden",m.style.pointerEvents="none",u.complete&&u.naturalWidth>0?v():(u.onload=v,u.onerror=v),g}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[f0({find:II,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var OI=LI;const q0="TipTapNodeView";class NI{constructor(e,{element:t,props:r}){rt(this,"component");rt(this,"props");rt(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 DI extends WA{mount(){const e=this.component,t=Sr({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 hk;r.set(q0,{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=xl(e,{target:i,props:t,context:r});this.renderer=new NI(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=la(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function tp(n,e){return t=>new DI(n,t,e)}var $I=new Set(["$$slots","$$events","$$legacy","as","children"]);function fd(n,e){if(new.target)return Ot({component:fd,...n});It(e,!0);const t=y(e,"as",7,"div"),r=y(e,"children",7),s=Yi(e,$I),i=Xw(q0);let o;Fu(async()=>{await Yo(),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:Nt,$on:(d,f)=>Dt(e,d,f)},c=Ze(),u=ue(c);return mk(u,t,!1,(d,f)=>{sr(d,m=>o=m,()=>o),Ka(d,()=>({"data-node-view-wrapper":"",role:"none",...s,ondragstart:i?.onDragStart}));var h=Ze(),p=ue(h);{var g=m=>{var v=Ze(),C=ue(v);Xn(C,r),x(m,v)};j(p,m=>{r()&&m(g)})}x(f,h)}),x(n,c),Lt(a)}var BI=B('<div class="flex items-center gap-2" contenteditable="false"><!> <!></div>'),zI=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),FI=B('<div class="group relative inline-block max-w-full"><!></div>'),HI=B("<!> <!>",1);function J0(n,e){if(new.target)return Ot({component:J0,...n});It(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(()=>mx(l(o),l(f))?.mimeType),p=w(()=>Gu(l(o))),g=w(()=>vx(l(o),l(f))),m=w(()=>l(p)?.path??l(g)?.path),v=w(()=>l(p)?.workspaceId??l(g)?.workspaceId??l(f));function C(N){N.preventDefault(),N.stopPropagation(),k(u,N.currentTarget instanceof HTMLElement?N.currentTarget:s().view.dom,!0),k(c,!0)}var z={get node(){return t()},set node(N){t(N),b()},get selected(){return r()},set selected(N){r(N),b()},get editor(){return s()},set editor(N){s(N),b()},get extension(){return i()},set extension(N){i(N),b()},$set:Nt,$on:(N,E)=>Dt(e,N,E)},M=HI(),S=ue(M);{let N=w(()=>`note-video-node${r()?" selected":""}`);fd(S,{get class(){return l(N)},children:(E,D)=>{var ee=FI(),U=ne(ee);{var oe=W=>{var X=BI(),le=ne(X);Jv(le,{get name(){return l(a)},reason:"load-failed",get path(){return l(m)},get workspaceId(){return l(v)}});var re=A(le,2);Yc(re,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Y(X),x(W,X)},F=W=>{var X=zI(),le=ue(X),re=A(le,2),Q=ne(re);{let P=w(()=>_.chat_videoBlock_play_ariaLabel({name:l(a)}));qe(Q,{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:($,ce)=>{tt($,{get icon(){return S1},size:"sm"})},$$slots:{default:!0}})}var me=A(Q,2);Yc(me,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace"}),Y(re),L(()=>{st(le,"src",l(o)),st(le,"aria-label",l(a))}),Mo("error",le,()=>k(d,l(o),!0)),x(W,X)};j(U,W=>{l(d)===l(o)?W(oe):W(F,-1)})}Y(ee),x(E,ee)},$$slots:{default:!0}})}var O=A(S,2);return qv(O,{get videoUrl(){return l(o)},get videoName(){return l(a)},get mimeType(){return l(h)},sourceKind:"workspace",get openerElement(){return l(u)},get open(){return l(c)},set open(N){k(c,N,!0)}}),x(n,M),Lt(z)}const UI=br.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",bn(n,{class:"markdown-video",controls:"",preload:"metadata",playsinline:""})]},addNodeView(){return tp(J0)}}),VI={note:"internal","linear-issue":"linear","github-issue":"github","github-pr":"github","sentry-issue":"sentry","browser-url":"browser"};var Nm=B("<span><!></span>");function qf(n,e){if(new.target)return Ot({component:qf,...n});It(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()?VI[r()]:"internal"));var a={get provider(){return t()},set provider(m){t(m),b()},get itemType(){return r()},set itemType(m){r(m),b()},get size(){return s()},set size(m=16){s(m),b()},get class(){return i()},set class(m=""){i(m),b()},$set:Nt,$on:(m,v)=>Dt(e,m,v)},c=Ze(),u=ue(c);{var d=m=>{Vk(m,{get size(){return s()},get class(){return i()}})},f=m=>{ph(m,{get size(){return s()},get class(){return i()}})},h=m=>{Wk(m,{get size(){return s()},get class(){return i()}})},p=m=>{var v=Nm(),C=ne(v);tt(C,{get icon(){return th},get size(){return`${s()??""}px`}}),Y(v),L(()=>{at(v,1,$n(i())),Gi(v,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),x(m,v)},g=m=>{var v=Nm(),C=ne(v);tt(C,{get icon(){return nh},get size(){return`${s()??""}px`}}),Y(v),L(()=>{at(v,1,$n(i())),Gi(v,`width: ${s()??""}px; height: ${s()??""}px; display: inline-flex; align-items: center; justify-content: center;`)}),x(m,v)};j(u,m=>{l(o)==="linear"?m(d):l(o)==="github"?m(f,1):l(o)==="sentry"?m(h,2):l(o)==="browser"?m(p,3):m(g,-1)})}return x(n,c),Lt(a)}function mo(n,e){if(new.target)return Ot({component:mo,...n});It(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:Nt,$on:(i,o)=>Dt(e,i,o)};return C1(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Lt(s)}var WI=B('<span class="text-subtle shrink-0"> </span>'),jI=B('<span><!> <!> <span class="max-w-[180px] truncate"> </span></span>'),KI=B('<span class="text-ui font-medium text-subtle">·</span> <span class="text-ui font-medium text-subtle"> </span>',1),GI=B('<div class="text-sm font-medium text-foreground leading-snug"> </div>'),Ac=B("<span> </span>"),qI=B('<span class="text-ui"> </span>'),Rc=B('<span class="text-ui text-subtle"> </span>'),JI=B('<div class="flex flex-wrap items-center gap-1.5"><!> <!> <!> <!></div>'),XI=B('<span class="px-1.5 py-0.5 rounded-full text-ui font-medium bg-muted/50 text-subtle"> </span>'),YI=B('<div class="flex flex-wrap gap-1"><!> <!></div>'),QI=B('<div class="flex items-center gap-3 text-ui text-subtle"><!> <!></div>'),ZI=B('<div class="text-xs text-subtle line-clamp-6"> </div>'),eL=B('<span class="text-ui text-subtle ml-auto"> </span>'),tL=B('<div class="flex items-center gap-2 pt-1 border-t border-border"><!> <!> <!></div>'),nL=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>'),rL=Xi('<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>'),sL=B('<span class="context-mention-wrapper group/pill relative inline-flex items-center svelte-1qhjkt1"><!> <!></span> <!>',1);function X0(n,e){if(new.target)return Ot({component:X0,...n});It(e,!0);const t=vk()?.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);ct(()=>{const W=X=>{k(o,X.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),m=w(()=>()=>{const W=r().attrs.metadata;if(!W)return null;try{return JSON.parse(W)}catch{return null}}),v=w(()=>()=>{if(l(u)==="github"&&l(h)){const W=l(h).match(/^([^/]+)\/([^#]+)#(\d+)$/);if(W){const[,X,le,re]=W,me=!!l(m)()?.sourceBranch?"pull":"issues";return`https://github.com/${X}/${le}/${me}/${re}`}}return l(p)}),C=w(()=>()=>{const W=l(m)()?.sourceBranch;return W&&W.length>0?W:null}),z=w(()=>l(u)==="github"&&(l(d)==="github-pr"||l(d)==="github-issue")&&l(C)()!==null),M=w(()=>l(a)&&l(z)&&l(C)()&&l(C)()!==l(o));function S(W){W.preventDefault(),W.stopPropagation();const X=l(C)();if(X){const le=new CustomEvent("switch-to-pr-branch",{detail:{branch:X,prIdentifier:l(h)},bubbles:!0});document.dispatchEvent(le)}}function O(W){return W?f1(W,{style:"narrow"}):""}function N(W){if(!W)return"bg-muted text-subtle";const X=W.toLowerCase();return X.includes("progress")||X.includes("active")||X.includes("open")?"bg-blue-500/15 text-blue-500":X.includes("done")||X.includes("resolved")||X.includes("closed")||X.includes("complete")?"bg-green-500/15 text-green-500":X.includes("backlog")||X.includes("todo")||X.includes("triage")?"bg-muted text-subtle":X.includes("block")||X.includes("error")||X.includes("cancel")?"bg-red-500/15 text-red-500":"bg-muted text-subtle"}function E(W){if(!W)return null;const X=W.toLowerCase();return X.includes("urgent")||X==="1"?{color:"bg-red-500",label:"🔴"}:X.includes("high")||X==="2"?{color:"bg-orange-500",label:"🟠"}:X.includes("medium")||X==="3"?{color:"bg-warning",label:"🟡"}:X.includes("low")||X==="4"?{color:"bg-blue-500",label:"🔵"}:null}function D(W){if(!W)return"";const X=W.toLowerCase();return X==="error"||X==="fatal"?"text-danger":X==="warning"?"text-warning-ink":"text-subtle"}const ee=w(()=>()=>l(d)==="browser-url"?l(f)||l(v)():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 oe(W){W.preventDefault(),W.stopPropagation();const X=l(v)();X&&t&&await ah(X,{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:Nt,$on:(W,X)=>Dt(e,W,X)};return fd(n,{as:"span",class:"inline",children:(W,X)=>{var le=sL(),re=ue(le),Q=ne(re);fh(Q,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"20rem",trigger:ye=>{var Z=jI(),ae=ne(Z);qf(ae,{get provider(){return l(u)},size:12,class:"shrink-0 opacity-30"});var V=A(ae,2);{var K=ve=>{var de=WI(),fe=se(de,!0);L(()=>H(fe,l(h))),x(ve,de)};j(V,ve=>{l(h)&&l(d)!=="browser-url"&&ve(K)})}var I=A(V,2),te=se(I,!0);Y(Z),L(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(m)()),ae=w(()=>l(Z)?E(l(Z).priority):null);var V=nL(),K=ne(V),I=ne(K);qf(I,{get provider(){return l(u)},size:10,class:"opacity-40"});var te=A(I,2),ve=se(te,!0),de=A(te,2);{var fe=Pe=>{var Ce=KI(),we=A(ue(Ce),2),Ve=se(we,!0);L(()=>H(Ve,l(h))),x(Pe,Ce)};j(de,Pe=>{l(h)&&l(d)!=="browser-url"&&Pe(fe)})}Y(K);var ke=A(K,2);{var be=Pe=>{var Ce=GI(),we=se(Ce,!0);L(()=>H(we,l(f))),x(Pe,Ce)};j(ke,Pe=>{l(f)&&Pe(be)})}var q=A(ke,2);{var Me=Pe=>{var Ce=JI(),we=ne(Ce);{var Ve=Tt=>{var We=Ac(),Ke=se(We,!0);L(Qt=>{at(We,1,`px-1.5 py-0.5 rounded text-ui font-medium ${Qt??""}`,"svelte-1qhjkt1"),H(Ke,l(Z).state)},[()=>N(l(Z).state)]),x(Tt,We)};j(we,Tt=>{l(Z).state&&Tt(Ve)})}var Mt=A(we,2);{var ie=Tt=>{var We=qI(),Ke=se(We,!0);L(()=>H(Ke,l(ae).label)),x(Tt,We)};j(Mt,Tt=>{l(ae)&&Tt(ie)})}var $e=A(Mt,2);{var lt=Tt=>{var We=Ac(),Ke=se(We,!0);L(Qt=>{at(We,1,`text-ui font-medium ${Qt??""}`,"svelte-1qhjkt1"),H(Ke,l(Z).level)},[()=>D(l(Z).level)]),x(Tt,We)};j($e,Tt=>{l(Z).level&&l(u)==="sentry"&&Tt(lt)})}var yt=A($e,2);{var mt=Tt=>{var We=Rc(),Ke=se(We);L(()=>H(Ke,`→ ${l(Z).assignee??""}`)),x(Tt,We)};j(yt,Tt=>{l(Z).assignee&&Tt(mt)})}Y(Ce),x(Pe,Ce)};j(q,Pe=>{l(Z)&&(l(Z).state||l(ae)||l(Z).assignee)&&Pe(Me)})}var ze=A(q,2);{var gt=Pe=>{var Ce=YI(),we=ne(Ce);is(we,17,()=>l(Z).labels.split(",").map($e=>$e.trim()).filter(Boolean).slice(0,5),Nc,($e,lt)=>{var yt=XI(),mt=se(yt,!0);L(()=>H(mt,l(lt))),x($e,yt)});var Ve=A(we,2);{var Mt=$e=>{var lt=Rc(),yt=se(lt);L(mt=>H(yt,`+${mt??""}`),[()=>l(Z).labels.split(",").length-5]),x($e,lt)},ie=w(()=>l(Z).labels.split(",").length>5);j(Ve,$e=>{l(ie)&&$e(Mt)})}Y(Ce),x(Pe,Ce)};j(ze,Pe=>{l(Z)?.labels&&Pe(gt)})}var Le=A(ze,2);{var De=Pe=>{var Ce=QI(),we=ne(Ce);{var Ve=$e=>{var lt=Ac(),yt=se(lt,!0);L(mt=>H(yt,mt),[()=>_.tiptap_contextMention_events_label({count:l(Z).count})]),x($e,lt)};j(we,$e=>{l(Z).count&&$e(Ve)})}var Mt=A(we,2);{var ie=$e=>{var lt=Ac(),yt=se(lt,!0);L(mt=>H(yt,mt),[()=>_.tiptap_contextMention_users_label({count:l(Z).userCount})]),x($e,lt)};j(Mt,$e=>{l(Z).userCount&&$e(ie)})}Y(Ce),x(Pe,Ce)};j(Le,Pe=>{l(Z)&&l(u)==="sentry"&&(l(Z).count||l(Z).userCount)&&Pe(De)})}var Fe=A(Le,2);{var vt=Pe=>{var Ce=ZI(),we=se(Ce,!0);L(()=>H(we,l(g))),x(Pe,Ce)};j(Fe,Pe=>{l(g)&&Pe(vt)})}var Vt=A(Fe,2);{var nt=Pe=>{var Ce=tL(),we=ne(Ce);{var Ve=yt=>{var mt=Rc(),Tt=se(mt,!0);L(()=>H(Tt,l(Z).project)),x(yt,mt)};j(we,yt=>{l(Z).project&&yt(Ve)})}var Mt=A(we,2);{var ie=yt=>{var mt=Rc(),Tt=se(mt,!0);L(We=>H(Tt,We),[()=>_.tiptap_contextMention_byAuthor_label({author:l(Z).author})]),x(yt,mt)};j(Mt,yt=>{l(Z).author&&yt(ie)})}var $e=A(Mt,2);{var lt=yt=>{var mt=eL(),Tt=se(mt,!0);L(We=>H(Tt,We),[()=>O(l(Z).createdAt)]),x(yt,mt)};j($e,yt=>{l(Z).createdAt&&yt(lt)})}Y(Ce),x(Pe,Ce)};j(Vt,Pe=>{l(Z)&&(l(Z).project||l(Z).createdAt||l(Z).author)&&Pe(nt)})}Y(V),L(Pe=>H(ve,Pe),[()=>l(U)()]),x(ye,V)},$$slots:{trigger:!0,content:!0}});var me=A(Q,2);{let ce=w(()=>s()?"bg-primary/20 hover:bg-primary/30":"bg-muted/60 hover:bg-muted"),pe=w(()=>_.tiptap_contextMention_remove_ariaLabel());qe(me,{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
152
  opacity-0 group-hover/pill:opacity-100 transition-opacity
153
- ${l(ce)??""}`},get"aria-label"(){return l(pe)},children:(ye,Z)=>{var ae=nL();x(ye,ae)},$$slots:{default:!0}})}Y(re);var P=A(re,2);{var $=ce=>{{let pe=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Hu(ce,{get content(){return l(pe)},side:"top",delayDuration:200,children:(ye,Z)=>{{let ae=w(()=>_.tiptap_contextMention_switchBranch_tooltip());qe(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(ae)},children:(V,K)=>{mo(V,{size:12,class:"text-primary-ink hover:text-primary-ink/80"})},$$slots:{default:!0}})}},$$slots:{default:!0}})}};j(P,ce=>{l(M)&&ce($)})}qr("click",re,oe),x(W,le)},$$slots:{default:!0}}),Lt(F)}Ro(["click"]);const sL=br.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",bn(n,{"data-type":"context-mention",class:"context-mention"}),n.title||n.identifier||_.tiptap_contextMention_link_fallback()]},addNodeView(){return ep(J0)},addCommands(){return{insertContextMention:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});var iL=B('<span><!> <span class="whitespace-nowrap"> </span></span>'),oL=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>'),aL=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 X0(n,e){if(new.target)return Ot({component:X0,...n});It(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:m})=>(l(a)?m.replaceWith(g,g+t().nodeSize,i().schema.text(l(a))):m.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:Nt,$on:(p,g)=>Dt(e,p,g)};return fd(n,{as:"span",class:"inline",children:(p,g)=>{var m=aL(),v=ne(m);dh(v,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"24rem",trigger:N=>{var E=iL(),D=ne(E);tt(D,{get icon(){return Tp},size:"xs",class:"shrink-0 opacity-40"});var ee=A(D,2),U=se(ee,!0);Y(E),L(oe=>{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,oe)},[()=>_.tiptap_pasteChip_pastedLines_label({count:hs(l(c))})]),x(N,E)},content:N=>{var E=oL(),D=ne(E),ee=ne(D);tt(ee,{get icon(){return Tp},size:"xs",class:"opacity-40"});var U=A(ee,2),oe=se(U,!0),F=A(U,2),W=se(F);Y(D);var X=A(D,2),le=se(X,!0);Y(E),L((re,Q)=>{H(oe,re),H(W,`· ${Q??""}`),H(le,l(u))},[()=>_.tiptap_pasteChip_pastedText_label(),()=>_.tiptap_pasteChip_lines_label({count:hs(l(c))})]),x(N,E)},$$slots:{trigger:!0,content:!0}});var C=A(v,2),z=ne(C);{let S=w(()=>(r(),"")),O=w(()=>_.tiptap_pasteChip_expand_label()),N=w(()=>_.tiptap_pasteChip_expand_label());qe(z,{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(O)},get tooltip(){return l(N)},children:(E,D)=>{tt(E,{get icon(){return C1},size:10,class:""})},$$slots:{default:!0}})}var M=A(z,2);{let S=w(()=>(r(),"")),O=w(()=>_.tiptap_pasteChip_remove_ariaLabel());qe(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(O)},children:(N,E)=>{tt(N,{get icon(){return Ki},size:10,class:""})},$$slots:{default:!0}})}Y(C),Y(m),x(p,m)},$$slots:{default:!0}}),Lt(h)}const lL=br.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",bn(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 ep(X0)},addCommands(){return{insertPasteChip:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function Y0(n,e,t){const r=n.resolve(e),s=n.resolve(t),i=c=>c.type.name==="hardBreak"?`
153
+ ${l(ce)??""}`},get"aria-label"(){return l(pe)},children:(ye,Z)=>{var ae=rL();x(ye,ae)},$$slots:{default:!0}})}Y(re);var P=A(re,2);{var $=ce=>{{let pe=w(()=>_.tiptap_contextMention_switchBranch_tooltip());Hu(ce,{get content(){return l(pe)},side:"top",delayDuration:200,children:(ye,Z)=>{{let ae=w(()=>_.tiptap_contextMention_switchBranch_tooltip());qe(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(ae)},children:(V,K)=>{mo(V,{size:12,class:"text-primary-ink hover:text-primary-ink/80"})},$$slots:{default:!0}})}},$$slots:{default:!0}})}};j(P,ce=>{l(M)&&ce($)})}Jr("click",re,oe),x(W,le)},$$slots:{default:!0}}),Lt(F)}Ao(["click"]);const iL=br.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",bn(n,{"data-type":"context-mention",class:"context-mention"}),n.title||n.identifier||_.tiptap_contextMention_link_fallback()]},addNodeView(){return tp(X0)},addCommands(){return{insertContextMention:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});var oL=B('<span><!> <span class="whitespace-nowrap"> </span></span>'),aL=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>'),lL=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 Y0(n,e){if(new.target)return Ot({component:Y0,...n});It(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:m})=>(l(a)?m.replaceWith(g,g+t().nodeSize,i().schema.text(l(a))):m.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:Nt,$on:(p,g)=>Dt(e,p,g)};return fd(n,{as:"span",class:"inline",children:(p,g)=>{var m=lL(),v=ne(m);fh(v,{side:"top",align:"start",delayDuration:300,interactive:!0,maxWidth:"24rem",trigger:N=>{var E=oL(),D=ne(E);tt(D,{get icon(){return Ep},size:"xs",class:"shrink-0 opacity-40"});var ee=A(D,2),U=se(ee,!0);Y(E),L(oe=>{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,oe)},[()=>_.tiptap_pasteChip_pastedLines_label({count:ps(l(c))})]),x(N,E)},content:N=>{var E=aL(),D=ne(E),ee=ne(D);tt(ee,{get icon(){return Ep},size:"xs",class:"opacity-40"});var U=A(ee,2),oe=se(U,!0),F=A(U,2),W=se(F);Y(D);var X=A(D,2),le=se(X,!0);Y(E),L((re,Q)=>{H(oe,re),H(W,`· ${Q??""}`),H(le,l(u))},[()=>_.tiptap_pasteChip_pastedText_label(),()=>_.tiptap_pasteChip_lines_label({count:ps(l(c))})]),x(N,E)},$$slots:{trigger:!0,content:!0}});var C=A(v,2),z=ne(C);{let S=w(()=>(r(),"")),O=w(()=>_.tiptap_pasteChip_expand_label()),N=w(()=>_.tiptap_pasteChip_expand_label());qe(z,{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(O)},get tooltip(){return l(N)},children:(E,D)=>{tt(E,{get icon(){return M1},size:10,class:""})},$$slots:{default:!0}})}var M=A(z,2);{let S=w(()=>(r(),"")),O=w(()=>_.tiptap_pasteChip_remove_ariaLabel());qe(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(O)},children:(N,E)=>{tt(N,{get icon(){return Ki},size:10,class:""})},$$slots:{default:!0}})}Y(C),Y(m),x(p,m)},$$slots:{default:!0}}),Lt(h)}const cL=br.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",bn(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 tp(Y0)},addCommands(){return{insertPasteChip:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function Q0(n,e,t){const r=n.resolve(e),s=n.resolve(t),i=c=>c.type.name==="hardBreak"?`
157
157
  `:"",o=e>r.start()?n.textBetween(e-1,e,`
158
158
  `,i):`
159
159
  `,a=t<s.end()?n.textBetween(t,t+1,`
160
160
  `,i):`
161
161
  `;return a===" "&&(o===" "||o===`
162
162
  `)?[e,t+1]:o===" "&&a===`
163
- `?[e-1,t]:[e,t]}const cL=br.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=hs(r);return["span",bn(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(...Y0(t.doc,a,a+o.nodeSize))),!0};return{Backspace:()=>n("before"),Delete:()=>n("after")}}}),vo=new Vn("screenInterim"),uL=jn.create({name:"screenInterim",addProseMirrorPlugins(){return[new Tn({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 on.empty;const t=new Map(e.references.map(r=>[r.id,r]));return on.create(n.doc,[Or.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:hs(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",tp="screen-evidence-insertion";function Q0(n){return n.kind==="clip-start"?`[[clip:${n.number}]]`:n.kind==="clip-end"?`[[clip:${n.number}:end]]`:`[[mark:${n.number}]]`}function dL(n,e){if(e.length===0||!/\[\[(mark|clip):/.test(n))return n;const t=new Map(e.map(o=>[Q0(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 fL(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(...Y0(r.doc,a,a+s.nodeSize))}),r.docChanged?(r.setMeta("addToHistory",!1).setMeta(hd,!0),n.view.dispatch(r),!0):!1}function hL(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=>[Q0(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 pL(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,`
163
+ `?[e-1,t]:[e,t]}const uL=br.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=ps(r);return["span",bn(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(...Q0(t.doc,a,a+o.nodeSize))),!0};return{Backspace:()=>n("before"),Delete:()=>n("after")}}}),vo=new Vn("screenInterim"),dL=jn.create({name:"screenInterim",addProseMirrorPlugins(){return[new Tn({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 an.empty;const t=new Map(e.references.map(r=>[r.id,r]));return an.create(n.doc,[Or.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:ps(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",np="screen-evidence-insertion";function Z0(n){return n.kind==="clip-start"?`[[clip:${n.number}]]`:n.kind==="clip-end"?`[[clip:${n.number}:end]]`:`[[mark:${n.number}]]`}function fL(n,e){if(e.length===0||!/\[\[(mark|clip):/.test(n))return n;const t=new Map(e.map(o=>[Z0(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 hL(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(...Q0(r.doc,a,a+s.nodeSize))}),r.docChanged?(r.setMeta("addToHistory",!1).setMeta(hd,!0),n.view.dispatch(r),!0):!1}function pL(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=>[Z0(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 gL(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
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:Je.near(a.resolve(Math.max(0,Math.min(r,a.content.size)))).from;return n.chain().setMeta(tp,e.id).command(({commands:u})=>c===void 0?u.insertContent(o,{updateSelection:!0}):u.insertContentAt(c,o,{updateSelection:!0})).scrollIntoView().run()}function Nm(n){const e=[];return n.descendants(t=>{t.type.name==="screenReference"&&t.attrs.id&&e.push(t.attrs.id)}),e}function gL(n){if(!n.docChanged||n.getMeta(hd)||n.getMeta(tp))return null;const e=Nm(n.before),t=Nm(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 mL=br.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",bn(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 vL(n){return n.dataTransfer?.types.includes("Files")??!1}function bL(n){return n.clipboardData?.types?.includes("Files")??!1}var yL=B('<span class="path svelte-1ycni0y"> </span>'),wL=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 Z0(n,e){if(new.target)return Ot({component:Z0,...n});It(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:Wo,"file-range":Wo,folder:Qs,"source-folder":Qs,note:nf,"note-range":nf,task:fv,rule:T1,command:dv,"external-source":eh,agent:uv,member:M1,personality:cv,workspace:Qs,symbol:Wo};function a(){return o[t().type]||Wo}function c(){if(t().type==="member")return Zw(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:D,y:ee}=r();return D+250>window.innerWidth&&(D=window.innerWidth-250-10),ee+30>window.innerHeight&&(ee=r().y-30-10),{x:D,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:Nt,$on:(E,D)=>Dt(e,E,D)},g=wL(),m=ne(g),v=ne(m),C=ne(v);{let E=w(a);tt(C,{get icon(){return l(E)}})}Y(v);var z=A(v,2),M=ne(z),S=se(M,!0),O=A(M,2);{var N=E=>{var D=yL(),ee=se(D,!0);L(()=>H(ee,h)),x(E,D)};j(O,E=>{h&&E(N)})}return Y(z),Y(m),Y(g),sr(g,E=>k(i,E),()=>l(i)),L((E,D)=>{Gi(g,`left: ${f.x??""}px; top: ${f.y??""}px`),st(g,"aria-label",E),H(S,D)},[()=>_.chat_mentionPreview_ariaLabel(),()=>t().type==="member"?Jf(t().label):t().label]),qr("mouseout",g,u),Ms(1,g,()=>rf,()=>({tier:"fast",y:0,scale:1})),Ms(2,g,()=>sf,()=>({tier:"fast"})),x(n,g),Lt(p)}Ro(["mouseout"]);const Dm={USE_DEFAULT_CONTEXT:{id:"use-default-context",type:"command",get label(){return _.chat_mentions_useDefaultContext_label()},get description(){return _.chat_mentions_useDefaultContext_description()},icon:"🔄",uri:"devspace://command/use-default-context"},CLEAR_CONTEXT:{id:"clear-context",type:"command",get label(){return _.chat_mentions_clearContext_label()},get description(){return _.chat_mentions_clearContext_description()},icon:"🗑️",uri:"devspace://command/clear-context"}};function zi(n){return"items"in n||"subgroups"in n}function xL(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 ew={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},$m="other";function kL(n){return zi(n)?$m:n.type in ew?n.type:$m}function _L(n){const e=new Map;for(const t of n){const r=kL(t),s=e.get(r)??[];e.set(r,s),s.push(t)}return Array.from(e,([t,r])=>({key:t,label:(ew[t]??_.chat_mentionList_otherSection_label)(),items:r}))}const Pc=fa("BreadcrumbController");var Yl,Ql,Zl;class tw{constructor(){ao(this,Yl,he(Sr([])));ao(this,Ql,he(null));ao(this,Zl,he(Sr([])));rt(this,"groupStack",[])}get _breadcrumbs(){return l(ts(this,Yl))}set _breadcrumbs(e){k(ts(this,Yl),e,!0)}get _currentGroup(){return l(ts(this,Ql))}set _currentGroup(e){k(ts(this,Ql),e,!0)}get _currentItems(){return l(ts(this,Zl))}set _currentItems(e){k(ts(this,Zl),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),Pc.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(),Pc.debug("[BreadcrumbController] Popped to:",this._currentGroup),!0}navigateToRoot(){this._breadcrumbs=[],this._currentGroup=null,this._currentItems=[],this.groupStack=[],Pc.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),Pc.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()}}Yl=new WeakMap,Ql=new WeakMap,Zl=new WeakMap;const pl={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 SL(n,e){if(e){const r=`${n}-${e}`;if(r in pl)return pl[r]}const t=n;return t in pl?pl[t]:pl.default}function nw(n,e){if(new.target)return Ot({component:nw,...n});It(e,!0);const t=()=>nn(o,"$session$",r),[r,s]=Ka();let i=y(e,"agentId",7);const o=e1(i()),a=w(()=>Y_(t()));var c={get agentId(){return i()},set agentId(d){i(d),b()},$set:Nt,$on:(d,f)=>Dt(e,d,f)};Bv(n,{get agentId(){return i()},variant:"compact",get state(){return l(a)}});var u=Lt(c);return s(),u}var CL=B('<span class="mention-agent-avatar svelte-myc5g6"><!></span>'),ML=B("<span><!></span>"),TL=B('<span class="mention-subtitle svelte-myc5g6"> </span>'),EL=B('<span class="group-arrow svelte-myc5g6"><!></span>'),AL=B('<!> <div class="mention-content svelte-myc5g6"><div class="mention-label-line svelte-myc5g6"><span class="mention-label svelte-myc5g6"> </span></div> <!></div> <!>',1),RL=B('<span class="breadcrumb-icon svelte-myc5g6"> </span>'),PL=B("<!> ",1),IL=B('<span class="breadcrumb-separator svelte-myc5g6">›</span> <!>',1),LL=B('<div class="breadcrumbs svelte-myc5g6"><!> <!></div>'),OL=B('<div class="mention-skeleton svelte-myc5g6"><div class="skeleton-icon svelte-myc5g6"></div> <div class="skeleton-text svelte-myc5g6"></div></div>'),NL=B('<div class="mention-loading svelte-myc5g6" role="status"></div>'),DL=B('<div class="mention-section-heading type-caption px-2 pt-2 pb-1 font-medium text-muted-foreground svelte-myc5g6" role="presentation"> </div>'),$L=B('<div class="mention-section svelte-myc5g6"><!> <!></div>'),BL=B('<div class="mention-items svelte-myc5g6" role="listbox" tabindex="-1"></div>'),zL=B('<div class="mention-empty svelte-myc5g6" role="status"> </div>'),FL=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 Wc(n,e){const t=Ji();if(new.target)return Ot({component:Wc,...n});It(e,!0);const r=(K,I=Jr)=>{const te=w(()=>l(F).indexOf(I())),ve=w(()=>C(I())),de=w(()=>l(te)===l(d)),fe=w(()=>!zi(I())&&I().type==="agent"),ke=w(()=>!zi(I())&&I().type==="member"),be=w(()=>l(ke)?Jf(I().label):I().label);{let q=w(ch),Me=w(()=>l(de)?"selected":""),ze=w(()=>le(I())),gt=w(()=>l(ke)&&I().subtitle?`${l(be)} · ${I().subtitle}`:l(be));qe(K,{variant:"plain",wrapContent:!1,get class(){return`${l(q)??""} mention-item ${l(Me)??""}`},get id(){return l(ze)},role:"option",get"aria-selected"(){return l(de)},get"aria-label"(){return l(gt)},tabindex:-1,onpointerdown:Le=>Le.preventDefault(),onmousedown:Le=>Le.preventDefault(),onclick:()=>D(l(te)),onmouseenter:()=>{l(m)||k(d,l(te),!0)},children:(Le,De)=>{var Fe=AL(),vt=ue(Fe);{var Vt=We=>{{let Ge=w(()=>I().meta?.avatarUrl);Mv(We,{get avatarUrl(){return l(Ge)},get label(){return I().label},size:18})}},nt=We=>{var Ge=CL(),Yt=ne(Ge);nw(Yt,{get agentId(){return I().id}}),Y(Ge),x(We,Ge)},Pe=We=>{var Ge=ML();let Yt;var Be=ne(Ge);tt(Be,{get icon(){return l(ve)}}),Y(Ge),L(()=>Yt=at(Ge,1,"mention-icon svelte-myc5g6",null,Yt,{selected:l(de)})),x(We,Ge)};j(vt,We=>{l(ke)?We(Vt):l(fe)?We(nt,1):We(Pe,-1)})}var Ce=A(vt,2),we=ne(Ce),Ve=ne(we),Mt=se(Ve,!0);Y(we);var ie=A(we,2);{var $e=We=>{var Ge=TL(),Yt=se(Ge,!0);L(()=>H(Yt,I().subtitle)),x(We,Ge)},lt=w(()=>!zi(I())&&I().subtitle);j(ie,We=>{l(lt)&&We($e)})}Y(Ce);var yt=A(Ce,2);{var mt=We=>{var Ge=EL(),Yt=ne(Ge);tt(Yt,{get icon(){return Ep},size:"xs"}),Y(Ge),x(We,Ge)},Tt=w(()=>zi(I()));j(yt,We=>{l(Tt)&&We(mt)})}L(()=>H(Mt,l(be))),x(Le,Fe)},$$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 tw,h=w(()=>f.breadcrumbs),p=w(()=>f.isInGroup()?f.currentItems:s());let g,m=he(!0);const v=w(()=>typeof l(F)<"u"&&l(F).length>0?l(F)[l(d)]||null:l(p)[l(d)]||null);function C(K){const I=zi(K)?"group":K.type,te=SL(I,K.subtype);return{file:Wo,"file-code":of,"file-text":th,"file-json":of,folder:Qs,"folder-open":nx,"folder-code":Qs,"sticky-note":nf,"list-todo":tx,"check-square":ex,shield:Z1,terminal:dv,"external-link":Q1,globe:eh,palette:Y1,database:X1,settings:J1,lock:q1,"git-branch":Sd,box:G1,wrench:K1,package:j1,image:Kc,"test-tube":W1,"book-open":V1,"package-check":fv,users:U1,lightbulb:H1,"pen-tool":F1,bug:z1,sparkles:B1,"trending-up":$1,"refresh-cw":D1,"shield-check":Ap,"align-left":N1,"shield-alert":Ap,play:O1,hammer:L1,rocket:I1,github:Sd,gitlab:Sd,files:av,folders:Qs,"chevron-right":Ep,"user-tie":cv,"user-graduate":P1,"chalkboard-teacher":R1,bolt:A1,robot:uv,brain:E1}[te]||Wo}tc(()=>f.destroy());function z(K){if(f?.handleKeyboard(K))return K.preventDefault(),K.stopPropagation(),!0;switch(K.key){case"ArrowUp":return K.preventDefault(),K.stopPropagation(),S(),!0;case"ArrowDown":return K.preventDefault(),K.stopPropagation(),O(),!0;case"ArrowRight":return!l(v)||!zi(l(v))?!1:(K.preventDefault(),K.stopPropagation(),N(),!0);case"Enter":return K.preventDefault(),K.stopPropagation(),N(),!0;case"Escape":return K.preventDefault(),K.stopPropagation(),l(h).length>0?f.navigateToRoot():o()?.(),!0;default:return!1}}function M({event:K}){return z(K)}function S(){const K=l(F).length;K!==0&&(k(d,(l(d)+K-1)%K),E())}function O(){const K=l(F).length;K!==0&&(k(d,(l(d)+1)%K),E())}function N(){D(l(d))}async function E(){if(await Qo(),!g)return;const K=g.querySelector(".mention-item.selected");if(!K)return;const I=l(oe)?l(U).find(te=>te.items[0]===l(F)[l(d)]):void 0;I&&document.getElementById(X(I))?.scrollIntoView?.({block:"nearest",behavior:"instant"}),K.scrollIntoView?.({block:"nearest",behavior:"instant"})}function D(K){const I=l(F)[K];I&&(zi(I)?(f.push(I),k(d,0)):i()(I))}function ee(K){f.navigateToBreadcrumb(K),k(d,0)}ct(()=>{l(p),k(d,0),k(m,!0)});const U=w(()=>_L(Array.isArray(l(p))?l(p):[])),oe=w(()=>l(U).length>1),F=w(()=>l(U).flatMap(K=>K.items));function W(K){K.target instanceof Element&&K.target.closest(".mention-section-heading")&&K.preventDefault()}function X(K){return`${t}-section-${K.key}`}function le(K){return`${t}-option-${encodeURIComponent(`${zi(K)?"group":K.type}:${K.id}`)}`}const re=w(()=>l(v)?le(l(v)):void 0);ct(()=>u()?.(l(re)));var Q={onKeyDown:M,get items(){return s()},set items(K=[]){s(K),b()},get command(){return i()},set command(K){i(K),b()},get onClose(){return o()},set onClose(K){o(K),b()},get loading(){return a()},set loading(K=!1){a(K),b()},get listboxId(){return c()},set listboxId(K=`${t}-listbox`){c(K),b()},get onActiveOptionChange(){return u()},set onActiveOptionChange(K){u(K),b()},$set:Nt,$on:(K,I)=>Dt(e,K,I)},me=FL(),P=ne(me),$=ne(P),ce=ne($);{var pe=K=>{var I=LL(),te=ne(I);qe(te,{variant:"plain",class:"breadcrumb-item",onmousedown:de=>de.preventDefault(),onclick:()=>f.navigateToRoot(),children:(de,fe)=>{Pt();var ke=zt();L(be=>H(ke,be),[()=>_.chat_mentionList_all_label()]),x(de,ke)},$$slots:{default:!0}});var ve=A(te,2);ss(ve,19,()=>l(h),(de,fe)=>de.id||`crumb-${fe}`,(de,fe,ke)=>{var be=IL(),q=A(ue(be),2);qe(q,{variant:"plain",class:"breadcrumb-item",onmousedown:Me=>Me.preventDefault(),onclick:()=>ee(l(ke)),children:(Me,ze)=>{var gt=PL(),Le=ue(gt);{var De=vt=>{var Vt=RL(),nt=se(Vt,!0);L(()=>H(nt,l(fe).icon)),x(vt,Vt)};j(Le,vt=>{l(fe).icon&&vt(De)})}var Fe=A(Le);L(()=>H(Fe,` ${l(fe).label??""}`)),x(Me,gt)},$$slots:{default:!0}}),x(de,be)}),Y(I),x(K,I)};j(ce,K=>{l(h).length>0&&K(pe)})}var ye=A(ce,2);{var Z=K=>{var I=NL();ss(I,20,()=>[0,1,2,3],te=>te,(te,ve)=>{var de=OL(),fe=A(ne(de),2);Y(de),L(()=>Gi(fe,`width: ${55+ve*12}%`)),x(te,de)}),Y(I),L(te=>st(I,"aria-label",te),[()=>_.ui_combobox_loadingOptions_message()]),x(K,I)},ae=K=>{var I=BL();ss(I,21,()=>l(U),te=>te.key,(te,ve)=>{var de=$L(),fe=ne(de);{var ke=q=>{var Me=DL(),ze=se(Me,!0);L(gt=>{st(Me,"id",gt),H(ze,l(ve).label)},[()=>X(l(ve))]),x(q,Me)};j(fe,q=>{l(oe)&&q(ke)})}var be=A(fe,2);ss(be,17,()=>l(ve).items,q=>le(q),(q,Me)=>{r(q,()=>l(Me))}),Y(de),L(q=>{st(de,"role",l(oe)?"group":void 0),st(de,"aria-labelledby",q)},[()=>l(oe)?X(l(ve)):void 0]),x(te,de)}),Y(I),L(te=>{st(I,"id",c()),st(I,"aria-label",te),st(I,"aria-activedescendant",l(re)),st(I,"aria-busy",a())},[()=>_.chat_mentionList_ariaLabel()]),qr("keydown",I,z),qr("mousemove",I,()=>k(m,!1)),qr("pointerdown",I,W),qr("mousedown",I,W),x(K,I)},V=K=>{var I=zL(),te=se(I,!0);L(ve=>H(te,ve),[()=>_.chat_mentionList_noResults_label()]),x(K,I)};j(ye,K=>{a()&&l(p).length===0?K(Z):l(p).length>0?K(ae,1):K(V,-1)})}return Y($),Y(P),Y(me),sr(me,K=>g=K,()=>g),x(n,me),Lt(Q)}Ro(["keydown","mousemove","pointerdown","mousedown"]);class HL{constructor(e){rt(this,"unregisterPopup");rt(this,"component",null);rt(this,"popup",null);rt(this,"editorElement",null);rt(this,"inputContainer",null);rt(this,"listboxId",`mention-listbox-${crypto.randomUUID()}`);rt(this,"previousAria",new Map);rt(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=kl(Wc,{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=kl(Wc,{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?(St.info("[MentionSuggestionRenderer] Found .rich-input-container"),e):(e=this.editorElement.closest(".rich-textarea"),e?(St.info("[MentionSuggestionRenderer] Found .rich-textarea"),e):(e=this.editorElement.closest('[style*="position"]'),e?(St.info("[MentionSuggestionRenderer] Found positioned ancestor"),e):(St.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){St.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`),St.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(St.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){St.info("[MentionSuggestionRenderer] Initializing popup and component in onUpdate (onStart was skipped)"),this.onStart(e);return}this.component&&this.popup?(St.info("[MentionSuggestionRenderer] Updating component props without remounting"),this.component.$set({items:e.items,command:e.command,loading:!1})):!this.component&&this.popup&&(St.info("[MentionSuggestionRenderer] Creating component in onUpdate"),this.component=kl(Wc,{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 UL(n){const e=new HL(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 Un(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=VL(t,r);return i?{score:WL(t,r,i),matches:i}:null}function VL(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 WL(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||jL(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 jL(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 KL(n,e){if(!n||!e)return null;if(!n.includes("/"))return Un(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=GL(t,r);return s?{score:qL(t,r,s),matches:[]}:null}function GL(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(Un(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&&Un(i,f)){t.push(c),r=c+1,o=!0;break}if(d&&Un(i,d)){t.push(c),r=c+1,o=!0;break}}}if(!o)return null}return t}function qL(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 Da(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 rw="*",JL=["member","note","agent","file","folder","script","terminal",rw,"specialist"];function sw(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(rw)??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 XL(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 YL{constructor(e={}){rt(this,"searchDebounceTimer",null);rt(this,"currentAbortController",null);rt(this,"cache",new Map);rt(this,"config");rt(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=Da(e,t,r),i=this.cache.get(s);if(i&&!this.isCacheExpired(i))return St.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=v=>{d||(d=!0,f(),c(v))},p=v=>{d||(d=!0,f(),u(v))},g=()=>p(new DOMException("Search cancelled","AbortError"));a.addEventListener("abort",g,{once:!0});const m=async()=>{try{if(a.aborted){p(new DOMException("Search cancelled","AbortError"));return}St.debug("[SearchService] Searching with providers:",t.map(E=>E.id));const v=Da(e,t,r),C=await Promise.all(t.map(E=>this.searchWithProvider(E,e,r,a)));if(a.aborted)return;if(v!==Da(e,t,r)){h([]);return}const M=this.combineResults(C.flat()).filter(E=>xL(E)),S=this.applyFuzzyMatching(e,M),O=sw(S,this.config.typeOrder),N=this.config.typeOrder.length>0?XL(O,this.config.maxResultsPerKind):O.slice(0,this.config.maxResults);this.cache.set(v,{results:N,timestamp:Date.now()}),St.debug(`[SearchService] Found ${N.length} results`),h(N)}catch(v){a.aborted?p(new DOMException("Search cancelled","AbortError")):(St.error("[SearchService] Search error:",v),p(v instanceof Error?v:new Error(String(v))))}};e?this.searchDebounceTimer=setTimeout(m,this.config.debounceMs):m()})}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||St.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=KL(e,a);u&&(o=Math.max(o,u.score*1.8))}const c=Un(e,i.label);if(c&&(o=Math.max(o,c.score*1.5)),i.subtitle){const u=Un(e,i.subtitle);u&&(o=Math.max(o,u.score))}if(i.description){const u=Un(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 QL{constructor(){rt(this,"id","file");rt(this,"triggers",["@file","@f"]);rt(this,"default",!0);rt(this,"supportsRanges",!0);rt(this,"supportsLivePreview",!0);rt(this,"recentFiles",new Set);rt(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){St.debug("[FileProvider] Searching for:",{query:e,context:{workspaceId:t.workspaceId}});const r=t.workspaceId;if(!r)return[];try{const s=await mv("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 St.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?Un(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 ZL{constructor(){rt(this,"id","member")}getCacheKey(e){const t=At.state;return JSON.stringify({backendId:c_.select(t),ownPrincipalId:t.presence.ownPrincipalId,members:e.workspaceId?Pp.select(t,e.workspaceId):[]})}async search(e,t){const{workspaceId:r}=t;if(!r)return[];const s=e.replace(/^@/,"").toLowerCase();return Pp.select(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 eO{constructor(){rt(this,"id","folder");rt(this,"triggers",["@folder","@dir"])}async search(e,t){const r=t.workspaceId;if(!r)return[];try{const{backendRequest:s}=await ps(async()=>{const{backendRequest:c}=await import("./BU46x7E3.js").then(u=>u.j);return{backendRequest:c}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),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?Un(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 St.debug("[FolderProvider] Failed to get folders:",s),[]}}}const tO=10,nO=.3;function rO(n){const e=n.toLowerCase().split(/\s+/).filter(Boolean);return(t,r)=>{const s=t?Un(n,t):null;if(s)return 1+s.score;if(r){const i=r.toLowerCase();if(e.every(o=>i.includes(o)))return nO}return 0}}class sO{constructor(){rt(this,"id","note");rt(this,"triggers",["@note","@n"]);rt(this,"supportsRanges",!0);rt(this,"cachedNotes",[]);rt(this,"lastCacheUpdate",0);rt(this,"cacheTimeout",5e3)}async getSiblingWorkspaces(e){if(!e)return[];try{const[{store:t},{selectWorkspaceItems:r}]=await Promise.all([ps(()=>import("./BlKpyqxv.js"),__vite__mapDeps([11,12,13,2,14,15,4,8,1,16,6,3,17,18]),import.meta.url),ps(()=>import("./BwmV4u5a.js").then(o=>o.dY),__vite__mapDeps([19,6,4,1,2,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26]),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 St.debug("[NoteProvider] Failed to get sibling workspaces:",t),[]}}async fetchNotesFromWorkspace(e,t){try{const[{store:r},{listSlimNotesRequested:s}]=await Promise.all([ps(()=>import("./BlKpyqxv.js"),__vite__mapDeps([11,12,13,2,14,15,4,8,1,16,6,3,17,18]),import.meta.url),ps(()=>import("./CQNY8AIr.js").then(o=>o.LF),__vite__mapDeps([12,13,2,14,15,4,8,1,16,6,3]),import.meta.url)]);return(await r.dispatch(s(e))).map(o=>({note:o,workspaceId:e,workspaceTitle:t}))}catch(r){St.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?rO(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,tO).map(({entry:{note:p,workspaceId:g,workspaceTitle:m},score:v})=>{const C=g===t.workspaceId,z=C?void 0:_.chat_mentions_fromWorkspace_subtitle({workspace:m||g}),M=p.content||p.contentPreview;return{candidate:{id:p.id,type:"note",label:p.title||p.id||_.chat_mentions_untitledNote_label(),subtitle:z,description:M?`${M.substring(0,100)}...`:"",icon:"📝",uri:`devspace://note/${p.id}`,meta:{preview:M?.substring(0,200)||"",workspaceId:g,...C?{}:{isExternalLink:!0}}},score:v}});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){St.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 iO{constructor(){rt(this,"id","external");rt(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||Un(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 oO{constructor(){rt(this,"id","rule");rt(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||Un(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 aO{constructor(){rt(this,"id","task");rt(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||Un(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 lO{constructor(){rt(this,"id","personality");rt(this,"triggers",["@personality","@persona"]);rt(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||Un(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 cO{constructor(){rt(this,"id","command");rt(this,"triggers",["@cmd","@command"])}async search(e,t){return[Dm.USE_DEFAULT_CONTEXT,Dm.CLEAR_CONTEXT].filter(s=>!e||s.label.toLowerCase().includes(e.toLowerCase()))}}class uO{constructor(){rt(this,"id","terminal");rt(this,"triggers",["@terminal","@term"])}async search(e,t){try{const{terminalManager:r}=await ps(async()=>{const{terminalManager:m}=await import("./BYrBvRoU.js").then(v=>v.c);return{terminalManager:m}},__vite__mapDeps([27,2,1,28,29,3,4,30,31,12,13,14,15,8,16,6,0,5,7,9,10,32,24,33,34,35,36,37,38,39,25,40,41]),import.meta.url),{selectTerminals:s,selectTerminalDisplayName:i}=await ps(async()=>{const{selectTerminals:m,selectTerminalDisplayName:v}=await import("./Bjx82_QL.js").then(C=>C.i);return{selectTerminals:m,selectTerminalDisplayName:v}},__vite__mapDeps([40,12,13,2,14,15,4,8,1,16,6,3]),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 m of c)d.add(m.id),f.push({id:m.id,name:i.select(a,t.workspaceId,m.id)});for(const m of u)d.has(m.terminalId)||(d.add(m.terminalId),f.push({id:m.terminalId,name:m.title||_.terminal_quakeOverlay_terminal_fallback()}));if(f.length===0)return[];const p=e?["terminal","term"].some(m=>m.startsWith(e.toLowerCase())||e.toLowerCase().startsWith(m)):!1;return(e&&!p?f.filter(m=>Un(e,m.name)!==null):f).slice(0,10).map((m,v)=>({id:m.id,type:"terminal",label:m.name,subtitle:_.chat_mentions_terminalIndex_subtitle({index:v+1}),description:_.chat_mentions_terminalOutput_description(),icon:"💻",uri:`devspace://terminal/${encodeURIComponent(m.id)}`,meta:{workspaceId:t.workspaceId}}))}catch(r){return St.debug("[TerminalProvider] Failed to get terminals:",r),[]}}}class dO{constructor(){rt(this,"id","script");rt(this,"triggers",["@script","@scripts"])}async search(e,t){try{const{selectScriptEntries:r}=await ps(async()=>{const{selectScriptEntries:c}=await import("./DtWyzoyb.js");return{selectScriptEntries:c}},__vite__mapDeps([42,12,13,2,14,15,4,8,1,16,6,3,43,44,22,7,9,45,46,23,0,5,10,21,47,26,48,49,20,50,51,52,19,24,25,53,29,28,54,55,33,31,56]),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=>Un(e,c.name)!==null||Un(e,$p(c))!==null):s).slice(0,10).map(c=>{const u=c.runtime.status,d=Up(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} · ${$p(c)}`,description:_.chat_mentions_scriptOutput_description(),icon:"▶️",uri:`devspace://script/${encodeURIComponent(c.id)}`,meta:{workspaceId:t.workspaceId,command:c.command,status:Up(u)?"ok":u==="exited"?"warning":void 0}}})}catch(r){return St.debug("[ScriptProvider] Failed to get scripts:",r),[]}}}class fO{constructor(){rt(this,"id","specialist");rt(this,"triggers",["@specialist","@spec"])}async search(e,t){try{const r=n_.select(At.state);return!r||r.length===0?[]:r.filter(s=>e?Un(e,s.name)!==null||Un(e,s.id)!==null||Un(e,s.description)!==null||Un(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 St.debug("[SpecialistProvider] Failed to get specialists:",r),[]}}}class hO{constructor(){rt(this,"id","agent");rt(this,"triggers",["@agent"])}async search(e,t){try{const{selectAllWorkspaceAgents:r}=await ps(async()=>{const{selectAllWorkspaceAgents:a}=await import("./BwmV4u5a.js").then(c=>c.dV);return{selectAllWorkspaceAgents:a}},__vite__mapDeps([19,6,4,1,2,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26]),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 v=t_.select(At.state,d);v&&(f=v.name)}if(e){const v=Un(e,u)!==null,C=Un(e,"agent")!==null,z=f&&Un(e,f)!==null,M=d&&Un(e,d)!==null;if(!v&&!C&&!z&&!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 m=a.lastActivity||a.lastModified;m&&!a.isStreaming&&p.push(Wk(new Date(m))),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 St.debug("[AgentProvider] Failed to get agents:",r),[]}}}class pO{constructor(){rt(this,"providers",new Map);rt(this,"defaultProviders",[]);this.register(new QL),this.register(new eO),this.register(new sO),this.register(new iO),this.register(new oO),this.register(new aO),this.register(new lO),this.register(new cO),this.register(new uO),this.register(new dO),this.register(new hO),this.register(new fO),this.register(new ZL),this.defaultProviders=["file","folder","note","terminal","script","agent","specialist","member"]}register(e){this.providers.set(e.id,e),St.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 Ma=new pO,gO=5e3,mO=8,vO=100,bO=50,yO=/^devspace:\/\/[^\/]+\/([^\/]+)/,wO=[{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()}}],xO=[{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}],kO=[{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 _O(n){return typeof n.getCachedNotes=="function"}class SO{constructor(e={}){rt(this,"searchService");rt(this,"breadcrumbController");rt(this,"resolvers",new Map);rt(this,"config");rt(this,"cachedResults",new Map);this.config={...e,typeOrder:e.typeOrder??JL},this.searchService=new YL(this.config),this.breadcrumbController=new tw}async search(e,t){if(!t?.workspaceId&&!t?.repoPath)return St.error("[MentionSystem] search called without valid context (no workspaceId or repoPath)"),[];const r=(e||"").trim(),s=this.getProvidersForQuery(r);if(s.length===0)return St.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"||St.error("[MentionSystem] Search failed:",i),[]}}searchSync(e,t){const r=e.toLowerCase();if(!t?.workspaceId&&!t?.repoPath)return St.debug("[MentionSystem] searchSync called without workspaceId or repoPath - returning empty results"),[];const s=Da(e,this.getProvidersForQuery(e),t),i=Date.now();if(this.cachedResults.has(s)){const a=this.cachedResults.get(s);if(a&&i-a.timestamp<gO)return this.cachedResults.delete(s),this.cachedResults.set(s,a),a.results}this.updateCache(e,t).catch(a=>{St.warn("[MentionSystem] Background cache update failed:",a)});const o=[];return o.push(...this.getNoteCandidates(r)),o.push(...this.filterCandidates(xO,r,3)),o.push(...this.filterCandidates(kO,r,2)),sw(o,this.config.typeOrder??[]).slice(0,mO)}getNoteCandidates(e){const t=Ma.get("note");if(t&&_O(t))try{return(t.getCachedNotes()||[]).filter(s=>!e||s.label&&typeof s.label=="string"&&s.label.toLowerCase().includes(e)).slice(0,3)}catch(r){St.warn("[MentionSystem] Failed to get cached notes:",r)}return this.filterCandidates(wO,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=Da(e,this.getProvidersForQuery(e),t),s=await this.search(e,t);if(r!==Da(e,this.getProvidersForQuery(e),t))return;const i={results:s,timestamp:Date.now()};this.cachedResults.delete(r),this.cachedResults.set(r,i);const o=Ma.get("note");if(o&&await o.search(e,t),this.cachedResults.size>vO){const a=this.cachedResults.size-bO,c=Array.from(this.cachedResults.keys()).slice(0,a);for(const u of c)this.cachedResults.delete(u);St.debug(`[MentionSystem] Cache cleanup: removed ${a} entries`)}}catch(r){St.warn("[MentionSystem] Cache update failed:",r)}}getProvidersForQuery(e){if(!e)return Ma.getDefault();if(e.startsWith("@")){const r=e.indexOf(" "),s=r>0?e.substring(0,r):e,i=Ma.getByTrigger(s);if(i.length>0)return St.debug("[MentionSystem] Using triggered providers for:",s),i}const t=Ma.getDefault();return St.debug("[MentionSystem] Using default providers, count:",t.length),t}async resolve(e){if(!e||typeof e!="string")return St.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 St.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 St.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 St.warn("[MentionSystem] Invalid URI provided to getPreview:",e),null;try{return(await this.resolve(e)).preview||null}catch(t){return St.error("[MentionSystem] Failed to get preview:",t),null}}registerProvider(e){if(!e){St.error("[MentionSystem] Cannot register null/undefined provider");return}if(!e.id){St.error("[MentionSystem] Cannot register provider without id");return}try{Ma.register(e),St.debug(`[MentionSystem] Registered provider: ${e.id}`)}catch(t){St.error("[MentionSystem] Failed to register provider:",t)}}registerResolver(e,t){if(!e||!t){St.error("[MentionSystem] Cannot register resolver with invalid type or resolver");return}this.resolvers.has(e)&&St.warn(`[MentionSystem] Overwriting existing resolver for type: ${e}`),this.resolvers.set(e,t),St.debug(`[MentionSystem] Registered resolver for type: ${e}`)}findResolver(e){if(!e||typeof e!="string")return;const t=e.match(yO);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)}St.debug(`[MentionSystem] No resolver found for URI pattern: ${e}`)}getBreadcrumbController(){return this.breadcrumbController}clearCache(){this.searchService.clearCache(),this.cachedResults.clear(),St.debug("[MentionSystem] All caches cleared")}destroy(){try{this.searchService.destroy(),this.breadcrumbController.destroy(),this.cachedResults.clear(),this.resolvers.clear(),St.debug("[MentionSystem] System destroyed successfully")}catch(e){St.error("[MentionSystem] Error during destroy:",e)}}}let Yd=null;function CO(n){return Yd||(Yd=new SO(n),St.debug("[MentionSystem] Created new instance with config:",n)),Yd}const MO=qR.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 iw(n={}){return MO.configure({validate:void 0,...n})}const lB=iw,Bm=n=>n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),TO={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},EO=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 TO[t]??e});function AO(n){const e=[];let t=0;for(const r of t1(n,"markdown",{decode:EO})){r.index>t&&e.push(n.slice(t,r.index));const s=r.parsed?n1(r.parsed):null;if(s){const i=s.attributes.map(([o,a])=>` ${o}="${Bm(a)}"`).join("");e.push(`<span${i} class="${s.className}">${Bm(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 RO=new Set(["code","pre","script","style","a"]);function PO(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("/>");(RO.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(AO(o)):e.push(o),t=i}return e.join("")}function IO(n){return n.replace(/^ +| +$/g,e=>" ".repeat(e.length)).replace(/ {2,}/g,e=>` ${" ".repeat(e.length-1)}`)}function LO(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function OO(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(LO).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 NO(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 OO(IO(o),e)}).join("<br>")}</p>`;return PO(s)}function Ta(n){return(n?.getText({blockSeparator:`
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:Je.near(a.resolve(Math.max(0,Math.min(r,a.content.size)))).from;return n.chain().setMeta(np,e.id).command(({commands:u})=>c===void 0?u.insertContent(o,{updateSelection:!0}):u.insertContentAt(c,o,{updateSelection:!0})).scrollIntoView().run()}function Dm(n){const e=[];return n.descendants(t=>{t.type.name==="screenReference"&&t.attrs.id&&e.push(t.attrs.id)}),e}function mL(n){if(!n.docChanged||n.getMeta(hd)||n.getMeta(np))return null;const e=Dm(n.before),t=Dm(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 vL=br.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",bn(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 bL(n){return n.dataTransfer?.types.includes("Files")??!1}function yL(n){return n.clipboardData?.types?.includes("Files")??!1}var wL=B('<span class="path svelte-1ycni0y"> </span>'),xL=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 ew(n,e){if(new.target)return Ot({component:ew,...n});It(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:Vo,"file-range":Vo,folder:Qs,"source-folder":Qs,note:nf,"note-range":nf,task:hv,rule:E1,command:fv,"external-source":th,agent:dv,member:T1,personality:uv,workspace:Qs,symbol:Vo};function a(){return o[t().type]||Vo}function c(){if(t().type==="member")return e1(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:D,y:ee}=r();return D+250>window.innerWidth&&(D=window.innerWidth-250-10),ee+30>window.innerHeight&&(ee=r().y-30-10),{x:D,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:Nt,$on:(E,D)=>Dt(e,E,D)},g=xL(),m=ne(g),v=ne(m),C=ne(v);{let E=w(a);tt(C,{get icon(){return l(E)}})}Y(v);var z=A(v,2),M=ne(z),S=se(M,!0),O=A(M,2);{var N=E=>{var D=wL(),ee=se(D,!0);L(()=>H(ee,h)),x(E,D)};j(O,E=>{h&&E(N)})}return Y(z),Y(m),Y(g),sr(g,E=>k(i,E),()=>l(i)),L((E,D)=>{Gi(g,`left: ${f.x??""}px; top: ${f.y??""}px`),st(g,"aria-label",E),H(S,D)},[()=>_.chat_mentionPreview_ariaLabel(),()=>t().type==="member"?Xf(t().label):t().label]),Jr("mouseout",g,u),Ts(1,g,()=>rf,()=>({tier:"fast",y:0,scale:1})),Ts(2,g,()=>sf,()=>({tier:"fast"})),x(n,g),Lt(p)}Ao(["mouseout"]);const $m={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 zi(n){return"items"in n||"subgroups"in n}function kL(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 tw={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},Bm="other";function _L(n){return zi(n)?Bm:n.type in tw?n.type:Bm}function SL(n){const e=new Map;for(const t of n){const r=_L(t),s=e.get(r)??[];e.set(r,s),s.push(t)}return Array.from(e,([t,r])=>({key:t,label:(tw[t]??_.chat_mentionList_otherSection_label)(),items:r}))}const Pc=da("BreadcrumbController");var Yl,Ql,Zl;class nw{constructor(){ao(this,Yl,he(Sr([])));ao(this,Ql,he(null));ao(this,Zl,he(Sr([])));rt(this,"groupStack",[])}get _breadcrumbs(){return l(ns(this,Yl))}set _breadcrumbs(e){k(ns(this,Yl),e,!0)}get _currentGroup(){return l(ns(this,Ql))}set _currentGroup(e){k(ns(this,Ql),e,!0)}get _currentItems(){return l(ns(this,Zl))}set _currentItems(e){k(ns(this,Zl),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),Pc.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(),Pc.debug("[BreadcrumbController] Popped to:",this._currentGroup),!0}navigateToRoot(){this._breadcrumbs=[],this._currentGroup=null,this._currentItems=[],this.groupStack=[],Pc.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),Pc.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()}}Yl=new WeakMap,Ql=new WeakMap,Zl=new WeakMap;const hl={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 CL(n,e){if(e){const r=`${n}-${e}`;if(r in hl)return hl[r]}const t=n;return t in hl?hl[t]:hl.default}function rw(n,e){if(new.target)return Ot({component:rw,...n});It(e,!0);const t=()=>rn(o,"$session$",r),[r,s]=ja();let i=y(e,"agentId",7);const o=t1(i()),a=w(()=>Q_(t()));var c={get agentId(){return i()},set agentId(d){i(d),b()},$set:Nt,$on:(d,f)=>Dt(e,d,f)};zv(n,{get agentId(){return i()},variant:"compact",get state(){return l(a)}});var u=Lt(c);return s(),u}var ML=B('<span class="mention-agent-avatar svelte-myc5g6"><!></span>'),TL=B("<span><!></span>"),EL=B('<span class="mention-subtitle svelte-myc5g6"> </span>'),AL=B('<span class="group-arrow svelte-myc5g6"><!></span>'),RL=B('<!> <div class="mention-content svelte-myc5g6"><div class="mention-label-line svelte-myc5g6"><span class="mention-label svelte-myc5g6"> </span></div> <!></div> <!>',1),PL=B('<span class="breadcrumb-icon svelte-myc5g6"> </span>'),IL=B("<!> ",1),LL=B('<span class="breadcrumb-separator svelte-myc5g6">›</span> <!>',1),OL=B('<div class="breadcrumbs svelte-myc5g6"><!> <!></div>'),NL=B('<div class="mention-skeleton svelte-myc5g6"><div class="skeleton-icon svelte-myc5g6"></div> <div class="skeleton-text svelte-myc5g6"></div></div>'),DL=B('<div class="mention-loading svelte-myc5g6" role="status"></div>'),$L=B('<div class="mention-section-heading type-caption px-2 pt-2 pb-1 font-medium text-muted-foreground svelte-myc5g6" role="presentation"> </div>'),BL=B('<div class="mention-section svelte-myc5g6"><!> <!></div>'),zL=B('<div class="mention-items svelte-myc5g6" role="listbox" tabindex="-1"></div>'),FL=B('<div class="mention-empty svelte-myc5g6" role="status"> </div>'),HL=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 Wc(n,e){const t=Ji();if(new.target)return Ot({component:Wc,...n});It(e,!0);const r=(K,I=Xr)=>{const te=w(()=>l(F).indexOf(I())),ve=w(()=>C(I())),de=w(()=>l(te)===l(d)),fe=w(()=>!zi(I())&&I().type==="agent"),ke=w(()=>!zi(I())&&I().type==="member"),be=w(()=>l(ke)?Xf(I().label):I().label);{let q=w(uh),Me=w(()=>l(de)?"selected":""),ze=w(()=>le(I())),gt=w(()=>l(ke)&&I().subtitle?`${l(be)} · ${I().subtitle}`:l(be));qe(K,{variant:"plain",wrapContent:!1,get class(){return`${l(q)??""} mention-item ${l(Me)??""}`},get id(){return l(ze)},role:"option",get"aria-selected"(){return l(de)},get"aria-label"(){return l(gt)},tabindex:-1,onpointerdown:Le=>Le.preventDefault(),onmousedown:Le=>Le.preventDefault(),onclick:()=>D(l(te)),onmouseenter:()=>{l(m)||k(d,l(te),!0)},children:(Le,De)=>{var Fe=RL(),vt=ue(Fe);{var Vt=We=>{{let Ke=w(()=>I().meta?.avatarUrl);Tv(We,{get avatarUrl(){return l(Ke)},get label(){return I().label},size:18})}},nt=We=>{var Ke=ML(),Qt=ne(Ke);rw(Qt,{get agentId(){return I().id}}),Y(Ke),x(We,Ke)},Pe=We=>{var Ke=TL();let Qt;var Be=ne(Ke);tt(Be,{get icon(){return l(ve)}}),Y(Ke),L(()=>Qt=at(Ke,1,"mention-icon svelte-myc5g6",null,Qt,{selected:l(de)})),x(We,Ke)};j(vt,We=>{l(ke)?We(Vt):l(fe)?We(nt,1):We(Pe,-1)})}var Ce=A(vt,2),we=ne(Ce),Ve=ne(we),Mt=se(Ve,!0);Y(we);var ie=A(we,2);{var $e=We=>{var Ke=EL(),Qt=se(Ke,!0);L(()=>H(Qt,I().subtitle)),x(We,Ke)},lt=w(()=>!zi(I())&&I().subtitle);j(ie,We=>{l(lt)&&We($e)})}Y(Ce);var yt=A(Ce,2);{var mt=We=>{var Ke=AL(),Qt=ne(Ke);tt(Qt,{get icon(){return Ap},size:"xs"}),Y(Ke),x(We,Ke)},Tt=w(()=>zi(I()));j(yt,We=>{l(Tt)&&We(mt)})}L(()=>H(Mt,l(be))),x(Le,Fe)},$$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 nw,h=w(()=>f.breadcrumbs),p=w(()=>f.isInGroup()?f.currentItems:s());let g,m=he(!0);const v=w(()=>typeof l(F)<"u"&&l(F).length>0?l(F)[l(d)]||null:l(p)[l(d)]||null);function C(K){const I=zi(K)?"group":K.type,te=CL(I,K.subtype);return{file:Vo,"file-code":of,"file-text":nh,"file-json":of,folder:Qs,"folder-open":rx,"folder-code":Qs,"sticky-note":nf,"list-todo":nx,"check-square":tx,shield:ex,terminal:fv,"external-link":Z1,globe:th,palette:Q1,database:Y1,settings:X1,lock:J1,"git-branch":Sd,box:q1,wrench:G1,package:K1,image:Kc,"test-tube":j1,"book-open":W1,"package-check":hv,users:V1,lightbulb:U1,"pen-tool":H1,bug:F1,sparkles:z1,"trending-up":B1,"refresh-cw":$1,"shield-check":Rp,"align-left":D1,"shield-alert":Rp,play:N1,hammer:O1,rocket:L1,github:Sd,gitlab:Sd,files:lv,folders:Qs,"chevron-right":Ap,"user-tie":uv,"user-graduate":I1,"chalkboard-teacher":P1,bolt:R1,robot:dv,brain:A1}[te]||Vo}tc(()=>f.destroy());function z(K){if(f?.handleKeyboard(K))return K.preventDefault(),K.stopPropagation(),!0;switch(K.key){case"ArrowUp":return K.preventDefault(),K.stopPropagation(),S(),!0;case"ArrowDown":return K.preventDefault(),K.stopPropagation(),O(),!0;case"ArrowRight":return!l(v)||!zi(l(v))?!1:(K.preventDefault(),K.stopPropagation(),N(),!0);case"Enter":return K.preventDefault(),K.stopPropagation(),N(),!0;case"Escape":return K.preventDefault(),K.stopPropagation(),l(h).length>0?f.navigateToRoot():o()?.(),!0;default:return!1}}function M({event:K}){return z(K)}function S(){const K=l(F).length;K!==0&&(k(d,(l(d)+K-1)%K),E())}function O(){const K=l(F).length;K!==0&&(k(d,(l(d)+1)%K),E())}function N(){D(l(d))}async function E(){if(await Yo(),!g)return;const K=g.querySelector(".mention-item.selected");if(!K)return;const I=l(oe)?l(U).find(te=>te.items[0]===l(F)[l(d)]):void 0;I&&document.getElementById(X(I))?.scrollIntoView?.({block:"nearest",behavior:"instant"}),K.scrollIntoView?.({block:"nearest",behavior:"instant"})}function D(K){const I=l(F)[K];I&&(zi(I)?(f.push(I),k(d,0)):i()(I))}function ee(K){f.navigateToBreadcrumb(K),k(d,0)}ct(()=>{l(p),k(d,0),k(m,!0)});const U=w(()=>SL(Array.isArray(l(p))?l(p):[])),oe=w(()=>l(U).length>1),F=w(()=>l(U).flatMap(K=>K.items));function W(K){K.target instanceof Element&&K.target.closest(".mention-section-heading")&&K.preventDefault()}function X(K){return`${t}-section-${K.key}`}function le(K){return`${t}-option-${encodeURIComponent(`${zi(K)?"group":K.type}:${K.id}`)}`}const re=w(()=>l(v)?le(l(v)):void 0);ct(()=>u()?.(l(re)));var Q={onKeyDown:M,get items(){return s()},set items(K=[]){s(K),b()},get command(){return i()},set command(K){i(K),b()},get onClose(){return o()},set onClose(K){o(K),b()},get loading(){return a()},set loading(K=!1){a(K),b()},get listboxId(){return c()},set listboxId(K=`${t}-listbox`){c(K),b()},get onActiveOptionChange(){return u()},set onActiveOptionChange(K){u(K),b()},$set:Nt,$on:(K,I)=>Dt(e,K,I)},me=HL(),P=ne(me),$=ne(P),ce=ne($);{var pe=K=>{var I=OL(),te=ne(I);qe(te,{variant:"plain",class:"breadcrumb-item",onmousedown:de=>de.preventDefault(),onclick:()=>f.navigateToRoot(),children:(de,fe)=>{Pt();var ke=zt();L(be=>H(ke,be),[()=>_.chat_mentionList_all_label()]),x(de,ke)},$$slots:{default:!0}});var ve=A(te,2);is(ve,19,()=>l(h),(de,fe)=>de.id||`crumb-${fe}`,(de,fe,ke)=>{var be=LL(),q=A(ue(be),2);qe(q,{variant:"plain",class:"breadcrumb-item",onmousedown:Me=>Me.preventDefault(),onclick:()=>ee(l(ke)),children:(Me,ze)=>{var gt=IL(),Le=ue(gt);{var De=vt=>{var Vt=PL(),nt=se(Vt,!0);L(()=>H(nt,l(fe).icon)),x(vt,Vt)};j(Le,vt=>{l(fe).icon&&vt(De)})}var Fe=A(Le);L(()=>H(Fe,` ${l(fe).label??""}`)),x(Me,gt)},$$slots:{default:!0}}),x(de,be)}),Y(I),x(K,I)};j(ce,K=>{l(h).length>0&&K(pe)})}var ye=A(ce,2);{var Z=K=>{var I=DL();is(I,20,()=>[0,1,2,3],te=>te,(te,ve)=>{var de=NL(),fe=A(ne(de),2);Y(de),L(()=>Gi(fe,`width: ${55+ve*12}%`)),x(te,de)}),Y(I),L(te=>st(I,"aria-label",te),[()=>_.ui_combobox_loadingOptions_message()]),x(K,I)},ae=K=>{var I=zL();is(I,21,()=>l(U),te=>te.key,(te,ve)=>{var de=BL(),fe=ne(de);{var ke=q=>{var Me=$L(),ze=se(Me,!0);L(gt=>{st(Me,"id",gt),H(ze,l(ve).label)},[()=>X(l(ve))]),x(q,Me)};j(fe,q=>{l(oe)&&q(ke)})}var be=A(fe,2);is(be,17,()=>l(ve).items,q=>le(q),(q,Me)=>{r(q,()=>l(Me))}),Y(de),L(q=>{st(de,"role",l(oe)?"group":void 0),st(de,"aria-labelledby",q)},[()=>l(oe)?X(l(ve)):void 0]),x(te,de)}),Y(I),L(te=>{st(I,"id",c()),st(I,"aria-label",te),st(I,"aria-activedescendant",l(re)),st(I,"aria-busy",a())},[()=>_.chat_mentionList_ariaLabel()]),Jr("keydown",I,z),Jr("mousemove",I,()=>k(m,!1)),Jr("pointerdown",I,W),Jr("mousedown",I,W),x(K,I)},V=K=>{var I=FL(),te=se(I,!0);L(ve=>H(te,ve),[()=>_.chat_mentionList_noResults_label()]),x(K,I)};j(ye,K=>{a()&&l(p).length===0?K(Z):l(p).length>0?K(ae,1):K(V,-1)})}return Y($),Y(P),Y(me),sr(me,K=>g=K,()=>g),x(n,me),Lt(Q)}Ao(["keydown","mousemove","pointerdown","mousedown"]);class UL{constructor(e){rt(this,"unregisterPopup");rt(this,"component",null);rt(this,"popup",null);rt(this,"editorElement",null);rt(this,"inputContainer",null);rt(this,"listboxId",`mention-listbox-${crypto.randomUUID()}`);rt(this,"previousAria",new Map);rt(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=xl(Wc,{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=xl(Wc,{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?(St.info("[MentionSuggestionRenderer] Found .rich-input-container"),e):(e=this.editorElement.closest(".rich-textarea"),e?(St.info("[MentionSuggestionRenderer] Found .rich-textarea"),e):(e=this.editorElement.closest('[style*="position"]'),e?(St.info("[MentionSuggestionRenderer] Found positioned ancestor"),e):(St.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){St.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`),St.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(St.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){St.info("[MentionSuggestionRenderer] Initializing popup and component in onUpdate (onStart was skipped)"),this.onStart(e);return}this.component&&this.popup?(St.info("[MentionSuggestionRenderer] Updating component props without remounting"),this.component.$set({items:e.items,command:e.command,loading:!1})):!this.component&&this.popup&&(St.info("[MentionSuggestionRenderer] Creating component in onUpdate"),this.component=xl(Wc,{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 VL(n){const e=new UL(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 Un(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=WL(t,r);return i?{score:jL(t,r,i),matches:i}:null}function WL(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 jL(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||KL(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 KL(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 GL(n,e){if(!n||!e)return null;if(!n.includes("/"))return Un(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=qL(t,r);return s?{score:JL(t,r,s),matches:[]}:null}function qL(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(Un(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&&Un(i,f)){t.push(c),r=c+1,o=!0;break}if(d&&Un(i,d)){t.push(c),r=c+1,o=!0;break}}}if(!o)return null}return t}function JL(n,e,t){let r=0;r+=1,r+=t.length*.2;let s=0;for(let o=1;o<t.length;o++)t[o]===t[o-1]+1&&(s+=.15);r+=s,t.length>0&&t[t.length-1]===e.length-1&&(r+=.3);for(let o=0;o<n.length&&o<t.length;o++){const a=n[o],c=e[t[o]];a.toLowerCase()===c.toLowerCase()&&(r+=.2)}return Math.min(r/3,1)}function Na(n,e,t){return JSON.stringify({query:n,workspaceId:t.workspaceId,repoPath:t.repoPath,currentFile:t.currentFile,currentNote:t.currentNote,providers:e.map(r=>[r.id,r.getCacheKey?.(t)])})}const sw="*",XL=["member","note","agent","file","folder","script","terminal",sw,"specialist"];function iw(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(sw)??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 YL(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 QL{constructor(e={}){rt(this,"searchDebounceTimer",null);rt(this,"currentAbortController",null);rt(this,"cache",new Map);rt(this,"config");rt(this,"isSearching",!1);this.config={debounceMs:e.debounceMs??100,maxResults:e.maxResults??50,cacheMaxAge:e.cacheMaxAge??3e4,enableSemantic:e.enableSemantic??!1,enableLivePreview:e.enableLivePreview??!0,enableCollaboration:e.enableCollaboration??!1,typeOrder:e.typeOrder??[],maxResultsPerKind:e.maxResultsPerKind??20}}async search(e,t,r){this.cancelPendingSearch();const s=Na(e,t,r),i=this.cache.get(s);if(i&&!this.isCacheExpired(i))return St.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=v=>{d||(d=!0,f(),c(v))},p=v=>{d||(d=!0,f(),u(v))},g=()=>p(new DOMException("Search cancelled","AbortError"));a.addEventListener("abort",g,{once:!0});const m=async()=>{try{if(a.aborted){p(new DOMException("Search cancelled","AbortError"));return}St.debug("[SearchService] Searching with providers:",t.map(E=>E.id));const v=Na(e,t,r),C=await Promise.all(t.map(E=>this.searchWithProvider(E,e,r,a)));if(a.aborted)return;if(v!==Na(e,t,r)){h([]);return}const M=this.combineResults(C.flat()).filter(E=>kL(E)),S=this.applyFuzzyMatching(e,M),O=iw(S,this.config.typeOrder),N=this.config.typeOrder.length>0?YL(O,this.config.maxResultsPerKind):O.slice(0,this.config.maxResults);this.cache.set(v,{results:N,timestamp:Date.now()}),St.debug(`[SearchService] Found ${N.length} results`),h(N)}catch(v){a.aborted?p(new DOMException("Search cancelled","AbortError")):(St.error("[SearchService] Search error:",v),p(v instanceof Error?v:new Error(String(v))))}};e?this.searchDebounceTimer=setTimeout(m,this.config.debounceMs):m()})}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||St.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=GL(e,a);u&&(o=Math.max(o,u.score*1.8))}const c=Un(e,i.label);if(c&&(o=Math.max(o,c.score*1.5)),i.subtitle){const u=Un(e,i.subtitle);u&&(o=Math.max(o,u.score))}if(i.description){const u=Un(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 ZL{constructor(){rt(this,"id","file");rt(this,"triggers",["@file","@f"]);rt(this,"default",!0);rt(this,"supportsRanges",!0);rt(this,"supportsLivePreview",!0);rt(this,"recentFiles",new Set);rt(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){St.debug("[FileProvider] Searching for:",{query:e,context:{workspaceId:t.workspaceId}});const r=t.workspaceId;if(!r)return[];try{const s=await vv("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 St.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?Un(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 eO{constructor(){rt(this,"id","member")}getCacheKey(e){const t=At.state;return JSON.stringify({backendId:u_.select(t),ownPrincipalId:t.presence.ownPrincipalId,members:e.workspaceId?Ip.select(t,e.workspaceId):[]})}async search(e,t){const{workspaceId:r}=t;if(!r)return[];const s=e.replace(/^@/,"").toLowerCase();return Ip.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 tO{constructor(){rt(this,"id","folder");rt(this,"triggers",["@folder","@dir"])}async search(e,t){const r=t.workspaceId;if(!r)return[];try{const{backendRequest:s}=await gs(async()=>{const{backendRequest:c}=await import("./BU46x7E3.js").then(u=>u.j);return{backendRequest:c}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),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?Un(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 St.debug("[FolderProvider] Failed to get folders:",s),[]}}}const nO=10,rO=.3;function sO(n){const e=n.toLowerCase().split(/\s+/).filter(Boolean);return(t,r)=>{const s=t?Un(n,t):null;if(s)return 1+s.score;if(r){const i=r.toLowerCase();if(e.every(o=>i.includes(o)))return rO}return 0}}class iO{constructor(){rt(this,"id","note");rt(this,"triggers",["@note","@n"]);rt(this,"supportsRanges",!0);rt(this,"cachedNotes",[]);rt(this,"lastCacheUpdate",0);rt(this,"cacheTimeout",5e3)}async getSiblingWorkspaces(e){if(!e)return[];try{const[{store:t},{selectWorkspaceItems:r}]=await Promise.all([gs(()=>import("./BlKpyqxv.js"),__vite__mapDeps([11,12,13,2,14,15,4,8,1,16,6,3,17,18]),import.meta.url),gs(()=>import("./BwmV4u5a.js").then(o=>o.dY),__vite__mapDeps([19,6,4,1,2,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26]),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 St.debug("[NoteProvider] Failed to get sibling workspaces:",t),[]}}async fetchNotesFromWorkspace(e,t){try{const[{store:r},{listSlimNotesRequested:s}]=await Promise.all([gs(()=>import("./BlKpyqxv.js"),__vite__mapDeps([11,12,13,2,14,15,4,8,1,16,6,3,17,18]),import.meta.url),gs(()=>import("./CQNY8AIr.js").then(o=>o.LF),__vite__mapDeps([12,13,2,14,15,4,8,1,16,6,3]),import.meta.url)]);return(await r.dispatch(s(e))).map(o=>({note:o,workspaceId:e,workspaceTitle:t}))}catch(r){St.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?sO(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,nO).map(({entry:{note:p,workspaceId:g,workspaceTitle:m},score:v})=>{const C=g===t.workspaceId,z=C?void 0:_.chat_mentions_fromWorkspace_subtitle({workspace:m||g}),M=p.content||p.contentPreview;return{candidate:{id:p.id,type:"note",label:p.title||p.id||_.chat_mentions_untitledNote_label(),subtitle:z,description:M?`${M.substring(0,100)}...`:"",icon:"📝",uri:`devspace://note/${p.id}`,meta:{preview:M?.substring(0,200)||"",workspaceId:g,...C?{}:{isExternalLink:!0}}},score:v}});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){St.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 oO{constructor(){rt(this,"id","external");rt(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||Un(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 aO{constructor(){rt(this,"id","rule");rt(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||Un(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 lO{constructor(){rt(this,"id","task");rt(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||Un(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 cO{constructor(){rt(this,"id","personality");rt(this,"triggers",["@personality","@persona"]);rt(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||Un(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 uO{constructor(){rt(this,"id","command");rt(this,"triggers",["@cmd","@command"])}async search(e,t){return[$m.USE_DEFAULT_CONTEXT,$m.CLEAR_CONTEXT].filter(s=>!e||s.label.toLowerCase().includes(e.toLowerCase()))}}class dO{constructor(){rt(this,"id","terminal");rt(this,"triggers",["@terminal","@term"])}async search(e,t){try{const{terminalManager:r}=await gs(async()=>{const{terminalManager:m}=await import("./BYrBvRoU.js").then(v=>v.c);return{terminalManager:m}},__vite__mapDeps([27,2,1,28,29,3,4,30,31,12,13,14,15,8,16,6,0,5,7,9,10,32,24,33,34,35,36,37,38,39,25,40,41]),import.meta.url),{selectTerminals:s,selectTerminalDisplayName:i}=await gs(async()=>{const{selectTerminals:m,selectTerminalDisplayName:v}=await import("./Bjx82_QL.js").then(C=>C.i);return{selectTerminals:m,selectTerminalDisplayName:v}},__vite__mapDeps([40,12,13,2,14,15,4,8,1,16,6,3]),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 m of c)d.add(m.id),f.push({id:m.id,name:i.select(a,t.workspaceId,m.id)});for(const m of u)d.has(m.terminalId)||(d.add(m.terminalId),f.push({id:m.terminalId,name:m.title||_.terminal_quakeOverlay_terminal_fallback()}));if(f.length===0)return[];const p=e?["terminal","term"].some(m=>m.startsWith(e.toLowerCase())||e.toLowerCase().startsWith(m)):!1;return(e&&!p?f.filter(m=>Un(e,m.name)!==null):f).slice(0,10).map((m,v)=>({id:m.id,type:"terminal",label:m.name,subtitle:_.chat_mentions_terminalIndex_subtitle({index:v+1}),description:_.chat_mentions_terminalOutput_description(),icon:"💻",uri:`devspace://terminal/${encodeURIComponent(m.id)}`,meta:{workspaceId:t.workspaceId}}))}catch(r){return St.debug("[TerminalProvider] Failed to get terminals:",r),[]}}}class fO{constructor(){rt(this,"id","script");rt(this,"triggers",["@script","@scripts"])}async search(e,t){try{const{selectScriptEntries:r}=await gs(async()=>{const{selectScriptEntries:c}=await import("./CPxXU1c_.js");return{selectScriptEntries:c}},__vite__mapDeps([42,12,13,2,14,15,4,8,1,16,6,3,43,44,22,7,9,45,46,23,0,5,10,21,47,26,48,49,20,50,51,52,19,24,25,53,29,28,54,55,33,31,56]),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=>Un(e,c.name)!==null||Un(e,Bp(c))!==null):s).slice(0,10).map(c=>{const u=c.runtime.status,d=Vp(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} · ${Bp(c)}`,description:_.chat_mentions_scriptOutput_description(),icon:"▶️",uri:`devspace://script/${encodeURIComponent(c.id)}`,meta:{workspaceId:t.workspaceId,command:c.command,status:Vp(u)?"ok":u==="exited"?"warning":void 0}}})}catch(r){return St.debug("[ScriptProvider] Failed to get scripts:",r),[]}}}class hO{constructor(){rt(this,"id","specialist");rt(this,"triggers",["@specialist","@spec"])}async search(e,t){try{const r=r_.select(At.state);return!r||r.length===0?[]:r.filter(s=>e?Un(e,s.name)!==null||Un(e,s.id)!==null||Un(e,s.description)!==null||Un(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 St.debug("[SpecialistProvider] Failed to get specialists:",r),[]}}}class pO{constructor(){rt(this,"id","agent");rt(this,"triggers",["@agent"])}async search(e,t){try{const{selectAllWorkspaceAgents:r}=await gs(async()=>{const{selectAllWorkspaceAgents:a}=await import("./BwmV4u5a.js").then(c=>c.dV);return{selectAllWorkspaceAgents:a}},__vite__mapDeps([19,6,4,1,2,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26]),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 v=n_.select(At.state,d);v&&(f=v.name)}if(e){const v=Un(e,u)!==null,C=Un(e,"agent")!==null,z=f&&Un(e,f)!==null,M=d&&Un(e,d)!==null;if(!v&&!C&&!z&&!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 m=a.lastActivity||a.lastModified;m&&!a.isStreaming&&p.push(jk(new Date(m))),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 St.debug("[AgentProvider] Failed to get agents:",r),[]}}}class gO{constructor(){rt(this,"providers",new Map);rt(this,"defaultProviders",[]);this.register(new ZL),this.register(new tO),this.register(new iO),this.register(new oO),this.register(new aO),this.register(new lO),this.register(new cO),this.register(new uO),this.register(new dO),this.register(new fO),this.register(new pO),this.register(new hO),this.register(new eO),this.defaultProviders=["file","folder","note","terminal","script","agent","specialist","member"]}register(e){this.providers.set(e.id,e),St.debug("[ProviderRegistry] Registered provider:",e.id)}unregister(e){this.providers.delete(e)}get(e){return this.providers.get(e)}getAll(){return Array.from(this.providers.values())}getDefault(){return this.defaultProviders.map(e=>this.providers.get(e)).filter(Boolean)}getByTrigger(e){return Array.from(this.providers.values()).filter(t=>t.triggers?.includes(e))}async searchAll(e,t){const r=e.startsWith("@")?this.getByTrigger(e.split(" ")[0]):this.getDefault();return(await Promise.all(r.map(i=>i.search(e,t)))).flat()}}const Ca=new gO,mO=5e3,vO=8,bO=100,yO=50,wO=/^devspace:\/\/[^\/]+\/([^\/]+)/,xO=[{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()}}],kO=[{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}],_O=[{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 SO(n){return typeof n.getCachedNotes=="function"}class CO{constructor(e={}){rt(this,"searchService");rt(this,"breadcrumbController");rt(this,"resolvers",new Map);rt(this,"config");rt(this,"cachedResults",new Map);this.config={...e,typeOrder:e.typeOrder??XL},this.searchService=new QL(this.config),this.breadcrumbController=new nw}async search(e,t){if(!t?.workspaceId&&!t?.repoPath)return St.error("[MentionSystem] search called without valid context (no workspaceId or repoPath)"),[];const r=(e||"").trim(),s=this.getProvidersForQuery(r);if(s.length===0)return St.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"||St.error("[MentionSystem] Search failed:",i),[]}}searchSync(e,t){const r=e.toLowerCase();if(!t?.workspaceId&&!t?.repoPath)return St.debug("[MentionSystem] searchSync called without workspaceId or repoPath - returning empty results"),[];const s=Na(e,this.getProvidersForQuery(e),t),i=Date.now();if(this.cachedResults.has(s)){const a=this.cachedResults.get(s);if(a&&i-a.timestamp<mO)return this.cachedResults.delete(s),this.cachedResults.set(s,a),a.results}this.updateCache(e,t).catch(a=>{St.warn("[MentionSystem] Background cache update failed:",a)});const o=[];return o.push(...this.getNoteCandidates(r)),o.push(...this.filterCandidates(kO,r,3)),o.push(...this.filterCandidates(_O,r,2)),iw(o,this.config.typeOrder??[]).slice(0,vO)}getNoteCandidates(e){const t=Ca.get("note");if(t&&SO(t))try{return(t.getCachedNotes()||[]).filter(s=>!e||s.label&&typeof s.label=="string"&&s.label.toLowerCase().includes(e)).slice(0,3)}catch(r){St.warn("[MentionSystem] Failed to get cached notes:",r)}return this.filterCandidates(xO,e,3)}filterCandidates(e,t,r){return t?e.filter(s=>s.label.toLowerCase().includes(t)).slice(0,r):e.slice(0,r)}async updateCache(e,t){try{const r=Na(e,this.getProvidersForQuery(e),t),s=await this.search(e,t);if(r!==Na(e,this.getProvidersForQuery(e),t))return;const i={results:s,timestamp:Date.now()};this.cachedResults.delete(r),this.cachedResults.set(r,i);const o=Ca.get("note");if(o&&await o.search(e,t),this.cachedResults.size>bO){const a=this.cachedResults.size-yO,c=Array.from(this.cachedResults.keys()).slice(0,a);for(const u of c)this.cachedResults.delete(u);St.debug(`[MentionSystem] Cache cleanup: removed ${a} entries`)}}catch(r){St.warn("[MentionSystem] Cache update failed:",r)}}getProvidersForQuery(e){if(!e)return Ca.getDefault();if(e.startsWith("@")){const r=e.indexOf(" "),s=r>0?e.substring(0,r):e,i=Ca.getByTrigger(s);if(i.length>0)return St.debug("[MentionSystem] Using triggered providers for:",s),i}const t=Ca.getDefault();return St.debug("[MentionSystem] Using default providers, count:",t.length),t}async resolve(e){if(!e||typeof e!="string")return St.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 St.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 St.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 St.warn("[MentionSystem] Invalid URI provided to getPreview:",e),null;try{return(await this.resolve(e)).preview||null}catch(t){return St.error("[MentionSystem] Failed to get preview:",t),null}}registerProvider(e){if(!e){St.error("[MentionSystem] Cannot register null/undefined provider");return}if(!e.id){St.error("[MentionSystem] Cannot register provider without id");return}try{Ca.register(e),St.debug(`[MentionSystem] Registered provider: ${e.id}`)}catch(t){St.error("[MentionSystem] Failed to register provider:",t)}}registerResolver(e,t){if(!e||!t){St.error("[MentionSystem] Cannot register resolver with invalid type or resolver");return}this.resolvers.has(e)&&St.warn(`[MentionSystem] Overwriting existing resolver for type: ${e}`),this.resolvers.set(e,t),St.debug(`[MentionSystem] Registered resolver for type: ${e}`)}findResolver(e){if(!e||typeof e!="string")return;const t=e.match(wO);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)}St.debug(`[MentionSystem] No resolver found for URI pattern: ${e}`)}getBreadcrumbController(){return this.breadcrumbController}clearCache(){this.searchService.clearCache(),this.cachedResults.clear(),St.debug("[MentionSystem] All caches cleared")}destroy(){try{this.searchService.destroy(),this.breadcrumbController.destroy(),this.cachedResults.clear(),this.resolvers.clear(),St.debug("[MentionSystem] System destroyed successfully")}catch(e){St.error("[MentionSystem] Error during destroy:",e)}}}let Yd=null;function MO(n){return Yd||(Yd=new CO(n),St.debug("[MentionSystem] Created new instance with config:",n)),Yd}const TO=JR.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 ow(n={}){return TO.configure({validate:void 0,...n})}const dB=ow,zm=n=>n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),EO={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},AO=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 EO[t]??e});function RO(n){const e=[];let t=0;for(const r of n1(n,"markdown",{decode:AO})){r.index>t&&e.push(n.slice(t,r.index));const s=r.parsed?r1(r.parsed):null;if(s){const i=s.attributes.map(([o,a])=>` ${o}="${zm(a)}"`).join("");e.push(`<span${i} class="${s.className}">${zm(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 PO=new Set(["code","pre","script","style","a"]);function IO(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("/>");(PO.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(RO(o)):e.push(o),t=i}return e.join("")}function LO(n){return n.replace(/^ +| +$/g,e=>" ".repeat(e.length)).replace(/ {2,}/g,e=>` ${" ".repeat(e.length-1)}`)}function OO(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function NO(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(OO).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 DO(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 NO(LO(o),e)}).join("<br>")}</p>`;return IO(s)}function Ma(n){return(n?.getText({blockSeparator:`
167
167
 
168
168
  `,textSerializers:{hardBreak:()=>`
169
- `}})??"").replace(/\u00A0/g," ")}function DO(n,e){const t=e.replace(/\r\n?/g,`
169
+ `}})??"").replace(/\u00A0/g," ")}function $O(n,e){const t=e.replace(/\r\n?/g,`
170
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 $O={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"},wl=new Vn("trailingHint");function zm(n,e){n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),e.onActivate()})}function Fm(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 BO(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",$O[e]),t.append(r),n.append(t)}function zO(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),Fm(e,n.ariaLabel),zm(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),Fm(t,n.ariaLabel),BO(t,n.icon),zm(t,n),e.append(t)}if(n.shortcut){const t=document.createElement("kbd");t.textContent=n.shortcut,e.append(t)}return e}function FO(n){let e=1;return n.descendants((t,r)=>{t.isText&&t.textContent.trim()&&(e=r+t.nodeSize)}),e}const HO=jn.create({name:"trailingHint",addProseMirrorPlugins(){return[new Tn({key:wl,state:{init:()=>null,apply(n,e){const t=n.getMeta(wl);return t===void 0?e:t}},props:{handleKeyDown(n,e){const t=wl.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=wl.getState(n);if(!e)return on.empty;const t=FO(n.doc);return on.create(n.doc,[Or.widget(t,()=>zO(e),{key:`prompt-trailing-hint-${e.kind}`,side:1,ignoreSelection:!0,stopEvent:r=>r.type==="mousedown"||r.type==="click"})])}}})]}});var UO=B('<div class="slash-skill-state svelte-m8tzng" role="status" aria-live="polite"> </div>'),VO=B('<div class="slash-skill-state svelte-m8tzng" role="alert"> <!></div>'),WO=B('<div class="slash-skill-state svelte-m8tzng" role="status"> </div>'),jO=B('<span class="type-body"> </span>'),KO=B('<div class="slash-skill-notice svelte-m8tzng" role="note"> </div>'),GO=B('<div class="slash-skill-options svelte-m8tzng" role="listbox" tabindex="-1"></div> <!>',1),qO=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 ow(n,e){const t=Ji();if(new.target)return Ot({component:ow,...n});It(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 m=w(()=>!s()&&!i()&&r()[l(p)]?v(r()[l(p)]):void 0);function v(W){return`${t}-option-${encodeURIComponent(`${W.name}:${W.location}`)}`}ct(()=>{r(),s(),i(),k(p,0)}),ct(()=>{h()?.(l(m))});function C(){l(g)?.querySelector('[role="option"][aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})}function z(W){r().length!==0&&(k(p,(l(p)+W+r().length)%r().length),C())}function M(W){const X=r()[W];X&&!s()&&!i()&&u()(X)}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(),z(-1),!0);case"ArrowDown":return r().length===0?!1:(W.preventDefault(),W.stopPropagation(),z(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 O({event:W}){return S(W)}var N={onKeyDown:O,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:Nt,$on:(W,X)=>Dt(e,W,X)},E=qO(),D=ne(E);{var ee=W=>{var X=UO(),le=se(X,!0);L(re=>H(le,re),[()=>_.chat_slashSkillSuggestionList_loading_label()]),x(W,X)},U=W=>{var X=VO(),le=ne(X),re=A(le);{var Q=me=>{qe(me,{variant:"ghost",size:"sm",onpointerdown:P=>P.preventDefault(),get onclick(){return f()},children:(P,$)=>{Pt();var ce=zt();L(pe=>H(ce,pe),[()=>_.ui_errorToast_retry_label()]),x(P,ce)},$$slots:{default:!0}})};j(re,me=>{f()&&me(Q)})}Y(X),L(me=>H(le,`${me??""} `),[()=>_.chat_slashSkillSuggestionList_loadFailed_label()]),x(W,X)},oe=W=>{var X=WO(),le=se(X,!0);L(re=>H(le,re),[()=>a()??_.chat_slashSkillSuggestionList_noResults_label()]),x(W,X)},F=W=>{var X=GO(),le=ue(X);ss(le,23,r,me=>`${me.name}:${me.location}`,(me,P,$)=>{Hu(me,{get content(){return l(P).description},side:"right",align:"start",size:"sm",class:"w-full",children:(ce,pe)=>{{let ye=w(()=>v(l(P))),Z=w(()=>Cr(ch(),"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($)&&"active")),ae=w(()=>l(p)===l($));qe(ce,{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(ae)},onpointerenter:()=>k(p,l($),!0),onpointerdown:V=>V.preventDefault(),onclick:()=>M(l($)),children:(V,K)=>{var I=jO(),te=se(I,!0);L(()=>H(te,l(P).name)),x(V,I)},$$slots:{default:!0}})}},$$slots:{default:!0}})}),Y(le),sr(le,me=>k(g,me),()=>l(g));var re=A(le,2);{var Q=me=>{var P=KO(),$=se(P,!0);L(()=>H($,c())),x(me,P)};j(re,me=>{c()&&me(Q)})}L(me=>{st(le,"id",o()),st(le,"aria-label",me),st(le,"aria-activedescendant",l(m))},[()=>_.chat_slashSkillSuggestionList_ariaLabel()]),qr("keydown",le,S),x(W,X)};j(D,W=>{s()?W(ee):i()?W(U,1):r().length===0?W(oe,2):W(F,-1)})}return Y(E),x(n,E),Lt(N)}Ro(["keydown"]);const Hm=/\s/u;function JO(n,e=n.length){if(e<0||e>n.length)return null;let t=e-1;for(;t>=0&&!Hm.test(n[t]);)t-=1;if(t+=1,n[t]!=="/"||e<t+1)return null;let r=t+1;for(;r<n.length&&!Hm.test(n[r]);)r+=1;return e>r?null:{query:n.slice(t+1,e),from:t,to:r}}function XO(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 YO(n,e){const t=e.toLowerCase();return n.map(r=>({skill:r,rank:XO(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 QO=B('<div class="tiptap-root svelte-bv9i3d"><!> <div></div></div>');function ZO(n,e){const t=Ji();if(new.target)return Ot({component:ZO,...n});It(e,!0);const r=RI.extend({parseHTML(){return[{tag:"span[data-mention]",getAttrs:R=>{const xe=R.getAttribute("data-meta");let Ee={};if(xe)try{Ee=JSON.parse(xe)}catch{Ee={}}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:Ee}}}]},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=fa("TipTapEditor"),i=CO();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,""),m=y(e,"workspace",7),v=y(e,"repoPath",7),C=y(e,"autoFocus",7,!1),z=y(e,"onUpdate",7),M=y(e,"onSubmit",7),S=y(e,"onForceSubmit",7),O=y(e,"onEscape",7),N=y(e,"onHistoryPrev",7),E=y(e,"onHistoryNext",7),D=y(e,"onMentionStart",7),ee=y(e,"onMentionSelect",7),U=y(e,"onSelectionChange",7),oe=y(e,"contextItems",23,()=>[]),F=y(e,"trailingHint",7,null),W=y(e,"skills",23,()=>[]),X=y(e,"skillsLoading",7,!1),le=y(e,"skillsError",7,null),re=y(e,"onSkillsRetry",7),Q=y(e,"slashEmptyLabel",7),me=y(e,"slashNotice",7),P=y(e,"unavailableSkillTitle",7),$=y(e,"screenReferences",7),ce=y(e,"screenInsertions",23,()=>[]),pe=y(e,"screenInterim",23,()=>[]),ye=y(e,"screenSpeechActive",7,!1),Z=y(e,"onScreenInsertionApplied",7),ae=y(e,"onCompositionChange",7),V=y(e,"onUserTextInput",7),K=y(e,"onScreenReferencesEdited",7),I=y(e,"minHeight",7,80),te=y(e,"maxHeight",7,300);const ve=kv();let de=he(null);ct(()=>{if(!(!l(de)||!ve))return ve.register(l(de),()=>Be())});const fe=w(()=>(!d()||f())&&!h()),ke=w(()=>!l(fe)&&!h());let be=he(void 0),q=he(null),Me=he(!1);const ze=new Set;function gt(){const R=l(q);if(!R||l(Me)||R.view.composing)return!1;if(!$())return!0;fL(R,$()),hL(R,$());for(const xe of ce().slice(0,1)){if(ze.has(xe.id)){if(!Z())return!1;Z()(xe.id,Ta(R));continue}const Ee=vo.getState(R.state)?.anchor;if(!Z()||!pL(R,xe,$(),Ee))return!1;ze.add(xe.id),Z()(xe.id,Ta(R))}return ce().length<=1}ct(()=>{c();const R=l(q);!u()||!R||R.isDestroyed||Xs(()=>R.view.dispatch(R.state.tr.setMeta("placeholder-refresh",!0)))}),ct(()=>{$(),ce(),!(!l(q)||l(Me)||!l(fe))&&Xs(()=>gt())}),ct(()=>{const R=l(q),xe=pe(),Ee=$(),ot=ye()||ce().length>0;!R||!Ee||l(Me)||R.view.composing||Xs(()=>{const Ne=vo.getState(R.state),Se=R.state.tr.setMeta(vo,xe.length||ot?{parts:xe,references:Ee,anchor:Ne?.anchor??R.state.selection.from,ariaLabel:_.hardwareConsole_ptt_listening_label()}:null);R.view.dispatch(xe.length?Se.scrollIntoView():Se);const Zt=R.view.dom.querySelector("[data-screen-interim]"),{selection:yn}=R.state;if(Zt?.parentNode&&R.view.hasFocus()&&yn.empty&&yn.from===vo.getState(R.state)?.anchor){const Ke=Array.prototype.indexOf.call(Zt.parentNode.childNodes,Zt);window.getSelection()?.collapse(Zt.parentNode,Ke+1)}})});let Le=null,De=null,Fe;function vt(){Fe?.(),Fe=void 0,Le&&uo(Le),De?.remove(),Le=null,De=null}let Vt=!1;ct(()=>{l(q)&&l(q).view.dom.setAttribute("aria-label",a())});let nt=he(!1),Pe=he(null),Ce=he(null),we=he(null),Ve=he(null);const Mt=`slash-skill-listbox-${t}`;let ie=he(void 0);const $e=w(()=>l(Pe)?YO(W(),l(Pe).query):[]),lt=w(()=>l(Pe)?`${l(Pe).from}:${l(Pe).to}:${l(Pe).query}`:null),yt=w(()=>l(nt)&&l(Pe)!==null&&l(lt)!==l(Ce)&&l(Pe).from!==l(we)&&(l($e).length>0||Q()!==void 0&&l(Pe).query===""&&!X())&&l(fe));ct(()=>{const R=l(q),xe=l(be),Ee=P();if(!R||!xe)return;const ot=()=>{for(const Ne of xe.querySelectorAll('[data-type="skill-command"]')){const Se=Ee?.(Ne.dataset.skillName??"");Ne.classList.toggle("skill-command-chip--unavailable",Se!==void 0),Se?Ne.title=Se:Ne.removeAttribute("title")}};return ot(),R.on("update",ot),()=>{R.off("update",ot)}}),ct(()=>{if(l(yt))return da(Be)});function mt(R){return{...Bh(R.schema),hardBreak:()=>`
172
- `,pasteChip:()=>" "}}function Tt(R,xe){return $h(R.state.doc,{from:0,to:xe},{blockSeparator:`
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 BO=new Set(["P","SPAN","META","BR"]);function zO(n,e){if(/\r|\n/.test(e))return!1;const t=new DOMParser().parseFromString(n,"text/html").body;if(t.querySelectorAll("p").length>1)return!1;for(const s of Array.from(t.querySelectorAll("*")))if(!BO.has(s.tagName)||s.tagName==="SPAN"&&(s.getAttribute("style")||s.getAttribute("class"))||s.tagName==="BR"&&!s.classList.contains("ProseMirror-trailingBreak"))return!1;return(t.textContent??"")===e}const FO={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"},yl=new Vn("trailingHint");function Fm(n,e){n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),e.onActivate()})}function Hm(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 HO(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",FO[e]),t.append(r),n.append(t)}function UO(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),Hm(e,n.ariaLabel),Fm(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),Hm(t,n.ariaLabel),HO(t,n.icon),Fm(t,n),e.append(t)}if(n.shortcut){const t=document.createElement("kbd");t.textContent=n.shortcut,e.append(t)}return e}function VO(n){let e=1;return n.descendants((t,r)=>{t.isText&&t.textContent.trim()&&(e=r+t.nodeSize)}),e}const WO=jn.create({name:"trailingHint",addProseMirrorPlugins(){return[new Tn({key:yl,state:{init:()=>null,apply(n,e){const t=n.getMeta(yl);return t===void 0?e:t}},props:{handleKeyDown(n,e){const t=yl.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=yl.getState(n);if(!e)return an.empty;const t=VO(n.doc);return an.create(n.doc,[Or.widget(t,()=>UO(e),{key:`prompt-trailing-hint-${e.kind}`,side:1,ignoreSelection:!0,stopEvent:r=>r.type==="mousedown"||r.type==="click"})])}}})]}});var jO=B('<div class="slash-skill-state svelte-m8tzng" role="status" aria-live="polite"> </div>'),KO=B('<div class="slash-skill-state svelte-m8tzng" role="alert"> <!></div>'),GO=B('<div class="slash-skill-state svelte-m8tzng" role="status"> </div>'),qO=B('<span class="type-body"> </span>'),JO=B('<div class="slash-skill-notice svelte-m8tzng" role="note"> </div>'),XO=B('<div class="slash-skill-options svelte-m8tzng" role="listbox" tabindex="-1"></div> <!>',1),YO=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 aw(n,e){const t=Ji();if(new.target)return Ot({component:aw,...n});It(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 m=w(()=>!s()&&!i()&&r()[l(p)]?v(r()[l(p)]):void 0);function v(W){return`${t}-option-${encodeURIComponent(`${W.name}:${W.location}`)}`}ct(()=>{r(),s(),i(),k(p,0)}),ct(()=>{h()?.(l(m))});function C(){l(g)?.querySelector('[role="option"][aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})}function z(W){r().length!==0&&(k(p,(l(p)+W+r().length)%r().length),C())}function M(W){const X=r()[W];X&&!s()&&!i()&&u()(X)}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(),z(-1),!0);case"ArrowDown":return r().length===0?!1:(W.preventDefault(),W.stopPropagation(),z(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 O({event:W}){return S(W)}var N={onKeyDown:O,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:Nt,$on:(W,X)=>Dt(e,W,X)},E=YO(),D=ne(E);{var ee=W=>{var X=jO(),le=se(X,!0);L(re=>H(le,re),[()=>_.chat_slashSkillSuggestionList_loading_label()]),x(W,X)},U=W=>{var X=KO(),le=ne(X),re=A(le);{var Q=me=>{qe(me,{variant:"ghost",size:"sm",onpointerdown:P=>P.preventDefault(),get onclick(){return f()},children:(P,$)=>{Pt();var ce=zt();L(pe=>H(ce,pe),[()=>_.ui_errorToast_retry_label()]),x(P,ce)},$$slots:{default:!0}})};j(re,me=>{f()&&me(Q)})}Y(X),L(me=>H(le,`${me??""} `),[()=>_.chat_slashSkillSuggestionList_loadFailed_label()]),x(W,X)},oe=W=>{var X=GO(),le=se(X,!0);L(re=>H(le,re),[()=>a()??_.chat_slashSkillSuggestionList_noResults_label()]),x(W,X)},F=W=>{var X=XO(),le=ue(X);is(le,23,r,me=>`${me.name}:${me.location}`,(me,P,$)=>{Hu(me,{get content(){return l(P).description},side:"right",align:"start",size:"sm",class:"w-full",children:(ce,pe)=>{{let ye=w(()=>v(l(P))),Z=w(()=>Cr(uh(),"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($)&&"active")),ae=w(()=>l(p)===l($));qe(ce,{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(ae)},onpointerenter:()=>k(p,l($),!0),onpointerdown:V=>V.preventDefault(),onclick:()=>M(l($)),children:(V,K)=>{var I=qO(),te=se(I,!0);L(()=>H(te,l(P).name)),x(V,I)},$$slots:{default:!0}})}},$$slots:{default:!0}})}),Y(le),sr(le,me=>k(g,me),()=>l(g));var re=A(le,2);{var Q=me=>{var P=JO(),$=se(P,!0);L(()=>H($,c())),x(me,P)};j(re,me=>{c()&&me(Q)})}L(me=>{st(le,"id",o()),st(le,"aria-label",me),st(le,"aria-activedescendant",l(m))},[()=>_.chat_slashSkillSuggestionList_ariaLabel()]),Jr("keydown",le,S),x(W,X)};j(D,W=>{s()?W(ee):i()?W(U,1):r().length===0?W(oe,2):W(F,-1)})}return Y(E),x(n,E),Lt(N)}Ao(["keydown"]);const Um=/\s/u;function QO(n,e=n.length){if(e<0||e>n.length)return null;let t=e-1;for(;t>=0&&!Um.test(n[t]);)t-=1;if(t+=1,n[t]!=="/"||e<t+1)return null;let r=t+1;for(;r<n.length&&!Um.test(n[r]);)r+=1;return e>r?null:{query:n.slice(t+1,e),from:t,to:r}}function ZO(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 eN(n,e){const t=e.toLowerCase();return n.map(r=>({skill:r,rank:ZO(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 tN=B('<div class="tiptap-root svelte-bv9i3d"><!> <div></div></div>');function nN(n,e){const t=Ji();if(new.target)return Ot({component:nN,...n});It(e,!0);const r=PI.extend({parseHTML(){return[{tag:"span[data-mention]",getAttrs:R=>{const xe=R.getAttribute("data-meta");let Ee={};if(xe)try{Ee=JSON.parse(xe)}catch{Ee={}}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:Ee}}}]},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=da("TipTapEditor"),i=MO();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,""),m=y(e,"workspace",7),v=y(e,"repoPath",7),C=y(e,"autoFocus",7,!1),z=y(e,"onUpdate",7),M=y(e,"onSubmit",7),S=y(e,"onForceSubmit",7),O=y(e,"onEscape",7),N=y(e,"onHistoryPrev",7),E=y(e,"onHistoryNext",7),D=y(e,"onMentionStart",7),ee=y(e,"onMentionSelect",7),U=y(e,"onSelectionChange",7),oe=y(e,"contextItems",23,()=>[]),F=y(e,"trailingHint",7,null),W=y(e,"skills",23,()=>[]),X=y(e,"skillsLoading",7,!1),le=y(e,"skillsError",7,null),re=y(e,"onSkillsRetry",7),Q=y(e,"slashEmptyLabel",7),me=y(e,"slashNotice",7),P=y(e,"unavailableSkillTitle",7),$=y(e,"screenReferences",7),ce=y(e,"screenInsertions",23,()=>[]),pe=y(e,"screenInterim",23,()=>[]),ye=y(e,"screenSpeechActive",7,!1),Z=y(e,"onScreenInsertionApplied",7),ae=y(e,"onCompositionChange",7),V=y(e,"onUserTextInput",7),K=y(e,"onScreenReferencesEdited",7),I=y(e,"minHeight",7,80),te=y(e,"maxHeight",7,300);const ve=_v();let de=he(null);ct(()=>{if(!(!l(de)||!ve))return ve.register(l(de),()=>Be())});const fe=w(()=>(!d()||f())&&!h()),ke=w(()=>!l(fe)&&!h());let be=he(void 0),q=he(null),Me=he(!1);const ze=new Set;function gt(){const R=l(q);if(!R||l(Me)||R.view.composing)return!1;if(!$())return!0;hL(R,$()),pL(R,$());for(const xe of ce().slice(0,1)){if(ze.has(xe.id)){if(!Z())return!1;Z()(xe.id,Ma(R));continue}const Ee=vo.getState(R.state)?.anchor;if(!Z()||!gL(R,xe,$(),Ee))return!1;ze.add(xe.id),Z()(xe.id,Ma(R))}return ce().length<=1}ct(()=>{c();const R=l(q);!u()||!R||R.isDestroyed||Xs(()=>R.view.dispatch(R.state.tr.setMeta("placeholder-refresh",!0)))}),ct(()=>{$(),ce(),!(!l(q)||l(Me)||!l(fe))&&Xs(()=>gt())}),ct(()=>{const R=l(q),xe=pe(),Ee=$(),ot=ye()||ce().length>0;!R||!Ee||l(Me)||R.view.composing||Xs(()=>{const Ne=vo.getState(R.state),_e=R.state.tr.setMeta(vo,xe.length||ot?{parts:xe,references:Ee,anchor:Ne?.anchor??R.state.selection.from,ariaLabel:_.hardwareConsole_ptt_listening_label()}:null);R.view.dispatch(xe.length?_e.scrollIntoView():_e);const Xt=R.view.dom.querySelector("[data-screen-interim]"),{selection:yn}=R.state;if(Xt?.parentNode&&R.view.hasFocus()&&yn.empty&&yn.from===vo.getState(R.state)?.anchor){const Ge=Array.prototype.indexOf.call(Xt.parentNode.childNodes,Xt);window.getSelection()?.collapse(Xt.parentNode,Ge+1)}})});let Le=null,De=null,Fe;function vt(){Fe?.(),Fe=void 0,Le&&uo(Le),De?.remove(),Le=null,De=null}let Vt=!1;ct(()=>{l(q)&&l(q).view.dom.setAttribute("aria-label",a())});let nt=he(!1),Pe=he(null),Ce=he(null),we=he(null),Ve=he(null);const Mt=`slash-skill-listbox-${t}`;let ie=he(void 0);const $e=w(()=>l(Pe)?eN(W(),l(Pe).query):[]),lt=w(()=>l(Pe)?`${l(Pe).from}:${l(Pe).to}:${l(Pe).query}`:null),yt=w(()=>l(nt)&&l(Pe)!==null&&l(lt)!==l(Ce)&&l(Pe).from!==l(we)&&(l($e).length>0||Q()!==void 0&&l(Pe).query===""&&!X())&&l(fe));ct(()=>{const R=l(q),xe=l(be),Ee=P();if(!R||!xe)return;const ot=()=>{for(const Ne of xe.querySelectorAll('[data-type="skill-command"]')){const _e=Ee?.(Ne.dataset.skillName??"");Ne.classList.toggle("skill-command-chip--unavailable",_e!==void 0),_e?Ne.title=_e:Ne.removeAttribute("title")}};return ot(),R.on("update",ot),()=>{R.off("update",ot)}}),ct(()=>{if(l(yt))return ua(Be)});function mt(R){return{...zh(R.schema),hardBreak:()=>`
172
+ `,pasteChip:()=>" "}}function Tt(R,xe){return Bh(R.state.doc,{from:0,to:xe},{blockSeparator:`
173
173
 
174
- `,textSerializers:mt(R)}).replace(/\u00A0/g," ")}function We(R){return Tt(R,R.state.doc.content.size)}function Ge(R){return Tt(R,R.state.selection.from)}function Yt(R,xe){const Ee=We(R),ot=JO(Ee,Ge(R).length);(!ot||ot.from!==l(Pe)?.from)&&(k(Ce,null),k(we,null)),k(Pe,ot,!0),ot&&xe?.dismissNewContext&&k(Ce,l(lt),!0)}function Be(){k(we,l(Pe)?.from??null,!0)}function jt(R){R.preventDefault()}function Yn(R){if(!l(q)||!l(Pe))return;const xe=We(l(q)),Ee=Ge(l(q)).length,ot={from:l(q).state.selection.from-l(Pe).query.length-1,to:l(q).state.selection.from+l(Pe).to-Ee},Ne=l(Pe).to===xe.length||!/^\s/u.test(xe.slice(l(Pe).to)),Se=[{type:"skillCommand",attrs:{name:R.name}},...Ne?[{type:"text",text:" "}]:[]];l(q).chain().focus().insertContentAt(ot,Se).setTextSelection(ot.from+2).run()}function Bn(R){const xe=NO(R,W().map(Ee=>Ee.name));return $()?dL(xe,$()):xe}function ge(R){if(!l(yt)||!l(Ve))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(Ve).onKeyDown({event:R})?!0:R.key==="Enter"?(R.preventDefault(),!0):!1}function ft(){l(q)&&l(q).view&&l(q).chain().focus().insertContent("@").run()}function Rt(R){return l(q)&&l(q).view?(l(q).chain().focus().insertContent(R).run(),!0):!1}function an(){if(h())return!1;if(l(q)&&l(q).view)try{if(l(q).view.hasFocus())return!0;const R=l(q),xe=document.activeElement;return requestAnimationFrame(()=>{if(l(q)!==R||R.isDestroyed||h()||R.view.hasFocus())return;const Ee=document.activeElement;Ee!==xe&&Ee instanceof HTMLElement&&_v(Ee)&&!R.view.dom.contains(Ee)||(R.view.focus(),R.commands.scrollIntoView())}),typeof l(q).view.hasFocus=="function"?l(q).view.hasFocus():!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focus:",R)}return!1}function Gt(){if(h())return!1;if(l(q)&&l(q).view)try{return l(q).chain().focus("end").run(),!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focusEnd:",R)}return!1}function ut(){if(h())return!1;if(l(q)&&l(q).view)try{return l(q).chain().focus().selectAll().run(),!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",R)}return!1}function ht(){try{return l(q)?.getHTML?.()??""}catch(R){return s.error("[TipTapEditor] Error getting HTML:",R),l(q)?.getText?.()??""}}function Ie(){l(q)&&(Vt=!0,l(q).commands.clearContent(!0),Vt=!1)}async function He(R){if(!l(q))return;const xe=Bn(R||"");cu(xe,l(q).schema).eq(l(q).state.doc)||l(q).chain().command(({tr:Ee})=>(Ee.setMeta("external-update",!0),!0)).setContent(xe).run()}function Xe(R,xe){l(q)&&l(q).view&&l(q).chain().focus().setImage({src:R,alt:xe||""}).createParagraphNear().focus().run()}function pt(){if(!l(q))return s.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const R=[];return l(q).state.doc.descendants(xe=>{if(xe.type.name==="image"){const Ee=xe.attrs.src;Ee&&Ee.startsWith("data:")&&R.push({src:Ee,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 Qe(){return Ta(l(q))}function et(R){if(s.debug("TipTapEditor: insertContextMention called",{hasEditor:!!l(q),hasEditorView:!!l(q)?.view,attrs:{itemType:R.itemType,identifier:R.identifier,title:R.title}}),l(q)&&l(q).view){const xe=l(q).chain().focus().insertContextMention(R).run();return s.debug("TipTapEditor: insertContextMention result",{result:xe}),xe}return s.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function it(R){if(!l(q)||!l(q).view)return s.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return l(q).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 xt(){if(!l(q))return s.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const R=[];return l(q).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 Ft(){if(!l(q))return s.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const R=[];return l(q).state.doc.descendants(xe=>{if(xe.type.name==="contextMention"){const Ee=xe.attrs;R.push({itemType:Ee.itemType,provider:Ee.provider,title:Ee.title,url:Ee.url,identifier:Ee.identifier,contextId:Ee.contextId,description:Ee.description,metadata:Ee.metadata})}return!0}),s.debug("TipTapEditor: Extracted context mentions",{mentionCount:R.length}),R}const $t={char:"@",pluginKey:new Vn("mention"),items:async({query:R})=>{if(s.debug("Mention query:",R),D()?.(R),!m()&&v()){s.debug("No workspace but repoPath available, using async search:",v());const Ee={workspaceId:void 0,repoPath:v(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const ot=await i.search(R,Ee);return s.debug("Mention search results from repoPath:",ot.length),ot}catch(ot){s.error("Failed to search mentions with repoPath:",ot);const Ne=i.searchSync(R,Ee);return s.debug("Fallback sync search results:",Ne.length),Ne}}if(!m())return s.debug("No workspace and no repoPath - returning empty results"),[];const xe={workspaceId:m().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Ee=await i.search(R,xe);return s.debug("Mention search results:",Ee.length),Ee}catch(Ee){return s.error("Failed to search mentions:",Ee),[]}},render:()=>UL(ve),command:({editor:R,range:xe,props:Ee})=>{const ot={id:Ee.id,label:Ee.label,type:Ee.type,uri:Ee.uri,meta:Ee.meta||{}};R.view&&R.chain().focus().deleteRange(xe).insertContent({type:"mention",attrs:ot}).run(),ee()?.(Ee)}};Fu(()=>{let R=!1;return(async()=>{const xe=Bn(o()||"");if(R)return;const Ee=l(be);if(!Ee)return;k(q,new FA({element:Ee,extensions:[...$()?[cL.configure({references:()=>$()??[]}),uL]:[],dI.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}),iw({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:Ne=>/^https?:\/\//.test(Ne)||Ne.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),fI.configure({placeholder:u()?({editor:Ne})=>vo.getState(Ne.state)?.parts.length?"":c():c(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),LI.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),HI.configure({workspaceId:m()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:$t,renderHTML({node:Ne}){const Se=Hv(Ne.attrs,m()?.id,oS);return["span",{"data-mention":"true","data-type":Ne.attrs.type||"file","data-uri":Ne.attrs.uri||"","data-meta":JSON.stringify(Ne.attrs.meta||{}),"data-id":Ne.attrs.id,"data-label":Ne.attrs.label,class:"mention-chip",tabindex:"0"},Se]},renderText:({node:Ne})=>{const Se=Ne.attrs||{};try{return r1({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"}`}}}),sL.extend({renderText:({node:Ne})=>{const Se=Ne.attrs||{},Zt=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(Zt)))}]`}}),lL,mL,HO],content:xe,editable:l(fe),enableCoreExtensions:{delete:!1},onCreate:({editor:Ne})=>{Yt(Ne),C()&&requestAnimationFrame(()=>{if(Ne.isDestroyed)return;Ne.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:Ne})=>{Ne.docChanged&&Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)},onUpdate:({editor:Ne,transaction:Se})=>{if(Se.getMeta("external-update")||Se.getMeta(tp)||Vt)return;const Zt=K()?gL(Se):null;Zt&&K()?.(Zt);const yn=Ta(Ne);Yt(Ne,{dismissNewContext:Se.getMeta("uiEvent")==="paste"}),Se.getMeta(hd)?z()?.(yn,{programmatic:!0}):z()?.(yn)},onSelectionUpdate:({editor:Ne,transaction:Se})=>{Yt(Ne,{dismissNewContext:Se.getMeta("uiEvent")==="paste"});const{from:Zt,to:yn,empty:Ke}=Ne.state.selection;if(Ke)U()?.(null);else{const cn=Ne.state.doc.textBetween(Zt,yn," ");U()?.(cn.trim()||null)}},onFocus:({editor:Ne})=>{Xs(()=>{k(nt,!0),Yt(Ne)})},onBlur:()=>{Xs(()=>{k(nt,!1)})},editorProps:{handleDOMEvents:{compositionstart:()=>(Xs(()=>{k(Me,!0)}),ae()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!l(q)||l(q).isDestroyed||(Xs(()=>{k(Me,!1)}),ae()?.(!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:(Ne,Se)=>{if(bL(Se))return!0;const Zt=Se.clipboardData?.getData("text/plain");if(Zt){const yn=Zt.split(`
175
- `);if(yn.length>=5){const{state:Ke,dispatch:cn}=Ne,En=Ke.schema.nodes.pasteChip.create({content:Zt,lineCount:yn.length}),Pn=Ke.tr.replaceSelectionWith(En).setMeta("uiEvent","paste");return cn(Pn),!0}if(/\r|\n/.test(Zt)){const{state:Ke,dispatch:cn}=Ne,En=DO(Ke.schema,Zt);if(En.length>0){const Pn=new je(_e.from(En),1,1);return cn(Ke.tr.replaceSelection(Pn).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(Ne,Se)=>vL(Se),handleKeyDown:(Ne,Se)=>{if(Ne.composing||Se.isComposing||Se.keyCode===229)return!1;if(ge(Se))return!0;if(Se.key==="Escape"&&O())return Se.preventDefault(),O()(),!0;const Zt=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),yn=Ke=>f_(Se,Xc(Ke),Zt);if(yn("chat.mention-context")&&Xc("chat.mention-context")!=="@")return Se.preventDefault(),l(q)?.chain().focus().insertContent("@").run(),!0;if(Zt&&Se.ctrlKey&&!Se.metaKey){if(Se.key==="a"){Se.preventDefault();const{state:Ke,dispatch:cn}=Ne,Pn=Ke.selection.$head.start();return cn(Ke.tr.setSelection(Je.create(Ke.doc,Pn))),!0}if(Se.key==="e"){Se.preventDefault();const{state:Ke,dispatch:cn}=Ne,Pn=Ke.selection.$head.end();return cn(Ke.tr.setSelection(Je.create(Ke.doc,Pn))),!0}if(Se.key==="k"){Se.preventDefault();const{state:Ke,dispatch:cn}=Ne,En=Ke.selection.$head,Pn=En.pos,As=En.end();return Pn<As&&cn(Ke.tr.delete(Pn,As)),!0}if(Se.key==="p"){Se.preventDefault();const Ke=window.getSelection();return Ke&&Ke.rangeCount>0&&Ke.modify("move","backward","line"),!0}if(Se.key==="n"){Se.preventDefault();const Ke=window.getSelection();return Ke&&Ke.rangeCount>0&&Ke.modify("move","forward","line"),!0}if(Se.key==="f"){Se.preventDefault();const Ke=window.getSelection();return Ke&&Ke.rangeCount>0&&Ke.modify("move","forward","character"),!0}if(Se.key==="b"){Se.preventDefault();const Ke=window.getSelection();return Ke&&Ke.rangeCount>0&&Ke.modify("move","backward","character"),!0}}if(Se.metaKey&&!Se.ctrlKey&&!Se.altKey){if(Se.key==="ArrowLeft"){Se.preventDefault();const Ke=window.getSelection();return Ke&&Ke.rangeCount>0&&Ke.modify(Se.shiftKey?"extend":"move","backward","lineboundary"),!0}if(Se.key==="ArrowRight"){Se.preventDefault();const Ke=window.getSelection();return Ke&&Ke.rangeCount>0&&Ke.modify(Se.shiftKey?"extend":"move","forward","lineboundary"),!0}if(Se.key==="ArrowUp"){Se.preventDefault();const{state:Ke,dispatch:cn}=Ne,En=1;if(Se.shiftKey){const{from:Pn}=Ke.selection;cn(Ke.tr.setSelection(Je.create(Ke.doc,En,Pn)))}else cn(Ke.tr.setSelection(Je.create(Ke.doc,En)));return!0}if(Se.key==="ArrowDown"){Se.preventDefault();const{state:Ke,dispatch:cn}=Ne,En=Ke.doc.content.size-1;if(Se.shiftKey){const{to:Pn}=Ke.selection;cn(Ke.tr.setSelection(Je.create(Ke.doc,Pn,En)))}else cn(Ke.tr.setSelection(Je.create(Ke.doc,En)));return!0}}if(yn("chat.force-send"))return Se.preventDefault(),S()?.(),!0;if(yn("chat.new-line"))return Se.preventDefault(),l(q)?.chain().setHardBreak().scrollIntoView().run(),!0;if(Se.key==="ArrowUp"&&N()&&!Se.shiftKey&&!Se.metaKey&&!Se.ctrlKey){if($t.pluginKey.getState(Ne.state)?.active)return!1;const{state:cn}=Ne,{from:En}=cn.selection,Pn=En<=1,As=cn.doc.textContent.length===0;if(Pn||As){const $r=N()();if($r!==null)return Se.preventDefault(),l(q)?.chain().setContent(Bn($r)).focus("end").run(),z()?.($r),!0}}if(Se.key==="ArrowDown"&&E()&&!Se.shiftKey&&!Se.metaKey&&!Se.ctrlKey){if($t.pluginKey.getState(Ne.state)?.active)return!1;const{state:cn}=Ne,{to:En}=cn.selection,Pn=cn.doc.content.size-1,As=En>=Pn,$r=cn.doc.textContent.length===0;if(As||$r){const Hs=E()();if(Hs!==null)return Se.preventDefault(),l(q)?.chain().setContent(Bn(Hs)).focus("end").run(),z()?.(Hs),!0}}return yn("chat.send")?$t.pluginKey.getState(Ne.state)?.active?!1:M()?(Se.preventDefault(),M()(),!0):!1:!1}}}),!0),Ee.addEventListener("mouseover",Ye),Ee.addEventListener("mouseout",ln),Ee.addEventListener("click",yr),l(q).view.dom.addEventListener("keydown",ei)})(),()=>{R=!0}});function Ye(R){const xe=R.target,Ee=Ip(xe);if(Ee){const ot=xe.getBoundingClientRect();if(!De){De=document.createElement("div"),(ve?.target()??document.body).appendChild(De);const Ne=Ee.type||"file",Se=Ee.label||xe.textContent||"",Zt={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};Le=kl(Z0,{target:De,props:{mention:{id:Ee.id,type:Ne,label:Se,uri:Ee.uri,meta:Ee.meta,icon:Zt[Ne]||"📄"},position:{x:ot.left,y:ot.bottom+5},onClose:()=>{Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)}}});const yn=De.firstElementChild;yn instanceof HTMLElement&&(Fe=ve?.register(yn,vt)),De.addEventListener("mouseout",_n)}}}function ln(R){const xe=R.target;R.relatedTarget?.closest(".mention-hover-preview")||xe.hasAttribute("data-mention")&&Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)}function _n(R){R.relatedTarget?.closest("[data-mention]")||Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)}async function yr(R){const xe=Ip(R.target);if(xe&&xe.type!=="member"){if(xe.intentUrl){R.preventDefault(),R.stopPropagation();const{handleIntentLink:Ee}=await ps(async()=>{const{handleIntentLink:ot}=await import("./DctTjn6B.js");return{handleIntentLink:ot}},__vite__mapDeps([57,1,2,44,3,4,22,7,8,9,45,46,23,0,5,6,10,21,47,26,48,12,13,14,15,16,49,20,50,51,52,19,24,25,55,33]),import.meta.url);await Ee(xe.intentUrl);return}if(xe.type==="note"&&xe.note){if(R.preventDefault(),R.stopPropagation(),xe.note.workspaceId){const{handleIntentLink:Ee}=await ps(async()=>{const{handleIntentLink:ot}=await import("./DctTjn6B.js");return{handleIntentLink:ot}},__vite__mapDeps([57,1,2,44,3,4,22,7,8,9,45,46,23,0,5,6,10,21,47,26,48,12,13,14,15,16,49,20,50,51,52,19,24,25,55,33]),import.meta.url);await Ee(s1(xe.note.id,xe.note.workspaceId))}else{const{navigateToNote:Ee}=await ps(async()=>{const{navigateToNote:ot}=await import("./BYBXBR1N.js").then(Ne=>Ne.h);return{navigateToNote:ot}},__vite__mapDeps([58,28,2,59,60,39,19,6,4,1,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26,33,56,61]),import.meta.url);await Ee(xe.note.id)}return}if(xe.type==="file"&&xe.filePath){R.preventDefault(),R.stopPropagation();const{navigateToFile:Ee}=await ps(async()=>{const{navigateToFile:ot}=await import("./BYBXBR1N.js").then(Ne=>Ne.h);return{navigateToFile:ot}},__vite__mapDeps([58,28,2,59,60,39,19,6,4,1,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26,33,56,61]),import.meta.url);await Ee(xe.filePath);return}}}function ei(R){if(!R.metaKey||R.ctrlKey||R.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(R.key)||!l(q))return;const{state:xe,dispatch:Ee}=l(q).view;if(R.key==="ArrowLeft"){R.preventDefault(),R.stopPropagation();const ot=window.getSelection();ot&&ot.rangeCount>0&&ot.modify(R.shiftKey?"extend":"move","backward","lineboundary")}else if(R.key==="ArrowRight"){R.preventDefault(),R.stopPropagation();const ot=window.getSelection();ot&&ot.rangeCount>0&&ot.modify(R.shiftKey?"extend":"move","forward","lineboundary")}else if(R.key==="ArrowUp"){R.preventDefault(),R.stopPropagation();const ot=1;if(R.shiftKey){const{from:Ne}=xe.selection;Ee(xe.tr.setSelection(Je.create(xe.doc,ot,Ne)).scrollIntoView())}else Ee(xe.tr.setSelection(Je.create(xe.doc,ot)).scrollIntoView())}else if(R.key==="ArrowDown"){R.preventDefault(),R.stopPropagation();const ot=xe.doc.content.size-1;if(R.shiftKey){const{to:Ne}=xe.selection;Ee(xe.tr.setSelection(Je.create(xe.doc,Ne,ot)).scrollIntoView())}else Ee(xe.tr.setSelection(Je.create(xe.doc,ot)).scrollIntoView())}}tc(()=>{l(q)&&(l(q).view.dom.removeEventListener("keydown",ei),l(q).destroy()),l(be)&&(l(be).removeEventListener("mouseover",Ye),l(be).removeEventListener("mouseout",ln),l(be).removeEventListener("click",yr)),De&&De.removeEventListener("mouseout",_n),Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove())});let rn=0;ct(()=>{if(!l(q))return;const R=Ta(l(q));if(o()===R)return;if(l(q).view.hasFocus()){rn+=1;return}const xe=l(q).view.hasFocus(),{from:Ee}=l(q).state.selection,ot=++rn;(async()=>{const Ne=Bn(o()||"");!l(q)||ot!==rn||Ta(l(q))===R&&l(q).chain().command(({tr:Se})=>(Se.setMeta("external-update",!0),!0)).setContent(Ne).command(({tr:Se,state:Zt})=>{if(xe)try{const yn=Zt.doc.content.size,Ke=Math.min(Ee,yn);Se.setSelection(Je.create(Zt.doc,Ke,Ke))}catch{}return!0}).run()})()}),ct(()=>{l(q)&&l(q).setEditable(l(fe),!1)}),ct(()=>{!l(q)||l(q).isDestroyed||l(q).view.dispatch(l(q).state.tr.setMeta(wl,F()))}),ct(()=>{const R=l(q)?.view.dom;R&&(R.setAttribute("aria-haspopup","listbox"),l(yt)&&l(ie)?(R.setAttribute("aria-controls",Mt),R.setAttribute("aria-activedescendant",l(ie))):(R.removeAttribute("aria-controls"),R.removeAttribute("aria-activedescendant")))});var Er={flushScreenEvidence:gt,insertAtSymbol:ft,insertText:Rt,focus:an,focusEnd:Gt,focusAndSelectAll:ut,getHTML:ht,clear:Ie,setContent:He,insertImage:Xe,getInlineImages:pt,getTextContent:Qe,insertContextMention:et,insertMention:it,getMentions:xt,getContextMentions:Ft,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 m()},set workspace(R){m(R),b()},get repoPath(){return v()},set repoPath(R){v(R),b()},get autoFocus(){return C()},set autoFocus(R=!1){C(R),b()},get onUpdate(){return z()},set onUpdate(R){z(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 O()},set onEscape(R){O(R),b()},get onHistoryPrev(){return N()},set onHistoryPrev(R){N(R),b()},get onHistoryNext(){return E()},set onHistoryNext(R){E(R),b()},get onMentionStart(){return D()},set onMentionStart(R){D(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 oe()},set contextItems(R=[]){oe(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 X()},set skillsLoading(R=!1){X(R),b()},get skillsError(){return le()},set skillsError(R=null){le(R),b()},get onSkillsRetry(){return re()},set onSkillsRetry(R){re(R),b()},get slashEmptyLabel(){return Q()},set slashEmptyLabel(R){Q(R),b()},get slashNotice(){return me()},set slashNotice(R){me(R),b()},get unavailableSkillTitle(){return P()},set unavailableSkillTitle(R){P(R),b()},get screenReferences(){return $()},set screenReferences(R){$(R),b()},get screenInsertions(){return ce()},set screenInsertions(R=[]){ce(R),b()},get screenInterim(){return pe()},set screenInterim(R=[]){pe(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 ae()},set onCompositionChange(R){ae(R),b()},get onUserTextInput(){return V()},set onUserTextInput(R){V(R),b()},get onScreenReferencesEdited(){return K()},set onScreenReferencesEdited(R){K(R),b()},get minHeight(){return I()},set minHeight(R=80){I(R),b()},get maxHeight(){return te()},set maxHeight(R=300){te(R),b()},$set:Nt,$on:(R,xe)=>Dt(e,R,xe)},cs=QO(),Ut=ne(cs),Ja=()=>l(yt),Si=R=>!R&&Be();wt(Ut,()=>Kk,(R,xe)=>{xe(R,{get open(){return Ja()},set open(Ee){Si(Ee)},children:(Ee,ot)=>{var Ne=Ze(),Se=ue(Ne);{let Zt=w(()=>ve?.target());wt(Se,()=>xv,(yn,Ke)=>{Ke(yn,{get to(){return l(Zt)},children:(cn,En)=>{var Pn=Ze(),As=ue(Pn);{let $r=w(()=>l(be)??null);wt(As,()=>jk,(Hs,ga)=>{ga(Hs,{get customAnchor(){return l($r)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:jt,onCloseAutoFocus:jt,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return l(de)},set ref(Ci){k(de,Ci,!0)},children:(Ci,lc)=>{sr(ow(Ci,{get listboxId(){return Mt},get items(){return l($e)},get loading(){return X()},get error(){return le()},get emptyLabel(){return Q()},get notice(){return me()},get onRetry(){return re()},onSelect:Yn,onDismiss:Be,onActiveOptionChange:bs=>k(ie,bs,!0)}),bs=>k(Ve,bs,!0),()=>l(Ve))},$$slots:{default:!0}})})}x(cn,Pn)},$$slots:{default:!0}})})}x(Ee,Ne)},$$slots:{default:!0}})});var Yr=A(Ut,2);let Zi;return sr(Yr,R=>k(be,R),()=>l(be)),Y(cs),L(()=>{Zi=at(Yr,1,`tiptap-container ${p()??""}`,"svelte-bv9i3d",Zi,{"placeholder-suppressed":l(ke)}),Gi(Yr,`--tt-min-height:${I()}px;--tt-max-height:${te()}px`)}),x(n,cs),Lt(Er)}class aw extends Error{constructor(t){super(t);rt(this,"reason");this.name="EnhancePromptUnavailableError",this.reason=t}}function cB(n){return n instanceof aw&&n.reason.trim()?{description:n.reason}:void 0}function eN(n){return"available"in n&&n.available===!1}function uB(n){return n==="auggie"}function tN(n,e,{model:t,workspaceId:r}){return{prompt:n,mode:e,...t?{model:t}:{},...r?{workspaceId:r}:{}}}async function dB(n,e={}){const t=await mv("agent.enhancePrompt",tN(n,"enhance",e));if(eN(t))throw new aw(t.reason);return t}var nN=B('<span class="block truncate text-xs text-subtle" data-testid="start-on-locked-reason"> </span>'),rN=B('<span> </span> <span><span class="block truncate"> </span> <!></span> <!>',1),sN=B("<!> <!>",1),iN=B('<div data-testid="start-on-picker"><!></div>');function oN(n,e){const t=Ji();if(new.target)return Ot({component:oN,...n});It(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=ju(),p=new Ku;let g=he(!1),m=he(null),v=he(null);const C=w(()=>i().find(D=>D.id===s())??i()[0]),z=w(()=>i().map(D=>({value:`machine:${D.id}`,label:D.label,description:D.reason??D.hint??D.platform??void 0,disabled:D.disabled,data:D}))),M=w(()=>i().some(D=>D.kind==="cloud")),S=w(()=>l(M)?440:360);ct(()=>{if(u())return da(D=>{D.isComposing||u(!1)})});var O={get presentation(){return r()},set presentation(D="form"){r(D),b()},get value(){return s()},set value(D){s(D),b()},get options(){return i()},set options(D){i(D),b()},get onChange(){return o()},set onChange(D){o(D),b()},get lockedReason(){return a()},set lockedReason(D){a(D),b()},get label(){return c()},set label(D=_.workspace_initialAgentPicker_startOn_label()){c(D),b()},get open(){return u()},set open(D=!1){u(D),b()},$set:Nt,$on:(D,ee)=>Dt(e,D,ee)},N=iN(),E=ne(N);return wt(E,()=>Wu,(D,ee)=>{ee(D,{onOpenChange:U=>{U&&k(g,!lh(l(m),l(S)))},get open(){return u()},set open(U){u(U)},children:(U,oe)=>{var F=sN(),W=ue(F);{const le=(re,Q)=>{let me=()=>(Q?.()).props;{let P=w(()=>r()==="metadata"?"plain":"ghost"),$=w(()=>r()==="metadata"?void 0:"sm"),ce=w(()=>!!a()),pe=w(()=>r()==="footer"?"h-9 min-w-0 max-w-36 gap-1 px-2 text-sm font-medium":r()==="metadata"?`${dn.bareTrigger} w-full`:dn.fieldTrigger);qe(re,gs(me,{get variant(){return l(P)},get size(){return l($)},type:"button",wrapContent:!1,get disabled(){return l(ce)},get"aria-labelledby"(){return`${d} ${f}`},get class(){return l(pe)},get ref(){return l(m)},set ref(ye){k(m,ye,!0)},children:(ye,Z)=>{var ae=rN(),V=ue(ae),K=se(V,!0),I=A(V,2),te=ne(I),ve=se(te,!0),de=A(te,2);{var fe=q=>{var Me=nN(),ze=se(Me,!0);L(()=>H(ze,a())),x(q,Me)};j(de,q=>{a()&&q(fe)})}Y(I);var ke=A(I,2);{var be=q=>{tt(q,{get icon(){return sa},get class(){return dn.bareChevron}})};j(ke,q=>{r()==="metadata"&&!a()&&q(be)})}L(()=>{at(V,1,$n(r()==="form"?dn.fieldLabel:r()==="metadata"?"shrink-0 text-muted-foreground":"sr-only")),st(V,"id",d),H(K,c()),at(I,1,$n(r()==="metadata"?dn.bareValue:"min-w-0 flex-1 text-left")),st(I,"id",f),H(ve,l(C)?.label)}),x(ye,ae)},$$slots:{default:!0}}))}};wt(W,()=>Uu,(re,Q)=>{Q(re,{child:le,$$slots:{child:!0}})})}var X=A(W,2);{let le=w(()=>({to:h()})),re=w(()=>r()==="footer"?"top":r()==="metadata"||p.current||l(g)?"bottom":"left"),Q=w(()=>r()==="metadata"?"start":r()==="footer"||p.current||l(g)?"end":"start"),me=w(()=>r()!=="form"||p.current||l(g)?4:24),P=w(()=>h()?"absolute":"fixed"),$=w(()=>l(M)?"w-110":"w-90");wt(X,()=>Vu,(ce,pe)=>{pe(ce,{role:"dialog",get portalProps(){return l(le)},get"aria-label"(){return c()},get side(){return l(re)},get align(){return l(Q)},get sideOffset(){return l(me)},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($)??""}`},style:"max-height: min(440px, var(--bits-popover-content-available-height, calc(100dvh - 1rem)))",onOpenAutoFocus:ye=>{ye.preventDefault(),l(v)?.focus()},onCloseAutoFocus:ye=>{ye.preventDefault(),l(m)?.focus()},onkeydown:ye=>{ye.key==="Enter"&&ye.stopPropagation()},children:(ye,Z)=>{{const ae=(te,ve=Jr)=>{{let de=w(()=>ve().data.kind==="cloud"?rx:sx);tt(te,{get icon(){return l(de)},get class(){return dn.icon}})}};let V=w(()=>l(C)?`machine:${l(C).id}`:void 0),K=w(()=>_.workspace_initialAgentPicker_searchMachines_placeholder()),I=w(()=>_.workspace_initialAgentPicker_searchMachines_placeholder());ah(ye,{get value(){return l(V)},get options(){return l(z)},get open(){return u()},get ariaLabel(){return c()},get placeholder(){return l(K)},get searchPlaceholder(){return l(I)},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 dn.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(v)},set inputRef(te){k(v,te,!0)},optionIcon:ae,$$slots:{optionIcon:!0}})}},$$slots:{default:!0}})})}x(U,F)},$$slots:{default:!0}})}),Y(N),L(()=>at(N,1,$n(r()==="footer"?"min-w-0":"w-full min-w-0"))),x(n,N),Lt(O)}function lw(n,{availability:e,enabledProviders:t,profiles:r}){return xk(n)&&!kk(r,n)?!1:u_(e,_k(n))&&!Tv({...t},n)}function fB(n,e){return e.availability?n.filter(t=>lw(t.id,e)).map(t=>({id:t.id})):[]}function hB({activeProviderId:n,defaultProviderId:e,availableProviders:t,...r}){const s=n||e;return!Tv({...r.enabledProviders},s)&&(!r.availability||lw(s,r))?s:t[0]?.id??""}function pB({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 aN=fa("SpecialistDefaultPreviews");var ec,$a;class gB{constructor(){ao(this,ec,he(Sr({})));ao(this,$a,0)}get byProvider(){return l(ts(this,ec))}set byProvider(e){k(ts(this,ec),e,!0)}invalidate(){wp(this,$a,ts(this,$a)+1),this.byProvider={}}load(e){if(!e||e in this.byProvider)return;const t=ts(this,$a);(async()=>{try{const r=await Uo.specialists.list(e);if(t!==ts(this,$a)||r.length===0)return;const s={};for(const i of r)s[i.id]=i;this.byProvider={...this.byProvider,[e]:s}}catch(r){aN.debug("Failed to fetch resolved-model previews:",{provider:e,error:r})}})()}}ec=new WeakMap,$a=new WeakMap;function ja(n){const e=n.replace(/\\/g,"/");return e.length>1?e.replace(/\/+$/,""):e}function lN(n,e){const t=ja(n),r=ja(e);return!t||!r?!1:t===r||t.startsWith(r==="/"?"/":`${r}/`)}function cN(n,e){let t=null;for(const r of e)r.type!=="local"||!r.path||lN(n,r.path)&&(!t||ja(r.path).length>ja(t.path).length)&&(t=r);return t}function mB(n,e){const t=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),r=ja(n);return t?r.endsWith(`/${t}`)?r.slice(0,-t.length-1)||"/":null:r||null}function vB(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 uN(n){return[n.title,n.cwd,n.gitBranch??"",n.sessionId,n.provider].filter(Boolean).join(" ")}function dN(n){const e=ja(n),t=e.lastIndexOf("/");return t>=0&&t<e.length-1?e.slice(t+1):e}function fN(n,e){return n.repoRoot?n.repoRoot:cN(n.cwd,e)?.path??null}function np(n,e){if(new.target)return Ot({component:np,...n});It(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:Nt,$on:(i,o)=>Dt(e,i,o)};return ix(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Lt(s)}var hN=new Set(["$$slots","$$events","$$legacy","ref","pressed","disabled","size","class","onclick","title","ariaLabel","ariaDescribedby","onChange","children"]);function cw(n,e){if(new.target)return Ot({component:cw,...n});It(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=Yi(e,hN);function g(M){r(M),f()?.(M),e.onPressedChange?.(M)}const m={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 v={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:Nt,$on:(M,S)=>Dt(e,M,S)},C=Ze(),z=ue(C);{let M=w(()=>Cr("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",m[i()],o()));wt(z,()=>Lv,(S,O)=>{O(S,gs({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(N){t(N)},get pressed(){return r()},set pressed(N){r(N)},children:(N,E)=>{var D=Ze(),ee=ue(D);Xn(ee,()=>h()??Jr),x(N,D)},$$slots:{default:!0}}))})}return x(n,C),Lt(v)}var pN=B('<span class="ml-auto shrink-0"> </span>'),gN=B('<span><!></span> <span class="min-w-0 truncate"> </span> <!> <!>',1),mN=B('<div role="status"> </div>'),Um=B("<!> <!>",1),Ea=B("<span> </span>"),vN=B('<div><!> <!> <span class="truncate"> </span></div>'),bN=B('<span class="text-orange-500"> </span>'),yN=B('<span> </span> <span class="text-sm opacity-75 ml-1"> </span>',1),wN=B('<!> <span class="sr-only"> </span>',1),xN=B('<span class="w-1.5 h-1.5 ml-0.5 rounded-full bg-warning cursor-help"></span>'),kN=B('<div class="flex-0 flex flex-col"><!></div>'),_N=B('<div><!> <!> <span class="flex-1 text-left truncate min-w-0"><!></span> <!> <!></div>'),SN=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>'),CN=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>'),MN=B('<!> <span class="flex-1 min-w-0"><span class="text-subtle"> </span> <strong class="text-foreground ml-1 truncate"> </strong></span>',1),TN=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),EN=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>'),AN=B('<div><div class="text-sm text-danger"> </div> <div class="text-sm text-subtle mt-1"> </div></div>'),RN=B('<div class="text-sm text-subtle mt-1"> </div>'),PN=B('<div role="alert"><div class="text-sm text-danger"> </div> <!></div>'),IN=B("<!> ",1),LN=B('<div class="flex shrink-0 flex-wrap items-center gap-1 border-t border-border bg-popover px-2 py-1.5"><!> <!></div>'),ON=B('<!> <div class="min-h-16 overflow-hidden flex flex-1 flex-col" data-testid="branch-results"><!> <!></div> <!>',1),NN=B('<p class="type-caption mt-2 pl-6.5 text-muted-foreground"> </p>'),DN=B('<div class="shrink-0 border-t border-border p-2"><div class="px-3 py-2.5"><!> <!></div></div>'),$N=B("<!> <div><!></div> <!>",1),BN=B('<div class="relative min-w-0"><!></div>');function xl(n,e){const t=Ji();if(new.target)return Ot({component:xl,...n});It(e,!0);const r=()=>nn(C,"$branchByRepo$",o),s=()=>nn(h,"$connection$",o),i=()=>nn(f,"$hostMember$",o),[o,a]=Ka(),c=J=>{{let Oe=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel()),Ue=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());qe(J,{onclick:Zi,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(Ue)},children:(Ct,Wt)=>{var Et=Ze(),fn=ue(Et);{var Qt=Bt=>{fi(Bt,{size:14})},Ae=Bt=>{tt(Bt,{get icon(){return Rp},class:"size-3.5!"})};j(fn,Bt=>{l(ke)?Bt(Qt):Bt(Ae,-1)})}x(Ct,Et)},$$slots:{default:!0}})}},u=J=>{var Oe=Ze(),Ue=ue(Oe);{var Ct=Et=>{mo(Et,{size:16,get class(){return dn.icon}})},Wt=Et=>{mo(Et,{size:14,class:"text-subtle"})};j(Ue,Et=>{oe()?Et(Ct):Et(Wt,-1)})}x(J,Oe)},d=(J,Oe=Jr)=>{const Ue=w(()=>$r(Oe()));var Ct=Um(),Wt=ue(Ct);{let Qt=w(()=>_.ui_groupedCombobox_toggleGroup_ariaLabel({group:Oe().label})),Ae=w(()=>oe()?`w-full justify-start gap-2 ${dn.group} h-auto`:"w-full justify-start gap-2 px-2 text-subtle");qe(Wt,{variant:"ghost",size:"sm",wrapContent:!1,get"aria-expanded"(){return l(Ue)},get"data-branch-group"(){return Oe().key},get"aria-label"(){return l(Qt)},get class(){return l(Ae)},onclick:()=>Hs(Oe()),children:(Bt,Wn)=>{var An=gN(),ur=ue(An),ys=ne(ur);{let un=w(()=>`${oe()?"size-4!":"size-3.5!"} shrink-0 ${l(Ue)?"":"-rotate-90"}`);tt(ys,{get icon(){return sa},get class(){return l(un)}})}Y(ur);var Qr=A(ur,2),pi=se(Qr,!0),eo=A(Qr,2);{var Mi=un=>{Gk(un,{size:"compact",class:"rounded-full px-1.5 font-normal text-subtle",children:(Zr,ti)=>{Pt();var Kn=zt();L(Us=>H(Kn,Us),[()=>hs(Oe().options.length)]),x(Zr,Kn)},$$slots:{default:!0}})};j(eo,un=>{Oe().key!=="remote"&&un(Mi)})}var Ti=A(eo,2);{var Rs=un=>{var Zr=pN(),ti=se(Zr,!0);L(Kn=>{st(Zr,"role",Oe().key==="remote"&&l(te)?"status":void 0),H(ti,Kn)},[()=>l(te)?_.ui_combobox_loadingOptions_message():_.workspace_branchSelector_groupLoad_label()]),x(un,Zr)};j(Ti,un=>{Oe().key==="remote"&&(l(te)||!l(ve)&&l(K).length===0)&&un(Rs)})}L(()=>{at(ur,1,`first-line-icon ${oe()?"w-4":"w-3.5"}`),H(pi,Oe().label)}),x(Bt,An)},$$slots:{default:!0}})}var Et=A(Wt,2);{var fn=Qt=>{var Ae=mN(),Bt=se(Ae,!0);L(Wn=>{at(Ae,1,`type-caption py-2 pr-3 text-muted-foreground ${oe()?"pl-8":"pl-6"}`),H(Bt,Wn)},[()=>_.workspace_branchSelector_noRemoteBranches_label()]),x(Qt,Ae)};j(Et,Qt=>{Oe().key==="remote"&&l(Ue)&&!l(te)&&l(ve)&&Oe().options.length===0&&Qt(fn)})}x(J,Ct)},f=Xf(),h=kd();let p=null;const g=fa("BranchSelector"),m=ju(),v=new Ku,C=vx();let z=y(e,"variant",7,"underline"),M=y(e,"value",7,""),S=y(e,"repoPath",7),O=y(e,"repoType",7),N=y(e,"githubUrl",7),E=y(e,"disabled",7,!1),D=y(e,"dropUp",7,!1),ee=y(e,"portal",7,!0),U=y(e,"triggerClass",7),oe=y(e,"rowLabel",7),F=y(e,"hasTriggerIcon",7,!0),W=y(e,"description",7),X=y(e,"skipIsolation",7,!1),le=y(e,"suggestedBranch",7),re=y(e,"onSkipIsolationChange",7),Q=y(e,"onGitHubAuthNeededChange",7),me=y(e,"onBranchStatusChange",7),P=y(e,"onBranchesLoaded",7),$=y(e,"onchange",7),ce=y(e,"showUncommittedIndicator",7,!1),pe=y(e,"showTriggerChevron",7,!1),ye=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),Z=y(e,"triggerContentClass",7,"gap-0.75"),ae=he(""),V=he(Sr([])),K=he(Sr([])),I=he(!1),te=he(!1),ve=he(!1),de=he(""),fe=he(""),ke=he(!1),be=he(null),q=he(""),Me=null,ze=he(Sr([])),gt=0,Le=0,De=null,Fe=he(null),vt=he(!1),Vt=he(!1),nt=he(void 0),Pe=he(null),Ce=he(null),we=he(void 0),Ve=he(void 0);const Mt=w(()=>O()==="local"&&typeof re()=="function"&&!!l(fe));let ie=he(void 0);ct(()=>{l(vt)||(k(ie,void 0),k(Ve,void 0))}),ct(()=>{if(l(vt))return da(J=>{J.isComposing||Ut()})});let $e=he("none"),lt=he(!1);const yt=_.workspace_isolationMode_worktree_label(),mt=w(()=>X()&&O()==="local");let Tt=he(0),We=he(!1),Ge=he(!1),Yt=he(null),Be=null;ct(()=>{if(typeof Q()=="function"&&l($e)!==Be){Be=l($e);try{Q()(l($e))}catch(J){g.error("Error in onGitHubAuthNeededChange callback",J)}}});const jt=w(()=>M()||l(ae)),Yn=w(()=>l(jt)===l(fe)&&l(fe)!=="");ct(()=>{if(!l(mt)||!l(fe)||l(jt)===l(fe))return;const J=l(fe);Xs(()=>Er(J,{keepSkipIsolation:!0,keepOpen:!0}))});let Bn=null;ct(()=>{if(typeof me()=="function"&&l(jt)){const J=l(Tt),Oe=l(We),Ue=l(fe),Ct=l(Yn),Wt=l(Ge);if(Bn&&Bn.behind===J&&Bn.hasUncommittedChanges===Oe&&Bn.currentBranch===Ue&&Bn.isCurrentBranch===Ct&&Bn.isLoading===Wt)return;const Et={behind:J,hasUncommittedChanges:Oe,currentBranch:Ue,isCurrentBranch:Ct,isLoading:Wt};Bn=Et;try{me()(Et)}catch(fn){g.error("Error in onBranchStatusChange callback",fn)}}});const ge=new Map,ft=300*1e3;let Rt="",an="local",Gt,ut=null;const ht=150;let Ie=null,He=0;function Xe(){const J=kd.select(At.state);return J&&S()?{connection:J,repoPath:S(),repoType:O(),githubUrl:N(),generation:He,cacheKey:JSON.stringify([J,S(),O(),N()])}:null}function pt(J){return J.generation===He&&J.connection===kd.select(At.state)&&J.repoPath===S()&&J.repoType===O()&&J.githubUrl===N()}function Qe(){ut&&(clearTimeout(ut),ut=null),Ie?.abort(),Ie=null}tc(()=>{He++,gt++,Qe(),Me&&clearTimeout(Me)});function et(J){return wa.get("enableFormPersistence")&&r()[J]||""}let it="";ct(()=>{g.debug("Value prop effect triggered",{value:M(),repoPath:S(),internalSelectedBranch:l(ae)});const J=S()!==it;it=S(),M()?(g.debug("Setting internalSelectedBranch from value prop",{value:M()}),k(ae,M())):J&&(g.debug("Repo changed and value is empty, clearing internalSelectedBranch"),k(ae,""))});function xt(){Qe(),k(ke,!0),k(be,null),ut=setTimeout(()=>{ut=null,Ye()},ht)}ct(()=>{const J=s(),Oe=J!==p;p=J;const Ue=S(),Ct=O(),Wt=N(),Et=Ue!==Rt,fn=Ct!==an,Qt=Wt!==Gt;Oe&&ge.clear();const Ae=Oe||Et||Ue&&(fn||Qt);Rt=Ue,an=Ct,Gt=Wt,Ae&&(He++,Qe(),De=null,k(K,[],!0),k(I,!1),k(te,!1),k(ve,!1),k(fe,""),k($e,"none"),gt++,k(ze,[],!0),k(be,null),ei(),Yr(),Ue&&J?(g.debug("Repo changed - resetting branch",{previousRepoPath:Rt,currentRepoPath:Ue,previousInternalBranch:l(ae)}),k(ae,""),k(de,""),k(V,[],!0),xt()):(k(V,[],!0),k(ae,""),k(de,""),k(ke,!1)))});function Ft(){if(typeof P()=="function")try{P()({branches:[...l(V)],remoteBranches:[...l(K)],defaultBranch:l(de),currentBranch:l(fe)})}catch(J){g.error("Error in onBranchesLoaded callback",J)}}function $t(){if(M()){rn(M());return}const J=et(S());J&&(l(V).includes(J)||l(K).includes(J))?rn(J):l(de)?rn(l(de)):rn(l(V)[0])}async function Ye(){const J=Xe();if(!J){k(ke,!1);return}Ie&&Ie.abort();const Oe=new AbortController;Ie=Oe;const Ue=()=>!Oe.signal.aborted&&pt(J);g.debug("fetchBranches called",{repoPath:S(),repoType:O(),githubUrl:N()}),Lp.start(`fetchBranches-${S()}`,{repoType:O(),githubUrl:N()});let Ct=O(),Wt=N();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())&&(Ct="github",Wt||(Wt=`https://github.com/${S()}`,g.debug("Reconstructed GitHub URL from shorthand",{repoPath:S(),effectiveGithubUrl:Wt}))),wa.get("enableBranchCaching")){const Ae=ge.get(J.cacheKey);if(Ae&&Date.now()-Ae.timestamp<ft){if(k(V,Ae.branches,!0),k(K,Ae.remoteBranches||[],!0),k(de,Ae.default,!0),k(fe,Ae.current||"",!0),Ct==="github")$t();else if(M())rn(M());else{const Bt=et(S());Bt&&(l(V).includes(Bt)||l(K).includes(Bt))?rn(Bt):l(fe)&&l(V).includes(l(fe))?rn(l(fe)):l(de)&&l(V).includes(l(de))?rn(l(de)):l(V).length>0&&rn(l(V)[0])}if(!Ue())return;Ft(),k(ke,!1);return}}k(ke,!0),k(be,null);let fn=!1,Qt=!1;try{if(wa.get("simulateSlowNetwork")&&await new Promise(Ae=>setTimeout(Ae,wa.get("networkDelay")||0)),!Ue())return;if(Ct==="local"){const Ae=await Uo.git.getBranches(J.repoPath,!0);if(!Ue())return;if(Ae){if(k(V,Ae.branches,!0),k(K,Ae.remoteBranches,!0),k(de,Ae.defaultBranch||"",!0),k(fe,Ae.currentBranch||"",!0),M())rn(M());else{const Bt=et(S());Bt&&(l(V).includes(Bt)||l(K).includes(Bt))?rn(Bt):l(fe)&&l(V).includes(l(fe))?rn(l(fe)):l(de)&&l(V).includes(l(de))?rn(l(de)):l(V).length>0&&rn(l(V)[0])}fn=!0}else throw new Error("Failed to fetch branches")}else if(Ct==="github"&&Wt){const Ae=Vp(Wt);if(!Ae)throw new Error("Invalid GitHub URL format");const{owner:Bt,repo:Wn}=Ae;Uo.integrations.githubBranchesCached(Bt,Wn).then(An=>{if(!(!Ue()||Qt)&&An.branches.length!==0){if(k(V,An.branches,!0),k(de,An.defaultBranch||"",!0),k(ke,!1),!De){const ur=et(S()),ys=M(),Qr=Le;if($t(),!Ue())return;De={autoSelectedBranch:l(ae),valueBeforePaint:ys,savedBranchBeforePaint:ur,explicitSelectionRevision:Qr}}Ft(),g.debug("Rendered cached branches via github.branches.listCached",{owner:Bt,repo:Wn,count:An.branches.length,source:An.source})}});try{const An=await Uo.integrations.githubBranches(Bt,Wn);if(!Ue()){g.debug("Branch fetch aborted after response");return}Qt=!0,k(V,An.branches,!0),k(de,An.defaultBranch||"",!0),k($e,"none"),fn=!0,g.debug("Fetched branches via daemon github.branches.list",{owner:Bt,repo:Wn,count:l(V).length})}catch(An){if(!Ue())return;if(Qt=!0,i())throw An;const ur=An instanceof Error?An.message:String(An);throw/not configured|not authenticated/i.test(ur)?(k($e,"not-authenticated"),new Error("GITHUB_AUTH_REQUIRED")):/404|not found/i.test(ur)?(k($e,"no-access"),new Error("GITHUB_NO_ACCESS")):An}}if(!Ue())return;if(wa.get("enableBranchCaching")&&ge.set(J.cacheKey,{branches:l(V),remoteBranches:l(K),default:l(de),current:l(fe),timestamp:Date.now()}),Ct==="github"&&l(V).length>0){const Ae=De;if(Ae&&!Ae.valueBeforePaint){if(Le===Ae.explicitSelectionRevision&&(!M()||M()===Ae.autoSelectedBranch)){const Bt=Ae.savedBranchBeforePaint,Wn=Bt&&(l(V).includes(Bt)||l(K).includes(Bt))?Bt:l(de)||l(V)[0];l(ae)!==Wn&&rn(Wn)}}else $t()}fn&&Ue()&&(De=null,Ft())}catch(Ae){if(Ae instanceof Error&&Ae.name==="AbortError"){g.debug("Branch fetch aborted in outer catch (superseded by newer request)");return}if(!Ue()){g.debug("Branch fetch aborted; skipping error-state write");return}const Bt=Ae instanceof Error?Ae:new Error(String(Ae));if(g.error("Failed to fetch branches",Bt,{repoPath:S(),repoType:O(),githubUrl:N(),effectiveRepoType:Ct,effectiveGithubUrl:Wt,githubAuthNeeded:l($e)}),Ae instanceof Error){if(Ae.message==="GITHUB_AUTH_REQUIRED"){k(be,null);return}else if(Ae.message==="GITHUB_NO_ACCESS"){k(be,_.workspace_branchSelector_noAccess_error(),!0),Dp.error(l(be));return}Ae.message.includes("private repo")||Ae.message.includes("authenticate with GitHub")||Ae.message.includes("access permissions")||Ae.message.includes("GitHub API error")?k(be,Ae.message,!0):Ae.message.includes("Git is not installed")||Ae.message.includes("ENOENT")||Ae.message.includes("spawn git")?k(be,_.workspace_branchSelector_gitNotInstalled_error(),!0):Ae.message.includes("rate limit")?k(be,_.workspace_branchSelector_rateLimit_error(),!0):Ae.message.includes("404")||Ae.message.includes("not found")?Ct==="github"?k(be,_.workspace_branchSelector_repoNotFoundGithub_error(),!0):k(be,_.workspace_branchSelector_repoNotFound_error(),!0):Ae.message.includes("network")||Ae.message.includes("fetch")?k(be,_.workspace_branchSelector_network_error(),!0):Ae.message.includes("permission")||Ae.message.includes("denied")?k(be,_.workspace_branchSelector_permissionDenied_error(),!0):k(be,Ae.message||_.workspace_branchSelector_fetchBranchesFailed_error(),!0)}else k(be,_.workspace_branchSelector_fetchBranchesFailedManual_error(),!0);X()&&Ct==="local"||Dp.error(l(be)),k(V,[],!0)}finally{Lp.end(`fetchBranches-${J.repoPath}`),Ie===Oe&&Ue()&&(k(ke,!1),Ie=null)}}async function ln(){const J=Xe();if(!(!J||J.repoType!=="local")&&!(l(te)||l(ve))){k(te,!0),k(ve,!0),g.debug("Fetching remote branches for",{repoPath:S()});try{const Oe=await Uo.git.getBranches(J.repoPath,!0);if(!pt(J))return;if(Oe){if(k(K,Oe.remoteBranches||[],!0),wa.get("enableBranchCaching")){const Ue=ge.get(J.cacheKey);Ue&&ge.set(J.cacheKey,{...Ue,remoteBranches:l(K)})}g.debug("Fetched remote branches",{count:l(K).length})}}catch(Oe){if(!pt(J))return;g.error("Failed to fetch remote branches",Oe)}finally{pt(J)&&k(te,!1)}}}function _n(){k(I,!l(I)),l(I)&&l(K).length===0&&!l(te)&&!l(ve)&&ln()}async function yr(J){const Oe=Xe();if(!J||!Oe||Oe.repoType!=="local"){k(Tt,0),k(We,!1),k(Ge,!1);return}k(Yt,J,!0),k(Ge,!0),g.debug("Fetching branch status",{branchName:J});try{if(h_()){const Ue=await Uo.git.branchStatus(Oe.repoPath,J);if(!pt(Oe)||l(Yt)!==J){g.debug("Ignoring stale branch status response",{requested:J,current:l(Yt)});return}Ue?(k(Tt,Ue.behind??0,!0),k(We,J===l(fe)?Ue.hasUncommittedChanges??!1:!1,!0),g.debug("Branch status fetched",{branchName:J,behind:l(Tt),hasUncommittedChanges:l(We),currentBranch:l(fe),isCurrentBranch:J===l(fe)})):(g.warn("Failed to get branch status",{branchName:J,repoPath:S()}),k(Tt,0),k(We,!1))}}catch(Ue){if(!pt(Oe)||l(Yt)!==J)return;g.error("Failed to fetch branch status",Ue),k(Tt,0),k(We,!1)}finally{pt(Oe)&&l(Yt)===J&&k(Ge,!1)}}function ei(){k(Tt,0),k(We,!1),k(Ge,!1),k(Yt,null)}function rn(J){const Oe=Xe();if(Oe){k(ae,J,!0),g.debug("setInternalBranch called",{branchName:J,hasOnchange:typeof $()=="function"});try{typeof $()=="function"&&(g.debug("Calling onchange with branch",{branchName:J}),$()(new CustomEvent("change",{detail:{branch:J}})))}catch(Ue){g.error("Error in onchange callback",Ue)}pt(Oe)&&yr(J)}}function Er(J,{keepSkipIsolation:Oe=!1,keepOpen:Ue=!1}={}){Le++,k(ae,J,!0),Yr();try{typeof $()=="function"&&$()(new CustomEvent("change",{detail:{branch:J}}))}catch(Ct){g.error("Error in onchange callback",Ct)}if(!Oe&&X()&&typeof re()=="function")try{re()(!1)}catch(Ct){g.error("Error in onSkipIsolationChange callback",Ct)}yr(J),Ue||Ut()}function cs(J){const Oe=l(Ce)?.closest('[role="dialog"]');if(!l(ie)&&Oe&&l(Pe)){k(Ve,l(we)?.getBoundingClientRect().height||void 0,!0);const Ue=l(Pe),Ct=Ue.getBoundingClientRect(),Wt=Oe.getBoundingClientRect(),Et=Wt.left-Ct.left,fn=Wt.top-Ct.top;k(ie,{contextElement:Ue,getBoundingClientRect:()=>{const Qt=Ue.getBoundingClientRect(),Ae=Math.max(xa,Ue.ownerDocument.documentElement.clientHeight-xa-Wt.height),Bt=Math.min(Math.max(xa,Qt.top+fn),Ae),Wn=Math.max(xa,Ue.ownerDocument.documentElement.clientWidth-xa-Wt.width),An=Math.min(Math.max(xa,Qt.left+Et),Wn);return new DOMRect(An,Bt,0,0)}},!0)}try{re()?.(!J)}catch(Ue){g.error("Error in onSkipIsolationChange callback",Ue)}!J&&l(fe)&&Er(l(fe),{keepSkipIsolation:!0,keepOpen:!0})}function Ut(){const J=l(vt);k(vt,!1),J&&Ja()}async function Ja(){await Qo(),!l(vt)&&l(Pe)?.isConnected&&l(Pe).focus({preventScroll:!0})}function Si(J){Me&&clearTimeout(Me),Me=setTimeout(()=>{k(q,J,!0)},100)}function Yr(){Me&&(clearTimeout(Me),Me=null),k(q,"")}async function Zi(){const J=Xe();J&&ge.delete(J.cacheKey),k($e,"none"),await Ye()}async function R(){if(!i()){k(lt,!0),k(be,null);try{const{initializeGitHubAuth:J,startGitHubAuth:Oe}=await ps(async()=>{const{initializeGitHubAuth:Qt,startGitHubAuth:Ae}=await import("./CQNY8AIr.js").then(Bt=>Bt.o5);return{initializeGitHubAuth:Qt,startGitHubAuth:Ae}},__vite__mapDeps([12,13,2,14,15,4,8,1,16,6,3]),import.meta.url),{selectGitHubAuthIsAuthenticated:Ue,selectGitHubAuthIsAuthenticating:Ct,selectGitHubAuthError:Wt}=await ps(async()=>{const{selectGitHubAuthIsAuthenticated:Qt,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:Bt}=await import("./B8_K0Ghc.js").then(Wn=>Wn.A);return{selectGitHubAuthIsAuthenticated:Qt,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:Bt}},__vite__mapDeps([43,44,3,4,1,2,22,7,8,9,45,46,23,0,5,6,10,21,47,26,48,12,13,14,15,16,49,20,50,51,52,19,24,25,53,29,28,54,55,33,31,56]),import.meta.url),Et=At;Et.dispatch(J()),Et.dispatch(Oe());const fn=setInterval(async()=>{const Qt=Et.state;if(Ue.select(Qt))clearInterval(fn),k(lt,!1),k($e,"none"),await Zi();else if(!Ct.select(Qt)){clearInterval(fn),k(lt,!1);const Ae=Wt.select(Qt);Ae&&k(be,Ae,!0)}},1e3);setTimeout(()=>{l(lt)&&(clearInterval(fn),k(lt,!1),k(be,_.workspace_branchSelector_githubTimeout_error(),!0))},300*1e3)}catch(J){g.error("Failed to connect GitHub",J),k(lt,!1),k(be,J instanceof Error?J.message:_.workspace_branchSelector_githubConnectFailed_error(),!0)}}}let xe=he(!0),Ee=he(!0),ot=!1;ct(()=>{if(l(vt)){const J=!ot;J&&requestAnimationFrame(()=>{l(vt)&&!l(mt)&&l(Fe)&&(l(Fe).focus(),l(Fe).select())}),J&&(k(Vt,!lh(l(Pe),360)),l(jt)&&O()==="local"&&yr(l(jt)))}ot=l(vt)}),ct(()=>{l(q)&&(l(En).length>0&&k(xe,!1),l(cn).length>0&&k(Ee,!1),l(Pn).length>0&&k(I,!0))});function Ne(){const J=N()||(S()&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(S())?`https://github.com/${S()}`:void 0);return J?Vp(J):null}ct(()=>{const J=s(),Oe=l(q).trim();if(!J||O()!=="github"||!Oe){gt++,k(ze,[],!0);return}const Ue=Ne();if(!Ue){gt++,k(ze,[],!0);return}const Ct=Xe();if(!Ct)return;const Wt=++gt;k(ze,[],!0),Uo.integrations.githubBranches(Ue.owner,Ue.repo,Oe).then(Et=>{!pt(Ct)||Wt!==gt||k(ze,Et.branches,!0)}).catch(()=>{})});function Se(J){return J.startsWith("dependabot/")}function Zt(J){const Oe=J.trim(),Ue=Oe.startsWith("+ ")?Oe.substring(2):Oe;if(bx(Ue))return!0;if(J.startsWith("+ ")){const Wt=J.substring(2);if(Wt.startsWith("workspace")||Wt.startsWith("ws/")||Wt.startsWith("ws_"))return!0}return!!(Ue.startsWith("workspace-")||Ue.startsWith("workspace/")||Ue.startsWith("ws/")||Ue.startsWith("ws_")||/-\d{13}-[a-z0-9]+$/.test(Ue))}const yn=w(()=>l(ze).length>0?[...l(V),...l(ze).filter(J=>!l(V).includes(J))]:l(V)),Ke=w(()=>l(yn).filter(J=>!Zt(J)&&!Se(J)&&J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>J===l(fe)?-1:Oe===l(fe)?1:J===l(de)?-1:Oe===l(de)?1:J.localeCompare(Oe))),cn=w(()=>l(yn).filter(J=>Se(J)&&J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>J.localeCompare(Oe))),En=w(()=>l(yn).filter(J=>Zt(J)&&J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>{const Ue=Et=>{const fn=Et.match(/(\d{13})/);return fn?parseInt(fn[1]):null},Ct=Ue(J),Wt=Ue(Oe);return Ct&&Wt?Wt-Ct:Ct&&!Wt?-1:!Ct&&Wt?1:J.localeCompare(Oe)})),Pn=w(()=>l(K).filter(J=>J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>J.localeCompare(Oe))),As=w(()=>{const J=(Oe,Ue=!1)=>Oe.map(Ct=>({value:Ct,label:Ct,class:oe()&&Ue?"pl-8":void 0,description:Ct===l(de)?_.workspace_branchSelector_default_label():Ct===l(fe)?_.workspace_branchSelector_current_label():void 0}));return[{key:"regular",label:"",options:J(l(Ke))},{key:"workspace",label:_.workspace_branchSelector_workspaceBranches_label(),options:J(l(En),!0),collapsed:l(xe)},{key:"remote",label:_.workspace_branchSelector_remoteBranches_label(),options:J(l(Pn),!0),collapsed:!l(I),keepEmpty:O()==="local"},{key:"dependabot",label:_.workspace_branchSelector_dependabotBranches_label(),options:J(l(cn),!0),collapsed:l(Ee)}].filter(Oe=>Oe.key!=="remote"||O()==="local")});function $r(J){return!J.collapsed}function Hs(J){J.key==="workspace"?k(xe,!l(xe)):J.key==="remote"?_n():J.key==="dependabot"&&k(Ee,!l(Ee))}var ga={get variant(){return z()},set variant(J="underline"){z(J),b()},get value(){return M()},set value(J=""){M(J),b()},get repoPath(){return S()},set repoPath(J){S(J),b()},get repoType(){return O()},set repoType(J){O(J),b()},get githubUrl(){return N()},set githubUrl(J){N(J),b()},get disabled(){return E()},set disabled(J=!1){E(J),b()},get dropUp(){return D()},set dropUp(J=!1){D(J),b()},get portal(){return ee()},set portal(J=!0){ee(J),b()},get triggerClass(){return U()},set triggerClass(J){U(J),b()},get rowLabel(){return oe()},set rowLabel(J){oe(J),b()},get hasTriggerIcon(){return F()},set hasTriggerIcon(J=!0){F(J),b()},get description(){return W()},set description(J){W(J),b()},get skipIsolation(){return X()},set skipIsolation(J=!1){X(J),b()},get suggestedBranch(){return le()},set suggestedBranch(J){le(J),b()},get onSkipIsolationChange(){return re()},set onSkipIsolationChange(J){re(J),b()},get onGitHubAuthNeededChange(){return Q()},set onGitHubAuthNeededChange(J){Q(J),b()},get onBranchStatusChange(){return me()},set onBranchStatusChange(J){me(J),b()},get onBranchesLoaded(){return P()},set onBranchesLoaded(J){P(J),b()},get onchange(){return $()},set onchange(J){$(J),b()},get showUncommittedIndicator(){return ce()},set showUncommittedIndicator(J=!1){ce(J),b()},get showTriggerChevron(){return pe()},set showTriggerChevron(J=!1){pe(J),b()},get triggerChevronClass(){return ye()},set triggerChevronClass(J="ml-2 opacity-50"){ye(J),b()},get triggerContentClass(){return Z()},set triggerContentClass(J="gap-0.75"){Z(J),b()},$set:Nt,$on:(J,Oe)=>Dt(e,J,Oe)},Ci=Ze(),lc=ue(Ci);{var bs=J=>{var Oe=vN(),Ue=ne(Oe);{var Ct=Ae=>{var Bt=Ea(),Wn=se(Bt,!0);L(()=>{at(Bt,1,$n(dn.fieldLabel)),H(Wn,oe())}),x(Ae,Bt)};j(Ue,Ae=>{oe()&&Ae(Ct)})}var Wt=A(Ue,2);{var Et=Ae=>{{let Bt=w(()=>oe()?16:12);mo(Ae,{get size(){return l(Bt)},class:"text-ghost shrink-0"})}};j(Wt,Ae=>{F()&&Ae(Et)})}var fn=A(Wt,2),Qt=se(fn,!0);Y(Oe),L(Ae=>{at(Oe,1,`flex min-w-0 items-center gap-2 text-subtle text-sm ${oe()?"min-h-10 px-3 py-2":"py-1"}`),H(Qt,Ae)},[()=>l(jt)||M()||(l(mt)?_.workspace_branchSelector_noIsolation_label({isolationLabel:yt}):_.workspace_branchSelector_noBranchSelected_label())]),x(J,Oe)},ma=J=>{var Oe=BN(),Ue=ne(Oe);wt(Ue,()=>Wu,(Ct,Wt)=>{Wt(Ct,{get open(){return l(vt)},set open(Et){k(vt,Et,!0)},children:(Et,fn)=>{var Qt=Um(),Ae=ue(Qt);{const Wn=(An,ur)=>{let ys=()=>(ur?.()).props;{let Qr=w(()=>z()==="default"?"outline":z()),pi=w(()=>!oe()),eo=w(()=>`${_.workspace_branchSelector_selectBranch_label()}: ${l(jt)||M()}`),Mi=w(()=>`w-full text-muted-foreground ${U()} ${l($e)==="not-authenticated"?"ring-1 ring-orange-400 rounded-sm":le()&&le()!==l(ae)?"ring-1 ring-primary-ink rounded-sm":""}`);qe(An,gs(ys,{get variant(){return l(Qr)},get wrapContent(){return l(pi)},get"aria-label"(){return l(eo)},get class(){return l(Mi)},get ref(){return l(Pe)},set ref(Ti){k(Pe,Ti,!0)},children:(Ti,Rs)=>{var un=_N(),Zr=ne(un);{var ti=kt=>{var qt=Ea(),wn=se(qt,!0);L(()=>{at(qt,1,$n(dn.fieldLabel)),H(wn,oe())}),x(kt,qt)};j(Zr,kt=>{oe()&&kt(ti)})}var Kn=A(Zr,2);{var Us=kt=>{tt(kt,{get icon(){return ox},class:"text-orange-500",size:"xs"})},ws=kt=>{{let qt=w(()=>oe()?16:12);mo(kt,{get size(){return l(qt)},class:"text-ghost shrink-0"})}};j(Kn,kt=>{l($e)==="not-authenticated"?kt(Us):F()&&kt(ws,1)})}var ni=A(Kn,2),ri=ne(ni);{var Xa=kt=>{var qt=bN(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_connectGithub_label()]),x(kt,qt)},Ya=kt=>{var qt=yN(),wn=ue(qt),or=se(wn,!0),Is=A(wn,2),Vs=se(Is,!0);L(en=>{H(or,l(jt)),H(Vs,en)},[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:yt})]),x(kt,qt)},Lo=kt=>{var qt=Ea(),wn=se(qt,!0);L(()=>H(wn,l(jt))),x(kt,qt)},Qa=kt=>{var qt=Ea(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:yt})]),x(kt,qt)},ir=kt=>{var qt=Ea(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_selectRepoFirst_label()]),x(kt,qt)},wr=kt=>{var qt=wN(),wn=ue(qt);fi(wn,{size:14,class:"text-ghost"});var or=A(wn,2),Is=se(or,!0);L(Vs=>H(Is,Vs),[()=>_.workspace_compactInitializer_waitingBranchSelection_label()]),x(kt,qt)},Br=kt=>{var qt=Ea(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_selectBranch_label()]),x(kt,qt)};j(ri,kt=>{l($e)==="not-authenticated"?kt(Xa):X()&&l(jt)?kt(Ya,1):l(jt)?kt(Lo,2):l(mt)&&S()?kt(Qa,3):S()?l(ke)?kt(wr,5):kt(Br,-1):kt(ir,4)})}Y(ni);var xs=A(ni,2);{var zr=kt=>{var qt=kN(),wn=ne(qt);{let or=w(()=>_.workspace_branchSelector_uncommittedChanges_tooltip());Hu(wn,{get content(){return l(or)},side:"bottom",delayDuration:200,children:(Is,Vs)=>{var en=xN();x(Is,en)},$$slots:{default:!0}})}Y(qt),Ms(3,qt,()=>Ho,()=>({axis:"x",tier:"moderate"})),x(kt,qt)};j(xs,kt=>{ce()&&!X()&&l(jt)&&O()==="local"&&!l(Ge)&&l(We)&&l(Yn)&&kt(zr)})}var Ps=A(xs,2);{var dr=kt=>{tt(kt,{get icon(){return sa},size:10,get class(){return ye()}})};j(Ps,kt=>{pe()&&kt(dr)})}Y(un),L(()=>at(un,1,`flex items-center truncate min-w-0 ${Z()}`)),x(Ti,un)},$$slots:{default:!0}}))}};wt(Ae,()=>Uu,(An,ur)=>{ur(An,{child:Wn,$$slots:{child:!0}})})}var Bt=A(Ae,2);{let Wn=w(()=>oe()??_.workspace_branchSelector_whichBranch_label()),An=w(()=>oe()?"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"),ur=w(()=>!l(ie)),ys=w(()=>l(ie)?"bottom":oe()?v.current||l(Vt)?"bottom":"left":D()?"top":"bottom"),Qr=w(()=>l(ie)?"start":oe()?v.current||l(Vt)?"end":"start":"center"),pi=w(()=>l(ie)?0:oe()?v.current||l(Vt)?4:24:void 0),eo=w(()=>({to:m()})),Mi=w(()=>m()?"absolute":"fixed");wt(Bt,()=>Vu,(Ti,Rs)=>{Rs(Ti,{role:"dialog",get"aria-label"(){return l(Wn)},get class(){return l(An)},get customAnchor(){return l(ie)},get avoidCollisions(){return l(ur)},get side(){return l(ys)},get align(){return l(Qr)},get sideOffset(){return l(pi)},get portalProps(){return l(eo)},get strategy(){return l(Mi)},onOpenAutoFocus:un=>{un.preventDefault(),Qo().then(()=>{l(vt)&&(l(mt)?l(Ce):l(Fe))?.focus()})},get portal(){return ee()},children:(un,Zr)=>{var ti=$N(),Kn=ue(ti);{var Us=ir=>{var wr=SN(),Br=ne(wr),xs=se(Br,!0),zr=A(Br,2),Ps=se(zr,!0);Y(wr),L((dr,kt)=>{H(xs,dr),H(Ps,kt)},[()=>_.workspace_branchSelector_whichBranch_label(),()=>W()||_.workspace_branchSelector_whichBranch_description()]),x(ir,wr)};j(Kn,ir=>{oe()||ir(Us)})}var ws=A(Kn,2);let ni;var ri=ne(ws);{var Xa=ir=>{var wr=CN(),Br=ne(wr),xs=se(Br,!0),zr=A(Br,2),Ps=ne(zr);u(Ps);var dr=A(Ps,2),kt=se(dr,!0),qt=A(dr,2),wn=se(qt,!0);Y(zr),Y(wr),L((or,Is)=>{H(xs,or),at(zr,1,$n(oe()?dn.row+" flex min-w-0":"type-caption flex min-w-0 items-center gap-2 px-2 py-1")),H(kt,l(fe)),H(wn,Is)},[()=>_.workspace_branchSelector_folderBranch_label(),()=>_.workspace_branchSelector_currentBranch_label()]),x(ir,wr)},Ya=ir=>{var wr=ON(),Br=ue(wr);{var xs=en=>{{let Sn=w(()=>oe()?"bg-sidebar hover:bg-hover":"bg-primary/10 hover:bg-primary/15 border border-primary/20");qe(en,{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(Sn)??""}`},onclick:()=>Er(le()),children:(Qn,zn)=>{var Cn=MN(),sn=ue(Cn);mo(sn,{size:14,class:"text-primary-ink shrink-0"});var fr=A(sn,2),Ar=ne(fr),Ws=se(Ar,!0),ks=A(Ar,2),Ls=se(ks,!0);Y(fr),L(Os=>{H(Ws,Os),H(Ls,le())},[()=>_.workspace_branchSelector_usePrBranch_label()]),x(Qn,Cn)},$$slots:{default:!0}})}};j(Br,en=>{le()&&le()!==l(ae)&&en(xs)})}var zr=A(Br,2),Ps=ne(zr);{var dr=en=>{{let Sn=w(()=>oe()?"mx-2 rounded-(--radius-medium) bg-sidebar":"w-full border-l-2 border-primary bg-primary/5");qe(en,{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(Sn)??""}`},onclick:R,children:(Qn,zn)=>{var Cn=TN(),sn=A(ue(Cn),2),fr=ne(sn),Ar=se(fr,!0),Ws=A(fr,2),ks=se(Ws,!0);Y(sn),L((Ls,Os)=>{H(Ar,Ls),H(ks,Os)},[()=>_.workspace_branchSelector_connectWithGithub_label(),()=>_.workspace_branchSelector_connectWithGithub_description()]),x(Qn,Cn)},$$slots:{default:!0}})}},kt=en=>{var Sn=EN(),Qn=ne(Sn),zn=ne(Qn);fi(zn,{size:20,class:"text-ghost"}),Y(Qn);var Cn=A(Qn,2),sn=ne(Cn),fr=se(sn,!0),Ar=A(sn,2),Ws=se(Ar,!0);Y(Cn),Y(Sn),L((ks,Ls)=>{at(Sn,1,`px-3 py-3 flex items-start gap-3 ${oe()?"mx-2 rounded-(--radius-medium) bg-sidebar":"border-l-2 border-primary bg-primary/5"}`),H(fr,ks),H(Ws,Ls)},[()=>_.workspace_branchSelector_connectingGithub_label(),()=>_.workspace_branchSelector_completeAuth_description()]),x(en,Sn)},qt=en=>{var Sn=AN(),Qn=ne(Sn),zn=se(Qn,!0),Cn=A(Qn,2),sn=se(Cn,!0);Y(Sn),L((fr,Ar)=>{at(Sn,1,`py-2 bg-danger-background/10 ${oe()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),H(zn,fr),H(sn,Ar)},[()=>_.workspace_branchSelector_noAccess_error(),()=>_.workspace_branchSelector_noAccess_description()]),x(en,Sn)},wn=en=>{var Sn=PN(),Qn=ne(Sn),zn=se(Qn,!0),Cn=A(Qn,2);{var sn=fr=>{var Ar=RN(),Ws=se(Ar,!0);L(ks=>H(Ws,ks),[()=>_.workspace_branchSelector_typeManually_description()]),x(fr,Ar)};j(Cn,fr=>{O()==="github"&&fr(sn)})}Y(Sn),L(()=>{at(Sn,1,`py-2 bg-danger-background/10 ${oe()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),H(zn,l(be))}),x(en,Sn)};j(Ps,en=>{!i()&&l($e)==="not-authenticated"&&!l(lt)?en(dr):l(lt)?en(kt,1):l($e)==="no-access"?en(qt,2):l(be)&&en(wn,3)})}var or=A(Ps,2);{let en=w(()=>oe()?dn.row:void 0),Sn=w(()=>_.workspace_branchSelector_selectBranch_label()),Qn=w(()=>_.workspace_branchSelector_search_placeholder()),zn=w(()=>_.workspace_branchSelector_search_placeholder()),Cn=w(()=>_.workspace_branchSelector_noBranchesFound_label()),sn=w(()=>l(ke)&&l(V).length===0),fr=w(()=>oe()?"flex min-h-0 flex-1 flex-col gap-1 px-2":"flex min-h-0 flex-1 flex-col px-2 pb-1"),Ar=w(()=>oe()?"search":void 0),Ws=w(()=>oe()?c:void 0),ks=w(()=>oe()?"min-h-0 max-h-none flex-1 p-0 pb-2":"min-h-0 max-h-none flex-1"),Ls=w(()=>oe()?"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");ah(or,{get open(){return l(vt)},get value(){return l(ae)},get groups(){return l(As)},get groupHeader(){return d},get optionIcon(){return u},get rowClass(){return l(en)},get ariaLabel(){return l(Sn)},get placeholder(){return l(Qn)},get searchPlaceholder(){return l(zn)},get emptyText(){return l(Cn)},get loading(){return l(sn)},staticPosition:!0,allowCustom:!0,onquerychange:Si,oncommit:Os=>{typeof Os=="string"&&Er(Os)},get class(){return l(fr)},get inputVariant(){return l(Ar)},get inputAction(){return l(Ws)},inputClass:"shrink-0",get viewportClass(){return l(ks)},size:"compact",get contentClass(){return l(Ls)},get inputRef(){return l(Fe)},set inputRef(Os){k(Fe,Os,!0)}})}Y(zr);var Is=A(zr,2);{var Vs=en=>{var Sn=LN(),Qn=ne(Sn);ss(Qn,17,()=>l(As).filter(Cn=>Cn.key==="workspace"&&Cn.options.length>0||Cn.key==="remote"),Cn=>Cn.key,(Cn,sn)=>{{let fr=w(()=>$r(l(sn)));cw(Cn,{size:"sm",get pressed(){return l(fr)},get ariaLabel(){return l(sn).label},onChange:()=>Hs(l(sn)),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:(Ar,Ws)=>{var ks=IN(),Ls=ue(ks);{var Os=Oo=>{tt(Oo,{get icon(){return hv},class:"size-3! text-primary-ink"})},uc=w(()=>$r(l(sn)));j(Ls,Oo=>{l(uc)&&Oo(Os)})}var pd=A(Ls);L(()=>H(pd,` ${l(sn).label??""}`)),x(Ar,ks)},$$slots:{default:!0}})}});var zn=A(Qn,2);{let Cn=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());qe(zn,{onclick:Zi,variant:"ghost",size:"icon-sm",class:"ml-auto shrink-0",get disabled(){return l(ke)},get"aria-label"(){return l(Cn)},children:(sn,fr)=>{tt(sn,{get icon(){return Rp},class:"size-3.5!"})},$$slots:{default:!0}})}Y(Sn),x(en,Sn)};j(Is,en=>{oe()||en(Vs)})}x(ir,wr)};j(ri,ir=>{l(mt)&&l(fe)?ir(Xa):ir(Ya,-1)})}Y(ws),sr(ws,ir=>k(we,ir),()=>l(we));var Lo=A(ws,2);{var Qa=ir=>{var wr=DN(),Br=ne(wr),xs=ne(Br);{const dr=Vs=>{{let en=w(()=>l(mt)?Qs:ax);tt(Vs,{get icon(){return l(en)},class:"size-4! text-subtle"})}},kt=(Vs,en)=>{let Sn=()=>(en?.()).labelId,Qn=()=>(en?.()).descriptionId;{let zn=w(()=>`${t}-isolation`),Cn=w(()=>!X());yv(Vs,{get id(){return l(zn)},get checked(){return l(Cn)},get ariaLabelledby(){return Sn()},get ariaDescribedby(){return Qn()},class:"dark:[&_[data-switch-thumb][data-state=unchecked]]:bg-foreground",onCheckedChange:cs,get ref(){return l(Ce)},set ref(sn){k(Ce,sn,!0)}})}};let qt=w(()=>`${t}-isolation-row`),wn=w(()=>`${t}-isolation`),or=w(()=>_.workspace_branchSelector_isolation_label({isolationLabel:yt})),Is=w(()=>l(mt)?_.workspace_branchSelector_isolationOff_description():_.workspace_branchSelector_isolationOn_description());Wx(xs,{get id(){return l(qt)},get htmlFor(){return l(wn)},activateLabel:!0,get label(){return l(or)},get description(){return l(Is)},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:dr,control:kt,$$slots:{leading:!0,control:!0}})}var zr=A(xs,2);{var Ps=dr=>{var kt=NN(),qt=se(kt,!0);L(wn=>H(qt,wn),[()=>_.workspace_branchSelector_directWarning_description()]),x(dr,kt)};j(zr,dr=>{l(mt)&&dr(Ps)})}Y(Br),Y(wr),x(ir,wr)};j(Lo,ir=>{O()==="local"&&typeof re()=="function"&&l(fe)&&ir(Qa)})}L(()=>{at(ws,1,`flex flex-col transition-none ${l(Ve)?"shrink-0":"flex-1"} ${l(Mt)?"min-h-52":"min-h-0"}`),ni=Gi(ws,"",ni,{height:l(Ve)?`${l(Ve)}px`:void 0})}),x(un,ti)},$$slots:{default:!0}})})}x(Et,Qt)},$$slots:{default:!0}})}),Y(Oe),sr(Oe,Ct=>k(nt,Ct),()=>l(nt)),x(J,Oe)};j(lc,J=>{E()?J(bs):J(ma,-1)})}x(n,Ci);var cc=Lt(ga);return a(),cc}var zN=B('<p class="type-caption text-muted-foreground px-2 py-1" role="status"> </p>');function qf(n,e){if(new.target)return Ot({component:qf,...n});It(e,!0);const t=()=>nn(a,"$member$",s),r=()=>nn(c,"$execution$",s),[s,i]=Ka();let o=y(e,"kind",7,"git-policy");const a=Xf(),c=i1(),u=w(()=>t()?o()==="ai"?_.hostExecution_providerSetup_description():o()==="repository"?r()&&!r().repositoryConnections.some(m=>m.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(m="git-policy"){o(m),b()},$set:Nt,$on:(m,v)=>Dt(e,m,v)},f=Ze(),h=ue(f);{var p=m=>{var v=zN(),C=se(v,!0);L(()=>H(C,l(u))),x(m,v)};j(h,m=>{l(u)&&m(p)})}x(n,f);var g=Lt(d);return i(),g}var FN=B('<div class="grid grid-cols-[minmax(0,1fr)_5rem] gap-3"><div><!> <!></div> <div><!> <!></div></div>'),HN=B("<div><!> <!></div>"),UN=B("<!> <!> <!>",1),VN=B('<div class="space-y-3"><h3 class="text-sm font-medium"> </h3> <!> <!> <!></div>'),WN=B('<div class="type-caption text-subtle"><p> </p></div>'),jN=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 uw(n,e){if(new.target)return Ot({component:uw,...n});It(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=fa("AddRemoteSetupModal");let c=he(Sr(o()?.name??"")),u=he("ssh"),d=he(Sr(o()?.host??"")),f=he(Sr(o()?.port??22)),h=he(Sr(o()?.wsUrl??"")),p=he(Sr(o()?.username??"")),g=he(""),m=he(""),v=he("agent"),C=he(Sr(o()?.workspacePath??"")),z=he(Sr(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(v)==="agent"||l(v)==="keyfile"&&l(m).trim()!==""||l(v)==="password"&&l(g).trim()!==""));function O(){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(v)==="password"?l(g).trim():void 0,keyPath:l(v)==="keyfile"?l(m).trim():void 0,useAgent:l(v)==="agent",workspacePath:l(C).trim(),transport:l(u),wsUrl:l(u)==="websocket"?l(h).trim():void 0,branch:l(z).trim()||void 0};a.info("Saving new remote setup",{name:F.name,transport:F.transport}),s()(F),N(),r()()}function N(){k(c,""),k(u,"ssh"),k(d,""),k(f,22),k(h,""),k(p,""),k(g,""),k(m,""),k(v,"agent"),k(C,""),k(z,"main"),k(M,"")}function E(){N(),r()()}var D={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:Nt,$on:(F,W)=>Dt(e,F,W)},ee=Ze(),U=ue(ee);{var oe=F=>{{let W=w(()=>_.workspace_addRemoteSetupModal_title()),X=w(()=>_.workspace_addRemoteSetupModal_close_ariaLabel()),le=w(()=>_.workspace_addRemoteSetupModal_addSetup_label()),re=w(()=>_.workspace_addRemoteSetupModal_cancel_label());g_(F,{get open(){return t()},get static(){return i()},get title(){return l(W)},get closeLabel(){return l(X)},get submitLabel(){return l(le)},get cancelLabel(){return l(re)},size:"lg",get canSubmit(){return l(S)},onSubmit:O,onCancel:E,children:(Q,me)=>{var P=jN(),$=ne(P),ce=ne($);zo(ce,{for:"name",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_setupName_label()]),x(Ce,Ve)},$$slots:{default:!0}});var pe=A(ce,2);{let Ce=w(()=>_.workspace_addRemoteSetupModal_setupName_placeholder());rs(pe,{id:"name",get placeholder(){return l(Ce)},class:"mt-1",get value(){return l(c)},set value(we){k(c,we,!0)}})}Y($);var ye=A($,2),Z=ne(ye),ae=se(Z,!0),V=A(Z,2),K=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");qe(K,{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"&&(N(),k(u,"ssh"))},children:(Ve,Mt)=>{Pt();var ie=zt("SSH");x(Ve,ie)},$$slots:{default:!0}})}var I=A(K,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");qe(I,{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"&&(N(),k(u,"websocket"))},children:(Ve,Mt)=>{Pt();var ie=zt("WebSocket");x(Ve,ie)},$$slots:{default:!0}})}Y(V);var te=A(V,2);{var ve=Ce=>{var we=FN(),Ve=ne(we),Mt=ne(Ve);zo(Mt,{for:"host",children:(mt,Tt)=>{Pt();var We=zt();L(Ge=>H(We,Ge),[()=>_.workspace_addRemoteSetupModal_host_label()]),x(mt,We)},$$slots:{default:!0}});var ie=A(Mt,2);rs(ie,{id:"host",placeholder:"dev.example.com",class:"mt-1",get value(){return l(d)},set value(mt){k(d,mt,!0)}}),Y(Ve);var $e=A(Ve,2),lt=ne($e);zo(lt,{for:"port",children:(mt,Tt)=>{Pt();var We=zt();L(Ge=>H(We,Ge),[()=>_.workspace_addRemoteSetupModal_port_label()]),x(mt,We)},$$slots:{default:!0}});var yt=A(lt,2);rs(yt,{id:"port",type:"number",placeholder:"22",class:"mt-1",get value(){return l(f)},set value(mt){k(f,mt,!0)}}),Y($e),Y(we),x(Ce,we)},de=Ce=>{var we=HN(),Ve=ne(we);zo(Ve,{for:"wsUrl",children:(ie,$e)=>{Pt();var lt=zt();L(yt=>H(lt,yt),[()=>_.workspace_addRemoteSetupModal_wsUrl_label()]),x(ie,lt)},$$slots:{default:!0}});var Mt=A(Ve,2);rs(Mt,{id:"wsUrl",placeholder:"wss://dev.example.com/ws",class:"mt-1",get value(){return l(h)},set value(ie){k(h,ie,!0)}}),Y(we),x(Ce,we)};j(te,Ce=>{l(u)==="ssh"?Ce(ve):Ce(de,-1)})}var fe=A(te,2),ke=ne(fe);zo(ke,{for:"username",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_username_label()]),x(Ce,Ve)},$$slots:{default:!0}});var be=A(ke,2);rs(be,{id:"username",placeholder:"john",class:"mt-1",get value(){return l(p)},set value(Ce){k(p,Ce,!0)}}),Y(fe),Y(ye);var q=A(ye,2);{var Me=Ce=>{var we=VN(),Ve=ne(we),Mt=se(Ve,!0),ie=A(Ve,2),$e=()=>l(v),lt=Ge=>{(Ge==="agent"||Ge==="keyfile"||Ge==="password")&&k(v,Ge,!0)};{let Ge=w(()=>_.workspace_addRemoteSetupModal_authentication_label());wt(ie,()=>Pv,(Yt,Be)=>{Be(Yt,{type:"single",get value(){return $e()},set value(jt){lt(jt)},get"aria-label"(){return l(Ge)},variant:"outline",class:"flex w-full",children:(jt,Yn)=>{var Bn=UN(),ge=ue(Bn);wt(ge,()=>_l,(an,Gt)=>{Gt(an,{value:"agent",class:"min-w-0 flex-1",onclick:ut=>{l(v)==="agent"&&ut.preventDefault()},onkeydown:ut=>{l(v)==="agent"&&["Enter"," "].includes(ut.key)&&ut.preventDefault()},children:(ut,ht)=>{Pt();var Ie=zt();L(He=>H(Ie,He),[()=>_.workspace_addRemoteSetupModal_sshAgent_label()]),x(ut,Ie)},$$slots:{default:!0}})});var ft=A(ge,2);wt(ft,()=>_l,(an,Gt)=>{Gt(an,{value:"keyfile",class:"min-w-0 flex-1",onclick:ut=>{l(v)==="keyfile"&&ut.preventDefault()},onkeydown:ut=>{l(v)==="keyfile"&&["Enter"," "].includes(ut.key)&&ut.preventDefault()},children:(ut,ht)=>{Pt();var Ie=zt();L(He=>H(Ie,He),[()=>_.workspace_addRemoteSetupModal_keyFile_label()]),x(ut,Ie)},$$slots:{default:!0}})});var Rt=A(ft,2);wt(Rt,()=>_l,(an,Gt)=>{Gt(an,{value:"password",class:"min-w-0 flex-1",onclick:ut=>{l(v)==="password"&&ut.preventDefault()},onkeydown:ut=>{l(v)==="password"&&["Enter"," "].includes(ut.key)&&ut.preventDefault()},children:(ut,ht)=>{Pt();var Ie=zt();L(He=>H(Ie,He),[()=>_.workspace_addRemoteSetupModal_password_label()]),x(ut,Ie)},$$slots:{default:!0}})}),x(jt,Bn)},$$slots:{default:!0}})})}var yt=A(ie,2);{var mt=Ge=>{const Yt=w(()=>"~/.ssh/id_rsa");{let Be=w(()=>_.workspace_addRemoteSetupModal_keyFile_label());rs(Ge,{placeholder:l(Yt),get"aria-label"(){return l(Be)},get value(){return l(m)},set value(jt){k(m,jt,!0)}})}};j(yt,Ge=>{l(v)==="keyfile"&&Ge(mt)})}var Tt=A(yt,2);{var We=Ge=>{{let Yt=w(()=>_.workspace_addRemoteSetupModal_password_label());rs(Ge,{type:"password",placeholder:"••••••••",get"aria-label"(){return l(Yt)},get value(){return l(g)},set value(Be){k(g,Be,!0)}})}};j(Tt,Ge=>{l(v)==="password"&&Ge(We)})}Y(we),L(Ge=>H(Mt,Ge),[()=>_.workspace_addRemoteSetupModal_authentication_label()]),x(Ce,we)},ze=Ce=>{var we=WN(),Ve=ne(we),Mt=se(Ve,!0);Y(we),L(ie=>H(Mt,ie),[()=>_.workspace_addRemoteSetupModal_websocketAuth_description()]),x(Ce,we)};j(q,Ce=>{l(u)==="ssh"?Ce(Me):Ce(ze,-1)})}var gt=A(q,2),Le=ne(gt);zo(Le,{for:"workspacePath",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_repoPath_label()]),x(Ce,Ve)},$$slots:{default:!0}});var De=A(Le,2);rs(De,{id:"workspacePath",placeholder:"/home/user/myrepo",class:"mt-1",get value(){return l(C)},set value(Ce){k(C,Ce,!0)}}),Y(gt);var Fe=A(gt,2),vt=ne(Fe);zo(vt,{for:"branch",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_branch_label()]),x(Ce,Ve)},$$slots:{default:!0}});var Vt=A(vt,2);rs(Vt,{id:"branch",placeholder:"main",class:"mt-1",get value(){return l(z)},set value(Ce){k(z,Ce,!0)}}),Y(Fe);var nt=A(Fe,2);{var Pe=Ce=>{pk(Ce,{tone:"error",children:(we,Ve)=>{Pt();var Mt=zt();L(()=>H(Mt,l(M))),x(we,Mt)},$$slots:{default:!0}})};j(nt,Ce=>{l(M)&&Ce(Pe)})}Y(P),L(Ce=>H(ae,Ce),[()=>_.workspace_addRemoteSetupModal_connectionDetails_label()]),x(Q,P)},$$slots:{default:!0}})}};j(U,F=>{t()&&F(oe)})}return x(n,ee),Lt(D)}var KN=new Set(["$$slots","$$events","$$legacy","owner","name","suffix","provider","avatarUrl","local","showOwner","showForge","recent","option","selected","formStyle","checked","class"]),GN=B('<span class="text-subtle mr-1"> </span>'),qN=B('<span class="text-subtle ml-1"> </span>'),JN=B('<span role="img" class="text-subtle shrink-0"><!></span>'),XN=B('<span><span class="truncate"><!> <!></span> <!></span>');function rp(n,e){if(new.target)return Ot({component:rp,...n});It(e,!0);const t=S=>{var O=Ze(),N=ue(O);{var E=D=>{{let ee=w(()=>Cr(dn.check,"self-center"));Ev(D,{state:"checked",get class(){return l(ee)}})}};j(N,D=>{(m()??p())&&D(E)})}x(S,O)};let r=y(e,"owner",7),s=y(e,"name",7),i=y(e,"suffix",7),o=y(e,"provider",7),a=y(e,"avatarUrl",7),c=y(e,"local",7,!1),u=y(e,"showOwner",7,!0),d=y(e,"showForge",7,!1),f=y(e,"recent",7,!1),h=y(e,"option",7,!1),p=y(e,"selected",7,!1),g=y(e,"formStyle",7,!1),m=y(e,"checked",7),v=y(e,"class",7,""),C=Yi(e,KN);const z={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 m()},set checked(S){m(S),b()},get class(){return v()},set class(S=""){v(S),b()},$set:Nt,$on:(S,O)=>Dt(e,S,O)};{const S=ee=>{{let U=w(()=>g()?20:16);fh(ee,{get owner(){return r()},get provider(){return o()},get avatarUrl(){return a()},get local(){return c()},get size(){return l(U)}})}},O=ee=>{var U=XN(),oe=ne(U),F=ne(oe);{var W=P=>{var $=GN(),ce=se($);L(()=>H(ce,`${r()??""} /`)),x(P,$)};j(F,P=>{u()&&r()&&P(W)})}var X=A(F),le=A(X);{var re=P=>{var $=qN(),ce=se($);L(()=>H(ce,`(${i()??""})`)),x(P,$)};j(le,P=>{i()&&P(re)})}Y(oe);var Q=A(oe,2);{var me=P=>{var $=JN(),ce=ne($);{let pe=w(()=>o()==="github"?Yf:Qf);tt(ce,{get icon(){return l(pe)},size:12})}Y($),L(()=>st($,"aria-label",z[o()])),x(P,$)};j(Q,P=>{d()&&o()&&!g()&&P(me)})}Y(U),L(()=>{at(U,1,`flex min-w-0 items-center gap-2 ${g()?"":"text-sm"}`),st(oe,"data-recent-repo-label",f()?"":void 0),H(X,` ${s()??""} `)}),x(ee,U)};let N=w(()=>g()?t:void 0),E=w(()=>h()?"option":void 0),D=w(()=>g()?Cr(dn.row,"cursor-pointer focus-visible:outline-none [--menu-icon-size:1.25rem]",v()):`gap-2 py-1.5 cursor-pointer ${v()}`);Ov(n,gs(()=>C,{get trailing(){return l(N)},get role(){return l(E)},get selected(){return p()},get class(){return l(D)},leading:S,title:O,$$slots:{leading:!0,title:!0}}))}return Lt(M)}var YN=B('<p class="mt-1"> </p>'),QN=B('<div role="alert" class="mt-2 px-1 text-sm text-subtle"><div class="flex items-center gap-2"><span> </span> <!></div> <!></div>'),ZN=B('<div role="status"><!><span> </span></div>'),eD=B('<div role="listbox"></div>'),tD=B("<p> </p>");function sp(n,e){const t=Ji();if(new.target)return Ot({component:sp,...n});It(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),m=y(e,"detail",7),v=y(e,"retryLabel",7),C=y(e,"onRetry",7),z=y(e,"onSelect",7),M=y(e,"selectedKey",7),S=y(e,"activeIndex",31,()=>-1),O=y(e,"scrollable",7,!0),N=y(e,"formStyle",7,!1),E=he(void 0),D="",ee=0;ct(()=>{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 oe(P,$,ce){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:ce+(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 pe=Date.now();D=pe-ee>500?P.key:D+P.key,ee=pe;for(let ye=1;ye<=s().length;ye+=1){const Z=(ce+ye)%s().length;if(`${o()(s()[Z])}/${a()(s()[Z])}`.toLowerCase().startsWith(D.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 m()},set detail(P){m(P),b()},get retryLabel(){return v()},set retryLabel(P){v(P),b()},get onRetry(){return C()},set onRetry(P){C(P),b()},get onSelect(){return z()},set onSelect(P){z(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 O()},set scrollable(P=!0){O(P),b()},get formStyle(){return N()},set formStyle(P=!1){N(P),b()},$set:Nt,$on:(P,$)=>Dt(e,P,$)},W=Ze(),X=ue(W);{var le=P=>{var $=QN(),ce=ne($),pe=ne(ce),ye=se(pe,!0),Z=A(pe,2);{var ae=I=>{qe(I,{variant:"ghost",type:"button",class:"underline underline-offset-2 cursor-pointer hover:no-underline",get onclick(){return C()},children:(te,ve)=>{Pt();var de=zt();L(()=>H(de,v())),x(te,de)},$$slots:{default:!0}})};j(Z,I=>{C()&&v()&&I(ae)})}Y(ce);var V=A(ce,2);{var K=I=>{var te=YN(),ve=se(te,!0);L(()=>H(ve,m())),x(I,te)};j(V,I=>{m()&&I(K)})}Y($),L(()=>H(ye,g())),x(P,$)},re=P=>{var $=ZN(),ce=ne($);fi(ce,{size:12});var pe=A(ce),ye=se(pe,!0);Y($),L(()=>{st($,"aria-label",h()),at($,1,`mt-2 flex items-center gap-2 ${N()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),H(ye,h())}),x(P,$)},Q=P=>{var $=eD();ss($,23,s,ce=>i()(ce),(ce,pe,ye)=>{{let Z=w(()=>`${r()}-${l(ye)}`),ae=w(()=>`${o()(l(pe))}/${a()(l(pe))}`),V=w(()=>l(ye)===Math.max(0,S())?0:-1),K=w(()=>M()?i()(l(pe))===M():l(ye)===S()),I=w(()=>l(ye)===S()||i()(l(pe))===M()),te=w(()=>i()(l(pe))===M()),ve=w(()=>o()(l(pe))),de=w(()=>a()(l(pe))),fe=w(()=>c()?.(l(pe)));rp(ce,{get id(){return l(Z)},option:!0,get"aria-label"(){return l(ae)},get tabindex(){return l(V)},get"aria-selected"(){return l(K)},get selected(){return l(I)},get checked(){return l(te)},get formStyle(){return N()},get owner(){return l(ve)},get name(){return l(de)},get avatarUrl(){return l(fe)},get provider(){return u()},onclick:()=>z()(l(pe)),onmousemove:()=>S(l(ye)),onfocus:()=>S(l(ye)),onkeydown:ke=>oe(ke,l(pe),l(ye))})}}),Y($),sr($,ce=>k(E,ce),()=>l(E)),L(()=>{st($,"id",r()),st($,"aria-label",d()),at($,1,$n(O()?"mt-2 max-h-56 overflow-y-auto":"mt-2"))}),x(P,$)},me=P=>{var $=tD(),ce=se($,!0);L(()=>{at($,1,`mt-2 ${N()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),H(ce,p())}),x(P,$)};j(X,P=>{g()?P(le):f()?P(re,1):s().length?P(Q,2):P(me,-1)})}return x(n,W),Lt(F)}var nD=B('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),rD=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 dw(n,e){if(new.target)return Ot({component:dw,...n});It(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),m=y(e,"scrollable",7,!0),v=y(e,"formStyle",7,!1),C=he(void 0);function z(Q){if(Q.key!=="ArrowDown"||Q.isComposing)return;const me=l(C)?.querySelector('[role="option"]');me&&(Q.preventDefault(),Q.stopPropagation(),me.focus())}var M={get selectedProjectPath(){return t()},set selectedProjectPath(Q){t(Q),b()},get onSelect(){return r()},set onSelect(Q){r(Q),b()},get scopeKey(){return s()},set scopeKey(Q){s(Q),b()},get prefix(){return i()},set prefix(Q){i(Q),b()},get instanceBaseUrl(){return o()},set instanceBaseUrl(Q){o(Q),b()},get query(){return a()},set query(Q){a(Q),b()},get page(){return c()},set page(Q){c(Q),b()},get copy(){return u()},set copy(Q){u(Q),b()},get onSearch(){return d()},set onSearch(Q){d(Q),b()},get onSubmit(){return f()},set onSubmit(Q){f(Q),b()},get submitLabel(){return h()},set submitLabel(Q){h(Q),b()},get onMore(){return p()},set onMore(Q){p(Q),b()},get onRecover(){return g()},set onRecover(Q){g(Q),b()},get scrollable(){return m()},set scrollable(Q=!0){m(Q),b()},get formStyle(){return v()},set formStyle(Q=!1){v(Q),b()},$set:Nt,$on:(Q,me)=>Dt(e,Q,me)},S=rD(),O=ne(S);{var N=Q=>{var me=nD(),P=se(me,!0);L(()=>H(P,o())),x(Q,me)};j(O,Q=>{o()&&!i()&&Q(N)})}var E=A(O,2),D=ne(E);{var ee=Q=>{var me=Ze(),P=ue(me);Xn(P,i),x(Q,me)};j(D,Q=>{i()&&Q(ee)})}var U=A(D,2);{var oe=Q=>{{let me=w(()=>!s());rs(Q,{type:"search",get"aria-label"(){return u().searchLabel},get value(){return a()},get disabled(){return l(me)},get placeholder(){return u().searchPlaceholder},oninput:P=>d()(P.currentTarget.value,s()),onkeydown:z,class:"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm",noFocusStyle:!0})}};j(U,Q=>{c().status!=="unavailable"&&Q(oe)})}Y(E);var F=A(E,2);{var W=Q=>{{let me=w(()=>!a().trim()||c().status==="loading"||c().loadingMore);qe(Q,{type:"button",variant:"secondary",class:"mt-2 w-full",get disabled(){return l(me)},onclick:()=>f()?.(a(),s()),children:(P,$)=>{Pt();var ce=zt();L(()=>H(ce,h())),x(P,ce)},$$slots:{default:!0}})}};j(F,Q=>{c().status!=="unavailable"&&f()&&h()&&Q(W)})}var X=A(F,2);uh(X,s,Q=>{{let me=w(()=>c().status==="ready"?c().items:[]),P=w(()=>c().status==="loading"),$=w(()=>a()?u().emptySearchLabel:u().emptyLabel),ce=w(()=>c().status==="unavailable"?c().message:void 0),pe=w(()=>c().status==="unavailable"?c().detail:void 0),ye=w(()=>c().status==="unavailable"?c().actionLabel:void 0),Z=w(()=>g()?()=>g()?.(s()):void 0);sp(Q,{get items(){return l(me)},getKey:ae=>ae.projectPath,getOwner:ae=>ae.projectPath.split("/").slice(0,-1).join("/"),getName:ae=>ae.projectPath.split("/").at(-1)??ae.name,getAvatarUrl:ae=>ae.ownerAvatarUrl,provider:"gitlab",get scrollable(){return m()},get formStyle(){return v()},get label(){return u().listLabel},get loading(){return l(P)},get loadingLabel(){return u().loadingLabel},get emptyLabel(){return l($)},get error(){return l(ce)},get detail(){return l(pe)},get retryLabel(){return l(ye)},get onRetry(){return l(Z)},get selectedKey(){return t()},onSelect:ae=>r()(ae.projectPath,s())})}});var le=A(X,2);{var re=Q=>{qe(Q,{type:"button",variant:"ghost",class:"mt-2 w-full",get disabled(){return c().loadingMore},onclick:()=>p()(s()),children:(me,P)=>{Pt();var $=zt();L(()=>H($,c().loadingMore?u().loadingMoreLabel:u().loadMoreLabel)),x(me,$)},$$slots:{default:!0}})};j(le,Q=>{c().status==="ready"&&(c().hasMore||c().loadingMore)&&Q(re)})}return Y(S),sr(S,Q=>k(C,Q),()=>l(C)),x(n,S),Lt(M)}var sD=B('<div class="py-2 px-2 flex items-center gap-2 text-xs text-emerald-500"><!> <span> </span></div>'),Vm=B("<!> <span> </span>",1),iD=B('<div class="py-2 px-2 space-y-2"><p class="text-xs text-danger"> </p> <!></div>'),oD=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>'),aD=B("<!> <span> </span> <!>",1),lD=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>'),cD=B('<div class="py-2 px-2 flex items-center gap-2 text-xs text-subtle"><!> <span> </span></div>'),uD=B('<p class="type-caption whitespace-normal text-muted-foreground"> </p>'),dD=B('<div class="first-line-icon type-caption"><!></div> <div class="flex-1 min-w-0"><p> </p> <!></div>',1),Wm=B("<div><!></div>");function fw(n,e){if(new.target)return Ot({component:fw,...n});It(e,!0);const t=()=>nn(g,"$isAuthenticated$",a),r=()=>nn(m,"$isAuthenticating$",a),s=()=>nn(v,"$deviceFlow$",a),i=()=>nn(C,"$error$",a),o=()=>nn(z,"$requiresDaemonAuth$",a),[a,c]=Ka();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=Av(),m=r_(),v=s_(),C=i_(),z=o_();let M=he(!1),S=he(!1),O=he(!1);Fu(()=>{At.dispatch(af()),p()&&N()});function N(){k(M,!0),At.dispatch(Sk())}function E(){l(M)&&(At.dispatch(Bp()),k(M,!1))}function D(){At.dispatch(Ck()),N()}function ee(){k(M,!1),k(O,!0),setTimeout(()=>{k(O,!1),typeof f()=="function"&&f()()},1e3)}async function U(){if(l(M)){if(t()){ee();return}k(S,!0);try{await yx.isAuthenticated()&&(At.dispatch(af()),ee())}catch{}finally{k(S,!1)}}}ct(()=>{!l(M)&&r()&&s()&&k(M,!0)}),ct(()=>{l(M)&&t()&&ee()}),ct(()=>{if(!l(M)||!s())return;const Z=()=>{U()};return window.addEventListener("focus",Z),()=>{window.removeEventListener("focus",Z)}}),tc(()=>{l(M)&&r()&&At.dispatch(Bp())});const oe=w(()=>l(M)&&r()),F=w(()=>l(M)&&s()),W=w(()=>l(M)&&i());var X={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:Nt,$on:(Z,ae)=>Dt(e,Z,ae)},le=Wm(),re=ne(le);{var Q=Z=>{var ae=sD(),V=ne(ae);tt(V,{get icon(){return hv},size:"xs"});var K=A(V,2),I=se(K,!0);Y(ae),L(te=>H(I,te),[()=>_.lib_githubAuth_connected_label()]),Ms(3,ae,()=>Ho,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},me=Z=>{var ae=iD(),V=ne(ae),K=se(V,!0),I=A(V,2);qe(I,{variant:"outline",size:"xs",onclick:D,children:(te,ve)=>{var de=Vm(),fe=ue(de);tt(fe,{get icon(){return Zf},size:"xs"});var ke=A(fe,2),be=se(ke,!0);L(q=>H(be,q),[()=>_.lib_githubAuth_tryAgain_label()]),x(te,de)},$$slots:{default:!0}}),Y(ae),L(()=>H(K,i())),Ms(3,ae,()=>Ho,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},P=Z=>{var ae=oD(),V=ne(ae),K=se(V,!0),I=A(V,2),te=ne(I),ve=A(te,2);Y(I),Y(ae),L((de,fe,ke)=>{H(K,de),H(te,`${fe??""} `),H(ve,` ${ke??""}`)},[()=>_.lib_githubAuth_daemonAuthFirst_message(),()=>_.lib_githubAuth_run_before(),()=>_.lib_githubAuth_inYourTerminal_after()]),Ms(3,ae,()=>Ho,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},$=Z=>{var ae=lD(),V=ne(ae),K=ne(V),I=se(K,!0),te=A(K,2);{let q=w(()=>_.lib_githubAuth_closeModal_ariaLabel());qe(te,{variant:"ghost-light",size:"icon-xs",class:"-mt-2 -mr-2",onclick:E,get"aria-label"(){return l(q)},children:(Me,ze)=>{tt(Me,{get icon(){return Ki},size:"xs"})},$$slots:{default:!0}})}Y(V);var ve=A(V,2);qk(ve,{get userCode(){return s().userCode},get verificationUri(){return s().verificationUri},compact:!0});var de=A(ve,2),fe=ne(de);{var ke=q=>{var Me=Vm(),ze=ue(Me);fi(ze,{size:12});var gt=A(ze,2),Le=se(gt,!0);L(De=>H(Le,De),[()=>_.lib_githubAuth_checking_label()]),x(q,Me)},be=q=>{var Me=aD(),ze=ue(Me);fi(ze,{size:12});var gt=A(ze,2),Le=se(gt,!0),De=A(gt,2);qe(De,{type:"button",class:"cursor-pointer underline underline-offset-2 decoration-muted-foreground/20",onclick:U,children:(Fe,vt)=>{Pt();var Vt=zt();L(nt=>H(Vt,nt),[()=>_.lib_githubAuth_checkNow_label()]),x(Fe,Vt)},$$slots:{default:!0}}),L(Fe=>H(Le,Fe),[()=>_.lib_githubAuth_waitingForAuthorization_label()]),x(q,Me)};j(fe,q=>{l(S)?q(ke):q(be,-1)})}Y(de),Y(ae),L(q=>H(I,q),[()=>_.lib_githubAuth_enterCode_label()]),Ms(3,ae,()=>Ho,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},ce=Z=>{var ae=cD(),V=ne(ae);fi(V,{size:12});var K=A(V,2),I=se(K,!0);Y(ae),L(te=>H(I,te),[()=>_.lib_githubAuth_startingAuthentication_label()]),Ms(3,ae,()=>Ho,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},pe=Z=>{var ae=Wm(),V=ne(ae);{let K=w(()=>d()?"h-8":"h-auto items-start py-2");qe(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(K)??""}`},onclick:N,children:(I,te)=>{var ve=dD(),de=ue(ve),fe=ne(de);hh(fe,{size:16,class:"text-ghost"}),Y(de);var ke=A(de,2),be=ne(ke),q=se(be,!0),Me=A(be,2);{var ze=gt=>{var Le=uD(),De=se(Le,!0);L(Fe=>H(De,Fe),[()=>_.lib_githubAuth_enables_description()]),x(gt,Le)};j(Me,gt=>{d()||gt(ze)})}Y(ke),L(()=>{at(be,1,`type-caption font-normal ${d()?"truncate":"whitespace-normal"}`),H(q,u())}),x(I,ve)},$$slots:{default:!0}})}Y(ae),Ms(3,ae,()=>Ho,()=>({axis:"y",tier:"moderate"})),x(Z,ae)};j(re,Z=>{l(O)?Z(Q):l(W)?Z(me,1):o()?Z(P,2):l(F)&&s()?Z($,3):l(oe)?Z(ce,4):Z(pe,-1)})}Y(le),L(()=>at(le,1,`min-w-0 rounded-sm ${d()?"":"bg-sidebar"} ${h()??""}`)),x(n,le);var ye=Lt(X);return c(),ye}function fD(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 hD=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 hw(n,e){if(new.target)return Ot({component:hw,...n});It(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(()=>fD(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:Nt,$on:(M,S)=>Dt(e,M,S)},h=hD(),p=ne(h);{let M=w(()=>`${d}-switch`),S=w(()=>`${d}-label`),O=w(()=>`${d}-description`);yv(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(O)},onCheckedChange:N=>s()(N)})}var g=A(p,2),m=ne(g),v=se(m,!0),C=A(m,2),z=se(C,!0);return Y(g),Y(h),L(()=>{at(h,1,`flex min-w-0 items-start gap-2.5 ${o()??""}`),st(m,"id",`${d}-label`),st(m,"for",`${d}-switch`),H(v,l(c)),st(C,"id",`${d}-description`),H(z,l(u))}),x(n,h),Lt(f)}function pD(n){return n.githubConnected||n.gitlabConnected||n.githubFailed||n.gitlabFailed?!0:!n.githubSettled||!n.gitlabSettled}function gD(n){return n.plainFoldersOffered?n.selected?n.selected:n.hasGitRepositoryEntry?"codebase":n.forgeState==="none"||n.hasPlainFolderEntry?"folder":"codebase":"codebase"}function mD(n){return n.githubConnected||n.gitlabConnected?"connected":n.githubFailed||!n.githubSettled||n.gitlabFailed||!n.gitlabSettled?"unknown":"none"}const vD=At.createSelector(n=>n.userPreferences?.labsPlainFolderWorkspacesEnabled===!0&&wx(n.daemonHealth?.stats?.protocolVersion)),bB=At.createSelector(n=>{const e=n.workspace?.workspaces?ih(n.workspace.workspaces).filter(s=>s.id!==Mk):[],t=n.gitlabAuth?.statusFailed===!0,r=xx({rememberedChoice:null,workspacesLoaded:n.workspace?.hasLoaded===!0,hasGitWorkspace:kx(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"}),bD=At.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return pD({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})}),yD=At.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return mD({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})}),wD=At.createSelector(n=>n.githubRepos.repos),xD=At.createSelector(n=>ih(wD.select(n))),kD=At.createSelector(n=>n.githubRepos.loading),_D=At.createSelector(n=>n.githubRepos.error),SD=At.createSelector(n=>n.githubRepos.loaded),CD=At.createSelector(n=>n.githubRepoSearch.results),MD=At.createSelector(n=>ih(CD.select(n))),TD=At.createSelector(n=>n.githubRepoSearch.loading),ED=At.createSelector(n=>n.githubRepoSearch.lastQuery);var AD=B('<p class="type-caption text-muted-foreground"> </p>'),RD=B('<div class="flex flex-col gap-0.5" data-testid="import-session-provider-notes"></div>'),PD=B('<!> <span class="whitespace-nowrap"> </span>',1),ID=B("<!> <!>",1),LD=B('<div class="shrink-0 overflow-x-auto px-2 pt-2" data-testid="import-session-provider-filter"><!></div>'),OD=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>'),ND=B('<span aria-hidden="true">·</span> <time class="shrink-0"> </time>',1),DD=B('<span aria-hidden="true">·</span> <span class="min-w-0 shrink truncate" data-testid="import-session-disabled-reason"> </span>',1),$D=B('<span aria-hidden="true">·</span> <span class="min-w-0 max-w-1/3 shrink truncate"> </span>',1),BD=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>'),zD=B('<div class="flex min-h-0 flex-1 flex-col" data-testid="import-session-list"><!> <!></div>');function pw(n,e){if(new.target)return Ot({component:pw,...n});It(e,!0);const t=P=>{var $=RD();ss($,21,()=>l(E),ce=>ce.id,(ce,pe)=>{var ye=AD(),Z=se(ye,!0);L(ae=>H(Z,ae),[()=>_.sessionImport_list_providerFailed_note({provider:l(pe).label})]),x(ce,ye)}),Y($),x(P,$)};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),m=y(e,"disabledReason",7),v=y(e,"selectedKey",7,""),C=y(e,"interactionRoot",7,null),z=he(null);function M(P){const $=C()??l(z);P.target instanceof Node&&$?.contains(P.target)&&P.preventDefault()}const S=P=>`session:${P}`;function O(P){return{value:S(Cv(P)),disabled:!!m()?.(P),label:P.title.trim()||_.sessionImport_list_untitled_label(),description:uN(P),data:P}}const N=w(()=>d().filter(P=>P.status==="ok")),E=w(()=>d().filter(P=>P.status==="error")),D=w(()=>s().filter(P=>!f()||P.provider===f()).map(O));function ee(P){return d().find($=>$.id===P)?.label??u()?.(P)??P}let U=he("");function oe(P){if(P.updatedAt===null)return null;const $=new Date(P.updatedAt);return Number.isNaN($.getTime())?null:$}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 m()},set disabledReason(P){m(P),b()},get selectedKey(){return v()},set selectedKey(P=""){v(P),b()},get interactionRoot(){return C()},set interactionRoot(P=null){C(P),b()},$set:Nt,$on:(P,$)=>Dt(e,P,$)},W=zD(),X=ne(W);{var le=P=>{var $=LD(),ce=ne($);{let pe=w(()=>f()||"all"),ye=w(()=>_.sessionImport_list_providerFilter_ariaLabel());wt(ce,()=>Pv,(Z,ae)=>{ae(Z,{type:"single",variant:"flat",get value(){return l(pe)},onValueChange:V=>h()?.(!V||V==="all"?"":V),get"aria-label"(){return l(ye)},children:(V,K)=>{var I=ID(),te=ue(I);wt(te,()=>_l,(de,fe)=>{fe(de,{value:"all",class:"type-caption h-7 px-2",children:(ke,be)=>{Pt();var q=zt();L(Me=>H(q,Me),[()=>_.sessionImport_list_allProviders_label()]),x(ke,q)},$$slots:{default:!0}})});var ve=A(te,2);ss(ve,17,()=>l(N),de=>de.id,(de,fe)=>{var ke=Ze(),be=ue(ke);wt(be,()=>_l,(q,Me)=>{Me(q,{get value(){return l(fe).id},class:"type-caption h-7 gap-1.5 px-2",children:(ze,gt)=>{var Le=PD(),De=ue(Le);{var Fe=Pe=>{lf(Pe,{get providerId(){return l(fe).id},size:14,class:"size-3.5",monochrome:!0})},vt=w(()=>cf(l(fe).id));j(De,Pe=>{l(vt)&&Pe(Fe)})}var Vt=A(De,2),nt=se(Vt,!0);L(()=>H(nt,l(fe).label)),x(ze,Le)},$$slots:{default:!0}})}),x(de,ke)}),x(V,I)},$$slots:{default:!0}})})}Y($),x(P,$)};j(X,P=>{l(N).length>1&&r()!=="error"&&P(le)})}var re=A(X,2);{var Q=P=>{var $=OD(),ce=ne($),pe=se(ce,!0),ye=A(ce,2);qe(ye,{variant:"ghost",size:"sm",get onclick(){return a()},children:(Z,ae)=>{Pt();var V=zt();L(K=>H(V,K),[()=>_.sessionImport_list_retry_label()]),x(Z,V)},$$slots:{default:!0}}),Y($),L(Z=>H(pe,Z),[()=>_.sessionImport_list_loadFailed_error()]),x(P,$)},me=P=>{{const $=(te,ve=Jr)=>{const de=w(()=>ve().data.provider);var fe=Ze(),ke=ue(fe);{var be=ze=>{lf(ze,{get providerId(){return l(de)},size:16,class:"size-4"})},q=w(()=>cf(l(de))),Me=ze=>{tt(ze,{get icon(){return pv},get class(){return dn.icon}})};j(ke,ze=>{l(q)?ze(be):ze(Me,-1)})}x(te,fe)},ce=(te,ve=Jr)=>{const de=w(()=>ve().data),fe=w(()=>oe(l(de))),ke=w(()=>m()?.(l(de))??null);var be=BD(),q=ne(be),Me=se(q,!0),ze=A(q,2);{var gt=nt=>{var Pe=ND(),Ce=A(ue(Pe),2),we=se(Ce,!0);L((Ve,Mt)=>{st(Ce,"datetime",l(de).updatedAt),st(Ce,"title",Ve),H(we,Mt)},[()=>f1(l(fe)),()=>h1(l(fe))]),x(nt,Pe)};j(ze,nt=>{l(fe)&&l(de).updatedAt&&nt(gt)})}var Le=A(ze,4),De=se(Le,!0),Fe=A(Le,2);{var vt=nt=>{var Pe=DD(),Ce=A(ue(Pe),2),we=se(Ce,!0);L(()=>H(we,l(ke))),x(nt,Pe)},Vt=nt=>{var Pe=$D(),Ce=A(ue(Pe),2),we=se(Ce,!0);L(()=>{st(Ce,"title",l(de).gitBranch),H(we,l(de).gitBranch)}),x(nt,Pe)};j(Fe,nt=>{l(ke)?nt(vt):l(de).gitBranch&&nt(Vt,1)})}Y(be),L((nt,Pe)=>{H(Me,nt),st(Le,"title",l(de).cwd),H(De,Pe)},[()=>ee(l(de).provider),()=>dN(l(de).cwd)]),x(te,be)};let pe=w(()=>v()?S(v()):""),ye=w(()=>r()==="loading"),Z=w(()=>_.sessionImport_list_ariaLabel()),ae=w(()=>_.sessionImport_list_search_placeholder()),V=w(()=>_.sessionImport_list_search_placeholder()),K=w(()=>l(U).trim()?_.sessionImport_list_noResults_message():_.sessionImport_list_empty_message()),I=w(()=>l(E).length>0?t:void 0);ah(P,{get options(){return l(D)},get value(){return l(pe)},get open(){return p()},get loading(){return l(ye)},get ariaLabel(){return l(Z)},get placeholder(){return l(ae)},get searchPlaceholder(){return l(V)},get emptyText(){return l(K)},get footer(){return l(I)},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`${dn.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:$,optionDescription:ce,$$slots:{optionIcon:!0,optionDescription:!0}})}};j(re,P=>{r()==="error"?P(Q):P(me,-1)})}return Y(W),sr(W,P=>k(z,P),()=>l(z)),L(()=>st(W,"data-status",r())),x(n,W),Lt(F)}var FD=B("<!> ",1),HD=B('<div class="flex shrink-0 justify-end border-t border-border px-2 py-1"><!></div>'),UD=B('<div data-testid="import-session-tab"><!> <!></div>');function gw(n,e){if(new.target)return Ot({component:gw,...n});It(e,!0);const t=()=>nn(m,"$status$",i),r=()=>nn(g,"$sessions$",i),s=()=>nn(v,"$providers$",i),[i,o]=Ka();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,"class",7,"");const g=_x(),m=Sx(),v=Cx();let C=he(""),z=he(null),M="";const S=w(()=>t()==="error"?"error":(t()==="loading"||t()==="idle")&&r().length===0?"loading":"ready");function O(re,Q=l(C)){M=re,At.dispatch(Tk(re,Q||void 0))}Fu(()=>{if(!d())return;const re=At.state.importableSessions;re&&(re.status==="ready"||re.status==="loading")&&re.query===""&&re.provider===""||Xs(()=>O(""))});function N(re){return o1.select(At.state,re)}function E(re){return fN(re,c())}function D(re){return E(re)?null:_.sessionImport_list_noRepository_reason()}function ee(re){const Q=E(re);Q&&a()(Ek(re,Q))}var U={get onselect(){return a()},set onselect(re){a(re),b()},get knownRepos(){return c()},set knownRepos(re=[]){c(re),b()},get selectedKey(){return u()},set selectedKey(re=""){u(re),b()},get autoload(){return d()},set autoload(re=!0){d(re),b()},get inputRef(){return f()},set inputRef(re=null){f(re),b()},get onclose(){return h()},set onclose(re){h(re),b()},get class(){return p()},set class(re=""){p(re),b()},$set:Nt,$on:(re,Q)=>Dt(e,re,Q)},oe=UD(),F=ne(oe);pw(F,{get status(){return l(S)},get sessions(){return r()},providerLabel:N,get providers(){return s()},get providerFilter(){return l(C)},onproviderchange:re=>{k(C,re,!0),O(M,re)},onquerychange:O,onselect:ee,onretry:()=>O(M),get onclose(){return h()},disabledReason:D,get selectedKey(){return u()},get interactionRoot(){return l(z)},get inputRef(){return f()},set inputRef(re){f(re)}});var W=A(F,2);{var X=re=>{var Q=HD(),me=ne(Q);{let P=w(()=>t()==="loading");qe(me,{variant:"ghost",size:"sm",type:"button",get disabled(){return l(P)},onclick:()=>O(M),"data-testid":"import-session-refresh",children:($,ce)=>{var pe=FD(),ye=ue(pe);tt(ye,{get icon(){return lx},class:"size-3.5"});var Z=A(ye);L(ae=>H(Z,` ${ae??""}`),[()=>_.sessionImport_list_refresh_label()]),x($,pe)},$$slots:{default:!0}})}Y(Q),x(re,Q)};j(W,re=>{l(S)!=="error"&&re(X)})}Y(oe),sr(oe,re=>k(z,re),()=>l(z)),L(()=>at(oe,1,`flex min-h-0 flex-col ${p()??""}`)),x(n,oe);var le=Lt(U);return o(),le}var VD=B('<div data-recent-repo-row=""><!> <!> <!></div>'),WD=B(" <!>",1),Ic=B("<!> <!>",1),jD=B('<span class="text-sm pl-3 shrink-0 select-none"> </span>'),jm=B("<span> </span>"),KD=B('<!> <span class="min-w-0 flex-1 text-left truncate" data-testid="repo-selector-session-value"><span> </span></span>',1),Km=B('<span class="text-sm text-subtle ml-1"> </span>'),Gm=B("<span> </span> <!>",1),GD=B('<span class="min-w-0 flex-1 text-left truncate"><!> <!></span>'),qD=B("<div><!> <!> <!> <!> <!></div>"),JD=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>'),XD=B('<div role="status"></div>'),YD=B('<p class="type-body px-3 py-2 text-muted-foreground" role="status"> </p>'),qm=B("<!> <span> </span>",1),QD=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),ZD=B('<div class="flex shrink-0 items-center gap-1 px-2 pt-2 pb-2"><!> <h2> </h2></div>'),e$=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>'),t$=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>'),n$=B('<!> <!> <div class="flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring"><!> <!></div> <!> <!>',1),r$=B('<span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <span><div class="truncate"> </div> <!></span>',1),s$=B('<div class="mt-2 px-1"><span class="text-sm text-danger"> </span></div>'),i$=B('<div class="flex items-center gap-2 text-sm text-subtle"><!> <span> </span></div>'),Lc=B('<div class="flex items-center justify-between gap-2"><span class="text-sm text-subtle"> </span> <!></div>'),o$=B('<div class="flex items-center justify-between gap-2"><span class="text-sm text-warning-ink"> </span> <!></div>'),a$=B('<div class="mt-2 px-1"><div class="text-sm text-subtle truncate mb-2"> </div> <!></div>'),l$=B('<!> <div class="flex items-center gap-3"><span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <!></div> <!>',1),c$=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>'),u$=B('<div class="text-sm text-subtle px-3 py-2"> </div>'),d$=B("<!> ",1),f$=B('<div class="space-y-1"><!> <!> <!></div>'),h$=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>'),p$=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>'),g$=B('<div class="space-y-1"></div>'),m$=B('<div class="-mx-2" data-testid="recent-repositories"><!></div>'),v$=B('<div class="min-h-16 overflow-y-auto flex-1 px-4 pb-3 pt-2"><!> <!></div>'),b$=B("<!> <div><!> <!></div> <!> <!>",1),y$=B("<!> <!> <!>",1),w$=B('<div class="relative min-w-0"><!></div> <!> <!>',1);function qs(n,e){const t=Ji();if(new.target)return Ot({component:qs,...n});It(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(X,"$admission$",U),c=()=>nn(ae,"$workspaceInitializerRecentRepos$",U),u=()=>nn(ye,"$dismissedRecentRepoKeys$",U),d=()=>nn(Ja,"$sessionImportSupported$",U),f=()=>nn(Ke,"$cloneSourceVisible$",U),h=()=>nn(V,"$workspaceInitializerRemoteSetups$",U),p=()=>nn(Z,"$defaultParentPath$",U),g=()=>nn(ve,"$directoryStatusCheck$",U),m=()=>nn(Xa,"$plainFolderCreationAvailable$",U),v=()=>nn(Ya,"$forgeConnectionState$",U),C=()=>nn(q,"$githubRepos$",U),z=()=>nn(Fe,"$githubSearchLastQuery$",U),M=()=>nn(Le,"$githubSearchResults$",U),S=()=>nn(ze,"$githubReposLoaded$",U),O=()=>nn(Me,"$githubReposLoading$",U),N=()=>nn(gt,"$githubReposError$",U),E=()=>nn(pe,"$initializerHydrated$",U),D=()=>nn(lc,"$remoteWorkspacesEnabled$",U),ee=()=>nn(De,"$githubSearchLoading$",U),[U,oe]=Ka(),F=Xf(),W=a1(),X=l1(),le=fa("RepoSelector"),re=ju(),Q=new Ku;let me=he(null),P=he(!1);const $=_.workspace_isolationMode_worktree_label(),ce=At.dispatch,pe=Mx(),ye=Tx(),Z=Ex(),ae=Ax(),V=Rx(),K=crypto.randomUUID(),I=crypto.randomUUID(),te=Px(K),ve=Ix(I);let de,fe;const ke=Av(),be=w(()=>r()||s()&&i()),q=xD(),Me=kD(),ze=SD(),gt=_D(),Le=MD(),De=TD(),Fe=ED();function vt(T,G){const Te=T.includes("\\")?"\\":"/";return`${T.replace(/[/\\]$/,"")}${Te}${G}`}let Vt=y(e,"variant",7,"ghost"),nt=y(e,"value",7,""),Pe=y(e,"onchange",7),Ce=y(e,"triggerClass",7),we=y(e,"rowLabel",7),Ve=y(e,"displayValue",7),Mt=y(e,"triggerSuffix",7),ie=y(e,"triggerValueClass",7,"text-subtle"),$e=y(e,"triggerContentClass",7,"gap-0.75"),lt=y(e,"emptyLabel",7),yt=y(e,"showEmptyIcon",7,!1),mt=y(e,"showTriggerChevron",7,!1),Tt=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),We=y(e,"triggerIcon",7),Ge=y(e,"triggerAriaLabel",7),Yt=y(e,"onClear",7),Be=y(e,"gitlab",7),jt=y(e,"gitlabSelected",7,!1),Yn=y(e,"plainFolderMode",7,!1),Bn=y(e,"plainFolderSelected",7,!1),ge=y(e,"gitChoice",7),ft=y(e,"sessions",7);function Rt(T){Zr++,Pe()&&Pe()(new CustomEvent("change",{detail:T}))}function an(){l(Xe)&&l(Xe).focus()}function Gt(T="local"){l(ht)&&!nt()&&(k(ht,""),k(Ie,""),k(Ye,"local"),k(Ae,"")),et=T,we()&&k(Kn,"add"),k(Qe,!0)}function ut(){l(Si)&&(et="sessions",k(Kn,"add"),k(Qe,!0))}let ht=he(Sr(nt())),Ie=he(Sr(nt())),He=he(""),Xe=he(void 0),pt=he(null),Qe=he(!1),et=null,it=he(!1);const xt=w(()=>!o()||o().admission===a()&&o().status==="pending");let Ft=he(!1),$t=he(!1),Ye=he(Sr(Os(nt()))),ln=he(""),_n=he(null);const yr=w(()=>{const T=c(),G=o();return!G||G.admission!==a()||At.dispatch!==ce?T:Dx({saved:T,source:G,dismissed:u(),mode:we()?"all":"recent"})});async function ei(T,G){T.preventDefault(),T.stopPropagation();const Te=T.currentTarget,Ht=Te.closest("[data-recent-repo-row]"),xn=Ht?.nextElementSibling??Ht?.previousElementSibling,si=Te.closest('[role="dialog"]'),to=xn?.querySelector("[data-remove-recent-repo]")??si?.querySelector('[role="tab"][aria-selected="true"]')??si?.querySelector("[data-repo-search]");At.dispatch($k({path:G.path,type:G.type})),await Qo(),to?.focus()}let rn=he(null),Er=he(null),cs=null,Ut=he("github");const Ja=Lx(),Si=w(()=>!!ft()&&!!we()&&d()),Yr=w(()=>ft()?.selected??null),Zi=w(()=>l(yr).filter(T=>T.type==="local").map(T=>({path:T.path,type:"local"})));ct(()=>{l(Ut)==="sessions"&&!l(Si)&&k(Ut,"local")});function R(){k(Ut,"sessions"),k(Kn,"add")}function xe(T){ft()?.onSelect(T),k(Qe,!1)}let Ee=he("github");const ot=w(()=>[...i()?[{id:"github",label:"github.com/",icon:Yf}]:[],...Be()?.authenticated&&Be().instanceBaseUrl?[{id:"gitlab",label:`${Be().instanceBaseUrl.replace(/^https:\/\//,"").replace(/\/$/,"")}/`,icon:Qf}]:[]]),Ne=w(()=>l(ot).find(T=>T.id===l(Ee))??l(ot)[0]),Se=w(()=>l(Ne)?.id??"github"),Zt=w(()=>l(Ut)==="github"||l(Ut)==="gitlab"),yn=w(()=>l(Ne)?.label??_.workspace_repoSelector_clone_tab()),Ke=bD(),cn=w(()=>f()||l(ot).length>0||r());function En(T){return!l(cn)&&(T==="github"||T==="gitlab")?"local":T}function Pn(){k(Qe,!1),m_({tab:"connections",hash:"integrations"}).catch(T=>le.error("Failed to open connection settings",T))}function As(T){l(ot).some(G=>G.id===T)&&(k(Ee,T,!0),k(Ut,T,!0))}ct(()=>{if(!(!l(Qe)||l(Ut)!=="gitlab"))return Xs(()=>{const T=Be();if(T)return T.onOpenChange?.(!0,T.scopeKey),()=>Xs(()=>{const G=Be()??T;G.onOpenChange?.(!1,G.scopeKey)})})}),ct(()=>{l(Qe)&&l(Ut)==="gitlab"&&!Be()&&k(Qe,!1)}),ct(()=>{l(Zt)&&k(Ut,En(l(Se)),!0)});let $r=he(!1),Hs=he("select-repo"),ga=he(Sr(_.workspace_repoSelector_selectFolder_title())),Ci=he(void 0);const lc=IS("remote-workspaces");let bs=he(Sr(h())),ma=he(!1);ct(()=>{k(bs,h(),!0)});function cc(T=l(bs)){At.dispatch(Bk(p_(T)))}function J(T){k(ht,T.name,!0),k(Ie,""),k(Ye,"local"),k(Ft,!1),k($t,!0);const G={path:T.workspacePath||T.name,type:"remote",remoteSetup:T,isNewRepo:!1,isValidPath:!0};Rt(G),k(Qe,!1)}function Oe(T){const G=l(bs).filter(Te=>Te.id!==T);k(bs,G,!0),cc(G)}function Ue(){k(ma,!0)}function Ct(T){const G=[...l(bs),T];k(bs,G,!0),cc(G),k(ma,!1)}let Wt=he(!1),Et=he(""),fn=he("new-project"),Qt=he(""),Ae=he("");function Bt(){return Cd(p(),Yn())}ct(()=>{const T=Yn(),G=p();Xs(()=>{l(Et)===Cd(G,!T)&&k(Et,Cd(G,T),!0)})});function Wn(T){At.dispatch(Nk(T))}function An(T){if(!T||T.trim().length===0)return;const G=T.trim();if(G.includes("/")||G.includes("\\"))return _.workspace_repoSelector_nameSeparators_error();if(G===".."||G==="."||/^\.+$/.test(G))return _.workspace_repoSelector_nameDots_error();if(G.includes("\0"))return _.workspace_repoSelector_nameNull_error();if(/[<>:"|?*]/.test(G))return _.workspace_repoSelector_nameInvalid_error();if(G.length>255)return _.workspace_repoSelector_nameTooLong_error()}const ur=w(()=>An(l(fn))),ys=w(()=>l(Et)&&l(fn)&&!l(ur)?vt(l(Et),l(fn)):""),Qr=w(()=>g()?.admission===a()&&g().path===l(ys)&&g().status==="ready"?g().result:null);let pi=he(null);const eo=w(()=>g()?.admission===a()&&g().path===l(ys)&&(g().status==="failed"||g().status==="unsupported")),Mi=w(()=>Yn()?l(eo)?"existing":Bx(l(Qr),l(pi)?.parent===l(Et)?l(pi).inRepo:null):null);ct(()=>{const T=l(Et);if(!Yn()||!T||l(pi)?.parent===T)return;let G=!1;return Td("file:getDirectoryStatus",{path:T}).then(Te=>!!(Te?.success&&(Te.data?.isGitRepo||Te.data?.isSubdirectoryOfGitRepo))).catch(()=>!1).then(Te=>{G||k(pi,{parent:T,inRepo:Te},!0)}),()=>{G=!0}});const Ti=w(()=>g()?.admission===a()&&g().path===l(ys)&&g().status==="pending");let Rs=he(!1),un=he(""),Zr=0;const ti=w(()=>()=>{const T=l(yr).filter(Te=>l(Ut)==="local"?Te.type==="local":l(Zt)&&Te.type==="github"),G=l(Ut)==="gitlab"?Be()?.query??"":l(He);return G===""?T:T.filter(Te=>Op(Te,G))});let Kn=he("browse"),Us=he(""),ws=he(null),ni=he(void 0);const ri=w(()=>{if(l(yr).some(dr))return l(yr);let T;if(jt()&&Be()?.instanceBaseUrl&&Be().selectedProjectPath){const G=Be().selectedProjectPath,Te=`${Be().instanceBaseUrl}/${G}`;T={path:Te,type:"github",githubUrl:Te,name:G.split("/").at(-1),owner:G.split("/").slice(0,-1).join("/"),repositoryIdentity:{provider:"gitlab",instanceBaseUrl:Be().instanceBaseUrl,projectPath:G}}}else if(!jt()&&l(ht)){const G=l(Ye)==="github"?Ns(l(Ae)||l(ht)):null;T=G?{path:`${G.owner}/${G.repo}`,type:"github",githubUrl:`https://github.com/${G.owner}/${G.repo}`,name:G.repo,owner:G.owner}:{path:l(ht),type:"local",name:Ox(l(ht)),...Bn()?{plainFolder:!0}:{}}}return T?[T,...l(yr)]:l(yr)}),Xa=vD(),Ya=yD(),Lo=T=>T.type==="local"&&T.plainFolder===!0,Qa=w(()=>{const T=l(ri).find(dr);return T?Bn()||Lo(T)?"folder":"codebase":null}),ir=w(()=>we()?gD({plainFoldersOffered:m(),forgeState:l(ot).length>0||r()?"connected":v(),hasGitRepositoryEntry:l(ri).some(G=>!Lo(G)),hasPlainFolderEntry:l(ri).some(Lo),selected:l(Qa)})==="folder"?_.workspace_compactInitializer_folder_label():we():void 0),wr=w(()=>m()?_.workspace_repoSelector_searchWithFolders_placeholder():_.workspace_repoSelector_search_placeholder()),Br=w(()=>m()?_.workspace_repoSelector_addRepositoryOrFolder_label():_.workspace_repoSelector_addRepository_label()),xs=w(()=>lt()??(we()?l(Br):_.workspace_repoSelector_selectRepository_label())),zr=w(()=>l(Us).trim()===""?l(ri):l(ri).filter(T=>Op(T,l(Us).trim())));function Ps(T){const G=ll(T,Be()?.instanceBaseUrl);return T.type!=="local"&&G?.provider==="gitlab"&&(!Be()?.authenticated||G.instanceBaseUrl!==Be().instanceBaseUrl||!Be().scopeKey&&!Be().onSelectRecent||Be().page.status==="unavailable")}function dr(T){const G=ll(T,Be()?.instanceBaseUrl);return T.type!=="local"&&G?.provider==="gitlab"?jt()&&Be()?.instanceBaseUrl===G.instanceBaseUrl&&Be().selectedProjectPath===G.projectPath:jt()||!l(ht)?!1:T.type==="github"?l(Ye)==="github"&&uc(T.githubUrl||T.path,l(Ae)||l(ht)):l(Ye)!=="github"&&T.path===l(ht)}function kt(){return[...l(ni)?.querySelectorAll("[data-recent-repo-row]")??[]].map(T=>T.querySelector("button:not([data-remove-recent-repo])")).filter(T=>!!T&&!T.disabled)}function qt(T){if(!T.isComposing){if(T.key==="ArrowDown"){const G=kt()[0];if(!G)return;T.preventDefault(),G.focus()}else if(T.key==="Enter"){T.preventDefault(),T.stopPropagation();const G=l(zr).find(Te=>!Ps(Te));G&&cp(G)}}}function wn(T){if(T.key!=="ArrowDown"&&T.key!=="ArrowUp")return;const G=kt(),Te=G.indexOf(document.activeElement);if(!(Te<0))if(T.preventDefault(),T.key==="ArrowUp"&&Te===0)l(ws)?.focus();else{const Ht=T.key==="ArrowDown"?1:-1;G[Math.min(G.length-1,Te+Ht)]?.focus()}}function or(){const T=l(Us).trim();if(T&&l(cn)){const G=Ns(op(T));G?(k(Ee,"github"),k(Ut,"github"),gd(`${G.owner}/${G.repo}`)):l(Ut)==="github"&&gd(T)}k(Kn,"add"),Qo().then(()=>{l(Ut)==="github"&&l(pt)?.focus()})}function Is(){k(Kn,"browse"),Qo().then(()=>l(ws)?.focus())}function Vs(T){const G=T==="repository"?l(Se):T;we()&&G==="local"&&Ns(l(Ie))&&Za(""),k(Ut,G,!0)}const en=w(()=>l(Qt).trim()),Sn=w(()=>{const T=C();if(!T.length)return[];const G=l(en).toLowerCase();return G?T.filter(Te=>`${Te.owner}/${Te.name}`.toLowerCase().includes(G)):T}),Qn=w(()=>{if(z()!==l(en))return[];const T=M();if(!T.length)return[];const G=new Set(C().map(Te=>Te.id));return T.filter(Te=>!G.has(Te.id))}),zn=w(()=>l(Ut)==="github"&&l(be)?[...l(Sn),...l(Qn)]:[]),Cn=w(()=>{const T=l(rn);if(!T)return!1;const G=T.owner.toLowerCase(),Te=T.repo.toLowerCase();return l(zn).some(Ht=>Ht.owner.toLowerCase()===G&&Ht.name.toLowerCase()===Te)});let sn=he(-1);ct(()=>{l(zn),k(sn,-1)}),ct(()=>{l(Ut)==="github"&&l(be)&&!S()&&!O()&&!N()&&At.dispatch(zp())});function fr(){At.dispatch(zp())}function Ar(T){k(Qt,`${T.owner}/${T.name}`),k(rn,{owner:T.owner,repo:T.name,url:`https://github.com/${T.owner}/${T.name}`},!0),md()}function Ws(T){if(!T.isComposing){if(T.key==="Enter"){T.preventDefault(),T.stopPropagation(),ks();return}if(T.key==="ArrowDown"){if(!l(zn).length)return;T.preventDefault(),k(sn,Math.min(l(sn)+1,l(zn).length-1),!0);return}if(T.key==="ArrowUp"){if(!l(zn).length)return;T.preventDefault(),k(sn,Math.max(l(sn)-1,-1),!0)}}}function ks(){const T=l(sn)>=0?l(zn)[l(sn)]:void 0;T?Ar(T):md()}let Ls=he(-1);ct(()=>{l(ti)(),k(Ls,-1)});function Os(T){return T&&Ns(T)?"github":"local"}function uc(T,G){const Te=Ns(T),Ht=Ns(G);return!!Te&&!!Ht&&Te.owner.toLowerCase()===Ht.owner.toLowerCase()&&Te.repo.toLowerCase()===Ht.repo.toLowerCase()}ct(()=>{nt()&&nt()!==l(ht)&&(k(ht,nt()),k(Ie,nt()),k(Ye,Os(nt()),!0),l(Ae)&&!uc(l(Ae),nt())&&k(Ae,""))});function pd(){if(k(P,!lh(l(me),360)),k(He,""),we()&&l(Kn)==="browse")k(Us,""),requestAnimationFrame(()=>{l(Qe)&&l(Kn)==="browse"&&l(ws)?.focus()});else if(we()){et&&(k(Ut,et,!0),et=null);return}const T=l(ht)||nt();if(le.info("Dropdown opened",{currentValue:T,selectedRepoType:l(Ye)}),et)k(Ut,et,!0),et=null;else if(jt()&&l(ot).some(G=>G.id==="gitlab"))k(Ee,"gitlab"),k(Ut,"gitlab");else if(T){if(k(Ut,En(l(Ye)==="github"?l(Se):l(Ye)),!0),l(Ye)==="github"&&l(cn)&&l(Ie)){const G=Ns(l(Ie));G&&(k(Qt,`${G.owner}/${G.repo}`),Za(`https://github.com/${G.owner}/${G.repo}`,""))}}else k(Ut,En(l(Se)),!0);requestAnimationFrame(()=>{we()||l(Qe)&&l(Ut)!=="gitlab"&&l(Xe)&&(l(Xe).focus(),l(Xe).select())})}let Oo=!1;ct(()=>{const T=l(Qe);T&&!Oo?pd():!T&&Oo&&we()&&!l(it)&&!l($r)&&k(Kn,"browse"),Oo=T}),ct(()=>{if(l(Qe))return da(T=>{T.isComposing||k(Qe,!1)})}),ct(()=>{l(Ut)==="new"&&!l(Et)&&k(Et,Bt(),!0)}),ct(()=>{const T=l(ys),G=a();!T||!l(Et)||!l(fn)||!G||(fe=crypto.randomUUID(),At.dispatch(Ak(I,fe,G,T)))}),ct(()=>{s()&&At.dispatch(af())}),ct(()=>{const T=a(),G=Be()?.instanceBaseUrl;E(),!(!T||At.dispatch!==ce)&&(de=crypto.randomUUID(),At.dispatch(Rk(K,de,T,G)))}),tc(()=>{ft()&&ce(Pk()),de&&ce(Ik(K,de)),fe&&ce(Lk(I,fe))});function Ns(T){const G=T.trim();if(!G)return null;if(G.startsWith("git@github.com:")){const Ht=G.slice(15).replace(/\.git$/,"").split("/");return Ht.length>=2&&Ht[0]&&Ht[1]?{owner:Ht[0],repo:Ht[1]}:null}try{const Te=new URL(G);if(Te.hostname!=="github.com"&&Te.hostname!=="www.github.com"||Te.protocol!=="http:"&&Te.protocol!=="https:")return null;const Ht=Te.pathname.split("/").filter(Boolean);if(Ht.length<2)return null;const xn=Ht[0],si=Ht[1].replace(/\.git$/,"");if(xn&&si)return{owner:xn,repo:si}}catch{}if(!G.includes("\\")&&!G.includes(":")&&!G.startsWith(".")&&!G.startsWith("/")){const Te=G.split("/");if(Te.length===2&&Te[0]&&Te[1]){const Ht=xn=>/^[a-zA-Z0-9]([a-zA-Z0-9\-_\.]*[a-zA-Z0-9])?$/.test(xn)||/^[a-zA-Z0-9]$/.test(xn);if(Ht(Te[0])&&Ht(Te[1]))return{owner:Te[0],repo:Te[1]}}}return null}function op(T){const G=T.trim();if(!G)return"";const Te=Ns(G);if(Te)return`${Te.owner}/${Te.repo}`;if(G.toLowerCase().startsWith("github.com/")){const Ht=G.slice(11),xn=Ht.split("/").filter(Boolean);return xn.length>=2?`${xn[0]}/${xn[1].replace(/\.git$/,"")}`:Ht.replace(/\/$/,"")}if(G.toLowerCase().startsWith("www.github.com/")){const Ht=G.slice(15),xn=Ht.split("/").filter(Boolean);return xn.length>=2?`${xn[0]}/${xn[1].replace(/\.git$/,"")}`:Ht.replace(/\/$/,"")}return G.replace(/\/$/,"").replace(/\.git$/,"")}function gd(T){let G=T;G.toLowerCase().startsWith("https://github.com/")?G=G.slice(19):G.toLowerCase().startsWith("http://github.com/")?G=G.slice(18):G.toLowerCase().startsWith("github.com/")&&(G=G.slice(11)),k(Qt,G,!0),G?Za(`https://github.com/${G}`,G):Za(""),ap(G)}function ap(T){l(be)&&At.dispatch(Ok(T.trim()))}function vw(T){const G=T.clipboardData?.getData("text")||"";if(G){T.preventDefault();const Te=op(G);k(Qt,Te,!0),Te&&Za(`https://github.com/${Te}`,Te),ap(Te)}}async function lp(T){try{const G=await Td("file:getDirectoryStatus",{path:T});G.success&&G.data&&(k(_n,G.data,!0),k(Ft,!G.data.exists&&!G.data.isSubdirectoryOfGitRepo,!0),G.data.exists&&!G.data.isDirectory&&k($t,!1))}catch(G){le.warn("Failed to check directory status",G)}}function Za(T,G=T){k(Ie,T,!0),k(He,G,!0),cs&&clearTimeout(cs),k(rn,null),k(Er,null),k(ln,""),cs=setTimeout(()=>{yw(T)},300)}function bw(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 yw(T){if(!T||T.trim()===""){k(rn,null),k(Er,null);return}if(T.startsWith("/")||T.startsWith("~")||T.includes(":\\")||T.startsWith("./")||T.startsWith("../")){k(rn,null),k(Er,T,!0),await lp(T);return}if(bw(T)){const G=Ns(T);if(G){const Te=`https://github.com/${G.owner}/${G.repo}`;k(Er,null),k(rn,{owner:G.owner,repo:G.repo,url:Te},!0);return}}k(rn,null),k(Er,null)}function cp(T){if(Zr++,we()&&dr(T)){k(Qe,!1);return}const G=ll(T,Be()?.instanceBaseUrl);if(T.type!=="local"&&G?.provider==="gitlab"){if(!Be()?.authenticated||G.instanceBaseUrl!==Be().instanceBaseUrl||!Be().scopeKey&&!Be().onSelectRecent||Be().page.status==="unavailable")return;Be().onSelectRecent?Be().onSelectRecent(G.projectPath,G.instanceBaseUrl):Be().onSelect(G.projectPath,Be().scopeKey),k(Qe,!1);return}if(T.type==="local"&&(Yn()||T.plainFolder===!0)){xw(T);return}up(T)}async function ww(T){try{const G=await Td("file:getDirectoryStatus",{path:T});return G?.success&&G.data?G.data:null}catch(G){return le.warn("Failed to check directory status",G),null}}async function xw(T){const G=Zr,Te=await ww(T.path);if(G!==Zr)return;const Ht=!!Te&&(Te.isGitRepo||!!Te.isSubdirectoryOfGitRepo);if(Te?Te.exists&&Te.isDirectory&&!Ht:T.plainFolder===!0||Yn()){if(Yn()){el(T.path,"existing");return}k(un,T.path,!0),k(Rs,!0);return}if(Yn()&&Te&&!Te.exists&&!Ht){el(T.path,"new");return}up(T,Te?.isSubdirectoryOfGitRepo?Te.relativePathFromGitRoot:"")}function up(T,G=""){const Te=T.type==="github"&&T.githubUrl?Ns(T.githubUrl):null,Ht=Te?`${Te.owner}/${Te.repo}`:T.path;k(ht,Ht,!0),k(Ie,T.type==="github"?T.githubUrl:T.path,!0),k(Ye,T.type,!0),k(Ae,T.type==="github"&&T.githubUrl||"",!0),k(Ft,!1),k($t,!0),k(ln,""),k(_n,null);const xn={path:Ht,type:T.type,isNewRepo:!1,isValidPath:!0};G&&(xn.scope=G),T.type==="github"&&T.githubUrl&&(xn.githubUrl=T.githubUrl),Rt(xn),k(Qe,!1)}function dp(T,G,Te){k(Hs,T,!0),k(ga,G,!0),k(Ci,Te,!0),Qk({title:G,defaultPath:Te,openModal:()=>k($r,!0),onSelect:fp})}function kw(){dp("select-repo",_.workspace_repoSelector_selectRepoFolder_title(),typeof l(ht)=="string"?l(ht):void 0)}async function _w(T){Zr++;try{if(await lp(T),l(_n)?.exists&&!l(_n)?.isGitRepo&&!l(_n)?.isSubdirectoryOfGitRepo){if(Yn()){el(T,"existing");return}k(un,T,!0),k(Rs,!0);return}k(ht,T,!0),k(Ie,T,!0),k(Ae,""),k(Ye,"local"),k($t,!0),k(ln,"");const G={path:T,type:"local",isNewRepo:l(Ft),isValidPath:!0,scope:l(_n)?.relativePathFromGitRoot};Rt(G),k(Qe,!1)}catch(G){le.error("Failed to select folder",G)}}function Sw(){k(it,!0),dp("new-repo-parent",_.workspace_repoSelector_selectNewRepoParent_title(),l(Et)||void 0)}function va(){if(!l(Et)||!l(fn)||l(ur))return;const T=vt(l(Et),l(fn));k(ht,T,!0),k(Ie,T,!0),k(Ae,""),k($t,!0),k(ln,""),k(_n,null),k(Ye,"new");const G=l(Qr)?.exists&&l(Qr)?.isGitRepo,Te=l(Mi);if(Te){el(T,Te),k(Wt,!1);return}k(Ft,!G),Rt({path:T,type:"local",isNewRepo:!G,isValidPath:!0}),Wn(l(Et)),k(Wt,!1),k(Qe,!1)}async function fp(T){k($r,!1);const G=l(Hs);if(G==="select-repo"){await _w(T);return}G==="new-repo-parent"&&(k(Et,T,!0),Wn(l(Et))),k(it,!1),k(Qe,!0)}function Cw(){k($r,!1),l(Hs)!=="select-repo"&&(k(it,!1),k(Qe,!0))}function md(){const T=Ns(l(Qt));if(!T)return;const G={owner:T.owner,repo:T.repo,url:`https://github.com/${T.owner}/${T.repo}`},Te=`${G.owner}/${G.repo}`,Ht={path:Te,type:"github",githubUrl:G.url,isNewRepo:!1,isValidPath:!0};k(ht,Te),k(Ie,G.url,!0),k(Ae,G.url,!0),k(Ye,"github"),k($t,!0),k(ln,""),Rt(Ht),k(Qe,!1)}function Mw(){if(!l(un))return;k(ht,l(un),!0),k(Ie,l(un),!0),k(Ae,""),k(Ye,"local"),k(Ft,!0),k($t,!0),k(ln,"");const T={path:l(un),type:"local",isNewRepo:!0,isValidPath:!0};Rt(T),k(Rs,!1),k(un,""),k(Qe,!1)}function el(T,G){k(ht,T,!0),k(Ie,T,!0),k(Ae,""),k(Ye,G==="new"?"new":"local",!0),k(Ft,!1),k($t,!0),k(ln,""),k(_n,null),Rt({path:T,type:"local",isNewRepo:!1,isValidPath:!0,plainFolder:G}),k(Rs,!1),k(un,""),k(Qe,!1)}function Tw(T,G){const Te=G==="local"&&l(Rs)?l(un):"";ge()?.onCheckedChange(T,G),Te&&!T&&el(Te,"existing")}function Ew(){k(Rs,!1),k(un,""),k(Er,null),k(_n,null),k(Ie,""),k(He,"")}function Aw(){if(!l(ht))return _.workspace_repoSelector_selectRepository_label();if(l(Ye)==="github"&&l(Ae)){const G=Ns(l(Ae));if(G)return`${G.owner}/${G.repo}`}if(l(ht).match(/^[^\/]+\/[^\/]+$/)&&!l(ht).includes("\\")&&!l(ht).startsWith("/"))return l(ht);const T=l(ht).split(/[\/\\]/);return T[T.length-1]||l(ht)}const vd=w(()=>jt()?Ve()??Be()?.selectedProjectPath??"":Ve()??Aw()),dc=w(()=>jt()?!!l(vd):!!l(ht)),bd=`${t}-github-suggestions`,hp=w(()=>jt()&&Be()?.authenticated&&Be().scopeKey&&Be().page.status!=="unavailable"&&Be().selectedProject?.projectPath===Be().selectedProjectPath?Be().selectedProject:void 0),pp=w(()=>jt()?null:Nx({selectedValue:l(ht),selectedRepoType:l(Ye),confirmedGithubUrl:l(Ae)},Ns)),yd=w(()=>l(ri).find(dr)),wd=w(()=>l(yd)?ll(l(yd),Be()?.instanceBaseUrl):null);function gp(T){if(!(T?.provider!=="gitlab"||!Be()?.authenticated||!Be().scopeKey||T.instanceBaseUrl!==Be().instanceBaseUrl||Be().page.status!=="ready"))return(Be().page.items.find(G=>G.projectPath===T.projectPath)??(Be().selectedProject?.projectPath===T.projectPath?Be().selectedProject:void 0))?.ownerAvatarUrl}var Rw={focusInput:an,openOnLocalTab:Gt,openOnSessionsTab:ut,get variant(){return Vt()},set variant(T="ghost"){Vt(T),b()},get value(){return nt()},set value(T=""){nt(T),b()},get onchange(){return Pe()},set onchange(T){Pe(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 Ve()},set displayValue(T){Ve(T),b()},get triggerSuffix(){return Mt()},set triggerSuffix(T){Mt(T),b()},get triggerValueClass(){return ie()},set triggerValueClass(T="text-subtle"){ie(T),b()},get triggerContentClass(){return $e()},set triggerContentClass(T="gap-0.75"){$e(T),b()},get emptyLabel(){return lt()},set emptyLabel(T){lt(T),b()},get showEmptyIcon(){return yt()},set showEmptyIcon(T=!1){yt(T),b()},get showTriggerChevron(){return mt()},set showTriggerChevron(T=!1){mt(T),b()},get triggerChevronClass(){return Tt()},set triggerChevronClass(T="ml-2 opacity-50"){Tt(T),b()},get triggerIcon(){return We()},set triggerIcon(T){We(T),b()},get triggerAriaLabel(){return Ge()},set triggerAriaLabel(T){Ge(T),b()},get onClear(){return Yt()},set onClear(T){Yt(T),b()},get gitlab(){return Be()},set gitlab(T){Be(T),b()},get gitlabSelected(){return jt()},set gitlabSelected(T=!1){jt(T),b()},get plainFolderMode(){return Yn()},set plainFolderMode(T=!1){Yn(T),b()},get plainFolderSelected(){return Bn()},set plainFolderSelected(T=!1){Bn(T),b()},get gitChoice(){return ge()},set gitChoice(T){ge(T),b()},get sessions(){return ft()},set sessions(T){ft(T),b()},$set:Nt,$on:(T,G)=>Dt(e,T,G)},mp=w$(),xd=ue(mp);{const T=(Te,Ht=Jr,xn=Jr)=>{var si=Ze(),to=ue(si);ss(to,19,Ht,Ds=>Dk(Ds),(Ds,hr,gi)=>{var js=VD();{const xr=mn=>{{let gr=w(()=>l(pr)&&l(hr).type!=="local"?l(pr).projectPath.split("/").at(-1):l(us).primary),Rr=w(()=>l(pr)?.provider),ds=w(()=>l(hr).type==="local"),Gn=w(()=>l(hr).type!=="local"),vi=w(()=>xn()(l(hr),l(gi))),Fr=w(()=>!!we()),Hr=w(()=>l(hr).type!=="local"&&l(pr)?.provider==="gitlab"&&(!Be()?.authenticated||l(pr).instanceBaseUrl!==Be().instanceBaseUrl||!Be().scopeKey&&!Be().onSelectRecent||Be().page.status==="unavailable"));rp(mn,{get owner(){return l(Ai)},get name(){return l(gr)},get suffix(){return l(us).suffix},get provider(){return l(Rr)},get avatarUrl(){return l(oi)},get local(){return l(ds)},get showOwner(){return l(Gn)},showForge:!0,recent:!0,get selected(){return l(vi)},get formStyle(){return l(Fr)},class:"flex-1",onclick:()=>cp(l(hr)),get disabled(){return l(Hr)}})}},us=w(()=>zx(l(hr))),pr=w(()=>ll(l(hr),Be()?.instanceBaseUrl)),Ai=w(()=>l(pr)?l(pr).projectPath.split("/").slice(0,-1).join("/"):l(us).ownerPrefix),Ri=w(()=>$x(l(hr))),oi=w(()=>gp(l(pr)));var mi=ne(js);{var No=mn=>{Hu(mn,{get content(){return l(Ri)},delayDuration:300,side:"bottom",class:"flex min-w-0 flex-1",children:(gr,Rr)=>{xr(gr)},$$slots:{default:!0}})},ba=mn=>{xr(mn)};j(mi,mn=>{l(Ri)?mn(No):mn(ba,-1)})}var Ei=A(mi,2);{var no=mn=>{const gr=w(()=>`${l(pr).instanceBaseUrl.replace(/\/$/,"")}/${l(pr).projectPath}`);{let Rr=w(()=>_.browser_embedded_openExternal_tooltip()),ds=w(()=>_.browser_embedded_openExternal_ariaLabel());qe(mn,{variant:"ghost",size:"icon-compact",iconOnly:!0,get href(){return l(gr)},target:"_blank",rel:"noopener noreferrer",get tooltip(){return l(Rr)},get"aria-label"(){return l(ds)},class:"mr-1 shrink-0 text-subtle",onclick:Gn=>{Gn.preventDefault(),Gn.stopPropagation(),oh(l(gr),{event:Gn,forceExternal:!0})},children:(Gn,vi)=>{tt(Gn,{get icon(){return lv},size:12})},$$slots:{default:!0}})}};j(Ei,mn=>{we()&&l(pr)&&mn(no)})}var Do=A(Ei,2);{var ii=mn=>{{let gr=w(()=>_.workspace_repoSelector_removeRecent_ariaLabel({repository:l(hr).path})),Rr=w(()=>_.workspace_repoSelector_removeRecent_tooltip());qe(mn,{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(gr)},get title(){return l(Rr)},onclick:ds=>ei(ds,l(hr)),children:(ds,Gn)=>{tt(ds,{get icon(){return Ki},size:12})},$$slots:{default:!0}})}};j(Do,mn=>{we()||mn(ii)})}Y(js)}L(xr=>at(js,1,`group/recent-repo flex min-w-0 items-center ${we()?"rounded-(--radius-row)":""} ${xr??""}`),[()=>we()&&xn()(l(hr),l(gi))?"bg-selected":""]),x(Ds,js)}),x(Te,si)},G=Te=>{var Ht=Ze(),xn=ue(Ht);{var si=Ds=>{var hr=Ze(),gi=ue(hr);wt(gi,()=>sh,(js,mi)=>{mi(js,{children:(No,ba)=>{var Ei=Ic(),no=ue(Ei);{const ii=(xr,us)=>{qe(xr,gs(()=>(us?.()).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:(Ai,Ri)=>{Pt();var oi=WD(),mn=ue(oi),gr=A(mn);tt(gr,{get icon(){return sa},size:10,class:"absolute right-0 opacity-0 group-hover/forge:opacity-100 group-focus/forge:opacity-100"}),L(()=>H(mn,`${l(yn)??""} `)),x(Ai,oi)},$$slots:{default:!0}}))};wt(no,()=>nh,(xr,us)=>{us(xr,{child:ii,$$slots:{child:!0}})})}var Do=A(no,2);{let ii=w(()=>({to:re()})),xr=w(()=>_.workspace_repoSelector_whichRepo_label());wt(Do,()=>rh,(us,pr)=>{pr(us,{get portalProps(){return l(ii)},get"aria-label"(){return l(xr)},children:(Ai,Ri)=>{var oi=Ze(),mn=ue(oi);{let gr=w(()=>l(Ne)?.id);wt(mn,()=>Kx,(Rr,ds)=>{ds(Rr,{get value(){return l(gr)},onValueChange:Gn=>As(Gn),children:(Gn,vi)=>{var Fr=Ze(),Hr=ue(Fr);ss(Hr,17,()=>l(ot),fs=>fs.id,(fs,Kt)=>{var In=Ze(),Pr=ue(In);{const es=tn=>{tt(tn,{get icon(){return l(Kt).icon},size:12})};wt(Pr,()=>Gx,(tn,Ln)=>{Ln(tn,{get value(){return l(Kt).id},closeOnSelect:!0,leading:es,children:(Ur,Fn)=>{Pt();var kn=zt();L(()=>H(kn,l(Kt).label)),x(Ur,kn)},$$slots:{leading:!0,default:!0}})})}x(fs,In)}),x(Gn,Fr)},$$slots:{default:!0}})})}x(Ai,oi)},$$slots:{default:!0}})})}x(No,Ei)},$$slots:{default:!0}})}),x(Ds,hr)},to=Ds=>{var hr=jD(),gi=se(hr,!0);L(()=>H(gi,l(Ne)?.label??"github.com/")),x(Ds,hr)};j(xn,Ds=>{l(ot).length>1?Ds(si):Ds(to,-1)})}x(Te,Ht)};var Pw=ne(xd);wt(Pw,()=>Wu,(Te,Ht)=>{Ht(Te,{get open(){return l(Qe)},set open(xn){k(Qe,xn,!0)},children:(xn,si)=>{var to=Ic(),Ds=ue(to);{const gi=(js,mi)=>{let No=()=>(mi?.()).props;{let ba=w(()=>!we()),Ei=w(()=>`w-full ${Ce()??""}`),no=w(()=>Ge()??(we()?void 0:`${_.workspace_repoSelector_selectRepository_label()}: ${l(vd)}`)),Do=w(()=>we()&&!Ge()?`${t}-field-label ${t}-field-value`:void 0);qe(js,gs(No,{get variant(){return Vt()},get wrapContent(){return l(ba)},get class(){return l(Ei)},get"aria-label"(){return l(no)},get"aria-labelledby"(){return l(Do)},get ref(){return l(me)},set ref(ii){k(me,ii,!0)},children:(ii,xr)=>{var us=qD(),pr=ne(us);{var Ai=Kt=>{var In=jm(),Pr=se(In,!0);L(()=>{at(In,1,$n(dn.fieldLabel)),st(In,"id",`${t}-field-label`),H(Pr,l(ir))}),x(Kt,In)};j(pr,Kt=>{we()&&Kt(Ai)})}var Ri=A(pr,2);{var oi=Kt=>{var In=KD(),Pr=ue(In);{var es=On=>{{let bi=w(()=>we()?20:16);lf(On,{get providerId(){return l(Yr).provider},get size(){return l(bi)},class:"shrink-0"})}},tn=w(()=>cf(l(Yr).provider)),Ln=On=>{Zo(On,{size:16,class:"shrink-0 text-muted-foreground"})};j(Pr,On=>{l(tn)?On(es):On(Ln,-1)})}var Ur=A(Pr,2),Fn=ne(Ur),kn=se(Fn,!0);Y(Ur),L(On=>{st(Ur,"id",we()?`${t}-field-value`:void 0),at(Fn,1,$n(ie())),H(kn,On)},[()=>l(Yr).title.trim()||_.sessionImport_list_untitled_label()]),x(Kt,In)},mn=Kt=>{tt(Kt,{get icon(){return We()},size:"xs"})},gr=Kt=>{Zo(Kt,{size:12,class:"text-ghost -mb-0.25 mr-1"})};j(Ri,Kt=>{l(Yr)&&!We()?Kt(oi):We()?Kt(mn,1):yt()&&!l(dc)&&Kt(gr,2)})}var Rr=A(Ri,2);{var ds=Kt=>{{let In=w(()=>l(wd)?.projectPath.split("/").slice(0,-1).join("/")||l(pp)||l(hp)?.namespace),Pr=w(()=>l(wd)?.provider??(jt()?"gitlab":l(pp)?"github":void 0)),es=w(()=>gp(l(wd))??l(hp)?.ownerAvatarUrl),tn=w(()=>l(yd)?.type==="local"||!jt()&&l(Ye)!=="github"),Ln=w(()=>we()?20:16);fh(Kt,{get owner(){return l(In)},get provider(){return l(Pr)},get avatarUrl(){return l(es)},get local(){return l(tn)},get size(){return l(Ln)}})}},Gn=Kt=>{Zo(Kt,{size:16,class:"shrink-0 text-muted-foreground"})};j(Rr,Kt=>{!l(Yr)&&!We()&&l(dc)?Kt(ds):!l(Yr)&&!We()&&we()&&!yt()&&Kt(Gn,1)})}var vi=A(Rr,2);{var Fr=Kt=>{var In=GD(),Pr=ne(In);{var es=Fn=>{var kn=Gm(),On=ue(kn),bi=se(On,!0),yi=A(On,2);{var tl=Pi=>{var ro=Km(),nl=se(ro,!0);L(so=>H(nl,so),[()=>_.workspace_repoSelector_new_label()]),x(Pi,ro)};j(yi,Pi=>{l(Ft)&&!Ve()&&!jt()&&Pi(tl)})}L(()=>{at(On,1,$n(ie())),H(bi,l(vd))}),x(Fn,kn)},tn=Fn=>{var kn=jm(),On=se(kn,!0);L(()=>{at(kn,1,$n(ie())),H(On,l(xs))}),x(Fn,kn)};j(Pr,Fn=>{l(dc)?Fn(es):Fn(tn,-1)})}var Ln=A(Pr,2);{var Ur=Fn=>{var kn=Km(),On=se(kn);L(()=>H(On,`(${Mt()??""})`)),x(Fn,kn)};j(Ln,Fn=>{Mt()&&Fn(Ur)})}Y(In),L(()=>st(In,"id",we()?`${t}-field-value`:void 0)),x(Kt,In)};j(vi,Kt=>{!l(Yr)&&!We()&&(l(dc)||l(xs))&&Kt(Fr)})}var Hr=A(vi,2);{var fs=Kt=>{tt(Kt,{get icon(){return sa},size:10,get class(){return Tt()}})};j(Hr,Kt=>{mt()&&Kt(fs)})}Y(us),L(()=>at(us,1,`flex w-full min-w-0 items-center truncate ${$e()}`)),x(ii,us)},$$slots:{default:!0}}))}};wt(Ds,()=>Uu,(js,mi)=>{mi(js,{child:gi,$$slots:{child:!0}})})}var hr=A(Ds,2);{let gi=w(()=>l(ir)??_.workspace_repoSelector_whichRepo_label()),js=w(()=>we()?`${l(Kn)==="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(Kn)==="browse"?"overflow-hidden":"overflow-y-auto"}`:"w-[400px] max-w-[calc(100vw-16px)] min-w-0 max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto flex flex-col"),mi=w(()=>we()?Q.current||l(P)?"bottom":"left":void 0),No=w(()=>we()?Q.current||l(P)?4:24:void 0),ba=w(()=>we()?Q.current||l(P)?"end":"start":void 0),Ei=w(()=>({to:re()})),no=w(()=>re()?"absolute":"fixed");wt(hr,()=>Vu,(Do,ii)=>{ii(Do,{role:"dialog",get"aria-label"(){return l(gi)},get class(){return l(js)},get side(){return l(mi)},get sideOffset(){return l(No)},get align(){return l(ba)},onkeydown:xr=>{we()&&l(Kn)==="browse"&&xr.target instanceof Node&&l(ni)?.contains(xr.target)&&wn(xr),xr.key==="Enter"&&xr.stopPropagation()},get portalProps(){return l(Ei)},get strategy(){return l(no)},portal:!0,children:(xr,us)=>{var pr=Ze(),Ai=ue(pr);{var Ri=mn=>{var gr=QD(),Rr=ue(gr),ds=ne(Rr);{let tn=w(()=>`${t}-form-repos`);rs(ds,{variant:"search",type:"text",role:"searchbox","data-repo-search":!0,"data-testid":"repo-form-search",get value(){return l(Us)},oninput:Ln=>k(Us,Ln.currentTarget.value,!0),onkeydown:qt,get placeholder(){return l(wr)},get"aria-label"(){return l(wr)},get"aria-controls"(){return l(tn)},get ref(){return l(ws)},set ref(Ln){k(ws,Ln,!0)}})}Y(Rr);var Gn=A(Rr,2),vi=ne(Gn);{var Fr=tn=>{var Ln=XD();ss(Ln,20,()=>[1,2,3],Nc,(Ur,Fn)=>{var kn=JD();x(Ur,kn)}),Y(Ln),x(tn,Ln)},Hr=tn=>{var Ln=YD(),Ur=se(Ln,!0);L(Fn=>H(Ur,Fn),[()=>_.hud_filter_noRepositories_label()]),x(tn,Ln)},fs=tn=>{T(tn,()=>l(zr),()=>Ln=>dr(Ln))};j(vi,tn=>{l(xt)&&l(ri).length===0?tn(Fr):l(zr).length===0?tn(Hr,1):tn(fs,-1)})}Y(Gn),sr(Gn,tn=>k(ni,tn),()=>l(ni));var Kt=A(Gn,2),In=ne(Kt);qe(In,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-add",get class(){return`${dn.row} w-full`},onclick:or,children:(tn,Ln)=>{var Ur=qm(),Fn=ue(Ur);tt(Fn,{get icon(){return Gc},class:"size-4 shrink-0"});var kn=A(Fn,2),On=se(kn,!0);L(()=>H(On,l(Br))),x(tn,Ur)},$$slots:{default:!0}});var Pr=A(In,2);{var es=tn=>{qe(tn,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-import-session",get class(){return`${dn.row} w-full`},onclick:R,children:(Ln,Ur)=>{var Fn=qm(),kn=ue(Fn);tt(kn,{get icon(){return pv},class:"size-4 shrink-0"});var On=A(kn,2),bi=se(On,!0);L(yi=>H(bi,yi),[()=>_.sessionImport_picker_none_label()]),x(Ln,Fn)},$$slots:{default:!0}})};j(Pr,tn=>{l(Si)&&tn(es)})}Y(Kt),L(tn=>{st(Gn,"id",`${t}-form-repos`),st(Gn,"aria-label",tn)},[()=>_.workspace_repoSelector_recent_label()]),x(mn,gr)},oi=mn=>{var gr=Ic(),Rr=ue(gr);{var ds=Fr=>{var Hr=ZD(),fs=ne(Hr);{let Pr=w(()=>_.ui_navButtons_goBack_tooltip());qe(fs,{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:Is,children:(es,tn)=>{tt(es,{get icon(){return cx},class:"size-3.5!"})},$$slots:{default:!0}})}var Kt=A(fs,2),In=se(Kt,!0);Y(Hr),L(()=>{at(Kt,1,`${dn.title} min-w-0 truncate`),H(In,l(Br))}),x(Fr,Hr)},Gn=Fr=>{var Hr=e$(),fs=ne(Hr),Kt=se(fs,!0),In=A(fs,2),Pr=se(In,!0);Y(Hr),L((es,tn)=>{H(Kt,es),H(Pr,tn)},[()=>_.workspace_repoSelector_whichRepo_label(),()=>_.workspace_repoSelector_whichRepo_description()]),x(Fr,Hr)};j(Rr,Fr=>{we()?Fr(ds):Fr(Gn,-1)})}var vi=A(Rr,2);{let Fr=w(()=>l(Zt)?"repository":l(Ut)),Hr=w(()=>we()?"shrink-0":"min-h-0");wt(vi,()=>Jk,(fs,Kt)=>{Kt(fs,{get value(){return l(Fr)},onValueChange:Vs,get class(){return`flex flex-col ${l(Hr)??""}`},children:(In,Pr)=>{var es=y$(),tn=ue(es);{let kn=w(()=>_.workspace_repoSelector_whichRepo_label());wt(tn,()=>Xk,(On,bi)=>{bi(On,{get"aria-label"(){return l(kn)},class:"flex shrink-0 gap-0 mx-3 mb-3 bg-sidebar rounded-lg p-1",children:(yi,tl)=>{var Pi=Ic(),ro=ue(Pi);{var nl=io=>{var Ii=Ze(),ya=ue(Ii);{let rl=w(()=>l(Zt)?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");wt(ya,()=>Hp,(sl,il)=>{il(sl,{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(rl)??""}`},children:(ol,fc)=>{Pt();var al=zt();L($o=>H(al,$o),[()=>_.workspace_repoSelector_clone_tab()]),x(ol,al)},$$slots:{default:!0}})})}x(io,Ii)};j(ro,io=>{l(cn)&&io(nl)})}var so=A(ro,2);ss(so,1,()=>[{id:"local",label:_.workspace_repoSelector_existingFolder_tab()},{id:"new",label:_.workspace_repoSelector_new_tab()},...l(Si)?[{id:"sessions",label:_.sessionImport_tab_label()}]:[],...D()?[{id:"remote",label:_.workspace_repoSelector_remoteServer_tab()}]:[]],Nc,(io,Ii)=>{var ya=Ze(),rl=ue(ya);{let sl=w(()=>l(Ut)===l(Ii).id?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");wt(rl,()=>Hp,(il,ol)=>{ol(il,{get value(){return l(Ii).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(sl)??""}`},children:(fc,al)=>{Pt();var $o=zt();L(()=>H($o,l(Ii).label)),x(fc,$o)},$$slots:{default:!0}})})}x(io,ya)}),x(yi,Pi)},$$slots:{default:!0}})})}var Ln=A(tn,2);{var Ur=kn=>{qe(kn,{type:"button",variant:"link",size:"sm",class:"mx-3 -mt-1 mb-2 h-auto self-start p-0 text-xs",onclick:Pn,children:(On,bi)=>{Pt();var yi=zt();L(tl=>H(yi,tl),[()=>_.workspace_repoSelector_connectForgeToClone_label()]),x(On,yi)},$$slots:{default:!0}})};j(Ln,kn=>{!l(cn)&&s()&&kn(Ur)})}var Fn=A(Ln,2);{let kn=w(()=>l(Zt)?"repository":l(Ut));wt(Fn,()=>Nv,(On,bi)=>{bi(On,{get value(){return l(kn)},class:"mt-0 min-h-0 flex flex-col",children:(yi,tl)=>{var Pi=b$(),ro=ue(Pi);{var nl=pn=>{{let Nn=w(()=>l(Yr)?Cv(l(Yr)):"");gw(pn,{class:"h-80 max-h-[min(320px,calc(100dvh-14rem))]",get knownRepos(){return l(Zi)},get selectedKey(){return l(Nn)},onselect:xe,onclose:()=>k(Qe,!1)})}};j(ro,pn=>{l(Ut)==="sessions"&&l(Si)&&pn(nl)})}var so=A(ro,2);let io;var Ii=ne(so);{var ya=pn=>{const Nn=w(()=>l(Ut)),mr=w(()=>l(Nn)==="new"?"new":l(Rs)&&l(un)?"folder":ge().folder??null);{let ar=w(()=>l(mr)==="git-repo"?ge().worktree!==!1:ge().checked);hw(pn,{class:"mb-3 px-1",get folder(){return l(mr)},get checked(){return l(ar)},get disabled(){return ge().disabled},onCheckedChange:lr=>Tw(lr,l(Nn))})}};j(Ii,pn=>{ge()&&(l(Ut)==="local"||l(Ut)==="new")&&pn(ya)})}var rl=A(Ii,2);{var sl=pn=>{{let Nn=w(()=>!we()),mr=w(()=>!!we());dw(pn,gs(Be,{get scrollable(){return l(Nn)},get formStyle(){return l(mr)},get prefix(){return G},onSelect:(ar,lr)=>{Zr++,Be()?.onSelect(ar,lr),k(Qe,!1)}}))}},il=pn=>{qe(pn,{type:"button",class:"w-full flex items-center justify-between px-3 py-2.5 rounded-lg border-0 text-left cursor-pointer",onclick:kw,children:(Nn,mr)=>{var ar=Gm(),lr=ue(ar),_s=se(lr,!0),Dn=A(lr,2);tt(Dn,{get icon(){return Qs},class:"text-ghost opacity-50"}),L(hn=>{at(lr,1,`text-sm truncate ${l(Ie)?"text-foreground":"text-muted-foreground"}`),H(_s,hn)},[()=>l(Ie)||_.workspace_repoSelector_selectAFolder_placeholder()]),x(Nn,ar)},$$slots:{default:!0}})},ol=pn=>{var Nn=n$(),mr=ue(Nn);qf(mr,{kind:"repository"});var ar=A(mr,2);qf(ar,{});var lr=A(ar,2),_s=ne(lr);G(_s);var Dn=A(_s,2);{let Mn=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Zn=w(()=>l(zn).length>0?bd:void 0),Ir=w(()=>l(zn).length>0),Vr=w(()=>l(zn)[l(sn)]?`${bd}-${l(sn)}`:void 0);sr(rs(Dn,{placeholder:"owner/repo",type:"text",oninput:er=>gd(er.currentTarget.value),onpaste:vw,onkeydown:Ws,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(Mn)},"aria-autocomplete":"list",get"aria-controls"(){return l(Zn)},get"aria-expanded"(){return l(Ir)},get"aria-activedescendant"(){return l(Vr)},get ref(){return l(pt)},set ref(er){k(pt,er,!0)},get value(){return l(Qt)},set value(er){k(Qt,er,!0)}}),er=>k(Xe,er,!0),()=>l(Xe))}Y(lr);var hn=A(lr,2);{var qn=Mn=>{{let Zn=w(()=>_.workspace_repoSelector_githubSignIn_description());fw(Mn,{class:"mt-2",get message(){return l(Zn)}})}},kr=Mn=>{{let Zn=w(()=>!!we()),Ir=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Vr=w(()=>!l(zn).length&&(O()||!!(l(en)&&ee()))),er=w(()=>l(en)?_.workspace_repoSelector_searchingGithub_label({query:l(en)}):_.gitlabCheckout_loading_label()),Ks=w(()=>_.hud_filter_noRepositories_label()),Bo=w(()=>N()?r()?N():_.workspace_repoSelector_suggestionsUnavailable_label():void 0),oo=w(()=>_.workspace_repoSelector_retrySuggestions_label());sp(Mn,{get formStyle(){return l(Zn)},get id(){return bd},get items(){return l(zn)},getKey:$s=>$s.id,getOwner:$s=>$s.owner,getName:$s=>$s.name,provider:"github",get label(){return l(Ir)},get loading(){return l(Vr)},get loadingLabel(){return l(er)},get emptyLabel(){return l(Ks)},get error(){return l(Bo)},get retryLabel(){return l(oo)},onRetry:fr,onSelect:Ar,get activeIndex(){return l(sn)},set activeIndex($s){k(sn,$s,!0)}})}};j(hn,Mn=>{!l(be)&&s()?Mn(qn):l(be)&&Mn(kr,1)})}var gn=A(hn,2);{var _r=Mn=>{var Zn=t$(),Ir=ne(Zn),Vr=se(Ir),er=A(Ir,2);qe(er,{size:"sm",onclick:md,class:"shrink-0",children:(Ks,Bo)=>{Pt();var oo=zt();L($s=>H(oo,$s),[()=>_.workspace_repoSelector_select_label()]),x(Ks,oo)},$$slots:{default:!0}}),Y(Zn),L(()=>H(Vr,`${l(rn).owner??""}/${l(rn).repo??""}`)),x(Mn,Zn)};j(gn,Mn=>{l(rn)&&!l(Cn)&&Mn(_r)})}x(pn,Nn)},fc=pn=>{var Nn=l$(),mr=ue(Nn);qe(mr,{type:"button",variant:"plain",wrapContent:!1,class:"w-full flex items-center gap-3 mb-2 text-left cursor-pointer",onclick:Sw,children:(gn,_r)=>{var Mn=r$(),Zn=ue(Mn),Ir=se(Zn,!0),Vr=A(Zn,2),er=ne(Vr),Ks=se(er,!0),Bo=A(er,2);tt(Bo,{get icon(){return Qs},class:"text-ghost shrink-0 opacity-50"}),Y(Vr),L((oo,$s)=>{H(Ir,oo),at(Vr,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(Et)?"text-foreground":"text-subtle"} truncate`),H(Ks,$s)},[()=>_.workspace_repoSelector_parentFolder_label(),()=>l(Et)||_.workspace_repoSelector_select_placeholder()]),x(gn,Mn)},$$slots:{default:!0}});var ar=A(mr,2),lr=ne(ar),_s=se(lr,!0),Dn=A(lr,2);rs(Dn,{placeholder:"new-project",type:"text",onkeydown:gn=>{gn.key==="Enter"&&!gn.isComposing&&(gn.preventDefault(),gn.stopPropagation(),va())},class:"bg-sidebar border-none",noFocusStyle:!0,get value(){return l(fn)},set value(gn){k(fn,gn,!0)}}),Y(ar);var hn=A(ar,2);{var qn=gn=>{var _r=s$(),Mn=ne(_r),Zn=se(Mn,!0);Y(_r),L(()=>H(Zn,l(ur))),x(gn,_r)},kr=gn=>{var _r=a$(),Mn=ne(_r),Zn=se(Mn,!0),Ir=A(Mn,2);{var Vr=Lr=>{var Jn=i$(),Wr=ne(Jn);fi(Wr,{size:14});var ai=A(Wr,2),li=se(ai,!0);Y(Jn),L(cr=>H(li,cr),[()=>_.workspace_repoSelector_checking_label()]),x(Lr,Jn)},er=Lr=>{var Jn=Lc(),Wr=ne(Jn),ai=se(Wr,!0),li=A(Wr,2);qe(li,{size:"sm",onclick:va,class:"shrink-0",children:(cr,hc)=>{Pt();var Ss=zt();L(Li=>H(Ss,Li),[()=>_.workspace_repoSelector_select_label()]),x(cr,Ss)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_repoExists_label({isolationLabel:$})]),x(Lr,Jn)},Ks=Lr=>{var Jn=Lc(),Wr=ne(Jn),ai=se(Wr,!0),li=A(Wr,2);qe(li,{size:"sm",onclick:va,class:"shrink-0",children:(cr,hc)=>{Pt();var Ss=zt();L(Li=>H(Ss,Li),[()=>_.workspace_repoSelector_select_label()]),x(cr,Ss)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.onboarding_localRepoTab_plainFolder_description()]),x(Lr,Jn)},Bo=Lr=>{var Jn=Lc(),Wr=ne(Jn),ai=se(Wr,!0),li=A(Wr,2);qe(li,{size:"sm",variant:"primary",onclick:va,class:"shrink-0",children:(cr,hc)=>{Pt();var Ss=zt();L(Li=>H(Ss,Li),[()=>_.workspace_repoSelector_create_label()]),x(cr,Ss)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_newFolderWillBeCreated_label()]),x(Lr,Jn)},oo=Lr=>{var Jn=o$(),Wr=ne(Jn),ai=se(Wr,!0),li=A(Wr,2);qe(li,{size:"sm",variant:"primary",onclick:va,class:"shrink-0",disabled:!0,children:(cr,hc)=>{Pt();var Ss=zt();L(Li=>H(Ss,Li),[()=>_.workspace_repoSelector_create_label()]),x(cr,Ss)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_folderNotGitRepo_label()]),x(Lr,Jn)},$s=Lr=>{var Jn=Lc(),Wr=ne(Jn),ai=se(Wr,!0),li=A(Wr,2);qe(li,{size:"sm",variant:"primary",onclick:va,class:"shrink-0",children:(cr,hc)=>{Pt();var Ss=zt();L(Li=>H(Ss,Li),[()=>_.workspace_repoSelector_create_label()]),x(cr,Ss)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_newRepoWillBeCreated_label()]),x(Lr,Jn)};j(Ir,Lr=>{l(Ti)?Lr(Vr):l(Qr)?.exists&&l(Qr)?.isGitRepo?Lr(er,1):l(Mi)==="existing"?Lr(Ks,2):l(Mi)==="new"?Lr(Bo,3):l(Qr)?.exists&&!l(Qr)?.isGitRepo?Lr(oo,4):Lr($s,-1)})}Y(_r),L(()=>H(Zn,l(ys))),x(gn,_r)};j(hn,gn=>{l(ur)?gn(qn):l(ys)&&gn(kr,1)})}L(gn=>H(_s,gn),[()=>_.workspace_repoSelector_folderName_label()]),x(pn,Nn)},al=pn=>{var Nn=f$(),mr=ne(Nn);ss(mr,17,()=>l(bs),Dn=>Dn.id,(Dn,hn)=>{var qn=c$(),kr=ne(qn);np(kr,{size:14,class:"text-ghost shrink-0"});var gn=A(kr,2),_r=ne(gn),Mn=se(_r,!0),Zn=A(_r,2),Ir=se(Zn,!0);Y(gn);var Vr=A(gn,2);{let er=w(()=>_.workspace_repoSelector_removeSetup_tooltip());qe(Vr,{variant:"ghost",type:"button",size:"icon-compact",iconOnly:!0,onclick:Ks=>{Ks.stopPropagation(),Ks.preventDefault(),Oe(l(hn).id)},class:"ml-1 rounded text-muted-foreground hover:text-danger hover:bg-danger-background/10",get title(){return l(er)},children:(Ks,Bo)=>{tt(Ks,{get icon(){return Ki},size:"xs"})},$$slots:{default:!0}})}Y(qn),L(()=>{H(Mn,l(hn).name),H(Ir,l(hn).transport==="websocket"?l(hn).wsUrl:`${l(hn).username}@${l(hn).host}:${l(hn).port}`)}),qr("click",qn,()=>J(l(hn))),qr("keydown",qn,er=>{(er.key==="Enter"||er.key===" ")&&(er.preventDefault(),J(l(hn)))}),x(Dn,qn)});var ar=A(mr,2);{var lr=Dn=>{var hn=u$(),qn=se(hn,!0);L(kr=>H(qn,kr),[()=>_.workspace_repoSelector_noRemoteSetups_label()]),x(Dn,hn)};j(ar,Dn=>{l(bs).length===0&&Dn(lr)})}var _s=A(ar,2);qe(_s,{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:Ue,children:(Dn,hn)=>{var qn=d$(),kr=ue(qn);tt(kr,{get icon(){return Gc},size:"sm"});var gn=A(kr);L(_r=>H(gn,` ${_r??""}`),[()=>_.workspace_repoSelector_addRemoteSetup_label()]),x(Dn,qn)},$$slots:{default:!0}}),Y(Nn),x(pn,Nn)};j(rl,pn=>{l(Ut)==="gitlab"&&Be()?pn(sl):l(Ut)==="local"?pn(il,1):l(Ut)==="github"?pn(ol,2):l(Ut)==="new"?pn(fc,3):l(Ut)==="remote"&&pn(al,4)})}Y(so);var $o=A(so,2);{var Nw=pn=>{var Nn=h$(),mr=ne(Nn),ar=ne(mr);tt(ar,{get icon(){return Qs},class:"text-ghost shrink-0 mt-0.5"});var lr=A(ar,2),_s=ne(lr),Dn=se(_s,!0),hn=A(_s,2),qn=se(hn,!0),kr=A(hn,2),gn=ne(kr);qe(gn,{size:"sm",variant:"secondary",onclick:Mw,children:(Mn,Zn)=>{Pt();var Ir=zt();L(Vr=>H(Ir,Vr),[()=>_.workspace_repoSelector_initializeGit_label()]),x(Mn,Ir)},$$slots:{default:!0}});var _r=A(gn,2);qe(_r,{size:"sm",variant:"secondary",onclick:Ew,children:(Mn,Zn)=>{Pt();var Ir=zt();L(Vr=>H(Ir,Vr),[()=>_.workspace_repoSelector_chooseDifferentFolder_label()]),x(Mn,Ir)},$$slots:{default:!0}}),Y(kr),Y(lr),Y(mr),Y(Nn),L((Mn,Zn)=>{st(_s,"title",l(un)),H(Dn,Mn),H(qn,Zn)},[()=>l(un).split("/").pop()||l(un),()=>_.workspace_repoSelector_notGitRepository_label()]),x(pn,Nn)};j($o,pn=>{l(Ut)!=="gitlab"&&l(Ut)!=="sessions"&&l(Rs)&&l(un)&&pn(Nw)})}var Dw=A($o,2);{var $w=pn=>{var Nn=v$(),mr=ne(Nn);jx(mr,{size:5,class:"mb-2",children:(Dn,hn)=>{Pt();var qn=zt();L(kr=>H(qn,kr),[()=>_.workspace_repoSelector_recent_label()]),x(Dn,qn)},$$slots:{default:!0}});var ar=A(mr,2);{var lr=Dn=>{var hn=g$();ss(hn,20,()=>[1,2,3],Nc,(qn,kr)=>{var gn=p$();x(qn,gn)}),Y(hn),x(Dn,hn)},_s=Dn=>{var hn=m$(),qn=ne(hn);{let kr=w(()=>l(ti)());T(qn,()=>l(kr),()=>(gn,_r)=>_r===l(Ls))}Y(hn),x(Dn,hn)};j(ar,Dn=>{l(xt)&&l(yr).length===0?Dn(lr):Dn(_s,-1)})}Y(Nn),x(pn,Nn)},Bw=w(()=>!we()&&(l(Ut)==="local"||l(Zt))&&(l(xt)||l(ti)().length>0));j(Dw,pn=>{l(Bw)&&pn($w)})}L(()=>io=at(so,1,"shrink-0 px-3 mb-3",null,io,{hidden:l(Ut)==="sessions"})),x(yi,Pi)},$$slots:{default:!0}})})}x(In,es)},$$slots:{default:!0}})})}x(mn,gr)};j(Ai,mn=>{we()&&l(Kn)==="browse"?mn(Ri):mn(oi,-1)})}x(xr,pr)},$$slots:{default:!0}})})}x(xn,to)},$$slots:{default:!0}})}),Y(xd)}var vp=A(xd,2);{var Iw=T=>{uw(T,{get isOpen(){return l(ma)},onclose:()=>k(ma,!1),onsave:Ct})};j(vp,T=>{D()&&T(Iw)})}var Lw=A(vp,2);Yk(Lw,{get open(){return l($r)},get title(){return l(ga)},get initialPath(){return l(Ci)},selectLabel:"Select folder",onSelect:fp,onClose:Cw}),x(n,mp);var Ow=Lt(Rw);return oe(),Ow}Ro(["click","keydown"]);var x$=B('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),k$=B('<div class="flex items-center rounded-lg bg-sidebar"><!></div>'),_$=B('<span class="mt-1 block"> </span>'),S$=B("<span> </span> <!>",1),Jm=B("<!> <!>",1),C$=B("<div><!> <!></div>"),M$=B("<!> <!> <!>",1),T$=B('<div data-testid="gitlab-picker-list"><!> <!></div>');function mw(n,e){if(new.target)return Ot({component:mw,...n});It(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),m=y(e,"getText",7),v=y(e,"onSelect",7),C=y(e,"row",7),z=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 O={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 m()},set getText(F){m(F),b()},get onSelect(){return v()},set onSelect(F){v(F),b()},get row(){return C()},set row(F){C(F),b()},get compact(){return z()},set compact(F=!1){z(F),b()},$set:Nt,$on:(F,W)=>Dt(e,F,W)},N=T$(),E=ne(N);{var D=F=>{var W=x$(),X=se(W,!0);L(()=>H(X,s())),x(F,W)};j(E,F=>{s()&&!r()&&!z()&&F(D)})}var ee=A(E,2);{var U=F=>{var W=Jm(),X=ue(W);{var le=Q=>{var me=k$(),P=ne(me);Xn(P,r),Y(me),x(Q,me)};j(X,Q=>{r()&&Q(le)})}var re=A(X,2);{const Q=$=>{var ce=S$(),pe=ue(ce),ye=se(pe,!0),Z=A(pe,2);{var ae=V=>{var K=_$(),I=se(K,!0);L(()=>H(I,o().detail)),x(V,K)};j(Z,V=>{o().detail&&V(ae)})}L(()=>H(ye,o().message)),x($,ce)};let me=w(()=>h()?o().actionLabel:void 0),P=w(()=>h()&&o().actionLabel?()=>h()?.(t()):void 0);qx(re,{density:"compact",get retryLabel(){return l(me)},get onRetry(){return l(P)},message:Q,$$slots:{message:!0}})}x(F,W)},oe=F=>{var W=M$(),X=ue(W);{var le=pe=>{{let ye=w(()=>!t());rs(pe,{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"})}},re=pe=>{Zk(pe,{get label(){return a().searchLabel},control:(Z,ae=Jr)=>{var V=C$(),K=ne(V);{var I=ve=>{var de=Ze(),fe=ue(de);Xn(fe,r),x(ve,de)};j(K,ve=>{r()&&ve(I)})}var te=A(K,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);rs(te,gs(ae,{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)}}))}Y(V),L(()=>at(V,1,$n(r()?"flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring":void 0))),x(Z,V)},$$slots:{control:!0}})};j(X,pe=>{z()?pe(le):pe(re,-1)})}var Q=A(X,2);{var me=pe=>{{let ye=w(()=>!i().trim()||o().status==="loading"||o().loadingMore);qe(pe,{type:"button",variant:"secondary",class:"w-full shrink-0",get disabled(){return l(ye)},onclick:()=>u()?.(i(),t()),children:(Z,ae)=>{Pt();var V=zt();L(()=>H(V,d())),x(Z,V)},$$slots:{default:!0}})}};j(Q,pe=>{u()&&d()&&pe(me)})}var P=A(Q,2);{var $=pe=>{Jx(pe,{get label(){return a().loadingLabel},density:"compact"})},ce=pe=>{var ye=Jm(),Z=ue(ye);uh(Z,t,K=>{{const I=fe=>{Yx(fe,{density:"compact",description:be=>{Pt();var q=zt();L(()=>H(q,i()?a().emptySearchLabel:a().emptyLabel)),x(be,q)},$$slots:{description:!0}})};let te=w(()=>p()?[p()]:[]),ve=w(()=>z()?"min-h-0 flex-1":"max-h-56"),de=w(()=>z()?40:void 0);Xx(K,{get items(){return o().items},get getKey(){return g()},get getText(){return m()},selectable:"single",get selectedKeys(){return l(te)},onActivate:fe=>v()(fe,t()),get ariaLabel(){return a().listLabel},get class(){return l(ve)},get rowHeight(){return l(de)},get row(){return C()},empty:I,$$slots:{empty:!0}})}});var ae=A(Z,2);{var V=K=>{qe(K,{type:"button",variant:"ghost",class:"w-full shrink-0",get disabled(){return o().loadingMore},onclick:()=>f()(t()),children:(I,te)=>{Pt();var ve=zt();L(()=>H(ve,o().loadingMore?a().loadingMoreLabel:a().loadMoreLabel)),x(I,ve)},$$slots:{default:!0}})};j(ae,K=>{(o().hasMore||o().loadingMore)&&K(V)})}x(pe,ye)};j(P,pe=>{o().status==="loading"?pe($):pe(ce,-1)})}x(F,W)};j(ee,F=>{o().status==="unavailable"?F(U):F(oe,-1)})}return Y(N),sr(N,F=>k(M,F),()=>l(M)),L(()=>at(N,1,$n(z()?"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,N),Lt(O)}var E$=new Set(["$$slots","$$events","$$legacy","projectPath","selectedBranch","placeholder","protectedLabel","triggerClass","rowLabel","isLoading","showTriggerChevron","triggerChevronClass","onSelect","onOpenChange"]),A$=B("<span> </span>"),R$=B('<!> <span class="sr-only"> </span>',1),P$=B('<span class="flex-1 min-w-0 text-left truncate"> </span>'),I$=B("<span><!> <!> <!></span>"),L$=B('<p class="break-all type-caption text-foreground"> </p>'),O$=B('<span class="type-caption shrink-0 text-muted-foreground"> </span>'),N$=B('<div><!> <span class="min-w-0 flex-1 truncate"> </span> <!> <!></div>'),Xm=B("<!> <!>",1);function jc(n,e){if(new.target)return Ot({component:jc,...n});It(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=Yi(e,E$),g=he(!1);const m=ju(),v=new Ku,C=w(()=>c()||e.page.status==="loading");var z={get projectPath(){return t()},set projectPath(O){t(O),b()},get selectedBranch(){return r()},set selectedBranch(O){r(O),b()},get placeholder(){return s()},set placeholder(O){s(O),b()},get protectedLabel(){return i()},set protectedLabel(O){i(O),b()},get triggerClass(){return o()},set triggerClass(O){o(O),b()},get rowLabel(){return a()},set rowLabel(O){a(O),b()},get isLoading(){return c()},set isLoading(O=!1){c(O),b()},get showTriggerChevron(){return u()},set showTriggerChevron(O=!1){u(O),b()},get triggerChevronClass(){return d()},set triggerChevronClass(O){d(O),b()},get onSelect(){return f()},set onSelect(O){f(O),b()},get onOpenChange(){return h()},set onOpenChange(O){h(O),b()},$set:Nt,$on:(O,N)=>Dt(e,O,N)},M=Ze(),S=ue(M);return wt(S,()=>Wu,(O,N)=>{N(O,{onOpenChange:E=>h()?.(E,e.scopeKey),get open(){return l(g)},set open(E){k(g,E,!0)},children:(E,D)=>{var ee=Xm(),U=ue(ee);{const F=(W,X)=>{let le=()=>(X?.()).props;{let re=w(()=>`min-w-0 max-w-full text-muted-foreground ${o()??""}`),Q=w(()=>!a());qe(W,gs(le,{variant:"ghost",type:"button",get class(){return l(re)},get"aria-busy"(){return l(C)},get wrapContent(){return l(Q)},children:(me,P)=>{var $=I$(),ce=ne($);{var pe=I=>{var te=A$(),ve=se(te,!0);L(()=>{at(te,1,$n(dn.fieldLabel)),H(ve,a())}),x(I,te)};j(ce,I=>{a()&&I(pe)})}var ye=A(ce,2);{var Z=I=>{var te=R$(),ve=ue(te);fi(ve,{size:14,class:"text-ghost"});var de=A(ve,2),fe=se(de,!0);L(()=>H(fe,e.copy.loadingLabel)),x(I,te)},ae=I=>{var te=P$(),ve=se(te,!0);L(()=>H(ve,r()?.name||s())),x(I,te)};j(ye,I=>{!r()&&l(C)?I(Z):I(ae,-1)})}var V=A(ye,2);{var K=I=>{tt(I,{get icon(){return sa},size:10,get class(){return d()}})};j(V,I=>{u()&&!l(C)&&I(K)})}Y($),L(()=>at($,1,`flex w-full min-w-0 items-center truncate ${a()?"gap-2":"gap-0.75"}`)),x(me,$)},$$slots:{default:!0}}))}};wt(U,()=>Uu,(W,X)=>{X(W,{child:F,$$slots:{child:!0}})})}var oe=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"),X=w(()=>a()?v.current?"bottom":"left":void 0),le=w(()=>a()?v.current?4:24:void 0),re=w(()=>a()&&v.current?"end":"start"),Q=w(()=>({to:m()})),me=w(()=>m()?"absolute":"fixed");wt(oe,()=>Vu,(P,$)=>{$(P,{role:"dialog",get"aria-label"(){return l(F)},get class(){return l(W)},get side(){return l(X)},get sideOffset(){return l(le)},get align(){return l(re)},get portalProps(){return l(Q)},get strategy(){return l(me)},onkeydown:ce=>{ce.key==="Enter"&&ce.stopPropagation()},children:(ce,pe)=>{var ye=Xm(),Z=ue(ye);{var ae=K=>{var I=L$(),te=se(I,!0);L(()=>H(te,t())),x(K,I)};j(Z,K=>{a()||K(ae)})}var V=A(Z,2);{const K=(ve,de)=>{let fe=()=>(de?.()).item,ke=()=>(de?.()).selected;var be=Ze(),q=ue(be);{var Me=gt=>{var Le=N$(),De=ne(Le);mo(De,{size:16,get class(){return dn.icon}});var Fe=A(De,2),vt=se(Fe,!0),Vt=A(Fe,2);{var nt=Ce=>{var we=O$(),Ve=se(we,!0);L(()=>H(Ve,i())),x(Ce,we)};j(Vt,Ce=>{fe().protected&&Ce(nt)})}var Pe=A(Vt,2);{let Ce=w(()=>ke()?"checked":"empty");Ev(Pe,{get state(){return l(Ce)},get class(){return dn.check}})}Y(Le),L(()=>{at(Le,1,`flex ${dn.row}`),H(vt,fe().name)}),x(gt,Le)},ze=gt=>{e_(gt,{title:Fe=>{Pt();var vt=zt();L(()=>H(vt,fe().name)),x(Fe,vt)},meta:Fe=>{Pt();var vt=zt();L(()=>H(vt,fe().protected?i():"")),x(Fe,vt)},$$slots:{title:!0,meta:!0}})};j(q,gt=>{a()?gt(Me):gt(ze,-1)})}x(ve,be)};let I=w(()=>!!a()),te=w(()=>r()?.name);mw(V,gs(()=>p,{get compact(){return l(I)},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:K,$$slots:{row:!0}}))}x(ce,ye)},$$slots:{default:!0}})})}x(E,ee)},$$slots:{default:!0}})}),x(n,M),Lt(z)}var D$=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>'),$$=B('<div class="min-w-0"><!></div>'),B$=B('<label class="flex items-center gap-2 py-2 text-sm text-muted-foreground"><!> </label>'),z$=B('<p class="min-w-0 truncate text-sm text-muted-foreground"> </p> <!>',1),Zd=B("<!> <!> <!>",1),F$=B('<div class="relative min-w-0"><!> <!></div>'),ci=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>'),Ym=B('<!> <span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>',1),Oc=B("<!> <!>",1),Qm=B("<!> <!> <!> <!> <!>",1),H$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pr-1"> </span>'),U$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 px-1"> </span>'),V$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pl-1"> </span>'),W$=B('<!> <span class="text-ui text-subtle whitespace-nowrap"> </span>',1),j$=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),K$=B("<div><!></div>");function G$(n,e){if(new.target)return Ot({component:G$,...n});It(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),m=y(e,"onSkipIsolationChange",7),v=y(e,"onGitHubAuthNeededChange",7),C=y(e,"onBranchStatusChange",7),z=y(e,"onBranchesLoaded",7),M=y(e,"presentation",7,"default"),S=y(e,"field",7,"both"),O=y(e,"isLoading",7,!1),N=y(e,"detectedGitHubOwner",7,null),E=y(e,"detectedGitHubRepo",7,null),D=y(e,"plainFolderMode",7,!1),ee=y(e,"plainFolder",7,null),U=y(e,"gitChoice",7),oe=y(e,"sessions",7);const F=w(()=>M()==="metadata"),W=w(()=>M()==="form"),X="\0",le=ge=>ge.split(X).map(ft=>ft.trim()),re=w(()=>le(_.workspace_repoAndBranchPicker_workOnRepo_label({repo:X}))),Q=w(()=>le(_.workspace_repoAndBranchPicker_workOnRepoOffBranch_label({repo:X,branch:X}))),me=w(()=>le(_.workspace_repoAndBranchPicker_repoOffBranch_label({repo:X,branch:X}))),P=w(()=>le(_.workspace_repoAndBranchPicker_cloneRepoAndWorkOffBranch_label({repo:X,branch:X}))),$=w(()=>le(_.workspace_repoAndBranchPicker_workInFolder_label({repo:X}))),ce=w(()=>le((c()?_.workspace_repoAndBranchPicker_workOnRemoteOnBranch_label:_.workspace_repoAndBranchPicker_workOnRemoteOffBranch_label)({repo:X,path:X,branch:X}))),pe=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=dn.metadataTriggerSurface,Z=w(()=>l(F)?`${dn.metadataTrigger} ${ye}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium)"),ae=w(()=>l(F)?`${dn.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=dn.metadataChevron,K="text-foreground font-medium",I="text-muted-foreground",te="main",ve=w(()=>l(F)&&S()==="branch"&&O()),de=w(()=>f()?`${f().username}@${f().host}:${f().workspacePath}`:"");function fe(ge){const ft=ge.split(/[\\/]/).filter(Boolean);return ft[ft.length-1]||ge}function ke(ge){const ft=ge.trim().replace(/^git@github\.com:/,"https://github.com/");try{const Rt=new URL(ft.startsWith("http")?ft:`https://${ft}`);return Rt.hostname!=="github.com"?fe(ge):Rt.pathname.replace(/^\//,"").replace(/\.git$/,"")||fe(ge)}catch{return fe(ge.replace(/\.git$/,""))}}const be=w(()=>s()==="gitlab"?i()?.selectedProjectPath??"":s()==="remote"&&f()?f().name:s()==="github"&&a()?ke(a()):fe(t())),q=w(()=>s()==="gitlab"?o()?.selectedBranch?.name??"":s()==="remote"&&f()&&f().branch||r()||te),Me=w(()=>l(be)?`${l(be)}/${l(q)}`:""),ze=w(()=>s()==="gitlab"?"":s()==="remote"&&f()?f().name:s()==="github"&&a()?a():t()),gt=w(()=>l(F)?l(be):void 0),Le=w(()=>N()&&E()?`${N()}/${E()}`:void 0),De=w(()=>t()||(s()==="remote"&&f()?f().workspacePath:""));function Fe(ge){p()?.(ge)}function vt(ge){g()?.(ge)}const Vt=w(()=>s()==="gitlab"||!!t()||s()==="github"&&!!a()||s()==="remote"&&!!f());let nt=he(void 0);function Pe(){l(nt)?.focusInput?.()}function Ce(ge="local"){l(nt)?.openOnLocalTab?.(ge)}var we={focusInput:Pe,openFolderSelection:Ce,get repoPath(){return t()},set repoPath(ge=""){t(ge),b()},get branch(){return r()},set branch(ge=""){r(ge),b()},get repoType(){return s()},set repoType(ge="local"){s(ge),b()},get gitlab(){return i()},set gitlab(ge){i(ge),b()},get gitlabBranch(){return o()},set gitlabBranch(ge){o(ge),b()},get githubUrl(){return a()},set githubUrl(ge=""){a(ge),b()},get skipIsolation(){return c()},set skipIsolation(ge=!1){c(ge),b()},get isNewRepo(){return u()},set isNewRepo(ge=!1){u(ge),b()},get suggestedBranch(){return d()},set suggestedBranch(ge){d(ge),b()},get remoteSetup(){return f()},set remoteSetup(ge=null){f(ge),b()},get onRemoteSetupChange(){return h()},set onRemoteSetupChange(ge){h(ge),b()},get onRepoChange(){return p()},set onRepoChange(ge){p(ge),b()},get onBranchChange(){return g()},set onBranchChange(ge){g(ge),b()},get onSkipIsolationChange(){return m()},set onSkipIsolationChange(ge){m(ge),b()},get onGitHubAuthNeededChange(){return v()},set onGitHubAuthNeededChange(ge){v(ge),b()},get onBranchStatusChange(){return C()},set onBranchStatusChange(ge){C(ge),b()},get onBranchesLoaded(){return z()},set onBranchesLoaded(ge){z(ge),b()},get presentation(){return M()},set presentation(ge="default"){M(ge),b()},get field(){return S()},set field(ge="both"){S(ge),b()},get isLoading(){return O()},set isLoading(ge=!1){O(ge),b()},get detectedGitHubOwner(){return N()},set detectedGitHubOwner(ge=null){N(ge),b()},get detectedGitHubRepo(){return E()},set detectedGitHubRepo(ge=null){E(ge),b()},get plainFolderMode(){return D()},set plainFolderMode(ge=!1){D(ge),b()},get plainFolder(){return ee()},set plainFolder(ge=null){ee(ge),b()},get gitChoice(){return U()},set gitChoice(ge){U(ge),b()},get sessions(){return oe()},set sessions(ge){oe(ge),b()},$set:Nt,$on:(ge,ft)=>Dt(e,ge,ft)},Ve=K$(),Mt=ne(Ve);{var ie=ge=>{var ft=Zd(),Rt=ue(ft);{let Ie=w(()=>s()==="gitlab"),He=w(()=>!!ee()&&s()==="local"),Xe=w(()=>_.workspace_compactInitializer_repository_label()),pt=w(()=>l(be)||void 0);sr(qs(Rt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},get sessions(){return oe()},variant:"ghost",get gitlabSelected(){return l(Ie)},get plainFolderSelected(){return l(He)},get value(){return l(ze)},onchange:Fe,get rowLabel(){return l(Xe)},get triggerClass(){return dn.fieldTrigger},get displayValue(){return l(pt)},triggerValueClass:"text-foreground",triggerContentClass:"gap-1"}),Qe=>k(nt,Qe,!0),()=>l(nt))}var an=A(Rt,2);{var Gt=Ie=>{var He=$$(),Xe=ne(He);{var pt=it=>{var xt=Ze(),Ft=ue(xt);{var $t=Ye=>{{let ln=w(()=>_.workspace_compactInitializer_branch_label());jc(Ye,gs(o,{get rowLabel(){return l(ln)},get triggerClass(){return dn.fieldTrigger},showTriggerChevron:!1}))}};j(Ft,Ye=>{o()&&Ye($t)})}x(it,xt)},Qe=it=>{var xt=D$(),Ft=ne(xt),$t=se(Ft,!0),Ye=A(Ft,2),ln=se(Ye,!0);Y(xt),L(_n=>{at(Ft,1,$n(dn.fieldLabel)),H($t,_n),H(ln,f().branch||"main")},[()=>_.workspace_compactInitializer_branch_label()]),x(it,xt)},et=it=>{{let xt=w(()=>_.workspace_compactInitializer_branch_label()),Ft=w(()=>!l(Vt));xl(it,{variant:"ghost",get rowLabel(){return l(xt)},get triggerClass(){return dn.fieldTrigger},get value(){return r()},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(Ft)},showUncommittedIndicator:!0,triggerContentClass:"w-full gap-2",onSkipIsolationChange:$t=>m()?.($t),onGitHubAuthNeededChange:$t=>v()?.($t),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}};j(Xe,it=>{s()==="gitlab"?it(pt):s()==="remote"&&f()?it(Qe,1):it(et,-1)})}Y(He),x(Ie,He)};j(an,Ie=>{!u()&&l(Vt)&&!(ee()&&s()==="local")&&Ie(Gt)})}var ut=A(an,2);{var ht=Ie=>{var He=z$(),Xe=ue(He),pt=se(Xe,!0);$l(Xe,(it,xt)=>uf?.(it,xt),()=>l(de));var Qe=A(Xe,2);{var et=it=>{var xt=B$(),Ft=ne(xt);Wp(Ft,{get checked(){return c()},onCheckedChange:Ye=>m()?.(Ye)});var $t=A(Ft);Y(xt),L(Ye=>H($t,` ${Ye??""}`),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),x(it,xt)};j(Qe,it=>{typeof m()=="function"&&it(et)})}L(()=>H(pt,l(de))),x(Ie,He)};j(ut,Ie=>{s()==="remote"&&f()&&Ie(ht)})}x(ge,ft)},$e=ge=>{{let ft=w(()=>s()==="gitlab"),Rt=w(()=>l(F)?K:I),an=w(()=>l(F)?"gap-1.5":"gap-0.75");sr(qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get gitlabSelected(){return l(ft)},get value(){return l(ze)},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(gt)},get triggerValueClass(){return l(Rt)},get triggerContentClass(){return l(an)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}),Gt=>k(nt,Gt,!0),()=>l(nt))}},lt=ge=>{var ft=Ze(),Rt=ue(ft);{var an=Gt=>{jc(Gt,gs(o,{get triggerClass(){return l(ae)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}))};j(Rt,Gt=>{o()&&Gt(an)})}x(ge,ft)},yt=ge=>{var ft=F$(),Rt=ne(ft);{let ut=w(()=>l(F)&&!l(ve)),ht=w(()=>l(F)?`w-full gap-1.5 ${l(ve)?"pr-5":""}`:void 0);xl(Rt,{variant:"ghost",get triggerClass(){return l(ae)},get value(){return l(q)},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,disabled:!1,showUncommittedIndicator:!0,get showTriggerChevron(){return l(ut)},get triggerChevronClass(){return V},get triggerContentClass(){return l(ht)},onSkipIsolationChange:Ie=>m()?.(Ie),onGitHubAuthNeededChange:Ie=>v()?.(Ie),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}var an=A(Rt,2);{var Gt=ut=>{fi(ut,{size:16,class:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-subtle"})};j(an,ut=>{l(ve)&&ut(Gt)})}Y(ft),x(ge,ft)},mt=ge=>{var ft=Zd(),Rt=ue(ft);{var an=Ie=>{var He=ci(),Xe=se(He,!0);L(()=>H(Xe,l(re)[0])),x(Ie,He)};j(Rt,Ie=>{!l(F)&&l(re)[0]&&Ie(an)})}var Gt=A(Rt,2);{let Ie=w(()=>l(F)?K:I),He=w(()=>l(F)?"gap-1.5":"gap-0.75");sr(qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",value:"",onchange:Fe,get triggerClass(){return l(Z)},get triggerValueClass(){return l(Ie)},get triggerContentClass(){return l(He)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}),Xe=>k(nt,Xe,!0),()=>l(nt))}var ut=A(Gt,2);{var ht=Ie=>{var He=ci(),Xe=se(He,!0);L(()=>H(Xe,l(re)[1])),x(Ie,He)};j(ut,Ie=>{!l(F)&&l(re)[1]&&Ie(ht)})}x(ge,ft)},Tt=ge=>{var ft=Zd(),Rt=ue(ft);{var an=Ie=>{var He=Ze(),Xe=ue(He);{var pt=et=>{var it=Ym(),xt=ue(it);tt(xt,{get icon(){return Gc},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var Ft=A(xt,2),$t=se(Ft,!0);L(Ye=>H($t,Ye),[()=>_.workspace_repoAndBranchPicker_createFolder_label()]),x(et,it)},Qe=et=>{var it=ci(),xt=se(it,!0);L(()=>H(xt,l($)[0])),x(et,it)};j(Xe,et=>{ee()==="new"?et(pt):l($)[0]&&et(Qe,1)})}x(Ie,He)};j(Rt,Ie=>{l(F)||Ie(an)})}var Gt=A(Rt,2);{let Ie=w(()=>l(F)?l(be):void 0),He=w(()=>l(F)?K:I),Xe=w(()=>l(F)?"gap-1.5":"gap-0.75");qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Ie)},get triggerValueClass(){return l(He)},get triggerContentClass(){return l(Xe)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=Ie=>{var He=ci(),Xe=se(He,!0);L(()=>H(Xe,l($)[1])),x(Ie,He)};j(ut,Ie=>{!l(F)&&ee()!=="new"&&l($)[1]&&Ie(ht)})}x(ge,ft)},We=ge=>{var ft=Oc(),Rt=ue(ft);{var an=ut=>{var ht=Ym(),Ie=ue(ht);tt(Ie,{get icon(){return Gc},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var He=A(Ie,2),Xe=se(He,!0);L(pt=>H(Xe,pt),[()=>_.workspace_repoAndBranchPicker_createNewRepo_label()]),x(ut,ht)};j(Rt,ut=>{l(F)||ut(an)})}var Gt=A(Rt,2);{let ut=w(()=>l(F)?l(Me):void 0),ht=w(()=>l(F)?K:I),Ie=w(()=>l(F)?"gap-1.5":"gap-0.75");qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(ut)},get triggerValueClass(){return l(ht)},get triggerContentClass(){return l(Ie)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}x(ge,ft)},Ge=ge=>{{let ft=w(()=>s()==="gitlab"),Rt=w(()=>s()==="gitlab"?"":t());qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},get gitlabSelected(){return l(ft)},variant:"ghost",get value(){return l(Rt)},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:K,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})}},Yt=ge=>{var ft=Qm(),Rt=ue(ft);{var an=et=>{var it=Oc(),xt=ue(it);Zo(xt,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var Ft=A(xt,2);{var $t=Ye=>{var ln=ci(),_n=se(ln,!0);L(()=>H(_n,l(P)[0])),x(Ye,ln)};j(Ft,Ye=>{l(P)[0]&&Ye($t)})}x(et,it)};j(Rt,et=>{l(F)||et(an)})}var Gt=A(Rt,2);{let et=w(()=>s()==="gitlab"),it=w(()=>s()==="gitlab"?"":t()),xt=w(()=>l(F)?K:I);qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},get gitlabSelected(){return l(et)},variant:"ghost",get value(){return l(it)},onchange:Fe,get triggerClass(){return l(Z)},get triggerValueClass(){return l(xt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=et=>{var it=ci(),xt=se(it,!0);L(()=>H(xt,l(F)?l(me)[1]:l(P)[1])),x(et,it)};j(ut,et=>{(l(F)?l(me)[1]:l(P)[1])&&et(ht)})}var Ie=A(ut,2);{var He=et=>{var it=Ze(),xt=ue(it);{var Ft=$t=>{jc($t,gs(o,{get triggerClass(){return l(ae)}}))};j(xt,$t=>{o()&&$t(Ft)})}x(et,it)},Xe=et=>{{let it=w(()=>t()||""),xt=w(()=>!t()),Ft=w(()=>l(F)?"w-full gap-1.5":void 0);xl(et,{variant:"ghost",get triggerClass(){return l(ae)},get value(){return r()},get repoPath(){return l(it)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(xt)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V},get triggerContentClass(){return l(Ft)},onSkipIsolationChange:$t=>m()?.($t),onGitHubAuthNeededChange:$t=>v()?.($t),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}};j(Ie,et=>{s()==="gitlab"?et(He):et(Xe,-1)})}var pt=A(Ie,2);{var Qe=et=>{var it=ci(),xt=se(it,!0);L(()=>H(xt,l(F)?l(me)[2]:l(P)[2])),x(et,it)};j(pt,et=>{(l(F)?l(me)[2]:l(P)[2])&&et(Qe)})}x(ge,ft)},Be=ge=>{qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return f().name},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:K,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})},jt=ge=>{var ft=j$(),Rt=ue(ft);{var an=Ye=>{var ln=Oc(),_n=ue(ln);np(_n,{size:16,class:"text-ghost ml-0.75 -mb-px mr-2 shrink-0"});var yr=A(_n,2);{var ei=rn=>{var Er=ci(),cs=se(Er,!0);L(()=>H(cs,l(ce)[0])),x(rn,Er)};j(yr,rn=>{l(ce)[0]&&rn(ei)})}x(Ye,ln)};j(Rt,Ye=>{l(F)||Ye(an)})}var Gt=A(Rt,2);{let Ye=w(()=>l(F)?K:I);qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return f().name},onchange:Fe,get triggerClass(){return l(Z)},get triggerValueClass(){return l(Ye)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=Ye=>{var ln=H$(),_n=se(ln,!0);L(()=>H(_n,l(ce)[1])),x(Ye,ln)};j(ut,Ye=>{l(ce)[1]&&Ye(ht)})}var Ie=A(ut,2),He=se(Ie,!0);$l(Ie,(Ye,ln)=>uf?.(Ye,ln),()=>l(de));var Xe=A(Ie,2);{var pt=Ye=>{var ln=U$(),_n=se(ln,!0);L(()=>H(_n,l(ce)[2])),x(Ye,ln)};j(Xe,Ye=>{l(ce)[2]&&Ye(pt)})}var Qe=A(Xe,2),et=se(Qe,!0),it=A(Qe,2);{var xt=Ye=>{var ln=V$(),_n=se(ln,!0);L(()=>H(_n,l(ce)[3])),x(Ye,ln)};j(it,Ye=>{l(ce)[3]&&Ye(xt)})}var Ft=A(it,2);{var $t=Ye=>{qe(Ye,{variant:"ghost",type:"button",onclick:()=>m()?.(!c()),class:"flex items-center gap-1.5 ml-3 shrink-0 cursor-pointer",children:(ln,_n)=>{var yr=W$(),ei=ue(yr);Wp(ei,{get checked(){return c()},class:"-mb-0.5",onCheckedChange:cs=>m()?.(cs)});var rn=A(ei,2),Er=se(rn,!0);L(cs=>H(Er,cs),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),x(ln,yr)},$$slots:{default:!0}})};j(Ft,Ye=>{typeof m()=="function"&&Ye($t)})}L(()=>{H(He,l(de)),H(et,f().branch||"main")}),x(ge,ft)},Yn=ge=>{qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:K,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})},Bn=ge=>{var ft=Qm(),Rt=ue(ft);{var an=pt=>{var Qe=Oc(),et=ue(Qe);Zo(et,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var it=A(et,2);{var xt=Ft=>{var $t=ci(),Ye=se($t,!0);L(()=>H(Ye,l(Q)[0])),x(Ft,$t)};j(it,Ft=>{l(Q)[0]&&Ft(xt)})}x(pt,Qe)};j(Rt,pt=>{l(F)||pt(an)})}var Gt=A(Rt,2);{let pt=w(()=>l(F)?K:I);qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get triggerSuffix(){return l(Le)},get triggerValueClass(){return l(pt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=pt=>{var Qe=ci(),et=se(Qe,!0);L(()=>H(et,l(Q)[1])),x(pt,Qe)};j(ut,pt=>{l(Q)[1]&&pt(ht)})}var Ie=A(ut,2);{let pt=w(()=>t()||""),Qe=w(()=>!t()),et=w(()=>l(F)?"w-full gap-1.5":void 0);xl(Ie,{variant:"ghost",get triggerClass(){return l(ae)},get value(){return r()},get repoPath(){return l(pt)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(Qe)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V},get triggerContentClass(){return l(et)},onSkipIsolationChange:it=>m()?.(it),onGitHubAuthNeededChange:it=>v()?.(it),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}var He=A(Ie,2);{var Xe=pt=>{var Qe=ci(),et=se(Qe,!0);L(()=>H(et,l(Q)[2])),x(pt,Qe)};j(He,pt=>{l(Q)[2]&&pt(Xe)})}x(ge,ft)};j(Mt,ge=>{l(W)?ge(ie):S()==="repo"?ge($e,1):S()==="branch"&&s()==="gitlab"?ge(lt,2):S()==="branch"?ge(yt,3):l(Vt)?ee()&&s()==="local"?ge(Tt,5):u()?ge(We,6):(s()==="github"&&a()||s()==="gitlab")&&l(F)?ge(Ge,7):s()==="github"&&a()||s()==="gitlab"?ge(Yt,8):s()==="remote"&&f()&&l(F)?ge(Be,9):s()==="remote"&&f()?ge(jt,10):l(F)?ge(Yn,11):ge(Bn,-1):ge(mt,4)})}return Y(Ve),L(()=>at(Ve,1,$n(l(W)?"grid min-w-0 gap-1":l(pe)))),x(n,Ve),Lt(we)}const q$=/^[\w.-]+\/[\w.-]+$/;function Zm(n){return n.replace(/[\\/]+$/,"")||n.slice(0,1)}function ev(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 yB(n){switch(n.type){case"github":{const e=n.githubUrl&&ev(n.githubUrl)||(n.path&&q$.test(n.path.trim())?ev(n.path):null);return e?`github:${e}`:null}case"local":{const e=n.path?.trim();return e?`local:${Zm(e)}`:null}case"remote":{const e=n.remote?.host?.trim().toLowerCase(),t=(n.remote?.workspacePath||n.path)?.trim();return e&&t?`remote:${e}:${Zm(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 wB(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:",tv=";base64,";function J$(n){if(!n.startsWith(ef))return null;const e=n.indexOf(tv,ef.length);if(e===-1)return null;const t=n.slice(ef.length,e),r=n.slice(e+tv.length);return!t.startsWith("image/")||r.length===0?null:{mimeType:t,data:r}}const nv=fa("image-context-items");let X$=0;const xB=30*1024*1024,kB=10*1024*1024;function Y$(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 Q$(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 _B(n,e){const{maxBytes:t,readFile:r=Q$,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=J$(c);if(!u)throw new Error("Invalid data URL format");const{mimeType:d,data:f}=u,h=Date.now(),p=a.name||Fx(d,`image-${h}`);i.push({id:`file-upload-${h}-${++X$}-${p}`,type:"file",label:p,description:`${d} • ${Y$(a.size)}`,path:p,file:a,imageData:f,imageMimeType:d,...gv(d)?{}:{placementFileName:p}})}catch(c){if(s?.aborted)return[];nv.error("Failed to add image to context",{fileName:a.name,error:c}),Cs.error(_.chat_richInput_addImageFailed_error({name:a.name}))}}return s?.aborted?[]:(i.length>0&&nv.debug(`Added ${i.length} image(s) to context`),o.length>0&&Cs.error(_.chat_richInput_filesTooLarge_error({names:o.join(", ")})),i)}var Z$=B('<img class="w-full h-full object-cover"/>'),e3=B('<div class="flex size-full items-center justify-center bg-muted text-subtle"><!></div>'),t3=B("<div><!> <!></div> <!>",1),n3=B('<span class="tabular-nums opacity-70 shrink-0" data-testid="attachment-upload-progress"> </span>'),r3=B("<!> <!>",1),s3=B('<div class="w-4 h-4 rounded overflow-hidden shrink-0"><img class="w-full h-full object-cover"/></div>'),i3=B('<div><!> <span class="font-medium truncate max-w-30"> </span> <!> <!></div>');function o3(n,e){if(new.target)return Ot({component:o3,...n});It(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),m=y(e,"placementProgress",7,void 0),v=y(e,"placementError",7,void 0),C=y(e,"onRetry",7),z=he(null);const M=w(()=>gv(c()||s()||o()?.type));let S=he(null);const O=w(()=>l(M)?a()&&c()?`data:${Md(c())};base64,${a()}`:l(S):null);ct(()=>{if(l(M)&&!(a()&&c())&&o()){const $=URL.createObjectURL(o());return k(S,$,!0),()=>URL.revokeObjectURL($)}k(S,null)});const N=w(()=>{if(s()==="folder")return Qs;const $=Md(s()||c()||o()?.type);return $.startsWith("image")?Kc:$.includes("javascript")||$.includes("typescript")||$.includes("json")?of:$.includes("text")||$.includes("markdown")?th:Wo}),E=w(()=>Md(s()||c()||o()?.type).startsWith("image")),D=w(()=>{if(g()!=="failed")return;const $=_.chat_attachmentPreview_placementFailed_tooltip({name:r()});return v()?`${$} — ${v()}`:$}),ee=w(()=>{if(g()!=="placing"||m()===void 0)return;const $=Math.max(0,Math.min(1,m()));return iv($,{style:"percent",maximumFractionDigits:0})});let U=he(!1),oe=he(null);function F(){f()==="thumbnail"&&l(E)&&l(O)&&k(U,!0)}function W($){($.key==="Enter"||$.key===" ")&&($.preventDefault(),F())}function X($){$.stopPropagation(),u()?.(t())}var le={get id(){return t()},set id($){t($),b()},get name(){return r()},set name($){r($),b()},get type(){return s()},set type($=""){s($),b()},get size(){return i()},set size($){i($),b()},get file(){return o()},set file($){o($),b()},get imageData(){return a()},set imageData($){a($),b()},get imageMimeType(){return c()},set imageMimeType($){c($),b()},get onRemove(){return u()},set onRemove($){u($),b()},get class(){return d()},set class($=""){d($),b()},get variant(){return f()},set variant($="chip"){f($),b()},get thumbnailClass(){return h()},set thumbnailClass($="w-16 h-16"){h($),b()},get disabled(){return p()},set disabled($=!1){p($),b()},get placementStatus(){return g()},set placementStatus($=void 0){g($),b()},get placementProgress(){return m()},set placementProgress($=void 0){m($),b()},get placementError(){return v()},set placementError($=void 0){v($),b()},get onRetry(){return C()},set onRetry($){C($),b()},$set:Nt,$on:($,ce)=>Dt(e,$,ce)},re=Ze(),Q=ue(re);{var me=$=>{var ce=t3(),pe=ue(ce),ye=ne(pe);{let K=w(()=>_.chat_attachmentPreview_viewFullSize_ariaLabel({name:r()})),I=w(()=>p()||!l(O));qe(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(K)},get title(){return r()},get disabled(){return l(I)},get ref(){return l(oe)},set ref(te){k(oe,te,!0)},children:(te,ve)=>{var de=Ze(),fe=ue(de);{var ke=q=>{var Me=Z$();L(()=>{st(Me,"src",l(O)),st(Me,"alt",r())}),To("error",Me,()=>k(z,l(O),!0)),tf(Me),x(q,Me)},be=q=>{var Me=e3(),ze=ne(Me);tt(ze,{get icon(){return Kc},size:"15"}),Y(Me),x(q,Me)};j(fe,q=>{l(O)?q(ke):q(be,-1)})}x(te,de)},$$slots:{default:!0}})}var Z=A(ye,2);{var ae=K=>{{let I=w(()=>_.chat_attachmentPreview_remove_ariaLabel({name:r()}));qe(K,{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:X,get"aria-label"(){return l(I)},children:(te,ve)=>{tt(te,{get icon(){return Ki},size:"10"})},$$slots:{default:!0}})}};j(Z,K=>{u()&&K(ae)})}Y(pe);var V=A(pe,2);{let K=w(()=>l(O)??"");Kv(V,{get imageUrl(){return l(K)},get imageName(){return r()},get openerElement(){return l(oe)},get open(){return l(U)},set open(I){k(U,I,!0)}})}L(()=>at(pe,1,`relative group shrink-0 ${d()??""}`)),Ms(1,pe,()=>rf,()=>({tier:"moderate",y:0,scale:.9})),Ms(2,pe,()=>sf,()=>({tier:"fast"})),x($,ce)},P=$=>{var ce=i3(),pe=ne(ce);{var ye=ke=>{var be=r3(),q=ue(be);fi(q,{size:15,class:"opacity-50 shrink-0"});var Me=A(q,2);{var ze=gt=>{var Le=n3(),De=se(Le,!0);L(()=>H(De,l(ee))),x(gt,Le)};j(Me,gt=>{l(ee)!==void 0&&gt(ze)})}x(ke,be)},Z=ke=>{tt(ke,{get icon(){return ov},size:"15",class:"shrink-0"})},ae=ke=>{var be=s3(),q=se(be);L(()=>{st(q,"src",l(O)),st(q,"alt",r())}),To("error",q,()=>k(z,l(O),!0)),tf(q),x(ke,be)},V=ke=>{tt(ke,{get icon(){return l(N)},size:"15",class:"opacity-30 shrink-0"})};j(pe,ke=>{g()==="placing"?ke(ye):g()==="failed"?ke(Z,1):l(E)&&l(O)&&l(z)!==l(O)?ke(ae,2):ke(V,-1)})}var K=A(pe,2),I=se(K,!0),te=A(K,2);{var ve=ke=>{{let be=w(()=>_.chat_attachmentPreview_retryPlacement_ariaLabel({name:r()}));qe(ke,{variant:"ghost-light",size:"icon-xs",class:"shrink-0 -my-1",onclick:q=>{q.stopPropagation(),C()(t())},get"aria-label"(){return l(be)},"data-testid":"attachment-retry",children:(q,Me)=>{tt(q,{get icon(){return Zf},size:"10"})},$$slots:{default:!0}})}};j(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"),q=w(()=>_.chat_attachmentPreview_removeAttachment_ariaLabel());qe(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(q)},children:(Me,ze)=>{tt(Me,{get icon(){return Ki},size:"10"})},$$slots:{default:!0}})}};j(de,ke=>{u()&&ke(fe)})}Y(ce),L(()=>{at(ce,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()??""}`),st(ce,"data-placement-status",g()),st(ce,"title",l(D)),H(I,r())}),Ms(1,ce,()=>rf,()=>({tier:"moderate",y:0,scale:.9})),Ms(2,ce,()=>sf,()=>({tier:"fast"})),x($,ce)};j(Q,$=>{f()==="thumbnail"&&l(E)&&l(M)&&(!l(O)||l(z)!==l(O))?$(me):$(P,-1)})}return x(n,re),Lt(le)}export{ZO as $,Bv as A,xl as B,nR as C,ha as D,FA as E,_e as F,mo as G,qf as H,kB as I,Vn as J,G$ as K,fh as L,pa as M,G0 as N,EC as O,NS as P,rS as Q,xB as R,Jt as S,je as T,gB as U,oN as V,ep as W,Nv as X,RP as Y,PP as Z,Je as _,o3 as a,RI as a$,dh as a0,Mb as a1,Yc as a2,Gv as a3,jv as a4,yB as a5,fB as a6,Q3 as a7,vn as a8,UL as a9,Y3 as aA,oB as aB,Ty as aC,cN as aD,Hv as aE,bn as aF,J$ as aG,Gu as aH,Ma as aI,tB as aJ,nB as aK,bD as aL,sB as aM,ED as aN,TD as aO,MD as aP,xD as aQ,_D as aR,SD as aS,kD as aT,rB as aU,bB as aV,IS as aW,vD as aX,vB as aY,wB as aZ,LI as a_,lB as aa,hB as ab,eB as ac,dB as ad,cB as ae,iB as af,VT as ag,Fv as ah,Y$ as ai,X3 as aj,G_ as ak,jp as al,Y_ as am,Xc as an,dt as ao,CO as ap,ca as aq,Z3 as ar,$h as as,Bh as at,mB as au,_B as av,pB as aw,uB as ax,vL as ay,lw as az,iR as b,dI as b0,fI as b1,oS as b2,pf as b3,$c as b4,J3 as b5,Wa as b6,sL as c,Gf as d,YL as e,Or as f,on as g,aw as h,jn as i,fw as j,Dv as k,hh as l,Wv as m,Kv as n,gw as o,hw as p,ac as q,ph as r,qv as s,Ov as t,br as u,bt as v,VA as w,fd as x,HI as y,Tn as z};
174
+ `,textSerializers:mt(R)}).replace(/\u00A0/g," ")}function We(R){return Tt(R,R.state.doc.content.size)}function Ke(R){return Tt(R,R.state.selection.from)}function Qt(R,xe){const Ee=We(R),ot=QO(Ee,Ke(R).length);(!ot||ot.from!==l(Pe)?.from)&&(k(Ce,null),k(we,null)),k(Pe,ot,!0),ot&&xe?.dismissNewContext&&k(Ce,l(lt),!0)}function Be(){k(we,l(Pe)?.from??null,!0)}function jt(R){R.preventDefault()}function Yn(R){if(!l(q)||!l(Pe))return;const xe=We(l(q)),Ee=Ke(l(q)).length,ot={from:l(q).state.selection.from-l(Pe).query.length-1,to:l(q).state.selection.from+l(Pe).to-Ee},Ne=l(Pe).to===xe.length||!/^\s/u.test(xe.slice(l(Pe).to)),_e=[{type:"skillCommand",attrs:{name:R.name}},...Ne?[{type:"text",text:" "}]:[]];l(q).chain().focus().insertContentAt(ot,_e).setTextSelection(ot.from+2).run()}function Bn(R){const xe=DO(R,W().map(Ee=>Ee.name));return $()?fL(xe,$()):xe}function ge(R){if(!l(yt)||!l(Ve))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(Ve).onKeyDown({event:R})?!0:R.key==="Enter"?(R.preventDefault(),!0):!1}function ft(){l(q)&&l(q).view&&l(q).chain().focus().insertContent("@").run()}function Rt(R){return l(q)&&l(q).view?(l(q).chain().focus().insertContent(R).run(),!0):!1}function ln(){if(h())return!1;if(l(q)&&l(q).view)try{if(l(q).view.hasFocus())return!0;const R=l(q),xe=document.activeElement;return requestAnimationFrame(()=>{if(l(q)!==R||R.isDestroyed||h()||R.view.hasFocus())return;const Ee=document.activeElement;Ee!==xe&&Ee instanceof HTMLElement&&Sv(Ee)&&!R.view.dom.contains(Ee)||(R.view.focus(),R.commands.scrollIntoView())}),typeof l(q).view.hasFocus=="function"?l(q).view.hasFocus():!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focus:",R)}return!1}function Gt(){if(h())return!1;if(l(q)&&l(q).view)try{return l(q).chain().focus("end").run(),!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focusEnd:",R)}return!1}function ut(){if(h())return!1;if(l(q)&&l(q).view)try{return l(q).chain().focus().selectAll().run(),!0}catch(R){s.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",R)}return!1}function ht(){try{return l(q)?.getHTML?.()??""}catch(R){return s.error("[TipTapEditor] Error getting HTML:",R),l(q)?.getText?.()??""}}function Ie(){l(q)&&(Vt=!0,l(q).commands.clearContent(!0),Vt=!1)}async function He(R){if(!l(q))return;const xe=Bn(R||"");cu(xe,l(q).schema).eq(l(q).state.doc)||l(q).chain().command(({tr:Ee})=>(Ee.setMeta("external-update",!0),!0)).setContent(xe).run()}function Xe(R,xe){l(q)&&l(q).view&&l(q).chain().focus().setImage({src:R,alt:xe||""}).createParagraphNear().focus().run()}function pt(){if(!l(q))return s.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const R=[];return l(q).state.doc.descendants(xe=>{if(xe.type.name==="image"){const Ee=xe.attrs.src;Ee&&Ee.startsWith("data:")&&R.push({src:Ee,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 Qe(){return Ma(l(q))}function et(R){if(s.debug("TipTapEditor: insertContextMention called",{hasEditor:!!l(q),hasEditorView:!!l(q)?.view,attrs:{itemType:R.itemType,identifier:R.identifier,title:R.title}}),l(q)&&l(q).view){const xe=l(q).chain().focus().insertContextMention(R).run();return s.debug("TipTapEditor: insertContextMention result",{result:xe}),xe}return s.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function it(R){if(!l(q)||!l(q).view)return s.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return l(q).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 xt(){if(!l(q))return s.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const R=[];return l(q).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 Ft(){if(!l(q))return s.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const R=[];return l(q).state.doc.descendants(xe=>{if(xe.type.name==="contextMention"){const Ee=xe.attrs;R.push({itemType:Ee.itemType,provider:Ee.provider,title:Ee.title,url:Ee.url,identifier:Ee.identifier,contextId:Ee.contextId,description:Ee.description,metadata:Ee.metadata})}return!0}),s.debug("TipTapEditor: Extracted context mentions",{mentionCount:R.length}),R}const $t={char:"@",pluginKey:new Vn("mention"),items:async({query:R})=>{if(s.debug("Mention query:",R),D()?.(R),!m()&&v()){s.debug("No workspace but repoPath available, using async search:",v());const Ee={workspaceId:void 0,repoPath:v(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const ot=await i.search(R,Ee);return s.debug("Mention search results from repoPath:",ot.length),ot}catch(ot){s.error("Failed to search mentions with repoPath:",ot);const Ne=i.searchSync(R,Ee);return s.debug("Fallback sync search results:",Ne.length),Ne}}if(!m())return s.debug("No workspace and no repoPath - returning empty results"),[];const xe={workspaceId:m().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Ee=await i.search(R,xe);return s.debug("Mention search results:",Ee.length),Ee}catch(Ee){return s.error("Failed to search mentions:",Ee),[]}},render:()=>VL(ve),command:({editor:R,range:xe,props:Ee})=>{const ot={id:Ee.id,label:Ee.label,type:Ee.type,uri:Ee.uri,meta:Ee.meta||{}};R.view&&R.chain().focus().deleteRange(xe).insertContent({type:"mention",attrs:ot}).run(),ee()?.(Ee)}};Fu(()=>{let R=!1;return(async()=>{const xe=Bn(o()||"");if(R)return;const Ee=l(be);if(!Ee)return;k(q,new HA({element:Ee,extensions:[...$()?[uL.configure({references:()=>$()??[]}),dL]:[],fI.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}),ow({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:Ne=>/^https?:\/\//.test(Ne)||Ne.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),hI.configure({placeholder:u()?({editor:Ne})=>vo.getState(Ne.state)?.parts.length?"":c():c(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),OI.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),UI.configure({workspaceId:m()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:$t,renderHTML({node:Ne}){const _e=Uv(Ne.attrs,m()?.id,aS);return["span",{"data-mention":"true","data-type":Ne.attrs.type||"file","data-uri":Ne.attrs.uri||"","data-meta":JSON.stringify(Ne.attrs.meta||{}),"data-id":Ne.attrs.id,"data-label":Ne.attrs.label,class:"mention-chip",tabindex:"0"},_e]},renderText:({node:Ne})=>{const _e=Ne.attrs||{};try{return s1({type:_e.type,id:_e.id,label:_e.label,meta:_e.meta})}catch{return`@${_e?.meta?.fullPath||_e?.meta?.path||_e?.label||_e?.id||"item"}`}}}),iL.extend({renderText:({node:Ne})=>{const _e=Ne.attrs||{},Xt=JSON.stringify({provider:_e.provider||"browser",identifier:_e.identifier||"",title:_e.title||"",url:_e.url||"",description:_e.description||"",metadata:_e.metadata||"",itemType:_e.itemType||""});return`@context[${btoa(unescape(encodeURIComponent(Xt)))}]`}}),cL,vL,WO],content:xe,editable:l(fe),enableCoreExtensions:{delete:!1},onCreate:({editor:Ne})=>{Qt(Ne),C()&&requestAnimationFrame(()=>{if(Ne.isDestroyed)return;Ne.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:Ne})=>{Ne.docChanged&&Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)},onUpdate:({editor:Ne,transaction:_e})=>{if(_e.getMeta("external-update")||_e.getMeta(np)||Vt)return;const Xt=K()?mL(_e):null;Xt&&K()?.(Xt);const yn=Ma(Ne);Qt(Ne,{dismissNewContext:_e.getMeta("uiEvent")==="paste"}),_e.getMeta(hd)?z()?.(yn,{programmatic:!0}):z()?.(yn)},onSelectionUpdate:({editor:Ne,transaction:_e})=>{Qt(Ne,{dismissNewContext:_e.getMeta("uiEvent")==="paste"});const{from:Xt,to:yn,empty:Ge}=Ne.state.selection;if(Ge)U()?.(null);else{const en=Ne.state.doc.textBetween(Xt,yn," ");U()?.(en.trim()||null)}},onFocus:({editor:Ne})=>{Xs(()=>{k(nt,!0),Qt(Ne)})},onBlur:()=>{Xs(()=>{k(nt,!1)})},editorProps:{handleDOMEvents:{compositionstart:()=>(Xs(()=>{k(Me,!0)}),ae()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!l(q)||l(q).isDestroyed||(Xs(()=>{k(Me,!1)}),ae()?.(!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:(Ne,_e)=>{if(yL(_e))return!0;const Xt=_e.clipboardData?.getData("text/plain");if(Xt){const yn=Xt.split(`
175
+ `);if(yn.length>=5){const{state:en,dispatch:Pn}=Ne,En=en.schema.nodes.pasteChip.create({content:Xt,lineCount:yn.length}),$r=en.tr.replaceSelectionWith(En).setMeta("uiEvent","paste");return Pn($r),!0}const Ge=_e.clipboardData?.getData("text/html");if(Ge&&zO(Ge,Xt))return Ne.dispatch(Ne.state.tr.insertText(Xt).scrollIntoView().setMeta("uiEvent","paste")),!0;if(/\r|\n/.test(Xt)){const{state:en,dispatch:Pn}=Ne,En=$O(en.schema,Xt);if(En.length>0){const $r=new je(Se.from(En),1,1);return Pn(en.tr.replaceSelection($r).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(Ne,_e)=>bL(_e),handleKeyDown:(Ne,_e)=>{if(Ne.composing||_e.isComposing||_e.keyCode===229)return!1;if(ge(_e))return!0;if(_e.key==="Escape"&&O())return _e.preventDefault(),O()(),!0;const Xt=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),yn=Ge=>h_(_e,Xc(Ge),Xt);if(yn("chat.mention-context")&&Xc("chat.mention-context")!=="@")return _e.preventDefault(),l(q)?.chain().focus().insertContent("@").run(),!0;if(Xt&&_e.ctrlKey&&!_e.metaKey){if(_e.key==="a"){_e.preventDefault();const{state:Ge,dispatch:en}=Ne,En=Ge.selection.$head.start();return en(Ge.tr.setSelection(Je.create(Ge.doc,En))),!0}if(_e.key==="e"){_e.preventDefault();const{state:Ge,dispatch:en}=Ne,En=Ge.selection.$head.end();return en(Ge.tr.setSelection(Je.create(Ge.doc,En))),!0}if(_e.key==="k"){_e.preventDefault();const{state:Ge,dispatch:en}=Ne,Pn=Ge.selection.$head,En=Pn.pos,$r=Pn.end();return En<$r&&en(Ge.tr.delete(En,$r)),!0}if(_e.key==="p"){_e.preventDefault();const Ge=window.getSelection();return Ge&&Ge.rangeCount>0&&Ge.modify("move","backward","line"),!0}if(_e.key==="n"){_e.preventDefault();const Ge=window.getSelection();return Ge&&Ge.rangeCount>0&&Ge.modify("move","forward","line"),!0}if(_e.key==="f"){_e.preventDefault();const Ge=window.getSelection();return Ge&&Ge.rangeCount>0&&Ge.modify("move","forward","character"),!0}if(_e.key==="b"){_e.preventDefault();const Ge=window.getSelection();return Ge&&Ge.rangeCount>0&&Ge.modify("move","backward","character"),!0}}if(_e.metaKey&&!_e.ctrlKey&&!_e.altKey){if(_e.key==="ArrowLeft"){_e.preventDefault();const Ge=window.getSelection();return Ge&&Ge.rangeCount>0&&Ge.modify(_e.shiftKey?"extend":"move","backward","lineboundary"),!0}if(_e.key==="ArrowRight"){_e.preventDefault();const Ge=window.getSelection();return Ge&&Ge.rangeCount>0&&Ge.modify(_e.shiftKey?"extend":"move","forward","lineboundary"),!0}if(_e.key==="ArrowUp"){_e.preventDefault();const{state:Ge,dispatch:en}=Ne,Pn=1;if(_e.shiftKey){const{from:En}=Ge.selection;en(Ge.tr.setSelection(Je.create(Ge.doc,Pn,En)))}else en(Ge.tr.setSelection(Je.create(Ge.doc,Pn)));return!0}if(_e.key==="ArrowDown"){_e.preventDefault();const{state:Ge,dispatch:en}=Ne,Pn=Ge.doc.content.size-1;if(_e.shiftKey){const{to:En}=Ge.selection;en(Ge.tr.setSelection(Je.create(Ge.doc,En,Pn)))}else en(Ge.tr.setSelection(Je.create(Ge.doc,Pn)));return!0}}if(yn("chat.force-send"))return _e.preventDefault(),S()?.(),!0;if(yn("chat.new-line"))return _e.preventDefault(),l(q)?.chain().setHardBreak().scrollIntoView().run(),!0;if(_e.key==="ArrowUp"&&N()&&!_e.shiftKey&&!_e.metaKey&&!_e.ctrlKey){if($t.pluginKey.getState(Ne.state)?.active)return!1;const{state:en}=Ne,{from:Pn}=en.selection,En=Pn<=1,$r=en.doc.textContent.length===0;if(En||$r){const Br=N()();if(Br!==null)return _e.preventDefault(),l(q)?.chain().setContent(Bn(Br)).focus("end").run(),z()?.(Br),!0}}if(_e.key==="ArrowDown"&&E()&&!_e.shiftKey&&!_e.metaKey&&!_e.ctrlKey){if($t.pluginKey.getState(Ne.state)?.active)return!1;const{state:en}=Ne,{to:Pn}=en.selection,En=en.doc.content.size-1,$r=Pn>=En,Br=en.doc.textContent.length===0;if($r||Br){const Hs=E()();if(Hs!==null)return _e.preventDefault(),l(q)?.chain().setContent(Bn(Hs)).focus("end").run(),z()?.(Hs),!0}}return yn("chat.send")?$t.pluginKey.getState(Ne.state)?.active?!1:M()?(_e.preventDefault(),M()(),!0):!1:!1}}}),!0),Ee.addEventListener("mouseover",Ye),Ee.addEventListener("mouseout",cn),Ee.addEventListener("click",yr),l(q).view.dom.addEventListener("keydown",ei)})(),()=>{R=!0}});function Ye(R){const xe=R.target,Ee=Lp(xe);if(Ee){const ot=xe.getBoundingClientRect();if(!De){De=document.createElement("div"),(ve?.target()??document.body).appendChild(De);const Ne=Ee.type||"file",_e=Ee.label||xe.textContent||"",Xt={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};Le=xl(ew,{target:De,props:{mention:{id:Ee.id,type:Ne,label:_e,uri:Ee.uri,meta:Ee.meta,icon:Xt[Ne]||"📄"},position:{x:ot.left,y:ot.bottom+5},onClose:()=>{Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)}}});const yn=De.firstElementChild;yn instanceof HTMLElement&&(Fe=ve?.register(yn,vt)),De.addEventListener("mouseout",_n)}}}function cn(R){const xe=R.target;R.relatedTarget?.closest(".mention-hover-preview")||xe.hasAttribute("data-mention")&&Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)}function _n(R){R.relatedTarget?.closest("[data-mention]")||Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove(),Le=null,De=null)}async function yr(R){const xe=Lp(R.target);if(xe&&xe.type!=="member"){if(xe.intentUrl){R.preventDefault(),R.stopPropagation();const{handleIntentLink:Ee}=await gs(async()=>{const{handleIntentLink:ot}=await import("./CnXKtYEY.js");return{handleIntentLink:ot}},__vite__mapDeps([57,1,2,44,3,4,22,7,8,9,45,46,23,0,5,6,10,21,47,26,48,12,13,14,15,16,49,20,50,51,52,19,24,25,55,33]),import.meta.url);await Ee(xe.intentUrl);return}if(xe.type==="note"&&xe.note){if(R.preventDefault(),R.stopPropagation(),xe.note.workspaceId){const{handleIntentLink:Ee}=await gs(async()=>{const{handleIntentLink:ot}=await import("./CnXKtYEY.js");return{handleIntentLink:ot}},__vite__mapDeps([57,1,2,44,3,4,22,7,8,9,45,46,23,0,5,6,10,21,47,26,48,12,13,14,15,16,49,20,50,51,52,19,24,25,55,33]),import.meta.url);await Ee(i1(xe.note.id,xe.note.workspaceId))}else{const{navigateToNote:Ee}=await gs(async()=>{const{navigateToNote:ot}=await import("./CTmPV4px.js").then(Ne=>Ne.h);return{navigateToNote:ot}},__vite__mapDeps([58,28,2,59,60,39,19,6,4,1,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26,33,56,61]),import.meta.url);await Ee(xe.note.id)}return}if(xe.type==="file"&&xe.filePath){R.preventDefault(),R.stopPropagation();const{navigateToFile:Ee}=await gs(async()=>{const{navigateToFile:ot}=await import("./CTmPV4px.js").then(Ne=>Ne.h);return{navigateToFile:ot}},__vite__mapDeps([58,28,2,59,60,39,19,6,4,1,12,13,14,15,8,16,3,20,21,22,7,9,23,24,0,5,10,25,26,33,56,61]),import.meta.url);await Ee(xe.filePath);return}}}function ei(R){if(!R.metaKey||R.ctrlKey||R.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(R.key)||!l(q))return;const{state:xe,dispatch:Ee}=l(q).view;if(R.key==="ArrowLeft"){R.preventDefault(),R.stopPropagation();const ot=window.getSelection();ot&&ot.rangeCount>0&&ot.modify(R.shiftKey?"extend":"move","backward","lineboundary")}else if(R.key==="ArrowRight"){R.preventDefault(),R.stopPropagation();const ot=window.getSelection();ot&&ot.rangeCount>0&&ot.modify(R.shiftKey?"extend":"move","forward","lineboundary")}else if(R.key==="ArrowUp"){R.preventDefault(),R.stopPropagation();const ot=1;if(R.shiftKey){const{from:Ne}=xe.selection;Ee(xe.tr.setSelection(Je.create(xe.doc,ot,Ne)).scrollIntoView())}else Ee(xe.tr.setSelection(Je.create(xe.doc,ot)).scrollIntoView())}else if(R.key==="ArrowDown"){R.preventDefault(),R.stopPropagation();const ot=xe.doc.content.size-1;if(R.shiftKey){const{to:Ne}=xe.selection;Ee(xe.tr.setSelection(Je.create(xe.doc,Ne,ot)).scrollIntoView())}else Ee(xe.tr.setSelection(Je.create(xe.doc,ot)).scrollIntoView())}}tc(()=>{l(q)&&(l(q).view.dom.removeEventListener("keydown",ei),l(q).destroy()),l(be)&&(l(be).removeEventListener("mouseover",Ye),l(be).removeEventListener("mouseout",cn),l(be).removeEventListener("click",yr)),De&&De.removeEventListener("mouseout",_n),Le&&De&&(uo(Le),Fe?.(),Fe=void 0,De.remove())});let sn=0;ct(()=>{if(!l(q))return;const R=Ma(l(q));if(o()===R)return;if(l(q).view.hasFocus()){sn+=1;return}const xe=l(q).view.hasFocus(),{from:Ee}=l(q).state.selection,ot=++sn;(async()=>{const Ne=Bn(o()||"");!l(q)||ot!==sn||Ma(l(q))===R&&l(q).chain().command(({tr:_e})=>(_e.setMeta("external-update",!0),!0)).setContent(Ne).command(({tr:_e,state:Xt})=>{if(xe)try{const yn=Xt.doc.content.size,Ge=Math.min(Ee,yn);_e.setSelection(Je.create(Xt.doc,Ge,Ge))}catch{}return!0}).run()})()}),ct(()=>{l(q)&&l(q).setEditable(l(fe),!1)}),ct(()=>{!l(q)||l(q).isDestroyed||l(q).view.dispatch(l(q).state.tr.setMeta(yl,F()))}),ct(()=>{const R=l(q)?.view.dom;R&&(R.setAttribute("aria-haspopup","listbox"),l(yt)&&l(ie)?(R.setAttribute("aria-controls",Mt),R.setAttribute("aria-activedescendant",l(ie))):(R.removeAttribute("aria-controls"),R.removeAttribute("aria-activedescendant")))});var Er={flushScreenEvidence:gt,insertAtSymbol:ft,insertText:Rt,focus:ln,focusEnd:Gt,focusAndSelectAll:ut,getHTML:ht,clear:Ie,setContent:He,insertImage:Xe,getInlineImages:pt,getTextContent:Qe,insertContextMention:et,insertMention:it,getMentions:xt,getContextMentions:Ft,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 m()},set workspace(R){m(R),b()},get repoPath(){return v()},set repoPath(R){v(R),b()},get autoFocus(){return C()},set autoFocus(R=!1){C(R),b()},get onUpdate(){return z()},set onUpdate(R){z(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 O()},set onEscape(R){O(R),b()},get onHistoryPrev(){return N()},set onHistoryPrev(R){N(R),b()},get onHistoryNext(){return E()},set onHistoryNext(R){E(R),b()},get onMentionStart(){return D()},set onMentionStart(R){D(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 oe()},set contextItems(R=[]){oe(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 X()},set skillsLoading(R=!1){X(R),b()},get skillsError(){return le()},set skillsError(R=null){le(R),b()},get onSkillsRetry(){return re()},set onSkillsRetry(R){re(R),b()},get slashEmptyLabel(){return Q()},set slashEmptyLabel(R){Q(R),b()},get slashNotice(){return me()},set slashNotice(R){me(R),b()},get unavailableSkillTitle(){return P()},set unavailableSkillTitle(R){P(R),b()},get screenReferences(){return $()},set screenReferences(R){$(R),b()},get screenInsertions(){return ce()},set screenInsertions(R=[]){ce(R),b()},get screenInterim(){return pe()},set screenInterim(R=[]){pe(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 ae()},set onCompositionChange(R){ae(R),b()},get onUserTextInput(){return V()},set onUserTextInput(R){V(R),b()},get onScreenReferencesEdited(){return K()},set onScreenReferencesEdited(R){K(R),b()},get minHeight(){return I()},set minHeight(R=80){I(R),b()},get maxHeight(){return te()},set maxHeight(R=300){te(R),b()},$set:Nt,$on:(R,xe)=>Dt(e,R,xe)},us=tN(),Ut=ne(us),qa=()=>l(yt),Si=R=>!R&&Be();wt(Ut,()=>Gk,(R,xe)=>{xe(R,{get open(){return qa()},set open(Ee){Si(Ee)},children:(Ee,ot)=>{var Ne=Ze(),_e=ue(Ne);{let Xt=w(()=>ve?.target());wt(_e,()=>kv,(yn,Ge)=>{Ge(yn,{get to(){return l(Xt)},children:(en,Pn)=>{var En=Ze(),$r=ue(En);{let Br=w(()=>l(be)??null);wt($r,()=>Kk,(Hs,pa)=>{pa(Hs,{get customAnchor(){return l(Br)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:jt,onCloseAutoFocus:jt,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return l(de)},set ref(Ci){k(de,Ci,!0)},children:(Ci,lc)=>{sr(aw(Ci,{get listboxId(){return Mt},get items(){return l($e)},get loading(){return X()},get error(){return le()},get emptyLabel(){return Q()},get notice(){return me()},get onRetry(){return re()},onSelect:Yn,onDismiss:Be,onActiveOptionChange:ys=>k(ie,ys,!0)}),ys=>k(Ve,ys,!0),()=>l(Ve))},$$slots:{default:!0}})})}x(en,En)},$$slots:{default:!0}})})}x(Ee,Ne)},$$slots:{default:!0}})});var Qr=A(Ut,2);let Zi;return sr(Qr,R=>k(be,R),()=>l(be)),Y(us),L(()=>{Zi=at(Qr,1,`tiptap-container ${p()??""}`,"svelte-bv9i3d",Zi,{"placeholder-suppressed":l(ke)}),Gi(Qr,`--tt-min-height:${I()}px;--tt-max-height:${te()}px`)}),x(n,us),Lt(Er)}class lw extends Error{constructor(t){super(t);rt(this,"reason");this.name="EnhancePromptUnavailableError",this.reason=t}}function fB(n){return n instanceof lw&&n.reason.trim()?{description:n.reason}:void 0}function rN(n){return"available"in n&&n.available===!1}function hB(n){return n==="auggie"}function sN(n,e,{model:t,workspaceId:r}){return{prompt:n,mode:e,...t?{model:t}:{},...r?{workspaceId:r}:{}}}async function pB(n,e={}){const t=await vv("agent.enhancePrompt",sN(n,"enhance",e));if(rN(t))throw new lw(t.reason);return t}var iN=B('<span class="block truncate text-xs text-subtle" data-testid="start-on-locked-reason"> </span>'),oN=B('<span> </span> <span><span class="block truncate"> </span> <!></span> <!>',1),aN=B("<!> <!>",1),lN=B('<div data-testid="start-on-picker"><!></div>');function cN(n,e){const t=Ji();if(new.target)return Ot({component:cN,...n});It(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=ju(),p=new Ku;let g=he(!1),m=he(null),v=he(null);const C=w(()=>i().find(D=>D.id===s())??i()[0]),z=w(()=>i().map(D=>({value:`machine:${D.id}`,label:D.label,description:D.reason??D.hint??D.platform??void 0,disabled:D.disabled,data:D}))),M=w(()=>i().some(D=>D.kind==="cloud")),S=w(()=>l(M)?440:360);ct(()=>{if(u())return ua(D=>{D.isComposing||u(!1)})});var O={get presentation(){return r()},set presentation(D="form"){r(D),b()},get value(){return s()},set value(D){s(D),b()},get options(){return i()},set options(D){i(D),b()},get onChange(){return o()},set onChange(D){o(D),b()},get lockedReason(){return a()},set lockedReason(D){a(D),b()},get label(){return c()},set label(D=_.workspace_initialAgentPicker_startOn_label()){c(D),b()},get open(){return u()},set open(D=!1){u(D),b()},$set:Nt,$on:(D,ee)=>Dt(e,D,ee)},N=lN(),E=ne(N);return wt(E,()=>Wu,(D,ee)=>{ee(D,{onOpenChange:U=>{U&&k(g,!ch(l(m),l(S)))},get open(){return u()},set open(U){u(U)},children:(U,oe)=>{var F=aN(),W=ue(F);{const le=(re,Q)=>{let me=()=>(Q?.()).props;{let P=w(()=>r()==="metadata"?"plain":"ghost"),$=w(()=>r()==="metadata"?void 0:"sm"),ce=w(()=>!!a()),pe=w(()=>r()==="footer"?"h-9 min-w-0 max-w-36 gap-1 px-2 text-sm font-medium":r()==="metadata"?`${dn.bareTrigger} w-full`:dn.fieldTrigger);qe(re,ms(me,{get variant(){return l(P)},get size(){return l($)},type:"button",wrapContent:!1,get disabled(){return l(ce)},get"aria-labelledby"(){return`${d} ${f}`},get class(){return l(pe)},get ref(){return l(m)},set ref(ye){k(m,ye,!0)},children:(ye,Z)=>{var ae=oN(),V=ue(ae),K=se(V,!0),I=A(V,2),te=ne(I),ve=se(te,!0),de=A(te,2);{var fe=q=>{var Me=iN(),ze=se(Me,!0);L(()=>H(ze,a())),x(q,Me)};j(de,q=>{a()&&q(fe)})}Y(I);var ke=A(I,2);{var be=q=>{tt(q,{get icon(){return ra},get class(){return dn.bareChevron}})};j(ke,q=>{r()==="metadata"&&!a()&&q(be)})}L(()=>{at(V,1,$n(r()==="form"?dn.fieldLabel:r()==="metadata"?"shrink-0 text-muted-foreground":"sr-only")),st(V,"id",d),H(K,c()),at(I,1,$n(r()==="metadata"?dn.bareValue:"min-w-0 flex-1 text-left")),st(I,"id",f),H(ve,l(C)?.label)}),x(ye,ae)},$$slots:{default:!0}}))}};wt(W,()=>Uu,(re,Q)=>{Q(re,{child:le,$$slots:{child:!0}})})}var X=A(W,2);{let le=w(()=>({to:h()})),re=w(()=>r()==="footer"?"top":r()==="metadata"||p.current||l(g)?"bottom":"left"),Q=w(()=>r()==="metadata"?"start":r()==="footer"||p.current||l(g)?"end":"start"),me=w(()=>r()!=="form"||p.current||l(g)?4:24),P=w(()=>h()?"absolute":"fixed"),$=w(()=>l(M)?"w-110":"w-90");wt(X,()=>Vu,(ce,pe)=>{pe(ce,{role:"dialog",get portalProps(){return l(le)},get"aria-label"(){return c()},get side(){return l(re)},get align(){return l(Q)},get sideOffset(){return l(me)},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($)??""}`},style:"max-height: min(440px, var(--bits-popover-content-available-height, calc(100dvh - 1rem)))",onOpenAutoFocus:ye=>{ye.preventDefault(),l(v)?.focus()},onCloseAutoFocus:ye=>{ye.preventDefault(),l(m)?.focus()},onkeydown:ye=>{ye.key==="Enter"&&ye.stopPropagation()},children:(ye,Z)=>{{const ae=(te,ve=Xr)=>{{let de=w(()=>ve().data.kind==="cloud"?sx:ix);tt(te,{get icon(){return l(de)},get class(){return dn.icon}})}};let V=w(()=>l(C)?`machine:${l(C).id}`:void 0),K=w(()=>_.workspace_initialAgentPicker_searchMachines_placeholder()),I=w(()=>_.workspace_initialAgentPicker_searchMachines_placeholder());lh(ye,{get value(){return l(V)},get options(){return l(z)},get open(){return u()},get ariaLabel(){return c()},get placeholder(){return l(K)},get searchPlaceholder(){return l(I)},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 dn.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(v)},set inputRef(te){k(v,te,!0)},optionIcon:ae,$$slots:{optionIcon:!0}})}},$$slots:{default:!0}})})}x(U,F)},$$slots:{default:!0}})}),Y(N),L(()=>at(N,1,$n(r()==="footer"?"min-w-0":"w-full min-w-0"))),x(n,N),Lt(O)}function cw(n,{availability:e,enabledProviders:t,profiles:r}){return kk(n)&&!_k(r,n)?!1:d_(e,Sk(n))&&!Ev({...t},n)}function gB(n,e){return e.availability?n.filter(t=>cw(t.id,e)).map(t=>({id:t.id})):[]}function mB({activeProviderId:n,defaultProviderId:e,availableProviders:t,...r}){const s=n||e;return!Ev({...r.enabledProviders},s)&&(!r.availability||cw(s,r))?s:t[0]?.id??""}function vB({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 uN=da("SpecialistDefaultPreviews");var ec,Da;class bB{constructor(){ao(this,ec,he(Sr({})));ao(this,Da,0)}get byProvider(){return l(ns(this,ec))}set byProvider(e){k(ns(this,ec),e,!0)}invalidate(){xp(this,Da,ns(this,Da)+1),this.byProvider={}}load(e){if(!e||e in this.byProvider)return;const t=ns(this,Da);(async()=>{try{const r=await Ho.specialists.list(e);if(t!==ns(this,Da)||r.length===0)return;const s={};for(const i of r)s[i.id]=i;this.byProvider={...this.byProvider,[e]:s}}catch(r){uN.debug("Failed to fetch resolved-model previews:",{provider:e,error:r})}})()}}ec=new WeakMap,Da=new WeakMap;function Wa(n){const e=n.replace(/\\/g,"/");return e.length>1?e.replace(/\/+$/,""):e}function dN(n,e){const t=Wa(n),r=Wa(e);return!t||!r?!1:t===r||t.startsWith(r==="/"?"/":`${r}/`)}function fN(n,e){let t=null;for(const r of e)r.type!=="local"||!r.path||dN(n,r.path)&&(!t||Wa(r.path).length>Wa(t.path).length)&&(t=r);return t}function yB(n,e){const t=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),r=Wa(n);return t?r.endsWith(`/${t}`)?r.slice(0,-t.length-1)||"/":null:r||null}function wB(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 hN(n){return[n.title,n.cwd,n.gitBranch??"",n.sessionId,n.provider].filter(Boolean).join(" ")}function pN(n){const e=Wa(n),t=e.lastIndexOf("/");return t>=0&&t<e.length-1?e.slice(t+1):e}function gN(n,e){return n.repoRoot?n.repoRoot:fN(n.cwd,e)?.path??null}function rp(n,e){if(new.target)return Ot({component:rp,...n});It(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:Nt,$on:(i,o)=>Dt(e,i,o)};return ox(n,{get size(){return t()},weight:"regular",get class(){return r()},"aria-hidden":"true"}),Lt(s)}var mN=new Set(["$$slots","$$events","$$legacy","ref","pressed","disabled","size","class","onclick","title","ariaLabel","ariaDescribedby","onChange","children"]);function uw(n,e){if(new.target)return Ot({component:uw,...n});It(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=Yi(e,mN);function g(M){r(M),f()?.(M),e.onPressedChange?.(M)}const m={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 v={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:Nt,$on:(M,S)=>Dt(e,M,S)},C=Ze(),z=ue(C);{let M=w(()=>Cr("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",m[i()],o()));wt(z,()=>Ov,(S,O)=>{O(S,ms({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(N){t(N)},get pressed(){return r()},set pressed(N){r(N)},children:(N,E)=>{var D=Ze(),ee=ue(D);Xn(ee,()=>h()??Xr),x(N,D)},$$slots:{default:!0}}))})}return x(n,C),Lt(v)}var vN=B('<span class="ml-auto shrink-0"> </span>'),bN=B('<span><!></span> <span class="min-w-0 truncate"> </span> <!> <!>',1),yN=B('<div role="status"> </div>'),Vm=B("<!> <!>",1),Ta=B("<span> </span>"),wN=B('<div><!> <!> <span class="truncate"> </span></div>'),xN=B('<span class="text-orange-500"> </span>'),kN=B('<span> </span> <span class="text-sm opacity-75 ml-1"> </span>',1),_N=B('<!> <span class="sr-only"> </span>',1),SN=B('<span class="w-1.5 h-1.5 ml-0.5 rounded-full bg-warning cursor-help"></span>'),CN=B('<div class="flex-0 flex flex-col"><!></div>'),MN=B('<div><!> <!> <span class="flex-1 text-left truncate min-w-0"><!></span> <!> <!></div>'),TN=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>'),EN=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>'),AN=B('<!> <span class="flex-1 min-w-0"><span class="text-subtle"> </span> <strong class="text-foreground ml-1 truncate"> </strong></span>',1),RN=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),PN=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>'),IN=B('<div><div class="text-sm text-danger"> </div> <div class="text-sm text-subtle mt-1"> </div></div>'),LN=B('<div class="text-sm text-subtle mt-1"> </div>'),ON=B('<div role="alert"><div class="text-sm text-danger"> </div> <!></div>'),NN=B("<!> ",1),DN=B('<div class="flex shrink-0 flex-wrap items-center gap-1 border-t border-border bg-popover px-2 py-1.5"><!> <!></div>'),$N=B('<!> <div class="min-h-16 overflow-hidden flex flex-1 flex-col" data-testid="branch-results"><!> <!></div> <!>',1),BN=B('<p class="type-caption mt-2 pl-6.5 text-muted-foreground"> </p>'),zN=B('<div class="shrink-0 border-t border-border p-2"><div class="px-3 py-2.5"><!> <!></div></div>'),FN=B("<!> <div><!></div> <!>",1),HN=B('<div class="relative min-w-0"><!></div>');function wl(n,e){const t=Ji();if(new.target)return Ot({component:wl,...n});It(e,!0);const r=()=>rn(C,"$branchByRepo$",o),s=()=>rn(h,"$connection$",o),i=()=>rn(f,"$hostMember$",o),[o,a]=ja(),c=J=>{{let Oe=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel()),Ue=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());qe(J,{onclick:Zi,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(Ue)},children:(Ct,Wt)=>{var Et=Ze(),fn=ue(Et);{var Zt=Bt=>{fi(Bt,{size:14})},Ae=Bt=>{tt(Bt,{get icon(){return Pp},class:"size-3.5!"})};j(fn,Bt=>{l(ke)?Bt(Zt):Bt(Ae,-1)})}x(Ct,Et)},$$slots:{default:!0}})}},u=J=>{var Oe=Ze(),Ue=ue(Oe);{var Ct=Et=>{mo(Et,{size:16,get class(){return dn.icon}})},Wt=Et=>{mo(Et,{size:14,class:"text-subtle"})};j(Ue,Et=>{oe()?Et(Ct):Et(Wt,-1)})}x(J,Oe)},d=(J,Oe=Xr)=>{const Ue=w(()=>Br(Oe()));var Ct=Vm(),Wt=ue(Ct);{let Zt=w(()=>_.ui_groupedCombobox_toggleGroup_ariaLabel({group:Oe().label})),Ae=w(()=>oe()?`w-full justify-start gap-2 ${dn.group} h-auto`:"w-full justify-start gap-2 px-2 text-subtle");qe(Wt,{variant:"ghost",size:"sm",wrapContent:!1,get"aria-expanded"(){return l(Ue)},get"data-branch-group"(){return Oe().key},get"aria-label"(){return l(Zt)},get class(){return l(Ae)},onclick:()=>Hs(Oe()),children:(Bt,Wn)=>{var An=bN(),ur=ue(An),ws=ne(ur);{let un=w(()=>`${oe()?"size-4!":"size-3.5!"} shrink-0 ${l(Ue)?"":"-rotate-90"}`);tt(ws,{get icon(){return ra},get class(){return l(un)}})}Y(ur);var Zr=A(ur,2),pi=se(Zr,!0),eo=A(Zr,2);{var Mi=un=>{qk(un,{size:"compact",class:"rounded-full px-1.5 font-normal text-subtle",children:(es,ti)=>{Pt();var Kn=zt();L(Us=>H(Kn,Us),[()=>ps(Oe().options.length)]),x(es,Kn)},$$slots:{default:!0}})};j(eo,un=>{Oe().key!=="remote"&&un(Mi)})}var Ti=A(eo,2);{var Rs=un=>{var es=vN(),ti=se(es,!0);L(Kn=>{st(es,"role",Oe().key==="remote"&&l(te)?"status":void 0),H(ti,Kn)},[()=>l(te)?_.ui_combobox_loadingOptions_message():_.workspace_branchSelector_groupLoad_label()]),x(un,es)};j(Ti,un=>{Oe().key==="remote"&&(l(te)||!l(ve)&&l(K).length===0)&&un(Rs)})}L(()=>{at(ur,1,`first-line-icon ${oe()?"w-4":"w-3.5"}`),H(pi,Oe().label)}),x(Bt,An)},$$slots:{default:!0}})}var Et=A(Wt,2);{var fn=Zt=>{var Ae=yN(),Bt=se(Ae,!0);L(Wn=>{at(Ae,1,`type-caption py-2 pr-3 text-muted-foreground ${oe()?"pl-8":"pl-6"}`),H(Bt,Wn)},[()=>_.workspace_branchSelector_noRemoteBranches_label()]),x(Zt,Ae)};j(Et,Zt=>{Oe().key==="remote"&&l(Ue)&&!l(te)&&l(ve)&&Oe().options.length===0&&Zt(fn)})}x(J,Ct)},f=Yf(),h=kd();let p=null;const g=da("BranchSelector"),m=ju(),v=new Ku,C=bx();let z=y(e,"variant",7,"underline"),M=y(e,"value",7,""),S=y(e,"repoPath",7),O=y(e,"repoType",7),N=y(e,"githubUrl",7),E=y(e,"disabled",7,!1),D=y(e,"dropUp",7,!1),ee=y(e,"portal",7,!0),U=y(e,"triggerClass",7),oe=y(e,"rowLabel",7),F=y(e,"hasTriggerIcon",7,!0),W=y(e,"description",7),X=y(e,"skipIsolation",7,!1),le=y(e,"suggestedBranch",7),re=y(e,"onSkipIsolationChange",7),Q=y(e,"onGitHubAuthNeededChange",7),me=y(e,"onBranchStatusChange",7),P=y(e,"onBranchesLoaded",7),$=y(e,"onchange",7),ce=y(e,"showUncommittedIndicator",7,!1),pe=y(e,"showTriggerChevron",7,!1),ye=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),Z=y(e,"triggerContentClass",7,"gap-0.75"),ae=he(""),V=he(Sr([])),K=he(Sr([])),I=he(!1),te=he(!1),ve=he(!1),de=he(""),fe=he(""),ke=he(!1),be=he(null),q=he(""),Me=null,ze=he(Sr([])),gt=0,Le=0,De=null,Fe=he(null),vt=he(!1),Vt=he(!1),nt=he(void 0),Pe=he(null),Ce=he(null),we=he(void 0),Ve=he(void 0);const Mt=w(()=>O()==="local"&&typeof re()=="function"&&!!l(fe));let ie=he(void 0);ct(()=>{l(vt)||(k(ie,void 0),k(Ve,void 0))}),ct(()=>{if(l(vt))return ua(J=>{J.isComposing||Ut()})});let $e=he("none"),lt=he(!1);const yt=_.workspace_isolationMode_worktree_label(),mt=w(()=>X()&&O()==="local");let Tt=he(0),We=he(!1),Ke=he(!1),Qt=he(null),Be=null;ct(()=>{if(typeof Q()=="function"&&l($e)!==Be){Be=l($e);try{Q()(l($e))}catch(J){g.error("Error in onGitHubAuthNeededChange callback",J)}}});const jt=w(()=>M()||l(ae)),Yn=w(()=>l(jt)===l(fe)&&l(fe)!=="");ct(()=>{if(!l(mt)||!l(fe)||l(jt)===l(fe))return;const J=l(fe);Xs(()=>Er(J,{keepSkipIsolation:!0,keepOpen:!0}))});let Bn=null;ct(()=>{if(typeof me()=="function"&&l(jt)){const J=l(Tt),Oe=l(We),Ue=l(fe),Ct=l(Yn),Wt=l(Ke);if(Bn&&Bn.behind===J&&Bn.hasUncommittedChanges===Oe&&Bn.currentBranch===Ue&&Bn.isCurrentBranch===Ct&&Bn.isLoading===Wt)return;const Et={behind:J,hasUncommittedChanges:Oe,currentBranch:Ue,isCurrentBranch:Ct,isLoading:Wt};Bn=Et;try{me()(Et)}catch(fn){g.error("Error in onBranchStatusChange callback",fn)}}});const ge=new Map,ft=300*1e3;let Rt="",ln="local",Gt,ut=null;const ht=150;let Ie=null,He=0;function Xe(){const J=kd.select(At.state);return J&&S()?{connection:J,repoPath:S(),repoType:O(),githubUrl:N(),generation:He,cacheKey:JSON.stringify([J,S(),O(),N()])}:null}function pt(J){return J.generation===He&&J.connection===kd.select(At.state)&&J.repoPath===S()&&J.repoType===O()&&J.githubUrl===N()}function Qe(){ut&&(clearTimeout(ut),ut=null),Ie?.abort(),Ie=null}tc(()=>{He++,gt++,Qe(),Me&&clearTimeout(Me)});function et(J){return ya.get("enableFormPersistence")&&r()[J]||""}let it="";ct(()=>{g.debug("Value prop effect triggered",{value:M(),repoPath:S(),internalSelectedBranch:l(ae)});const J=S()!==it;it=S(),M()?(g.debug("Setting internalSelectedBranch from value prop",{value:M()}),k(ae,M())):J&&(g.debug("Repo changed and value is empty, clearing internalSelectedBranch"),k(ae,""))});function xt(){Qe(),k(ke,!0),k(be,null),ut=setTimeout(()=>{ut=null,Ye()},ht)}ct(()=>{const J=s(),Oe=J!==p;p=J;const Ue=S(),Ct=O(),Wt=N(),Et=Ue!==Rt,fn=Ct!==ln,Zt=Wt!==Gt;Oe&&ge.clear();const Ae=Oe||Et||Ue&&(fn||Zt);Rt=Ue,ln=Ct,Gt=Wt,Ae&&(He++,Qe(),De=null,k(K,[],!0),k(I,!1),k(te,!1),k(ve,!1),k(fe,""),k($e,"none"),gt++,k(ze,[],!0),k(be,null),ei(),Qr(),Ue&&J?(g.debug("Repo changed - resetting branch",{previousRepoPath:Rt,currentRepoPath:Ue,previousInternalBranch:l(ae)}),k(ae,""),k(de,""),k(V,[],!0),xt()):(k(V,[],!0),k(ae,""),k(de,""),k(ke,!1)))});function Ft(){if(typeof P()=="function")try{P()({branches:[...l(V)],remoteBranches:[...l(K)],defaultBranch:l(de),currentBranch:l(fe)})}catch(J){g.error("Error in onBranchesLoaded callback",J)}}function $t(){if(M()){sn(M());return}const J=et(S());J&&(l(V).includes(J)||l(K).includes(J))?sn(J):l(de)?sn(l(de)):sn(l(V)[0])}async function Ye(){const J=Xe();if(!J){k(ke,!1);return}Ie&&Ie.abort();const Oe=new AbortController;Ie=Oe;const Ue=()=>!Oe.signal.aborted&&pt(J);g.debug("fetchBranches called",{repoPath:S(),repoType:O(),githubUrl:N()}),Op.start(`fetchBranches-${S()}`,{repoType:O(),githubUrl:N()});let Ct=O(),Wt=N();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())&&(Ct="github",Wt||(Wt=`https://github.com/${S()}`,g.debug("Reconstructed GitHub URL from shorthand",{repoPath:S(),effectiveGithubUrl:Wt}))),ya.get("enableBranchCaching")){const Ae=ge.get(J.cacheKey);if(Ae&&Date.now()-Ae.timestamp<ft){if(k(V,Ae.branches,!0),k(K,Ae.remoteBranches||[],!0),k(de,Ae.default,!0),k(fe,Ae.current||"",!0),Ct==="github")$t();else if(M())sn(M());else{const Bt=et(S());Bt&&(l(V).includes(Bt)||l(K).includes(Bt))?sn(Bt):l(fe)&&l(V).includes(l(fe))?sn(l(fe)):l(de)&&l(V).includes(l(de))?sn(l(de)):l(V).length>0&&sn(l(V)[0])}if(!Ue())return;Ft(),k(ke,!1);return}}k(ke,!0),k(be,null);let fn=!1,Zt=!1;try{if(ya.get("simulateSlowNetwork")&&await new Promise(Ae=>setTimeout(Ae,ya.get("networkDelay")||0)),!Ue())return;if(Ct==="local"){const Ae=await Ho.git.getBranches(J.repoPath,!0);if(!Ue())return;if(Ae){if(k(V,Ae.branches,!0),k(K,Ae.remoteBranches,!0),k(de,Ae.defaultBranch||"",!0),k(fe,Ae.currentBranch||"",!0),M())sn(M());else{const Bt=et(S());Bt&&(l(V).includes(Bt)||l(K).includes(Bt))?sn(Bt):l(fe)&&l(V).includes(l(fe))?sn(l(fe)):l(de)&&l(V).includes(l(de))?sn(l(de)):l(V).length>0&&sn(l(V)[0])}fn=!0}else throw new Error("Failed to fetch branches")}else if(Ct==="github"&&Wt){const Ae=Wp(Wt);if(!Ae)throw new Error("Invalid GitHub URL format");const{owner:Bt,repo:Wn}=Ae;Ho.integrations.githubBranchesCached(Bt,Wn).then(An=>{if(!(!Ue()||Zt)&&An.branches.length!==0){if(k(V,An.branches,!0),k(de,An.defaultBranch||"",!0),k(ke,!1),!De){const ur=et(S()),ws=M(),Zr=Le;if($t(),!Ue())return;De={autoSelectedBranch:l(ae),valueBeforePaint:ws,savedBranchBeforePaint:ur,explicitSelectionRevision:Zr}}Ft(),g.debug("Rendered cached branches via github.branches.listCached",{owner:Bt,repo:Wn,count:An.branches.length,source:An.source})}});try{const An=await Ho.integrations.githubBranches(Bt,Wn);if(!Ue()){g.debug("Branch fetch aborted after response");return}Zt=!0,k(V,An.branches,!0),k(de,An.defaultBranch||"",!0),k($e,"none"),fn=!0,g.debug("Fetched branches via daemon github.branches.list",{owner:Bt,repo:Wn,count:l(V).length})}catch(An){if(!Ue())return;if(Zt=!0,i())throw An;const ur=An instanceof Error?An.message:String(An);throw/not configured|not authenticated/i.test(ur)?(k($e,"not-authenticated"),new Error("GITHUB_AUTH_REQUIRED")):/404|not found/i.test(ur)?(k($e,"no-access"),new Error("GITHUB_NO_ACCESS")):An}}if(!Ue())return;if(ya.get("enableBranchCaching")&&ge.set(J.cacheKey,{branches:l(V),remoteBranches:l(K),default:l(de),current:l(fe),timestamp:Date.now()}),Ct==="github"&&l(V).length>0){const Ae=De;if(Ae&&!Ae.valueBeforePaint){if(Le===Ae.explicitSelectionRevision&&(!M()||M()===Ae.autoSelectedBranch)){const Bt=Ae.savedBranchBeforePaint,Wn=Bt&&(l(V).includes(Bt)||l(K).includes(Bt))?Bt:l(de)||l(V)[0];l(ae)!==Wn&&sn(Wn)}}else $t()}fn&&Ue()&&(De=null,Ft())}catch(Ae){if(Ae instanceof Error&&Ae.name==="AbortError"){g.debug("Branch fetch aborted in outer catch (superseded by newer request)");return}if(!Ue()){g.debug("Branch fetch aborted; skipping error-state write");return}const Bt=Ae instanceof Error?Ae:new Error(String(Ae));if(g.error("Failed to fetch branches",Bt,{repoPath:S(),repoType:O(),githubUrl:N(),effectiveRepoType:Ct,effectiveGithubUrl:Wt,githubAuthNeeded:l($e)}),Ae instanceof Error){if(Ae.message==="GITHUB_AUTH_REQUIRED"){k(be,null);return}else if(Ae.message==="GITHUB_NO_ACCESS"){k(be,_.workspace_branchSelector_noAccess_error(),!0),$p.error(l(be));return}Ae.message.includes("private repo")||Ae.message.includes("authenticate with GitHub")||Ae.message.includes("access permissions")||Ae.message.includes("GitHub API error")?k(be,Ae.message,!0):Ae.message.includes("Git is not installed")||Ae.message.includes("ENOENT")||Ae.message.includes("spawn git")?k(be,_.workspace_branchSelector_gitNotInstalled_error(),!0):Ae.message.includes("rate limit")?k(be,_.workspace_branchSelector_rateLimit_error(),!0):Ae.message.includes("404")||Ae.message.includes("not found")?Ct==="github"?k(be,_.workspace_branchSelector_repoNotFoundGithub_error(),!0):k(be,_.workspace_branchSelector_repoNotFound_error(),!0):Ae.message.includes("network")||Ae.message.includes("fetch")?k(be,_.workspace_branchSelector_network_error(),!0):Ae.message.includes("permission")||Ae.message.includes("denied")?k(be,_.workspace_branchSelector_permissionDenied_error(),!0):k(be,Ae.message||_.workspace_branchSelector_fetchBranchesFailed_error(),!0)}else k(be,_.workspace_branchSelector_fetchBranchesFailedManual_error(),!0);X()&&Ct==="local"||$p.error(l(be)),k(V,[],!0)}finally{Op.end(`fetchBranches-${J.repoPath}`),Ie===Oe&&Ue()&&(k(ke,!1),Ie=null)}}async function cn(){const J=Xe();if(!(!J||J.repoType!=="local")&&!(l(te)||l(ve))){k(te,!0),k(ve,!0),g.debug("Fetching remote branches for",{repoPath:S()});try{const Oe=await Ho.git.getBranches(J.repoPath,!0);if(!pt(J))return;if(Oe){if(k(K,Oe.remoteBranches||[],!0),ya.get("enableBranchCaching")){const Ue=ge.get(J.cacheKey);Ue&&ge.set(J.cacheKey,{...Ue,remoteBranches:l(K)})}g.debug("Fetched remote branches",{count:l(K).length})}}catch(Oe){if(!pt(J))return;g.error("Failed to fetch remote branches",Oe)}finally{pt(J)&&k(te,!1)}}}function _n(){k(I,!l(I)),l(I)&&l(K).length===0&&!l(te)&&!l(ve)&&cn()}async function yr(J){const Oe=Xe();if(!J||!Oe||Oe.repoType!=="local"){k(Tt,0),k(We,!1),k(Ke,!1);return}k(Qt,J,!0),k(Ke,!0),g.debug("Fetching branch status",{branchName:J});try{if(p_()){const Ue=await Ho.git.branchStatus(Oe.repoPath,J);if(!pt(Oe)||l(Qt)!==J){g.debug("Ignoring stale branch status response",{requested:J,current:l(Qt)});return}Ue?(k(Tt,Ue.behind??0,!0),k(We,J===l(fe)?Ue.hasUncommittedChanges??!1:!1,!0),g.debug("Branch status fetched",{branchName:J,behind:l(Tt),hasUncommittedChanges:l(We),currentBranch:l(fe),isCurrentBranch:J===l(fe)})):(g.warn("Failed to get branch status",{branchName:J,repoPath:S()}),k(Tt,0),k(We,!1))}}catch(Ue){if(!pt(Oe)||l(Qt)!==J)return;g.error("Failed to fetch branch status",Ue),k(Tt,0),k(We,!1)}finally{pt(Oe)&&l(Qt)===J&&k(Ke,!1)}}function ei(){k(Tt,0),k(We,!1),k(Ke,!1),k(Qt,null)}function sn(J){const Oe=Xe();if(Oe){k(ae,J,!0),g.debug("setInternalBranch called",{branchName:J,hasOnchange:typeof $()=="function"});try{typeof $()=="function"&&(g.debug("Calling onchange with branch",{branchName:J}),$()(new CustomEvent("change",{detail:{branch:J}})))}catch(Ue){g.error("Error in onchange callback",Ue)}pt(Oe)&&yr(J)}}function Er(J,{keepSkipIsolation:Oe=!1,keepOpen:Ue=!1}={}){Le++,k(ae,J,!0),Qr();try{typeof $()=="function"&&$()(new CustomEvent("change",{detail:{branch:J}}))}catch(Ct){g.error("Error in onchange callback",Ct)}if(!Oe&&X()&&typeof re()=="function")try{re()(!1)}catch(Ct){g.error("Error in onSkipIsolationChange callback",Ct)}yr(J),Ue||Ut()}function us(J){const Oe=l(Ce)?.closest('[role="dialog"]');if(!l(ie)&&Oe&&l(Pe)){k(Ve,l(we)?.getBoundingClientRect().height||void 0,!0);const Ue=l(Pe),Ct=Ue.getBoundingClientRect(),Wt=Oe.getBoundingClientRect(),Et=Wt.left-Ct.left,fn=Wt.top-Ct.top;k(ie,{contextElement:Ue,getBoundingClientRect:()=>{const Zt=Ue.getBoundingClientRect(),Ae=Math.max(wa,Ue.ownerDocument.documentElement.clientHeight-wa-Wt.height),Bt=Math.min(Math.max(wa,Zt.top+fn),Ae),Wn=Math.max(wa,Ue.ownerDocument.documentElement.clientWidth-wa-Wt.width),An=Math.min(Math.max(wa,Zt.left+Et),Wn);return new DOMRect(An,Bt,0,0)}},!0)}try{re()?.(!J)}catch(Ue){g.error("Error in onSkipIsolationChange callback",Ue)}!J&&l(fe)&&Er(l(fe),{keepSkipIsolation:!0,keepOpen:!0})}function Ut(){const J=l(vt);k(vt,!1),J&&qa()}async function qa(){await Yo(),!l(vt)&&l(Pe)?.isConnected&&l(Pe).focus({preventScroll:!0})}function Si(J){Me&&clearTimeout(Me),Me=setTimeout(()=>{k(q,J,!0)},100)}function Qr(){Me&&(clearTimeout(Me),Me=null),k(q,"")}async function Zi(){const J=Xe();J&&ge.delete(J.cacheKey),k($e,"none"),await Ye()}async function R(){if(!i()){k(lt,!0),k(be,null);try{const{initializeGitHubAuth:J,startGitHubAuth:Oe}=await gs(async()=>{const{initializeGitHubAuth:Zt,startGitHubAuth:Ae}=await import("./CQNY8AIr.js").then(Bt=>Bt.o5);return{initializeGitHubAuth:Zt,startGitHubAuth:Ae}},__vite__mapDeps([12,13,2,14,15,4,8,1,16,6,3]),import.meta.url),{selectGitHubAuthIsAuthenticated:Ue,selectGitHubAuthIsAuthenticating:Ct,selectGitHubAuthError:Wt}=await gs(async()=>{const{selectGitHubAuthIsAuthenticated:Zt,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:Bt}=await import("./D1dKOodV.js").then(Wn=>Wn.A);return{selectGitHubAuthIsAuthenticated:Zt,selectGitHubAuthIsAuthenticating:Ae,selectGitHubAuthError:Bt}},__vite__mapDeps([43,44,3,4,1,2,22,7,8,9,45,46,23,0,5,6,10,21,47,26,48,12,13,14,15,16,49,20,50,51,52,19,24,25,53,29,28,54,55,33,31,56]),import.meta.url),Et=At;Et.dispatch(J()),Et.dispatch(Oe());const fn=setInterval(async()=>{const Zt=Et.state;if(Ue.select(Zt))clearInterval(fn),k(lt,!1),k($e,"none"),await Zi();else if(!Ct.select(Zt)){clearInterval(fn),k(lt,!1);const Ae=Wt.select(Zt);Ae&&k(be,Ae,!0)}},1e3);setTimeout(()=>{l(lt)&&(clearInterval(fn),k(lt,!1),k(be,_.workspace_branchSelector_githubTimeout_error(),!0))},300*1e3)}catch(J){g.error("Failed to connect GitHub",J),k(lt,!1),k(be,J instanceof Error?J.message:_.workspace_branchSelector_githubConnectFailed_error(),!0)}}}let xe=he(!0),Ee=he(!0),ot=!1;ct(()=>{if(l(vt)){const J=!ot;J&&requestAnimationFrame(()=>{l(vt)&&!l(mt)&&l(Fe)&&(l(Fe).focus(),l(Fe).select())}),J&&(k(Vt,!ch(l(Pe),360)),l(jt)&&O()==="local"&&yr(l(jt)))}ot=l(vt)}),ct(()=>{l(q)&&(l(Pn).length>0&&k(xe,!1),l(en).length>0&&k(Ee,!1),l(En).length>0&&k(I,!0))});function Ne(){const J=N()||(S()&&/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(S())?`https://github.com/${S()}`:void 0);return J?Wp(J):null}ct(()=>{const J=s(),Oe=l(q).trim();if(!J||O()!=="github"||!Oe){gt++,k(ze,[],!0);return}const Ue=Ne();if(!Ue){gt++,k(ze,[],!0);return}const Ct=Xe();if(!Ct)return;const Wt=++gt;k(ze,[],!0),Ho.integrations.githubBranches(Ue.owner,Ue.repo,Oe).then(Et=>{!pt(Ct)||Wt!==gt||k(ze,Et.branches,!0)}).catch(()=>{})});function _e(J){return J.startsWith("dependabot/")}function Xt(J){const Oe=J.trim(),Ue=Oe.startsWith("+ ")?Oe.substring(2):Oe;if(yx(Ue))return!0;if(J.startsWith("+ ")){const Wt=J.substring(2);if(Wt.startsWith("workspace")||Wt.startsWith("ws/")||Wt.startsWith("ws_"))return!0}return!!(Ue.startsWith("workspace-")||Ue.startsWith("workspace/")||Ue.startsWith("ws/")||Ue.startsWith("ws_")||/-\d{13}-[a-z0-9]+$/.test(Ue))}const yn=w(()=>l(ze).length>0?[...l(V),...l(ze).filter(J=>!l(V).includes(J))]:l(V)),Ge=w(()=>l(yn).filter(J=>!Xt(J)&&!_e(J)&&J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>J===l(fe)?-1:Oe===l(fe)?1:J===l(de)?-1:Oe===l(de)?1:J.localeCompare(Oe))),en=w(()=>l(yn).filter(J=>_e(J)&&J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>J.localeCompare(Oe))),Pn=w(()=>l(yn).filter(J=>Xt(J)&&J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>{const Ue=Et=>{const fn=Et.match(/(\d{13})/);return fn?parseInt(fn[1]):null},Ct=Ue(J),Wt=Ue(Oe);return Ct&&Wt?Wt-Ct:Ct&&!Wt?-1:!Ct&&Wt?1:J.localeCompare(Oe)})),En=w(()=>l(K).filter(J=>J.toLowerCase().includes(l(q).toLowerCase())).sort((J,Oe)=>J.localeCompare(Oe))),$r=w(()=>{const J=(Oe,Ue=!1)=>Oe.map(Ct=>({value:Ct,label:Ct,class:oe()&&Ue?"pl-8":void 0,description:Ct===l(de)?_.workspace_branchSelector_default_label():Ct===l(fe)?_.workspace_branchSelector_current_label():void 0}));return[{key:"regular",label:"",options:J(l(Ge))},{key:"workspace",label:_.workspace_branchSelector_workspaceBranches_label(),options:J(l(Pn),!0),collapsed:l(xe)},{key:"remote",label:_.workspace_branchSelector_remoteBranches_label(),options:J(l(En),!0),collapsed:!l(I),keepEmpty:O()==="local"},{key:"dependabot",label:_.workspace_branchSelector_dependabotBranches_label(),options:J(l(en),!0),collapsed:l(Ee)}].filter(Oe=>Oe.key!=="remote"||O()==="local")});function Br(J){return!J.collapsed}function Hs(J){J.key==="workspace"?k(xe,!l(xe)):J.key==="remote"?_n():J.key==="dependabot"&&k(Ee,!l(Ee))}var pa={get variant(){return z()},set variant(J="underline"){z(J),b()},get value(){return M()},set value(J=""){M(J),b()},get repoPath(){return S()},set repoPath(J){S(J),b()},get repoType(){return O()},set repoType(J){O(J),b()},get githubUrl(){return N()},set githubUrl(J){N(J),b()},get disabled(){return E()},set disabled(J=!1){E(J),b()},get dropUp(){return D()},set dropUp(J=!1){D(J),b()},get portal(){return ee()},set portal(J=!0){ee(J),b()},get triggerClass(){return U()},set triggerClass(J){U(J),b()},get rowLabel(){return oe()},set rowLabel(J){oe(J),b()},get hasTriggerIcon(){return F()},set hasTriggerIcon(J=!0){F(J),b()},get description(){return W()},set description(J){W(J),b()},get skipIsolation(){return X()},set skipIsolation(J=!1){X(J),b()},get suggestedBranch(){return le()},set suggestedBranch(J){le(J),b()},get onSkipIsolationChange(){return re()},set onSkipIsolationChange(J){re(J),b()},get onGitHubAuthNeededChange(){return Q()},set onGitHubAuthNeededChange(J){Q(J),b()},get onBranchStatusChange(){return me()},set onBranchStatusChange(J){me(J),b()},get onBranchesLoaded(){return P()},set onBranchesLoaded(J){P(J),b()},get onchange(){return $()},set onchange(J){$(J),b()},get showUncommittedIndicator(){return ce()},set showUncommittedIndicator(J=!1){ce(J),b()},get showTriggerChevron(){return pe()},set showTriggerChevron(J=!1){pe(J),b()},get triggerChevronClass(){return ye()},set triggerChevronClass(J="ml-2 opacity-50"){ye(J),b()},get triggerContentClass(){return Z()},set triggerContentClass(J="gap-0.75"){Z(J),b()},$set:Nt,$on:(J,Oe)=>Dt(e,J,Oe)},Ci=Ze(),lc=ue(Ci);{var ys=J=>{var Oe=wN(),Ue=ne(Oe);{var Ct=Ae=>{var Bt=Ta(),Wn=se(Bt,!0);L(()=>{at(Bt,1,$n(dn.fieldLabel)),H(Wn,oe())}),x(Ae,Bt)};j(Ue,Ae=>{oe()&&Ae(Ct)})}var Wt=A(Ue,2);{var Et=Ae=>{{let Bt=w(()=>oe()?16:12);mo(Ae,{get size(){return l(Bt)},class:"text-ghost shrink-0"})}};j(Wt,Ae=>{F()&&Ae(Et)})}var fn=A(Wt,2),Zt=se(fn,!0);Y(Oe),L(Ae=>{at(Oe,1,`flex min-w-0 items-center gap-2 text-subtle text-sm ${oe()?"min-h-10 px-3 py-2":"py-1"}`),H(Zt,Ae)},[()=>l(jt)||M()||(l(mt)?_.workspace_branchSelector_noIsolation_label({isolationLabel:yt}):_.workspace_branchSelector_noBranchSelected_label())]),x(J,Oe)},ga=J=>{var Oe=HN(),Ue=ne(Oe);wt(Ue,()=>Wu,(Ct,Wt)=>{Wt(Ct,{get open(){return l(vt)},set open(Et){k(vt,Et,!0)},children:(Et,fn)=>{var Zt=Vm(),Ae=ue(Zt);{const Wn=(An,ur)=>{let ws=()=>(ur?.()).props;{let Zr=w(()=>z()==="default"?"outline":z()),pi=w(()=>!oe()),eo=w(()=>`${_.workspace_branchSelector_selectBranch_label()}: ${l(jt)||M()}`),Mi=w(()=>`w-full text-muted-foreground ${U()} ${l($e)==="not-authenticated"?"ring-1 ring-orange-400 rounded-sm":le()&&le()!==l(ae)?"ring-1 ring-primary-ink rounded-sm":""}`);qe(An,ms(ws,{get variant(){return l(Zr)},get wrapContent(){return l(pi)},get"aria-label"(){return l(eo)},get class(){return l(Mi)},get ref(){return l(Pe)},set ref(Ti){k(Pe,Ti,!0)},children:(Ti,Rs)=>{var un=MN(),es=ne(un);{var ti=kt=>{var qt=Ta(),wn=se(qt,!0);L(()=>{at(qt,1,$n(dn.fieldLabel)),H(wn,oe())}),x(kt,qt)};j(es,kt=>{oe()&&kt(ti)})}var Kn=A(es,2);{var Us=kt=>{tt(kt,{get icon(){return ax},class:"text-orange-500",size:"xs"})},xs=kt=>{{let qt=w(()=>oe()?16:12);mo(kt,{get size(){return l(qt)},class:"text-ghost shrink-0"})}};j(Kn,kt=>{l($e)==="not-authenticated"?kt(Us):F()&&kt(xs,1)})}var ni=A(Kn,2),ri=ne(ni);{var Ja=kt=>{var qt=xN(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_connectGithub_label()]),x(kt,qt)},Xa=kt=>{var qt=kN(),wn=ue(qt),or=se(wn,!0),Is=A(wn,2),Vs=se(Is,!0);L(tn=>{H(or,l(jt)),H(Vs,tn)},[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:yt})]),x(kt,qt)},Io=kt=>{var qt=Ta(),wn=se(qt,!0);L(()=>H(wn,l(jt))),x(kt,qt)},Ya=kt=>{var qt=Ta(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_noIsolation_label({isolationLabel:yt})]),x(kt,qt)},ir=kt=>{var qt=Ta(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_selectRepoFirst_label()]),x(kt,qt)},wr=kt=>{var qt=_N(),wn=ue(qt);fi(wn,{size:14,class:"text-ghost"});var or=A(wn,2),Is=se(or,!0);L(Vs=>H(Is,Vs),[()=>_.workspace_compactInitializer_waitingBranchSelection_label()]),x(kt,qt)},zr=kt=>{var qt=Ta(),wn=se(qt,!0);L(or=>H(wn,or),[()=>_.workspace_branchSelector_selectBranch_label()]),x(kt,qt)};j(ri,kt=>{l($e)==="not-authenticated"?kt(Ja):X()&&l(jt)?kt(Xa,1):l(jt)?kt(Io,2):l(mt)&&S()?kt(Ya,3):S()?l(ke)?kt(wr,5):kt(zr,-1):kt(ir,4)})}Y(ni);var ks=A(ni,2);{var Fr=kt=>{var qt=CN(),wn=ne(qt);{let or=w(()=>_.workspace_branchSelector_uncommittedChanges_tooltip());Hu(wn,{get content(){return l(or)},side:"bottom",delayDuration:200,children:(Is,Vs)=>{var tn=SN();x(Is,tn)},$$slots:{default:!0}})}Y(qt),Ts(3,qt,()=>Fo,()=>({axis:"x",tier:"moderate"})),x(kt,qt)};j(ks,kt=>{ce()&&!X()&&l(jt)&&O()==="local"&&!l(Ke)&&l(We)&&l(Yn)&&kt(Fr)})}var Ps=A(ks,2);{var dr=kt=>{tt(kt,{get icon(){return ra},size:10,get class(){return ye()}})};j(Ps,kt=>{pe()&&kt(dr)})}Y(un),L(()=>at(un,1,`flex items-center truncate min-w-0 ${Z()}`)),x(Ti,un)},$$slots:{default:!0}}))}};wt(Ae,()=>Uu,(An,ur)=>{ur(An,{child:Wn,$$slots:{child:!0}})})}var Bt=A(Ae,2);{let Wn=w(()=>oe()??_.workspace_branchSelector_whichBranch_label()),An=w(()=>oe()?"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"),ur=w(()=>!l(ie)),ws=w(()=>l(ie)?"bottom":oe()?v.current||l(Vt)?"bottom":"left":D()?"top":"bottom"),Zr=w(()=>l(ie)?"start":oe()?v.current||l(Vt)?"end":"start":"center"),pi=w(()=>l(ie)?0:oe()?v.current||l(Vt)?4:24:void 0),eo=w(()=>({to:m()})),Mi=w(()=>m()?"absolute":"fixed");wt(Bt,()=>Vu,(Ti,Rs)=>{Rs(Ti,{role:"dialog",get"aria-label"(){return l(Wn)},get class(){return l(An)},get customAnchor(){return l(ie)},get avoidCollisions(){return l(ur)},get side(){return l(ws)},get align(){return l(Zr)},get sideOffset(){return l(pi)},get portalProps(){return l(eo)},get strategy(){return l(Mi)},onOpenAutoFocus:un=>{un.preventDefault(),Yo().then(()=>{l(vt)&&(l(mt)?l(Ce):l(Fe))?.focus()})},get portal(){return ee()},children:(un,es)=>{var ti=FN(),Kn=ue(ti);{var Us=ir=>{var wr=TN(),zr=ne(wr),ks=se(zr,!0),Fr=A(zr,2),Ps=se(Fr,!0);Y(wr),L((dr,kt)=>{H(ks,dr),H(Ps,kt)},[()=>_.workspace_branchSelector_whichBranch_label(),()=>W()||_.workspace_branchSelector_whichBranch_description()]),x(ir,wr)};j(Kn,ir=>{oe()||ir(Us)})}var xs=A(Kn,2);let ni;var ri=ne(xs);{var Ja=ir=>{var wr=EN(),zr=ne(wr),ks=se(zr,!0),Fr=A(zr,2),Ps=ne(Fr);u(Ps);var dr=A(Ps,2),kt=se(dr,!0),qt=A(dr,2),wn=se(qt,!0);Y(Fr),Y(wr),L((or,Is)=>{H(ks,or),at(Fr,1,$n(oe()?dn.row+" flex min-w-0":"type-caption flex min-w-0 items-center gap-2 px-2 py-1")),H(kt,l(fe)),H(wn,Is)},[()=>_.workspace_branchSelector_folderBranch_label(),()=>_.workspace_branchSelector_currentBranch_label()]),x(ir,wr)},Xa=ir=>{var wr=$N(),zr=ue(wr);{var ks=tn=>{{let Sn=w(()=>oe()?"bg-sidebar hover:bg-hover":"bg-primary/10 hover:bg-primary/15 border border-primary/20");qe(tn,{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(Sn)??""}`},onclick:()=>Er(le()),children:(Qn,zn)=>{var Cn=AN(),on=ue(Cn);mo(on,{size:14,class:"text-primary-ink shrink-0"});var fr=A(on,2),Ar=ne(fr),Ws=se(Ar,!0),_s=A(Ar,2),Ls=se(_s,!0);Y(fr),L(Os=>{H(Ws,Os),H(Ls,le())},[()=>_.workspace_branchSelector_usePrBranch_label()]),x(Qn,Cn)},$$slots:{default:!0}})}};j(zr,tn=>{le()&&le()!==l(ae)&&tn(ks)})}var Fr=A(zr,2),Ps=ne(Fr);{var dr=tn=>{{let Sn=w(()=>oe()?"mx-2 rounded-(--radius-medium) bg-sidebar":"w-full border-l-2 border-primary bg-primary/5");qe(tn,{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(Sn)??""}`},onclick:R,children:(Qn,zn)=>{var Cn=RN(),on=A(ue(Cn),2),fr=ne(on),Ar=se(fr,!0),Ws=A(fr,2),_s=se(Ws,!0);Y(on),L((Ls,Os)=>{H(Ar,Ls),H(_s,Os)},[()=>_.workspace_branchSelector_connectWithGithub_label(),()=>_.workspace_branchSelector_connectWithGithub_description()]),x(Qn,Cn)},$$slots:{default:!0}})}},kt=tn=>{var Sn=PN(),Qn=ne(Sn),zn=ne(Qn);fi(zn,{size:20,class:"text-ghost"}),Y(Qn);var Cn=A(Qn,2),on=ne(Cn),fr=se(on,!0),Ar=A(on,2),Ws=se(Ar,!0);Y(Cn),Y(Sn),L((_s,Ls)=>{at(Sn,1,`px-3 py-3 flex items-start gap-3 ${oe()?"mx-2 rounded-(--radius-medium) bg-sidebar":"border-l-2 border-primary bg-primary/5"}`),H(fr,_s),H(Ws,Ls)},[()=>_.workspace_branchSelector_connectingGithub_label(),()=>_.workspace_branchSelector_completeAuth_description()]),x(tn,Sn)},qt=tn=>{var Sn=IN(),Qn=ne(Sn),zn=se(Qn,!0),Cn=A(Qn,2),on=se(Cn,!0);Y(Sn),L((fr,Ar)=>{at(Sn,1,`py-2 bg-danger-background/10 ${oe()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),H(zn,fr),H(on,Ar)},[()=>_.workspace_branchSelector_noAccess_error(),()=>_.workspace_branchSelector_noAccess_description()]),x(tn,Sn)},wn=tn=>{var Sn=ON(),Qn=ne(Sn),zn=se(Qn,!0),Cn=A(Qn,2);{var on=fr=>{var Ar=LN(),Ws=se(Ar,!0);L(_s=>H(Ws,_s),[()=>_.workspace_branchSelector_typeManually_description()]),x(fr,Ar)};j(Cn,fr=>{O()==="github"&&fr(on)})}Y(Sn),L(()=>{at(Sn,1,`py-2 bg-danger-background/10 ${oe()?"mx-2 rounded-(--radius-medium) px-3":"border-l-2 border-danger px-2"}`),H(zn,l(be))}),x(tn,Sn)};j(Ps,tn=>{!i()&&l($e)==="not-authenticated"&&!l(lt)?tn(dr):l(lt)?tn(kt,1):l($e)==="no-access"?tn(qt,2):l(be)&&tn(wn,3)})}var or=A(Ps,2);{let tn=w(()=>oe()?dn.row:void 0),Sn=w(()=>_.workspace_branchSelector_selectBranch_label()),Qn=w(()=>_.workspace_branchSelector_search_placeholder()),zn=w(()=>_.workspace_branchSelector_search_placeholder()),Cn=w(()=>_.workspace_branchSelector_noBranchesFound_label()),on=w(()=>l(ke)&&l(V).length===0),fr=w(()=>oe()?"flex min-h-0 flex-1 flex-col gap-1 px-2":"flex min-h-0 flex-1 flex-col px-2 pb-1"),Ar=w(()=>oe()?"search":void 0),Ws=w(()=>oe()?c:void 0),_s=w(()=>oe()?"min-h-0 max-h-none flex-1 p-0 pb-2":"min-h-0 max-h-none flex-1"),Ls=w(()=>oe()?"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");lh(or,{get open(){return l(vt)},get value(){return l(ae)},get groups(){return l($r)},get groupHeader(){return d},get optionIcon(){return u},get rowClass(){return l(tn)},get ariaLabel(){return l(Sn)},get placeholder(){return l(Qn)},get searchPlaceholder(){return l(zn)},get emptyText(){return l(Cn)},get loading(){return l(on)},staticPosition:!0,allowCustom:!0,onquerychange:Si,oncommit:Os=>{typeof Os=="string"&&Er(Os)},get class(){return l(fr)},get inputVariant(){return l(Ar)},get inputAction(){return l(Ws)},inputClass:"shrink-0",get viewportClass(){return l(_s)},size:"compact",get contentClass(){return l(Ls)},get inputRef(){return l(Fe)},set inputRef(Os){k(Fe,Os,!0)}})}Y(Fr);var Is=A(Fr,2);{var Vs=tn=>{var Sn=DN(),Qn=ne(Sn);is(Qn,17,()=>l($r).filter(Cn=>Cn.key==="workspace"&&Cn.options.length>0||Cn.key==="remote"),Cn=>Cn.key,(Cn,on)=>{{let fr=w(()=>Br(l(on)));uw(Cn,{size:"sm",get pressed(){return l(fr)},get ariaLabel(){return l(on).label},onChange:()=>Hs(l(on)),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:(Ar,Ws)=>{var _s=NN(),Ls=ue(_s);{var Os=Lo=>{tt(Lo,{get icon(){return pv},class:"size-3! text-primary-ink"})},uc=w(()=>Br(l(on)));j(Ls,Lo=>{l(uc)&&Lo(Os)})}var pd=A(Ls);L(()=>H(pd,` ${l(on).label??""}`)),x(Ar,_s)},$$slots:{default:!0}})}});var zn=A(Qn,2);{let Cn=w(()=>_.workspace_branchSelector_refreshBranches_ariaLabel());qe(zn,{onclick:Zi,variant:"ghost",size:"icon-sm",class:"ml-auto shrink-0",get disabled(){return l(ke)},get"aria-label"(){return l(Cn)},children:(on,fr)=>{tt(on,{get icon(){return Pp},class:"size-3.5!"})},$$slots:{default:!0}})}Y(Sn),x(tn,Sn)};j(Is,tn=>{oe()||tn(Vs)})}x(ir,wr)};j(ri,ir=>{l(mt)&&l(fe)?ir(Ja):ir(Xa,-1)})}Y(xs),sr(xs,ir=>k(we,ir),()=>l(we));var Io=A(xs,2);{var Ya=ir=>{var wr=zN(),zr=ne(wr),ks=ne(zr);{const dr=Vs=>{{let tn=w(()=>l(mt)?Qs:lx);tt(Vs,{get icon(){return l(tn)},class:"size-4! text-subtle"})}},kt=(Vs,tn)=>{let Sn=()=>(tn?.()).labelId,Qn=()=>(tn?.()).descriptionId;{let zn=w(()=>`${t}-isolation`),Cn=w(()=>!X());wv(Vs,{get id(){return l(zn)},get checked(){return l(Cn)},get ariaLabelledby(){return Sn()},get ariaDescribedby(){return Qn()},class:"dark:[&_[data-switch-thumb][data-state=unchecked]]:bg-foreground",onCheckedChange:us,get ref(){return l(Ce)},set ref(on){k(Ce,on,!0)}})}};let qt=w(()=>`${t}-isolation-row`),wn=w(()=>`${t}-isolation`),or=w(()=>_.workspace_branchSelector_isolation_label({isolationLabel:yt})),Is=w(()=>l(mt)?_.workspace_branchSelector_isolationOff_description():_.workspace_branchSelector_isolationOn_description());jx(ks,{get id(){return l(qt)},get htmlFor(){return l(wn)},activateLabel:!0,get label(){return l(or)},get description(){return l(Is)},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:dr,control:kt,$$slots:{leading:!0,control:!0}})}var Fr=A(ks,2);{var Ps=dr=>{var kt=BN(),qt=se(kt,!0);L(wn=>H(qt,wn),[()=>_.workspace_branchSelector_directWarning_description()]),x(dr,kt)};j(Fr,dr=>{l(mt)&&dr(Ps)})}Y(zr),Y(wr),x(ir,wr)};j(Io,ir=>{O()==="local"&&typeof re()=="function"&&l(fe)&&ir(Ya)})}L(()=>{at(xs,1,`flex flex-col transition-none ${l(Ve)?"shrink-0":"flex-1"} ${l(Mt)?"min-h-52":"min-h-0"}`),ni=Gi(xs,"",ni,{height:l(Ve)?`${l(Ve)}px`:void 0})}),x(un,ti)},$$slots:{default:!0}})})}x(Et,Zt)},$$slots:{default:!0}})}),Y(Oe),sr(Oe,Ct=>k(nt,Ct),()=>l(nt)),x(J,Oe)};j(lc,J=>{E()?J(ys):J(ga,-1)})}x(n,Ci);var cc=Lt(pa);return a(),cc}var UN=B('<p class="type-caption text-muted-foreground px-2 py-1" role="status"> </p>');function Jf(n,e){if(new.target)return Ot({component:Jf,...n});It(e,!0);const t=()=>rn(a,"$member$",s),r=()=>rn(c,"$execution$",s),[s,i]=ja();let o=y(e,"kind",7,"git-policy");const a=Yf(),c=o1(),u=w(()=>t()?o()==="ai"?_.hostExecution_providerSetup_description():o()==="repository"?r()&&!r().repositoryConnections.some(m=>m.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(m="git-policy"){o(m),b()},$set:Nt,$on:(m,v)=>Dt(e,m,v)},f=Ze(),h=ue(f);{var p=m=>{var v=UN(),C=se(v,!0);L(()=>H(C,l(u))),x(m,v)};j(h,m=>{l(u)&&m(p)})}x(n,f);var g=Lt(d);return i(),g}var VN=B('<div class="grid grid-cols-[minmax(0,1fr)_5rem] gap-3"><div><!> <!></div> <div><!> <!></div></div>'),WN=B("<div><!> <!></div>"),jN=B("<!> <!> <!>",1),KN=B('<div class="space-y-3"><h3 class="text-sm font-medium"> </h3> <!> <!> <!></div>'),GN=B('<div class="type-caption text-subtle"><p> </p></div>'),qN=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 dw(n,e){if(new.target)return Ot({component:dw,...n});It(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=da("AddRemoteSetupModal");let c=he(Sr(o()?.name??"")),u=he("ssh"),d=he(Sr(o()?.host??"")),f=he(Sr(o()?.port??22)),h=he(Sr(o()?.wsUrl??"")),p=he(Sr(o()?.username??"")),g=he(""),m=he(""),v=he("agent"),C=he(Sr(o()?.workspacePath??"")),z=he(Sr(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(v)==="agent"||l(v)==="keyfile"&&l(m).trim()!==""||l(v)==="password"&&l(g).trim()!==""));function O(){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(v)==="password"?l(g).trim():void 0,keyPath:l(v)==="keyfile"?l(m).trim():void 0,useAgent:l(v)==="agent",workspacePath:l(C).trim(),transport:l(u),wsUrl:l(u)==="websocket"?l(h).trim():void 0,branch:l(z).trim()||void 0};a.info("Saving new remote setup",{name:F.name,transport:F.transport}),s()(F),N(),r()()}function N(){k(c,""),k(u,"ssh"),k(d,""),k(f,22),k(h,""),k(p,""),k(g,""),k(m,""),k(v,"agent"),k(C,""),k(z,"main"),k(M,"")}function E(){N(),r()()}var D={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:Nt,$on:(F,W)=>Dt(e,F,W)},ee=Ze(),U=ue(ee);{var oe=F=>{{let W=w(()=>_.workspace_addRemoteSetupModal_title()),X=w(()=>_.workspace_addRemoteSetupModal_close_ariaLabel()),le=w(()=>_.workspace_addRemoteSetupModal_addSetup_label()),re=w(()=>_.workspace_addRemoteSetupModal_cancel_label());m_(F,{get open(){return t()},get static(){return i()},get title(){return l(W)},get closeLabel(){return l(X)},get submitLabel(){return l(le)},get cancelLabel(){return l(re)},size:"lg",get canSubmit(){return l(S)},onSubmit:O,onCancel:E,children:(Q,me)=>{var P=qN(),$=ne(P),ce=ne($);Bo(ce,{for:"name",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_setupName_label()]),x(Ce,Ve)},$$slots:{default:!0}});var pe=A(ce,2);{let Ce=w(()=>_.workspace_addRemoteSetupModal_setupName_placeholder());ss(pe,{id:"name",get placeholder(){return l(Ce)},class:"mt-1",get value(){return l(c)},set value(we){k(c,we,!0)}})}Y($);var ye=A($,2),Z=ne(ye),ae=se(Z,!0),V=A(Z,2),K=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");qe(K,{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"&&(N(),k(u,"ssh"))},children:(Ve,Mt)=>{Pt();var ie=zt("SSH");x(Ve,ie)},$$slots:{default:!0}})}var I=A(K,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");qe(I,{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"&&(N(),k(u,"websocket"))},children:(Ve,Mt)=>{Pt();var ie=zt("WebSocket");x(Ve,ie)},$$slots:{default:!0}})}Y(V);var te=A(V,2);{var ve=Ce=>{var we=VN(),Ve=ne(we),Mt=ne(Ve);Bo(Mt,{for:"host",children:(mt,Tt)=>{Pt();var We=zt();L(Ke=>H(We,Ke),[()=>_.workspace_addRemoteSetupModal_host_label()]),x(mt,We)},$$slots:{default:!0}});var ie=A(Mt,2);ss(ie,{id:"host",placeholder:"dev.example.com",class:"mt-1",get value(){return l(d)},set value(mt){k(d,mt,!0)}}),Y(Ve);var $e=A(Ve,2),lt=ne($e);Bo(lt,{for:"port",children:(mt,Tt)=>{Pt();var We=zt();L(Ke=>H(We,Ke),[()=>_.workspace_addRemoteSetupModal_port_label()]),x(mt,We)},$$slots:{default:!0}});var yt=A(lt,2);ss(yt,{id:"port",type:"number",placeholder:"22",class:"mt-1",get value(){return l(f)},set value(mt){k(f,mt,!0)}}),Y($e),Y(we),x(Ce,we)},de=Ce=>{var we=WN(),Ve=ne(we);Bo(Ve,{for:"wsUrl",children:(ie,$e)=>{Pt();var lt=zt();L(yt=>H(lt,yt),[()=>_.workspace_addRemoteSetupModal_wsUrl_label()]),x(ie,lt)},$$slots:{default:!0}});var Mt=A(Ve,2);ss(Mt,{id:"wsUrl",placeholder:"wss://dev.example.com/ws",class:"mt-1",get value(){return l(h)},set value(ie){k(h,ie,!0)}}),Y(we),x(Ce,we)};j(te,Ce=>{l(u)==="ssh"?Ce(ve):Ce(de,-1)})}var fe=A(te,2),ke=ne(fe);Bo(ke,{for:"username",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_username_label()]),x(Ce,Ve)},$$slots:{default:!0}});var be=A(ke,2);ss(be,{id:"username",placeholder:"john",class:"mt-1",get value(){return l(p)},set value(Ce){k(p,Ce,!0)}}),Y(fe),Y(ye);var q=A(ye,2);{var Me=Ce=>{var we=KN(),Ve=ne(we),Mt=se(Ve,!0),ie=A(Ve,2),$e=()=>l(v),lt=Ke=>{(Ke==="agent"||Ke==="keyfile"||Ke==="password")&&k(v,Ke,!0)};{let Ke=w(()=>_.workspace_addRemoteSetupModal_authentication_label());wt(ie,()=>Iv,(Qt,Be)=>{Be(Qt,{type:"single",get value(){return $e()},set value(jt){lt(jt)},get"aria-label"(){return l(Ke)},variant:"outline",class:"flex w-full",children:(jt,Yn)=>{var Bn=jN(),ge=ue(Bn);wt(ge,()=>kl,(ln,Gt)=>{Gt(ln,{value:"agent",class:"min-w-0 flex-1",onclick:ut=>{l(v)==="agent"&&ut.preventDefault()},onkeydown:ut=>{l(v)==="agent"&&["Enter"," "].includes(ut.key)&&ut.preventDefault()},children:(ut,ht)=>{Pt();var Ie=zt();L(He=>H(Ie,He),[()=>_.workspace_addRemoteSetupModal_sshAgent_label()]),x(ut,Ie)},$$slots:{default:!0}})});var ft=A(ge,2);wt(ft,()=>kl,(ln,Gt)=>{Gt(ln,{value:"keyfile",class:"min-w-0 flex-1",onclick:ut=>{l(v)==="keyfile"&&ut.preventDefault()},onkeydown:ut=>{l(v)==="keyfile"&&["Enter"," "].includes(ut.key)&&ut.preventDefault()},children:(ut,ht)=>{Pt();var Ie=zt();L(He=>H(Ie,He),[()=>_.workspace_addRemoteSetupModal_keyFile_label()]),x(ut,Ie)},$$slots:{default:!0}})});var Rt=A(ft,2);wt(Rt,()=>kl,(ln,Gt)=>{Gt(ln,{value:"password",class:"min-w-0 flex-1",onclick:ut=>{l(v)==="password"&&ut.preventDefault()},onkeydown:ut=>{l(v)==="password"&&["Enter"," "].includes(ut.key)&&ut.preventDefault()},children:(ut,ht)=>{Pt();var Ie=zt();L(He=>H(Ie,He),[()=>_.workspace_addRemoteSetupModal_password_label()]),x(ut,Ie)},$$slots:{default:!0}})}),x(jt,Bn)},$$slots:{default:!0}})})}var yt=A(ie,2);{var mt=Ke=>{const Qt=w(()=>"~/.ssh/id_rsa");{let Be=w(()=>_.workspace_addRemoteSetupModal_keyFile_label());ss(Ke,{placeholder:l(Qt),get"aria-label"(){return l(Be)},get value(){return l(m)},set value(jt){k(m,jt,!0)}})}};j(yt,Ke=>{l(v)==="keyfile"&&Ke(mt)})}var Tt=A(yt,2);{var We=Ke=>{{let Qt=w(()=>_.workspace_addRemoteSetupModal_password_label());ss(Ke,{type:"password",placeholder:"••••••••",get"aria-label"(){return l(Qt)},get value(){return l(g)},set value(Be){k(g,Be,!0)}})}};j(Tt,Ke=>{l(v)==="password"&&Ke(We)})}Y(we),L(Ke=>H(Mt,Ke),[()=>_.workspace_addRemoteSetupModal_authentication_label()]),x(Ce,we)},ze=Ce=>{var we=GN(),Ve=ne(we),Mt=se(Ve,!0);Y(we),L(ie=>H(Mt,ie),[()=>_.workspace_addRemoteSetupModal_websocketAuth_description()]),x(Ce,we)};j(q,Ce=>{l(u)==="ssh"?Ce(Me):Ce(ze,-1)})}var gt=A(q,2),Le=ne(gt);Bo(Le,{for:"workspacePath",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_repoPath_label()]),x(Ce,Ve)},$$slots:{default:!0}});var De=A(Le,2);ss(De,{id:"workspacePath",placeholder:"/home/user/myrepo",class:"mt-1",get value(){return l(C)},set value(Ce){k(C,Ce,!0)}}),Y(gt);var Fe=A(gt,2),vt=ne(Fe);Bo(vt,{for:"branch",children:(Ce,we)=>{Pt();var Ve=zt();L(Mt=>H(Ve,Mt),[()=>_.workspace_addRemoteSetupModal_branch_label()]),x(Ce,Ve)},$$slots:{default:!0}});var Vt=A(vt,2);ss(Vt,{id:"branch",placeholder:"main",class:"mt-1",get value(){return l(z)},set value(Ce){k(z,Ce,!0)}}),Y(Fe);var nt=A(Fe,2);{var Pe=Ce=>{gk(Ce,{tone:"error",children:(we,Ve)=>{Pt();var Mt=zt();L(()=>H(Mt,l(M))),x(we,Mt)},$$slots:{default:!0}})};j(nt,Ce=>{l(M)&&Ce(Pe)})}Y(P),L(Ce=>H(ae,Ce),[()=>_.workspace_addRemoteSetupModal_connectionDetails_label()]),x(Q,P)},$$slots:{default:!0}})}};j(U,F=>{t()&&F(oe)})}return x(n,ee),Lt(D)}var JN=new Set(["$$slots","$$events","$$legacy","owner","name","suffix","provider","avatarUrl","local","showOwner","showForge","recent","option","selected","formStyle","checked","class"]),XN=B('<span class="text-subtle mr-1"> </span>'),YN=B('<span class="text-subtle ml-1"> </span>'),QN=B('<span role="img" class="text-subtle shrink-0"><!></span>'),ZN=B('<span><span class="truncate"><!> <!></span> <!></span>');function sp(n,e){if(new.target)return Ot({component:sp,...n});It(e,!0);const t=S=>{var O=Ze(),N=ue(O);{var E=D=>{{let ee=w(()=>Cr(dn.check,"self-center"));Av(D,{state:"checked",get class(){return l(ee)}})}};j(N,D=>{(m()??p())&&D(E)})}x(S,O)};let r=y(e,"owner",7),s=y(e,"name",7),i=y(e,"suffix",7),o=y(e,"provider",7),a=y(e,"avatarUrl",7),c=y(e,"local",7,!1),u=y(e,"showOwner",7,!0),d=y(e,"showForge",7,!1),f=y(e,"recent",7,!1),h=y(e,"option",7,!1),p=y(e,"selected",7,!1),g=y(e,"formStyle",7,!1),m=y(e,"checked",7),v=y(e,"class",7,""),C=Yi(e,JN);const z={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 m()},set checked(S){m(S),b()},get class(){return v()},set class(S=""){v(S),b()},$set:Nt,$on:(S,O)=>Dt(e,S,O)};{const S=ee=>{{let U=w(()=>g()?20:16);hh(ee,{get owner(){return r()},get provider(){return o()},get avatarUrl(){return a()},get local(){return c()},get size(){return l(U)}})}},O=ee=>{var U=ZN(),oe=ne(U),F=ne(oe);{var W=P=>{var $=XN(),ce=se($);L(()=>H(ce,`${r()??""} /`)),x(P,$)};j(F,P=>{u()&&r()&&P(W)})}var X=A(F),le=A(X);{var re=P=>{var $=YN(),ce=se($);L(()=>H(ce,`(${i()??""})`)),x(P,$)};j(le,P=>{i()&&P(re)})}Y(oe);var Q=A(oe,2);{var me=P=>{var $=QN(),ce=ne($);{let pe=w(()=>o()==="github"?Qf:Zf);tt(ce,{get icon(){return l(pe)},size:12})}Y($),L(()=>st($,"aria-label",z[o()])),x(P,$)};j(Q,P=>{d()&&o()&&!g()&&P(me)})}Y(U),L(()=>{at(U,1,`flex min-w-0 items-center gap-2 ${g()?"":"text-sm"}`),st(oe,"data-recent-repo-label",f()?"":void 0),H(X,` ${s()??""} `)}),x(ee,U)};let N=w(()=>g()?t:void 0),E=w(()=>h()?"option":void 0),D=w(()=>g()?Cr(dn.row,"cursor-pointer focus-visible:outline-none [--menu-icon-size:1.25rem]",v()):`gap-2 py-1.5 cursor-pointer ${v()}`);Nv(n,ms(()=>C,{get trailing(){return l(N)},get role(){return l(E)},get selected(){return p()},get class(){return l(D)},leading:S,title:O,$$slots:{leading:!0,title:!0}}))}return Lt(M)}var eD=B('<p class="mt-1"> </p>'),tD=B('<div role="alert" class="mt-2 px-1 text-sm text-subtle"><div class="flex items-center gap-2"><span> </span> <!></div> <!></div>'),nD=B('<div role="status"><!><span> </span></div>'),rD=B('<div role="listbox"></div>'),sD=B("<p> </p>");function ip(n,e){const t=Ji();if(new.target)return Ot({component:ip,...n});It(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),m=y(e,"detail",7),v=y(e,"retryLabel",7),C=y(e,"onRetry",7),z=y(e,"onSelect",7),M=y(e,"selectedKey",7),S=y(e,"activeIndex",31,()=>-1),O=y(e,"scrollable",7,!0),N=y(e,"formStyle",7,!1),E=he(void 0),D="",ee=0;ct(()=>{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 oe(P,$,ce){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:ce+(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 pe=Date.now();D=pe-ee>500?P.key:D+P.key,ee=pe;for(let ye=1;ye<=s().length;ye+=1){const Z=(ce+ye)%s().length;if(`${o()(s()[Z])}/${a()(s()[Z])}`.toLowerCase().startsWith(D.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 m()},set detail(P){m(P),b()},get retryLabel(){return v()},set retryLabel(P){v(P),b()},get onRetry(){return C()},set onRetry(P){C(P),b()},get onSelect(){return z()},set onSelect(P){z(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 O()},set scrollable(P=!0){O(P),b()},get formStyle(){return N()},set formStyle(P=!1){N(P),b()},$set:Nt,$on:(P,$)=>Dt(e,P,$)},W=Ze(),X=ue(W);{var le=P=>{var $=tD(),ce=ne($),pe=ne(ce),ye=se(pe,!0),Z=A(pe,2);{var ae=I=>{qe(I,{variant:"ghost",type:"button",class:"underline underline-offset-2 cursor-pointer hover:no-underline",get onclick(){return C()},children:(te,ve)=>{Pt();var de=zt();L(()=>H(de,v())),x(te,de)},$$slots:{default:!0}})};j(Z,I=>{C()&&v()&&I(ae)})}Y(ce);var V=A(ce,2);{var K=I=>{var te=eD(),ve=se(te,!0);L(()=>H(ve,m())),x(I,te)};j(V,I=>{m()&&I(K)})}Y($),L(()=>H(ye,g())),x(P,$)},re=P=>{var $=nD(),ce=ne($);fi(ce,{size:12});var pe=A(ce),ye=se(pe,!0);Y($),L(()=>{st($,"aria-label",h()),at($,1,`mt-2 flex items-center gap-2 ${N()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),H(ye,h())}),x(P,$)},Q=P=>{var $=rD();is($,23,s,ce=>i()(ce),(ce,pe,ye)=>{{let Z=w(()=>`${r()}-${l(ye)}`),ae=w(()=>`${o()(l(pe))}/${a()(l(pe))}`),V=w(()=>l(ye)===Math.max(0,S())?0:-1),K=w(()=>M()?i()(l(pe))===M():l(ye)===S()),I=w(()=>l(ye)===S()||i()(l(pe))===M()),te=w(()=>i()(l(pe))===M()),ve=w(()=>o()(l(pe))),de=w(()=>a()(l(pe))),fe=w(()=>c()?.(l(pe)));sp(ce,{get id(){return l(Z)},option:!0,get"aria-label"(){return l(ae)},get tabindex(){return l(V)},get"aria-selected"(){return l(K)},get selected(){return l(I)},get checked(){return l(te)},get formStyle(){return N()},get owner(){return l(ve)},get name(){return l(de)},get avatarUrl(){return l(fe)},get provider(){return u()},onclick:()=>z()(l(pe)),onmousemove:()=>S(l(ye)),onfocus:()=>S(l(ye)),onkeydown:ke=>oe(ke,l(pe),l(ye))})}}),Y($),sr($,ce=>k(E,ce),()=>l(E)),L(()=>{st($,"id",r()),st($,"aria-label",d()),at($,1,$n(O()?"mt-2 max-h-56 overflow-y-auto":"mt-2"))}),x(P,$)},me=P=>{var $=sD(),ce=se($,!0);L(()=>{at($,1,`mt-2 ${N()?"type-body px-3 py-2 text-muted-foreground":"px-1 text-sm text-subtle"}`),H(ce,p())}),x(P,$)};j(X,P=>{g()?P(le):f()?P(re,1):s().length?P(Q,2):P(me,-1)})}return x(n,W),Lt(F)}var iD=B('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),oD=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 fw(n,e){if(new.target)return Ot({component:fw,...n});It(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),m=y(e,"scrollable",7,!0),v=y(e,"formStyle",7,!1),C=he(void 0);function z(Q){if(Q.key!=="ArrowDown"||Q.isComposing)return;const me=l(C)?.querySelector('[role="option"]');me&&(Q.preventDefault(),Q.stopPropagation(),me.focus())}var M={get selectedProjectPath(){return t()},set selectedProjectPath(Q){t(Q),b()},get onSelect(){return r()},set onSelect(Q){r(Q),b()},get scopeKey(){return s()},set scopeKey(Q){s(Q),b()},get prefix(){return i()},set prefix(Q){i(Q),b()},get instanceBaseUrl(){return o()},set instanceBaseUrl(Q){o(Q),b()},get query(){return a()},set query(Q){a(Q),b()},get page(){return c()},set page(Q){c(Q),b()},get copy(){return u()},set copy(Q){u(Q),b()},get onSearch(){return d()},set onSearch(Q){d(Q),b()},get onSubmit(){return f()},set onSubmit(Q){f(Q),b()},get submitLabel(){return h()},set submitLabel(Q){h(Q),b()},get onMore(){return p()},set onMore(Q){p(Q),b()},get onRecover(){return g()},set onRecover(Q){g(Q),b()},get scrollable(){return m()},set scrollable(Q=!0){m(Q),b()},get formStyle(){return v()},set formStyle(Q=!1){v(Q),b()},$set:Nt,$on:(Q,me)=>Dt(e,Q,me)},S=oD(),O=ne(S);{var N=Q=>{var me=iD(),P=se(me,!0);L(()=>H(P,o())),x(Q,me)};j(O,Q=>{o()&&!i()&&Q(N)})}var E=A(O,2),D=ne(E);{var ee=Q=>{var me=Ze(),P=ue(me);Xn(P,i),x(Q,me)};j(D,Q=>{i()&&Q(ee)})}var U=A(D,2);{var oe=Q=>{{let me=w(()=>!s());ss(Q,{type:"search",get"aria-label"(){return u().searchLabel},get value(){return a()},get disabled(){return l(me)},get placeholder(){return u().searchPlaceholder},oninput:P=>d()(P.currentTarget.value,s()),onkeydown:z,class:"min-w-0 bg-sidebar border-none px-1 py-2.5! h-auto text-sm",noFocusStyle:!0})}};j(U,Q=>{c().status!=="unavailable"&&Q(oe)})}Y(E);var F=A(E,2);{var W=Q=>{{let me=w(()=>!a().trim()||c().status==="loading"||c().loadingMore);qe(Q,{type:"button",variant:"secondary",class:"mt-2 w-full",get disabled(){return l(me)},onclick:()=>f()?.(a(),s()),children:(P,$)=>{Pt();var ce=zt();L(()=>H(ce,h())),x(P,ce)},$$slots:{default:!0}})}};j(F,Q=>{c().status!=="unavailable"&&f()&&h()&&Q(W)})}var X=A(F,2);dh(X,s,Q=>{{let me=w(()=>c().status==="ready"?c().items:[]),P=w(()=>c().status==="loading"),$=w(()=>a()?u().emptySearchLabel:u().emptyLabel),ce=w(()=>c().status==="unavailable"?c().message:void 0),pe=w(()=>c().status==="unavailable"?c().detail:void 0),ye=w(()=>c().status==="unavailable"?c().actionLabel:void 0),Z=w(()=>g()?()=>g()?.(s()):void 0);ip(Q,{get items(){return l(me)},getKey:ae=>ae.projectPath,getOwner:ae=>ae.projectPath.split("/").slice(0,-1).join("/"),getName:ae=>ae.projectPath.split("/").at(-1)??ae.name,getAvatarUrl:ae=>ae.ownerAvatarUrl,provider:"gitlab",get scrollable(){return m()},get formStyle(){return v()},get label(){return u().listLabel},get loading(){return l(P)},get loadingLabel(){return u().loadingLabel},get emptyLabel(){return l($)},get error(){return l(ce)},get detail(){return l(pe)},get retryLabel(){return l(ye)},get onRetry(){return l(Z)},get selectedKey(){return t()},onSelect:ae=>r()(ae.projectPath,s())})}});var le=A(X,2);{var re=Q=>{qe(Q,{type:"button",variant:"ghost",class:"mt-2 w-full",get disabled(){return c().loadingMore},onclick:()=>p()(s()),children:(me,P)=>{Pt();var $=zt();L(()=>H($,c().loadingMore?u().loadingMoreLabel:u().loadMoreLabel)),x(me,$)},$$slots:{default:!0}})};j(le,Q=>{c().status==="ready"&&(c().hasMore||c().loadingMore)&&Q(re)})}return Y(S),sr(S,Q=>k(C,Q),()=>l(C)),x(n,S),Lt(M)}var aD=B('<div class="py-2 px-2 flex items-center gap-2 text-xs text-emerald-500"><!> <span> </span></div>'),Wm=B("<!> <span> </span>",1),lD=B('<div class="py-2 px-2 space-y-2"><p class="text-xs text-danger"> </p> <!></div>'),cD=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>'),uD=B("<!> <span> </span> <!>",1),dD=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>'),fD=B('<div class="py-2 px-2 flex items-center gap-2 text-xs text-subtle"><!> <span> </span></div>'),hD=B('<p class="type-caption whitespace-normal text-muted-foreground"> </p>'),pD=B('<div class="first-line-icon type-caption"><!></div> <div class="flex-1 min-w-0"><p> </p> <!></div>',1),jm=B("<div><!></div>");function hw(n,e){if(new.target)return Ot({component:hw,...n});It(e,!0);const t=()=>rn(g,"$isAuthenticated$",a),r=()=>rn(m,"$isAuthenticating$",a),s=()=>rn(v,"$deviceFlow$",a),i=()=>rn(C,"$error$",a),o=()=>rn(z,"$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(),m=s_(),v=i_(),C=o_(),z=a_();let M=he(!1),S=he(!1),O=he(!1);Fu(()=>{At.dispatch(af()),p()&&N()});function N(){k(M,!0),At.dispatch(Ck())}function E(){l(M)&&(At.dispatch(zp()),k(M,!1))}function D(){At.dispatch(Mk()),N()}function ee(){k(M,!1),k(O,!0),setTimeout(()=>{k(O,!1),typeof f()=="function"&&f()()},1e3)}async function U(){if(l(M)){if(t()){ee();return}k(S,!0);try{await wx.isAuthenticated()&&(At.dispatch(af()),ee())}catch{}finally{k(S,!1)}}}ct(()=>{!l(M)&&r()&&s()&&k(M,!0)}),ct(()=>{l(M)&&t()&&ee()}),ct(()=>{if(!l(M)||!s())return;const Z=()=>{U()};return window.addEventListener("focus",Z),()=>{window.removeEventListener("focus",Z)}}),tc(()=>{l(M)&&r()&&At.dispatch(zp())});const oe=w(()=>l(M)&&r()),F=w(()=>l(M)&&s()),W=w(()=>l(M)&&i());var X={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:Nt,$on:(Z,ae)=>Dt(e,Z,ae)},le=jm(),re=ne(le);{var Q=Z=>{var ae=aD(),V=ne(ae);tt(V,{get icon(){return pv},size:"xs"});var K=A(V,2),I=se(K,!0);Y(ae),L(te=>H(I,te),[()=>_.lib_githubAuth_connected_label()]),Ts(3,ae,()=>Fo,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},me=Z=>{var ae=lD(),V=ne(ae),K=se(V,!0),I=A(V,2);qe(I,{variant:"outline",size:"xs",onclick:D,children:(te,ve)=>{var de=Wm(),fe=ue(de);tt(fe,{get icon(){return eh},size:"xs"});var ke=A(fe,2),be=se(ke,!0);L(q=>H(be,q),[()=>_.lib_githubAuth_tryAgain_label()]),x(te,de)},$$slots:{default:!0}}),Y(ae),L(()=>H(K,i())),Ts(3,ae,()=>Fo,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},P=Z=>{var ae=cD(),V=ne(ae),K=se(V,!0),I=A(V,2),te=ne(I),ve=A(te,2);Y(I),Y(ae),L((de,fe,ke)=>{H(K,de),H(te,`${fe??""} `),H(ve,` ${ke??""}`)},[()=>_.lib_githubAuth_daemonAuthFirst_message(),()=>_.lib_githubAuth_run_before(),()=>_.lib_githubAuth_inYourTerminal_after()]),Ts(3,ae,()=>Fo,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},$=Z=>{var ae=dD(),V=ne(ae),K=ne(V),I=se(K,!0),te=A(K,2);{let q=w(()=>_.lib_githubAuth_closeModal_ariaLabel());qe(te,{variant:"ghost-light",size:"icon-xs",class:"-mt-2 -mr-2",onclick:E,get"aria-label"(){return l(q)},children:(Me,ze)=>{tt(Me,{get icon(){return Ki},size:"xs"})},$$slots:{default:!0}})}Y(V);var ve=A(V,2);Jk(ve,{get userCode(){return s().userCode},get verificationUri(){return s().verificationUri},compact:!0});var de=A(ve,2),fe=ne(de);{var ke=q=>{var Me=Wm(),ze=ue(Me);fi(ze,{size:12});var gt=A(ze,2),Le=se(gt,!0);L(De=>H(Le,De),[()=>_.lib_githubAuth_checking_label()]),x(q,Me)},be=q=>{var Me=uD(),ze=ue(Me);fi(ze,{size:12});var gt=A(ze,2),Le=se(gt,!0),De=A(gt,2);qe(De,{type:"button",class:"cursor-pointer underline underline-offset-2 decoration-muted-foreground/20",onclick:U,children:(Fe,vt)=>{Pt();var Vt=zt();L(nt=>H(Vt,nt),[()=>_.lib_githubAuth_checkNow_label()]),x(Fe,Vt)},$$slots:{default:!0}}),L(Fe=>H(Le,Fe),[()=>_.lib_githubAuth_waitingForAuthorization_label()]),x(q,Me)};j(fe,q=>{l(S)?q(ke):q(be,-1)})}Y(de),Y(ae),L(q=>H(I,q),[()=>_.lib_githubAuth_enterCode_label()]),Ts(3,ae,()=>Fo,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},ce=Z=>{var ae=fD(),V=ne(ae);fi(V,{size:12});var K=A(V,2),I=se(K,!0);Y(ae),L(te=>H(I,te),[()=>_.lib_githubAuth_startingAuthentication_label()]),Ts(3,ae,()=>Fo,()=>({axis:"y",tier:"moderate"})),x(Z,ae)},pe=Z=>{var ae=jm(),V=ne(ae);{let K=w(()=>d()?"h-8":"h-auto items-start py-2");qe(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(K)??""}`},onclick:N,children:(I,te)=>{var ve=pD(),de=ue(ve),fe=ne(de);ph(fe,{size:16,class:"text-ghost"}),Y(de);var ke=A(de,2),be=ne(ke),q=se(be,!0),Me=A(be,2);{var ze=gt=>{var Le=hD(),De=se(Le,!0);L(Fe=>H(De,Fe),[()=>_.lib_githubAuth_enables_description()]),x(gt,Le)};j(Me,gt=>{d()||gt(ze)})}Y(ke),L(()=>{at(be,1,`type-caption font-normal ${d()?"truncate":"whitespace-normal"}`),H(q,u())}),x(I,ve)},$$slots:{default:!0}})}Y(ae),Ts(3,ae,()=>Fo,()=>({axis:"y",tier:"moderate"})),x(Z,ae)};j(re,Z=>{l(O)?Z(Q):l(W)?Z(me,1):o()?Z(P,2):l(F)&&s()?Z($,3):l(oe)?Z(ce,4):Z(pe,-1)})}Y(le),L(()=>at(le,1,`min-w-0 rounded-sm ${d()?"":"bg-sidebar"} ${h()??""}`)),x(n,le);var ye=Lt(X);return c(),ye}function gD(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 mD=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 pw(n,e){if(new.target)return Ot({component:pw,...n});It(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(()=>gD(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:Nt,$on:(M,S)=>Dt(e,M,S)},h=mD(),p=ne(h);{let M=w(()=>`${d}-switch`),S=w(()=>`${d}-label`),O=w(()=>`${d}-description`);wv(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(O)},onCheckedChange:N=>s()(N)})}var g=A(p,2),m=ne(g),v=se(m,!0),C=A(m,2),z=se(C,!0);return Y(g),Y(h),L(()=>{at(h,1,`flex min-w-0 items-start gap-2.5 ${o()??""}`),st(m,"id",`${d}-label`),st(m,"for",`${d}-switch`),H(v,l(c)),st(C,"id",`${d}-description`),H(z,l(u))}),x(n,h),Lt(f)}function vD(n){return n.githubConnected||n.gitlabConnected||n.githubFailed||n.gitlabFailed?!0:!n.githubSettled||!n.gitlabSettled}function bD(n){return n.plainFoldersOffered?n.selected?n.selected:n.hasGitRepositoryEntry?"codebase":n.forgeState==="none"||n.hasPlainFolderEntry?"folder":"codebase":"codebase"}function yD(n){return n.githubConnected||n.gitlabConnected?"connected":n.githubFailed||!n.githubSettled||n.gitlabFailed||!n.gitlabSettled?"unknown":"none"}const wD=At.createSelector(n=>n.userPreferences?.labsPlainFolderWorkspacesEnabled===!0&&xx(n.daemonHealth?.stats?.protocolVersion)),xB=At.createSelector(n=>{const e=n.workspace?.workspaces?oh(n.workspace.workspaces).filter(s=>s.id!==Tk):[],t=n.gitlabAuth?.statusFailed===!0,r=kx({rememberedChoice:null,workspacesLoaded:n.workspace?.hasLoaded===!0,hasGitWorkspace:_x(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"}),xD=At.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return vD({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})}),kD=At.createSelector(n=>{const e=n.gitlabAuth?.statusFailed===!0;return yD({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})}),_D=At.createSelector(n=>n.githubRepos.repos),SD=At.createSelector(n=>oh(_D.select(n))),CD=At.createSelector(n=>n.githubRepos.loading),MD=At.createSelector(n=>n.githubRepos.error),TD=At.createSelector(n=>n.githubRepos.loaded),ED=At.createSelector(n=>n.githubRepoSearch.results),AD=At.createSelector(n=>oh(ED.select(n))),RD=At.createSelector(n=>n.githubRepoSearch.loading),PD=At.createSelector(n=>n.githubRepoSearch.lastQuery);var ID=B('<p class="type-caption text-muted-foreground"> </p>'),LD=B('<div class="flex flex-col gap-0.5" data-testid="import-session-provider-notes"></div>'),OD=B('<!> <span class="whitespace-nowrap"> </span>',1),ND=B("<!> <!>",1),DD=B('<div class="shrink-0 overflow-x-auto px-2 pt-2" data-testid="import-session-provider-filter"><!></div>'),$D=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>'),BD=B('<span aria-hidden="true">·</span> <time class="shrink-0"> </time>',1),zD=B('<span aria-hidden="true">·</span> <span class="min-w-0 shrink truncate" data-testid="import-session-disabled-reason"> </span>',1),FD=B('<span aria-hidden="true">·</span> <span class="min-w-0 max-w-1/3 shrink truncate"> </span>',1),HD=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>'),UD=B('<div class="flex min-h-0 flex-1 flex-col" data-testid="import-session-list"><!> <!></div>');function gw(n,e){if(new.target)return Ot({component:gw,...n});It(e,!0);const t=P=>{var $=LD();is($,21,()=>l(E),ce=>ce.id,(ce,pe)=>{var ye=ID(),Z=se(ye,!0);L(ae=>H(Z,ae),[()=>_.sessionImport_list_providerFailed_note({provider:l(pe).label})]),x(ce,ye)}),Y($),x(P,$)};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),m=y(e,"disabledReason",7),v=y(e,"selectedKey",7,""),C=y(e,"interactionRoot",7,null),z=he(null);function M(P){const $=C()??l(z);P.target instanceof Node&&$?.contains(P.target)&&P.preventDefault()}const S=P=>`session:${P}`;function O(P){return{value:S(Mv(P)),disabled:!!m()?.(P),label:P.title.trim()||_.sessionImport_list_untitled_label(),description:hN(P),data:P}}const N=w(()=>d().filter(P=>P.status==="ok")),E=w(()=>d().filter(P=>P.status==="error")),D=w(()=>s().filter(P=>!f()||P.provider===f()).map(O));function ee(P){return d().find($=>$.id===P)?.label??u()?.(P)??P}let U=he("");function oe(P){if(P.updatedAt===null)return null;const $=new Date(P.updatedAt);return Number.isNaN($.getTime())?null:$}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 m()},set disabledReason(P){m(P),b()},get selectedKey(){return v()},set selectedKey(P=""){v(P),b()},get interactionRoot(){return C()},set interactionRoot(P=null){C(P),b()},$set:Nt,$on:(P,$)=>Dt(e,P,$)},W=UD(),X=ne(W);{var le=P=>{var $=DD(),ce=ne($);{let pe=w(()=>f()||"all"),ye=w(()=>_.sessionImport_list_providerFilter_ariaLabel());wt(ce,()=>Iv,(Z,ae)=>{ae(Z,{type:"single",variant:"flat",get value(){return l(pe)},onValueChange:V=>h()?.(!V||V==="all"?"":V),get"aria-label"(){return l(ye)},children:(V,K)=>{var I=ND(),te=ue(I);wt(te,()=>kl,(de,fe)=>{fe(de,{value:"all",class:"type-caption h-7 px-2",children:(ke,be)=>{Pt();var q=zt();L(Me=>H(q,Me),[()=>_.sessionImport_list_allProviders_label()]),x(ke,q)},$$slots:{default:!0}})});var ve=A(te,2);is(ve,17,()=>l(N),de=>de.id,(de,fe)=>{var ke=Ze(),be=ue(ke);wt(be,()=>kl,(q,Me)=>{Me(q,{get value(){return l(fe).id},class:"type-caption h-7 gap-1.5 px-2",children:(ze,gt)=>{var Le=OD(),De=ue(Le);{var Fe=Pe=>{lf(Pe,{get providerId(){return l(fe).id},size:14,class:"size-3.5",monochrome:!0})},vt=w(()=>cf(l(fe).id));j(De,Pe=>{l(vt)&&Pe(Fe)})}var Vt=A(De,2),nt=se(Vt,!0);L(()=>H(nt,l(fe).label)),x(ze,Le)},$$slots:{default:!0}})}),x(de,ke)}),x(V,I)},$$slots:{default:!0}})})}Y($),x(P,$)};j(X,P=>{l(N).length>1&&r()!=="error"&&P(le)})}var re=A(X,2);{var Q=P=>{var $=$D(),ce=ne($),pe=se(ce,!0),ye=A(ce,2);qe(ye,{variant:"ghost",size:"sm",get onclick(){return a()},children:(Z,ae)=>{Pt();var V=zt();L(K=>H(V,K),[()=>_.sessionImport_list_retry_label()]),x(Z,V)},$$slots:{default:!0}}),Y($),L(Z=>H(pe,Z),[()=>_.sessionImport_list_loadFailed_error()]),x(P,$)},me=P=>{{const $=(te,ve=Xr)=>{const de=w(()=>ve().data.provider);var fe=Ze(),ke=ue(fe);{var be=ze=>{lf(ze,{get providerId(){return l(de)},size:16,class:"size-4"})},q=w(()=>cf(l(de))),Me=ze=>{tt(ze,{get icon(){return gv},get class(){return dn.icon}})};j(ke,ze=>{l(q)?ze(be):ze(Me,-1)})}x(te,fe)},ce=(te,ve=Xr)=>{const de=w(()=>ve().data),fe=w(()=>oe(l(de))),ke=w(()=>m()?.(l(de))??null);var be=HD(),q=ne(be),Me=se(q,!0),ze=A(q,2);{var gt=nt=>{var Pe=BD(),Ce=A(ue(Pe),2),we=se(Ce,!0);L((Ve,Mt)=>{st(Ce,"datetime",l(de).updatedAt),st(Ce,"title",Ve),H(we,Mt)},[()=>h1(l(fe)),()=>p1(l(fe))]),x(nt,Pe)};j(ze,nt=>{l(fe)&&l(de).updatedAt&&nt(gt)})}var Le=A(ze,4),De=se(Le,!0),Fe=A(Le,2);{var vt=nt=>{var Pe=zD(),Ce=A(ue(Pe),2),we=se(Ce,!0);L(()=>H(we,l(ke))),x(nt,Pe)},Vt=nt=>{var Pe=FD(),Ce=A(ue(Pe),2),we=se(Ce,!0);L(()=>{st(Ce,"title",l(de).gitBranch),H(we,l(de).gitBranch)}),x(nt,Pe)};j(Fe,nt=>{l(ke)?nt(vt):l(de).gitBranch&&nt(Vt,1)})}Y(be),L((nt,Pe)=>{H(Me,nt),st(Le,"title",l(de).cwd),H(De,Pe)},[()=>ee(l(de).provider),()=>pN(l(de).cwd)]),x(te,be)};let pe=w(()=>v()?S(v()):""),ye=w(()=>r()==="loading"),Z=w(()=>_.sessionImport_list_ariaLabel()),ae=w(()=>_.sessionImport_list_search_placeholder()),V=w(()=>_.sessionImport_list_search_placeholder()),K=w(()=>l(U).trim()?_.sessionImport_list_noResults_message():_.sessionImport_list_empty_message()),I=w(()=>l(E).length>0?t:void 0);lh(P,{get options(){return l(D)},get value(){return l(pe)},get open(){return p()},get loading(){return l(ye)},get ariaLabel(){return l(Z)},get placeholder(){return l(ae)},get searchPlaceholder(){return l(V)},get emptyText(){return l(K)},get footer(){return l(I)},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`${dn.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:$,optionDescription:ce,$$slots:{optionIcon:!0,optionDescription:!0}})}};j(re,P=>{r()==="error"?P(Q):P(me,-1)})}return Y(W),sr(W,P=>k(z,P),()=>l(z)),L(()=>st(W,"data-status",r())),x(n,W),Lt(F)}var VD=B("<!> ",1),WD=B('<div class="flex shrink-0 justify-end border-t border-border px-2 py-1"><!></div>'),jD=B('<div data-testid="import-session-tab"><!> <!></div>');function mw(n,e){if(new.target)return Ot({component:mw,...n});It(e,!0);const t=()=>rn(m,"$status$",i),r=()=>rn(g,"$sessions$",i),s=()=>rn(v,"$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,"class",7,"");const g=Sx(),m=Cx(),v=Mx();let C=he(""),z=he(null),M="";const S=w(()=>t()==="error"?"error":(t()==="loading"||t()==="idle")&&r().length===0?"loading":"ready");function O(re,Q=l(C)){M=re,At.dispatch(Ek(re,Q||void 0))}Fu(()=>{if(!d())return;const re=At.state.importableSessions;re&&(re.status==="ready"||re.status==="loading")&&re.query===""&&re.provider===""||Xs(()=>O(""))});function N(re){return a1.select(At.state,re)}function E(re){return gN(re,c())}function D(re){return E(re)?null:_.sessionImport_list_noRepository_reason()}function ee(re){const Q=E(re);Q&&a()(Ak(re,Q))}var U={get onselect(){return a()},set onselect(re){a(re),b()},get knownRepos(){return c()},set knownRepos(re=[]){c(re),b()},get selectedKey(){return u()},set selectedKey(re=""){u(re),b()},get autoload(){return d()},set autoload(re=!0){d(re),b()},get inputRef(){return f()},set inputRef(re=null){f(re),b()},get onclose(){return h()},set onclose(re){h(re),b()},get class(){return p()},set class(re=""){p(re),b()},$set:Nt,$on:(re,Q)=>Dt(e,re,Q)},oe=jD(),F=ne(oe);gw(F,{get status(){return l(S)},get sessions(){return r()},providerLabel:N,get providers(){return s()},get providerFilter(){return l(C)},onproviderchange:re=>{k(C,re,!0),O(M,re)},onquerychange:O,onselect:ee,onretry:()=>O(M),get onclose(){return h()},disabledReason:D,get selectedKey(){return u()},get interactionRoot(){return l(z)},get inputRef(){return f()},set inputRef(re){f(re)}});var W=A(F,2);{var X=re=>{var Q=WD(),me=ne(Q);{let P=w(()=>t()==="loading");qe(me,{variant:"ghost",size:"sm",type:"button",get disabled(){return l(P)},onclick:()=>O(M),"data-testid":"import-session-refresh",children:($,ce)=>{var pe=VD(),ye=ue(pe);tt(ye,{get icon(){return cx},class:"size-3.5"});var Z=A(ye);L(ae=>H(Z,` ${ae??""}`),[()=>_.sessionImport_list_refresh_label()]),x($,pe)},$$slots:{default:!0}})}Y(Q),x(re,Q)};j(W,re=>{l(S)!=="error"&&re(X)})}Y(oe),sr(oe,re=>k(z,re),()=>l(z)),L(()=>at(oe,1,`flex min-h-0 flex-col ${p()??""}`)),x(n,oe);var le=Lt(U);return o(),le}var KD=B('<div data-recent-repo-row=""><!> <!> <!></div>'),GD=B(" <!>",1),Ic=B("<!> <!>",1),qD=B('<span class="text-sm pl-3 shrink-0 select-none"> </span>'),Km=B("<span> </span>"),JD=B('<!> <span class="min-w-0 flex-1 text-left truncate" data-testid="repo-selector-session-value"><span> </span></span>',1),Gm=B('<span class="text-sm text-subtle ml-1"> </span>'),qm=B("<span> </span> <!>",1),XD=B('<span class="min-w-0 flex-1 text-left truncate"><!> <!></span>'),YD=B("<div><!> <!> <!> <!> <!></div>"),QD=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>'),ZD=B('<div role="status"></div>'),e$=B('<p class="type-body px-3 py-2 text-muted-foreground" role="status"> </p>'),Jm=B("<!> <span> </span>",1),t$=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),n$=B('<div class="flex shrink-0 items-center gap-1 px-2 pt-2 pb-2"><!> <h2> </h2></div>'),r$=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>'),s$=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>'),i$=B('<!> <!> <div class="flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring"><!> <!></div> <!> <!>',1),o$=B('<span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <span><div class="truncate"> </div> <!></span>',1),a$=B('<div class="mt-2 px-1"><span class="text-sm text-danger"> </span></div>'),l$=B('<div class="flex items-center gap-2 text-sm text-subtle"><!> <span> </span></div>'),Lc=B('<div class="flex items-center justify-between gap-2"><span class="text-sm text-subtle"> </span> <!></div>'),c$=B('<div class="flex items-center justify-between gap-2"><span class="text-sm text-warning-ink"> </span> <!></div>'),u$=B('<div class="mt-2 px-1"><div class="text-sm text-subtle truncate mb-2"> </div> <!></div>'),d$=B('<!> <div class="flex items-center gap-3"><span class="text-sm text-subtle shrink-0 w-24 pl-1"> </span> <!></div> <!>',1),f$=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>'),h$=B('<div class="text-sm text-subtle px-3 py-2"> </div>'),p$=B("<!> ",1),g$=B('<div class="space-y-1"><!> <!> <!></div>'),m$=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>'),v$=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>'),b$=B('<div class="space-y-1"></div>'),y$=B('<div class="-mx-2" data-testid="recent-repositories"><!></div>'),w$=B('<div class="min-h-16 overflow-y-auto flex-1 px-4 pb-3 pt-2"><!> <!></div>'),x$=B("<!> <div><!> <!></div> <!> <!>",1),k$=B("<!> <!> <!>",1),_$=B('<div class="relative min-w-0"><!></div> <!> <!>',1);function qs(n,e){const t=Ji();if(new.target)return Ot({component:qs,...n});It(e,!0);const r=()=>rn(F,"$hostMember$",U),s=()=>rn(W,"$canAdministerHost$",U),i=()=>rn(ke,"$isGithubAuthenticated$",U),o=()=>rn(te,"$recentRepoRefresh$",U),a=()=>rn(X,"$admission$",U),c=()=>rn(ae,"$workspaceInitializerRecentRepos$",U),u=()=>rn(ye,"$dismissedRecentRepoKeys$",U),d=()=>rn(qa,"$sessionImportSupported$",U),f=()=>rn(Ge,"$cloneSourceVisible$",U),h=()=>rn(V,"$workspaceInitializerRemoteSetups$",U),p=()=>rn(Z,"$defaultParentPath$",U),g=()=>rn(ve,"$directoryStatusCheck$",U),m=()=>rn(Ja,"$plainFolderCreationAvailable$",U),v=()=>rn(Xa,"$forgeConnectionState$",U),C=()=>rn(q,"$githubRepos$",U),z=()=>rn(Fe,"$githubSearchLastQuery$",U),M=()=>rn(Le,"$githubSearchResults$",U),S=()=>rn(ze,"$githubReposLoaded$",U),O=()=>rn(Me,"$githubReposLoading$",U),N=()=>rn(gt,"$githubReposError$",U),E=()=>rn(pe,"$initializerHydrated$",U),D=()=>rn(lc,"$remoteWorkspacesEnabled$",U),ee=()=>rn(De,"$githubSearchLoading$",U),[U,oe]=ja(),F=Yf(),W=l1(),X=c1(),le=da("RepoSelector"),re=ju(),Q=new Ku;let me=he(null),P=he(!1);const $=_.workspace_isolationMode_worktree_label(),ce=At.dispatch,pe=Tx(),ye=Ex(),Z=Ax(),ae=Rx(),V=Px(),K=crypto.randomUUID(),I=crypto.randomUUID(),te=Ix(K),ve=Lx(I);let de,fe;const ke=Rv(),be=w(()=>r()||s()&&i()),q=SD(),Me=CD(),ze=TD(),gt=MD(),Le=AD(),De=RD(),Fe=PD();function vt(T,G){const Te=T.includes("\\")?"\\":"/";return`${T.replace(/[/\\]$/,"")}${Te}${G}`}let Vt=y(e,"variant",7,"ghost"),nt=y(e,"value",7,""),Pe=y(e,"onchange",7),Ce=y(e,"triggerClass",7),we=y(e,"rowLabel",7),Ve=y(e,"displayValue",7),Mt=y(e,"triggerSuffix",7),ie=y(e,"triggerValueClass",7,"text-subtle"),$e=y(e,"triggerContentClass",7,"gap-0.75"),lt=y(e,"emptyLabel",7),yt=y(e,"showEmptyIcon",7,!1),mt=y(e,"showTriggerChevron",7,!1),Tt=y(e,"triggerChevronClass",7,"ml-2 opacity-50"),We=y(e,"triggerIcon",7),Ke=y(e,"triggerAriaLabel",7),Qt=y(e,"onClear",7),Be=y(e,"gitlab",7),jt=y(e,"gitlabSelected",7,!1),Yn=y(e,"plainFolderMode",7,!1),Bn=y(e,"plainFolderSelected",7,!1),ge=y(e,"gitChoice",7),ft=y(e,"sessions",7);function Rt(T){es++,Pe()&&Pe()(new CustomEvent("change",{detail:T}))}function ln(){l(Xe)&&l(Xe).focus()}function Gt(T="local"){l(ht)&&!nt()&&(k(ht,""),k(Ie,""),k(Ye,"local"),k(Ae,"")),et=T,we()&&k(Kn,"add"),k(Qe,!0)}function ut(){l(Si)&&(et="sessions",k(Kn,"add"),k(Qe,!0))}let ht=he(Sr(nt())),Ie=he(Sr(nt())),He=he(""),Xe=he(void 0),pt=he(null),Qe=he(!1),et=null,it=he(!1);const xt=w(()=>!o()||o().admission===a()&&o().status==="pending");let Ft=he(!1),$t=he(!1),Ye=he(Sr(Os(nt()))),cn=he(""),_n=he(null);const yr=w(()=>{const T=c(),G=o();return!G||G.admission!==a()||At.dispatch!==ce?T:$x({saved:T,source:G,dismissed:u(),mode:we()?"all":"recent"})});async function ei(T,G){T.preventDefault(),T.stopPropagation();const Te=T.currentTarget,Ht=Te.closest("[data-recent-repo-row]"),xn=Ht?.nextElementSibling??Ht?.previousElementSibling,si=Te.closest('[role="dialog"]'),to=xn?.querySelector("[data-remove-recent-repo]")??si?.querySelector('[role="tab"][aria-selected="true"]')??si?.querySelector("[data-repo-search]");At.dispatch(Bk({path:G.path,type:G.type})),await Yo(),to?.focus()}let sn=he(null),Er=he(null),us=null,Ut=he("github");const qa=Ox(),Si=w(()=>!!ft()&&!!we()&&d()),Qr=w(()=>ft()?.selected??null),Zi=w(()=>l(yr).filter(T=>T.type==="local").map(T=>({path:T.path,type:"local"})));ct(()=>{l(Ut)==="sessions"&&!l(Si)&&k(Ut,"local")});function R(){k(Ut,"sessions"),k(Kn,"add")}function xe(T){ft()?.onSelect(T),k(Qe,!1)}let Ee=he("github");const ot=w(()=>[...i()?[{id:"github",label:"github.com/",icon:Qf}]:[],...Be()?.authenticated&&Be().instanceBaseUrl?[{id:"gitlab",label:`${Be().instanceBaseUrl.replace(/^https:\/\//,"").replace(/\/$/,"")}/`,icon:Zf}]:[]]),Ne=w(()=>l(ot).find(T=>T.id===l(Ee))??l(ot)[0]),_e=w(()=>l(Ne)?.id??"github"),Xt=w(()=>l(Ut)==="github"||l(Ut)==="gitlab"),yn=w(()=>l(Ne)?.label??_.workspace_repoSelector_clone_tab()),Ge=xD(),en=w(()=>f()||l(ot).length>0||r());function Pn(T){return!l(en)&&(T==="github"||T==="gitlab")?"local":T}function En(){k(Qe,!1),v_({tab:"connections",hash:"integrations"}).catch(T=>le.error("Failed to open connection settings",T))}function $r(T){l(ot).some(G=>G.id===T)&&(k(Ee,T,!0),k(Ut,T,!0))}ct(()=>{if(!(!l(Qe)||l(Ut)!=="gitlab"))return Xs(()=>{const T=Be();if(T)return T.onOpenChange?.(!0,T.scopeKey),()=>Xs(()=>{const G=Be()??T;G.onOpenChange?.(!1,G.scopeKey)})})}),ct(()=>{l(Qe)&&l(Ut)==="gitlab"&&!Be()&&k(Qe,!1)}),ct(()=>{l(Xt)&&k(Ut,Pn(l(_e)),!0)});let Br=he(!1),Hs=he("select-repo"),pa=he(Sr(_.workspace_repoSelector_selectFolder_title())),Ci=he(void 0);const lc=LS("remote-workspaces");let ys=he(Sr(h())),ga=he(!1);ct(()=>{k(ys,h(),!0)});function cc(T=l(ys)){At.dispatch(zk(g_(T)))}function J(T){k(ht,T.name,!0),k(Ie,""),k(Ye,"local"),k(Ft,!1),k($t,!0);const G={path:T.workspacePath||T.name,type:"remote",remoteSetup:T,isNewRepo:!1,isValidPath:!0};Rt(G),k(Qe,!1)}function Oe(T){const G=l(ys).filter(Te=>Te.id!==T);k(ys,G,!0),cc(G)}function Ue(){k(ga,!0)}function Ct(T){const G=[...l(ys),T];k(ys,G,!0),cc(G),k(ga,!1)}let Wt=he(!1),Et=he(""),fn=he("new-project"),Zt=he(""),Ae=he("");function Bt(){return Cd(p(),Yn())}ct(()=>{const T=Yn(),G=p();Xs(()=>{l(Et)===Cd(G,!T)&&k(Et,Cd(G,T),!0)})});function Wn(T){At.dispatch(Dk(T))}function An(T){if(!T||T.trim().length===0)return;const G=T.trim();if(G.includes("/")||G.includes("\\"))return _.workspace_repoSelector_nameSeparators_error();if(G===".."||G==="."||/^\.+$/.test(G))return _.workspace_repoSelector_nameDots_error();if(G.includes("\0"))return _.workspace_repoSelector_nameNull_error();if(/[<>:"|?*]/.test(G))return _.workspace_repoSelector_nameInvalid_error();if(G.length>255)return _.workspace_repoSelector_nameTooLong_error()}const ur=w(()=>An(l(fn))),ws=w(()=>l(Et)&&l(fn)&&!l(ur)?vt(l(Et),l(fn)):""),Zr=w(()=>g()?.admission===a()&&g().path===l(ws)&&g().status==="ready"?g().result:null);let pi=he(null);const eo=w(()=>g()?.admission===a()&&g().path===l(ws)&&(g().status==="failed"||g().status==="unsupported")),Mi=w(()=>Yn()?l(eo)?"existing":zx(l(Zr),l(pi)?.parent===l(Et)?l(pi).inRepo:null):null);ct(()=>{const T=l(Et);if(!Yn()||!T||l(pi)?.parent===T)return;let G=!1;return Td("file:getDirectoryStatus",{path:T}).then(Te=>!!(Te?.success&&(Te.data?.isGitRepo||Te.data?.isSubdirectoryOfGitRepo))).catch(()=>!1).then(Te=>{G||k(pi,{parent:T,inRepo:Te},!0)}),()=>{G=!0}});const Ti=w(()=>g()?.admission===a()&&g().path===l(ws)&&g().status==="pending");let Rs=he(!1),un=he(""),es=0;const ti=w(()=>()=>{const T=l(yr).filter(Te=>l(Ut)==="local"?Te.type==="local":l(Xt)&&Te.type==="github"),G=l(Ut)==="gitlab"?Be()?.query??"":l(He);return G===""?T:T.filter(Te=>Np(Te,G))});let Kn=he("browse"),Us=he(""),xs=he(null),ni=he(void 0);const ri=w(()=>{if(l(yr).some(dr))return l(yr);let T;if(jt()&&Be()?.instanceBaseUrl&&Be().selectedProjectPath){const G=Be().selectedProjectPath,Te=`${Be().instanceBaseUrl}/${G}`;T={path:Te,type:"github",githubUrl:Te,name:G.split("/").at(-1),owner:G.split("/").slice(0,-1).join("/"),repositoryIdentity:{provider:"gitlab",instanceBaseUrl:Be().instanceBaseUrl,projectPath:G}}}else if(!jt()&&l(ht)){const G=l(Ye)==="github"?Ns(l(Ae)||l(ht)):null;T=G?{path:`${G.owner}/${G.repo}`,type:"github",githubUrl:`https://github.com/${G.owner}/${G.repo}`,name:G.repo,owner:G.owner}:{path:l(ht),type:"local",name:Nx(l(ht)),...Bn()?{plainFolder:!0}:{}}}return T?[T,...l(yr)]:l(yr)}),Ja=wD(),Xa=kD(),Io=T=>T.type==="local"&&T.plainFolder===!0,Ya=w(()=>{const T=l(ri).find(dr);return T?Bn()||Io(T)?"folder":"codebase":null}),ir=w(()=>we()?bD({plainFoldersOffered:m(),forgeState:l(ot).length>0||r()?"connected":v(),hasGitRepositoryEntry:l(ri).some(G=>!Io(G)),hasPlainFolderEntry:l(ri).some(Io),selected:l(Ya)})==="folder"?_.workspace_compactInitializer_folder_label():we():void 0),wr=w(()=>m()?_.workspace_repoSelector_searchWithFolders_placeholder():_.workspace_repoSelector_search_placeholder()),zr=w(()=>m()?_.workspace_repoSelector_addRepositoryOrFolder_label():_.workspace_repoSelector_addRepository_label()),ks=w(()=>lt()??(we()?l(zr):_.workspace_repoSelector_selectRepository_label())),Fr=w(()=>l(Us).trim()===""?l(ri):l(ri).filter(T=>Np(T,l(Us).trim())));function Ps(T){const G=al(T,Be()?.instanceBaseUrl);return T.type!=="local"&&G?.provider==="gitlab"&&(!Be()?.authenticated||G.instanceBaseUrl!==Be().instanceBaseUrl||!Be().scopeKey&&!Be().onSelectRecent||Be().page.status==="unavailable")}function dr(T){const G=al(T,Be()?.instanceBaseUrl);return T.type!=="local"&&G?.provider==="gitlab"?jt()&&Be()?.instanceBaseUrl===G.instanceBaseUrl&&Be().selectedProjectPath===G.projectPath:jt()||!l(ht)?!1:T.type==="github"?l(Ye)==="github"&&uc(T.githubUrl||T.path,l(Ae)||l(ht)):l(Ye)!=="github"&&T.path===l(ht)}function kt(){return[...l(ni)?.querySelectorAll("[data-recent-repo-row]")??[]].map(T=>T.querySelector("button:not([data-remove-recent-repo])")).filter(T=>!!T&&!T.disabled)}function qt(T){if(!T.isComposing){if(T.key==="ArrowDown"){const G=kt()[0];if(!G)return;T.preventDefault(),G.focus()}else if(T.key==="Enter"){T.preventDefault(),T.stopPropagation();const G=l(Fr).find(Te=>!Ps(Te));G&&up(G)}}}function wn(T){if(T.key!=="ArrowDown"&&T.key!=="ArrowUp")return;const G=kt(),Te=G.indexOf(document.activeElement);if(!(Te<0))if(T.preventDefault(),T.key==="ArrowUp"&&Te===0)l(xs)?.focus();else{const Ht=T.key==="ArrowDown"?1:-1;G[Math.min(G.length-1,Te+Ht)]?.focus()}}function or(){const T=l(Us).trim();if(T&&l(en)){const G=Ns(ap(T));G?(k(Ee,"github"),k(Ut,"github"),gd(`${G.owner}/${G.repo}`)):l(Ut)==="github"&&gd(T)}k(Kn,"add"),Yo().then(()=>{l(Ut)==="github"&&l(pt)?.focus()})}function Is(){k(Kn,"browse"),Yo().then(()=>l(xs)?.focus())}function Vs(T){const G=T==="repository"?l(_e):T;we()&&G==="local"&&Ns(l(Ie))&&Qa(""),k(Ut,G,!0)}const tn=w(()=>l(Zt).trim()),Sn=w(()=>{const T=C();if(!T.length)return[];const G=l(tn).toLowerCase();return G?T.filter(Te=>`${Te.owner}/${Te.name}`.toLowerCase().includes(G)):T}),Qn=w(()=>{if(z()!==l(tn))return[];const T=M();if(!T.length)return[];const G=new Set(C().map(Te=>Te.id));return T.filter(Te=>!G.has(Te.id))}),zn=w(()=>l(Ut)==="github"&&l(be)?[...l(Sn),...l(Qn)]:[]),Cn=w(()=>{const T=l(sn);if(!T)return!1;const G=T.owner.toLowerCase(),Te=T.repo.toLowerCase();return l(zn).some(Ht=>Ht.owner.toLowerCase()===G&&Ht.name.toLowerCase()===Te)});let on=he(-1);ct(()=>{l(zn),k(on,-1)}),ct(()=>{l(Ut)==="github"&&l(be)&&!S()&&!O()&&!N()&&At.dispatch(Fp())});function fr(){At.dispatch(Fp())}function Ar(T){k(Zt,`${T.owner}/${T.name}`),k(sn,{owner:T.owner,repo:T.name,url:`https://github.com/${T.owner}/${T.name}`},!0),md()}function Ws(T){if(!T.isComposing){if(T.key==="Enter"){T.preventDefault(),T.stopPropagation(),_s();return}if(T.key==="ArrowDown"){if(!l(zn).length)return;T.preventDefault(),k(on,Math.min(l(on)+1,l(zn).length-1),!0);return}if(T.key==="ArrowUp"){if(!l(zn).length)return;T.preventDefault(),k(on,Math.max(l(on)-1,-1),!0)}}}function _s(){const T=l(on)>=0?l(zn)[l(on)]:void 0;T?Ar(T):md()}let Ls=he(-1);ct(()=>{l(ti)(),k(Ls,-1)});function Os(T){return T&&Ns(T)?"github":"local"}function uc(T,G){const Te=Ns(T),Ht=Ns(G);return!!Te&&!!Ht&&Te.owner.toLowerCase()===Ht.owner.toLowerCase()&&Te.repo.toLowerCase()===Ht.repo.toLowerCase()}ct(()=>{nt()&&nt()!==l(ht)&&(k(ht,nt()),k(Ie,nt()),k(Ye,Os(nt()),!0),l(Ae)&&!uc(l(Ae),nt())&&k(Ae,""))});function pd(){if(k(P,!ch(l(me),360)),k(He,""),we()&&l(Kn)==="browse")k(Us,""),requestAnimationFrame(()=>{l(Qe)&&l(Kn)==="browse"&&l(xs)?.focus()});else if(we()){et&&(k(Ut,et,!0),et=null);return}const T=l(ht)||nt();if(le.info("Dropdown opened",{currentValue:T,selectedRepoType:l(Ye)}),et)k(Ut,et,!0),et=null;else if(jt()&&l(ot).some(G=>G.id==="gitlab"))k(Ee,"gitlab"),k(Ut,"gitlab");else if(T){if(k(Ut,Pn(l(Ye)==="github"?l(_e):l(Ye)),!0),l(Ye)==="github"&&l(en)&&l(Ie)){const G=Ns(l(Ie));G&&(k(Zt,`${G.owner}/${G.repo}`),Qa(`https://github.com/${G.owner}/${G.repo}`,""))}}else k(Ut,Pn(l(_e)),!0);requestAnimationFrame(()=>{we()||l(Qe)&&l(Ut)!=="gitlab"&&l(Xe)&&(l(Xe).focus(),l(Xe).select())})}let Lo=!1;ct(()=>{const T=l(Qe);T&&!Lo?pd():!T&&Lo&&we()&&!l(it)&&!l(Br)&&k(Kn,"browse"),Lo=T}),ct(()=>{if(l(Qe))return ua(T=>{T.isComposing||k(Qe,!1)})}),ct(()=>{l(Ut)==="new"&&!l(Et)&&k(Et,Bt(),!0)}),ct(()=>{const T=l(ws),G=a();!T||!l(Et)||!l(fn)||!G||(fe=crypto.randomUUID(),At.dispatch(Rk(I,fe,G,T)))}),ct(()=>{s()&&At.dispatch(af())}),ct(()=>{const T=a(),G=Be()?.instanceBaseUrl;E(),!(!T||At.dispatch!==ce)&&(de=crypto.randomUUID(),At.dispatch(Pk(K,de,T,G)))}),tc(()=>{ft()&&ce(Ik()),de&&ce(Lk(K,de)),fe&&ce(Ok(I,fe))});function Ns(T){const G=T.trim();if(!G)return null;if(G.startsWith("git@github.com:")){const Ht=G.slice(15).replace(/\.git$/,"").split("/");return Ht.length>=2&&Ht[0]&&Ht[1]?{owner:Ht[0],repo:Ht[1]}:null}try{const Te=new URL(G);if(Te.hostname!=="github.com"&&Te.hostname!=="www.github.com"||Te.protocol!=="http:"&&Te.protocol!=="https:")return null;const Ht=Te.pathname.split("/").filter(Boolean);if(Ht.length<2)return null;const xn=Ht[0],si=Ht[1].replace(/\.git$/,"");if(xn&&si)return{owner:xn,repo:si}}catch{}if(!G.includes("\\")&&!G.includes(":")&&!G.startsWith(".")&&!G.startsWith("/")){const Te=G.split("/");if(Te.length===2&&Te[0]&&Te[1]){const Ht=xn=>/^[a-zA-Z0-9]([a-zA-Z0-9\-_\.]*[a-zA-Z0-9])?$/.test(xn)||/^[a-zA-Z0-9]$/.test(xn);if(Ht(Te[0])&&Ht(Te[1]))return{owner:Te[0],repo:Te[1]}}}return null}function ap(T){const G=T.trim();if(!G)return"";const Te=Ns(G);if(Te)return`${Te.owner}/${Te.repo}`;if(G.toLowerCase().startsWith("github.com/")){const Ht=G.slice(11),xn=Ht.split("/").filter(Boolean);return xn.length>=2?`${xn[0]}/${xn[1].replace(/\.git$/,"")}`:Ht.replace(/\/$/,"")}if(G.toLowerCase().startsWith("www.github.com/")){const Ht=G.slice(15),xn=Ht.split("/").filter(Boolean);return xn.length>=2?`${xn[0]}/${xn[1].replace(/\.git$/,"")}`:Ht.replace(/\/$/,"")}return G.replace(/\/$/,"").replace(/\.git$/,"")}function gd(T){let G=T;G.toLowerCase().startsWith("https://github.com/")?G=G.slice(19):G.toLowerCase().startsWith("http://github.com/")?G=G.slice(18):G.toLowerCase().startsWith("github.com/")&&(G=G.slice(11)),k(Zt,G,!0),G?Qa(`https://github.com/${G}`,G):Qa(""),lp(G)}function lp(T){l(be)&&At.dispatch(Nk(T.trim()))}function bw(T){const G=T.clipboardData?.getData("text")||"";if(G){T.preventDefault();const Te=ap(G);k(Zt,Te,!0),Te&&Qa(`https://github.com/${Te}`,Te),lp(Te)}}async function cp(T){try{const G=await Td("file:getDirectoryStatus",{path:T});G.success&&G.data&&(k(_n,G.data,!0),k(Ft,!G.data.exists&&!G.data.isSubdirectoryOfGitRepo,!0),G.data.exists&&!G.data.isDirectory&&k($t,!1))}catch(G){le.warn("Failed to check directory status",G)}}function Qa(T,G=T){k(Ie,T,!0),k(He,G,!0),us&&clearTimeout(us),k(sn,null),k(Er,null),k(cn,""),us=setTimeout(()=>{ww(T)},300)}function yw(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 ww(T){if(!T||T.trim()===""){k(sn,null),k(Er,null);return}if(T.startsWith("/")||T.startsWith("~")||T.includes(":\\")||T.startsWith("./")||T.startsWith("../")){k(sn,null),k(Er,T,!0),await cp(T);return}if(yw(T)){const G=Ns(T);if(G){const Te=`https://github.com/${G.owner}/${G.repo}`;k(Er,null),k(sn,{owner:G.owner,repo:G.repo,url:Te},!0);return}}k(sn,null),k(Er,null)}function up(T){if(es++,we()&&dr(T)){k(Qe,!1);return}const G=al(T,Be()?.instanceBaseUrl);if(T.type!=="local"&&G?.provider==="gitlab"){if(!Be()?.authenticated||G.instanceBaseUrl!==Be().instanceBaseUrl||!Be().scopeKey&&!Be().onSelectRecent||Be().page.status==="unavailable")return;Be().onSelectRecent?Be().onSelectRecent(G.projectPath,G.instanceBaseUrl):Be().onSelect(G.projectPath,Be().scopeKey),k(Qe,!1);return}if(T.type==="local"&&(Yn()||T.plainFolder===!0)){kw(T);return}dp(T)}async function xw(T){try{const G=await Td("file:getDirectoryStatus",{path:T});return G?.success&&G.data?G.data:null}catch(G){return le.warn("Failed to check directory status",G),null}}async function kw(T){const G=es,Te=await xw(T.path);if(G!==es)return;const Ht=!!Te&&(Te.isGitRepo||!!Te.isSubdirectoryOfGitRepo);if(Te?Te.exists&&Te.isDirectory&&!Ht:T.plainFolder===!0||Yn()){if(Yn()){Za(T.path,"existing");return}k(un,T.path,!0),k(Rs,!0);return}if(Yn()&&Te&&!Te.exists&&!Ht){Za(T.path,"new");return}dp(T,Te?.isSubdirectoryOfGitRepo?Te.relativePathFromGitRoot:"")}function dp(T,G=""){const Te=T.type==="github"&&T.githubUrl?Ns(T.githubUrl):null,Ht=Te?`${Te.owner}/${Te.repo}`:T.path;k(ht,Ht,!0),k(Ie,T.type==="github"?T.githubUrl:T.path,!0),k(Ye,T.type,!0),k(Ae,T.type==="github"&&T.githubUrl||"",!0),k(Ft,!1),k($t,!0),k(cn,""),k(_n,null);const xn={path:Ht,type:T.type,isNewRepo:!1,isValidPath:!0};G&&(xn.scope=G),T.type==="github"&&T.githubUrl&&(xn.githubUrl=T.githubUrl),Rt(xn),k(Qe,!1)}function fp(T,G,Te){k(Hs,T,!0),k(pa,G,!0),k(Ci,Te,!0),Zk({title:G,defaultPath:Te,openModal:()=>k(Br,!0),onSelect:hp})}function _w(){fp("select-repo",_.workspace_repoSelector_selectRepoFolder_title(),typeof l(ht)=="string"?l(ht):void 0)}async function Sw(T){es++;try{if(await cp(T),l(_n)?.exists&&!l(_n)?.isGitRepo&&!l(_n)?.isSubdirectoryOfGitRepo){if(Yn()){Za(T,"existing");return}k(un,T,!0),k(Rs,!0);return}k(ht,T,!0),k(Ie,T,!0),k(Ae,""),k(Ye,"local"),k($t,!0),k(cn,"");const G={path:T,type:"local",isNewRepo:l(Ft),isValidPath:!0,scope:l(_n)?.relativePathFromGitRoot};Rt(G),k(Qe,!1)}catch(G){le.error("Failed to select folder",G)}}function Cw(){k(it,!0),fp("new-repo-parent",_.workspace_repoSelector_selectNewRepoParent_title(),l(Et)||void 0)}function ma(){if(!l(Et)||!l(fn)||l(ur))return;const T=vt(l(Et),l(fn));k(ht,T,!0),k(Ie,T,!0),k(Ae,""),k($t,!0),k(cn,""),k(_n,null),k(Ye,"new");const G=l(Zr)?.exists&&l(Zr)?.isGitRepo,Te=l(Mi);if(Te){Za(T,Te),k(Wt,!1);return}k(Ft,!G),Rt({path:T,type:"local",isNewRepo:!G,isValidPath:!0}),Wn(l(Et)),k(Wt,!1),k(Qe,!1)}async function hp(T){k(Br,!1);const G=l(Hs);if(G==="select-repo"){await Sw(T);return}G==="new-repo-parent"&&(k(Et,T,!0),Wn(l(Et))),k(it,!1),k(Qe,!0)}function Mw(){k(Br,!1),l(Hs)!=="select-repo"&&(k(it,!1),k(Qe,!0))}function md(){const T=Ns(l(Zt));if(!T)return;const G={owner:T.owner,repo:T.repo,url:`https://github.com/${T.owner}/${T.repo}`},Te=`${G.owner}/${G.repo}`,Ht={path:Te,type:"github",githubUrl:G.url,isNewRepo:!1,isValidPath:!0};k(ht,Te),k(Ie,G.url,!0),k(Ae,G.url,!0),k(Ye,"github"),k($t,!0),k(cn,""),Rt(Ht),k(Qe,!1)}function Tw(){if(!l(un))return;k(ht,l(un),!0),k(Ie,l(un),!0),k(Ae,""),k(Ye,"local"),k(Ft,!0),k($t,!0),k(cn,"");const T={path:l(un),type:"local",isNewRepo:!0,isValidPath:!0};Rt(T),k(Rs,!1),k(un,""),k(Qe,!1)}function Za(T,G){k(ht,T,!0),k(Ie,T,!0),k(Ae,""),k(Ye,G==="new"?"new":"local",!0),k(Ft,!1),k($t,!0),k(cn,""),k(_n,null),Rt({path:T,type:"local",isNewRepo:!1,isValidPath:!0,plainFolder:G}),k(Rs,!1),k(un,""),k(Qe,!1)}function Ew(T,G){const Te=G==="local"&&l(Rs)?l(un):"";ge()?.onCheckedChange(T,G),Te&&!T&&Za(Te,"existing")}function Aw(){k(Rs,!1),k(un,""),k(Er,null),k(_n,null),k(Ie,""),k(He,"")}function Rw(){if(!l(ht))return _.workspace_repoSelector_selectRepository_label();if(l(Ye)==="github"&&l(Ae)){const G=Ns(l(Ae));if(G)return`${G.owner}/${G.repo}`}if(l(ht).match(/^[^\/]+\/[^\/]+$/)&&!l(ht).includes("\\")&&!l(ht).startsWith("/"))return l(ht);const T=l(ht).split(/[\/\\]/);return T[T.length-1]||l(ht)}const vd=w(()=>jt()?Ve()??Be()?.selectedProjectPath??"":Ve()??Rw()),dc=w(()=>jt()?!!l(vd):!!l(ht)),bd=`${t}-github-suggestions`,pp=w(()=>jt()&&Be()?.authenticated&&Be().scopeKey&&Be().page.status!=="unavailable"&&Be().selectedProject?.projectPath===Be().selectedProjectPath?Be().selectedProject:void 0),gp=w(()=>jt()?null:Dx({selectedValue:l(ht),selectedRepoType:l(Ye),confirmedGithubUrl:l(Ae)},Ns)),yd=w(()=>l(ri).find(dr)),wd=w(()=>l(yd)?al(l(yd),Be()?.instanceBaseUrl):null);function mp(T){if(!(T?.provider!=="gitlab"||!Be()?.authenticated||!Be().scopeKey||T.instanceBaseUrl!==Be().instanceBaseUrl||Be().page.status!=="ready"))return(Be().page.items.find(G=>G.projectPath===T.projectPath)??(Be().selectedProject?.projectPath===T.projectPath?Be().selectedProject:void 0))?.ownerAvatarUrl}var Pw={focusInput:ln,openOnLocalTab:Gt,openOnSessionsTab:ut,get variant(){return Vt()},set variant(T="ghost"){Vt(T),b()},get value(){return nt()},set value(T=""){nt(T),b()},get onchange(){return Pe()},set onchange(T){Pe(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 Ve()},set displayValue(T){Ve(T),b()},get triggerSuffix(){return Mt()},set triggerSuffix(T){Mt(T),b()},get triggerValueClass(){return ie()},set triggerValueClass(T="text-subtle"){ie(T),b()},get triggerContentClass(){return $e()},set triggerContentClass(T="gap-0.75"){$e(T),b()},get emptyLabel(){return lt()},set emptyLabel(T){lt(T),b()},get showEmptyIcon(){return yt()},set showEmptyIcon(T=!1){yt(T),b()},get showTriggerChevron(){return mt()},set showTriggerChevron(T=!1){mt(T),b()},get triggerChevronClass(){return Tt()},set triggerChevronClass(T="ml-2 opacity-50"){Tt(T),b()},get triggerIcon(){return We()},set triggerIcon(T){We(T),b()},get triggerAriaLabel(){return Ke()},set triggerAriaLabel(T){Ke(T),b()},get onClear(){return Qt()},set onClear(T){Qt(T),b()},get gitlab(){return Be()},set gitlab(T){Be(T),b()},get gitlabSelected(){return jt()},set gitlabSelected(T=!1){jt(T),b()},get plainFolderMode(){return Yn()},set plainFolderMode(T=!1){Yn(T),b()},get plainFolderSelected(){return Bn()},set plainFolderSelected(T=!1){Bn(T),b()},get gitChoice(){return ge()},set gitChoice(T){ge(T),b()},get sessions(){return ft()},set sessions(T){ft(T),b()},$set:Nt,$on:(T,G)=>Dt(e,T,G)},vp=_$(),xd=ue(vp);{const T=(Te,Ht=Xr,xn=Xr)=>{var si=Ze(),to=ue(si);is(to,19,Ht,Ds=>$k(Ds),(Ds,hr,gi)=>{var js=KD();{const xr=mn=>{{let gr=w(()=>l(pr)&&l(hr).type!=="local"?l(pr).projectPath.split("/").at(-1):l(ds).primary),Rr=w(()=>l(pr)?.provider),fs=w(()=>l(hr).type==="local"),Gn=w(()=>l(hr).type!=="local"),vi=w(()=>xn()(l(hr),l(gi))),Hr=w(()=>!!we()),Ur=w(()=>l(hr).type!=="local"&&l(pr)?.provider==="gitlab"&&(!Be()?.authenticated||l(pr).instanceBaseUrl!==Be().instanceBaseUrl||!Be().scopeKey&&!Be().onSelectRecent||Be().page.status==="unavailable"));sp(mn,{get owner(){return l(Ai)},get name(){return l(gr)},get suffix(){return l(ds).suffix},get provider(){return l(Rr)},get avatarUrl(){return l(oi)},get local(){return l(fs)},get showOwner(){return l(Gn)},showForge:!0,recent:!0,get selected(){return l(vi)},get formStyle(){return l(Hr)},class:"flex-1",onclick:()=>up(l(hr)),get disabled(){return l(Ur)}})}},ds=w(()=>Fx(l(hr))),pr=w(()=>al(l(hr),Be()?.instanceBaseUrl)),Ai=w(()=>l(pr)?l(pr).projectPath.split("/").slice(0,-1).join("/"):l(ds).ownerPrefix),Ri=w(()=>Bx(l(hr))),oi=w(()=>mp(l(pr)));var mi=ne(js);{var Oo=mn=>{Hu(mn,{get content(){return l(Ri)},delayDuration:300,side:"bottom",class:"flex min-w-0 flex-1",children:(gr,Rr)=>{xr(gr)},$$slots:{default:!0}})},va=mn=>{xr(mn)};j(mi,mn=>{l(Ri)?mn(Oo):mn(va,-1)})}var Ei=A(mi,2);{var no=mn=>{const gr=w(()=>`${l(pr).instanceBaseUrl.replace(/\/$/,"")}/${l(pr).projectPath}`);{let Rr=w(()=>_.browser_embedded_openExternal_tooltip()),fs=w(()=>_.browser_embedded_openExternal_ariaLabel());qe(mn,{variant:"ghost",size:"icon-compact",iconOnly:!0,get href(){return l(gr)},target:"_blank",rel:"noopener noreferrer",get tooltip(){return l(Rr)},get"aria-label"(){return l(fs)},class:"mr-1 shrink-0 text-subtle",onclick:Gn=>{Gn.preventDefault(),Gn.stopPropagation(),ah(l(gr),{event:Gn,forceExternal:!0})},children:(Gn,vi)=>{tt(Gn,{get icon(){return cv},size:12})},$$slots:{default:!0}})}};j(Ei,mn=>{we()&&l(pr)&&mn(no)})}var No=A(Ei,2);{var ii=mn=>{{let gr=w(()=>_.workspace_repoSelector_removeRecent_ariaLabel({repository:l(hr).path})),Rr=w(()=>_.workspace_repoSelector_removeRecent_tooltip());qe(mn,{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(gr)},get title(){return l(Rr)},onclick:fs=>ei(fs,l(hr)),children:(fs,Gn)=>{tt(fs,{get icon(){return Ki},size:12})},$$slots:{default:!0}})}};j(No,mn=>{we()||mn(ii)})}Y(js)}L(xr=>at(js,1,`group/recent-repo flex min-w-0 items-center ${we()?"rounded-(--radius-row)":""} ${xr??""}`),[()=>we()&&xn()(l(hr),l(gi))?"bg-selected":""]),x(Ds,js)}),x(Te,si)},G=Te=>{var Ht=Ze(),xn=ue(Ht);{var si=Ds=>{var hr=Ze(),gi=ue(hr);wt(gi,()=>ih,(js,mi)=>{mi(js,{children:(Oo,va)=>{var Ei=Ic(),no=ue(Ei);{const ii=(xr,ds)=>{qe(xr,ms(()=>(ds?.()).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:(Ai,Ri)=>{Pt();var oi=GD(),mn=ue(oi),gr=A(mn);tt(gr,{get icon(){return ra},size:10,class:"absolute right-0 opacity-0 group-hover/forge:opacity-100 group-focus/forge:opacity-100"}),L(()=>H(mn,`${l(yn)??""} `)),x(Ai,oi)},$$slots:{default:!0}}))};wt(no,()=>rh,(xr,ds)=>{ds(xr,{child:ii,$$slots:{child:!0}})})}var No=A(no,2);{let ii=w(()=>({to:re()})),xr=w(()=>_.workspace_repoSelector_whichRepo_label());wt(No,()=>sh,(ds,pr)=>{pr(ds,{get portalProps(){return l(ii)},get"aria-label"(){return l(xr)},children:(Ai,Ri)=>{var oi=Ze(),mn=ue(oi);{let gr=w(()=>l(Ne)?.id);wt(mn,()=>Gx,(Rr,fs)=>{fs(Rr,{get value(){return l(gr)},onValueChange:Gn=>$r(Gn),children:(Gn,vi)=>{var Hr=Ze(),Ur=ue(Hr);is(Ur,17,()=>l(ot),hs=>hs.id,(hs,Kt)=>{var In=Ze(),Pr=ue(In);{const ts=nn=>{tt(nn,{get icon(){return l(Kt).icon},size:12})};wt(Pr,()=>qx,(nn,Ln)=>{Ln(nn,{get value(){return l(Kt).id},closeOnSelect:!0,leading:ts,children:(Vr,Fn)=>{Pt();var kn=zt();L(()=>H(kn,l(Kt).label)),x(Vr,kn)},$$slots:{leading:!0,default:!0}})})}x(hs,In)}),x(Gn,Hr)},$$slots:{default:!0}})})}x(Ai,oi)},$$slots:{default:!0}})})}x(Oo,Ei)},$$slots:{default:!0}})}),x(Ds,hr)},to=Ds=>{var hr=qD(),gi=se(hr,!0);L(()=>H(gi,l(Ne)?.label??"github.com/")),x(Ds,hr)};j(xn,Ds=>{l(ot).length>1?Ds(si):Ds(to,-1)})}x(Te,Ht)};var Iw=ne(xd);wt(Iw,()=>Wu,(Te,Ht)=>{Ht(Te,{get open(){return l(Qe)},set open(xn){k(Qe,xn,!0)},children:(xn,si)=>{var to=Ic(),Ds=ue(to);{const gi=(js,mi)=>{let Oo=()=>(mi?.()).props;{let va=w(()=>!we()),Ei=w(()=>`w-full ${Ce()??""}`),no=w(()=>Ke()??(we()?void 0:`${_.workspace_repoSelector_selectRepository_label()}: ${l(vd)}`)),No=w(()=>we()&&!Ke()?`${t}-field-label ${t}-field-value`:void 0);qe(js,ms(Oo,{get variant(){return Vt()},get wrapContent(){return l(va)},get class(){return l(Ei)},get"aria-label"(){return l(no)},get"aria-labelledby"(){return l(No)},get ref(){return l(me)},set ref(ii){k(me,ii,!0)},children:(ii,xr)=>{var ds=YD(),pr=ne(ds);{var Ai=Kt=>{var In=Km(),Pr=se(In,!0);L(()=>{at(In,1,$n(dn.fieldLabel)),st(In,"id",`${t}-field-label`),H(Pr,l(ir))}),x(Kt,In)};j(pr,Kt=>{we()&&Kt(Ai)})}var Ri=A(pr,2);{var oi=Kt=>{var In=JD(),Pr=ue(In);{var ts=On=>{{let bi=w(()=>we()?20:16);lf(On,{get providerId(){return l(Qr).provider},get size(){return l(bi)},class:"shrink-0"})}},nn=w(()=>cf(l(Qr).provider)),Ln=On=>{Qo(On,{size:16,class:"shrink-0 text-muted-foreground"})};j(Pr,On=>{l(nn)?On(ts):On(Ln,-1)})}var Vr=A(Pr,2),Fn=ne(Vr),kn=se(Fn,!0);Y(Vr),L(On=>{st(Vr,"id",we()?`${t}-field-value`:void 0),at(Fn,1,$n(ie())),H(kn,On)},[()=>l(Qr).title.trim()||_.sessionImport_list_untitled_label()]),x(Kt,In)},mn=Kt=>{tt(Kt,{get icon(){return We()},size:"xs"})},gr=Kt=>{Qo(Kt,{size:12,class:"text-ghost -mb-0.25 mr-1"})};j(Ri,Kt=>{l(Qr)&&!We()?Kt(oi):We()?Kt(mn,1):yt()&&!l(dc)&&Kt(gr,2)})}var Rr=A(Ri,2);{var fs=Kt=>{{let In=w(()=>l(wd)?.projectPath.split("/").slice(0,-1).join("/")||l(gp)||l(pp)?.namespace),Pr=w(()=>l(wd)?.provider??(jt()?"gitlab":l(gp)?"github":void 0)),ts=w(()=>mp(l(wd))??l(pp)?.ownerAvatarUrl),nn=w(()=>l(yd)?.type==="local"||!jt()&&l(Ye)!=="github"),Ln=w(()=>we()?20:16);hh(Kt,{get owner(){return l(In)},get provider(){return l(Pr)},get avatarUrl(){return l(ts)},get local(){return l(nn)},get size(){return l(Ln)}})}},Gn=Kt=>{Qo(Kt,{size:16,class:"shrink-0 text-muted-foreground"})};j(Rr,Kt=>{!l(Qr)&&!We()&&l(dc)?Kt(fs):!l(Qr)&&!We()&&we()&&!yt()&&Kt(Gn,1)})}var vi=A(Rr,2);{var Hr=Kt=>{var In=XD(),Pr=ne(In);{var ts=Fn=>{var kn=qm(),On=ue(kn),bi=se(On,!0),yi=A(On,2);{var el=Pi=>{var ro=Gm(),tl=se(ro,!0);L(so=>H(tl,so),[()=>_.workspace_repoSelector_new_label()]),x(Pi,ro)};j(yi,Pi=>{l(Ft)&&!Ve()&&!jt()&&Pi(el)})}L(()=>{at(On,1,$n(ie())),H(bi,l(vd))}),x(Fn,kn)},nn=Fn=>{var kn=Km(),On=se(kn,!0);L(()=>{at(kn,1,$n(ie())),H(On,l(ks))}),x(Fn,kn)};j(Pr,Fn=>{l(dc)?Fn(ts):Fn(nn,-1)})}var Ln=A(Pr,2);{var Vr=Fn=>{var kn=Gm(),On=se(kn);L(()=>H(On,`(${Mt()??""})`)),x(Fn,kn)};j(Ln,Fn=>{Mt()&&Fn(Vr)})}Y(In),L(()=>st(In,"id",we()?`${t}-field-value`:void 0)),x(Kt,In)};j(vi,Kt=>{!l(Qr)&&!We()&&(l(dc)||l(ks))&&Kt(Hr)})}var Ur=A(vi,2);{var hs=Kt=>{tt(Kt,{get icon(){return ra},size:10,get class(){return Tt()}})};j(Ur,Kt=>{mt()&&Kt(hs)})}Y(ds),L(()=>at(ds,1,`flex w-full min-w-0 items-center truncate ${$e()}`)),x(ii,ds)},$$slots:{default:!0}}))}};wt(Ds,()=>Uu,(js,mi)=>{mi(js,{child:gi,$$slots:{child:!0}})})}var hr=A(Ds,2);{let gi=w(()=>l(ir)??_.workspace_repoSelector_whichRepo_label()),js=w(()=>we()?`${l(Kn)==="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(Kn)==="browse"?"overflow-hidden":"overflow-y-auto"}`:"w-[400px] max-w-[calc(100vw-16px)] min-w-0 max-h-[min(600px,var(--bits-popover-content-available-height,100dvh))] overflow-y-auto flex flex-col"),mi=w(()=>we()?Q.current||l(P)?"bottom":"left":void 0),Oo=w(()=>we()?Q.current||l(P)?4:24:void 0),va=w(()=>we()?Q.current||l(P)?"end":"start":void 0),Ei=w(()=>({to:re()})),no=w(()=>re()?"absolute":"fixed");wt(hr,()=>Vu,(No,ii)=>{ii(No,{role:"dialog",get"aria-label"(){return l(gi)},get class(){return l(js)},get side(){return l(mi)},get sideOffset(){return l(Oo)},get align(){return l(va)},onkeydown:xr=>{we()&&l(Kn)==="browse"&&xr.target instanceof Node&&l(ni)?.contains(xr.target)&&wn(xr),xr.key==="Enter"&&xr.stopPropagation()},get portalProps(){return l(Ei)},get strategy(){return l(no)},portal:!0,children:(xr,ds)=>{var pr=Ze(),Ai=ue(pr);{var Ri=mn=>{var gr=t$(),Rr=ue(gr),fs=ne(Rr);{let nn=w(()=>`${t}-form-repos`);ss(fs,{variant:"search",type:"text",role:"searchbox","data-repo-search":!0,"data-testid":"repo-form-search",get value(){return l(Us)},oninput:Ln=>k(Us,Ln.currentTarget.value,!0),onkeydown:qt,get placeholder(){return l(wr)},get"aria-label"(){return l(wr)},get"aria-controls"(){return l(nn)},get ref(){return l(xs)},set ref(Ln){k(xs,Ln,!0)}})}Y(Rr);var Gn=A(Rr,2),vi=ne(Gn);{var Hr=nn=>{var Ln=ZD();is(Ln,20,()=>[1,2,3],Nc,(Vr,Fn)=>{var kn=QD();x(Vr,kn)}),Y(Ln),x(nn,Ln)},Ur=nn=>{var Ln=e$(),Vr=se(Ln,!0);L(Fn=>H(Vr,Fn),[()=>_.hud_filter_noRepositories_label()]),x(nn,Ln)},hs=nn=>{T(nn,()=>l(Fr),()=>Ln=>dr(Ln))};j(vi,nn=>{l(xt)&&l(ri).length===0?nn(Hr):l(Fr).length===0?nn(Ur,1):nn(hs,-1)})}Y(Gn),sr(Gn,nn=>k(ni,nn),()=>l(ni));var Kt=A(Gn,2),In=ne(Kt);qe(In,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-add",get class(){return`${dn.row} w-full`},onclick:or,children:(nn,Ln)=>{var Vr=Jm(),Fn=ue(Vr);tt(Fn,{get icon(){return Gc},class:"size-4 shrink-0"});var kn=A(Fn,2),On=se(kn,!0);L(()=>H(On,l(zr))),x(nn,Vr)},$$slots:{default:!0}});var Pr=A(In,2);{var ts=nn=>{qe(nn,{variant:"ghost",type:"button",wrapContent:!1,"data-testid":"repo-form-import-session",get class(){return`${dn.row} w-full`},onclick:R,children:(Ln,Vr)=>{var Fn=Jm(),kn=ue(Fn);tt(kn,{get icon(){return gv},class:"size-4 shrink-0"});var On=A(kn,2),bi=se(On,!0);L(yi=>H(bi,yi),[()=>_.sessionImport_picker_none_label()]),x(Ln,Fn)},$$slots:{default:!0}})};j(Pr,nn=>{l(Si)&&nn(ts)})}Y(Kt),L(nn=>{st(Gn,"id",`${t}-form-repos`),st(Gn,"aria-label",nn)},[()=>_.workspace_repoSelector_recent_label()]),x(mn,gr)},oi=mn=>{var gr=Ic(),Rr=ue(gr);{var fs=Hr=>{var Ur=n$(),hs=ne(Ur);{let Pr=w(()=>_.ui_navButtons_goBack_tooltip());qe(hs,{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:Is,children:(ts,nn)=>{tt(ts,{get icon(){return ux},class:"size-3.5!"})},$$slots:{default:!0}})}var Kt=A(hs,2),In=se(Kt,!0);Y(Ur),L(()=>{at(Kt,1,`${dn.title} min-w-0 truncate`),H(In,l(zr))}),x(Hr,Ur)},Gn=Hr=>{var Ur=r$(),hs=ne(Ur),Kt=se(hs,!0),In=A(hs,2),Pr=se(In,!0);Y(Ur),L((ts,nn)=>{H(Kt,ts),H(Pr,nn)},[()=>_.workspace_repoSelector_whichRepo_label(),()=>_.workspace_repoSelector_whichRepo_description()]),x(Hr,Ur)};j(Rr,Hr=>{we()?Hr(fs):Hr(Gn,-1)})}var vi=A(Rr,2);{let Hr=w(()=>l(Xt)?"repository":l(Ut)),Ur=w(()=>we()?"shrink-0":"min-h-0");wt(vi,()=>Xk,(hs,Kt)=>{Kt(hs,{get value(){return l(Hr)},onValueChange:Vs,get class(){return`flex flex-col ${l(Ur)??""}`},children:(In,Pr)=>{var ts=k$(),nn=ue(ts);{let kn=w(()=>_.workspace_repoSelector_whichRepo_label());wt(nn,()=>Yk,(On,bi)=>{bi(On,{get"aria-label"(){return l(kn)},class:"flex shrink-0 gap-0 mx-3 mb-3 bg-sidebar rounded-lg p-1",children:(yi,el)=>{var Pi=Ic(),ro=ue(Pi);{var tl=io=>{var Ii=Ze(),ba=ue(Ii);{let nl=w(()=>l(Xt)?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");wt(ba,()=>Up,(rl,sl)=>{sl(rl,{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(nl)??""}`},children:(il,fc)=>{Pt();var ol=zt();L(Do=>H(ol,Do),[()=>_.workspace_repoSelector_clone_tab()]),x(il,ol)},$$slots:{default:!0}})})}x(io,Ii)};j(ro,io=>{l(en)&&io(tl)})}var so=A(ro,2);is(so,1,()=>[{id:"local",label:_.workspace_repoSelector_existingFolder_tab()},{id:"new",label:_.workspace_repoSelector_new_tab()},...l(Si)?[{id:"sessions",label:_.sessionImport_tab_label()}]:[],...D()?[{id:"remote",label:_.workspace_repoSelector_remoteServer_tab()}]:[]],Nc,(io,Ii)=>{var ba=Ze(),nl=ue(ba);{let rl=w(()=>l(Ut)===l(Ii).id?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");wt(nl,()=>Up,(sl,il)=>{il(sl,{get value(){return l(Ii).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(rl)??""}`},children:(fc,ol)=>{Pt();var Do=zt();L(()=>H(Do,l(Ii).label)),x(fc,Do)},$$slots:{default:!0}})})}x(io,ba)}),x(yi,Pi)},$$slots:{default:!0}})})}var Ln=A(nn,2);{var Vr=kn=>{qe(kn,{type:"button",variant:"link",size:"sm",class:"mx-3 -mt-1 mb-2 h-auto self-start p-0 text-xs",onclick:En,children:(On,bi)=>{Pt();var yi=zt();L(el=>H(yi,el),[()=>_.workspace_repoSelector_connectForgeToClone_label()]),x(On,yi)},$$slots:{default:!0}})};j(Ln,kn=>{!l(en)&&s()&&kn(Vr)})}var Fn=A(Ln,2);{let kn=w(()=>l(Xt)?"repository":l(Ut));wt(Fn,()=>Dv,(On,bi)=>{bi(On,{get value(){return l(kn)},class:"mt-0 min-h-0 flex flex-col",children:(yi,el)=>{var Pi=x$(),ro=ue(Pi);{var tl=pn=>{{let Nn=w(()=>l(Qr)?Mv(l(Qr)):"");mw(pn,{class:"h-80 max-h-[min(320px,calc(100dvh-14rem))]",get knownRepos(){return l(Zi)},get selectedKey(){return l(Nn)},onselect:xe,onclose:()=>k(Qe,!1)})}};j(ro,pn=>{l(Ut)==="sessions"&&l(Si)&&pn(tl)})}var so=A(ro,2);let io;var Ii=ne(so);{var ba=pn=>{const Nn=w(()=>l(Ut)),mr=w(()=>l(Nn)==="new"?"new":l(Rs)&&l(un)?"folder":ge().folder??null);{let ar=w(()=>l(mr)==="git-repo"?ge().worktree!==!1:ge().checked);pw(pn,{class:"mb-3 px-1",get folder(){return l(mr)},get checked(){return l(ar)},get disabled(){return ge().disabled},onCheckedChange:lr=>Ew(lr,l(Nn))})}};j(Ii,pn=>{ge()&&(l(Ut)==="local"||l(Ut)==="new")&&pn(ba)})}var nl=A(Ii,2);{var rl=pn=>{{let Nn=w(()=>!we()),mr=w(()=>!!we());fw(pn,ms(Be,{get scrollable(){return l(Nn)},get formStyle(){return l(mr)},get prefix(){return G},onSelect:(ar,lr)=>{es++,Be()?.onSelect(ar,lr),k(Qe,!1)}}))}},sl=pn=>{qe(pn,{type:"button",class:"w-full flex items-center justify-between px-3 py-2.5 rounded-lg border-0 text-left cursor-pointer",onclick:_w,children:(Nn,mr)=>{var ar=qm(),lr=ue(ar),Ss=se(lr,!0),Dn=A(lr,2);tt(Dn,{get icon(){return Qs},class:"text-ghost opacity-50"}),L(hn=>{at(lr,1,`text-sm truncate ${l(Ie)?"text-foreground":"text-muted-foreground"}`),H(Ss,hn)},[()=>l(Ie)||_.workspace_repoSelector_selectAFolder_placeholder()]),x(Nn,ar)},$$slots:{default:!0}})},il=pn=>{var Nn=i$(),mr=ue(Nn);Jf(mr,{kind:"repository"});var ar=A(mr,2);Jf(ar,{});var lr=A(ar,2),Ss=ne(lr);G(Ss);var Dn=A(Ss,2);{let Mn=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Zn=w(()=>l(zn).length>0?bd:void 0),Ir=w(()=>l(zn).length>0),Wr=w(()=>l(zn)[l(on)]?`${bd}-${l(on)}`:void 0);sr(ss(Dn,{placeholder:"owner/repo",type:"text",oninput:er=>gd(er.currentTarget.value),onpaste:bw,onkeydown:Ws,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(Mn)},"aria-autocomplete":"list",get"aria-controls"(){return l(Zn)},get"aria-expanded"(){return l(Ir)},get"aria-activedescendant"(){return l(Wr)},get ref(){return l(pt)},set ref(er){k(pt,er,!0)},get value(){return l(Zt)},set value(er){k(Zt,er,!0)}}),er=>k(Xe,er,!0),()=>l(Xe))}Y(lr);var hn=A(lr,2);{var qn=Mn=>{{let Zn=w(()=>_.workspace_repoSelector_githubSignIn_description());hw(Mn,{class:"mt-2",get message(){return l(Zn)}})}},kr=Mn=>{{let Zn=w(()=>!!we()),Ir=w(()=>_.workspace_repoSelector_githubSuggestions_ariaLabel()),Wr=w(()=>!l(zn).length&&(O()||!!(l(tn)&&ee()))),er=w(()=>l(tn)?_.workspace_repoSelector_searchingGithub_label({query:l(tn)}):_.gitlabCheckout_loading_label()),Ks=w(()=>_.hud_filter_noRepositories_label()),$o=w(()=>N()?r()?N():_.workspace_repoSelector_suggestionsUnavailable_label():void 0),oo=w(()=>_.workspace_repoSelector_retrySuggestions_label());ip(Mn,{get formStyle(){return l(Zn)},get id(){return bd},get items(){return l(zn)},getKey:$s=>$s.id,getOwner:$s=>$s.owner,getName:$s=>$s.name,provider:"github",get label(){return l(Ir)},get loading(){return l(Wr)},get loadingLabel(){return l(er)},get emptyLabel(){return l(Ks)},get error(){return l($o)},get retryLabel(){return l(oo)},onRetry:fr,onSelect:Ar,get activeIndex(){return l(on)},set activeIndex($s){k(on,$s,!0)}})}};j(hn,Mn=>{!l(be)&&s()?Mn(qn):l(be)&&Mn(kr,1)})}var gn=A(hn,2);{var _r=Mn=>{var Zn=s$(),Ir=ne(Zn),Wr=se(Ir),er=A(Ir,2);qe(er,{size:"sm",onclick:md,class:"shrink-0",children:(Ks,$o)=>{Pt();var oo=zt();L($s=>H(oo,$s),[()=>_.workspace_repoSelector_select_label()]),x(Ks,oo)},$$slots:{default:!0}}),Y(Zn),L(()=>H(Wr,`${l(sn).owner??""}/${l(sn).repo??""}`)),x(Mn,Zn)};j(gn,Mn=>{l(sn)&&!l(Cn)&&Mn(_r)})}x(pn,Nn)},fc=pn=>{var Nn=d$(),mr=ue(Nn);qe(mr,{type:"button",variant:"plain",wrapContent:!1,class:"w-full flex items-center gap-3 mb-2 text-left cursor-pointer",onclick:Cw,children:(gn,_r)=>{var Mn=o$(),Zn=ue(Mn),Ir=se(Zn,!0),Wr=A(Zn,2),er=ne(Wr),Ks=se(er,!0),$o=A(er,2);tt($o,{get icon(){return Qs},class:"text-ghost shrink-0 opacity-50"}),Y(Wr),L((oo,$s)=>{H(Ir,oo),at(Wr,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(Et)?"text-foreground":"text-subtle"} truncate`),H(Ks,$s)},[()=>_.workspace_repoSelector_parentFolder_label(),()=>l(Et)||_.workspace_repoSelector_select_placeholder()]),x(gn,Mn)},$$slots:{default:!0}});var ar=A(mr,2),lr=ne(ar),Ss=se(lr,!0),Dn=A(lr,2);ss(Dn,{placeholder:"new-project",type:"text",onkeydown:gn=>{gn.key==="Enter"&&!gn.isComposing&&(gn.preventDefault(),gn.stopPropagation(),ma())},class:"bg-sidebar border-none",noFocusStyle:!0,get value(){return l(fn)},set value(gn){k(fn,gn,!0)}}),Y(ar);var hn=A(ar,2);{var qn=gn=>{var _r=a$(),Mn=ne(_r),Zn=se(Mn,!0);Y(_r),L(()=>H(Zn,l(ur))),x(gn,_r)},kr=gn=>{var _r=u$(),Mn=ne(_r),Zn=se(Mn,!0),Ir=A(Mn,2);{var Wr=Lr=>{var Jn=l$(),jr=ne(Jn);fi(jr,{size:14});var ai=A(jr,2),li=se(ai,!0);Y(Jn),L(cr=>H(li,cr),[()=>_.workspace_repoSelector_checking_label()]),x(Lr,Jn)},er=Lr=>{var Jn=Lc(),jr=ne(Jn),ai=se(jr,!0),li=A(jr,2);qe(li,{size:"sm",onclick:ma,class:"shrink-0",children:(cr,hc)=>{Pt();var Cs=zt();L(Li=>H(Cs,Li),[()=>_.workspace_repoSelector_select_label()]),x(cr,Cs)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_repoExists_label({isolationLabel:$})]),x(Lr,Jn)},Ks=Lr=>{var Jn=Lc(),jr=ne(Jn),ai=se(jr,!0),li=A(jr,2);qe(li,{size:"sm",onclick:ma,class:"shrink-0",children:(cr,hc)=>{Pt();var Cs=zt();L(Li=>H(Cs,Li),[()=>_.workspace_repoSelector_select_label()]),x(cr,Cs)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.onboarding_localRepoTab_plainFolder_description()]),x(Lr,Jn)},$o=Lr=>{var Jn=Lc(),jr=ne(Jn),ai=se(jr,!0),li=A(jr,2);qe(li,{size:"sm",variant:"primary",onclick:ma,class:"shrink-0",children:(cr,hc)=>{Pt();var Cs=zt();L(Li=>H(Cs,Li),[()=>_.workspace_repoSelector_create_label()]),x(cr,Cs)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_newFolderWillBeCreated_label()]),x(Lr,Jn)},oo=Lr=>{var Jn=c$(),jr=ne(Jn),ai=se(jr,!0),li=A(jr,2);qe(li,{size:"sm",variant:"primary",onclick:ma,class:"shrink-0",disabled:!0,children:(cr,hc)=>{Pt();var Cs=zt();L(Li=>H(Cs,Li),[()=>_.workspace_repoSelector_create_label()]),x(cr,Cs)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_folderNotGitRepo_label()]),x(Lr,Jn)},$s=Lr=>{var Jn=Lc(),jr=ne(Jn),ai=se(jr,!0),li=A(jr,2);qe(li,{size:"sm",variant:"primary",onclick:ma,class:"shrink-0",children:(cr,hc)=>{Pt();var Cs=zt();L(Li=>H(Cs,Li),[()=>_.workspace_repoSelector_create_label()]),x(cr,Cs)},$$slots:{default:!0}}),Y(Jn),L(cr=>H(ai,cr),[()=>_.workspace_repoSelector_newRepoWillBeCreated_label()]),x(Lr,Jn)};j(Ir,Lr=>{l(Ti)?Lr(Wr):l(Zr)?.exists&&l(Zr)?.isGitRepo?Lr(er,1):l(Mi)==="existing"?Lr(Ks,2):l(Mi)==="new"?Lr($o,3):l(Zr)?.exists&&!l(Zr)?.isGitRepo?Lr(oo,4):Lr($s,-1)})}Y(_r),L(()=>H(Zn,l(ws))),x(gn,_r)};j(hn,gn=>{l(ur)?gn(qn):l(ws)&&gn(kr,1)})}L(gn=>H(Ss,gn),[()=>_.workspace_repoSelector_folderName_label()]),x(pn,Nn)},ol=pn=>{var Nn=g$(),mr=ne(Nn);is(mr,17,()=>l(ys),Dn=>Dn.id,(Dn,hn)=>{var qn=f$(),kr=ne(qn);rp(kr,{size:14,class:"text-ghost shrink-0"});var gn=A(kr,2),_r=ne(gn),Mn=se(_r,!0),Zn=A(_r,2),Ir=se(Zn,!0);Y(gn);var Wr=A(gn,2);{let er=w(()=>_.workspace_repoSelector_removeSetup_tooltip());qe(Wr,{variant:"ghost",type:"button",size:"icon-compact",iconOnly:!0,onclick:Ks=>{Ks.stopPropagation(),Ks.preventDefault(),Oe(l(hn).id)},class:"ml-1 rounded text-muted-foreground hover:text-danger hover:bg-danger-background/10",get title(){return l(er)},children:(Ks,$o)=>{tt(Ks,{get icon(){return Ki},size:"xs"})},$$slots:{default:!0}})}Y(qn),L(()=>{H(Mn,l(hn).name),H(Ir,l(hn).transport==="websocket"?l(hn).wsUrl:`${l(hn).username}@${l(hn).host}:${l(hn).port}`)}),Jr("click",qn,()=>J(l(hn))),Jr("keydown",qn,er=>{(er.key==="Enter"||er.key===" ")&&(er.preventDefault(),J(l(hn)))}),x(Dn,qn)});var ar=A(mr,2);{var lr=Dn=>{var hn=h$(),qn=se(hn,!0);L(kr=>H(qn,kr),[()=>_.workspace_repoSelector_noRemoteSetups_label()]),x(Dn,hn)};j(ar,Dn=>{l(ys).length===0&&Dn(lr)})}var Ss=A(ar,2);qe(Ss,{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:Ue,children:(Dn,hn)=>{var qn=p$(),kr=ue(qn);tt(kr,{get icon(){return Gc},size:"sm"});var gn=A(kr);L(_r=>H(gn,` ${_r??""}`),[()=>_.workspace_repoSelector_addRemoteSetup_label()]),x(Dn,qn)},$$slots:{default:!0}}),Y(Nn),x(pn,Nn)};j(nl,pn=>{l(Ut)==="gitlab"&&Be()?pn(rl):l(Ut)==="local"?pn(sl,1):l(Ut)==="github"?pn(il,2):l(Ut)==="new"?pn(fc,3):l(Ut)==="remote"&&pn(ol,4)})}Y(so);var Do=A(so,2);{var Dw=pn=>{var Nn=m$(),mr=ne(Nn),ar=ne(mr);tt(ar,{get icon(){return Qs},class:"text-ghost shrink-0 mt-0.5"});var lr=A(ar,2),Ss=ne(lr),Dn=se(Ss,!0),hn=A(Ss,2),qn=se(hn,!0),kr=A(hn,2),gn=ne(kr);qe(gn,{size:"sm",variant:"secondary",onclick:Tw,children:(Mn,Zn)=>{Pt();var Ir=zt();L(Wr=>H(Ir,Wr),[()=>_.workspace_repoSelector_initializeGit_label()]),x(Mn,Ir)},$$slots:{default:!0}});var _r=A(gn,2);qe(_r,{size:"sm",variant:"secondary",onclick:Aw,children:(Mn,Zn)=>{Pt();var Ir=zt();L(Wr=>H(Ir,Wr),[()=>_.workspace_repoSelector_chooseDifferentFolder_label()]),x(Mn,Ir)},$$slots:{default:!0}}),Y(kr),Y(lr),Y(mr),Y(Nn),L((Mn,Zn)=>{st(Ss,"title",l(un)),H(Dn,Mn),H(qn,Zn)},[()=>l(un).split("/").pop()||l(un),()=>_.workspace_repoSelector_notGitRepository_label()]),x(pn,Nn)};j(Do,pn=>{l(Ut)!=="gitlab"&&l(Ut)!=="sessions"&&l(Rs)&&l(un)&&pn(Dw)})}var $w=A(Do,2);{var Bw=pn=>{var Nn=w$(),mr=ne(Nn);Kx(mr,{size:5,class:"mb-2",children:(Dn,hn)=>{Pt();var qn=zt();L(kr=>H(qn,kr),[()=>_.workspace_repoSelector_recent_label()]),x(Dn,qn)},$$slots:{default:!0}});var ar=A(mr,2);{var lr=Dn=>{var hn=b$();is(hn,20,()=>[1,2,3],Nc,(qn,kr)=>{var gn=v$();x(qn,gn)}),Y(hn),x(Dn,hn)},Ss=Dn=>{var hn=y$(),qn=ne(hn);{let kr=w(()=>l(ti)());T(qn,()=>l(kr),()=>(gn,_r)=>_r===l(Ls))}Y(hn),x(Dn,hn)};j(ar,Dn=>{l(xt)&&l(yr).length===0?Dn(lr):Dn(Ss,-1)})}Y(Nn),x(pn,Nn)},zw=w(()=>!we()&&(l(Ut)==="local"||l(Xt))&&(l(xt)||l(ti)().length>0));j($w,pn=>{l(zw)&&pn(Bw)})}L(()=>io=at(so,1,"shrink-0 px-3 mb-3",null,io,{hidden:l(Ut)==="sessions"})),x(yi,Pi)},$$slots:{default:!0}})})}x(In,ts)},$$slots:{default:!0}})})}x(mn,gr)};j(Ai,mn=>{we()&&l(Kn)==="browse"?mn(Ri):mn(oi,-1)})}x(xr,pr)},$$slots:{default:!0}})})}x(xn,to)},$$slots:{default:!0}})}),Y(xd)}var bp=A(xd,2);{var Lw=T=>{dw(T,{get isOpen(){return l(ga)},onclose:()=>k(ga,!1),onsave:Ct})};j(bp,T=>{D()&&T(Lw)})}var Ow=A(bp,2);Qk(Ow,{get open(){return l(Br)},get title(){return l(pa)},get initialPath(){return l(Ci)},selectLabel:"Select folder",onSelect:hp,onClose:Mw}),x(n,vp);var Nw=Lt(Pw);return oe(),Nw}Ao(["click","keydown"]);var S$=B('<p class="break-all type-caption text-muted-foreground" data-testid="gitlab-picker-instance"> </p>'),C$=B('<div class="flex items-center rounded-lg bg-sidebar"><!></div>'),M$=B('<span class="mt-1 block"> </span>'),T$=B("<span> </span> <!>",1),Xm=B("<!> <!>",1),E$=B("<div><!> <!></div>"),A$=B("<!> <!> <!>",1),R$=B('<div data-testid="gitlab-picker-list"><!> <!></div>');function vw(n,e){if(new.target)return Ot({component:vw,...n});It(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),m=y(e,"getText",7),v=y(e,"onSelect",7),C=y(e,"row",7),z=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 O={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 m()},set getText(F){m(F),b()},get onSelect(){return v()},set onSelect(F){v(F),b()},get row(){return C()},set row(F){C(F),b()},get compact(){return z()},set compact(F=!1){z(F),b()},$set:Nt,$on:(F,W)=>Dt(e,F,W)},N=R$(),E=ne(N);{var D=F=>{var W=S$(),X=se(W,!0);L(()=>H(X,s())),x(F,W)};j(E,F=>{s()&&!r()&&!z()&&F(D)})}var ee=A(E,2);{var U=F=>{var W=Xm(),X=ue(W);{var le=Q=>{var me=C$(),P=ne(me);Xn(P,r),Y(me),x(Q,me)};j(X,Q=>{r()&&Q(le)})}var re=A(X,2);{const Q=$=>{var ce=T$(),pe=ue(ce),ye=se(pe,!0),Z=A(pe,2);{var ae=V=>{var K=M$(),I=se(K,!0);L(()=>H(I,o().detail)),x(V,K)};j(Z,V=>{o().detail&&V(ae)})}L(()=>H(ye,o().message)),x($,ce)};let me=w(()=>h()?o().actionLabel:void 0),P=w(()=>h()&&o().actionLabel?()=>h()?.(t()):void 0);Jx(re,{density:"compact",get retryLabel(){return l(me)},get onRetry(){return l(P)},message:Q,$$slots:{message:!0}})}x(F,W)},oe=F=>{var W=A$(),X=ue(W);{var le=pe=>{{let ye=w(()=>!t());ss(pe,{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"})}},re=pe=>{e_(pe,{get label(){return a().searchLabel},control:(Z,ae=Xr)=>{var V=E$(),K=ne(V);{var I=ve=>{var de=Ze(),fe=ue(de);Xn(fe,r),x(ve,de)};j(K,ve=>{r()&&ve(I)})}var te=A(K,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);ss(te,ms(ae,{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)}}))}Y(V),L(()=>at(V,1,$n(r()?"flex items-center rounded-lg bg-sidebar focus-within:ring-1 focus-within:ring-ring":void 0))),x(Z,V)},$$slots:{control:!0}})};j(X,pe=>{z()?pe(le):pe(re,-1)})}var Q=A(X,2);{var me=pe=>{{let ye=w(()=>!i().trim()||o().status==="loading"||o().loadingMore);qe(pe,{type:"button",variant:"secondary",class:"w-full shrink-0",get disabled(){return l(ye)},onclick:()=>u()?.(i(),t()),children:(Z,ae)=>{Pt();var V=zt();L(()=>H(V,d())),x(Z,V)},$$slots:{default:!0}})}};j(Q,pe=>{u()&&d()&&pe(me)})}var P=A(Q,2);{var $=pe=>{Xx(pe,{get label(){return a().loadingLabel},density:"compact"})},ce=pe=>{var ye=Xm(),Z=ue(ye);dh(Z,t,K=>{{const I=fe=>{Qx(fe,{density:"compact",description:be=>{Pt();var q=zt();L(()=>H(q,i()?a().emptySearchLabel:a().emptyLabel)),x(be,q)},$$slots:{description:!0}})};let te=w(()=>p()?[p()]:[]),ve=w(()=>z()?"min-h-0 flex-1":"max-h-56"),de=w(()=>z()?40:void 0);Yx(K,{get items(){return o().items},get getKey(){return g()},get getText(){return m()},selectable:"single",get selectedKeys(){return l(te)},onActivate:fe=>v()(fe,t()),get ariaLabel(){return a().listLabel},get class(){return l(ve)},get rowHeight(){return l(de)},get row(){return C()},empty:I,$$slots:{empty:!0}})}});var ae=A(Z,2);{var V=K=>{qe(K,{type:"button",variant:"ghost",class:"w-full shrink-0",get disabled(){return o().loadingMore},onclick:()=>f()(t()),children:(I,te)=>{Pt();var ve=zt();L(()=>H(ve,o().loadingMore?a().loadingMoreLabel:a().loadMoreLabel)),x(I,ve)},$$slots:{default:!0}})};j(ae,K=>{(o().hasMore||o().loadingMore)&&K(V)})}x(pe,ye)};j(P,pe=>{o().status==="loading"?pe($):pe(ce,-1)})}x(F,W)};j(ee,F=>{o().status==="unavailable"?F(U):F(oe,-1)})}return Y(N),sr(N,F=>k(M,F),()=>l(M)),L(()=>at(N,1,$n(z()?"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,N),Lt(O)}var P$=new Set(["$$slots","$$events","$$legacy","projectPath","selectedBranch","placeholder","protectedLabel","triggerClass","rowLabel","isLoading","showTriggerChevron","triggerChevronClass","onSelect","onOpenChange"]),I$=B("<span> </span>"),L$=B('<!> <span class="sr-only"> </span>',1),O$=B('<span class="flex-1 min-w-0 text-left truncate"> </span>'),N$=B("<span><!> <!> <!></span>"),D$=B('<p class="break-all type-caption text-foreground"> </p>'),$$=B('<span class="type-caption shrink-0 text-muted-foreground"> </span>'),B$=B('<div><!> <span class="min-w-0 flex-1 truncate"> </span> <!> <!></div>'),Ym=B("<!> <!>",1);function jc(n,e){if(new.target)return Ot({component:jc,...n});It(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=Yi(e,P$),g=he(!1);const m=ju(),v=new Ku,C=w(()=>c()||e.page.status==="loading");var z={get projectPath(){return t()},set projectPath(O){t(O),b()},get selectedBranch(){return r()},set selectedBranch(O){r(O),b()},get placeholder(){return s()},set placeholder(O){s(O),b()},get protectedLabel(){return i()},set protectedLabel(O){i(O),b()},get triggerClass(){return o()},set triggerClass(O){o(O),b()},get rowLabel(){return a()},set rowLabel(O){a(O),b()},get isLoading(){return c()},set isLoading(O=!1){c(O),b()},get showTriggerChevron(){return u()},set showTriggerChevron(O=!1){u(O),b()},get triggerChevronClass(){return d()},set triggerChevronClass(O){d(O),b()},get onSelect(){return f()},set onSelect(O){f(O),b()},get onOpenChange(){return h()},set onOpenChange(O){h(O),b()},$set:Nt,$on:(O,N)=>Dt(e,O,N)},M=Ze(),S=ue(M);return wt(S,()=>Wu,(O,N)=>{N(O,{onOpenChange:E=>h()?.(E,e.scopeKey),get open(){return l(g)},set open(E){k(g,E,!0)},children:(E,D)=>{var ee=Ym(),U=ue(ee);{const F=(W,X)=>{let le=()=>(X?.()).props;{let re=w(()=>`min-w-0 max-w-full text-muted-foreground ${o()??""}`),Q=w(()=>!a());qe(W,ms(le,{variant:"ghost",type:"button",get class(){return l(re)},get"aria-busy"(){return l(C)},get wrapContent(){return l(Q)},children:(me,P)=>{var $=N$(),ce=ne($);{var pe=I=>{var te=I$(),ve=se(te,!0);L(()=>{at(te,1,$n(dn.fieldLabel)),H(ve,a())}),x(I,te)};j(ce,I=>{a()&&I(pe)})}var ye=A(ce,2);{var Z=I=>{var te=L$(),ve=ue(te);fi(ve,{size:14,class:"text-ghost"});var de=A(ve,2),fe=se(de,!0);L(()=>H(fe,e.copy.loadingLabel)),x(I,te)},ae=I=>{var te=O$(),ve=se(te,!0);L(()=>H(ve,r()?.name||s())),x(I,te)};j(ye,I=>{!r()&&l(C)?I(Z):I(ae,-1)})}var V=A(ye,2);{var K=I=>{tt(I,{get icon(){return ra},size:10,get class(){return d()}})};j(V,I=>{u()&&!l(C)&&I(K)})}Y($),L(()=>at($,1,`flex w-full min-w-0 items-center truncate ${a()?"gap-2":"gap-0.75"}`)),x(me,$)},$$slots:{default:!0}}))}};wt(U,()=>Uu,(W,X)=>{X(W,{child:F,$$slots:{child:!0}})})}var oe=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"),X=w(()=>a()?v.current?"bottom":"left":void 0),le=w(()=>a()?v.current?4:24:void 0),re=w(()=>a()&&v.current?"end":"start"),Q=w(()=>({to:m()})),me=w(()=>m()?"absolute":"fixed");wt(oe,()=>Vu,(P,$)=>{$(P,{role:"dialog",get"aria-label"(){return l(F)},get class(){return l(W)},get side(){return l(X)},get sideOffset(){return l(le)},get align(){return l(re)},get portalProps(){return l(Q)},get strategy(){return l(me)},onkeydown:ce=>{ce.key==="Enter"&&ce.stopPropagation()},children:(ce,pe)=>{var ye=Ym(),Z=ue(ye);{var ae=K=>{var I=D$(),te=se(I,!0);L(()=>H(te,t())),x(K,I)};j(Z,K=>{a()||K(ae)})}var V=A(Z,2);{const K=(ve,de)=>{let fe=()=>(de?.()).item,ke=()=>(de?.()).selected;var be=Ze(),q=ue(be);{var Me=gt=>{var Le=B$(),De=ne(Le);mo(De,{size:16,get class(){return dn.icon}});var Fe=A(De,2),vt=se(Fe,!0),Vt=A(Fe,2);{var nt=Ce=>{var we=$$(),Ve=se(we,!0);L(()=>H(Ve,i())),x(Ce,we)};j(Vt,Ce=>{fe().protected&&Ce(nt)})}var Pe=A(Vt,2);{let Ce=w(()=>ke()?"checked":"empty");Av(Pe,{get state(){return l(Ce)},get class(){return dn.check}})}Y(Le),L(()=>{at(Le,1,`flex ${dn.row}`),H(vt,fe().name)}),x(gt,Le)},ze=gt=>{t_(gt,{title:Fe=>{Pt();var vt=zt();L(()=>H(vt,fe().name)),x(Fe,vt)},meta:Fe=>{Pt();var vt=zt();L(()=>H(vt,fe().protected?i():"")),x(Fe,vt)},$$slots:{title:!0,meta:!0}})};j(q,gt=>{a()?gt(Me):gt(ze,-1)})}x(ve,be)};let I=w(()=>!!a()),te=w(()=>r()?.name);vw(V,ms(()=>p,{get compact(){return l(I)},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:K,$$slots:{row:!0}}))}x(ce,ye)},$$slots:{default:!0}})})}x(E,ee)},$$slots:{default:!0}})}),x(n,M),Lt(z)}var z$=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>'),F$=B('<div class="min-w-0"><!></div>'),H$=B('<label class="flex items-center gap-2 py-2 text-sm text-muted-foreground"><!> </label>'),U$=B('<p class="min-w-0 truncate text-sm text-muted-foreground"> </p> <!>',1),Zd=B("<!> <!> <!>",1),V$=B('<div class="relative min-w-0"><!> <!></div>'),ci=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>'),Qm=B('<!> <span class="text-sm text-subtle whitespace-nowrap shrink-0"> </span>',1),Oc=B("<!> <!>",1),Zm=B("<!> <!> <!> <!> <!>",1),W$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pr-1"> </span>'),j$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 px-1"> </span>'),K$=B('<span class="text-sm text-subtle whitespace-nowrap shrink-0 pl-1"> </span>'),G$=B('<!> <span class="text-ui text-subtle whitespace-nowrap"> </span>',1),q$=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),J$=B("<div><!></div>");function X$(n,e){if(new.target)return Ot({component:X$,...n});It(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),m=y(e,"onSkipIsolationChange",7),v=y(e,"onGitHubAuthNeededChange",7),C=y(e,"onBranchStatusChange",7),z=y(e,"onBranchesLoaded",7),M=y(e,"presentation",7,"default"),S=y(e,"field",7,"both"),O=y(e,"isLoading",7,!1),N=y(e,"detectedGitHubOwner",7,null),E=y(e,"detectedGitHubRepo",7,null),D=y(e,"plainFolderMode",7,!1),ee=y(e,"plainFolder",7,null),U=y(e,"gitChoice",7),oe=y(e,"sessions",7);const F=w(()=>M()==="metadata"),W=w(()=>M()==="form"),X="\0",le=ge=>ge.split(X).map(ft=>ft.trim()),re=w(()=>le(_.workspace_repoAndBranchPicker_workOnRepo_label({repo:X}))),Q=w(()=>le(_.workspace_repoAndBranchPicker_workOnRepoOffBranch_label({repo:X,branch:X}))),me=w(()=>le(_.workspace_repoAndBranchPicker_repoOffBranch_label({repo:X,branch:X}))),P=w(()=>le(_.workspace_repoAndBranchPicker_cloneRepoAndWorkOffBranch_label({repo:X,branch:X}))),$=w(()=>le(_.workspace_repoAndBranchPicker_workInFolder_label({repo:X}))),ce=w(()=>le((c()?_.workspace_repoAndBranchPicker_workOnRemoteOnBranch_label:_.workspace_repoAndBranchPicker_workOnRemoteOffBranch_label)({repo:X,path:X,branch:X}))),pe=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=dn.metadataTriggerSurface,Z=w(()=>l(F)?`${dn.metadataTrigger} ${ye}`:"px-1 font-medium text-sm bg-transparent h-auto min-h-(--control-height-compact) py-0.5 rounded-(--radius-medium)"),ae=w(()=>l(F)?`${dn.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=dn.metadataChevron,K="text-foreground font-medium",I="text-muted-foreground",te="main",ve=w(()=>l(F)&&S()==="branch"&&O()),de=w(()=>f()?`${f().username}@${f().host}:${f().workspacePath}`:"");function fe(ge){const ft=ge.split(/[\\/]/).filter(Boolean);return ft[ft.length-1]||ge}function ke(ge){const ft=ge.trim().replace(/^git@github\.com:/,"https://github.com/");try{const Rt=new URL(ft.startsWith("http")?ft:`https://${ft}`);return Rt.hostname!=="github.com"?fe(ge):Rt.pathname.replace(/^\//,"").replace(/\.git$/,"")||fe(ge)}catch{return fe(ge.replace(/\.git$/,""))}}const be=w(()=>s()==="gitlab"?i()?.selectedProjectPath??"":s()==="remote"&&f()?f().name:s()==="github"&&a()?ke(a()):fe(t())),q=w(()=>s()==="gitlab"?o()?.selectedBranch?.name??"":s()==="remote"&&f()&&f().branch||r()||te),Me=w(()=>l(be)?`${l(be)}/${l(q)}`:""),ze=w(()=>s()==="gitlab"?"":s()==="remote"&&f()?f().name:s()==="github"&&a()?a():t()),gt=w(()=>l(F)?l(be):void 0),Le=w(()=>N()&&E()?`${N()}/${E()}`:void 0),De=w(()=>t()||(s()==="remote"&&f()?f().workspacePath:""));function Fe(ge){p()?.(ge)}function vt(ge){g()?.(ge)}const Vt=w(()=>s()==="gitlab"||!!t()||s()==="github"&&!!a()||s()==="remote"&&!!f());let nt=he(void 0);function Pe(){l(nt)?.focusInput?.()}function Ce(ge="local"){l(nt)?.openOnLocalTab?.(ge)}var we={focusInput:Pe,openFolderSelection:Ce,get repoPath(){return t()},set repoPath(ge=""){t(ge),b()},get branch(){return r()},set branch(ge=""){r(ge),b()},get repoType(){return s()},set repoType(ge="local"){s(ge),b()},get gitlab(){return i()},set gitlab(ge){i(ge),b()},get gitlabBranch(){return o()},set gitlabBranch(ge){o(ge),b()},get githubUrl(){return a()},set githubUrl(ge=""){a(ge),b()},get skipIsolation(){return c()},set skipIsolation(ge=!1){c(ge),b()},get isNewRepo(){return u()},set isNewRepo(ge=!1){u(ge),b()},get suggestedBranch(){return d()},set suggestedBranch(ge){d(ge),b()},get remoteSetup(){return f()},set remoteSetup(ge=null){f(ge),b()},get onRemoteSetupChange(){return h()},set onRemoteSetupChange(ge){h(ge),b()},get onRepoChange(){return p()},set onRepoChange(ge){p(ge),b()},get onBranchChange(){return g()},set onBranchChange(ge){g(ge),b()},get onSkipIsolationChange(){return m()},set onSkipIsolationChange(ge){m(ge),b()},get onGitHubAuthNeededChange(){return v()},set onGitHubAuthNeededChange(ge){v(ge),b()},get onBranchStatusChange(){return C()},set onBranchStatusChange(ge){C(ge),b()},get onBranchesLoaded(){return z()},set onBranchesLoaded(ge){z(ge),b()},get presentation(){return M()},set presentation(ge="default"){M(ge),b()},get field(){return S()},set field(ge="both"){S(ge),b()},get isLoading(){return O()},set isLoading(ge=!1){O(ge),b()},get detectedGitHubOwner(){return N()},set detectedGitHubOwner(ge=null){N(ge),b()},get detectedGitHubRepo(){return E()},set detectedGitHubRepo(ge=null){E(ge),b()},get plainFolderMode(){return D()},set plainFolderMode(ge=!1){D(ge),b()},get plainFolder(){return ee()},set plainFolder(ge=null){ee(ge),b()},get gitChoice(){return U()},set gitChoice(ge){U(ge),b()},get sessions(){return oe()},set sessions(ge){oe(ge),b()},$set:Nt,$on:(ge,ft)=>Dt(e,ge,ft)},Ve=J$(),Mt=ne(Ve);{var ie=ge=>{var ft=Zd(),Rt=ue(ft);{let Ie=w(()=>s()==="gitlab"),He=w(()=>!!ee()&&s()==="local"),Xe=w(()=>_.workspace_compactInitializer_repository_label()),pt=w(()=>l(be)||void 0);sr(qs(Rt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},get sessions(){return oe()},variant:"ghost",get gitlabSelected(){return l(Ie)},get plainFolderSelected(){return l(He)},get value(){return l(ze)},onchange:Fe,get rowLabel(){return l(Xe)},get triggerClass(){return dn.fieldTrigger},get displayValue(){return l(pt)},triggerValueClass:"text-foreground",triggerContentClass:"gap-1"}),Qe=>k(nt,Qe,!0),()=>l(nt))}var ln=A(Rt,2);{var Gt=Ie=>{var He=F$(),Xe=ne(He);{var pt=it=>{var xt=Ze(),Ft=ue(xt);{var $t=Ye=>{{let cn=w(()=>_.workspace_compactInitializer_branch_label());jc(Ye,ms(o,{get rowLabel(){return l(cn)},get triggerClass(){return dn.fieldTrigger},showTriggerChevron:!1}))}};j(Ft,Ye=>{o()&&Ye($t)})}x(it,xt)},Qe=it=>{var xt=z$(),Ft=ne(xt),$t=se(Ft,!0),Ye=A(Ft,2),cn=se(Ye,!0);Y(xt),L(_n=>{at(Ft,1,$n(dn.fieldLabel)),H($t,_n),H(cn,f().branch||"main")},[()=>_.workspace_compactInitializer_branch_label()]),x(it,xt)},et=it=>{{let xt=w(()=>_.workspace_compactInitializer_branch_label()),Ft=w(()=>!l(Vt));wl(it,{variant:"ghost",get rowLabel(){return l(xt)},get triggerClass(){return dn.fieldTrigger},get value(){return r()},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(Ft)},showUncommittedIndicator:!0,triggerContentClass:"w-full gap-2",onSkipIsolationChange:$t=>m()?.($t),onGitHubAuthNeededChange:$t=>v()?.($t),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}};j(Xe,it=>{s()==="gitlab"?it(pt):s()==="remote"&&f()?it(Qe,1):it(et,-1)})}Y(He),x(Ie,He)};j(ln,Ie=>{!u()&&l(Vt)&&!(ee()&&s()==="local")&&Ie(Gt)})}var ut=A(ln,2);{var ht=Ie=>{var He=U$(),Xe=ue(He),pt=se(Xe,!0);$l(Xe,(it,xt)=>uf?.(it,xt),()=>l(de));var Qe=A(Xe,2);{var et=it=>{var xt=H$(),Ft=ne(xt);jp(Ft,{get checked(){return c()},onCheckedChange:Ye=>m()?.(Ye)});var $t=A(Ft);Y(xt),L(Ye=>H($t,` ${Ye??""}`),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),x(it,xt)};j(Qe,it=>{typeof m()=="function"&&it(et)})}L(()=>H(pt,l(de))),x(Ie,He)};j(ut,Ie=>{s()==="remote"&&f()&&Ie(ht)})}x(ge,ft)},$e=ge=>{{let ft=w(()=>s()==="gitlab"),Rt=w(()=>l(F)?K:I),ln=w(()=>l(F)?"gap-1.5":"gap-0.75");sr(qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get gitlabSelected(){return l(ft)},get value(){return l(ze)},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(gt)},get triggerValueClass(){return l(Rt)},get triggerContentClass(){return l(ln)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}),Gt=>k(nt,Gt,!0),()=>l(nt))}},lt=ge=>{var ft=Ze(),Rt=ue(ft);{var ln=Gt=>{jc(Gt,ms(o,{get triggerClass(){return l(ae)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}))};j(Rt,Gt=>{o()&&Gt(ln)})}x(ge,ft)},yt=ge=>{var ft=V$(),Rt=ne(ft);{let ut=w(()=>l(F)&&!l(ve)),ht=w(()=>l(F)?`w-full gap-1.5 ${l(ve)?"pr-5":""}`:void 0);wl(Rt,{variant:"ghost",get triggerClass(){return l(ae)},get value(){return l(q)},get repoPath(){return l(De)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,disabled:!1,showUncommittedIndicator:!0,get showTriggerChevron(){return l(ut)},get triggerChevronClass(){return V},get triggerContentClass(){return l(ht)},onSkipIsolationChange:Ie=>m()?.(Ie),onGitHubAuthNeededChange:Ie=>v()?.(Ie),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}var ln=A(Rt,2);{var Gt=ut=>{fi(ut,{size:16,class:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-subtle"})};j(ln,ut=>{l(ve)&&ut(Gt)})}Y(ft),x(ge,ft)},mt=ge=>{var ft=Zd(),Rt=ue(ft);{var ln=Ie=>{var He=ci(),Xe=se(He,!0);L(()=>H(Xe,l(re)[0])),x(Ie,He)};j(Rt,Ie=>{!l(F)&&l(re)[0]&&Ie(ln)})}var Gt=A(Rt,2);{let Ie=w(()=>l(F)?K:I),He=w(()=>l(F)?"gap-1.5":"gap-0.75");sr(qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",value:"",onchange:Fe,get triggerClass(){return l(Z)},get triggerValueClass(){return l(Ie)},get triggerContentClass(){return l(He)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}}),Xe=>k(nt,Xe,!0),()=>l(nt))}var ut=A(Gt,2);{var ht=Ie=>{var He=ci(),Xe=se(He,!0);L(()=>H(Xe,l(re)[1])),x(Ie,He)};j(ut,Ie=>{!l(F)&&l(re)[1]&&Ie(ht)})}x(ge,ft)},Tt=ge=>{var ft=Zd(),Rt=ue(ft);{var ln=Ie=>{var He=Ze(),Xe=ue(He);{var pt=et=>{var it=Qm(),xt=ue(it);tt(xt,{get icon(){return Gc},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var Ft=A(xt,2),$t=se(Ft,!0);L(Ye=>H($t,Ye),[()=>_.workspace_repoAndBranchPicker_createFolder_label()]),x(et,it)},Qe=et=>{var it=ci(),xt=se(it,!0);L(()=>H(xt,l($)[0])),x(et,it)};j(Xe,et=>{ee()==="new"?et(pt):l($)[0]&&et(Qe,1)})}x(Ie,He)};j(Rt,Ie=>{l(F)||Ie(ln)})}var Gt=A(Rt,2);{let Ie=w(()=>l(F)?l(be):void 0),He=w(()=>l(F)?K:I),Xe=w(()=>l(F)?"gap-1.5":"gap-0.75");qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Ie)},get triggerValueClass(){return l(He)},get triggerContentClass(){return l(Xe)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=Ie=>{var He=ci(),Xe=se(He,!0);L(()=>H(Xe,l($)[1])),x(Ie,He)};j(ut,Ie=>{!l(F)&&ee()!=="new"&&l($)[1]&&Ie(ht)})}x(ge,ft)},We=ge=>{var ft=Oc(),Rt=ue(ft);{var ln=ut=>{var ht=Qm(),Ie=ue(ht);tt(Ie,{get icon(){return Gc},size:"sm",class:"ml-0.75 mr-2 shrink-0"});var He=A(Ie,2),Xe=se(He,!0);L(pt=>H(Xe,pt),[()=>_.workspace_repoAndBranchPicker_createNewRepo_label()]),x(ut,ht)};j(Rt,ut=>{l(F)||ut(ln)})}var Gt=A(Rt,2);{let ut=w(()=>l(F)?l(Me):void 0),ht=w(()=>l(F)?K:I),Ie=w(()=>l(F)?"gap-1.5":"gap-0.75");qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(ut)},get triggerValueClass(){return l(ht)},get triggerContentClass(){return l(Ie)},get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}x(ge,ft)},Ke=ge=>{{let ft=w(()=>s()==="gitlab"),Rt=w(()=>s()==="gitlab"?"":t());qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},get gitlabSelected(){return l(ft)},variant:"ghost",get value(){return l(Rt)},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:K,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})}},Qt=ge=>{var ft=Zm(),Rt=ue(ft);{var ln=et=>{var it=Oc(),xt=ue(it);Qo(xt,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var Ft=A(xt,2);{var $t=Ye=>{var cn=ci(),_n=se(cn,!0);L(()=>H(_n,l(P)[0])),x(Ye,cn)};j(Ft,Ye=>{l(P)[0]&&Ye($t)})}x(et,it)};j(Rt,et=>{l(F)||et(ln)})}var Gt=A(Rt,2);{let et=w(()=>s()==="gitlab"),it=w(()=>s()==="gitlab"?"":t()),xt=w(()=>l(F)?K:I);qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},get gitlabSelected(){return l(et)},variant:"ghost",get value(){return l(it)},onchange:Fe,get triggerClass(){return l(Z)},get triggerValueClass(){return l(xt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=et=>{var it=ci(),xt=se(it,!0);L(()=>H(xt,l(F)?l(me)[1]:l(P)[1])),x(et,it)};j(ut,et=>{(l(F)?l(me)[1]:l(P)[1])&&et(ht)})}var Ie=A(ut,2);{var He=et=>{var it=Ze(),xt=ue(it);{var Ft=$t=>{jc($t,ms(o,{get triggerClass(){return l(ae)}}))};j(xt,$t=>{o()&&$t(Ft)})}x(et,it)},Xe=et=>{{let it=w(()=>t()||""),xt=w(()=>!t()),Ft=w(()=>l(F)?"w-full gap-1.5":void 0);wl(et,{variant:"ghost",get triggerClass(){return l(ae)},get value(){return r()},get repoPath(){return l(it)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(xt)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V},get triggerContentClass(){return l(Ft)},onSkipIsolationChange:$t=>m()?.($t),onGitHubAuthNeededChange:$t=>v()?.($t),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}};j(Ie,et=>{s()==="gitlab"?et(He):et(Xe,-1)})}var pt=A(Ie,2);{var Qe=et=>{var it=ci(),xt=se(it,!0);L(()=>H(xt,l(F)?l(me)[2]:l(P)[2])),x(et,it)};j(pt,et=>{(l(F)?l(me)[2]:l(P)[2])&&et(Qe)})}x(ge,ft)},Be=ge=>{qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return f().name},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:K,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})},jt=ge=>{var ft=q$(),Rt=ue(ft);{var ln=Ye=>{var cn=Oc(),_n=ue(cn);rp(_n,{size:16,class:"text-ghost ml-0.75 -mb-px mr-2 shrink-0"});var yr=A(_n,2);{var ei=sn=>{var Er=ci(),us=se(Er,!0);L(()=>H(us,l(ce)[0])),x(sn,Er)};j(yr,sn=>{l(ce)[0]&&sn(ei)})}x(Ye,cn)};j(Rt,Ye=>{l(F)||Ye(ln)})}var Gt=A(Rt,2);{let Ye=w(()=>l(F)?K:I);qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return f().name},onchange:Fe,get triggerClass(){return l(Z)},get triggerValueClass(){return l(Ye)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=Ye=>{var cn=W$(),_n=se(cn,!0);L(()=>H(_n,l(ce)[1])),x(Ye,cn)};j(ut,Ye=>{l(ce)[1]&&Ye(ht)})}var Ie=A(ut,2),He=se(Ie,!0);$l(Ie,(Ye,cn)=>uf?.(Ye,cn),()=>l(de));var Xe=A(Ie,2);{var pt=Ye=>{var cn=j$(),_n=se(cn,!0);L(()=>H(_n,l(ce)[2])),x(Ye,cn)};j(Xe,Ye=>{l(ce)[2]&&Ye(pt)})}var Qe=A(Xe,2),et=se(Qe,!0),it=A(Qe,2);{var xt=Ye=>{var cn=K$(),_n=se(cn,!0);L(()=>H(_n,l(ce)[3])),x(Ye,cn)};j(it,Ye=>{l(ce)[3]&&Ye(xt)})}var Ft=A(it,2);{var $t=Ye=>{qe(Ye,{variant:"ghost",type:"button",onclick:()=>m()?.(!c()),class:"flex items-center gap-1.5 ml-3 shrink-0 cursor-pointer",children:(cn,_n)=>{var yr=G$(),ei=ue(yr);jp(ei,{get checked(){return c()},class:"-mb-0.5",onCheckedChange:us=>m()?.(us)});var sn=A(ei,2),Er=se(sn,!0);L(us=>H(Er,us),[()=>_.workspace_repoAndBranchPicker_workDirectly_label()]),x(cn,yr)},$$slots:{default:!0}})};j(Ft,Ye=>{typeof m()=="function"&&Ye($t)})}L(()=>{H(He,l(de)),H(et,f().branch||"main")}),x(ge,ft)},Yn=ge=>{qs(ge,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get displayValue(){return l(Me)},triggerValueClass:K,triggerContentClass:"gap-1.5",showTriggerChevron:!0,get triggerChevronClass(){return V}})},Bn=ge=>{var ft=Zm(),Rt=ue(ft);{var ln=pt=>{var Qe=Oc(),et=ue(Qe);Qo(et,{size:16,class:"ml-0.75 -mb-px mr-2 shrink-0"});var it=A(et,2);{var xt=Ft=>{var $t=ci(),Ye=se($t,!0);L(()=>H(Ye,l(Q)[0])),x(Ft,$t)};j(it,Ft=>{l(Q)[0]&&Ft(xt)})}x(pt,Qe)};j(Rt,pt=>{l(F)||pt(ln)})}var Gt=A(Rt,2);{let pt=w(()=>l(F)?K:I);qs(Gt,{get gitlab(){return i()},get plainFolderMode(){return D()},get gitChoice(){return U()},variant:"ghost",get value(){return t()},onchange:Fe,get triggerClass(){return l(Z)},get triggerSuffix(){return l(Le)},get triggerValueClass(){return l(pt)},triggerContentClass:"gap-0.75",get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V}})}var ut=A(Gt,2);{var ht=pt=>{var Qe=ci(),et=se(Qe,!0);L(()=>H(et,l(Q)[1])),x(pt,Qe)};j(ut,pt=>{l(Q)[1]&&pt(ht)})}var Ie=A(ut,2);{let pt=w(()=>t()||""),Qe=w(()=>!t()),et=w(()=>l(F)?"w-full gap-1.5":void 0);wl(Ie,{variant:"ghost",get triggerClass(){return l(ae)},get value(){return r()},get repoPath(){return l(pt)},get repoType(){return s()},get githubUrl(){return a()},get skipIsolation(){return c()},get suggestedBranch(){return d()},hasTriggerIcon:!1,get disabled(){return l(Qe)},showUncommittedIndicator:!0,get showTriggerChevron(){return l(F)},get triggerChevronClass(){return V},get triggerContentClass(){return l(et)},onSkipIsolationChange:it=>m()?.(it),onGitHubAuthNeededChange:it=>v()?.(it),get onBranchStatusChange(){return C()},get onBranchesLoaded(){return z()},onchange:vt})}var He=A(Ie,2);{var Xe=pt=>{var Qe=ci(),et=se(Qe,!0);L(()=>H(et,l(Q)[2])),x(pt,Qe)};j(He,pt=>{l(Q)[2]&&pt(Xe)})}x(ge,ft)};j(Mt,ge=>{l(W)?ge(ie):S()==="repo"?ge($e,1):S()==="branch"&&s()==="gitlab"?ge(lt,2):S()==="branch"?ge(yt,3):l(Vt)?ee()&&s()==="local"?ge(Tt,5):u()?ge(We,6):(s()==="github"&&a()||s()==="gitlab")&&l(F)?ge(Ke,7):s()==="github"&&a()||s()==="gitlab"?ge(Qt,8):s()==="remote"&&f()&&l(F)?ge(Be,9):s()==="remote"&&f()?ge(jt,10):l(F)?ge(Yn,11):ge(Bn,-1):ge(mt,4)})}return Y(Ve),L(()=>at(Ve,1,$n(l(W)?"grid min-w-0 gap-1":l(pe)))),x(n,Ve),Lt(we)}const Y$=/^[\w.-]+\/[\w.-]+$/;function ev(n){return n.replace(/[\\/]+$/,"")||n.slice(0,1)}function tv(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 kB(n){switch(n.type){case"github":{const e=n.githubUrl&&tv(n.githubUrl)||(n.path&&Y$.test(n.path.trim())?tv(n.path):null);return e?`github:${e}`:null}case"local":{const e=n.path?.trim();return e?`local:${ev(e)}`:null}case"remote":{const e=n.remote?.host?.trim().toLowerCase(),t=(n.remote?.workspacePath||n.path)?.trim();return e&&t?`remote:${e}:${ev(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 _B(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:",nv=";base64,";function Q$(n){if(!n.startsWith(ef))return null;const e=n.indexOf(nv,ef.length);if(e===-1)return null;const t=n.slice(ef.length,e),r=n.slice(e+nv.length);return!t.startsWith("image/")||r.length===0?null:{mimeType:t,data:r}}const rv=da("image-context-items");let Z$=0;const SB=30*1024*1024,CB=10*1024*1024;function e3(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 t3(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 MB(n,e){const{maxBytes:t,readFile:r=t3,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=Q$(c);if(!u)throw new Error("Invalid data URL format");const{mimeType:d,data:f}=u,h=Date.now(),p=a.name||Hx(d,`image-${h}`);i.push({id:`file-upload-${h}-${++Z$}-${p}`,type:"file",label:p,description:`${d} • ${e3(a.size)}`,path:p,file:a,imageData:f,imageMimeType:d,...mv(d)?{}:{placementFileName:p}})}catch(c){if(s?.aborted)return[];rv.error("Failed to add image to context",{fileName:a.name,error:c}),Ms.error(_.chat_richInput_addImageFailed_error({name:a.name}))}}return s?.aborted?[]:(i.length>0&&rv.debug(`Added ${i.length} image(s) to context`),o.length>0&&Ms.error(_.chat_richInput_filesTooLarge_error({names:o.join(", ")})),i)}var n3=B('<img class="w-full h-full object-cover"/>'),r3=B('<div class="flex size-full items-center justify-center bg-muted text-subtle"><!></div>'),s3=B("<div><!> <!></div> <!>",1),i3=B('<span class="tabular-nums opacity-70 shrink-0" data-testid="attachment-upload-progress"> </span>'),o3=B("<!> <!>",1),a3=B('<div class="w-4 h-4 rounded overflow-hidden shrink-0"><img class="w-full h-full object-cover"/></div>'),l3=B('<div><!> <span class="font-medium truncate max-w-30"> </span> <!> <!></div>');function c3(n,e){if(new.target)return Ot({component:c3,...n});It(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),m=y(e,"placementProgress",7,void 0),v=y(e,"placementError",7,void 0),C=y(e,"onRetry",7),z=he(null);const M=w(()=>mv(c()||s()||o()?.type));let S=he(null);const O=w(()=>l(M)?a()&&c()?`data:${Md(c())};base64,${a()}`:l(S):null);ct(()=>{if(l(M)&&!(a()&&c())&&o()){const $=URL.createObjectURL(o());return k(S,$,!0),()=>URL.revokeObjectURL($)}k(S,null)});const N=w(()=>{if(s()==="folder")return Qs;const $=Md(s()||c()||o()?.type);return $.startsWith("image")?Kc:$.includes("javascript")||$.includes("typescript")||$.includes("json")?of:$.includes("text")||$.includes("markdown")?nh:Vo}),E=w(()=>Md(s()||c()||o()?.type).startsWith("image")),D=w(()=>{if(g()!=="failed")return;const $=_.chat_attachmentPreview_placementFailed_tooltip({name:r()});return v()?`${$} — ${v()}`:$}),ee=w(()=>{if(g()!=="placing"||m()===void 0)return;const $=Math.max(0,Math.min(1,m()));return ov($,{style:"percent",maximumFractionDigits:0})});let U=he(!1),oe=he(null);function F(){f()==="thumbnail"&&l(E)&&l(O)&&k(U,!0)}function W($){($.key==="Enter"||$.key===" ")&&($.preventDefault(),F())}function X($){$.stopPropagation(),u()?.(t())}var le={get id(){return t()},set id($){t($),b()},get name(){return r()},set name($){r($),b()},get type(){return s()},set type($=""){s($),b()},get size(){return i()},set size($){i($),b()},get file(){return o()},set file($){o($),b()},get imageData(){return a()},set imageData($){a($),b()},get imageMimeType(){return c()},set imageMimeType($){c($),b()},get onRemove(){return u()},set onRemove($){u($),b()},get class(){return d()},set class($=""){d($),b()},get variant(){return f()},set variant($="chip"){f($),b()},get thumbnailClass(){return h()},set thumbnailClass($="w-16 h-16"){h($),b()},get disabled(){return p()},set disabled($=!1){p($),b()},get placementStatus(){return g()},set placementStatus($=void 0){g($),b()},get placementProgress(){return m()},set placementProgress($=void 0){m($),b()},get placementError(){return v()},set placementError($=void 0){v($),b()},get onRetry(){return C()},set onRetry($){C($),b()},$set:Nt,$on:($,ce)=>Dt(e,$,ce)},re=Ze(),Q=ue(re);{var me=$=>{var ce=s3(),pe=ue(ce),ye=ne(pe);{let K=w(()=>_.chat_attachmentPreview_viewFullSize_ariaLabel({name:r()})),I=w(()=>p()||!l(O));qe(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(K)},get title(){return r()},get disabled(){return l(I)},get ref(){return l(oe)},set ref(te){k(oe,te,!0)},children:(te,ve)=>{var de=Ze(),fe=ue(de);{var ke=q=>{var Me=n3();L(()=>{st(Me,"src",l(O)),st(Me,"alt",r())}),Mo("error",Me,()=>k(z,l(O),!0)),tf(Me),x(q,Me)},be=q=>{var Me=r3(),ze=ne(Me);tt(ze,{get icon(){return Kc},size:"15"}),Y(Me),x(q,Me)};j(fe,q=>{l(O)?q(ke):q(be,-1)})}x(te,de)},$$slots:{default:!0}})}var Z=A(ye,2);{var ae=K=>{{let I=w(()=>_.chat_attachmentPreview_remove_ariaLabel({name:r()}));qe(K,{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:X,get"aria-label"(){return l(I)},children:(te,ve)=>{tt(te,{get icon(){return Ki},size:"10"})},$$slots:{default:!0}})}};j(Z,K=>{u()&&K(ae)})}Y(pe);var V=A(pe,2);{let K=w(()=>l(O)??"");Gv(V,{get imageUrl(){return l(K)},get imageName(){return r()},get openerElement(){return l(oe)},get open(){return l(U)},set open(I){k(U,I,!0)}})}L(()=>at(pe,1,`relative group shrink-0 ${d()??""}`)),Ts(1,pe,()=>rf,()=>({tier:"moderate",y:0,scale:.9})),Ts(2,pe,()=>sf,()=>({tier:"fast"})),x($,ce)},P=$=>{var ce=l3(),pe=ne(ce);{var ye=ke=>{var be=o3(),q=ue(be);fi(q,{size:15,class:"opacity-50 shrink-0"});var Me=A(q,2);{var ze=gt=>{var Le=i3(),De=se(Le,!0);L(()=>H(De,l(ee))),x(gt,Le)};j(Me,gt=>{l(ee)!==void 0&&gt(ze)})}x(ke,be)},Z=ke=>{tt(ke,{get icon(){return av},size:"15",class:"shrink-0"})},ae=ke=>{var be=a3(),q=se(be);L(()=>{st(q,"src",l(O)),st(q,"alt",r())}),Mo("error",q,()=>k(z,l(O),!0)),tf(q),x(ke,be)},V=ke=>{tt(ke,{get icon(){return l(N)},size:"15",class:"opacity-30 shrink-0"})};j(pe,ke=>{g()==="placing"?ke(ye):g()==="failed"?ke(Z,1):l(E)&&l(O)&&l(z)!==l(O)?ke(ae,2):ke(V,-1)})}var K=A(pe,2),I=se(K,!0),te=A(K,2);{var ve=ke=>{{let be=w(()=>_.chat_attachmentPreview_retryPlacement_ariaLabel({name:r()}));qe(ke,{variant:"ghost-light",size:"icon-xs",class:"shrink-0 -my-1",onclick:q=>{q.stopPropagation(),C()(t())},get"aria-label"(){return l(be)},"data-testid":"attachment-retry",children:(q,Me)=>{tt(q,{get icon(){return eh},size:"10"})},$$slots:{default:!0}})}};j(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"),q=w(()=>_.chat_attachmentPreview_removeAttachment_ariaLabel());qe(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(q)},children:(Me,ze)=>{tt(Me,{get icon(){return Ki},size:"10"})},$$slots:{default:!0}})}};j(de,ke=>{u()&&ke(fe)})}Y(ce),L(()=>{at(ce,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()??""}`),st(ce,"data-placement-status",g()),st(ce,"title",l(D)),H(I,r())}),Ts(1,ce,()=>rf,()=>({tier:"moderate",y:0,scale:.9})),Ts(2,ce,()=>sf,()=>({tier:"fast"})),x($,ce)};j(Q,$=>{f()==="thumbnail"&&l(E)&&l(M)&&(!l(O)||l(z)!==l(O))?$(me):$(P,-1)})}return x(n,re),Lt(le)}export{nN as $,zv as A,wl as B,rR as C,fa as D,HA as E,Se as F,mo as G,Jf as H,CB as I,Vn as J,X$ as K,hh as L,ha as M,q0 as N,AC as O,DS as P,sS as Q,SB as R,Jt as S,je as T,bB as U,cN as V,tp as W,Dv as X,PP as Y,IP as Z,Je as _,c3 as a,PI as a$,fh as a0,Tb as a1,Yc as a2,qv as a3,Kv as a4,kB as a5,gB as a6,tB as a7,vn as a8,VL as a9,eB as aA,cB as aB,Ey as aC,fN as aD,Uv as aE,bn as aF,Q$ as aG,Gu as aH,Ca as aI,sB as aJ,iB as aK,xD as aL,aB as aM,PD as aN,RD as aO,AD as aP,SD as aQ,MD as aR,TD as aS,CD as aT,oB as aU,xB as aV,LS as aW,wD as aX,wB as aY,_B as aZ,OI as a_,dB as aa,mB as ab,rB as ac,pB as ad,fB as ae,lB as af,WT as ag,Hv as ah,e3 as ai,Z3 as aj,q_ as ak,Kp as al,Q_ as am,Xc as an,dt as ao,MO as ap,la as aq,nB as ar,Bh as as,zh as at,yB as au,MB as av,vB as aw,hB as ax,bL as ay,cw as az,oR as b,fI as b0,hI as b1,aS as b2,pf as b3,$c as b4,Q3 as b5,Va as b6,iL as c,qf as d,QL as e,Or as f,an as g,lw as h,jn as i,hw as j,$v as k,ph as l,jv as m,Gv as n,mw as o,pw as p,ac as q,gh as r,Jv as s,Nv as t,br as u,bt as v,WA as w,fd as x,UI as y,Tn as z};