@intent-hq/web 2.389.0 → 2.389.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{R69_F6ow.js → -xQ9aHnN.js} +1 -1
  3. package/web/app/immutable/chunks/{B6CGcXmK.js → 0JJFb4pz.js} +1 -1
  4. package/web/app/immutable/chunks/{T6fchQhT.js → 1-L83W2E.js} +2 -2
  5. package/web/app/immutable/chunks/{CM3NPzxs.js → 1C8jE5xg.js} +1 -1
  6. package/web/app/immutable/chunks/{CFjHgtjF.js → 2Rvfwx05.js} +4 -4
  7. package/web/app/immutable/chunks/{BVXrO_xP.js → 36_0UmtU.js} +1 -1
  8. package/web/app/immutable/chunks/{k1pjOtcg.js → 4DKzLFxz.js} +2 -2
  9. package/web/app/immutable/chunks/{qWMP3EPi.js → 4mQbCgSg.js} +1 -1
  10. package/web/app/immutable/chunks/{HYdiaHV7.js → 6SYeyudR.js} +1 -1
  11. package/web/app/immutable/chunks/{Beb33qQi.js → B37_G9B8.js} +1 -1
  12. package/web/app/immutable/chunks/{CIuThArl.js → B3ZhJ2zS.js} +3 -3
  13. package/web/app/immutable/chunks/{C4sNRwZN.js → B6xkV8xv.js} +1 -1
  14. package/web/app/immutable/chunks/{Ba3e0br1.js → B9LAnui0.js} +1 -1
  15. package/web/app/immutable/chunks/{DVsXJTH5.js → BAMTcytp.js} +1 -1
  16. package/web/app/immutable/chunks/{B-r8Ld9c.js → BBPT3jzS.js} +1 -1
  17. package/web/app/immutable/chunks/{vJJhwCPu.js → BE9LyC4x.js} +1 -1
  18. package/web/app/immutable/chunks/{oBc79yRV.js → BFacF5Cc.js} +1 -1
  19. package/web/app/immutable/chunks/{B4JMAhvp.js → BFiq0x-M.js} +1 -1
  20. package/web/app/immutable/chunks/{Dl8k4QUp.js → BFpiydcV.js} +1 -1
  21. package/web/app/immutable/chunks/{DIPIWs2Q.js → BGN20Sak.js} +4 -4
  22. package/web/app/immutable/chunks/{DtluaQEg.js → BGyTNq2q.js} +4 -4
  23. package/web/app/immutable/chunks/{D63urNNT.js → BHd5Ycyv.js} +1 -1
  24. package/web/app/immutable/chunks/{BR02ohTI.js → BI-xeUgJ.js} +1 -1
  25. package/web/app/immutable/chunks/{DM3Yrkkb.js → BLhpk6cm.js} +1 -1
  26. package/web/app/immutable/chunks/{CRPk37P7.js → BOy6NFH3.js} +1 -1
  27. package/web/app/immutable/chunks/{hgE6oWwa.js → BPDTSRg_.js} +1 -1
  28. package/web/app/immutable/chunks/{Z4vtXCdu.js → BPueFkqz.js} +1 -1
  29. package/web/app/immutable/chunks/{mq9vi3Up.js → BQGkLFny.js} +3 -3
  30. package/web/app/immutable/chunks/{Da5bNPjQ.js → BVZ7Hw44.js} +1 -1
  31. package/web/app/immutable/chunks/{uftNwUIw.js → BYZgkpv-.js} +1 -1
  32. package/web/app/immutable/chunks/{D36a16oA.js → B_EH4rnd.js} +2 -2
  33. package/web/app/immutable/chunks/{sQSEv8Vy.js → BfgamEFW.js} +1 -1
  34. package/web/app/immutable/chunks/{DrF6vLLb.js → Bj2kxXBv.js} +1 -1
  35. package/web/app/immutable/chunks/Bk5Drm1a.js +12 -0
  36. package/web/app/immutable/chunks/{D2McplNW.js → BmGKJL-X.js} +1 -1
  37. package/web/app/immutable/chunks/{wX0L7qir.js → BnaA6Qz9.js} +3 -3
  38. package/web/app/immutable/chunks/{DZKOpbCv.js → BoToR9vg.js} +1 -1
  39. package/web/app/immutable/chunks/{x0vz7jUI.js → BpmuH_kK.js} +1 -1
  40. package/web/app/immutable/chunks/{BF_gPEg7.js → BwA1d-u1.js} +1 -1
  41. package/web/app/immutable/chunks/{JrdZaYjT.js → BxBhc8SK.js} +1 -1
  42. package/web/app/immutable/chunks/{Cy--ZUaj.js → ByH7GIW_.js} +2 -2
  43. package/web/app/immutable/chunks/{DZz-0U7K.js → Byqd0P12.js} +1 -1
  44. package/web/app/immutable/chunks/{xXDRZ4UR.js → C-AFiViU.js} +1 -1
  45. package/web/app/immutable/chunks/{gsePksRf.js → C0ar8e1U.js} +1 -1
  46. package/web/app/immutable/chunks/{Cp1B7D7t.js → C2PFxOOc.js} +1 -1
  47. package/web/app/immutable/chunks/{C3vs7E1W.js → C46oSs94.js} +1 -1
  48. package/web/app/immutable/chunks/{dEPZ-XrU.js → C6nQg0nK.js} +1 -1
  49. package/web/app/immutable/chunks/{BkYN9M7z.js → C87s6b1I.js} +1 -1
  50. package/web/app/immutable/chunks/{BNSbhHFY.js → C9HRYAK5.js} +1 -1
  51. package/web/app/immutable/chunks/{B-I8ZlVM.js → CIzdwtCK.js} +1 -1
  52. package/web/app/immutable/chunks/{C8A41C8K.js → CKjPe4ll.js} +1 -1
  53. package/web/app/immutable/chunks/{DUJ7Uicl.js → CLuP0_Is.js} +1 -1
  54. package/web/app/immutable/chunks/{BdNfyyl1.js → CO1JOjiw.js} +1 -1
  55. package/web/app/immutable/chunks/{BdQ54KL0.js → COli2nkv.js} +1 -1
  56. package/web/app/immutable/chunks/{DOmB999d.js → CPIfFszb.js} +1 -1
  57. package/web/app/immutable/chunks/{BIVpRSxo.js → CPlbtgfY.js} +2 -2
  58. package/web/app/immutable/chunks/{qtHim0jP.js → CSMPUzig.js} +1 -1
  59. package/web/app/immutable/chunks/{CdfbvT19.js → CT137GBc.js} +1 -1
  60. package/web/app/immutable/chunks/{C4JKtRY1.js → CW6t9rU8.js} +1 -1
  61. package/web/app/immutable/chunks/{86aXQThN.js → C_ps7SI2.js} +1 -1
  62. package/web/app/immutable/chunks/{fCCFSMRf.js → Cb1ltk9x.js} +3 -3
  63. package/web/app/immutable/chunks/{BwVhyX7o.js → Ccgqb2IM.js} +1 -1
  64. package/web/app/immutable/chunks/{DBwApbzS.js → Ce8WBTjF.js} +1 -1
  65. package/web/app/immutable/chunks/{Be-9sO50.js → Cg8YmoXY.js} +1 -1
  66. package/web/app/immutable/chunks/{Ci0dPfzv.js → Comxi6VB.js} +1 -1
  67. package/web/app/immutable/chunks/{zA4TFq_E.js → CpSE18tk.js} +1 -1
  68. package/web/app/immutable/chunks/{CmBouCgt.js → CrF2NvoU.js} +2 -2
  69. package/web/app/immutable/chunks/{Dsyh_lG5.js → Cs1c4sXg.js} +1 -1
  70. package/web/app/immutable/chunks/{g-pOypvE.js → Cx-w_9tt.js} +1 -1
  71. package/web/app/immutable/chunks/{DRbQVjcG.js → CzBMiZpT.js} +1 -1
  72. package/web/app/immutable/chunks/{oEGQGYxq.js → D0bUMHTb.js} +1 -1
  73. package/web/app/immutable/chunks/{BlTdGk3A.js → DB7VQKGS.js} +1 -1
  74. package/web/app/immutable/chunks/{BQGIKN0g.js → DBb8bRDA.js} +1 -1
  75. package/web/app/immutable/chunks/{DHz7ym-I.js → DBjXG7Re.js} +1 -1
  76. package/web/app/immutable/chunks/{iIsyEXfi.js → DBtTsT3h.js} +1 -1
  77. package/web/app/immutable/chunks/{5J_xNo3h.js → DC_3EQkj.js} +2 -2
  78. package/web/app/immutable/chunks/{s6Wn05Cg.js → DJAJF2aV.js} +1 -1
  79. package/web/app/immutable/chunks/{CqqkIXTJ.js → DLN1m_oc.js} +1 -1
  80. package/web/app/immutable/chunks/{Bm_geQt1.js → DP6e20em.js} +1 -1
  81. package/web/app/immutable/chunks/{DDVnHnMH.js → DP94l5zD.js} +3 -3
  82. package/web/app/immutable/chunks/{BE4rQlti.js → DPWgxx_r.js} +1 -1
  83. package/web/app/immutable/chunks/{D8EdnE4r.js → DROfA7cv.js} +1 -1
  84. package/web/app/immutable/chunks/{DN-c0DDt.js → DUc2opAY.js} +1 -1
  85. package/web/app/immutable/chunks/{0AIorxUa.js → DWlmiKMQ.js} +7 -7
  86. package/web/app/immutable/chunks/{KvHDUk_b.js → DaR1HweB.js} +2 -2
  87. package/web/app/immutable/chunks/{D3shmp0V.js → DdG0fpQR.js} +1 -1
  88. package/web/app/immutable/chunks/{ublLekYt.js → DeTo2B7W.js} +1 -1
  89. package/web/app/immutable/chunks/{BoCCPZlL.js → Dg6-yJwG.js} +1 -1
  90. package/web/app/immutable/chunks/{D3vsaFn3.js → DghicuZY.js} +1 -1
  91. package/web/app/immutable/chunks/{CXfRSojK.js → DhBCCByJ.js} +1 -1
  92. package/web/app/immutable/chunks/{C9szebIt.js → DiSTOpT2.js} +1 -1
  93. package/web/app/immutable/chunks/{BT5v4htV.js → DlYWQy9o.js} +1 -1
  94. package/web/app/immutable/chunks/{B91tdOJm.js → DmaxCRlh.js} +1 -1
  95. package/web/app/immutable/chunks/{D-q3diCz.js → DpSuNWKG.js} +1 -1
  96. package/web/app/immutable/chunks/{T7iqVsMb.js → Dq37igck.js} +1 -1
  97. package/web/app/immutable/chunks/{CheN8m7G.js → Du0sz9ah.js} +1 -1
  98. package/web/app/immutable/chunks/{CkTunFkP.js → DvKBDp7T.js} +1 -1
  99. package/web/app/immutable/chunks/{C4UYdkwZ.js → Dwp4DMqr.js} +1 -1
  100. package/web/app/immutable/chunks/{CeZGOup4.js → DzHCFW-E.js} +1 -1
  101. package/web/app/immutable/chunks/{CgzHyieN.js → FVGAeFGR.js} +1 -1
  102. package/web/app/immutable/chunks/{CB2iSm6U.js → F_CzStpc.js} +1 -1
  103. package/web/app/immutable/chunks/{Z2wqUYyr.js → HCeNaLBX.js} +2 -2
  104. package/web/app/immutable/chunks/{BhVbCtBE.js → HXrwONGg.js} +1 -1
  105. package/web/app/immutable/chunks/{CJ9ZGIU3.js → O_noOQCK.js} +1 -1
  106. package/web/app/immutable/chunks/{BwCICkMn.js → QzztRxOC.js} +1 -1
  107. package/web/app/immutable/chunks/{BWFaOHKx.js → ScJg5Frh.js} +1 -1
  108. package/web/app/immutable/chunks/{DCFeaWgZ.js → W8QLebuN.js} +1 -1
  109. package/web/app/immutable/chunks/{85NDZF0c.js → YH-zvTaG.js} +1 -1
  110. package/web/app/immutable/chunks/{2mfr9mCI.js → ZACNX8Dr.js} +1 -1
  111. package/web/app/immutable/chunks/{CUE71p7a.js → _O-9-CfM.js} +1 -1
  112. package/web/app/immutable/chunks/{CS9nZ0mb.js → a8-PvMdA.js} +1 -1
  113. package/web/app/immutable/chunks/{4VEtxogG.js → aXIBID0A.js} +1 -1
  114. package/web/app/immutable/chunks/{CrK7N1sc.js → eeYFFN2l.js} +1 -1
  115. package/web/app/immutable/chunks/{D5dii3q-.js → f5_5NkcH.js} +1 -1
  116. package/web/app/immutable/chunks/{Cmw8ZiCg.js → hr3XkGev.js} +1 -1
  117. package/web/app/immutable/chunks/{D17rwSNZ.js → ialDfbR3.js} +1 -1
  118. package/web/app/immutable/chunks/{nfiajAfR.js → j4CbH61f.js} +1 -1
  119. package/web/app/immutable/chunks/{Bmlx0yvl.js → kGnYVYAk.js} +2 -2
  120. package/web/app/immutable/chunks/{2sf1Yn-s.js → lPtzElq9.js} +1 -1
  121. package/web/app/immutable/chunks/{CeWx_dfN.js → mnUHiFkL.js} +1 -1
  122. package/web/app/immutable/chunks/{Di3tMG_J.js → pLgYa-qv.js} +1 -1
  123. package/web/app/immutable/chunks/{Bauem7Ke.js → qksfFGtg.js} +1 -1
  124. package/web/app/immutable/chunks/{ByZRLPfm.js → r9CLdeRr.js} +3 -3
  125. package/web/app/immutable/chunks/{DqRvDwkX.js → rRCDXSQW.js} +1 -1
  126. package/web/app/immutable/chunks/{97-360Ms.js → rhdxBxmR.js} +1 -1
  127. package/web/app/immutable/chunks/{CzFnnQhI.js → trGNLbxJ.js} +1 -1
  128. package/web/app/immutable/chunks/{Nthsb-68.js → y6JuXIK4.js} +1 -1
  129. package/web/app/immutable/entry/{app.Beuvfwpq.js → app.DJnjuiiE.js} +2 -2
  130. package/web/app/immutable/entry/start.DrjKV6rZ.js +1 -0
  131. package/web/app/immutable/nodes/{0.cL5zt7Bt.js → 0.CUxBVUWQ.js} +1 -1
  132. package/web/app/immutable/nodes/{1.Dj9s42wq.js → 1.CSjXQrGv.js} +1 -1
  133. package/web/app/immutable/nodes/{10.CQpwV39P.js → 10.BATprR9e.js} +1 -1
  134. package/web/app/immutable/nodes/{11.ryjds32c.js → 11.5ipin3q_.js} +1 -1
  135. package/web/app/immutable/nodes/{15.ffzaVnT8.js → 15.Dwvj0-lX.js} +1 -1
  136. package/web/app/immutable/nodes/{19.COuvk-IK.js → 19.8bZ2WiIx.js} +2 -2
  137. package/web/app/immutable/nodes/{2.CyeHTGza.js → 2.BhLocieZ.js} +1 -1
  138. package/web/app/immutable/nodes/{3.Cli5S3q6.js → 3.CZ0MN870.js} +1 -1
  139. package/web/app/immutable/nodes/{4.DnwVlUKb.js → 4.Jqmt7KB_.js} +1 -1
  140. package/web/app/immutable/nodes/{5.BBLKg00X.js → 5.QoAJLoN0.js} +1 -1
  141. package/web/app/immutable/nodes/{6.D_zrx8Je.js → 6.uLNlkxFf.js} +1 -1
  142. package/web/app/immutable/nodes/{7.CbiG1FxN.js → 7.BohHriQX.js} +1 -1
  143. package/web/app/immutable/nodes/{8.BqucsZP2.js → 8.BC5uGoFC.js} +1 -1
  144. package/web/app/immutable/nodes/{9.YctElBWI.js → 9.BnQAis5Y.js} +2 -2
  145. package/web/app/version.json +1 -1
  146. package/web/index.html +9 -9
  147. package/web/app/immutable/chunks/CndXvgyH.js +0 -12
  148. package/web/app/immutable/entry/start.dSf-uLxv.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BIVpRSxo.js","/app/immutable/chunks/CLAmm_T1.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/96V4v2iI.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/BFgvMDua.js","/app/immutable/chunks/CcJmuwXr.js","/app/immutable/chunks/BwNrQXlF.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/nxtepGjE.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/B1CKzIA2.js","/app/immutable/chunks/TB9r2XJy.js","/app/immutable/chunks/UTM5G-w-.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/BwH4Bvte.js","/app/immutable/chunks/CIbfGsF-.js","/app/immutable/chunks/Cu5e4npY.js","/app/immutable/chunks/BbYWP3Ow.js","/app/immutable/chunks/B9vHutcJ.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BBFoj-dS.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/DPttSllj.js","/app/immutable/chunks/CfNIzRu8.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.DylRFR3N.css","/app/immutable/chunks/C2UL5Ler.js","/app/immutable/chunks/_UjuBCOJ.js","/app/immutable/chunks/BGrimfDs.js","/app/immutable/chunks/aZdb_rCN.js","/app/immutable/chunks/CXfRSojK.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CndXvgyH.js","/app/immutable/chunks/Da5bNPjQ.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/Cy--ZUaj.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/Di3tMG_J.js"])))=>i.map(i=>d[i]);
2
- var em=Object.defineProperty;var Kl=n=>{throw TypeError(n)};var tm=(n,e,t)=>e in n?em(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var tt=(n,e,t)=>tm(n,typeof e!="symbol"?e+"":e,t),nm=(n,e,t)=>e.has(n)||Kl("Cannot "+t);var Fn=(n,e,t)=>(nm(n,e,"read from private field"),t?t.call(n):e.get(n)),$i=(n,e,t)=>e.has(n)?Kl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{t as Wt,bo as L,bw as jt,b as Kt,bp as rm,bm as se,bq as im,bs as sm,_ as Hi}from"./CLAmm_T1.js";import{bs as Ut,b_ as ie,W as K,bn as qt,aA as P,aC as Zu,br as la,bb as Zr,c3 as wn,aG as om,bk as ed,a7 as wr,ay as Bt,c0 as td,a5 as ye,aD as p,bA as ue,bS as oe,aw as am,bH as me,c9 as $,bV as qe,aB as te,ai as io,ca as bt,aj as Kn,bl as Me,bO as ge,bo as Ka,bj as nd,be as rd,b$ as id,bf as lm,c5 as vn}from"./3SdAC2_C.js";import{c as Lo}from"./BwH4Bvte.js";import{s as St,f as pn,c as ca,b as cm,g as hi,e as um}from"./CcJmuwXr.js";import{b as Er}from"./Dn334wJv.js";import{i as dm}from"./DaWmj23r.js";import{d3 as fm,aF as hm,aT as Ul}from"./BQGIKN0g.js";import{a as pm}from"./CC7to1B5.js";import{aT as mm,aB as gm,ao as ym,aw as bm,ab as vm,f as nn,ae as sd,a1 as km}from"./nxtepGjE.js";import{i as Se}from"./BFgvMDua.js";import{F as tn,bb as xm,bv as Ua,bh as od,v as wm,bE as Sm,d3 as Cm,aI as ql,bg as vr,bn as Sr,cZ as ad,cW as Mm,cn as ld,cK as cd,ak as Em,av as ud,ay as Jl,ap as Tm,aj as Am,as as Nm,cX as Om,aZ as Im,aN as Po,co as Rm,bx as Dm,cb as Lm,cy as Gl,Y as Pm,cH as _m,at as Bm,bU as zm,aq as $m,c7 as Hm,bN as Fm,c_ as Vm,al as Wm,bl as jm,bF as Km,a$ as Um,d2 as qm,am as Jm,bS as Gm,aT as Xm,b0 as Ym,c1 as Qm,bd as Zm,cx as eg,cD as tg,bR as ng,bo as rg,bi as Xl}from"./DPttSllj.js";import{t as ig}from"./BwNrQXlF.js";import{e as sg}from"./Drl447ub.js";import{b as og,V as Yl,c as ag,p as lg,m as cg,s as ug}from"./D8EdnE4r.js";import{h as dg}from"./TB9r2XJy.js";import{g as kr,i as fg}from"./B1CKzIA2.js";import{L as hg,S as pg,T as dd}from"./BIFBPuAO.js";import{n as mg,l as ps}from"./Cu5e4npY.js";import{h as gg}from"./KvHDUk_b.js";import{br as yg}from"./B9vHutcJ.js";import{g as bg}from"./BrMDTgLg.js";import{c as qa,l as pe}from"./ChTqQfQN.js";import{n as Ql,l as vg,c as kg}from"./CfNIzRu8.js";import{$ as fd,a0 as xg,p as ua,aO as wg,am as Sg,a1 as Cg,ea as Mg,a9 as Eg}from"./C2UL5Ler.js";import{i as cn,M as Tg,D as Ag,s as _o,a as Ng,p as lr}from"./T6fchQhT.js";import{A as Og,b as Ig}from"./BhCMc9G0.js";import{P as Rg}from"./TyAuxp07.js";import{a as hd}from"./hkJYqn41.js";import{g as Zl}from"./CYxt6gzD.js";import{H as Dg}from"./Bqd7fdCF.js";import{q as Lg}from"./Dd-LQrG1.js";import{b as Pg,P as _g}from"./BksTLNI4.js";var Bg=Zu('<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 pd(n,e){if(new.target)return Wt({component:pd,...n});Ut(e,!0);let t=L(e,"size",7,16),r=L(e,"class",7,"");var i={get size(){return t()},set size(o=16){t(o),P()},get class(){return r()},set class(o=""){r(o),P()},$set:jt,$on:(o,a)=>Kt(e,o,a)},s=Bg();return ie(()=>{St(s,"width",t()),St(s,"height",t()),pn(s,0,ca(r()))}),K(n,s),qt(i)}var ec=Object.defineProperty,zg=(n,e)=>{let t={};for(var r in n)ec(t,r,{get:n[r],enumerable:!0});return ec(t,Symbol.toStringTag,{value:"Module"}),t};function vt(n){this.content=n}vt.prototype={constructor:vt,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,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new vt(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new vt(t)},addToStart:function(n,e){return new vt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new vt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new vt(i)},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=vt.from(n),n.size?new vt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=vt.from(n),n.size?new vt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=vt.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}};vt.from=function(n){if(n instanceof vt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new vt(e)};function md(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,a=s.text,l=0;for(;o[l]==a[l];l++)t++;return l&&l<o.length&&l<a.length&&bd(o.charCodeAt(l-1))&&yd(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=md(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function gd(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=o.text,u=a.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&bd(c.charCodeAt(d-1))&&yd(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let c=gd(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}function yd(n){return n>=56320&&n<57344}function bd(n){return n>=55296&&n<56320}class M{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,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>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),i+=a.nodeSize),o=l}return new M(r,i)}cutByIndex(e,t){return e==t?M.empty:e==0&&t==this.content.length?this:new M(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return md(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return gd(this,e,t,r)}findIndex(e){if(e==0)return Fi(0,e);if(e==this.size)return Fi(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 i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Fi(t+1,s):Fi(t,r);r=s}}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 M.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return M.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new M(t||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const Bo={index:0,offset:0};function Fi(n,e){return Bo.index=n,Bo.offset=e,Bo}function ms(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(!ms(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ms(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Le=class da{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&ms(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 da.none;if(e instanceof da)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Le.none=[];class pi extends Error{}class W{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=kd(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(vd(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 W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(M.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new W(e,r,i)}}W.empty=new W(M.empty,0,0);function vd(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.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,s.copy(vd(s.content,e-i-1,t-i-1)))}function kd(n,e,t,r,i,s){let{index:o,offset:a}=n.findIndex(e),l=n.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=kd(l.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,l);return c&&n.replaceChild(o,l.copy(c))}function $g(n,e,t){if(t.openStart>n.depth)throw new pi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new pi("Inconsistent open depths");return xd(n,e,t,0)}function xd(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=xd(n,e,t,r+1);return s.copy(s.content.replaceChild(i,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 Yn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Hg(t,n);return Yn(s,Sd(n,o,a,e,r))}else return Yn(s,gs(n,e,r))}function wd(n,e){if(!e.type.compatibleContent(n.type))throw new pi("Cannot join "+e.type.name+" onto "+n.type.name)}function fa(n,e,t){let r=n.node(t);return wd(r,e.node(t)),r}function Xn(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 ei(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Xn(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Xn(i.child(a),r);e&&e.depth==t&&e.textOffset&&Xn(e.nodeBefore,r)}function Yn(n,e){if(!n.type.validContent(e))throw new pi("Invalid content for node "+n.type.name);return n.copy(e)}function Sd(n,e,t,r,i){let s=n.depth>i&&fa(n,e,i+1),o=r.depth>i&&fa(t,r,i+1),a=[];return ei(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(wd(s,o),Xn(Yn(s,Sd(n,e,t,r,i+1)),a)):(s&&Xn(Yn(s,gs(n,e,i+1)),a),ei(e,t,i,a),o&&Xn(Yn(o,gs(t,r,i+1)),a)),ei(r,null,i,a),new M(a)}function gs(n,e,t){let r=[];if(ei(null,n,t,r),n.depth>t){let i=fa(n,e,t+1);Xn(Yn(i,gs(n,e,t+1)),r)}return ei(e,null,t,r),new M(r)}function Hg(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class mi{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],i=e.child(t);return r?e.child(t).cut(r):i}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],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 ys(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=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new mi(t,r,s)}static resolveCached(e,t){let r=tc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else tc.set(e,r=new Fg);let i=r.elts[r.i]=mi.resolve(e,t);return r.i=(r.i+1)%Vg,i}}class Fg{constructor(){this.elts=[],this.i=0}}const Vg=12,tc=new WeakMap;class ys{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 Wg=Object.create(null);let In=class ha{constructor(e,t,r,i=Le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||M.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,i=0){this.content.nodesBetween(e,t,r,i,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,i){return this.content.textBetween(e,t,r,i)}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&&ms(this.attrs,t||e.defaultAttrs||Wg)&&Le.sameSet(this.marks,r||Le.none)}copy(e=null){return e==this.content?this:new ha(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ha(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 W.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new W(c,i.depth-o,s.depth-o)}replace(e,t,r){return $g(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return mi.resolveCached(this,e)}resolveNoCache(e){return mi.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),Cd(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=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.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),rc(this.type.attrs,this.attrs,"node",this.type.name);let e=Le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];rc(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Le.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 i=M.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};In.prototype.text=void 0;const nc=(()=>{let{stack:n}=new Error("/");if(!n||!/\n\s*at\s/.test(n))return t=>t;let e=Object.create(null);return t=>(e[t],t)})();class bs extends In{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Cd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return nc(this.text.slice(e,t))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bs(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(nc(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 Cd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function rc(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(e[i])}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jg(e,t);if(r.next==null)return er.empty;let i=Md(r);r.next&&r.err("Unexpected trailing text");let s=Yg(Xg(i));return Qg(s,r),s}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 i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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 i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return M.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(u));if(f)return f}}return null}return s(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 i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/CPlbtgfY.js","/app/immutable/chunks/CLAmm_T1.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/96V4v2iI.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/BFgvMDua.js","/app/immutable/chunks/CcJmuwXr.js","/app/immutable/chunks/BwNrQXlF.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/nxtepGjE.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/B1CKzIA2.js","/app/immutable/chunks/TB9r2XJy.js","/app/immutable/chunks/UTM5G-w-.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/BwH4Bvte.js","/app/immutable/chunks/CIbfGsF-.js","/app/immutable/chunks/Cu5e4npY.js","/app/immutable/chunks/BbYWP3Ow.js","/app/immutable/chunks/B9vHutcJ.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BBFoj-dS.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/DPttSllj.js","/app/immutable/chunks/CfNIzRu8.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.DylRFR3N.css","/app/immutable/chunks/C2UL5Ler.js","/app/immutable/chunks/_UjuBCOJ.js","/app/immutable/chunks/BGrimfDs.js","/app/immutable/chunks/aZdb_rCN.js","/app/immutable/chunks/DhBCCByJ.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/Bk5Drm1a.js","/app/immutable/chunks/BVZ7Hw44.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/ByH7GIW_.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/pLgYa-qv.js"])))=>i.map(i=>d[i]);
2
+ var em=Object.defineProperty;var Kl=n=>{throw TypeError(n)};var tm=(n,e,t)=>e in n?em(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var tt=(n,e,t)=>tm(n,typeof e!="symbol"?e+"":e,t),nm=(n,e,t)=>e.has(n)||Kl("Cannot "+t);var Fn=(n,e,t)=>(nm(n,e,"read from private field"),t?t.call(n):e.get(n)),$i=(n,e,t)=>e.has(n)?Kl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{t as Wt,bo as L,bw as jt,b as Kt,bp as rm,bm as se,bq as im,bs as sm,_ as Hi}from"./CLAmm_T1.js";import{bs as Ut,b_ as ie,W as K,bn as qt,aA as P,aC as Zu,br as la,bb as Zr,c3 as wn,aG as om,bk as ed,a7 as wr,ay as Bt,c0 as td,a5 as ye,aD as p,bA as ue,bS as oe,aw as am,bH as me,c9 as $,bV as qe,aB as te,ai as io,ca as bt,aj as Kn,bl as Me,bO as ge,bo as Ka,bj as nd,be as rd,b$ as id,bf as lm,c5 as vn}from"./3SdAC2_C.js";import{c as Lo}from"./BwH4Bvte.js";import{s as St,f as pn,c as ca,b as cm,g as hi,e as um}from"./CcJmuwXr.js";import{b as Er}from"./Dn334wJv.js";import{i as dm}from"./DaWmj23r.js";import{d3 as fm,aF as hm,aT as Ul}from"./DBb8bRDA.js";import{a as pm}from"./CC7to1B5.js";import{aT as mm,aB as gm,ao as ym,aw as bm,ab as vm,f as nn,ae as sd,a1 as km}from"./nxtepGjE.js";import{i as Se}from"./BFgvMDua.js";import{F as tn,bb as xm,bv as Ua,bh as od,v as wm,bE as Sm,d3 as Cm,aI as ql,bg as vr,bn as Sr,cZ as ad,cW as Mm,cn as ld,cK as cd,ak as Em,av as ud,ay as Jl,ap as Tm,aj as Am,as as Nm,cX as Om,aZ as Im,aN as Po,co as Rm,bx as Dm,cb as Lm,cy as Gl,Y as Pm,cH as _m,at as Bm,bU as zm,aq as $m,c7 as Hm,bN as Fm,c_ as Vm,al as Wm,bl as jm,bF as Km,a$ as Um,d2 as qm,am as Jm,bS as Gm,aT as Xm,b0 as Ym,c1 as Qm,bd as Zm,cx as eg,cD as tg,bR as ng,bo as rg,bi as Xl}from"./DPttSllj.js";import{t as ig}from"./BwNrQXlF.js";import{e as sg}from"./Drl447ub.js";import{b as og,V as Yl,c as ag,p as lg,m as cg,s as ug}from"./DROfA7cv.js";import{h as dg}from"./TB9r2XJy.js";import{g as kr,i as fg}from"./B1CKzIA2.js";import{L as hg,S as pg,T as dd}from"./BIFBPuAO.js";import{n as mg,l as ps}from"./Cu5e4npY.js";import{h as gg}from"./DaR1HweB.js";import{br as yg}from"./B9vHutcJ.js";import{g as bg}from"./BrMDTgLg.js";import{c as qa,l as pe}from"./ChTqQfQN.js";import{n as Ql,l as vg,c as kg}from"./CfNIzRu8.js";import{$ as fd,a0 as xg,p as ua,aO as wg,am as Sg,a1 as Cg,ea as Mg,a9 as Eg}from"./C2UL5Ler.js";import{i as cn,M as Tg,D as Ag,s as _o,a as Ng,p as lr}from"./1-L83W2E.js";import{A as Og,b as Ig}from"./BhCMc9G0.js";import{P as Rg}from"./TyAuxp07.js";import{a as hd}from"./hkJYqn41.js";import{g as Zl}from"./CYxt6gzD.js";import{H as Dg}from"./Bqd7fdCF.js";import{q as Lg}from"./Dd-LQrG1.js";import{b as Pg,P as _g}from"./BksTLNI4.js";var Bg=Zu('<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 pd(n,e){if(new.target)return Wt({component:pd,...n});Ut(e,!0);let t=L(e,"size",7,16),r=L(e,"class",7,"");var i={get size(){return t()},set size(o=16){t(o),P()},get class(){return r()},set class(o=""){r(o),P()},$set:jt,$on:(o,a)=>Kt(e,o,a)},s=Bg();return ie(()=>{St(s,"width",t()),St(s,"height",t()),pn(s,0,ca(r()))}),K(n,s),qt(i)}var ec=Object.defineProperty,zg=(n,e)=>{let t={};for(var r in n)ec(t,r,{get:n[r],enumerable:!0});return ec(t,Symbol.toStringTag,{value:"Module"}),t};function vt(n){this.content=n}vt.prototype={constructor:vt,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,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new vt(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new vt(t)},addToStart:function(n,e){return new vt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new vt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new vt(i)},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=vt.from(n),n.size?new vt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=vt.from(n),n.size?new vt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=vt.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}};vt.from=function(n){if(n instanceof vt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new vt(e)};function md(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,a=s.text,l=0;for(;o[l]==a[l];l++)t++;return l&&l<o.length&&l<a.length&&bd(o.charCodeAt(l-1))&&yd(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=md(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function gd(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=o.text,u=a.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&bd(c.charCodeAt(d-1))&&yd(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let c=gd(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}function yd(n){return n>=56320&&n<57344}function bd(n){return n>=55296&&n<56320}class M{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,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>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),i+=a.nodeSize),o=l}return new M(r,i)}cutByIndex(e,t){return e==t?M.empty:e==0&&t==this.content.length?this:new M(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return md(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return gd(this,e,t,r)}findIndex(e){if(e==0)return Fi(0,e);if(e==this.size)return Fi(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 i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Fi(t+1,s):Fi(t,r);r=s}}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 M.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return M.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new M(t||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const Bo={index:0,offset:0};function Fi(n,e){return Bo.index=n,Bo.offset=e,Bo}function ms(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(!ms(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ms(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Le=class da{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&ms(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 da.none;if(e instanceof da)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Le.none=[];class pi extends Error{}class W{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=kd(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(vd(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 W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(M.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new W(e,r,i)}}W.empty=new W(M.empty,0,0);function vd(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.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,s.copy(vd(s.content,e-i-1,t-i-1)))}function kd(n,e,t,r,i,s){let{index:o,offset:a}=n.findIndex(e),l=n.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=kd(l.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,l);return c&&n.replaceChild(o,l.copy(c))}function $g(n,e,t){if(t.openStart>n.depth)throw new pi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new pi("Inconsistent open depths");return xd(n,e,t,0)}function xd(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=xd(n,e,t,r+1);return s.copy(s.content.replaceChild(i,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 Yn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Hg(t,n);return Yn(s,Sd(n,o,a,e,r))}else return Yn(s,gs(n,e,r))}function wd(n,e){if(!e.type.compatibleContent(n.type))throw new pi("Cannot join "+e.type.name+" onto "+n.type.name)}function fa(n,e,t){let r=n.node(t);return wd(r,e.node(t)),r}function Xn(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 ei(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Xn(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Xn(i.child(a),r);e&&e.depth==t&&e.textOffset&&Xn(e.nodeBefore,r)}function Yn(n,e){if(!n.type.validContent(e))throw new pi("Invalid content for node "+n.type.name);return n.copy(e)}function Sd(n,e,t,r,i){let s=n.depth>i&&fa(n,e,i+1),o=r.depth>i&&fa(t,r,i+1),a=[];return ei(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(wd(s,o),Xn(Yn(s,Sd(n,e,t,r,i+1)),a)):(s&&Xn(Yn(s,gs(n,e,i+1)),a),ei(e,t,i,a),o&&Xn(Yn(o,gs(t,r,i+1)),a)),ei(r,null,i,a),new M(a)}function gs(n,e,t){let r=[];if(ei(null,n,t,r),n.depth>t){let i=fa(n,e,t+1);Xn(Yn(i,gs(n,e,t+1)),r)}return ei(e,null,t,r),new M(r)}function Hg(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class mi{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],i=e.child(t);return r?e.child(t).cut(r):i}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],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 ys(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=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new mi(t,r,s)}static resolveCached(e,t){let r=tc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else tc.set(e,r=new Fg);let i=r.elts[r.i]=mi.resolve(e,t);return r.i=(r.i+1)%Vg,i}}class Fg{constructor(){this.elts=[],this.i=0}}const Vg=12,tc=new WeakMap;class ys{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 Wg=Object.create(null);let In=class ha{constructor(e,t,r,i=Le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||M.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,i=0){this.content.nodesBetween(e,t,r,i,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,i){return this.content.textBetween(e,t,r,i)}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&&ms(this.attrs,t||e.defaultAttrs||Wg)&&Le.sameSet(this.marks,r||Le.none)}copy(e=null){return e==this.content?this:new ha(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ha(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 W.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new W(c,i.depth-o,s.depth-o)}replace(e,t,r){return $g(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return mi.resolveCached(this,e)}resolveNoCache(e){return mi.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),Cd(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=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.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),rc(this.type.attrs,this.attrs,"node",this.type.name);let e=Le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];rc(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Le.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 i=M.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};In.prototype.text=void 0;const nc=(()=>{let{stack:n}=new Error("/");if(!n||!/\n\s*at\s/.test(n))return t=>t;let e=Object.create(null);return t=>(e[t],t)})();class bs extends In{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Cd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return nc(this.text.slice(e,t))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bs(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(nc(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 Cd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function rc(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(e[i])}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jg(e,t);if(r.next==null)return er.empty;let i=Md(r);r.next&&r.err("Unexpected trailing text");let s=Yg(Xg(i));return Qg(s,r),s}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 i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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 i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return M.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(u));if(f)return f}}return null}return s(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 i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
3
3
  `)}}er.empty=new er(!0);class jg{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 Md(n){let e=[];do e.push(Kg(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Kg(n){let e=[];do e.push(Ug(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Ug(n){let e=Gg(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=qg(n,e);else break;return e}function ic(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function qg(n,e){let t=ic(n),r=t;return n.eat(",")&&(n.next!="}"?r=ic(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Jg(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Gg(n){if(n.eat("(")){let e=Md(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=Jg(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 Xg(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ed(n,e){return e-n}function sc(n,e){let t=[];return r(e),t.sort(Ed);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function Yg(n){let e=Object.create(null);return t(sc(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);sc(n,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new er(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Ed);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Qg(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Td(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 Ad(n,e){let t=Object.create(null);for(let r in n){let i=n[r],s=e&&e[r];if(s===void 0)if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r);else i.validate&&i.validate(s);t[r]=s}return t}function Nd(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ey(n,r,e[r]);return t}let pa=class Od{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=Nd(e,r.attrs),this.defaultAttrs=Td(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==er.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:Ad(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new In(this,this.computeAttrs(e),M.from(t),Le.setFrom(r))}createChecked(e=null,t,r){return t=M.from(t),this.checkContent(t),new In(this,this.computeAttrs(e),t,Le.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=M.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(M.empty,!0);return s?new In(this,e,t.append(s),Le.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:Le.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Od(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Zg(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class ey{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Zg(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class so{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Nd(e,i.attrs),this.excluded=null;let s=Td(this.attrs);this.instance=s?new Le(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Le(this,Ad(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new so(s,i++,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 ss{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=vt.from(e.nodes),t.marks=vt.from(e.marks||{}),this.nodes=pa.compile(this.spec.nodes,this),this.marks=so.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=er.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?oc(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:oc(this,o.split(" "))}this.nodeFromJSON=i=>In.fromJSON(this,i),this.markFromJSON=i=>Le.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof pa){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,i)}text(e,t){let r=this.nodes.text;return new bs(r,r.defaultAttrs,e,Le.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 oc(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function ty(n){return n.tag!=null}function ny(n){return n.style!=null}let ti=class ma{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(ty(i))this.tags.push(i);else if(ny(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new lc(this,t,!1);return r.addAll(e,Le.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new lc(this,t,!0);return r.addAll(e,Le.none,t.from,t.to),W.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(sy(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],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 l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ma(e,ma.schemaRules(e)))}};const Id={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},ry={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Rd={ol:!0,ul:!0},gi=1,ga=2,ni=4;function ac(n,e,t){return e!=null?(e?gi:0)|(e==="full"?ga:0):n&&n.whitespace=="pre"?gi|ga:t&~ni}class Vi{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Le.none,this.match=s||(o&ni?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(M.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&gi)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=M.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(M.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&&!Id.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class lc{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=ac(null,t.preserveWhitespace,0)|(r?ni:0);i?s=new Vi(i.type,i.attrs,Le.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Vi(null,null,Le.none,!0,null,o):s=new Vi(e.schema.topNodeType,null,Le.none,!0,null,o),this.nodes=[s],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,i=this.top,s=i.options&ga?"full":this.localPreserveWS||(i.options&gi)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
4
4
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));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=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.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 i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Rd.hasOwnProperty(o)&&this.parser.normalizeLists&&iy(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:ry.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Id.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
5
5
  `),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 i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,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 l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Le.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):uc(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=ac(e,s,o.options);o.options&ni&&o.content.length==0&&(a|=ni);let l=Le.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):uc(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Vi(e,t,l,i,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|=gi)}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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}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 iy(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Rd.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function sy(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function cc(n){let e={};for(let t in n)e[t]=n[t];return e}function uc(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class or{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Wi(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){if(e.isText)return Wi(t).createTextNode(e.text);let{dom:r,contentDOM:i}=as(Wi(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&as(Wi(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:as(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new or(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=dc(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return dc(e.marks)}}function dc(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Wi(n){return n.document||window.document}const fc=new WeakMap;function oy(n){let e=fc.get(n);return e===void 0&&fc.set(n,e=ay(n)),e}function ay(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 i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function as(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=oy(r))&&s.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=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(n.createTextNode(f));else{let{dom:h,contentDOM:m}=as(n,f,t,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const Dd=65535,Ld=Math.pow(2,16);function ly(n,e){return n+e*Ld}function hc(n){return n&Dd}function cy(n){return(n-(n&Dd))/Ld}const Pd=1,_d=2,ls=4,Bd=8;class ya{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Bd)>0}get deletedBefore(){return(this.delInfo&(Pd|ls))>0}get deletedAfter(){return(this.delInfo&(_d|ls))>0}get deletedAcross(){return(this.delInfo&ls)>0}}class _t{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&_t.empty)return _t.empty}recover(e){let t=0,r=hc(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+cy(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,h=l+i+(f<0?0:u);if(r)return h;let m=e==(t<0?l:d)?null:ly(a/3,e-l),g=0;return c&&(g|=e==l?_d:e==d?Pd:ls,(t<0?e!=l:e!=d)&&(g|=Bd)),new ya(h,g,m)}i+=u-c}return r?e+i:new ya(e+i,0,null)}touches(e,t){let r=0,i=hc(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new _t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?_t.empty:new _t(e<0?[0,-e,0]:[0,0,e])}}_t.empty=new _t([]);class yi{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new yi(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=e.from,r=this._maps.length;t<e.to;t++){let i=e.getMirror(t);i!=null&&(i=i<t&&i>=e.from?r+(i-e.from):void 0),this.appendMap(e._maps[t],i)}}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.to-1,r=this._maps.length+e._maps.length;t>=e.from;t--){let i=e.getMirror(t);i!=null&&(i=i>t&&i<e.to?r-(i-e.from)-1:void 0),this.appendMap(e._maps[t].invert(),i)}}invert(){let e=new yi;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 i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new ya(e,i,null)}}const zo=Object.create(null);class ht{getMap(){return _t.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zo[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 zo)throw new RangeError("Duplicate use of step JSON ID "+e);return zo[e]=t,t.prototype.jsonID=e,t}}class nt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new nt(e,null)}static fail(e){return new nt(null,e)}static fromReplace(e,t,r,i){try{return nt.ok(e.replace(t,r,i))}catch(s){if(s instanceof pi)return nt.fail(s.message);throw s}}}function Ja(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Ja(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return M.fromArray(r)}class en extends ht{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),i=r.node(r.sharedDepth(this.to)),s=new W(Ja(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return nt.fromReplace(e,this.from,this.to,s)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,i)=>{if(r.isInline&&r.isAtom){let s=this.mark.addToSet(r.marks);if(!Le.sameSet(s,r.marks)){let o=Math.max(this.from,i),a=Math.min(this.to,i+r.nodeSize);vs(Gt,o,a,this.mark,t);for(let l of r.marks)l.isInSet(s)||vs(en,o,a,l,t)}}}),t.length==1?t[0]:new Qn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new en(t,r,this.mark)}merge(e){return e instanceof en&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new en(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 en(t.from,t.to,e.markFromJSON(t.mark))}}ht.jsonID("addMark",en);class Gt extends ht{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 W(Ja(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return nt.fromReplace(e,this.from,this.to,r)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,i)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&vs(en,Math.max(this.from,i),Math.min(this.to,i+r.nodeSize),this.mark,t)}),t.length==1?t[0]:new Qn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new Gt(t,r,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(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 Gt(t.from,t.to,e.markFromJSON(t.mark))}}ht.jsonID("removeMark",Gt);function vs(n,e,t,r,i){let s=i.length?i[i.length-1]:null;s&&s instanceof n&&s.to==e&&s.mark.eq(r)?i[i.length-1]=new n(s.from,t,r):i.push(new n(e,t,r))}class Qn extends ht{constructor(e){super(),this.steps=e}apply(e){for(let t of this.steps){let r=t.apply(e);if(!r.doc)return r;e=r.doc}return new nt(e,null)}invert(e){return new Qn(this.steps.map(t=>t.invert(e)))}map(e){let t=[];for(let r of this.steps){let i=r.map(e);i&&t.push(i)}return t.length?new Qn(t):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,t){if(!Array.isArray(t.steps)||!t.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new Qn(t.steps.map(r=>ht.fromJSON(e,r)))}}ht.jsonID("markSet",Qn);class Nn extends ht{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return nt.fromReplace(e,this.pos,this.pos+1,new W(M.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 i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Nn(this.pos,t.marks[i]);return new Nn(this.pos,this.mark)}}return new tr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Nn(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 Nn(t.pos,e.markFromJSON(t.mark))}}ht.jsonID("addNodeMark",Nn);class tr extends ht{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return nt.fromReplace(e,this.pos,this.pos+1,new W(M.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Nn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new tr(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 tr(t.pos,e.markFromJSON(t.mark))}}ht.jsonID("removeNodeMark",tr);class Qe extends ht{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ba(e,this.from,this.to)?nt.fail("Structure replace would overwrite content"):nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _t([this.from,this.to-this.from,this.slice.size])}invert(e){return new Qe(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&&Qe.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new Qe(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Qe)||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?W.empty:new W(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Qe(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?W.empty:new W(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Qe(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 Qe(t.from,t.to,W.fromJSON(e,t.slice),!!t.structure)}}Qe.MAP_BIAS=1;ht.jsonID("replace",Qe);class gt extends ht{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(ba(e,this.from,this.gapFrom)||ba(e,this.gapTo,this.to)))return nt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return nt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?nt.fromReplace(e,this.from,this.to,r):nt.fail("Content does not fit in gap")}getMap(){return new _t([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 gt(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),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos||i>s?null:new gt(t.pos,r.pos,i,s,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 gt(t.from,t.to,t.gapFrom,t.gapTo,W.fromJSON(e,t.slice),t.insert,!!t.structure)}}ht.jsonID("replaceAround",gt);function ba(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function uy(n,e,t,r){let i=[];n.doc.nodesBetween(e,t,(s,o,a)=>{if(!s.isInline)return;let l=s.marks;if(!r.isInSet(l)&&a.type.allowsMarkType(r.type)){let c=Math.max(o,e),u=Math.min(o+s.nodeSize,t);vs(en,c,u,r,i)}}),i.forEach(s=>n.step(s))}function dy(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline||!o.isAtom)return;s++;let l=null;if(r instanceof so){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<i.length;h++){let m=i[h];m.step==s-1&&d.eq(i[h].style)&&(f=m)}f?(f.to=c,f.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>n.step(new Gt(o.from,o.to,o.style)))}function Ga(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Qe(a,u,W.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Gt(a,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new W(M.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Qe(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(M.empty,!0);n.replace(a,a,new W(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function fy(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Br(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-s;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!fy(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function hy(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=M.empty,d=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=M.from(r.node(m).copy(u)),d++):l--;let f=M.empty,h=0;for(let m=s,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,f=M.from(i.node(m).copy(f)),h++):c++;n.step(new gt(l,c,o,a,new W(u.append(f),d,h),u.size-d,!0))}function Xa(n,e,t=null,r=n){let i=py(n,e),s=i&&my(r,e);return s?i.map(pc).concat({type:e,attrs:t}).concat(s.map(pc)):null}function pc(n){return{type:n,attrs:null}}function py(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function my(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function gy(n,e,t){let r=M.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=M.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new gt(i,s,i,s,new W(r,0,0),t.length,!0))}function yy(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&by(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&$d(n,o,a,s),Ga(n,n.mapping.slice(s).map(a,1),r,void 0,c===null);let u=n.mapping.slice(s),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return n.step(new gt(d,f,d+1,f-1,new W(M.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&zd(n,o,a,s),!1}})}function zd(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function $d(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -172,4 +172,4 @@ ${t}
172
172
  `,pasteChip:()=>" "}}function Pl(b,C){return gl(b.state.doc,{from:0,to:C},{blockSeparator:`
173
173
 
174
174
  `,textSerializers:Eo(b)}).replace(/\u00A0/g," ")}function To(b){return Pl(b,b.state.doc.content.size)}function Ao(b){return Pl(b,b.state.selection.from)}function Bi(b,C){const I=To(b),Q=FM(I,Ao(b).length);(!Q||Q.from!==p(re)?.from)&&(me(Et,null),me(Tt,null)),me(Pe,I,!0),me(re,Q,!0),Q&&C?.dismissNewContext&&me(Et,p(Re),!0)}function zi(){me(Tt,p(re)?.from??null,!0)}function _l(b){b.preventDefault()}function Np(b){if(!p(S)||!p(re))return;const C=To(p(S)),I=Ao(p(S)).length,Q={from:p(S).state.selection.from-p(re).query.length-1,to:p(S).state.selection.from+p(re).to-I},z=p(re).to===C.length||!/^\s/u.test(C.slice(p(re).to)),E=[{type:"skillCommand",attrs:{name:b.name}},...z?[{type:"text",text:" "}]:[]];p(S).chain().focus().insertContentAt(Q,E).setTextSelection(Q.from+2).run()}function Op(b){if(!p(S)||!p(re))return;const C=To(p(S)),I=Ao(p(S)).length,Q={from:p(S).state.selection.from-p(re).query.length-1,to:p(S).state.selection.from+p(re).to-I},z=p(re).to===C.length||!/^\s/u.test(C.slice(p(re).to)),E=`/${b.name}`;p(S).chain().focus().insertContentAt(Q,{type:"text",text:z?`${E} `:E}).setTextSelection(Q.from+E.length+1).run()}function zr(b){const C=fM(b,B().map(I=>I.name));return Y()?mC(C,Y()):C}const $r=new _M({readSnapshot:()=>{const b=p(S);return!b||b.isDestroyed||!F()||!p(Ue)||!p(we)?null:{text:Wn(b),caretAtEnd:Ti(b.state),composing:p(Mt)||b.view.composing,menuOpen:p(mt)||Hr.pluginKey.getState(b.state)?.active===!0}},readContext:()=>F()?.()??"",request:HM,showGhost:b=>{p(S)&&!p(S).isDestroyed&&sa(p(S).view,b)}});function Bl(){$r.cancel(),p(S)&&!p(S).isDestroyed&&Ai(p(S).state)&&sa(p(S).view,null)}function Ip(b,C){C||Ai(b.state)?$r.cancel():$r.schedule()}bt(()=>{(!F()||!p(Ue))&&vn(Bl)});function Rp(b){$r.cancel(),p(S)&&!p(S).isDestroyed&&sa(p(S).view,b)}function Dp(b){if(!p(mt)||!p(Dt))return!1;const C=!b.shiftKey&&!b.metaKey&&!b.ctrlKey&&!b.altKey&&["ArrowUp","ArrowDown","Enter"].includes(b.key);return b.key!=="Escape"&&!C?!1:p(Dt).onKeyDown({event:b})?!0:b.key==="Enter"?(b.preventDefault(),!0):!1}function Lp(){p(S)&&p(S).view&&p(S).chain().focus().insertContent("@").run()}function Pp(b){return p(S)&&p(S).view?(p(S).chain().focus().insertContent(b).run(),!0):!1}function _p(b){if(f()||!p(S)?.view)return!1;const{state:C,dispatch:I}=p(S).view,Q=Ju(C.schema,b);return Q.length===0?!1:(I(C.tr.replaceSelection(new W(M.from(Q),1,1)).scrollIntoView()),p(S).view.focus(),!0)}function Bp(){if(f())return!1;if(p(S)&&p(S).view)try{if(p(S).view.hasFocus())return!0;const b=p(S),C=document.activeElement;return requestAnimationFrame(()=>{if(p(S)!==b||b.isDestroyed||f()||b.view.hasFocus())return;const I=document.activeElement;I!==C&&I instanceof HTMLElement&&pm(I)&&!b.view.dom.contains(I)||(b.view.focus(),b.commands.scrollIntoView())}),typeof p(S).view.hasFocus=="function"?p(S).view.hasFocus():!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focus:",b)}return!1}function zp(){if(f())return!1;if(p(S)&&p(S).view)try{return p(S).chain().focus("end").run(),!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focusEnd:",b)}return!1}function $p(){if(f())return!1;if(p(S)&&p(S).view)try{return p(S).chain().focus().selectAll().run(),!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",b)}return!1}function Hp(){try{return p(S)?.getHTML?.()??""}catch(b){return i.error("[TipTapEditor] Error getting HTML:",b),p(S)?.getText?.()??""}}function Fp(){p(S)&&(ve=!0,p(S).commands.clearContent(!0),ve=!1)}async function Vp(b){if(!p(S))return;const C=zr(b||"");As(C,p(S).schema).eq(p(S).state.doc)||p(S).chain().command(({tr:I})=>(I.setMeta("external-update",!0),!0)).setContent(C).run()}function Wp(b,C){p(S)&&p(S).view&&p(S).chain().focus().setImage({src:b,alt:C||""}).createParagraphNear().focus().run()}function jp(){if(!p(S))return i.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const b=[];return p(S).state.doc.descendants(C=>{if(C.type.name==="image"){const I=C.attrs.src;I&&I.startsWith("data:")&&b.push({src:I,alt:C.attrs.alt||void 0})}return!0}),i.debug("TipTapEditor: Extracted inline images",{imageCount:b.length,imageSources:b.map(C=>({alt:C.alt,srcLength:C.src?.length||0}))}),b}function Kp(){return Wn(p(S))}function Up(b){if(i.debug("TipTapEditor: insertContextMention called",{hasEditor:!!p(S),hasEditorView:!!p(S)?.view,attrs:{itemType:b.itemType,identifier:b.identifier,title:b.title}}),p(S)&&p(S).view){const C=p(S).chain().focus().insertContextMention(b).run();return i.debug("TipTapEditor: insertContextMention result",{result:C}),C}return i.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function qp(b){if(!p(S)||!p(S).view)return i.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return p(S).chain().focus().insertContent({type:"mention",attrs:{id:b.id,label:b.label,type:b.type,uri:b.uri,meta:b.meta||{}}}).insertContent(" ").run(),!0}catch(C){return i.error("TipTapEditor: insertMention failed",C),!1}}function Jp(){if(!p(S))return i.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const b=[];return p(S).state.doc.descendants(C=>(C.type.name==="mention"&&b.push({id:C.attrs.id,label:C.attrs.label,type:C.attrs.type||"file",uri:C.attrs.uri||"",meta:C.attrs.meta||{}}),!0)),i.debug("TipTapEditor: Extracted mentions",{mentionCount:b.length,types:b.map(C=>C.type)}),b}function Gp(){if(!p(S))return i.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const b=[];return p(S).state.doc.descendants(C=>{if(C.type.name==="contextMention"){const I=C.attrs;b.push({itemType:I.itemType,provider:I.provider,title:I.title,url:I.url,identifier:I.identifier,contextId:I.contextId,description:I.description,metadata:I.metadata})}return!0}),i.debug("TipTapEditor: Extracted context mentions",{mentionCount:b.length}),b}const Hr={char:"@",pluginKey:new Ve("mention"),items:async({query:b})=>{if(i.debug("Mention query:",b),D()?.(b),!g()&&y()){i.debug("No workspace but repoPath available, using async search:",y());const I={workspaceId:void 0,repoPath:y(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Q=await s.search(b,I);return i.debug("Mention search results from repoPath:",Q.length),Q}catch(Q){i.error("Failed to search mentions with repoPath:",Q);const z=s.searchSync(b,I);return i.debug("Fallback sync search results:",z.length),z}}if(!g())return i.debug("No workspace and no repoPath - returning empty results"),[];const C={workspaceId:g().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const I=await s.search(b,C);return i.debug("Mention search results:",I.length),I}catch(I){return i.error("Failed to search mentions:",I),[]}},render:()=>KC(ze),command:({editor:b,range:C,props:I})=>{const Q={id:I.id,label:I.label,type:I.type,uri:I.uri,meta:I.meta||{}};b.view&&b.chain().focus().deleteRange(C).insertContent({type:"mention",attrs:Q}).run(),V()?.(I)}};ed(()=>{let b=!1;return(async()=>{const C=zr(o()||"");if(b)return;const I=p($e);if(!I)return;me(S,new jx({element:I,extensions:[...Y()?[hC.configure({references:()=>Y()??[]}),pC]:[],mS.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}),Mp({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:z=>/^https?:\/\//.test(z)||z.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),gS.configure({placeholder:c()?({editor:z})=>An.getState(z.state)?.parts.length?"":l():l(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),BS.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),KS.configure({workspaceId:g()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:Hr,renderHTML({node:z}){const E=cg(z.attrs,g()?.id,ug);return["span",{"data-mention":"true","data-type":z.attrs.type||"file","data-uri":z.attrs.uri||"","data-meta":JSON.stringify(z.attrs.meta||{}),"data-id":z.attrs.id,"data-label":z.attrs.label,class:"mention-chip",tabindex:"0"},E]},renderText:({node:z})=>{const E=z.attrs||{};try{return Mg({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"}`}}}),lC.extend({renderText:({node:z})=>{const E=z.attrs||{},Oe=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(Oe)))}]`}}),fC,kC,vM,RM],content:C,editable:p(Ue),enableCoreExtensions:{delete:!1},onCreate:({editor:z})=>{Bi(z),v()&&requestAnimationFrame(()=>{if(z.isDestroyed)return;z.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:z})=>{z.docChanged&&He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)},onUpdate:({editor:z,transaction:E})=>{if(E.getMeta("external-update")||E.getMeta(Ll)||ve)return;const Oe=de()?vC(E):null;Oe&&de()?.(Oe);const Ge=Wn(z);Bi(z,{dismissNewContext:E.getMeta("uiEvent")==="paste"}),E.getMeta(Mo)?x()?.(Ge,{programmatic:!0}):x()?.(Ge),Ip(z,E.getMeta(Tp)===!0)},onSelectionUpdate:({editor:z,transaction:E})=>{Bi(z,{dismissNewContext:E.getMeta("uiEvent")==="paste"});const{from:Oe,to:Ge,empty:J}=z.state.selection;if(J)_()?.(null);else{const De=z.state.doc.textBetween(Oe,Ge," ");_()?.(De.trim()||null)}},onFocus:({editor:z})=>{vn(()=>{me(we,!0),Bi(z)})},onBlur:()=>{vn(()=>{me(we,!1)}),Bl()},editorProps:{handleDOMEvents:{compositionstart:()=>(vn(()=>{me(Mt,!0)}),T()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!p(S)||p(S).isDestroyed||(vn(()=>{me(Mt,!1)}),T()?.(!1),bn())})}),!1),beforeinput:()=>(U()?.(),!1)},attributes:{class:`tiptap-editor ${m()}`,role:"textbox","aria-multiline":"true","aria-label":a(),autocomplete:"off",spellcheck:"false",autocorrect:"off",autocapitalize:"off"},handlePaste:(z,E)=>{if(wC(E))return!0;const Oe=E.clipboardData?.getData("text/plain");if(Oe){const Ge=Oe.split(`
175
- `);if(Ge.length>=5){const{state:De,dispatch:ut}=z,Xe=De.schema.nodes.pasteChip.create({content:Oe,lineCount:Ge.length}),$t=De.tr.replaceSelectionWith(Xe).setMeta("uiEvent","paste");return ut($t),!0}const J=E.clipboardData?.getData("text/html");if(J&&pM(J,Oe))return z.dispatch(z.state.tr.insertText(Oe).scrollIntoView().setMeta("uiEvent","paste")),!0;if(/\r|\n/.test(Oe)){const{state:De,dispatch:ut}=z,Xe=Ju(De.schema,Oe);if(Xe.length>0){const $t=new W(M.from(Xe),1,1);return ut(De.tr.replaceSelection($t).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(z,E)=>xC(E),handleKeyDown:(z,E)=>{if(z.composing||E.isComposing||E.keyCode===229)return!1;if(Ap(z,E)||Dp(E))return!0;if(E.key==="Escape"&&H())return E.preventDefault(),H()(),!0;const Oe=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),Ge=J=>Dg(E,Zl(J),Oe);if(Ge("chat.mention-context")&&Zl("chat.mention-context")!=="@")return E.preventDefault(),p(S)?.chain().focus().insertContent("@").run(),!0;if(Oe&&E.ctrlKey&&!E.metaKey){if(E.key==="a"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.start();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="e"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.end();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="k"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.selection.$head,Xe=ut.pos,$t=ut.end();return Xe<$t&&De(J.tr.delete(Xe,$t)),!0}if(E.key==="p"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","line"),!0}if(E.key==="n"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","line"),!0}if(E.key==="f"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","character"),!0}if(E.key==="b"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","character"),!0}}if(E.metaKey&&!E.ctrlKey&&!E.altKey){if(E.key==="ArrowLeft"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","backward","lineboundary"),!0}if(E.key==="ArrowRight"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","forward","lineboundary"),!0}if(E.key==="ArrowUp"){E.preventDefault();const{state:J,dispatch:De}=z,ut=1;if(E.shiftKey){const{from:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,ut,Xe)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}if(E.key==="ArrowDown"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.doc.content.size-1;if(E.shiftKey){const{to:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,Xe,ut)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}}if(Ge("chat.force-send"))return E.preventDefault(),k()?.(),!0;if(Ge("chat.new-line"))return E.preventDefault(),p(S)?.chain().setHardBreak().scrollIntoView().run(),!0;if(E.key==="ArrowUp"&&O()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{from:ut}=De.selection,Xe=ut<=1,$t=De.doc.textContent.length===0;if(Xe||$t){const Hn=O()();if(Hn!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Hn)).focus("end").run(),x()?.(Hn),!0}}if(E.key==="ArrowDown"&&R()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{to:ut}=De.selection,Xe=De.doc.content.size-1,$t=ut>=Xe,Hn=De.doc.textContent.length===0;if($t||Hn){const Fr=R()();if(Fr!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Fr)).focus("end").run(),x()?.(Fr),!0}}return Ge("chat.send")?Hr.pluginKey.getState(z.state)?.active?!1:w()?(E.preventDefault(),w()(),!0):!1:!1}}}),!0),I.addEventListener("mouseover",zl),I.addEventListener("mouseout",$l),I.addEventListener("click",Fl),p(S).view.dom.addEventListener("keydown",Vl)})(),()=>{b=!0}});function zl(b){const C=b.target,I=Ul(C);if(I){const Q=C.getBoundingClientRect();if(!xe){xe=document.createElement("div"),(ze?.target()??document.body).appendChild(xe);const z=I.type||"file",E=I.label||C.textContent||"",Oe={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};He=Zr(xp,{target:xe,props:{mention:{id:I.id,type:z,label:E,uri:I.uri,meta:I.meta,icon:Oe[z]||"📄"},position:{x:Q.left,y:Q.bottom+5},onClose:()=>{He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}}});const Ge=xe.firstElementChild;Ge instanceof HTMLElement&&(it=ze?.register(Ge,$n)),xe.addEventListener("mouseout",Hl)}}}function $l(b){const C=b.target;b.relatedTarget?.closest(".mention-hover-preview")||C.hasAttribute("data-mention")&&He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}function Hl(b){b.relatedTarget?.closest("[data-mention]")||He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}async function Fl(b){const C=Ul(b.target);if(C&&C.type!=="member"){if(C.intentUrl){b.preventDefault(),b.stopPropagation();const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./BIVpRSxo.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]),import.meta.url);await I(C.intentUrl);return}if(C.type==="note"&&C.note){if(b.preventDefault(),b.stopPropagation(),C.note.workspaceId){const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./BIVpRSxo.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]),import.meta.url);await I(Eg(C.note.id,C.note.workspaceId))}else{const{navigateToNote:I}=await Hi(async()=>{const{navigateToNote:Q}=await import("./CXfRSojK.js").then(z=>z.h);return{navigateToNote:Q}},__vite__mapDeps([36,37,2,38,39,40,32,15,5,1,21,22,23,24,8,25,4,33,27,17,6,7,9,12,13,14,16,34,19,41,42,43]),import.meta.url);await I(C.note.id)}return}if(C.type==="file"&&C.filePath){b.preventDefault(),b.stopPropagation();const{navigateToFile:I}=await Hi(async()=>{const{navigateToFile:Q}=await import("./CXfRSojK.js").then(z=>z.h);return{navigateToFile:Q}},__vite__mapDeps([36,37,2,38,39,40,32,15,5,1,21,22,23,24,8,25,4,33,27,17,6,7,9,12,13,14,16,34,19,41,42,43]),import.meta.url);await I(C.filePath);return}}}function Vl(b){if(!b.metaKey||b.ctrlKey||b.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(b.key)||!p(S))return;const{state:C,dispatch:I}=p(S).view;if(b.key==="ArrowLeft"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","backward","lineboundary")}else if(b.key==="ArrowRight"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","forward","lineboundary")}else if(b.key==="ArrowUp"){b.preventDefault(),b.stopPropagation();const Q=1;if(b.shiftKey){const{from:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,Q,z)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}else if(b.key==="ArrowDown"){b.preventDefault(),b.stopPropagation();const Q=C.doc.content.size-1;if(b.shiftKey){const{to:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,z,Q)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}}nd(()=>{$r.dispose(),p(S)&&(p(S).view.dom.removeEventListener("keydown",Vl),p(S).destroy()),p($e)&&(p($e).removeEventListener("mouseover",zl),p($e).removeEventListener("mouseout",$l),p($e).removeEventListener("click",Fl)),xe&&xe.removeEventListener("mouseout",Hl),He&&xe&&(wn(He),it?.(),it=void 0,xe.remove())});let No=0;bt(()=>{if(!p(S))return;const b=Wn(p(S));if(o()===b)return;if(p(S).view.hasFocus()){No+=1;return}const C=p(S).view.hasFocus(),{from:I}=p(S).state.selection,Q=++No;(async()=>{const z=zr(o()||"");!p(S)||Q!==No||Wn(p(S))===b&&p(S).chain().command(({tr:E})=>(E.setMeta("external-update",!0),!0)).setContent(z).command(({tr:E,state:Oe})=>{if(C)try{const Ge=Oe.doc.content.size,J=Math.min(I,Ge);E.setSelection(j.create(Oe.doc,J,J))}catch{}return!0}).run()})()}),bt(()=>{p(S)&&p(S).setEditable(p(Ue),!1)}),bt(()=>{!p(S)||p(S).isDestroyed||p(S).view.dispatch(p(S).state.tr.setMeta(Qr,ke()))}),bt(()=>{const b=p(S)?.view.dom;b&&(b.setAttribute("aria-haspopup","listbox"),p(mt)&&p(st)?(b.setAttribute("aria-controls",We),b.setAttribute("aria-activedescendant",p(st))):(b.removeAttribute("aria-controls"),b.removeAttribute("aria-activedescendant")))});var Xp={flushScreenEvidence:bn,showAutocompleteSuggestion:Rp,insertAtSymbol:Lp,insertText:Pp,insertPlainText:_p,focus:Bp,focusEnd:zp,focusAndSelectAll:$p,getHTML:Hp,clear:Fp,setContent:Vp,insertImage:Wp,getInlineImages:jp,getTextContent:Kp,insertContextMention:Up,insertMention:qp,getMentions:Jp,getContextMentions:Gp,get value(){return o()},set value(b=""){o(b),P()},get ariaLabel(){return a()},set ariaLabel(b=se.chat_richInput_editor_ariaLabel()){a(b),P()},get placeholder(){return l()},set placeholder(b=se.chat_richInput_askAnything_placeholder()){l(b),P()},get reactivePlaceholder(){return c()},set reactivePlaceholder(b=!1){c(b),P()},get disabled(){return u()},set disabled(b=!1){u(b),P()},get editableWhileDisabled(){return d()},set editableWhileDisabled(b=!1){d(b),P()},get inputLocked(){return f()},set inputLocked(b=!1){f(b),P()},get class(){return h()},set class(b=""){h(b),P()},get editorClassName(){return m()},set editorClassName(b=""){m(b),P()},get workspace(){return g()},set workspace(b){g(b),P()},get repoPath(){return y()},set repoPath(b){y(b),P()},get autoFocus(){return v()},set autoFocus(b=!1){v(b),P()},get onUpdate(){return x()},set onUpdate(b){x(b),P()},get onSubmit(){return w()},set onSubmit(b){w(b),P()},get onForceSubmit(){return k()},set onForceSubmit(b){k(b),P()},get onEscape(){return H()},set onEscape(b){H(b),P()},get onHistoryPrev(){return O()},set onHistoryPrev(b){O(b),P()},get onHistoryNext(){return R()},set onHistoryNext(b){R(b),P()},get onMentionStart(){return D()},set onMentionStart(b){D(b),P()},get onMentionSelect(){return V()},set onMentionSelect(b){V(b),P()},get onSelectionChange(){return _()},set onSelectionChange(b){_(b),P()},get contextItems(){return be()},set contextItems(b=[]){be(b),P()},get trailingHint(){return ke()},set trailingHint(b=null){ke(b),P()},get autocompleteContext(){return F()},set autocompleteContext(b=null){F(b),P()},get skills(){return B()},set skills(b=[]){B(b),P()},get skillsLoading(){return Z()},set skillsLoading(b=!1){Z(b),P()},get skillsError(){return ne()},set skillsError(b=null){ne(b),P()},get onSkillsRetry(){return _e()},set onSkillsRetry(b){_e(b),P()},get slashCommands(){return et()},set slashCommands(b=[]){et(b),P()},get slashEmptyLabel(){return at()},set slashEmptyLabel(b){at(b),P()},get slashNotice(){return lt()},set slashNotice(b){lt(b),P()},get unavailableSkillTitle(){return N()},set unavailableSkillTitle(b){N(b),P()},get screenReferences(){return Y()},set screenReferences(b){Y(b),P()},get screenInsertions(){return le()},set screenInsertions(b=[]){le(b),P()},get screenInterim(){return q()},set screenInterim(b=[]){q(b),P()},get screenSpeechActive(){return Be()},set screenSpeechActive(b=!1){Be(b),P()},get onScreenInsertionApplied(){return Ae()},set onScreenInsertionApplied(b){Ae(b),P()},get onCompositionChange(){return T()},set onCompositionChange(b){T(b),P()},get onUserTextInput(){return U()},set onUserTextInput(b){U(b),P()},get onScreenReferencesEdited(){return de()},set onScreenReferencesEdited(b){de(b),P()},get minHeight(){return Ne()},set minHeight(b=80){Ne(b),P()},get maxHeight(){return Ce()},set maxHeight(b=300){Ce(b),P()},$set:jt,$on:(b,C)=>Kt(e,b,C)},Oo=UM(),Wl=ye(Oo),Yp=()=>p(mt),Qp=b=>!b&&zi();Lo(Wl,()=>_g,(b,C)=>{C(b,{get open(){return Yp()},set open(I){Qp(I)},children:(I,Q)=>{var z=wr(),E=Bt(z);{let Oe=$(()=>ze?.target());Lo(E,()=>km,(Ge,J)=>{J(Ge,{get to(){return p(Oe)},children:(De,ut)=>{var Xe=wr(),$t=Bt(Xe);{let Hn=$(()=>p($e)??null);Lo($t,()=>Pg,(Fr,Zp)=>{Zp(Fr,{get customAnchor(){return p(Hn)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:_l,onCloseAutoFocus:_l,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return p(rt)},set ref(Ro){me(rt,Ro,!0)},children:(Ro,JM)=>{Er(Ep(Ro,{get listboxId(){return We},get commands(){return p(Fe)},get items(){return p(fe)},get loading(){return Z()},get error(){return ne()},get emptyLabel(){return at()},get notice(){return lt()},get onRetry(){return _e()},onSelect:Np,onSelectCommand:Op,onDismiss:zi,onActiveOptionChange:Do=>me(st,Do,!0)}),Do=>me(Dt,Do,!0),()=>p(Dt))},$$slots:{default:!0}})})}K(De,Xe)},$$slots:{default:!0}})})}K(I,z)},$$slots:{default:!0}})});var Io=oe(Wl,2);let jl;return Er(Io,b=>me($e,b),()=>p($e)),ue(Oo),ie(()=>{jl=pn(Io,1,`tiptap-container ${h()??""}`,"svelte-bv9i3d",jl,{"placeholder-suppressed":p(ct)}),hi(Io,`--tt-min-height:${Ne()}px;--tt-max-height:${Ce()}px`)}),K(n,Oo),qt(Xp)}export{nM as A,rr as B,o1 as C,or as D,jx as E,M as F,gp as G,gl as H,_i as I,yl as J,xC as K,NE as L,ar as M,pp as N,Jf as O,Ie as P,Te as Q,BS as R,ae as S,Lw as T,LS as U,mS as V,gS as W,_r as X,c1 as a,lC as b,ja as c,ft as d,he as e,Ke as f,pd as g,ot as h,G as i,qx as j,Co as k,KS as l,Ve as m,Oy as n,W as o,Dl as p,Pw as q,j as r,qM as s,Ya as t,Ee as u,KC as v,IE as w,AE as x,Uv as y,X as z};
175
+ `);if(Ge.length>=5){const{state:De,dispatch:ut}=z,Xe=De.schema.nodes.pasteChip.create({content:Oe,lineCount:Ge.length}),$t=De.tr.replaceSelectionWith(Xe).setMeta("uiEvent","paste");return ut($t),!0}const J=E.clipboardData?.getData("text/html");if(J&&pM(J,Oe))return z.dispatch(z.state.tr.insertText(Oe).scrollIntoView().setMeta("uiEvent","paste")),!0;if(/\r|\n/.test(Oe)){const{state:De,dispatch:ut}=z,Xe=Ju(De.schema,Oe);if(Xe.length>0){const $t=new W(M.from(Xe),1,1);return ut(De.tr.replaceSelection($t).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(z,E)=>xC(E),handleKeyDown:(z,E)=>{if(z.composing||E.isComposing||E.keyCode===229)return!1;if(Ap(z,E)||Dp(E))return!0;if(E.key==="Escape"&&H())return E.preventDefault(),H()(),!0;const Oe=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),Ge=J=>Dg(E,Zl(J),Oe);if(Ge("chat.mention-context")&&Zl("chat.mention-context")!=="@")return E.preventDefault(),p(S)?.chain().focus().insertContent("@").run(),!0;if(Oe&&E.ctrlKey&&!E.metaKey){if(E.key==="a"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.start();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="e"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.end();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="k"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.selection.$head,Xe=ut.pos,$t=ut.end();return Xe<$t&&De(J.tr.delete(Xe,$t)),!0}if(E.key==="p"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","line"),!0}if(E.key==="n"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","line"),!0}if(E.key==="f"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","character"),!0}if(E.key==="b"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","character"),!0}}if(E.metaKey&&!E.ctrlKey&&!E.altKey){if(E.key==="ArrowLeft"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","backward","lineboundary"),!0}if(E.key==="ArrowRight"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","forward","lineboundary"),!0}if(E.key==="ArrowUp"){E.preventDefault();const{state:J,dispatch:De}=z,ut=1;if(E.shiftKey){const{from:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,ut,Xe)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}if(E.key==="ArrowDown"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.doc.content.size-1;if(E.shiftKey){const{to:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,Xe,ut)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}}if(Ge("chat.force-send"))return E.preventDefault(),k()?.(),!0;if(Ge("chat.new-line"))return E.preventDefault(),p(S)?.chain().setHardBreak().scrollIntoView().run(),!0;if(E.key==="ArrowUp"&&O()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{from:ut}=De.selection,Xe=ut<=1,$t=De.doc.textContent.length===0;if(Xe||$t){const Hn=O()();if(Hn!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Hn)).focus("end").run(),x()?.(Hn),!0}}if(E.key==="ArrowDown"&&R()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{to:ut}=De.selection,Xe=De.doc.content.size-1,$t=ut>=Xe,Hn=De.doc.textContent.length===0;if($t||Hn){const Fr=R()();if(Fr!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Fr)).focus("end").run(),x()?.(Fr),!0}}return Ge("chat.send")?Hr.pluginKey.getState(z.state)?.active?!1:w()?(E.preventDefault(),w()(),!0):!1:!1}}}),!0),I.addEventListener("mouseover",zl),I.addEventListener("mouseout",$l),I.addEventListener("click",Fl),p(S).view.dom.addEventListener("keydown",Vl)})(),()=>{b=!0}});function zl(b){const C=b.target,I=Ul(C);if(I){const Q=C.getBoundingClientRect();if(!xe){xe=document.createElement("div"),(ze?.target()??document.body).appendChild(xe);const z=I.type||"file",E=I.label||C.textContent||"",Oe={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};He=Zr(xp,{target:xe,props:{mention:{id:I.id,type:z,label:E,uri:I.uri,meta:I.meta,icon:Oe[z]||"📄"},position:{x:Q.left,y:Q.bottom+5},onClose:()=>{He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}}});const Ge=xe.firstElementChild;Ge instanceof HTMLElement&&(it=ze?.register(Ge,$n)),xe.addEventListener("mouseout",Hl)}}}function $l(b){const C=b.target;b.relatedTarget?.closest(".mention-hover-preview")||C.hasAttribute("data-mention")&&He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}function Hl(b){b.relatedTarget?.closest("[data-mention]")||He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}async function Fl(b){const C=Ul(b.target);if(C&&C.type!=="member"){if(C.intentUrl){b.preventDefault(),b.stopPropagation();const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./CPlbtgfY.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]),import.meta.url);await I(C.intentUrl);return}if(C.type==="note"&&C.note){if(b.preventDefault(),b.stopPropagation(),C.note.workspaceId){const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./CPlbtgfY.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]),import.meta.url);await I(Eg(C.note.id,C.note.workspaceId))}else{const{navigateToNote:I}=await Hi(async()=>{const{navigateToNote:Q}=await import("./DhBCCByJ.js").then(z=>z.h);return{navigateToNote:Q}},__vite__mapDeps([36,37,2,38,39,40,32,15,5,1,21,22,23,24,8,25,4,33,27,17,6,7,9,12,13,14,16,34,19,41,42,43]),import.meta.url);await I(C.note.id)}return}if(C.type==="file"&&C.filePath){b.preventDefault(),b.stopPropagation();const{navigateToFile:I}=await Hi(async()=>{const{navigateToFile:Q}=await import("./DhBCCByJ.js").then(z=>z.h);return{navigateToFile:Q}},__vite__mapDeps([36,37,2,38,39,40,32,15,5,1,21,22,23,24,8,25,4,33,27,17,6,7,9,12,13,14,16,34,19,41,42,43]),import.meta.url);await I(C.filePath);return}}}function Vl(b){if(!b.metaKey||b.ctrlKey||b.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(b.key)||!p(S))return;const{state:C,dispatch:I}=p(S).view;if(b.key==="ArrowLeft"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","backward","lineboundary")}else if(b.key==="ArrowRight"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","forward","lineboundary")}else if(b.key==="ArrowUp"){b.preventDefault(),b.stopPropagation();const Q=1;if(b.shiftKey){const{from:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,Q,z)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}else if(b.key==="ArrowDown"){b.preventDefault(),b.stopPropagation();const Q=C.doc.content.size-1;if(b.shiftKey){const{to:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,z,Q)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}}nd(()=>{$r.dispose(),p(S)&&(p(S).view.dom.removeEventListener("keydown",Vl),p(S).destroy()),p($e)&&(p($e).removeEventListener("mouseover",zl),p($e).removeEventListener("mouseout",$l),p($e).removeEventListener("click",Fl)),xe&&xe.removeEventListener("mouseout",Hl),He&&xe&&(wn(He),it?.(),it=void 0,xe.remove())});let No=0;bt(()=>{if(!p(S))return;const b=Wn(p(S));if(o()===b)return;if(p(S).view.hasFocus()){No+=1;return}const C=p(S).view.hasFocus(),{from:I}=p(S).state.selection,Q=++No;(async()=>{const z=zr(o()||"");!p(S)||Q!==No||Wn(p(S))===b&&p(S).chain().command(({tr:E})=>(E.setMeta("external-update",!0),!0)).setContent(z).command(({tr:E,state:Oe})=>{if(C)try{const Ge=Oe.doc.content.size,J=Math.min(I,Ge);E.setSelection(j.create(Oe.doc,J,J))}catch{}return!0}).run()})()}),bt(()=>{p(S)&&p(S).setEditable(p(Ue),!1)}),bt(()=>{!p(S)||p(S).isDestroyed||p(S).view.dispatch(p(S).state.tr.setMeta(Qr,ke()))}),bt(()=>{const b=p(S)?.view.dom;b&&(b.setAttribute("aria-haspopup","listbox"),p(mt)&&p(st)?(b.setAttribute("aria-controls",We),b.setAttribute("aria-activedescendant",p(st))):(b.removeAttribute("aria-controls"),b.removeAttribute("aria-activedescendant")))});var Xp={flushScreenEvidence:bn,showAutocompleteSuggestion:Rp,insertAtSymbol:Lp,insertText:Pp,insertPlainText:_p,focus:Bp,focusEnd:zp,focusAndSelectAll:$p,getHTML:Hp,clear:Fp,setContent:Vp,insertImage:Wp,getInlineImages:jp,getTextContent:Kp,insertContextMention:Up,insertMention:qp,getMentions:Jp,getContextMentions:Gp,get value(){return o()},set value(b=""){o(b),P()},get ariaLabel(){return a()},set ariaLabel(b=se.chat_richInput_editor_ariaLabel()){a(b),P()},get placeholder(){return l()},set placeholder(b=se.chat_richInput_askAnything_placeholder()){l(b),P()},get reactivePlaceholder(){return c()},set reactivePlaceholder(b=!1){c(b),P()},get disabled(){return u()},set disabled(b=!1){u(b),P()},get editableWhileDisabled(){return d()},set editableWhileDisabled(b=!1){d(b),P()},get inputLocked(){return f()},set inputLocked(b=!1){f(b),P()},get class(){return h()},set class(b=""){h(b),P()},get editorClassName(){return m()},set editorClassName(b=""){m(b),P()},get workspace(){return g()},set workspace(b){g(b),P()},get repoPath(){return y()},set repoPath(b){y(b),P()},get autoFocus(){return v()},set autoFocus(b=!1){v(b),P()},get onUpdate(){return x()},set onUpdate(b){x(b),P()},get onSubmit(){return w()},set onSubmit(b){w(b),P()},get onForceSubmit(){return k()},set onForceSubmit(b){k(b),P()},get onEscape(){return H()},set onEscape(b){H(b),P()},get onHistoryPrev(){return O()},set onHistoryPrev(b){O(b),P()},get onHistoryNext(){return R()},set onHistoryNext(b){R(b),P()},get onMentionStart(){return D()},set onMentionStart(b){D(b),P()},get onMentionSelect(){return V()},set onMentionSelect(b){V(b),P()},get onSelectionChange(){return _()},set onSelectionChange(b){_(b),P()},get contextItems(){return be()},set contextItems(b=[]){be(b),P()},get trailingHint(){return ke()},set trailingHint(b=null){ke(b),P()},get autocompleteContext(){return F()},set autocompleteContext(b=null){F(b),P()},get skills(){return B()},set skills(b=[]){B(b),P()},get skillsLoading(){return Z()},set skillsLoading(b=!1){Z(b),P()},get skillsError(){return ne()},set skillsError(b=null){ne(b),P()},get onSkillsRetry(){return _e()},set onSkillsRetry(b){_e(b),P()},get slashCommands(){return et()},set slashCommands(b=[]){et(b),P()},get slashEmptyLabel(){return at()},set slashEmptyLabel(b){at(b),P()},get slashNotice(){return lt()},set slashNotice(b){lt(b),P()},get unavailableSkillTitle(){return N()},set unavailableSkillTitle(b){N(b),P()},get screenReferences(){return Y()},set screenReferences(b){Y(b),P()},get screenInsertions(){return le()},set screenInsertions(b=[]){le(b),P()},get screenInterim(){return q()},set screenInterim(b=[]){q(b),P()},get screenSpeechActive(){return Be()},set screenSpeechActive(b=!1){Be(b),P()},get onScreenInsertionApplied(){return Ae()},set onScreenInsertionApplied(b){Ae(b),P()},get onCompositionChange(){return T()},set onCompositionChange(b){T(b),P()},get onUserTextInput(){return U()},set onUserTextInput(b){U(b),P()},get onScreenReferencesEdited(){return de()},set onScreenReferencesEdited(b){de(b),P()},get minHeight(){return Ne()},set minHeight(b=80){Ne(b),P()},get maxHeight(){return Ce()},set maxHeight(b=300){Ce(b),P()},$set:jt,$on:(b,C)=>Kt(e,b,C)},Oo=UM(),Wl=ye(Oo),Yp=()=>p(mt),Qp=b=>!b&&zi();Lo(Wl,()=>_g,(b,C)=>{C(b,{get open(){return Yp()},set open(I){Qp(I)},children:(I,Q)=>{var z=wr(),E=Bt(z);{let Oe=$(()=>ze?.target());Lo(E,()=>km,(Ge,J)=>{J(Ge,{get to(){return p(Oe)},children:(De,ut)=>{var Xe=wr(),$t=Bt(Xe);{let Hn=$(()=>p($e)??null);Lo($t,()=>Pg,(Fr,Zp)=>{Zp(Fr,{get customAnchor(){return p(Hn)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:_l,onCloseAutoFocus:_l,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return p(rt)},set ref(Ro){me(rt,Ro,!0)},children:(Ro,JM)=>{Er(Ep(Ro,{get listboxId(){return We},get commands(){return p(Fe)},get items(){return p(fe)},get loading(){return Z()},get error(){return ne()},get emptyLabel(){return at()},get notice(){return lt()},get onRetry(){return _e()},onSelect:Np,onSelectCommand:Op,onDismiss:zi,onActiveOptionChange:Do=>me(st,Do,!0)}),Do=>me(Dt,Do,!0),()=>p(Dt))},$$slots:{default:!0}})})}K(De,Xe)},$$slots:{default:!0}})})}K(I,z)},$$slots:{default:!0}})});var Io=oe(Wl,2);let jl;return Er(Io,b=>me($e,b),()=>p($e)),ue(Oo),ie(()=>{jl=pn(Io,1,`tiptap-container ${h()??""}`,"svelte-bv9i3d",jl,{"placeholder-suppressed":p(ct)}),hi(Io,`--tt-min-height:${Ne()}px;--tt-max-height:${Ce()}px`)}),K(n,Oo),qt(Xp)}export{nM as A,rr as B,o1 as C,or as D,jx as E,M as F,gp as G,gl as H,_i as I,yl as J,xC as K,NE as L,ar as M,pp as N,Jf as O,Ie as P,Te as Q,BS as R,ae as S,Lw as T,LS as U,mS as V,gS as W,_r as X,c1 as a,lC as b,ja as c,ft as d,he as e,Ke as f,pd as g,ot as h,G as i,qx as j,Co as k,KS as l,Ve as m,Oy as n,W as o,Dl as p,Pw as q,j as r,qM as s,Ya as t,Ee as u,KC as v,IE as w,AE as x,Uv as y,X as z};
@@ -1 +1 @@
1
- import"./3SdAC2_C.js";import{p as r}from"./CndXvgyH.js";const t={get error(){return r.error},get params(){return r.params},get state(){return r.state},get status(){return r.status},get url(){return r.url}},s=t;export{s as p};
1
+ import"./3SdAC2_C.js";import{p as r}from"./Bk5Drm1a.js";const t={get error(){return r.error},get params(){return r.params},get state(){return r.state},get status(){return r.status},get url(){return r.url}},s=t;export{s as p};
@@ -1 +1 @@
1
- import{t as Ot,bo as R,bm as u,bw as Ft,b as Rt}from"./CLAmm_T1.js";import{bs as Gt,bV as K,br as rt,bk as er,bj as tr,bH as r,a5 as c,aD as e,bS as n,bl as S,bA as l,b_ as g,bO as m,W as o,bn as Mt,aA as G,c9 as z,be as Ve,b$ as Be,aB as b,c5 as mt,ca as ft,a7 as Ue,ay as U,ai as rr,aj as ar,bf as sr}from"./3SdAC2_C.js";import{i as W}from"./BFgvMDua.js";import{I as or,g as Xe}from"./B1CKzIA2.js";import{c as Ee}from"./BwH4Bvte.js";import{n as Oe,j as Ze,h as $t}from"./CfNIzRu8.js";import{f as Fe,c as gt,s as nr}from"./CcJmuwXr.js";import{b as xt}from"./Dn334wJv.js";import{F as Te,cR as ir,au as lr,cK as bt,c$ as Pt,cd as cr}from"./DPttSllj.js";import{f as ye}from"./nxtepGjE.js";import"./TB9r2XJy.js";import"./hkJYqn41.js";import{M as nt}from"./mq9vi3Up.js";import{M as dr}from"./BtmHyUSg.js";import{w as _e}from"./C3vs7E1W.js";import{h as Ct,i as Et,g as Tt,P as At}from"./96V4v2iI.js";import{C as ht}from"./BNJ3edFz.js";import{c as pr}from"./ChTqQfQN.js";import{A as ur}from"./9YT9B_ti.js";import"./BwNrQXlF.js";import{f as vr}from"./BbhtQrkZ.js";import{JH as _r}from"./B9vHutcJ.js";import{dT as mr}from"./C2UL5Ler.js";import{S as et,j as fr,a as jt}from"./CFjHgtjF.js";import{R as qe,c as it,m as gr,bE as tt}from"./ByZRLPfm.js";import"./BF_gPEg7.js";var xr=b('<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>'),br=b('<div class="text-sm text-danger bg-danger-background/10 rounded-md p-3"> </div>'),hr=b('<div class="flex items-center gap-2 text-subtle"><!> <span class="text-sm"> </span></div>'),Sr=b('<div class="p-4 max-h-60 overflow-y-auto overscroll-contain"><!></div>'),wr=b('<div class="p-3 bg-muted/30"><div class="flex items-center justify-between mb-2"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span></div> <!></div> <p class="text-xs text-subtle mb-2"> </p> <div class="h-32 rounded border border-border overflow-hidden"><!></div></div>'),yr=b('<div class="flex flex-col bg-background border border-border rounded-lg overflow-hidden"><div class="flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span> <!></div> <div class="flex items-center gap-1"><!></div></div> <!> <!></div>');function St(He,P){if(new.target)return Ot({component:St,...He});Gt(P,!0);const at=pr("SetupScriptAgent");let Ae=R(P,"repoPath",7),Re=R(P,"onScriptGenerated",7),Ge=R(P,"onClose",7),Me=K(rt(crypto.randomUUID())),O=K(!1),ae=K(null),me=!1,ie=K(null);er(()=>{me=!0,C()}),tr(()=>{me=!1});async function le(){try{const v=mr.select(_r.state).find(E=>E.repositoryPath===Ae()||E.path===Ae()||E.worktreePath===Ae());return v?String(v.id):null}catch{return null}}async function C(){r(O,!0),r(ae,null),r(ie,null);try{const s=await le();if(!me)return;if(!s){r(ae,u.workspace_setupScriptAgent_noWorkspace_error(),!0),r(O,!1);return}const v=await vr.setupScripts.generate(s);if(!me)return;if(!v||!v.script){r(ae,u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1);return}r(ie,{name:v.projectType?u.workspace_setupScriptAgent_projectTypeSetup_label({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedSetup_label(),description:v.projectType?u.workspace_setupScriptAgent_generatedForProject_description({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedFromAnalysis_description(),content:v.script},!0),r(O,!1)}catch(s){if(at.error("Failed to generate setup script",s),!me)return;r(ae,s instanceof Error?s.message:u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1)}}function fe(s){Re()?.(s)}var ge={get repoPath(){return Ae()},set repoPath(s){Ae(s),G()},get onScriptGenerated(){return Re()},set onScriptGenerated(s){Re(s),G()},get onClose(){return Ge()},set onClose(s){Ge(s),G()},$set:Ft,$on:(s,v)=>Rt(P,s,v)},ce=yr(),xe=c(ce),be=c(xe),De=c(be);ur(De,{variant:"standard",get agentId(){return e(Me)}});var Le=n(De,2),je=S(Le,!0),he=n(Le,2);{var de=s=>{var v=xr();o(s,v)};W(he,s=>{e(O)&&s(de)})}l(be);var Y=n(be,2),ke=c(Y);{let s=z(()=>u.workspace_setupScriptAgent_close_ariaLabel());ye(ke,{variant:"ghost-light",size:"icon-sm",iconOnly:!0,get"aria-label"(){return e(s)},get onclick(){return Ge()},children:(v,E)=>{Te(v,{get icon(){return ir}})},$$slots:{default:!0}})}l(Y),l(xe);var $e=n(xe,2);{var Ie=s=>{var v=Sr(),E=c(v);{var q=B=>{var M=br(),Q=S(M,!0);g(()=>m(Q,e(ae))),o(B,M)},se=B=>{var M=hr(),Q=c(M);or(Q,{size:16,class:"text-primary"});var Se=n(Q,2),ze=S(Se,!0);l(M),g(we=>m(ze,we),[()=>u.workspace_setupScriptAgent_analyzing_label()]),o(B,M)};W(E,B=>{e(ae)?B(q):B(se,-1)})}l(v),o(s,v)};W($e,s=>{(e(ae)||e(O))&&s(Ie)})}var Je=n($e,2);{var pe=s=>{var v=wr(),E=c(v),q=c(E),se=c(q);Te(se,{get icon(){return lr},class:"text-green-500"});var B=n(se,2),M=S(B,!0);l(q);var Q=n(q,2);ye(Q,{variant:"primary",size:"sm",onclick:()=>fe(e(ie)),class:"h-7",children:(Pe,st)=>{Ve();var Ye=Be();g(ct=>m(Ye,ct),[()=>u.workspace_setupScriptAgent_createScript_label()]),o(Pe,Ye)},$$slots:{default:!0}}),l(E);var Se=n(E,2),ze=S(Se,!0),we=n(Se,2),lt=c(we);ht(lt,{get value(){return e(ie).content},language:"shell",readOnly:!0,lineNumbers:!1}),l(we),l(v),g(()=>{m(M,e(ie).name),m(ze,e(ie).description)}),o(s,v)};W(Je,s=>{e(ie)&&!e(O)&&s(pe)})}return l(ce),g(s=>m(je,s),[()=>u.workspace_setupScriptAgent_title()]),o(He,ce),Mt(ge)}var kr=b('<span class="block truncate"> </span>'),$r=b("<div></div>"),Pr=b('<div role="group"></div> <div class="mt-2 border-t border-border pt-2"><!></div> <!> <div class="mt-2 border-t border-border pt-2"><!> <!></div>',1),Cr=b('<code class="type-caption text-muted-foreground"> </code>'),Er=b('<p> </p> <code class="type-caption"> </code>',1),It=b("<!> <!>",1),Tr=b('<div class="mt-2 flex flex-wrap gap-2 px-2"></div>'),Ar=b('<div class="h-44 min-w-0 overflow-hidden rounded-(--radius-medium) border border-border bg-background py-2"><!></div> <div class="mt-2 px-1"><!> <!></div>',1),jr=b('<div class="mb-2 flex items-center justify-between gap-3 px-2"><div class="min-w-0"><h3> </h3> <p class="type-caption truncate text-muted-foreground"> </p></div> <!></div> <!>',1),Ke=b("<div><!></div>"),Ir=b("<!> ",1),Nt=b('<div class="min-w-0 w-full"><span class="text-sm"> </span> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Ut=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>'),Nr=b('<span class="type-caption px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium shrink-0"> </span>'),Ur=b('<div class="min-w-0 w-full"><div class="flex flex-wrap items-center gap-x-2 gap-y-1"><span class="text-sm"> </span> <!></div> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Or=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <p class="text-xs text-subtle px-2 mb-2"> </p> <!></div> <!> <!> <div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>',1),Fr=b('<code class="type-caption px-1.5 py-0.5 rounded bg-background/80 text-muted-foreground font-mono cursor-pointer hover:bg-background hover:text-foreground transition-colors"> </code>'),Rr=b('<p class="text-xs"> </p> <p class="mt-1 text-xs text-muted-foreground"> <code class="type-caption"> </code></p>',1),Gr=b('<div class="flex flex-wrap items-center gap-x-3 gap-y-1.5 px-3 py-1.5 bg-muted/30 shrink-0"><span class="type-caption font-medium text-muted-foreground shrink-0"> </span> <div class="flex flex-wrap gap-1.5"></div></div> <div class="flex-1 min-h-0 min-w-0 overflow-hidden py-3 bg-background"><!></div>',1),Mr=b('<div class="flex min-h-0 min-w-0 flex-col overflow-y-auto"><!></div> <div class="flex min-h-0 min-w-0 flex-col"><!></div>',1),Dr=b('<div class="flex flex-col min-h-0 min-w-0 overflow-y-auto p-2 md:pr-4"><!></div> <div class="flex flex-col min-w-0 min-h-0"><!></div>',1),Lr=b('<!> <span class="text-sm font-normal text-subtle"> </span> <span class="text-subtle font-normal"> </span>',1),zr=b('<div class="mt-1 pl-7 space-y-3"><!></div>'),Wr=b('<div class="space-y-3"><!></div>'),qr=b("<div><!> <!></div> <!>",1);function Kr(He,P){if(new.target)return Ot({component:Kr,...He});Gt(P,!0);const at=(t,a=sr)=>{{const y=_=>{Te(_,{get icon(){return bt},get class(){return _e.icon}})},j=_=>{var i=kr(),f=S(i,!0);g(()=>m(f,a().name)),o(_,i)},T=_=>{{let i=z(()=>e(st)===a().id?"checked":"empty");dr(_,{get state(){return e(i)}})}};let h=z(()=>e(st)===a().id),$=z(()=>e(st)===a().id);nt(t,{get selected(){return e(h)},get"aria-pressed"(){return e($)},get"data-setup-source"(){return a().id},get class(){return _e.row},onclick:()=>a().id==="custom"?Dt():we(a().id),leading:y,title:j,trailing:T,$$slots:{leading:!0,title:!0,trailing:!0}})}},Ae=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Pr(),_=U($);Xe(_,21,()=>e(Ye),I=>I.id,(I,F)=>{at(I,()=>e(F))}),l(_);var i=n(_,2),f=c(i);nt(f,{get"aria-expanded"(){return e($e)},get class(){return _e.row},onclick:()=>r($e,!e($e)),leading:w=>{Te(w,{get icon(){return cr},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptEditor_templates_label()]),o(w,d)},$$slots:{leading:!0,title:!0}}),l(i);var x=n(i,2);{var k=I=>{var F=$r();Xe(F,21,()=>e(ct),w=>w.id,(w,d)=>{at(w,()=>({id:`template-${e(d).id}`,name:e(d).name}))}),l(F),Oe(3,F,()=>Ze,()=>({tier:"moderate"})),o(I,F)};W(x,I=>{e($e)&&I(k)})}var D=n(x,2),ue=c(D);nt(ue,{get class(){return _e.row},onclick:()=>r(ke,!0),leading:w=>{Te(w,{get icon(){return bt},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptPicker_edit_label()]),o(w,d)},$$slots:{leading:!0,title:!0}});var ve=n(ue,2);{const I=d=>{Te(d,{get icon(){return Pt},get class(){return _e.icon}})},F=d=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(d,p)};let w=z(()=>!O());nt(ve,{get class(){return _e.row},get disabled(){return e(w)},onclick:()=>{r(ke,!0),r(Y,!0)},leading:I,title:F,$$slots:{leading:!0,title:!0}})}l(D),g(I=>nr(_,"aria-label",I),[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(h,$)},T=h=>{var $=jr(),_=U($),i=c(_),f=c(i),x=S(f,!0),k=n(f,2),D=S(k,!0);l(i);var ue=n(i,2);ye(ue,{variant:"ghost",size:"sm",onclick:()=>{r(ke,!1),r(Y,!1)},children:(w,d)=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptPicker_choose_label()]),o(w,p)},$$slots:{default:!0}}),l(_);var ve=n(_,2);{var I=w=>{St(w,{get repoPath(){return O()},onScriptGenerated:Lt,onClose:()=>r(Y,!1)})},F=w=>{var d=Ar(),p=U(d),N=c(p);xt(ht(N,{language:"shell",lineNumbers:!1,get lineWrapping(){return e(Se)},get value(){return C()},set value(A){C(A)}}),A=>r(pe,A,!0),()=>e(pe)),l(p);var X=n(p,2),H=c(X);ye(H,{variant:"ghost",size:"sm",get active(){return e(Ie)},get"aria-expanded"(){return e(Ie)},onclick:()=>r(Ie,!e(Ie)),children:(A,oe)=>{Ve();var L=Be();g(ee=>m(L,ee),[()=>u.workspace_setupScriptEditor_variables_label()]),o(A,L)},$$slots:{default:!0}});var V=n(H,2);{var Z=A=>{var oe=Ue(),L=U(oe);Ee(L,()=>At,(ee,te)=>{te(ee,{delayDuration:100,children:(ne,Ce)=>{var J=Tr();Xe(J,21,()=>jt,re=>re.name,(re,Ne)=>{var We=Ue(),pt=U(We);Ee(pt,()=>Ct,(Vt,Bt)=>{Bt(Vt,{children:(Ht,Vr)=>{var yt=It(),kt=U(yt);Ee(kt,()=>Et,(ut,vt)=>{vt(ut,{children:(_t,Yt)=>{var Qe=Cr(),ot=S(Qe);g(()=>m(ot,`$${e(Ne).name??""}`)),o(_t,Qe)},$$slots:{default:!0}})});var Jt=n(kt,2);Ee(Jt,()=>Tt,(ut,vt)=>{vt(ut,{side:"top",class:"max-w-xs",children:(_t,Yt)=>{var Qe=Er(),ot=U(Qe),Qt=S(ot,!0),Xt=n(ot,2),Zt=S(Xt,!0);g(()=>{m(Qt,e(Ne).description),m(Zt,e(Ne).example)}),o(_t,Qe)},$$slots:{default:!0}})}),o(Ht,yt)},$$slots:{default:!0}})}),o(re,We)}),l(J),o(ne,J)},$$slots:{default:!0}})}),o(A,oe)};W(V,A=>{e(Ie)&&A(Z)})}l(X),o(w,d)};W(ve,w=>{e(Y)&&O()?w(I):w(F,-1)})}g(w=>{Fe(f,1,gt(_e.title),"svelte-1yy464i"),m(x,w),m(D,e(ze))},[()=>u.workspace_setupScriptPicker_commands_label()]),o(h,$)};W(y,h=>{e(ke)?h(T,-1):h(j)})}l(a),xt(a,h=>r(Je,h),()=>e(Je)),g(()=>Fe(a,1,`${_e.rows} min-w-0`,"svelte-1yy464i")),o(t,a)},Re=t=>{var a=Or(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2),$=S(h,!0),_=n(h,2);{var i=d=>{var p=Ke(),N=c(p);St(N,{get repoPath(){return O()},onScriptGenerated:X=>{r(se,!0),r(s,""),C(X.content),r(E,X.name,!0),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())},onClose:()=>r(Y,!1)}),l(p),Oe(3,p,()=>Ze,()=>({tier:"moderate"})),o(d,p)},f=d=>{{let p=z(()=>!O());ye(d,{variant:"ghost",size:"sm",class:"w-full justify-start text-subtle",onclick:()=>r(Y,!0),get disabled(){return e(p)},children:(N,X)=>{var H=Ir(),V=U(H);Te(V,{get icon(){return Pt},class:"mr-1.5"});var Z=n(V);g(A=>m(Z,` ${A??""}`),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(N,H)},$$slots:{default:!0}})}};W(_,d=>{e(Y)&&O()?d(i):d(f,-1)})}l(y);var x=n(y,2);{var k=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===qe),Z=z(()=>e(s)===qe);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(qe),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(it,"repo-config"),()=>u.workspace_setupScriptEditor_repoConfig_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_repoConfig_label()]),o(d,p)};W(x,d=>{le()&&d(k)})}var D=n(x,2);{var ue=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===B),Z=z(()=>e(s)===B);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(B),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(e(M).name,e(M).nameSource),()=>u.workspace_setupScriptEditor_lastUsed_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_lastUsed_label()]),o(d,p)};W(D,d=>{e(M)&&d(ue)})}var ve=n(D,2),I=c(ve),F=S(I,!0),w=n(I,2);Xe(w,17,()=>et,d=>d.id,(d,p)=>{{let N=z(()=>e(s)===`template-${e(p).id}`),X=z(()=>e(s)===`template-${e(p).id}`);ye(d,{variant:"ghost",truncateLabel:!1,get active(){return e(N)},get"aria-pressed"(){return e(X)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(`template-${e(p).id}`),children:(H,V)=>{var Z=Ur(),A=c(Z),oe=c(A),L=S(oe,!0),ee=n(oe,2);{var te=J=>{var re=Nr(),Ne=S(re,!0);g(We=>m(Ne,We),[()=>u.workspace_setupScriptEditor_recommended_label()]),o(J,re)};W(ee,J=>{e(p).projectType===ie()&&J(te)})}l(A);var ne=n(A,2),Ce=S(ne,!0);l(Z),g(()=>{m(L,e(p).name),m(Ce,e(p).description)}),o(H,Z)},$$slots:{default:!0}})}}),l(ve),g((d,p,N)=>{m(T,d),m($,p),m(F,N)},[()=>u.workspace_setupScriptEditor_generate_label(),()=>u.workspace_setupScriptEditor_generate_description(),()=>u.workspace_setupScriptEditor_templates_label()]),o(t,a)},Ge=t=>{var a=Gr(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2);Xe(h,21,()=>jt,i=>i.name,(i,f)=>{var x=Ue(),k=U(x);Ee(k,()=>At,(D,ue)=>{ue(D,{delayDuration:100,children:(ve,I)=>{var F=Ue(),w=U(F);Ee(w,()=>Ct,(d,p)=>{p(d,{delayDuration:100,children:(N,X)=>{var H=It(),V=U(H);Ee(V,()=>Et,(A,oe)=>{oe(A,{children:(L,ee)=>{var te=Fr(),ne=S(te);g(()=>m(ne,`$${e(f).name??""}`)),o(L,te)},$$slots:{default:!0}})});var Z=n(V,2);Ee(Z,()=>Tt,(A,oe)=>{oe(A,{side:"bottom",class:"max-w-xs z-[200]",children:(L,ee)=>{var te=Rr(),ne=U(te),Ce=S(ne,!0),J=n(ne,2),re=c(J),Ne=n(re),We=S(Ne,!0);l(J),g(pt=>{m(Ce,e(f).description),m(re,`${pt??""} `),m(We,e(f).example)},[()=>u.workspace_setupScriptEditor_example_before()]),o(L,te)},$$slots:{default:!0}})}),o(N,H)},$$slots:{default:!0}})}),o(ve,F)},$$slots:{default:!0}})}),o(i,x)}),l(h),l(y);var $=n(y,2),_=c($);xt(ht(_,{language:"shell",lineNumbers:!0,get lineWrapping(){return e(Se)},get value(){return C()},set value(i){C(i)}}),i=>r(pe,i,!0),()=>e(pe)),l($),g(i=>m(T,i),[()=>u.workspace_setupScriptEditor_variables_label()]),ar("keydown",$,i=>{i.altKey&&i.key==="z"&&(i.preventDefault(),r(Se,!e(Se)))}),o(t,a)},Me=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Mr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),Oe(1,_,()=>$t,()=>({tier:"moderate",axis:"x",distance:-8})),Oe(1,f,()=>$t,()=>({tier:"moderate",axis:"x"})),o(h,$)},T=h=>{var $=Dr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),o(h,$)};W(y,h=>{he()==="workspace"?h(j):h(T,-1)})}l(a),g(()=>Fe(a,1,gt(he()==="workspace"?"setup-workspace-layout":"grid flex-1 min-h-0 min-w-0 grid-cols-1 grid-rows-[minmax(0,1fr)_minmax(0,2fr)] md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] md:grid-rows-1"),"svelte-1yy464i")),o(t,a)};let O=R(P,"repoPath",7,""),ae=R(P,"repositoryKey",7),me=R(P,"githubUrl",7,null),ie=R(P,"projectType",7,void 0),le=R(P,"repoConfigScript",7,null),C=R(P,"value",15,""),fe=R(P,"expanded",15,!1),ge=R(P,"scriptName",31,()=>rt(u.workspace_setupScriptEditor_custom_name())),ce=R(P,"scriptNameSource",15,"named"),xe=R(P,"isCustomScript",15,!1),be=R(P,"compact",7,!1),De=R(P,"triggerClass",7,""),Le=R(P,"contentOnly",7,!1),je=R(P,"contentClass",7,""),he=R(P,"presentation",7,"editor"),de=R(P,"onchange",7),Y=K(!1),ke=K(rt(mt(()=>xe()))),$e=K(!1),Ie=K(!1),Je=K(void 0),pe=K(void 0),s=K(""),v=K(!1),E=K(rt(ge())),q=K(rt(ce())),se=K(!1);const B="last-used",M=z(()=>{const t=ae()??O(),a=t?gr(t,me()):void 0;return a?.nameSource==="repo-config"?{...a,name:"Custom",nameSource:"custom"}:a}),Q=z(()=>{const t=new Map;return le()&&t.set(qe,{content:le(),label:it,source:"repo-config"}),e(M)&&t.set(B,{content:e(M).content,label:e(M).name,source:e(M).nameSource}),et.forEach(a=>{t.set(`template-${a.id}`,{content:fr(a),label:a.name,source:"named"})}),t});let Se=K(!0);const ze=z(()=>{if(e(v))return tt(e(E),e(q));if(!e(s))return u.workspace_setupScriptEditor_custom_name();const t=e(Q).get(e(s));return t?tt(t.label,t.source):u.workspace_setupScriptEditor_custom_name()});function we(t){r(s,t,!0),r(v,!1),r(se,!0);const a=e(Q).get(t);a&&(C(a.content),r(E,a.label,!0),r(q,a.source,!0),de()?.(C())),he()==="picker"?(r(ke,!1),r($e,!1),requestAnimationFrame(()=>e(Je)?.querySelector("[data-setup-source][aria-pressed=true]")?.focus())):requestAnimationFrame(()=>e(pe)?.focus())}function lt(t){if(e(s)&&e(s)!=="none"){const a=e(Q).get(e(s));a&&r(v,t!==a.content)}else t&&r(v,!0)}const Pe=(()=>{const t=et.find(a=>a.id==="generic");return t?`template-${t.id}`:""})(),st=z(()=>e(v)||!e(s)?"custom":e(s)),Ye=z(()=>{const t=[];le()&&t.push({id:qe,name:tt(it,"repo-config")}),e(M)&&t.push({id:B,name:u.workspace_setupScriptEditor_lastUsed_label()});for(const a of et){const y=`template-${a.id}`;(y===Pe||y===e(s))&&t.push({id:y,name:a.name})}return t.push({id:"custom",name:u.workspace_setupScriptPicker_custom_label()}),t}),ct=z(()=>et.filter(t=>!e(Ye).some(a=>a.id===`template-${t.id}`)));function Dt(){r(s,""),r(v,!0),r(E,"Custom"),r(q,"custom"),r(Y,!1),r(ke,!0),requestAnimationFrame(()=>e(pe)?.focus())}function Lt(t){r(se,!0),r(s,""),C(t.content),r(E,t.name,!0),r(q,"named"),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())}let dt=K(null);ft(()=>{const t=ae()??O();if(t===e(dt))return;const a=e(dt)===null&&(xe()||C().trim().length>0);if(r(dt,t,!0),a){mt(()=>{let T=!1;const h=C().trim();for(const[$,_]of e(Q).entries())if(h===_.content.trim()&&_.source===ce()&&_.label===ge()){r(s,$,!0),r(E,_.label,!0),r(q,_.source,!0),r(v,!1),T=!0;break}T||(r(v,!0),e(E)||(r(E,ge()||u.workspace_setupScriptEditor_custom_name(),!0),r(q,ge()?ce():"named",!0))),r(se,!0)});return}const y=!!le(),j=e(M);if(mt(()=>{if(r(v,!1),r(se,!0),y)r(s,qe,!0),r(E,it,!0),r(q,"repo-config");else if(j)r(s,B),r(E,j.name,!0),r(q,j.nameSource,!0);else if(Pe){r(s,Pe,!0);const T=e(Q).get(Pe);r(E,T?.label||u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}else r(E,u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}),y&&le())C(le()),de()?.(C());else if(j)C(j.content),de()?.(C());else if(Pe){const T=e(Q).get(Pe);T&&(C(T.content),de()?.(C()))}}),ft(()=>{if(e(se)){r(se,!1);return}C()!==void 0&&lt(C())}),ft(()=>{ge(e(E)),ce(e(q)),xe(e(v))});var zt={get repoPath(){return O()},set repoPath(t=""){O(t),G()},get repositoryKey(){return ae()},set repositoryKey(t){ae(t),G()},get githubUrl(){return me()},set githubUrl(t=null){me(t),G()},get projectType(){return ie()},set projectType(t=void 0){ie(t),G()},get repoConfigScript(){return le()},set repoConfigScript(t=null){le(t),G()},get value(){return C()},set value(t=""){C(t),G()},get expanded(){return fe()},set expanded(t=!1){fe(t),G()},get scriptName(){return ge()},set scriptName(t=u.workspace_setupScriptEditor_custom_name()){ge(t),G()},get scriptNameSource(){return ce()},set scriptNameSource(t="named"){ce(t),G()},get isCustomScript(){return xe()},set isCustomScript(t=!1){xe(t),G()},get compact(){return be()},set compact(t=!1){be(t),G()},get triggerClass(){return De()},set triggerClass(t=""){De(t),G()},get contentOnly(){return Le()},set contentOnly(t=!1){Le(t),G()},get contentClass(){return je()},set contentClass(t=""){je(t),G()},get presentation(){return he()},set presentation(t="editor"){he(t),G()},get onchange(){return de()},set onchange(t){de(t),G()},$set:Ft,$on:(t,a)=>Rt(P,t,a)},wt=Ue(),Wt=U(wt);{var qt=t=>{var a=Ue(),y=U(a);{var j=T=>{var h=Ue(),$=U(h);{var _=x=>{var k=Ke(),D=c(k);Ae(D),l(k),g(()=>Fe(k,1,`${je()??""} min-w-0`,"svelte-1yy464i")),o(x,k)},i=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex min-h-0 min-w-0 flex-1 flex-col`,"svelte-1yy464i")),o(x,k)},f=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex flex-col gap-3 flex-1 min-h-0 min-w-0`,"svelte-1yy464i")),Oe(3,k,()=>Ze,()=>({tier:"moderate"})),o(x,k)};W($,x=>{he()==="picker"?x(_):he()==="workspace"?x(i,1):x(f,-1)})}o(T,h)};W(y,T=>{fe()&&T(j)})}o(t,a)},Kt=t=>{var a=qr(),y=U(a),j=c(y);ye(j,{variant:"ghost",size:"sm",get class(){return`whitespace-nowrap hover:text-inherit! ${De()??""}`},onclick:()=>fe(!fe()),children:(i,f)=>{var x=Lr(),k=U(x);Te(k,{get icon(){return bt},size:"xs"});var D=n(k,2),ue=S(D,!0),ve=n(D,2),I=S(ve,!0);g(F=>{m(ue,F),m(I,e(ze))},[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(i,x)},$$slots:{default:!0}});var T=n(j,2);{var h=i=>{var f=zr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W(T,i=>{fe()&&!be()&&i(h)})}l(y);var $=n(y,2);{var _=i=>{var f=Wr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W($,i=>{fe()&&be()&&i(_)})}g(()=>Fe(y,1,gt(be()?"":"w-full"))),o(t,a)};W(Wt,t=>{Le()?t(qt):t(Kt,-1)})}return o(He,wt),Mt(zt)}rr(["keydown"]);export{Kr as default};
1
+ import{t as Ot,bo as R,bm as u,bw as Ft,b as Rt}from"./CLAmm_T1.js";import{bs as Gt,bV as K,br as rt,bk as er,bj as tr,bH as r,a5 as c,aD as e,bS as n,bl as S,bA as l,b_ as g,bO as m,W as o,bn as Mt,aA as G,c9 as z,be as Ve,b$ as Be,aB as b,c5 as mt,ca as ft,a7 as Ue,ay as U,ai as rr,aj as ar,bf as sr}from"./3SdAC2_C.js";import{i as W}from"./BFgvMDua.js";import{I as or,g as Xe}from"./B1CKzIA2.js";import{c as Ee}from"./BwH4Bvte.js";import{n as Oe,j as Ze,h as $t}from"./CfNIzRu8.js";import{f as Fe,c as gt,s as nr}from"./CcJmuwXr.js";import{b as xt}from"./Dn334wJv.js";import{F as Te,cR as ir,au as lr,cK as bt,c$ as Pt,cd as cr}from"./DPttSllj.js";import{f as ye}from"./nxtepGjE.js";import"./TB9r2XJy.js";import"./hkJYqn41.js";import{M as nt}from"./BQGkLFny.js";import{M as dr}from"./BtmHyUSg.js";import{w as _e}from"./C46oSs94.js";import{h as Ct,i as Et,g as Tt,P as At}from"./96V4v2iI.js";import{C as ht}from"./BNJ3edFz.js";import{c as pr}from"./ChTqQfQN.js";import{A as ur}from"./9YT9B_ti.js";import"./BwNrQXlF.js";import{f as vr}from"./BbhtQrkZ.js";import{JH as _r}from"./B9vHutcJ.js";import{dT as mr}from"./C2UL5Ler.js";import{S as et,j as fr,a as jt}from"./2Rvfwx05.js";import{R as qe,c as it,m as gr,bE as tt}from"./r9CLdeRr.js";import"./BwA1d-u1.js";var xr=b('<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>'),br=b('<div class="text-sm text-danger bg-danger-background/10 rounded-md p-3"> </div>'),hr=b('<div class="flex items-center gap-2 text-subtle"><!> <span class="text-sm"> </span></div>'),Sr=b('<div class="p-4 max-h-60 overflow-y-auto overscroll-contain"><!></div>'),wr=b('<div class="p-3 bg-muted/30"><div class="flex items-center justify-between mb-2"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span></div> <!></div> <p class="text-xs text-subtle mb-2"> </p> <div class="h-32 rounded border border-border overflow-hidden"><!></div></div>'),yr=b('<div class="flex flex-col bg-background border border-border rounded-lg overflow-hidden"><div class="flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span> <!></div> <div class="flex items-center gap-1"><!></div></div> <!> <!></div>');function St(He,P){if(new.target)return Ot({component:St,...He});Gt(P,!0);const at=pr("SetupScriptAgent");let Ae=R(P,"repoPath",7),Re=R(P,"onScriptGenerated",7),Ge=R(P,"onClose",7),Me=K(rt(crypto.randomUUID())),O=K(!1),ae=K(null),me=!1,ie=K(null);er(()=>{me=!0,C()}),tr(()=>{me=!1});async function le(){try{const v=mr.select(_r.state).find(E=>E.repositoryPath===Ae()||E.path===Ae()||E.worktreePath===Ae());return v?String(v.id):null}catch{return null}}async function C(){r(O,!0),r(ae,null),r(ie,null);try{const s=await le();if(!me)return;if(!s){r(ae,u.workspace_setupScriptAgent_noWorkspace_error(),!0),r(O,!1);return}const v=await vr.setupScripts.generate(s);if(!me)return;if(!v||!v.script){r(ae,u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1);return}r(ie,{name:v.projectType?u.workspace_setupScriptAgent_projectTypeSetup_label({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedSetup_label(),description:v.projectType?u.workspace_setupScriptAgent_generatedForProject_description({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedFromAnalysis_description(),content:v.script},!0),r(O,!1)}catch(s){if(at.error("Failed to generate setup script",s),!me)return;r(ae,s instanceof Error?s.message:u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1)}}function fe(s){Re()?.(s)}var ge={get repoPath(){return Ae()},set repoPath(s){Ae(s),G()},get onScriptGenerated(){return Re()},set onScriptGenerated(s){Re(s),G()},get onClose(){return Ge()},set onClose(s){Ge(s),G()},$set:Ft,$on:(s,v)=>Rt(P,s,v)},ce=yr(),xe=c(ce),be=c(xe),De=c(be);ur(De,{variant:"standard",get agentId(){return e(Me)}});var Le=n(De,2),je=S(Le,!0),he=n(Le,2);{var de=s=>{var v=xr();o(s,v)};W(he,s=>{e(O)&&s(de)})}l(be);var Y=n(be,2),ke=c(Y);{let s=z(()=>u.workspace_setupScriptAgent_close_ariaLabel());ye(ke,{variant:"ghost-light",size:"icon-sm",iconOnly:!0,get"aria-label"(){return e(s)},get onclick(){return Ge()},children:(v,E)=>{Te(v,{get icon(){return ir}})},$$slots:{default:!0}})}l(Y),l(xe);var $e=n(xe,2);{var Ie=s=>{var v=Sr(),E=c(v);{var q=B=>{var M=br(),Q=S(M,!0);g(()=>m(Q,e(ae))),o(B,M)},se=B=>{var M=hr(),Q=c(M);or(Q,{size:16,class:"text-primary"});var Se=n(Q,2),ze=S(Se,!0);l(M),g(we=>m(ze,we),[()=>u.workspace_setupScriptAgent_analyzing_label()]),o(B,M)};W(E,B=>{e(ae)?B(q):B(se,-1)})}l(v),o(s,v)};W($e,s=>{(e(ae)||e(O))&&s(Ie)})}var Je=n($e,2);{var pe=s=>{var v=wr(),E=c(v),q=c(E),se=c(q);Te(se,{get icon(){return lr},class:"text-green-500"});var B=n(se,2),M=S(B,!0);l(q);var Q=n(q,2);ye(Q,{variant:"primary",size:"sm",onclick:()=>fe(e(ie)),class:"h-7",children:(Pe,st)=>{Ve();var Ye=Be();g(ct=>m(Ye,ct),[()=>u.workspace_setupScriptAgent_createScript_label()]),o(Pe,Ye)},$$slots:{default:!0}}),l(E);var Se=n(E,2),ze=S(Se,!0),we=n(Se,2),lt=c(we);ht(lt,{get value(){return e(ie).content},language:"shell",readOnly:!0,lineNumbers:!1}),l(we),l(v),g(()=>{m(M,e(ie).name),m(ze,e(ie).description)}),o(s,v)};W(Je,s=>{e(ie)&&!e(O)&&s(pe)})}return l(ce),g(s=>m(je,s),[()=>u.workspace_setupScriptAgent_title()]),o(He,ce),Mt(ge)}var kr=b('<span class="block truncate"> </span>'),$r=b("<div></div>"),Pr=b('<div role="group"></div> <div class="mt-2 border-t border-border pt-2"><!></div> <!> <div class="mt-2 border-t border-border pt-2"><!> <!></div>',1),Cr=b('<code class="type-caption text-muted-foreground"> </code>'),Er=b('<p> </p> <code class="type-caption"> </code>',1),It=b("<!> <!>",1),Tr=b('<div class="mt-2 flex flex-wrap gap-2 px-2"></div>'),Ar=b('<div class="h-44 min-w-0 overflow-hidden rounded-(--radius-medium) border border-border bg-background py-2"><!></div> <div class="mt-2 px-1"><!> <!></div>',1),jr=b('<div class="mb-2 flex items-center justify-between gap-3 px-2"><div class="min-w-0"><h3> </h3> <p class="type-caption truncate text-muted-foreground"> </p></div> <!></div> <!>',1),Ke=b("<div><!></div>"),Ir=b("<!> ",1),Nt=b('<div class="min-w-0 w-full"><span class="text-sm"> </span> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Ut=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>'),Nr=b('<span class="type-caption px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium shrink-0"> </span>'),Ur=b('<div class="min-w-0 w-full"><div class="flex flex-wrap items-center gap-x-2 gap-y-1"><span class="text-sm"> </span> <!></div> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Or=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <p class="text-xs text-subtle px-2 mb-2"> </p> <!></div> <!> <!> <div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>',1),Fr=b('<code class="type-caption px-1.5 py-0.5 rounded bg-background/80 text-muted-foreground font-mono cursor-pointer hover:bg-background hover:text-foreground transition-colors"> </code>'),Rr=b('<p class="text-xs"> </p> <p class="mt-1 text-xs text-muted-foreground"> <code class="type-caption"> </code></p>',1),Gr=b('<div class="flex flex-wrap items-center gap-x-3 gap-y-1.5 px-3 py-1.5 bg-muted/30 shrink-0"><span class="type-caption font-medium text-muted-foreground shrink-0"> </span> <div class="flex flex-wrap gap-1.5"></div></div> <div class="flex-1 min-h-0 min-w-0 overflow-hidden py-3 bg-background"><!></div>',1),Mr=b('<div class="flex min-h-0 min-w-0 flex-col overflow-y-auto"><!></div> <div class="flex min-h-0 min-w-0 flex-col"><!></div>',1),Dr=b('<div class="flex flex-col min-h-0 min-w-0 overflow-y-auto p-2 md:pr-4"><!></div> <div class="flex flex-col min-w-0 min-h-0"><!></div>',1),Lr=b('<!> <span class="text-sm font-normal text-subtle"> </span> <span class="text-subtle font-normal"> </span>',1),zr=b('<div class="mt-1 pl-7 space-y-3"><!></div>'),Wr=b('<div class="space-y-3"><!></div>'),qr=b("<div><!> <!></div> <!>",1);function Kr(He,P){if(new.target)return Ot({component:Kr,...He});Gt(P,!0);const at=(t,a=sr)=>{{const y=_=>{Te(_,{get icon(){return bt},get class(){return _e.icon}})},j=_=>{var i=kr(),f=S(i,!0);g(()=>m(f,a().name)),o(_,i)},T=_=>{{let i=z(()=>e(st)===a().id?"checked":"empty");dr(_,{get state(){return e(i)}})}};let h=z(()=>e(st)===a().id),$=z(()=>e(st)===a().id);nt(t,{get selected(){return e(h)},get"aria-pressed"(){return e($)},get"data-setup-source"(){return a().id},get class(){return _e.row},onclick:()=>a().id==="custom"?Dt():we(a().id),leading:y,title:j,trailing:T,$$slots:{leading:!0,title:!0,trailing:!0}})}},Ae=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Pr(),_=U($);Xe(_,21,()=>e(Ye),I=>I.id,(I,F)=>{at(I,()=>e(F))}),l(_);var i=n(_,2),f=c(i);nt(f,{get"aria-expanded"(){return e($e)},get class(){return _e.row},onclick:()=>r($e,!e($e)),leading:w=>{Te(w,{get icon(){return cr},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptEditor_templates_label()]),o(w,d)},$$slots:{leading:!0,title:!0}}),l(i);var x=n(i,2);{var k=I=>{var F=$r();Xe(F,21,()=>e(ct),w=>w.id,(w,d)=>{at(w,()=>({id:`template-${e(d).id}`,name:e(d).name}))}),l(F),Oe(3,F,()=>Ze,()=>({tier:"moderate"})),o(I,F)};W(x,I=>{e($e)&&I(k)})}var D=n(x,2),ue=c(D);nt(ue,{get class(){return _e.row},onclick:()=>r(ke,!0),leading:w=>{Te(w,{get icon(){return bt},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptPicker_edit_label()]),o(w,d)},$$slots:{leading:!0,title:!0}});var ve=n(ue,2);{const I=d=>{Te(d,{get icon(){return Pt},get class(){return _e.icon}})},F=d=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(d,p)};let w=z(()=>!O());nt(ve,{get class(){return _e.row},get disabled(){return e(w)},onclick:()=>{r(ke,!0),r(Y,!0)},leading:I,title:F,$$slots:{leading:!0,title:!0}})}l(D),g(I=>nr(_,"aria-label",I),[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(h,$)},T=h=>{var $=jr(),_=U($),i=c(_),f=c(i),x=S(f,!0),k=n(f,2),D=S(k,!0);l(i);var ue=n(i,2);ye(ue,{variant:"ghost",size:"sm",onclick:()=>{r(ke,!1),r(Y,!1)},children:(w,d)=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptPicker_choose_label()]),o(w,p)},$$slots:{default:!0}}),l(_);var ve=n(_,2);{var I=w=>{St(w,{get repoPath(){return O()},onScriptGenerated:Lt,onClose:()=>r(Y,!1)})},F=w=>{var d=Ar(),p=U(d),N=c(p);xt(ht(N,{language:"shell",lineNumbers:!1,get lineWrapping(){return e(Se)},get value(){return C()},set value(A){C(A)}}),A=>r(pe,A,!0),()=>e(pe)),l(p);var X=n(p,2),H=c(X);ye(H,{variant:"ghost",size:"sm",get active(){return e(Ie)},get"aria-expanded"(){return e(Ie)},onclick:()=>r(Ie,!e(Ie)),children:(A,oe)=>{Ve();var L=Be();g(ee=>m(L,ee),[()=>u.workspace_setupScriptEditor_variables_label()]),o(A,L)},$$slots:{default:!0}});var V=n(H,2);{var Z=A=>{var oe=Ue(),L=U(oe);Ee(L,()=>At,(ee,te)=>{te(ee,{delayDuration:100,children:(ne,Ce)=>{var J=Tr();Xe(J,21,()=>jt,re=>re.name,(re,Ne)=>{var We=Ue(),pt=U(We);Ee(pt,()=>Ct,(Vt,Bt)=>{Bt(Vt,{children:(Ht,Vr)=>{var yt=It(),kt=U(yt);Ee(kt,()=>Et,(ut,vt)=>{vt(ut,{children:(_t,Yt)=>{var Qe=Cr(),ot=S(Qe);g(()=>m(ot,`$${e(Ne).name??""}`)),o(_t,Qe)},$$slots:{default:!0}})});var Jt=n(kt,2);Ee(Jt,()=>Tt,(ut,vt)=>{vt(ut,{side:"top",class:"max-w-xs",children:(_t,Yt)=>{var Qe=Er(),ot=U(Qe),Qt=S(ot,!0),Xt=n(ot,2),Zt=S(Xt,!0);g(()=>{m(Qt,e(Ne).description),m(Zt,e(Ne).example)}),o(_t,Qe)},$$slots:{default:!0}})}),o(Ht,yt)},$$slots:{default:!0}})}),o(re,We)}),l(J),o(ne,J)},$$slots:{default:!0}})}),o(A,oe)};W(V,A=>{e(Ie)&&A(Z)})}l(X),o(w,d)};W(ve,w=>{e(Y)&&O()?w(I):w(F,-1)})}g(w=>{Fe(f,1,gt(_e.title),"svelte-1yy464i"),m(x,w),m(D,e(ze))},[()=>u.workspace_setupScriptPicker_commands_label()]),o(h,$)};W(y,h=>{e(ke)?h(T,-1):h(j)})}l(a),xt(a,h=>r(Je,h),()=>e(Je)),g(()=>Fe(a,1,`${_e.rows} min-w-0`,"svelte-1yy464i")),o(t,a)},Re=t=>{var a=Or(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2),$=S(h,!0),_=n(h,2);{var i=d=>{var p=Ke(),N=c(p);St(N,{get repoPath(){return O()},onScriptGenerated:X=>{r(se,!0),r(s,""),C(X.content),r(E,X.name,!0),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())},onClose:()=>r(Y,!1)}),l(p),Oe(3,p,()=>Ze,()=>({tier:"moderate"})),o(d,p)},f=d=>{{let p=z(()=>!O());ye(d,{variant:"ghost",size:"sm",class:"w-full justify-start text-subtle",onclick:()=>r(Y,!0),get disabled(){return e(p)},children:(N,X)=>{var H=Ir(),V=U(H);Te(V,{get icon(){return Pt},class:"mr-1.5"});var Z=n(V);g(A=>m(Z,` ${A??""}`),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(N,H)},$$slots:{default:!0}})}};W(_,d=>{e(Y)&&O()?d(i):d(f,-1)})}l(y);var x=n(y,2);{var k=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===qe),Z=z(()=>e(s)===qe);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(qe),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(it,"repo-config"),()=>u.workspace_setupScriptEditor_repoConfig_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_repoConfig_label()]),o(d,p)};W(x,d=>{le()&&d(k)})}var D=n(x,2);{var ue=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===B),Z=z(()=>e(s)===B);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(B),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(e(M).name,e(M).nameSource),()=>u.workspace_setupScriptEditor_lastUsed_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_lastUsed_label()]),o(d,p)};W(D,d=>{e(M)&&d(ue)})}var ve=n(D,2),I=c(ve),F=S(I,!0),w=n(I,2);Xe(w,17,()=>et,d=>d.id,(d,p)=>{{let N=z(()=>e(s)===`template-${e(p).id}`),X=z(()=>e(s)===`template-${e(p).id}`);ye(d,{variant:"ghost",truncateLabel:!1,get active(){return e(N)},get"aria-pressed"(){return e(X)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(`template-${e(p).id}`),children:(H,V)=>{var Z=Ur(),A=c(Z),oe=c(A),L=S(oe,!0),ee=n(oe,2);{var te=J=>{var re=Nr(),Ne=S(re,!0);g(We=>m(Ne,We),[()=>u.workspace_setupScriptEditor_recommended_label()]),o(J,re)};W(ee,J=>{e(p).projectType===ie()&&J(te)})}l(A);var ne=n(A,2),Ce=S(ne,!0);l(Z),g(()=>{m(L,e(p).name),m(Ce,e(p).description)}),o(H,Z)},$$slots:{default:!0}})}}),l(ve),g((d,p,N)=>{m(T,d),m($,p),m(F,N)},[()=>u.workspace_setupScriptEditor_generate_label(),()=>u.workspace_setupScriptEditor_generate_description(),()=>u.workspace_setupScriptEditor_templates_label()]),o(t,a)},Ge=t=>{var a=Gr(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2);Xe(h,21,()=>jt,i=>i.name,(i,f)=>{var x=Ue(),k=U(x);Ee(k,()=>At,(D,ue)=>{ue(D,{delayDuration:100,children:(ve,I)=>{var F=Ue(),w=U(F);Ee(w,()=>Ct,(d,p)=>{p(d,{delayDuration:100,children:(N,X)=>{var H=It(),V=U(H);Ee(V,()=>Et,(A,oe)=>{oe(A,{children:(L,ee)=>{var te=Fr(),ne=S(te);g(()=>m(ne,`$${e(f).name??""}`)),o(L,te)},$$slots:{default:!0}})});var Z=n(V,2);Ee(Z,()=>Tt,(A,oe)=>{oe(A,{side:"bottom",class:"max-w-xs z-[200]",children:(L,ee)=>{var te=Rr(),ne=U(te),Ce=S(ne,!0),J=n(ne,2),re=c(J),Ne=n(re),We=S(Ne,!0);l(J),g(pt=>{m(Ce,e(f).description),m(re,`${pt??""} `),m(We,e(f).example)},[()=>u.workspace_setupScriptEditor_example_before()]),o(L,te)},$$slots:{default:!0}})}),o(N,H)},$$slots:{default:!0}})}),o(ve,F)},$$slots:{default:!0}})}),o(i,x)}),l(h),l(y);var $=n(y,2),_=c($);xt(ht(_,{language:"shell",lineNumbers:!0,get lineWrapping(){return e(Se)},get value(){return C()},set value(i){C(i)}}),i=>r(pe,i,!0),()=>e(pe)),l($),g(i=>m(T,i),[()=>u.workspace_setupScriptEditor_variables_label()]),ar("keydown",$,i=>{i.altKey&&i.key==="z"&&(i.preventDefault(),r(Se,!e(Se)))}),o(t,a)},Me=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Mr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),Oe(1,_,()=>$t,()=>({tier:"moderate",axis:"x",distance:-8})),Oe(1,f,()=>$t,()=>({tier:"moderate",axis:"x"})),o(h,$)},T=h=>{var $=Dr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),o(h,$)};W(y,h=>{he()==="workspace"?h(j):h(T,-1)})}l(a),g(()=>Fe(a,1,gt(he()==="workspace"?"setup-workspace-layout":"grid flex-1 min-h-0 min-w-0 grid-cols-1 grid-rows-[minmax(0,1fr)_minmax(0,2fr)] md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] md:grid-rows-1"),"svelte-1yy464i")),o(t,a)};let O=R(P,"repoPath",7,""),ae=R(P,"repositoryKey",7),me=R(P,"githubUrl",7,null),ie=R(P,"projectType",7,void 0),le=R(P,"repoConfigScript",7,null),C=R(P,"value",15,""),fe=R(P,"expanded",15,!1),ge=R(P,"scriptName",31,()=>rt(u.workspace_setupScriptEditor_custom_name())),ce=R(P,"scriptNameSource",15,"named"),xe=R(P,"isCustomScript",15,!1),be=R(P,"compact",7,!1),De=R(P,"triggerClass",7,""),Le=R(P,"contentOnly",7,!1),je=R(P,"contentClass",7,""),he=R(P,"presentation",7,"editor"),de=R(P,"onchange",7),Y=K(!1),ke=K(rt(mt(()=>xe()))),$e=K(!1),Ie=K(!1),Je=K(void 0),pe=K(void 0),s=K(""),v=K(!1),E=K(rt(ge())),q=K(rt(ce())),se=K(!1);const B="last-used",M=z(()=>{const t=ae()??O(),a=t?gr(t,me()):void 0;return a?.nameSource==="repo-config"?{...a,name:"Custom",nameSource:"custom"}:a}),Q=z(()=>{const t=new Map;return le()&&t.set(qe,{content:le(),label:it,source:"repo-config"}),e(M)&&t.set(B,{content:e(M).content,label:e(M).name,source:e(M).nameSource}),et.forEach(a=>{t.set(`template-${a.id}`,{content:fr(a),label:a.name,source:"named"})}),t});let Se=K(!0);const ze=z(()=>{if(e(v))return tt(e(E),e(q));if(!e(s))return u.workspace_setupScriptEditor_custom_name();const t=e(Q).get(e(s));return t?tt(t.label,t.source):u.workspace_setupScriptEditor_custom_name()});function we(t){r(s,t,!0),r(v,!1),r(se,!0);const a=e(Q).get(t);a&&(C(a.content),r(E,a.label,!0),r(q,a.source,!0),de()?.(C())),he()==="picker"?(r(ke,!1),r($e,!1),requestAnimationFrame(()=>e(Je)?.querySelector("[data-setup-source][aria-pressed=true]")?.focus())):requestAnimationFrame(()=>e(pe)?.focus())}function lt(t){if(e(s)&&e(s)!=="none"){const a=e(Q).get(e(s));a&&r(v,t!==a.content)}else t&&r(v,!0)}const Pe=(()=>{const t=et.find(a=>a.id==="generic");return t?`template-${t.id}`:""})(),st=z(()=>e(v)||!e(s)?"custom":e(s)),Ye=z(()=>{const t=[];le()&&t.push({id:qe,name:tt(it,"repo-config")}),e(M)&&t.push({id:B,name:u.workspace_setupScriptEditor_lastUsed_label()});for(const a of et){const y=`template-${a.id}`;(y===Pe||y===e(s))&&t.push({id:y,name:a.name})}return t.push({id:"custom",name:u.workspace_setupScriptPicker_custom_label()}),t}),ct=z(()=>et.filter(t=>!e(Ye).some(a=>a.id===`template-${t.id}`)));function Dt(){r(s,""),r(v,!0),r(E,"Custom"),r(q,"custom"),r(Y,!1),r(ke,!0),requestAnimationFrame(()=>e(pe)?.focus())}function Lt(t){r(se,!0),r(s,""),C(t.content),r(E,t.name,!0),r(q,"named"),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())}let dt=K(null);ft(()=>{const t=ae()??O();if(t===e(dt))return;const a=e(dt)===null&&(xe()||C().trim().length>0);if(r(dt,t,!0),a){mt(()=>{let T=!1;const h=C().trim();for(const[$,_]of e(Q).entries())if(h===_.content.trim()&&_.source===ce()&&_.label===ge()){r(s,$,!0),r(E,_.label,!0),r(q,_.source,!0),r(v,!1),T=!0;break}T||(r(v,!0),e(E)||(r(E,ge()||u.workspace_setupScriptEditor_custom_name(),!0),r(q,ge()?ce():"named",!0))),r(se,!0)});return}const y=!!le(),j=e(M);if(mt(()=>{if(r(v,!1),r(se,!0),y)r(s,qe,!0),r(E,it,!0),r(q,"repo-config");else if(j)r(s,B),r(E,j.name,!0),r(q,j.nameSource,!0);else if(Pe){r(s,Pe,!0);const T=e(Q).get(Pe);r(E,T?.label||u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}else r(E,u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}),y&&le())C(le()),de()?.(C());else if(j)C(j.content),de()?.(C());else if(Pe){const T=e(Q).get(Pe);T&&(C(T.content),de()?.(C()))}}),ft(()=>{if(e(se)){r(se,!1);return}C()!==void 0&&lt(C())}),ft(()=>{ge(e(E)),ce(e(q)),xe(e(v))});var zt={get repoPath(){return O()},set repoPath(t=""){O(t),G()},get repositoryKey(){return ae()},set repositoryKey(t){ae(t),G()},get githubUrl(){return me()},set githubUrl(t=null){me(t),G()},get projectType(){return ie()},set projectType(t=void 0){ie(t),G()},get repoConfigScript(){return le()},set repoConfigScript(t=null){le(t),G()},get value(){return C()},set value(t=""){C(t),G()},get expanded(){return fe()},set expanded(t=!1){fe(t),G()},get scriptName(){return ge()},set scriptName(t=u.workspace_setupScriptEditor_custom_name()){ge(t),G()},get scriptNameSource(){return ce()},set scriptNameSource(t="named"){ce(t),G()},get isCustomScript(){return xe()},set isCustomScript(t=!1){xe(t),G()},get compact(){return be()},set compact(t=!1){be(t),G()},get triggerClass(){return De()},set triggerClass(t=""){De(t),G()},get contentOnly(){return Le()},set contentOnly(t=!1){Le(t),G()},get contentClass(){return je()},set contentClass(t=""){je(t),G()},get presentation(){return he()},set presentation(t="editor"){he(t),G()},get onchange(){return de()},set onchange(t){de(t),G()},$set:Ft,$on:(t,a)=>Rt(P,t,a)},wt=Ue(),Wt=U(wt);{var qt=t=>{var a=Ue(),y=U(a);{var j=T=>{var h=Ue(),$=U(h);{var _=x=>{var k=Ke(),D=c(k);Ae(D),l(k),g(()=>Fe(k,1,`${je()??""} min-w-0`,"svelte-1yy464i")),o(x,k)},i=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex min-h-0 min-w-0 flex-1 flex-col`,"svelte-1yy464i")),o(x,k)},f=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex flex-col gap-3 flex-1 min-h-0 min-w-0`,"svelte-1yy464i")),Oe(3,k,()=>Ze,()=>({tier:"moderate"})),o(x,k)};W($,x=>{he()==="picker"?x(_):he()==="workspace"?x(i,1):x(f,-1)})}o(T,h)};W(y,T=>{fe()&&T(j)})}o(t,a)},Kt=t=>{var a=qr(),y=U(a),j=c(y);ye(j,{variant:"ghost",size:"sm",get class(){return`whitespace-nowrap hover:text-inherit! ${De()??""}`},onclick:()=>fe(!fe()),children:(i,f)=>{var x=Lr(),k=U(x);Te(k,{get icon(){return bt},size:"xs"});var D=n(k,2),ue=S(D,!0),ve=n(D,2),I=S(ve,!0);g(F=>{m(ue,F),m(I,e(ze))},[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(i,x)},$$slots:{default:!0}});var T=n(j,2);{var h=i=>{var f=zr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W(T,i=>{fe()&&!be()&&i(h)})}l(y);var $=n(y,2);{var _=i=>{var f=Wr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W($,i=>{fe()&&be()&&i(_)})}g(()=>Fe(y,1,gt(be()?"":"w-full"))),o(t,a)};W(Wt,t=>{Le()?t(qt):t(Kt,-1)})}return o(He,wt),Mt(zt)}rr(["keydown"]);export{Kr as default};
@@ -1 +1 @@
1
- import{JH as s,ij as a,mm as S,nZ as f,mz as m}from"./B9vHutcJ.js";import{u as O}from"./BF_gPEg7.js";import{dP as d,b5 as b,dX as k}from"./C2UL5Ler.js";const v=s.createSelector((t,e)=>{if(b.select(t,e)&&k.select(t,e))return!1;const r=t.principal?.snapshot;return r?.capabilities.workspaceGuestRoles===!0&&(r.capabilities.hostMembership?r.principal.hostRole==="guest":!r.principal.isAdministrator)}),h=s.createSelector(t=>t.principal?.snapshot?.capabilities.remoteScripts===1),l=s.createSelector((t,e,r)=>!v.select(t,e)||!!d.select(t,e)&&r?.purpose==="saved");function o(t,e,r){return!!e&&!!r&&l.select(t,e,r)}function i(t,e){return e?t.scripts.byWorkspaceId[e]??m:m}const j=s.createSelector((t,e)=>i(t,e).initialized),W=s.createSelector((t,e)=>{const r=i(t,e);return r.activeScriptIds?r.activeScriptIds.flatMap(c=>o(t,e,r.scripts[c])?[r.scripts[c]]:[]):Object.values(r.scripts).filter(c=>!c.archivedAt&&o(t,e,c))}),C=s.createSelector((t,e)=>W.select(t,e).filter(r=>O((r.runtime??a()).status))),u=s.createSelector((t,e,r)=>{const c=i(t,e);return o(t,e,c.scripts[r])?c.scripts[r]:null}),x=s.createSelector((t,e,r)=>u.select(t,e,r)?.runtime??a()),z=s.createSelector((t,e,r)=>{const c=i(t,e);return l.select(t,e??"",c.scripts[r])?c.outputBuffers[r]??S:S}),E=s.createSelector((t,e,r,c)=>{const n=i(t,e).retainedOutputs?.[c];return n?.scriptId===r&&l.select(t,e,i(t,e).scripts[r])?n:void 0}),M=s.createSelector(t=>Object.entries(t.scripts?.byWorkspaceId??{}).filter(([,e])=>Object.keys(e.retainedOutputs??{}).length>0).map(([e])=>e).sort()),A=s.createSelector((t,e)=>!!t.scripts?.byWorkspaceId[e]?.outputStreamReady),D=s.createSelector((t,e)=>i(t,e).initialized),B=s.createSelector((t,e)=>{const r=i(t,e);return r.activeScriptIds?r.activeScriptIds.flatMap(c=>o(t,e,r.scripts[c])?[r.scripts[c]]:[]):Object.values(r.scripts).filter(c=>!c.archivedAt&&o(t,e,c))}),G=s.createSelector((t,e)=>{const r=i(t,e);return r.detectionOperation?.pending?{...r.operations,...Object.fromEntries(Object.keys(r.scripts).map(c=>[c,r.detectionOperation]))}:r.operations}),P=s.createSelector((t,e)=>i(t,e).detectionOperation),J=s.createSelector((t,e,r,c)=>{const n=i(t,r).workflowOutcomes,p=n?f(n,e):void 0;return p?.workspaceId===r&&p.resourceId===c?p:void 0}),L=s.createSelector((t,e,r)=>u.select(t,e,r)?.runtime??a()),H=s.createSelector((t,e)=>Object.values(i(t,e).scripts).filter(r=>o(t,e,r))),U=s.createSelector((t,e,r)=>i(t,e).pendingReads?.[r]),V=s.createSelector((t,e,r)=>!!u.select(t,e,r)&&!i(t,e).detectionOperation?.pending&&!i(t,e).operations[r]?.pending),X=s.createSelector((t,e)=>({nextCursor:i(t,e).nextCursor,loading:i(t,e).loading,error:i(t,e).loadError}));export{H as selectAllWorkspaceScriptEntries,V as selectCanDeleteScript,l as selectCanReadScriptDefinition,h as selectRemoteScriptsSupported,C as selectRunningScripts,u as selectScriptById,P as selectScriptDetectionOperation,W as selectScriptEntries,X as selectScriptListPageState,z as selectScriptOutput,A as selectScriptOutputStreamReady,M as selectScriptOutputViewerWorkspaceIds,U as selectScriptReadJournal,E as selectScriptRetainedOutput,x as selectScriptRuntime,J as selectScriptWorkflowOutcome,j as selectScriptsInitialized,v as selectUsesGuestScriptScope,B as selectWorkspaceScriptEntries,G as selectWorkspaceScriptOperations,L as selectWorkspaceScriptRuntime,D as selectWorkspaceScriptsInitialized};
1
+ import{JH as s,ij as a,mm as S,nZ as f,mz as m}from"./B9vHutcJ.js";import{u as O}from"./BwA1d-u1.js";import{dP as d,b5 as b,dX as k}from"./C2UL5Ler.js";const v=s.createSelector((t,e)=>{if(b.select(t,e)&&k.select(t,e))return!1;const r=t.principal?.snapshot;return r?.capabilities.workspaceGuestRoles===!0&&(r.capabilities.hostMembership?r.principal.hostRole==="guest":!r.principal.isAdministrator)}),h=s.createSelector(t=>t.principal?.snapshot?.capabilities.remoteScripts===1),l=s.createSelector((t,e,r)=>!v.select(t,e)||!!d.select(t,e)&&r?.purpose==="saved");function o(t,e,r){return!!e&&!!r&&l.select(t,e,r)}function i(t,e){return e?t.scripts.byWorkspaceId[e]??m:m}const j=s.createSelector((t,e)=>i(t,e).initialized),W=s.createSelector((t,e)=>{const r=i(t,e);return r.activeScriptIds?r.activeScriptIds.flatMap(c=>o(t,e,r.scripts[c])?[r.scripts[c]]:[]):Object.values(r.scripts).filter(c=>!c.archivedAt&&o(t,e,c))}),C=s.createSelector((t,e)=>W.select(t,e).filter(r=>O((r.runtime??a()).status))),u=s.createSelector((t,e,r)=>{const c=i(t,e);return o(t,e,c.scripts[r])?c.scripts[r]:null}),x=s.createSelector((t,e,r)=>u.select(t,e,r)?.runtime??a()),z=s.createSelector((t,e,r)=>{const c=i(t,e);return l.select(t,e??"",c.scripts[r])?c.outputBuffers[r]??S:S}),E=s.createSelector((t,e,r,c)=>{const n=i(t,e).retainedOutputs?.[c];return n?.scriptId===r&&l.select(t,e,i(t,e).scripts[r])?n:void 0}),M=s.createSelector(t=>Object.entries(t.scripts?.byWorkspaceId??{}).filter(([,e])=>Object.keys(e.retainedOutputs??{}).length>0).map(([e])=>e).sort()),A=s.createSelector((t,e)=>!!t.scripts?.byWorkspaceId[e]?.outputStreamReady),D=s.createSelector((t,e)=>i(t,e).initialized),B=s.createSelector((t,e)=>{const r=i(t,e);return r.activeScriptIds?r.activeScriptIds.flatMap(c=>o(t,e,r.scripts[c])?[r.scripts[c]]:[]):Object.values(r.scripts).filter(c=>!c.archivedAt&&o(t,e,c))}),G=s.createSelector((t,e)=>{const r=i(t,e);return r.detectionOperation?.pending?{...r.operations,...Object.fromEntries(Object.keys(r.scripts).map(c=>[c,r.detectionOperation]))}:r.operations}),P=s.createSelector((t,e)=>i(t,e).detectionOperation),J=s.createSelector((t,e,r,c)=>{const n=i(t,r).workflowOutcomes,p=n?f(n,e):void 0;return p?.workspaceId===r&&p.resourceId===c?p:void 0}),L=s.createSelector((t,e,r)=>u.select(t,e,r)?.runtime??a()),H=s.createSelector((t,e)=>Object.values(i(t,e).scripts).filter(r=>o(t,e,r))),U=s.createSelector((t,e,r)=>i(t,e).pendingReads?.[r]),V=s.createSelector((t,e,r)=>!!u.select(t,e,r)&&!i(t,e).detectionOperation?.pending&&!i(t,e).operations[r]?.pending),X=s.createSelector((t,e)=>({nextCursor:i(t,e).nextCursor,loading:i(t,e).loading,error:i(t,e).loadError}));export{H as selectAllWorkspaceScriptEntries,V as selectCanDeleteScript,l as selectCanReadScriptDefinition,h as selectRemoteScriptsSupported,C as selectRunningScripts,u as selectScriptById,P as selectScriptDetectionOperation,W as selectScriptEntries,X as selectScriptListPageState,z as selectScriptOutput,A as selectScriptOutputStreamReady,M as selectScriptOutputViewerWorkspaceIds,U as selectScriptReadJournal,E as selectScriptRetainedOutput,x as selectScriptRuntime,J as selectScriptWorkflowOutcome,j as selectScriptsInitialized,v as selectUsesGuestScriptScope,B as selectWorkspaceScriptEntries,G as selectWorkspaceScriptOperations,L as selectWorkspaceScriptRuntime,D as selectWorkspaceScriptsInitialized};
@@ -1 +1 @@
1
- var Vt=Object.defineProperty;var yt=e=>{throw TypeError(e)};var jt=(e,i,s)=>i in e?Vt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s;var J=(e,i,s)=>jt(e,typeof i!="symbol"?i+"":i,s),bt=(e,i,s)=>i.has(e)||yt("Cannot "+s);var t=(e,i,s)=>(bt(e,i,"read from private field"),s?s.call(e):i.get(e)),g=(e,i,s)=>i.has(e)?yt("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,s),a=(e,i,s,n)=>(bt(e,i,"write to private field"),n?n.call(e,s):i.set(e,s),s),o=(e,i,s)=>(bt(e,i,"access private method"),s);var vt=(e,i,s,n)=>({set _(r){a(e,i,r,s)},get _(){return t(e,i,n)}});import{_ as wt}from"./CLAmm_T1.js";import{m as xt,A as qt,r as Ht,Q as Nt,aX as Gt,R as Jt}from"./DIPIWs2Q.js";import{B as Ft,D as Kt}from"./iIsyEXfi.js";import{I as F,E as Ct,b as Qt,a as Ut}from"./DICr2Lvd.js";function Xt(e,i){for(const s of Array.isArray(e)?e:[e]){let n=xt.get(s.name);n==null&&(n=s,xt.set(s.name,n)),i.attachLanguages([n]),qt.add(n.name)}}function Zt(e,i){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>e.apply(this,n),i)}}const Dt=0;let Wt=0;var H,T,P,Q,L,st,it,C,U,nt,u,D,_,A,O,b,v,z,dt,E,B,X,N,R,Z,Tt,ft,h,K,ut,zt,Et,Y,pt,It,ct,tt,Ot,gt,et,Bt,Pt,At,Yt=(At=class{constructor(e,i,s){g(this,h);J(this,"backend");g(this,H);g(this,T);g(this,P);g(this,Q);g(this,L);g(this,st);g(this,it);g(this,C);g(this,U);g(this,nt,!1);g(this,u,[F]);g(this,D,[]);g(this,_,0);g(this,A,[]);g(this,O,-1);g(this,b,!0);g(this,v,!1);g(this,z,0);g(this,dt,++Wt);g(this,E,-1);g(this,B,-1);g(this,X);g(this,N,0);g(this,R,[]);g(this,Z,!1);g(this,Tt,Zt(async e=>{if(t(this,nt))return;const{startingLine:i=0,totalLines:s=1/0}=e??{},n=Math.min(s===1/0?1/0:i+s,t(this,L).lineCount);if(t(this,T)==null&&!Lt(t(this,L).languageId)){if(await this.backend?.loadLanguages([t(this,L).languageId]),t(this,nt))return;a(this,T,t(this,H).getLanguage(t(this,L).languageId))}o(this,h,K).call(this),o(this,h,It).call(this,n)},500));g(this,ft,({data:e})=>{if(typeof e!="object"||e===null)return;const{type:i,tokenizerId:s,jobId:n}=e;i==="tokenize"&&s===t(this,dt)&&typeof n=="number"&&n===t(this,z)&&(t(this,E)>=0?o(this,h,Bt).call(this,n):o(this,h,Pt).call(this,n))});this.backend=s,a(this,H,e),a(this,L,i.textDocument),a(this,P,i.theme),a(this,Q,[]),a(this,st,i.tokenizeMaxLineLength??1e3),a(this,it,i.onDeferTokenize),a(this,C,i.matchBrackets!==!1),a(this,U,i.__debug??!1),o(this,h,ut).call(this),o(this,h,K).call(this)}getStringCommentRegexpRangesInLine(e){if(!t(this,C)||e<0||e>=t(this,L).lineCount||(o(this,h,ut).call(this),t(this,T)==null))return null;if(t(this,R)[e]===void 0){o(this,h,et).call(this,e);const i=t(this,u)[e]??F,s=o(this,h,ct).call(this,e,i);t(this,u)[e+1]=s.state}return t(this,R)[e]??null}setTheme(e){t(this,P)!==e&&(a(this,P,e),o(this,h,K).call(this),this.stopBackgroundTokenize(),a(this,u,[F]),a(this,D,[]),a(this,_,0),a(this,A,[]),t(this,T)!=null&&t(this,L).lineCount>0&&o(this,h,pt).call(this,0))}dispose(){a(this,nt,!0),this.stopBackgroundTokenize(),o(this,h,Et).call(this)}tokenize(e,i,s=!1){if(o(this,h,ut).call(this),o(this,h,K).call(this),t(this,T)==null&&!Lt(t(this,L).languageId))throw new Error(`Grammar for language "${t(this,L).languageId}" not loaded`);const{lineCount:n}=t(this,L),{startingLine:r=0,totalLines:l=1/0}=i??{},d=l===1/0?n:Math.min(r+l,n),c=e.startLine,f=Math.max(r,c),I=i!=null&&l!==1/0&&e.lineDelta>0&&c<d&&e.endLine>=d,m=e.lineDelta===0&&(e.changedLineChanges?.every(([,,p])=>p===0)??!0);t(this,C)&&!m&&(t(this,R).length=Math.min(t(this,R).length,e.startLine));const M=s&&e.lineDelta!==0&&c>=r,S=m||i==null||c>=f,y=e.changedLineRanges??[[c,e.endLine]];a(this,D,[]),a(this,_,0),a(this,A,[]);let V=-1;if(c<f)for(const[p,w]of y)p<f&&(V=Math.max(V,Math.min(w,f-1)));const mt=V>=c&&(m||e.lineDelta<0);m?o(this,h,et).call(this,c):(o(this,h,Ot).call(this,e),(i==null||c>=f)&&o(this,h,et).call(this,f));let j=0,St=y[j][1],ht,Rt=0,k=m?y[j][0]:f,rt=!1;const Mt=new Map,W=mt?new Map:void 0;if(W!=null&&!m){const p=Math.min(V+1,f,d);if(p>c){o(this,h,et).call(this,p);let w=c,ot=t(this,u)[w]??F;for(;w<p;w++){const x=o(this,h,ct).call(this,w,ot);ot=x.state,W.set(w,x.resolvedTokens)}t(this,u)[p]=ot}}let q=t(this,u)[k]??F;for(;k<d;){const p=m?t(this,u)[k+1]:M?o(this,h,gt).call(this,k+1):void 0;S&&(t(this,u)[k]=q);const{resolvedTokens:w,state:ot}=o(this,h,ct).call(this,k,q);if(q=ot,k>=f?Mt.set(k,w):W?.set(k,w),S&&(t(this,u)[k+1]=q),rt=k>=St&&(m||M)&&p!=null&&q.equals(p),rt){j++;const x=y[j];if(x==null)break;if(x[0]>=d){ht=x[0],Rt=j;break}let lt=t(this,u)[x[0]];if(M)for(let kt=k+2;kt<=x[0]&&(lt=o(this,h,gt).call(this,kt),lt!=null);kt++)t(this,u)[kt]=lt;lt==null?(St=x[1],k++):(k=x[0],q=lt,St=x[1]),rt=!1;continue}k++}if(S&&(k<d?t(this,u)[k+1]=q:t(this,u)[k]=q),rt&&M&&ht==null){for(let p=k+2;p<=n;p++){const w=o(this,h,gt).call(this,p);if(w==null)break;t(this,u)[p]=w}a(this,D,[]),a(this,_,0),a(this,A,[])}if(W!=null&&W.size>0&&t(this,it).call(this,W),ht!=null)t(this,C)&&m&&(t(this,R).length=Math.min(t(this,R).length,ht)),o(this,h,pt).call(this,ht,y,Rt);else if(!rt&&k<n){const p=I&&c>=f?d:c<f&&!m?c:k;t(this,C)&&m&&(t(this,R).length=Math.min(t(this,R).length,p)),o(this,h,pt).call(this,p,y,j)}return Mt}prebuildStateStack(e){o(this,h,ut).call(this),t(this,Tt).call(this,e)}stopBackgroundTokenize(){a(this,B,-1),!t(this,b)&&(a(this,b,!0),a(this,v,!1),a(this,O,-1),a(this,E,-1),a(this,X,void 0),a(this,N,0),a(this,D,[]),a(this,_,0),a(this,A,[]),o(this,h,Et).call(this))}pauseBackgroundTokenize(){t(this,b)||t(this,v)||(t(this,U)&&console.log("[diffs/editor] background tokenization paused",{jobId:t(this,z)}),a(this,v,!0))}resumeBackgroundTokenize(){t(this,b)||!t(this,v)||t(this,T)==null||t(this,O)<0||(t(this,U)&&console.log("[diffs/editor] background tokenization resumed",{jobId:t(this,z)}),a(this,v,!1),o(this,h,Y).call(this,t(this,z)))}},H=new WeakMap,T=new WeakMap,P=new WeakMap,Q=new WeakMap,L=new WeakMap,st=new WeakMap,it=new WeakMap,C=new WeakMap,U=new WeakMap,nt=new WeakMap,u=new WeakMap,D=new WeakMap,_=new WeakMap,A=new WeakMap,O=new WeakMap,b=new WeakMap,v=new WeakMap,z=new WeakMap,dt=new WeakMap,E=new WeakMap,B=new WeakMap,X=new WeakMap,N=new WeakMap,R=new WeakMap,Z=new WeakMap,Tt=new WeakMap,ft=new WeakMap,h=new WeakSet,K=function(){if(t(this,P)==="")return;this.backend?.getTheme(t(this,P));const{colorMap:e}=t(this,H).setTheme(t(this,P));a(this,Q,e)},ut=function(){t(this,T)==null&&!Lt(t(this,L).languageId)&&t(this,H).getLoadedLanguages().includes(t(this,L).languageId)&&a(this,T,t(this,H).getLanguage(t(this,L).languageId))},zt=function(){t(this,Z)||(globalThis.addEventListener("message",t(this,ft)),a(this,Z,!0))},Et=function(){t(this,Z)&&(globalThis.removeEventListener("message",t(this,ft)),a(this,Z,!1))},Y=function(e){globalThis.postMessage({type:"tokenize",tokenizerId:t(this,dt),jobId:e})},pt=function(e,i,s=0){if(Lt(t(this,L).languageId))return;const n=++vt(this,z)._;t(this,U)&&console.log("[diffs/editor] background tokenization scheduled",{jobId:n,startLine:e,changedLineRanges:i,changedRangeIndex:s}),a(this,b,!1),a(this,v,!1),a(this,O,e),t(this,E)>=0&&a(this,B,Math.max(t(this,B),t(this,E))),a(this,E,-1),a(this,X,i),a(this,N,s),o(this,h,zt).call(this),o(this,h,Y).call(this,n)},It=function(e){if(t(this,T)==null||t(this,u).length>e)return;if(!t(this,b)){t(this,E)>=0?a(this,E,Math.max(t(this,E),e)):a(this,B,Math.max(t(this,B),e));return}const i=++vt(this,z)._;a(this,b,!1),a(this,v,!1),a(this,O,t(this,u).length-1),a(this,E,e),a(this,B,-1),a(this,X,void 0),a(this,N,0),o(this,h,zt).call(this),o(this,h,Y).call(this,i)},ct=function(e,i){const s=t(this,L).getLineText(e);if(s.length>=t(this,st))return console.warn(`[diffs] Line(${e}) too long to tokenize: ${s.length}`),o(this,h,tt).call(this,e,null),{resolvedTokens:[[0,"",s]],state:i};if(t(this,T)==null||s===""||s.trim()==="")return o(this,h,tt).call(this,e,null),{resolvedTokens:[[0,"",s]],state:i};const n=_t(t(this,T),t(this,Q),s,i,Dt,t(this,C));return o(this,h,tt).call(this,e,n.bracketIgnoredRanges),{resolvedTokens:n.resolvedTokens,state:n.ruleStack}},tt=function(e,i){t(this,C)&&(t(this,R)[e]=i)},Ot=function(e){const i=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],s=e.startLine+1;s<=t(this,u).length-s?(a(this,D,t(this,u)),a(this,_,0),a(this,u,t(this,u).slice(0,s))):(a(this,_,s),a(this,D,t(this,u).slice(s)),t(this,u).length=Math.min(t(this,u).length,s)),a(this,A,i)},gt=function(e){let i=e;for(let s=t(this,A).length-1;s>=0;s--){const[n,r,l]=t(this,A)[s];if(l!==0){if(i>r)i-=l;else if(i>n)return t(this,u)[e]}}return t(this,D)[i-t(this,_)]??t(this,u)[e]},et=function(e,i){const s=Math.min(Math.max(0,e),t(this,L).lineCount);if(t(this,u).length>s||t(this,T)==null)return!0;const n=i==null?0:performance.now();let r=t(this,u).length-1,l=t(this,u)[r]??F;for(;r<s;){t(this,u)[r]=l;const d=t(this,L).getLineText(r);if(d.length<t(this,st)&&d!==""&&d.trim()!==""){const c=_t(t(this,T),t(this,Q),d,l,Dt,t(this,C),!1);o(this,h,tt).call(this,r,c.bracketIgnoredRanges),l=c.ruleStack}else o(this,h,tt).call(this,r,null);if(r++,t(this,u)[r]=l,i!=null&&performance.now()-n>i)break}return r>=s},Bt=function(e){if(t(this,b)||t(this,v)||t(this,T)==null||e!==t(this,z))return;o(this,h,K).call(this);const i=o(this,h,et).call(this,t(this,E),1);if(!(t(this,b)||t(this,v)||e!==t(this,z))){if(i){this.stopBackgroundTokenize();return}a(this,O,t(this,u).length-1),o(this,h,Y).call(this,e)}},Pt=function(e){if(t(this,b)||t(this,v)||t(this,T)==null||e!==t(this,z))return;o(this,h,K).call(this);const i=performance.now(),s=new Map,n=t(this,L).lineCount,r=t(this,X);let l=t(this,O),d=t(this,u)[l]??F,c=!1,f=t(this,N),I=r?.[f]?.[1];for(;l<n;){t(this,u)[l]=d;const m=I!=null?o(this,h,gt).call(this,l+1):void 0,M=o(this,h,ct).call(this,l,d);if(s.set(l,M.resolvedTokens),d=M.state,t(this,u)[l+1]=d,c=I!=null&&l>=I&&m!=null&&d.equals(m),l++,c){f++;const S=r?.[f];if(S==null)break;if(I=S[1],t(this,u)[S[0]]==null)c=!1;else{l=S[0],d=t(this,u)[l]??d,c=!1;continue}}if(performance.now()-i>1)break}if(t(this,it).call(this,s),!(t(this,b)||t(this,v)||e!==t(this,z))){if(c||l>=n){const m=t(this,B);this.stopBackgroundTokenize(),m>=0&&o(this,h,It).call(this,m);return}a(this,O,l),a(this,N,f),o(this,h,Y).call(this,e)}},At);function _t(e,i,s,n,r,l=!0,d=!0){const c=e.tokenizeLine2(s,n,r);c.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${s.substring(0,100)}`);const f=c.tokens,I=f.length/2,m=[],M=[];if(!d&&!l)return{ruleStack:c.ruleStack,resolvedTokens:m,bracketIgnoredRanges:M};for(let S=0;S<I;S++){const y=f[2*S],V=S+1<I?f[2*S+2]:s.length;if(y===V)continue;const mt=f[2*S+1];if(d){const j=Ct.getForeground(mt);m.push([y,i[j],s.slice(y,V)])}l&&Ct.getTokenType(mt)>0&&M.push([y,V])}return{ruleStack:c.ruleStack,resolvedTokens:m,bracketIgnoredRanges:M}}function Lt(e){return e==="text"||e==="ansi"}var $,G,at,te=(at=class extends Ft{constructor(s,n){super();J(this,"highlighter");J(this,"options");g(this,$,"");g(this,G);this.highlighter=s,this.options=n}tokenizeChunk(s,n){const r=(t(this,$)+s).split(/(\r\n|\r|\n)/);let l=[];for(let d=0;d<r.length;d+=2){const c=r[d],f=this.highlighter.codeToTokens(c,{...this.options,grammarState:t(this,G)}),I=f.tokens[0].map(m=>({...m,offset:m.offset+this.stableOffset}));d+1<r.length?(Ht(n,I),this.pushLineBreak(n,c.length,r[d+1]),a(this,G,f.grammarState)):(l=I,a(this,$,c))}return{unstable:l,tailLength:t(this,$).length}}clone(){this.assertActive();const s=new at(this.highlighter,this.options);return this.copyStateTo(s),a(s,$,t(this,$)),a(s,G,t(this,G)),s}resetSource(){a(this,$,""),a(this,G,void 0)}releaseSource(){this.resetSource()}},$=new WeakMap,G=new WeakMap,at),he=class $t extends Kt{constructor(s,n){super(s,Nt(s));J(this,"raw");J(this,"loadedThemes",new Map);J(this,"attachedLanguages",new Set(["text","ansi"]));this.raw=n}static async create(s){const n=s==="shiki-wasm"?(await wt(async()=>{const{createOnigurumaEngine:l}=await import("./fp9mRO0R.js");return{createOnigurumaEngine:l}},[],import.meta.url)).createOnigurumaEngine(wt(()=>import("./Cey7Y6ql.js"),[],import.meta.url)):(await wt(async()=>{const{createJavaScriptRegexEngine:l}=await import("./LU5PuYrD.js");return{createJavaScriptRegexEngine:l}},[],import.meta.url)).createJavaScriptRegexEngine(),r=await Qt({themes:[],langs:[],engine:n});return new $t(s,r)}getTheme(s){this.assertNotDisposed();const n=this.loadedThemes.get(s),r=this.themeResolver.getResolvedTheme(s)??n;if(r==null)throw new Error(`Theme "${s}" has not been resolved`);if(n!==r){const l=r.textmate??(r.cssVariables!=null?Ut(r.cssVariables):void 0);if(l==null)throw new Error(`Theme "${s}" does not support Shiki`);this.raw.setTheme({...l,name:s}),this.loadedThemes.set(s,r)}return r}codeToTokens(s,n){return this.raw.codeToTokens(s,this.resolveOptions(n))}createEditorTokenizer(s){return new Yt(this.raw,s,this)}createStreamTokenizer(s){return new te(this.raw,this.resolveOptions(s))}async loadLanguages(s){this.assertNotDisposed();const n=s.filter(r=>!this.attachedLanguages.has(r));Xt(await Gt(n),this)}hasLoadedLanguages(s){if(this.disposed)return!1;let n;return s.every(r=>this.attachedLanguages.has(r)?!0:Jt.has(r)?!1:(n??=this.raw.getLoadedLanguages(),n.includes(r)))}attachLanguages(s){this.assertNotDisposed();for(const n of s){if(this.attachedLanguages.has(n.name))continue;const r=n.data.find(l=>l.name===n.name||l.aliases?.includes(n.name)===!0);if(r==null)throw new Error(`attachResolvedLanguages: No returned grammar declares "${n.name}" as its name or an alias.`);this.raw.loadLanguageSync(n.data);try{this.raw.getLanguage(n.name)}catch{throw new Error(`attachResolvedLanguages: "${r.name}" is already loaded without alias "${n.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(n.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:s,themes:n,...r}){if(this.assertNotDisposed(),s!=null)return this.getTheme(s),{...r,theme:s};if(n==null)throw new Error("A theme or themes option is required");for(const l of Object.values(n))this.getTheme(l);return{...r,themes:n}}};export{he as ShikiHighlighter};
1
+ var Vt=Object.defineProperty;var yt=e=>{throw TypeError(e)};var jt=(e,i,s)=>i in e?Vt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s;var J=(e,i,s)=>jt(e,typeof i!="symbol"?i+"":i,s),bt=(e,i,s)=>i.has(e)||yt("Cannot "+s);var t=(e,i,s)=>(bt(e,i,"read from private field"),s?s.call(e):i.get(e)),g=(e,i,s)=>i.has(e)?yt("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,s),a=(e,i,s,n)=>(bt(e,i,"write to private field"),n?n.call(e,s):i.set(e,s),s),o=(e,i,s)=>(bt(e,i,"access private method"),s);var vt=(e,i,s,n)=>({set _(r){a(e,i,r,s)},get _(){return t(e,i,n)}});import{_ as wt}from"./CLAmm_T1.js";import{m as xt,A as qt,r as Ht,Q as Nt,aX as Gt,R as Jt}from"./BGN20Sak.js";import{B as Ft,D as Kt}from"./DBtTsT3h.js";import{I as F,E as Ct,b as Qt,a as Ut}from"./DICr2Lvd.js";function Xt(e,i){for(const s of Array.isArray(e)?e:[e]){let n=xt.get(s.name);n==null&&(n=s,xt.set(s.name,n)),i.attachLanguages([n]),qt.add(n.name)}}function Zt(e,i){let s;return function(...n){clearTimeout(s),s=setTimeout(()=>e.apply(this,n),i)}}const Dt=0;let Wt=0;var H,T,P,Q,L,st,it,C,U,nt,u,D,_,A,O,b,v,z,dt,E,B,X,N,R,Z,Tt,ft,h,K,ut,zt,Et,Y,pt,It,ct,tt,Ot,gt,et,Bt,Pt,At,Yt=(At=class{constructor(e,i,s){g(this,h);J(this,"backend");g(this,H);g(this,T);g(this,P);g(this,Q);g(this,L);g(this,st);g(this,it);g(this,C);g(this,U);g(this,nt,!1);g(this,u,[F]);g(this,D,[]);g(this,_,0);g(this,A,[]);g(this,O,-1);g(this,b,!0);g(this,v,!1);g(this,z,0);g(this,dt,++Wt);g(this,E,-1);g(this,B,-1);g(this,X);g(this,N,0);g(this,R,[]);g(this,Z,!1);g(this,Tt,Zt(async e=>{if(t(this,nt))return;const{startingLine:i=0,totalLines:s=1/0}=e??{},n=Math.min(s===1/0?1/0:i+s,t(this,L).lineCount);if(t(this,T)==null&&!Lt(t(this,L).languageId)){if(await this.backend?.loadLanguages([t(this,L).languageId]),t(this,nt))return;a(this,T,t(this,H).getLanguage(t(this,L).languageId))}o(this,h,K).call(this),o(this,h,It).call(this,n)},500));g(this,ft,({data:e})=>{if(typeof e!="object"||e===null)return;const{type:i,tokenizerId:s,jobId:n}=e;i==="tokenize"&&s===t(this,dt)&&typeof n=="number"&&n===t(this,z)&&(t(this,E)>=0?o(this,h,Bt).call(this,n):o(this,h,Pt).call(this,n))});this.backend=s,a(this,H,e),a(this,L,i.textDocument),a(this,P,i.theme),a(this,Q,[]),a(this,st,i.tokenizeMaxLineLength??1e3),a(this,it,i.onDeferTokenize),a(this,C,i.matchBrackets!==!1),a(this,U,i.__debug??!1),o(this,h,ut).call(this),o(this,h,K).call(this)}getStringCommentRegexpRangesInLine(e){if(!t(this,C)||e<0||e>=t(this,L).lineCount||(o(this,h,ut).call(this),t(this,T)==null))return null;if(t(this,R)[e]===void 0){o(this,h,et).call(this,e);const i=t(this,u)[e]??F,s=o(this,h,ct).call(this,e,i);t(this,u)[e+1]=s.state}return t(this,R)[e]??null}setTheme(e){t(this,P)!==e&&(a(this,P,e),o(this,h,K).call(this),this.stopBackgroundTokenize(),a(this,u,[F]),a(this,D,[]),a(this,_,0),a(this,A,[]),t(this,T)!=null&&t(this,L).lineCount>0&&o(this,h,pt).call(this,0))}dispose(){a(this,nt,!0),this.stopBackgroundTokenize(),o(this,h,Et).call(this)}tokenize(e,i,s=!1){if(o(this,h,ut).call(this),o(this,h,K).call(this),t(this,T)==null&&!Lt(t(this,L).languageId))throw new Error(`Grammar for language "${t(this,L).languageId}" not loaded`);const{lineCount:n}=t(this,L),{startingLine:r=0,totalLines:l=1/0}=i??{},d=l===1/0?n:Math.min(r+l,n),c=e.startLine,f=Math.max(r,c),I=i!=null&&l!==1/0&&e.lineDelta>0&&c<d&&e.endLine>=d,m=e.lineDelta===0&&(e.changedLineChanges?.every(([,,p])=>p===0)??!0);t(this,C)&&!m&&(t(this,R).length=Math.min(t(this,R).length,e.startLine));const M=s&&e.lineDelta!==0&&c>=r,S=m||i==null||c>=f,y=e.changedLineRanges??[[c,e.endLine]];a(this,D,[]),a(this,_,0),a(this,A,[]);let V=-1;if(c<f)for(const[p,w]of y)p<f&&(V=Math.max(V,Math.min(w,f-1)));const mt=V>=c&&(m||e.lineDelta<0);m?o(this,h,et).call(this,c):(o(this,h,Ot).call(this,e),(i==null||c>=f)&&o(this,h,et).call(this,f));let j=0,St=y[j][1],ht,Rt=0,k=m?y[j][0]:f,rt=!1;const Mt=new Map,W=mt?new Map:void 0;if(W!=null&&!m){const p=Math.min(V+1,f,d);if(p>c){o(this,h,et).call(this,p);let w=c,ot=t(this,u)[w]??F;for(;w<p;w++){const x=o(this,h,ct).call(this,w,ot);ot=x.state,W.set(w,x.resolvedTokens)}t(this,u)[p]=ot}}let q=t(this,u)[k]??F;for(;k<d;){const p=m?t(this,u)[k+1]:M?o(this,h,gt).call(this,k+1):void 0;S&&(t(this,u)[k]=q);const{resolvedTokens:w,state:ot}=o(this,h,ct).call(this,k,q);if(q=ot,k>=f?Mt.set(k,w):W?.set(k,w),S&&(t(this,u)[k+1]=q),rt=k>=St&&(m||M)&&p!=null&&q.equals(p),rt){j++;const x=y[j];if(x==null)break;if(x[0]>=d){ht=x[0],Rt=j;break}let lt=t(this,u)[x[0]];if(M)for(let kt=k+2;kt<=x[0]&&(lt=o(this,h,gt).call(this,kt),lt!=null);kt++)t(this,u)[kt]=lt;lt==null?(St=x[1],k++):(k=x[0],q=lt,St=x[1]),rt=!1;continue}k++}if(S&&(k<d?t(this,u)[k+1]=q:t(this,u)[k]=q),rt&&M&&ht==null){for(let p=k+2;p<=n;p++){const w=o(this,h,gt).call(this,p);if(w==null)break;t(this,u)[p]=w}a(this,D,[]),a(this,_,0),a(this,A,[])}if(W!=null&&W.size>0&&t(this,it).call(this,W),ht!=null)t(this,C)&&m&&(t(this,R).length=Math.min(t(this,R).length,ht)),o(this,h,pt).call(this,ht,y,Rt);else if(!rt&&k<n){const p=I&&c>=f?d:c<f&&!m?c:k;t(this,C)&&m&&(t(this,R).length=Math.min(t(this,R).length,p)),o(this,h,pt).call(this,p,y,j)}return Mt}prebuildStateStack(e){o(this,h,ut).call(this),t(this,Tt).call(this,e)}stopBackgroundTokenize(){a(this,B,-1),!t(this,b)&&(a(this,b,!0),a(this,v,!1),a(this,O,-1),a(this,E,-1),a(this,X,void 0),a(this,N,0),a(this,D,[]),a(this,_,0),a(this,A,[]),o(this,h,Et).call(this))}pauseBackgroundTokenize(){t(this,b)||t(this,v)||(t(this,U)&&console.log("[diffs/editor] background tokenization paused",{jobId:t(this,z)}),a(this,v,!0))}resumeBackgroundTokenize(){t(this,b)||!t(this,v)||t(this,T)==null||t(this,O)<0||(t(this,U)&&console.log("[diffs/editor] background tokenization resumed",{jobId:t(this,z)}),a(this,v,!1),o(this,h,Y).call(this,t(this,z)))}},H=new WeakMap,T=new WeakMap,P=new WeakMap,Q=new WeakMap,L=new WeakMap,st=new WeakMap,it=new WeakMap,C=new WeakMap,U=new WeakMap,nt=new WeakMap,u=new WeakMap,D=new WeakMap,_=new WeakMap,A=new WeakMap,O=new WeakMap,b=new WeakMap,v=new WeakMap,z=new WeakMap,dt=new WeakMap,E=new WeakMap,B=new WeakMap,X=new WeakMap,N=new WeakMap,R=new WeakMap,Z=new WeakMap,Tt=new WeakMap,ft=new WeakMap,h=new WeakSet,K=function(){if(t(this,P)==="")return;this.backend?.getTheme(t(this,P));const{colorMap:e}=t(this,H).setTheme(t(this,P));a(this,Q,e)},ut=function(){t(this,T)==null&&!Lt(t(this,L).languageId)&&t(this,H).getLoadedLanguages().includes(t(this,L).languageId)&&a(this,T,t(this,H).getLanguage(t(this,L).languageId))},zt=function(){t(this,Z)||(globalThis.addEventListener("message",t(this,ft)),a(this,Z,!0))},Et=function(){t(this,Z)&&(globalThis.removeEventListener("message",t(this,ft)),a(this,Z,!1))},Y=function(e){globalThis.postMessage({type:"tokenize",tokenizerId:t(this,dt),jobId:e})},pt=function(e,i,s=0){if(Lt(t(this,L).languageId))return;const n=++vt(this,z)._;t(this,U)&&console.log("[diffs/editor] background tokenization scheduled",{jobId:n,startLine:e,changedLineRanges:i,changedRangeIndex:s}),a(this,b,!1),a(this,v,!1),a(this,O,e),t(this,E)>=0&&a(this,B,Math.max(t(this,B),t(this,E))),a(this,E,-1),a(this,X,i),a(this,N,s),o(this,h,zt).call(this),o(this,h,Y).call(this,n)},It=function(e){if(t(this,T)==null||t(this,u).length>e)return;if(!t(this,b)){t(this,E)>=0?a(this,E,Math.max(t(this,E),e)):a(this,B,Math.max(t(this,B),e));return}const i=++vt(this,z)._;a(this,b,!1),a(this,v,!1),a(this,O,t(this,u).length-1),a(this,E,e),a(this,B,-1),a(this,X,void 0),a(this,N,0),o(this,h,zt).call(this),o(this,h,Y).call(this,i)},ct=function(e,i){const s=t(this,L).getLineText(e);if(s.length>=t(this,st))return console.warn(`[diffs] Line(${e}) too long to tokenize: ${s.length}`),o(this,h,tt).call(this,e,null),{resolvedTokens:[[0,"",s]],state:i};if(t(this,T)==null||s===""||s.trim()==="")return o(this,h,tt).call(this,e,null),{resolvedTokens:[[0,"",s]],state:i};const n=_t(t(this,T),t(this,Q),s,i,Dt,t(this,C));return o(this,h,tt).call(this,e,n.bracketIgnoredRanges),{resolvedTokens:n.resolvedTokens,state:n.ruleStack}},tt=function(e,i){t(this,C)&&(t(this,R)[e]=i)},Ot=function(e){const i=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],s=e.startLine+1;s<=t(this,u).length-s?(a(this,D,t(this,u)),a(this,_,0),a(this,u,t(this,u).slice(0,s))):(a(this,_,s),a(this,D,t(this,u).slice(s)),t(this,u).length=Math.min(t(this,u).length,s)),a(this,A,i)},gt=function(e){let i=e;for(let s=t(this,A).length-1;s>=0;s--){const[n,r,l]=t(this,A)[s];if(l!==0){if(i>r)i-=l;else if(i>n)return t(this,u)[e]}}return t(this,D)[i-t(this,_)]??t(this,u)[e]},et=function(e,i){const s=Math.min(Math.max(0,e),t(this,L).lineCount);if(t(this,u).length>s||t(this,T)==null)return!0;const n=i==null?0:performance.now();let r=t(this,u).length-1,l=t(this,u)[r]??F;for(;r<s;){t(this,u)[r]=l;const d=t(this,L).getLineText(r);if(d.length<t(this,st)&&d!==""&&d.trim()!==""){const c=_t(t(this,T),t(this,Q),d,l,Dt,t(this,C),!1);o(this,h,tt).call(this,r,c.bracketIgnoredRanges),l=c.ruleStack}else o(this,h,tt).call(this,r,null);if(r++,t(this,u)[r]=l,i!=null&&performance.now()-n>i)break}return r>=s},Bt=function(e){if(t(this,b)||t(this,v)||t(this,T)==null||e!==t(this,z))return;o(this,h,K).call(this);const i=o(this,h,et).call(this,t(this,E),1);if(!(t(this,b)||t(this,v)||e!==t(this,z))){if(i){this.stopBackgroundTokenize();return}a(this,O,t(this,u).length-1),o(this,h,Y).call(this,e)}},Pt=function(e){if(t(this,b)||t(this,v)||t(this,T)==null||e!==t(this,z))return;o(this,h,K).call(this);const i=performance.now(),s=new Map,n=t(this,L).lineCount,r=t(this,X);let l=t(this,O),d=t(this,u)[l]??F,c=!1,f=t(this,N),I=r?.[f]?.[1];for(;l<n;){t(this,u)[l]=d;const m=I!=null?o(this,h,gt).call(this,l+1):void 0,M=o(this,h,ct).call(this,l,d);if(s.set(l,M.resolvedTokens),d=M.state,t(this,u)[l+1]=d,c=I!=null&&l>=I&&m!=null&&d.equals(m),l++,c){f++;const S=r?.[f];if(S==null)break;if(I=S[1],t(this,u)[S[0]]==null)c=!1;else{l=S[0],d=t(this,u)[l]??d,c=!1;continue}}if(performance.now()-i>1)break}if(t(this,it).call(this,s),!(t(this,b)||t(this,v)||e!==t(this,z))){if(c||l>=n){const m=t(this,B);this.stopBackgroundTokenize(),m>=0&&o(this,h,It).call(this,m);return}a(this,O,l),a(this,N,f),o(this,h,Y).call(this,e)}},At);function _t(e,i,s,n,r,l=!0,d=!0){const c=e.tokenizeLine2(s,n,r);c.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${s.substring(0,100)}`);const f=c.tokens,I=f.length/2,m=[],M=[];if(!d&&!l)return{ruleStack:c.ruleStack,resolvedTokens:m,bracketIgnoredRanges:M};for(let S=0;S<I;S++){const y=f[2*S],V=S+1<I?f[2*S+2]:s.length;if(y===V)continue;const mt=f[2*S+1];if(d){const j=Ct.getForeground(mt);m.push([y,i[j],s.slice(y,V)])}l&&Ct.getTokenType(mt)>0&&M.push([y,V])}return{ruleStack:c.ruleStack,resolvedTokens:m,bracketIgnoredRanges:M}}function Lt(e){return e==="text"||e==="ansi"}var $,G,at,te=(at=class extends Ft{constructor(s,n){super();J(this,"highlighter");J(this,"options");g(this,$,"");g(this,G);this.highlighter=s,this.options=n}tokenizeChunk(s,n){const r=(t(this,$)+s).split(/(\r\n|\r|\n)/);let l=[];for(let d=0;d<r.length;d+=2){const c=r[d],f=this.highlighter.codeToTokens(c,{...this.options,grammarState:t(this,G)}),I=f.tokens[0].map(m=>({...m,offset:m.offset+this.stableOffset}));d+1<r.length?(Ht(n,I),this.pushLineBreak(n,c.length,r[d+1]),a(this,G,f.grammarState)):(l=I,a(this,$,c))}return{unstable:l,tailLength:t(this,$).length}}clone(){this.assertActive();const s=new at(this.highlighter,this.options);return this.copyStateTo(s),a(s,$,t(this,$)),a(s,G,t(this,G)),s}resetSource(){a(this,$,""),a(this,G,void 0)}releaseSource(){this.resetSource()}},$=new WeakMap,G=new WeakMap,at),he=class $t extends Kt{constructor(s,n){super(s,Nt(s));J(this,"raw");J(this,"loadedThemes",new Map);J(this,"attachedLanguages",new Set(["text","ansi"]));this.raw=n}static async create(s){const n=s==="shiki-wasm"?(await wt(async()=>{const{createOnigurumaEngine:l}=await import("./fp9mRO0R.js");return{createOnigurumaEngine:l}},[],import.meta.url)).createOnigurumaEngine(wt(()=>import("./Cey7Y6ql.js"),[],import.meta.url)):(await wt(async()=>{const{createJavaScriptRegexEngine:l}=await import("./LU5PuYrD.js");return{createJavaScriptRegexEngine:l}},[],import.meta.url)).createJavaScriptRegexEngine(),r=await Qt({themes:[],langs:[],engine:n});return new $t(s,r)}getTheme(s){this.assertNotDisposed();const n=this.loadedThemes.get(s),r=this.themeResolver.getResolvedTheme(s)??n;if(r==null)throw new Error(`Theme "${s}" has not been resolved`);if(n!==r){const l=r.textmate??(r.cssVariables!=null?Ut(r.cssVariables):void 0);if(l==null)throw new Error(`Theme "${s}" does not support Shiki`);this.raw.setTheme({...l,name:s}),this.loadedThemes.set(s,r)}return r}codeToTokens(s,n){return this.raw.codeToTokens(s,this.resolveOptions(n))}createEditorTokenizer(s){return new Yt(this.raw,s,this)}createStreamTokenizer(s){return new te(this.raw,this.resolveOptions(s))}async loadLanguages(s){this.assertNotDisposed();const n=s.filter(r=>!this.attachedLanguages.has(r));Xt(await Gt(n),this)}hasLoadedLanguages(s){if(this.disposed)return!1;let n;return s.every(r=>this.attachedLanguages.has(r)?!0:Jt.has(r)?!1:(n??=this.raw.getLoadedLanguages(),n.includes(r)))}attachLanguages(s){this.assertNotDisposed();for(const n of s){if(this.attachedLanguages.has(n.name))continue;const r=n.data.find(l=>l.name===n.name||l.aliases?.includes(n.name)===!0);if(r==null)throw new Error(`attachResolvedLanguages: No returned grammar declares "${n.name}" as its name or an alias.`);this.raw.loadLanguageSync(n.data);try{this.raw.getLanguage(n.name)}catch{throw new Error(`attachResolvedLanguages: "${r.name}" is already loaded without alias "${n.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(n.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:s,themes:n,...r}){if(this.assertNotDisposed(),s!=null)return this.getTheme(s),{...r,theme:s};if(n==null)throw new Error("A theme or themes option is required");for(const l of Object.values(n))this.getTheme(l);return{...r,themes:n}}};export{he as ShikiHighlighter};