@decocms/mesh 2.76.0 → 2.77.0

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 (155) hide show
  1. package/dist/client/assets/{AlertCircle-TbirTaeA.js → AlertCircle-oGnqqT1Z.js} +1 -1
  2. package/dist/client/assets/{ArrowUp-DVhz9MPT.js → ArrowUp-DyvHGnwT.js} +1 -1
  3. package/dist/client/assets/{Calendar-BhleOqT-.js → Calendar-DH27yGmZ.js} +1 -1
  4. package/dist/client/assets/{Check-BIlnRzi6.js → Check-BlatIqwx.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-CSYoAEm3.js → CheckCircle-A7jAb6dO.js} +1 -1
  6. package/dist/client/assets/{CheckDone01-gZo2F6uL.js → CheckDone01-6mjKztKu.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-jAfIG9nZ.js → ChevronDown-CCp2JMaE.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-CNYkXy1u.js → ChevronRight-BcCazbVH.js} +1 -1
  9. package/dist/client/assets/{Code01-DeVT5m93.js → Code01-D97OsfSf.js} +1 -1
  10. package/dist/client/assets/{Copy01-BJPi2nBZ.js → Copy01-DGJsTP15.js} +1 -1
  11. package/dist/client/assets/{DotsHorizontal-CZIcl0Ye.js → DotsHorizontal-C2NdUnkY.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CPJps54j.js → DotsVertical-BahQdspO.js} +1 -1
  13. package/dist/client/assets/{Download01-BVA62GFI.js → Download01-NaPFxXbm.js} +1 -1
  14. package/dist/client/assets/{Edit01-CLT1AKyh.js → Edit01-CSl-FU1V.js} +1 -1
  15. package/dist/client/assets/{File02-M7e4eeKQ.js → File02-DCmcNtYa.js} +1 -1
  16. package/dist/client/assets/{File06-BUOJeS0C.js → File06-BmPjFHnz.js} +1 -1
  17. package/dist/client/assets/{FilterLines-CDkZPaiO.js → FilterLines-Bbx0mrEz.js} +1 -1
  18. package/dist/client/assets/{Globe02-CNtZ4Mz7.js → Globe02-B4QQLqTF.js} +1 -1
  19. package/dist/client/assets/{Grid01-BhCIE3UE.js → Grid01-CXhtcjgR.js} +1 -1
  20. package/dist/client/assets/{Home02-Zp_wVezk.js → Home02-DTzcdbjE.js} +1 -1
  21. package/dist/client/assets/{Image01-Bmljn0R6.js → Image01-Cw_RHYUi.js} +1 -1
  22. package/dist/client/assets/{Inbox01-Bz-1SNbb.js → Inbox01-Cd7KCD-D.js} +1 -1
  23. package/dist/client/assets/{InfoCircle-DutDNmXq.js → InfoCircle-D87-HsMo.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-npl2D9IH.js → LinkExternal01-DAYrBD75.js} +1 -1
  25. package/dist/client/assets/{List-B95opsr5.js → List-BOdL1TDJ.js} +1 -1
  26. package/dist/client/assets/{Loading01-CudhqwtJ.js → Loading01-DcUBqOzt.js} +1 -1
  27. package/dist/client/assets/{Lock01-C3j5poil.js → Lock01-CJlTX6d9.js} +1 -1
  28. package/dist/client/assets/{Pin01-DpTwe7GO.js → Pin01-Cetrd1z7.js} +1 -1
  29. package/dist/client/assets/{Play-BxFFyAEF.js → Play-76i3R5Mg.js} +1 -1
  30. package/dist/client/assets/{Plus-BVPnBK8D.js → Plus-CBeTqgO0.js} +1 -1
  31. package/dist/client/assets/{RefreshCcw01-Dzlid7sh.js → RefreshCcw01-qWaidSs5.js} +1 -1
  32. package/dist/client/assets/{SearchMd-yRVgOeax.js → SearchMd-DlO0jVus.js} +1 -1
  33. package/dist/client/assets/{Settings01-DGIrqZBI.js → Settings01-Dyku2FbW.js} +1 -1
  34. package/dist/client/assets/{Settings02-CW4MK9LY.js → Settings02-CYlXe29M.js} +1 -1
  35. package/dist/client/assets/{Share07-BKNvns4q.js → Share07-5RJmIBaS.js} +1 -1
  36. package/dist/client/assets/{Terminal-DV_yPRWa.js → Terminal-CwhCdVNd.js} +1 -1
  37. package/dist/client/assets/{Tool01-C0EKLKq5.js → Tool01-SB9NL9XB.js} +1 -1
  38. package/dist/client/assets/{Trash01-py7ft8Od.js → Trash01-B5rQsNj_.js} +1 -1
  39. package/dist/client/assets/{Upload01-CCoXEdI4.js → Upload01-up-2G0Zk.js} +1 -1
  40. package/dist/client/assets/{Users03-D2F2bran.js → Users03-YVnet25Q.js} +1 -1
  41. package/dist/client/assets/{X-CixxHrye.js → X-CDixI9Fp.js} +1 -1
  42. package/dist/client/assets/{XClose-S1Me7eeg.js → XClose-9HhuzPl1.js} +1 -1
  43. package/dist/client/assets/{agent-connections-preview-DZgc-mir.js → agent-connections-preview-D_HsP759.js} +1 -1
  44. package/dist/client/assets/{agent-detail-DPLDxB9n.js → agent-detail-CNliY0im.js} +1 -1
  45. package/dist/client/assets/{agents-CynO2-IY.js → agents-DSOm54r8.js} +1 -1
  46. package/dist/client/assets/{alert-dialog-B1nWkQHx.js → alert-dialog-CezkcFZv.js} +1 -1
  47. package/dist/client/assets/{auth-catchall-CJ49F7Eq.js → auth-catchall-Ddtu2gr8.js} +1 -1
  48. package/dist/client/assets/{avatar-BbH9O0kN.js → avatar-a-IdsKtd.js} +1 -1
  49. package/dist/client/assets/{badge-C898LHvV.js → badge-DyTP00ui.js} +1 -1
  50. package/dist/client/assets/{binder-xcUkLvPC.js → binder-D3g26T9_.js} +1 -1
  51. package/dist/client/assets/{breadcrumb-t_Ccp20G.js → breadcrumb-CrQKEc0V.js} +1 -1
  52. package/dist/client/assets/{button-C1iesapY.js → button-IcLvDS7b.js} +1 -1
  53. package/dist/client/assets/{card-DKzkS6ji.js → card-DPhTtE1j.js} +1 -1
  54. package/dist/client/assets/{checkbox-B82l7mBw.js → checkbox-BMOSGAPg.js} +1 -1
  55. package/dist/client/assets/{circle-alert-_5s_KbQk.js → circle-alert-CUdPHotP.js} +1 -1
  56. package/dist/client/assets/collection-detail-CVwTrXbU.js +26 -0
  57. package/dist/client/assets/{collection-search-D3a5_1zR.js → collection-search-C9obF9Ju.js} +1 -1
  58. package/dist/client/assets/{collection-tab-Y58MHDMK.js → collection-tab-B0D5Ge1w.js} +1 -1
  59. package/dist/client/assets/{collection-table-wrapper-B6XWzQ-4.js → collection-table-wrapper-B0DqLvbL.js} +1 -1
  60. package/dist/client/assets/{collection-tabs-BPHWDFL4.js → collection-tabs-Bh3_w0C-.js} +1 -1
  61. package/dist/client/assets/{command-DepzRVHX.js → command-xbgaBPKx.js} +1 -1
  62. package/dist/client/assets/{connect-OP0J5SPJ.js → connect-B1f578pl.js} +1 -1
  63. package/dist/client/assets/{connection-card-DkCny6Ez.js → connection-card-DzzffrUK.js} +1 -1
  64. package/dist/client/assets/{connection-detail-CdLleACg.js → connection-detail-Dc9842ih.js} +1 -1
  65. package/dist/client/assets/{connections-BZUVvBGs.js → connections-DMThZLY2.js} +1 -1
  66. package/dist/client/assets/{constants-BEco_-y7.js → constants-Bb6jn5pm.js} +1 -1
  67. package/dist/client/assets/constants-D3p69qeS.js +1 -0
  68. package/dist/client/assets/{create-organization-dialog-58b_GUv7.js → create-organization-dialog-Cv4z3yf1.js} +1 -1
  69. package/dist/client/assets/{create-project-dialog-C5GAJOOY.js → create-project-dialog-B-TMsdZD.js} +1 -1
  70. package/dist/client/assets/{dialog-CpkgwzHW.js → dialog-BP68A3-r.js} +1 -1
  71. package/dist/client/assets/{dropdown-menu-D6YYwFq7.js → dropdown-menu-C0weu07S.js} +1 -1
  72. package/dist/client/assets/{dynamic-plugin-layout-BMgNBEQS.js → dynamic-plugin-layout-C3YR0WSk.js} +1 -1
  73. package/dist/client/assets/{empty-state-BQPtoYZe.js → empty-state-BY2kT0YF.js} +1 -1
  74. package/dist/client/assets/{empty-state-CH3e4Xzf.js → empty-state-CcIz0DtW.js} +1 -1
  75. package/dist/client/assets/{env-vars-editor-Vpi1vdW2.js → env-vars-editor-DJJKlTL9.js} +1 -1
  76. package/dist/client/assets/{error-boundary-BGFWaL1J.js → error-boundary-Dxa9vN4s.js} +1 -1
  77. package/dist/client/assets/{estree-CwOGYdhi.js → estree-BOE5AzoZ.js} +2 -2
  78. package/dist/client/assets/{extract-connection-data-CDmQ7rLP.js → extract-connection-data-qxA4zC_1.js} +1 -1
  79. package/dist/client/assets/{file-browser-DUDclrRh.js → file-browser-C4JlHX7p.js} +2 -2
  80. package/dist/client/assets/{form-NA0-x5iN.js → form-CPbw8FiC.js} +1 -1
  81. package/dist/client/assets/{grid-view-DbtTgaoS.js → grid-view-Pi_wFmga.js} +1 -1
  82. package/dist/client/assets/{home-DtmWz3MA.js → home-D9pqYJxL.js} +1 -1
  83. package/dist/client/assets/{index-DlY6KFzI.js → index-BE8lTkR-.js} +1 -1
  84. package/dist/client/assets/{index-GRocoNYa.js → index-BQaDRMwA.js} +1 -1
  85. package/dist/client/assets/{index-ByJoFAq_.js → index-Bofa5A4c.js} +1 -1
  86. package/dist/client/assets/{index-43_iGxlN.js → index-CIjJkh1w.js} +1 -1
  87. package/dist/client/assets/{index-wUnd_o-U.js → index-CV7G73w0.js} +1 -1
  88. package/dist/client/assets/{index-HxeE9C0A.js → index-ChHDKIbN.js} +6 -6
  89. package/dist/client/assets/{index-Kq8ytqk9.js → index-DIqndGeg.js} +1 -1
  90. package/dist/client/assets/{index-C9Dn0opW.js → index-DauKEk3R.js} +2 -2
  91. package/dist/client/assets/index-Dw0obvD7.js +25 -0
  92. package/dist/client/assets/{infiniteQueryObserver-CSOdbqFL.js → infiniteQueryObserver-BJxHLYt6.js} +1 -1
  93. package/dist/client/assets/{input-DBGu1Yhi.js → input-BiH6tKYM.js} +1 -1
  94. package/dist/client/assets/{integration-icon-CmJggqPx.js → integration-icon-D8EX8kVH.js} +1 -1
  95. package/dist/client/assets/{label-11d5Pe_w.js → label-CL-z0zvN.js} +1 -1
  96. package/dist/client/assets/{layout-BQSZy0Ao.js → layout-DS9ZU1FV.js} +1 -1
  97. package/dist/client/assets/{localstorage-keys-BxVB7BFB.js → localstorage-keys-CglJRhni.js} +1 -1
  98. package/dist/client/assets/{login-CMpn2tdR.js → login-CQ4DI182.js} +1 -1
  99. package/dist/client/assets/{mcp-oauth-JrpxCLx4.js → mcp-oauth-pNbworXN.js} +1 -1
  100. package/dist/client/assets/{mcp-server-card-8DET7nVd.js → mcp-server-card-CiBv2daD.js} +1 -1
  101. package/dist/client/assets/{mcp-server-detail-CMrzxsYv.js → mcp-server-detail-CWlOVXjE.js} +2 -2
  102. package/dist/client/assets/{members-CUWgr5ku.js → members-DP31FB6R.js} +1 -1
  103. package/dist/client/assets/{monaco-editor-DvJ6AQm-.js → monaco-editor-B3-QQ48f.js} +2 -2
  104. package/dist/client/assets/{monitoring-Db1K0NxK.js → monitoring-CEJjhEzo.js} +3 -3
  105. package/dist/client/assets/{oauth-callback-Bh-LWKIz.js → oauth-callback-DwNVkFW_.js} +1 -1
  106. package/dist/client/assets/{page-79TZOOqo.js → page-BYKRtBSp.js} +1 -1
  107. package/dist/client/assets/{page-Bx3m0Nlj.js → page-UBkAPmC5.js} +1 -1
  108. package/dist/client/assets/{plugin-empty-state-34Wj3C93.js → plugin-empty-state-BpFO_GZ3.js} +1 -1
  109. package/dist/client/assets/{plugin-header-KrvIXXbF.js → plugin-header-COGg6PEu.js} +1 -1
  110. package/dist/client/assets/{popover-BbAo_V3q.js → popover-JVz1MvYo.js} +1 -1
  111. package/dist/client/assets/{project-layout-QE2hcM6x.js → project-layout-D_GhuXhx.js} +1 -1
  112. package/dist/client/assets/{project-settings-2bxHgR8P.js → project-settings-YCZbbN-X.js} +1 -1
  113. package/dist/client/assets/{projects-list-CSrfAb2G.js → projects-list-DK4ua0bt.js} +1 -1
  114. package/dist/client/assets/{registry-utils-CLfG2KJO.js → registry-utils-BAvR5D-B.js} +1 -1
  115. package/dist/client/assets/{resizable-D5fgPQWp.js → resizable-Z1lo2KUF.js} +1 -1
  116. package/dist/client/assets/{select-CnIfeZ9k.js → select-DWWlFXcM.js} +1 -1
  117. package/dist/client/assets/{shell-layout-DIuzNmm5.js → shell-layout-j0caJ6cv.js} +1 -1
  118. package/dist/client/assets/{spinner-BbdUl9_5.js → spinner-DDglcYN3.js} +1 -1
  119. package/dist/client/assets/{store-invite-eQ6O_LcC.js → store-invite-DE3oTPEQ.js} +1 -1
  120. package/dist/client/assets/{switch-7wa9WQCt.js → switch-BU39MRXa.js} +1 -1
  121. package/dist/client/assets/{table-F_F9uG31.js → table-DkKXRH0o.js} +1 -1
  122. package/dist/client/assets/{tasks-Bo849zPQ.js → tasks-B5becd8b.js} +1 -1
  123. package/dist/client/assets/{textarea-CX1AXmSo.js → textarea-B0H-V_2P.js} +1 -1
  124. package/dist/client/assets/{tools-list-CeBZ5K9_.js → tools-list-BPmcCiBX.js} +1 -1
  125. package/dist/client/assets/{topbar-portal-DTnSGvrH.js → topbar-portal-COlO8Xo1.js} +1 -1
  126. package/dist/client/assets/{typewriter-title-CydscG0b.js → typewriter-title-Bwf3Eryu.js} +1 -1
  127. package/dist/client/assets/{use-binding-BIvDtNoa.js → use-binding-BF44Dr3v.js} +1 -1
  128. package/dist/client/assets/{use-connection-DWpxH8iy.js → use-connection-DMc1ed7A.js} +1 -1
  129. package/dist/client/assets/{use-create-virtual-mcp-CMegJpH_.js → use-create-virtual-mcp-DFreYzbI.js} +1 -1
  130. package/dist/client/assets/{use-deco-chat-open-DeBMXnMx.js → use-deco-chat-open-C_KGQyGq.js} +2 -2
  131. package/dist/client/assets/{use-install-from-registry-CNdLBCwL.js → use-install-from-registry--Nvk5mQH.js} +1 -1
  132. package/dist/client/assets/{use-list-state-CqdwrHCA.js → use-list-state-BHsqFECN.js} +1 -1
  133. package/dist/client/assets/{use-llm-B2BVGott.js → use-llm-B0wA4ukF.js} +1 -1
  134. package/dist/client/assets/{use-mcp-prompts-CUow6VVK.js → use-mcp-prompts-DnDIhnz1.js} +1 -1
  135. package/dist/client/assets/{use-mcp-tools-DO_-llbI.js → use-mcp-tools-D7_YQODs.js} +1 -1
  136. package/dist/client/assets/{use-mobile-CqANtQ4e.js → use-mobile-DKBgr338.js} +1 -1
  137. package/dist/client/assets/{use-organization-settings-ANLw4ex1.js → use-organization-settings-DhaOb6f0.js} +1 -1
  138. package/dist/client/assets/{use-project-C1G7xlcy.js → use-project-DuJfQ5Lc.js} +1 -1
  139. package/dist/client/assets/{use-virtual-mcp-DaI2d98r.js → use-virtual-mcp-Dx2SDNW7.js} +1 -1
  140. package/dist/client/assets/useInfiniteQuery-l-SVnEZQ.js +1 -0
  141. package/dist/client/assets/{useMutation-M3-wug2Q.js → useMutation-CR-ZbATX.js} +1 -1
  142. package/dist/client/assets/useQuery-t9jS7IDj.js +1 -0
  143. package/dist/client/assets/utils-B_eWxCLR.js +1 -0
  144. package/dist/client/assets/{view-mode-toggle-JVmuLwXe.js → view-mode-toggle-DL3lAsm5.js} +1 -1
  145. package/dist/client/assets/{workflow-BKKAfuJP.js → workflow-COg9B_We.js} +1 -1
  146. package/dist/client/index.html +1 -1
  147. package/dist/server/cli.js +154 -154
  148. package/dist/server/server.js +127 -127
  149. package/package.json +1 -1
  150. package/dist/client/assets/collection-detail-B-hnHfhu.js +0 -26
  151. package/dist/client/assets/constants-gwxE8_b0.js +0 -1
  152. package/dist/client/assets/index-Dv4saiJc.js +0 -25
  153. package/dist/client/assets/useInfiniteQuery-CL3o6Gdm.js +0 -1
  154. package/dist/client/assets/useQuery-jRtVXI31.js +0 -1
  155. package/dist/client/assets/utils-D1Qd9-I_.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as U,c as ae,o as Nx,h as Cw,k as _w,j as T,s as Nb,a2 as Ix,b$ as wx,bY as Nw,bt as At,c0 as Iw,u as ci,t as _n,c1 as ww,aW as Rx,c2 as Rw,c3 as dn,c4 as il,c5 as Ow,c6 as al,c7 as Lw,c8 as Dw,c9 as Mw,ca as Pw,y as Fw,K as qm,cb as Bw,cc as Uw,cd as Hw,ce as $w,z as Ox,m as Lx,O as as,b4 as jm,bX as Es,g as zw}from"./index-HxeE9C0A.js";import{c as pe}from"./utils-D1Qd9-I_.js";import{i as qw}from"./X-CixxHrye.js";import{u as ka,S as Ib,a as jw,i as Gw,m as Dx,M as Vw,c as Ww,g as Yw,C as Kw,t as Mx,b as Xw,h as Zw}from"./use-deco-chat-open-DeBMXnMx.js";import{b as di,P as pi,a as fi}from"./popover-BbAo_V3q.js";import{S as So}from"./spinner-BbdUl9_5.js";import{b as wn,T as Rn,a as On,c as Ao,I as Gm}from"./integration-icon-CmJggqPx.js";import{d as Px,u as Vm,i as Qr,f as Qw}from"./constants-BEco_-y7.js";import{u as Jw,g as Fx,l as wb,a as Rb,r as eR}from"./use-mcp-prompts-CUow6VVK.js";import{E as tR,i as nR}from"./error-boundary-BGFWaL1J.js";import{B as et}from"./button-C1iesapY.js";import{c as rR,b as iR,e as aR,a as sR,D as oR}from"./dialog-CpkgwzHW.js";import{a as lR,F as uR,b as cR,c as dR,d as pR,f as fR}from"./form-NA0-x5iN.js";import{I as Bx}from"./input-DBGu1Yhi.js";import{i as Ux}from"./AlertCircle-TbirTaeA.js";import{i as hR}from"./ArrowUp-DVhz9MPT.js";import{t as Hh}from"./ChevronDown-jAfIG9nZ.js";import{i as mR}from"./Edit01-CLT1AKyh.js";import{t as ia}from"./Users03-D2F2bran.js";import{i as Hx}from"./ChevronRight-CNYkXy1u.js";import{i as xa}from"./Check-BIlnRzi6.js";import{a as Wm}from"./Copy01-BJPi2nBZ.js";import{i as gR}from"./Terminal-DV_yPRWa.js";import{M as $x,s as Ob}from"./monaco-editor-DvJ6AQm-.js";import{u as bR,L as ER}from"./localstorage-keys-BxVB7BFB.js";import{E as yR}from"./empty-state-CH3e4Xzf.js";import{g as TR,h as SR}from"./use-connection-DWpxH8iy.js";import{g as AR}from"./generate-id-Dyweu44Y.js";import{i as zx}from"./SearchMd-yRVgOeax.js";import{s as kR}from"./Trash01-py7ft8Od.js";import{B as xR}from"./badge-C898LHvV.js";import{i as vR}from"./Code01-DeVT5m93.js";import{b as CR}from"./use-virtual-mcp-DaI2d98r.js";import{u as _R}from"./use-create-virtual-mcp-CMegJpH_.js";const qx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));qx.displayName="Atom02";const jx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));jx.displayName="Attachment01";const Gx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));Gx.displayName="Coins01";const Vx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));Vx.displayName="Lightbulb01";const Wx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Wx.displayName="Stop";const Yx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));Yx.displayName="Target04";const Kx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Kx.displayName="XCircle";function NR(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?Nb().min(1,"Required"):Nb();return Nx(e)}function IR(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function Xx(t){const e=ae.c(64),{prompt:n,setPrompt:r,onSubmit:i}=t,a=U.useId();let s;if(e[0]!==n){const H=n?NR(n):Nx({});s=Cw(H),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?IR(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=_w(c);let f;e[7]!==n?.arguments?(f=n?.arguments??[],e[7]=n?.arguments,e[8]=f):f=e[8];const p=f;let h;e[9]!==d||e[10]!==i||e[11]!==r?(h=async H=>{await i(H),r(null),d.reset()},e[9]=d,e[10]=i,e[11]=r,e[12]=h):h=e[12];const g=h;let b;e[13]!==d||e[14]!==r?(b=H=>{H||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const E=b;if(!n)return null;let y;e[16]!==n.name||e[17]!==n.title?(y=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=y):y=e[18];let S;e[19]!==y?(S=T.jsx(rR,{children:y}),e[19]=y,e[20]=S):S=e[20];let k;e[21]!==n.description?(k=n.description&&T.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=k):k=e[22];let x;e[23]!==k||e[24]!==S?(x=T.jsxs(iR,{children:[S,k]}),e[23]=k,e[24]=S,e[25]=x):x=e[25];let A;e[26]!==d||e[27]!==g?(A=H=>{H.stopPropagation(),d.handleSubmit(g)(H)},e[26]=d,e[27]=g,e[28]=A):A=e[28];let v;if(e[29]!==p||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let H;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(H=J=>T.jsx(uR,{control:d.control,name:J.name,render:I=>{const{field:X}=I;return T.jsxs(cR,{children:[T.jsxs(dR,{className:"text-xs",children:[J.name,J.required?null:T.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),T.jsx(pR,{children:T.jsx(Bx,{...X,value:X.value??"",required:J.required,placeholder:J.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),T.jsx(fR,{})]})}},J.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=H):H=e[35],v=p.map(H),e[29]=p,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=v}else v=e[32];let w;e[36]!==E?(w=()=>E(!1),e[36]=E,e[37]=w):w=e[37];let N;e[38]!==d.formState.isSubmitting||e[39]!==w?(N=T.jsx(et,{type:"button",variant:"ghost",onClick:w,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=w,e[40]=N):N=e[40];const _=!d.formState.isValid||d.formState.isSubmitting;let D;e[41]!==d.formState.isSubmitting?(D=d.formState.isSubmitting?T.jsxs("span",{className:"flex items-center gap-2",children:[T.jsx(So,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=D):D=e[42];let M;e[43]!==a||e[44]!==_||e[45]!==D?(M=T.jsx(et,{type:"submit",form:a,disabled:_,children:D}),e[43]=a,e[44]=_,e[45]=D,e[46]=M):M=e[46];let q;e[47]!==N||e[48]!==M?(q=T.jsxs(aR,{children:[N,M]}),e[47]=N,e[48]=M,e[49]=q):q=e[49];let P;e[50]!==a||e[51]!==A||e[52]!==v||e[53]!==q?(P=T.jsxs("form",{id:a,className:"space-y-4 py-4",autoComplete:"off",onSubmit:A,children:[v,q]}),e[50]=a,e[51]=A,e[52]=v,e[53]=q,e[54]=P):P=e[54];let F;e[55]!==d||e[56]!==P?(F=T.jsx(lR,{...d,children:P}),e[55]=d,e[56]=P,e[57]=F):F=e[57];let $;e[58]!==x||e[59]!==F?($=T.jsxs(sR,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[x,F]}),e[58]=x,e[59]=F,e[60]=$):$=e[60];let G;return e[61]!==E||e[62]!==$?(G=T.jsx(oR,{open:!0,onOpenChange:E,children:$}),e[61]=E,e[62]=$,e[63]=G):G=e[63],G}function it(t){this.content=t}it.prototype={constructor:it,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new it(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new it(n)},addToStart:function(t,e){return new it([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new it(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new it(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=it.from(t),t.size?new it(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=it.from(t),t.size?new it(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=it.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};it.from=function(t){if(t instanceof it)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new it(e)};function Zx(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=Zx(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Qx(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=Qx(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class W{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=u},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new W(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new W(r,i)}cutByIndex(e,n){return e==n?W.empty:e==0&&n==this.content.length?this:new W(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new W(i,a)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Zx(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Qx(this,e,n,r)}findIndex(e){if(e==0)return Fa(0,e);if(e==this.size)return Fa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Fa(n+1,a):Fa(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return W.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new W(n||e,r)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const sl={index:0,offset:0};function Fa(t,e){return sl.index=t,sl.offset=e,sl}function ys(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ys(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ys(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let _e=class $h{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ys(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $h.none;if(e instanceof $h)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};_e.none=[];class Ts extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=ev(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(Jx(this.content,e+this.openStart,n+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,n){if(!n)return ee.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(W.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new ee(e,r,i)}}ee.empty=new ee(W.empty,0,0);function Jx(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Jx(a.content,e-i-1,n-i-1)))}function ev(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=ev(s.content,e-a-1,n,s);return o&&t.replaceChild(i,s.copy(o))}function wR(t,e,n){if(n.openStart>t.depth)throw new Ts("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ts("Inconsistent open depths");return tv(t,e,n,0)}function tv(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=tv(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return br(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=RR(n,t);return br(a,rv(t,s,o,e,r))}else return br(a,Ss(t,e,r))}function nv(t,e){if(!e.type.compatibleContent(t.type))throw new Ts("Cannot join "+e.type.name+" onto "+t.type.name)}function zh(t,e,n){let r=t.node(n);return nv(r,e.node(n)),r}function gr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ui(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(gr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)gr(i.child(o),r);e&&e.depth==n&&e.textOffset&&gr(e.nodeBefore,r)}function br(t,e){return t.type.checkContent(e),t.copy(e)}function rv(t,e,n,r,i){let a=t.depth>i&&zh(t,e,i+1),s=r.depth>i&&zh(n,r,i+1),o=[];return Ui(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(nv(a,s),gr(br(a,rv(t,e,n,r,i+1)),o)):(a&&gr(br(a,Ss(t,e,i+1)),o),Ui(e,n,i,o),s&&gr(br(s,Ss(n,r,i+1)),o)),Ui(r,null,i,o),new W(o)}function Ss(t,e,n){let r=[];if(Ui(null,t,n,r),t.depth>n){let i=zh(t,e,n+1);gr(br(i,Ss(t,e,n+1)),r)}return Ui(e,null,n,r),new W(r)}function RR(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(W.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class aa{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new As(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(r.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new aa(n,r,a)}static resolveCached(e,n){let r=Lb.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Lb.set(e,r=new OR);let i=r.elts[r.i]=aa.resolve(e,n);return r.i=(r.i+1)%LR,i}}class OR{constructor(){this.elts=[],this.i=0}}const LR=12,Lb=new WeakMap;class As{constructor(e,n,r){this.$from=e,this.$to=n,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 DR=Object.create(null);let Xn=class qh{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||W.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,n,r,i=0){this.content.nodesBetween(e,n,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,n,r,i){return this.content.textBetween(e,n,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,n,r){return this.type==e&&ys(this.attrs,n||e.defaultAttrs||DR)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new qh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new qh(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),u=i.node(s).content.cut(i.pos-o,a.pos-o);return new ee(u,i.depth-s,a.depth-s)}replace(e,n,r){return wR(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return aa.resolveCached(this,e)}resolveNoCache(e){return aa.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.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()+")"),iv(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=W.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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),this.type.checkAttrs(this.attrs);let e=_e.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=W.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Xn.prototype.text=void 0;class ks extends Xn{constructor(e,n,r,i){if(super(e,n,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):iv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ks(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ks(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function iv(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class kr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new MR(e,n);if(r.next==null)return kr.empty;let i=av(r);r.next&&r.err("Unexpected trailing text");let a=zR($R(i));return qR(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return W.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=a(d,o.concat(c));if(f)return f}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
1
+ import{r as U,c as ae,o as Nx,h as Cw,k as _w,j as T,s as Nb,a2 as Ix,b_ as wx,bX as Nw,bs as At,b$ as Iw,u as ci,t as _n,c0 as ww,aW as Rx,c1 as Rw,c2 as dn,c3 as il,c4 as Ow,c5 as al,c6 as Lw,c7 as Dw,c8 as Mw,c9 as Pw,y as Fw,K as qm,ca as Bw,cb as Uw,cc as Hw,cd as $w,z as Ox,m as Lx,O as as,b3 as jm,bW as Es,g as zw}from"./index-ChHDKIbN.js";import{c as pe}from"./utils-B_eWxCLR.js";import{i as qw}from"./X-CDixI9Fp.js";import{u as ka,S as Ib,a as jw,i as Gw,m as Dx,M as Vw,c as Ww,g as Yw,C as Kw,t as Mx,b as Xw,h as Zw}from"./use-deco-chat-open-C_KGQyGq.js";import{b as di,P as pi,a as fi}from"./popover-JVz1MvYo.js";import{S as So}from"./spinner-DDglcYN3.js";import{b as wn,T as Rn,a as On,c as Ao,I as Gm}from"./integration-icon-D8EX8kVH.js";import{d as Px,u as Vm,i as Qr,f as Qw}from"./constants-Bb6jn5pm.js";import{u as Jw,g as Fx,l as wb,a as Rb,r as eR}from"./use-mcp-prompts-DnDIhnz1.js";import{E as tR,i as nR}from"./error-boundary-Dxa9vN4s.js";import{B as et}from"./button-IcLvDS7b.js";import{c as rR,b as iR,e as aR,a as sR,D as oR}from"./dialog-BP68A3-r.js";import{a as lR,F as uR,b as cR,c as dR,d as pR,f as fR}from"./form-CPbw8FiC.js";import{I as Bx}from"./input-BiH6tKYM.js";import{i as Ux}from"./AlertCircle-oGnqqT1Z.js";import{i as hR}from"./ArrowUp-DyvHGnwT.js";import{t as Hh}from"./ChevronDown-CCp2JMaE.js";import{i as mR}from"./Edit01-CSl-FU1V.js";import{t as ia}from"./Users03-YVnet25Q.js";import{i as Hx}from"./ChevronRight-BcCazbVH.js";import{i as xa}from"./Check-BlatIqwx.js";import{a as Wm}from"./Copy01-DGJsTP15.js";import{i as gR}from"./Terminal-CwhCdVNd.js";import{M as $x,s as Ob}from"./monaco-editor-B3-QQ48f.js";import{u as bR,L as ER}from"./localstorage-keys-CglJRhni.js";import{E as yR}from"./empty-state-CcIz0DtW.js";import{g as TR,h as SR}from"./use-connection-DMc1ed7A.js";import{g as AR}from"./generate-id-Dyweu44Y.js";import{i as zx}from"./SearchMd-DlO0jVus.js";import{s as kR}from"./Trash01-B5rQsNj_.js";import{B as xR}from"./badge-DyTP00ui.js";import{i as vR}from"./Code01-D97OsfSf.js";import{b as CR}from"./use-virtual-mcp-Dx2SDNW7.js";import{u as _R}from"./use-create-virtual-mcp-DFreYzbI.js";const qx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));qx.displayName="Atom02";const jx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));jx.displayName="Attachment01";const Gx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));Gx.displayName="Coins01";const Vx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));Vx.displayName="Lightbulb01";const Wx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Wx.displayName="Stop";const Yx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));Yx.displayName="Target04";const Kx=({size:t=24,color:e="currentColor",...n})=>U.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},U.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Kx.displayName="XCircle";function NR(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?Nb().min(1,"Required"):Nb();return Nx(e)}function IR(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function Xx(t){const e=ae.c(64),{prompt:n,setPrompt:r,onSubmit:i}=t,a=U.useId();let s;if(e[0]!==n){const H=n?NR(n):Nx({});s=Cw(H),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?IR(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=_w(c);let f;e[7]!==n?.arguments?(f=n?.arguments??[],e[7]=n?.arguments,e[8]=f):f=e[8];const p=f;let h;e[9]!==d||e[10]!==i||e[11]!==r?(h=async H=>{await i(H),r(null),d.reset()},e[9]=d,e[10]=i,e[11]=r,e[12]=h):h=e[12];const g=h;let b;e[13]!==d||e[14]!==r?(b=H=>{H||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const E=b;if(!n)return null;let y;e[16]!==n.name||e[17]!==n.title?(y=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=y):y=e[18];let S;e[19]!==y?(S=T.jsx(rR,{children:y}),e[19]=y,e[20]=S):S=e[20];let k;e[21]!==n.description?(k=n.description&&T.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=k):k=e[22];let x;e[23]!==k||e[24]!==S?(x=T.jsxs(iR,{children:[S,k]}),e[23]=k,e[24]=S,e[25]=x):x=e[25];let A;e[26]!==d||e[27]!==g?(A=H=>{H.stopPropagation(),d.handleSubmit(g)(H)},e[26]=d,e[27]=g,e[28]=A):A=e[28];let v;if(e[29]!==p||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let H;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(H=J=>T.jsx(uR,{control:d.control,name:J.name,render:I=>{const{field:X}=I;return T.jsxs(cR,{children:[T.jsxs(dR,{className:"text-xs",children:[J.name,J.required?null:T.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),T.jsx(pR,{children:T.jsx(Bx,{...X,value:X.value??"",required:J.required,placeholder:J.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),T.jsx(fR,{})]})}},J.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=H):H=e[35],v=p.map(H),e[29]=p,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=v}else v=e[32];let w;e[36]!==E?(w=()=>E(!1),e[36]=E,e[37]=w):w=e[37];let N;e[38]!==d.formState.isSubmitting||e[39]!==w?(N=T.jsx(et,{type:"button",variant:"ghost",onClick:w,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=w,e[40]=N):N=e[40];const _=!d.formState.isValid||d.formState.isSubmitting;let D;e[41]!==d.formState.isSubmitting?(D=d.formState.isSubmitting?T.jsxs("span",{className:"flex items-center gap-2",children:[T.jsx(So,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=D):D=e[42];let M;e[43]!==a||e[44]!==_||e[45]!==D?(M=T.jsx(et,{type:"submit",form:a,disabled:_,children:D}),e[43]=a,e[44]=_,e[45]=D,e[46]=M):M=e[46];let q;e[47]!==N||e[48]!==M?(q=T.jsxs(aR,{children:[N,M]}),e[47]=N,e[48]=M,e[49]=q):q=e[49];let P;e[50]!==a||e[51]!==A||e[52]!==v||e[53]!==q?(P=T.jsxs("form",{id:a,className:"space-y-4 py-4",autoComplete:"off",onSubmit:A,children:[v,q]}),e[50]=a,e[51]=A,e[52]=v,e[53]=q,e[54]=P):P=e[54];let F;e[55]!==d||e[56]!==P?(F=T.jsx(lR,{...d,children:P}),e[55]=d,e[56]=P,e[57]=F):F=e[57];let $;e[58]!==x||e[59]!==F?($=T.jsxs(sR,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[x,F]}),e[58]=x,e[59]=F,e[60]=$):$=e[60];let G;return e[61]!==E||e[62]!==$?(G=T.jsx(oR,{open:!0,onOpenChange:E,children:$}),e[61]=E,e[62]=$,e[63]=G):G=e[63],G}function it(t){this.content=t}it.prototype={constructor:it,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new it(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new it(n)},addToStart:function(t,e){return new it([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new it(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new it(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=it.from(t),t.size?new it(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=it.from(t),t.size?new it(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=it.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};it.from=function(t){if(t instanceof it)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new it(e)};function Zx(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=Zx(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Qx(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=Qx(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class W{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=u},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new W(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new W(r,i)}cutByIndex(e,n){return e==n?W.empty:e==0&&n==this.content.length?this:new W(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new W(i,a)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Zx(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Qx(this,e,n,r)}findIndex(e){if(e==0)return Fa(0,e);if(e==this.size)return Fa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Fa(n+1,a):Fa(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return W.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new W(n||e,r)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const sl={index:0,offset:0};function Fa(t,e){return sl.index=t,sl.offset=e,sl}function ys(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ys(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ys(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let _e=class $h{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ys(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $h.none;if(e instanceof $h)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};_e.none=[];class Ts extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=ev(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(Jx(this.content,e+this.openStart,n+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,n){if(!n)return ee.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(W.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new ee(e,r,i)}}ee.empty=new ee(W.empty,0,0);function Jx(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Jx(a.content,e-i-1,n-i-1)))}function ev(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=ev(s.content,e-a-1,n,s);return o&&t.replaceChild(i,s.copy(o))}function wR(t,e,n){if(n.openStart>t.depth)throw new Ts("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ts("Inconsistent open depths");return tv(t,e,n,0)}function tv(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=tv(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return br(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=RR(n,t);return br(a,rv(t,s,o,e,r))}else return br(a,Ss(t,e,r))}function nv(t,e){if(!e.type.compatibleContent(t.type))throw new Ts("Cannot join "+e.type.name+" onto "+t.type.name)}function zh(t,e,n){let r=t.node(n);return nv(r,e.node(n)),r}function gr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ui(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(gr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)gr(i.child(o),r);e&&e.depth==n&&e.textOffset&&gr(e.nodeBefore,r)}function br(t,e){return t.type.checkContent(e),t.copy(e)}function rv(t,e,n,r,i){let a=t.depth>i&&zh(t,e,i+1),s=r.depth>i&&zh(n,r,i+1),o=[];return Ui(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(nv(a,s),gr(br(a,rv(t,e,n,r,i+1)),o)):(a&&gr(br(a,Ss(t,e,i+1)),o),Ui(e,n,i,o),s&&gr(br(s,Ss(n,r,i+1)),o)),Ui(r,null,i,o),new W(o)}function Ss(t,e,n){let r=[];if(Ui(null,t,n,r),t.depth>n){let i=zh(t,e,n+1);gr(br(i,Ss(t,e,n+1)),r)}return Ui(e,null,n,r),new W(r)}function RR(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(W.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class aa{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new As(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(r.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new aa(n,r,a)}static resolveCached(e,n){let r=Lb.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Lb.set(e,r=new OR);let i=r.elts[r.i]=aa.resolve(e,n);return r.i=(r.i+1)%LR,i}}class OR{constructor(){this.elts=[],this.i=0}}const LR=12,Lb=new WeakMap;class As{constructor(e,n,r){this.$from=e,this.$to=n,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 DR=Object.create(null);let Xn=class qh{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||W.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,n,r,i=0){this.content.nodesBetween(e,n,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,n,r,i){return this.content.textBetween(e,n,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,n,r){return this.type==e&&ys(this.attrs,n||e.defaultAttrs||DR)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new qh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new qh(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),u=i.node(s).content.cut(i.pos-o,a.pos-o);return new ee(u,i.depth-s,a.depth-s)}replace(e,n,r){return wR(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return aa.resolveCached(this,e)}resolveNoCache(e){return aa.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.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()+")"),iv(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=W.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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),this.type.checkAttrs(this.attrs);let e=_e.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=W.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Xn.prototype.text=void 0;class ks extends Xn{constructor(e,n,r,i){if(super(e,n,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):iv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ks(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ks(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function iv(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class kr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new MR(e,n);if(r.next==null)return kr.empty;let i=av(r);r.next&&r.err("Unexpected trailing text");let a=zR($R(i));return qR(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return W.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=a(d,o.concat(c));if(f)return f}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
2
2
  `)}}kr.empty=new kr(!0);class MR{constructor(e,n){this.string=e,this.nodeTypes=n,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 av(t){let e=[];do e.push(PR(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function PR(t){let e=[];do e.push(FR(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function FR(t){let e=HR(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=BR(t,e);else break;return e}function Db(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function BR(t,e){let n=Db(t),r=n;return t.eat(",")&&(t.next!="}"?r=Db(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function UR(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let s=n[a];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function HR(t){if(t.eat("(")){let e=av(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=UR(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $R(t){let e=[[]];return i(a(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,l){let u={term:l,to:o};return e[s].push(u),u}function i(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(a(u,o)),[]);if(s.type=="seq")for(let l=0;;l++){let u=a(s.exprs[l],o);if(l==s.exprs.length-1)return u;i(u,o=n())}else if(s.type=="star"){let l=n();return r(o,l),i(a(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(a(s.expr,o),l),i(a(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let u=0;u<s.min;u++){let c=n();i(a(s.expr,l),c),l=c}if(s.max==-1)i(a(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),i(a(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function sv(t,e){return e-t}function Mb(t,e){let n=[];return r(e),n.sort(sv);function r(i){let a=t[i];if(a.length==1&&!a[0].term)return r(a[0].to);n.push(i);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&n.indexOf(l)==-1&&r(l)}}}function zR(t){let e=Object.create(null);return n(Mb(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let u;for(let c=0;c<i.length;c++)i[c][0]==o&&(u=i[c][1]);Mb(t,l).forEach(c=>{u||i.push([o,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let a=e[r.join(",")]=new kr(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let o=i[s][1].sort(sv);a.next.push({type:i[s][0],next:e[o.join(",")]||n(o)})}return a}}function qR(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],a=!i.validEnd,s=[];for(let o=0;o<i.next.length;o++){let{type:l,next:u}=i.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),r.indexOf(u)==-1&&r.push(u)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ov(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function lv(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let a=t[r];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function uv(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let a=t[i];a.validate&&a.validate(e[i])}}function cv(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new GR(t,r,e[r]);return n}let Pb=class dv{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=cv(e,r.attrs),this.defaultAttrs=ov(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==kr.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:lv(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Xn(this,this.computeAttrs(e),W.from(n),_e.setFrom(r))}createChecked(e=null,n,r){return n=W.from(n),this.checkContent(n),new Xn(this,this.computeAttrs(e),n,_e.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=W.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(W.empty,!0);return a?new Xn(this,e,n.append(a),_e.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){uv(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:_e.none:e}static compile(e,n){let r=Object.create(null);e.forEach((a,s)=>r[a]=new dv(a,n,s));let i=n.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 a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function jR(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class GR{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?jR(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ko{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=cv(e,i.attrs),this.excluded=null;let a=ov(this.attrs);this.instance=a?new _e(this,a):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,lv(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,s)=>r[a]=new ko(a,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){uv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let pv=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=it.from(e.nodes),n.marks=it.from(e.marks||{}),this.nodes=Pb.compile(this.spec.nodes,this),this.marks=ko.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 a=this.nodes[i],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=r[s]||(r[s]=kr.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?Fb(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:Fb(this,s.split(" "))}this.nodeFromJSON=i=>Xn.fromJSON(this,i),this.markFromJSON=i=>_e.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Pb){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(n,r,i)}text(e,n){let r=this.nodes.text;return new ks(r,r.defaultAttrs,e,_e.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function Fb(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.marks[i],s=a;if(a)n.push(a);else for(let o in t.marks){let l=t.marks[o];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function VR(t){return t.tag!=null}function WR(t){return t.style!=null}class Zn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(VR(i))this.tags.push(i);else if(WR(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new Ub(this,n,!1);return r.addAll(e,_e.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Ub(this,n,!0);return r.addAll(e,_e.none,n.from,n.to),ee.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(XR(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,r,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let a=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(s=>{r(s=Hb(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(s=>{r(s=Hb(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Zn(e,Zn.schemaRules(e)))}}const fv={address:!0,article:!0,aside:!0,blockquote:!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},YR={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hv={ol:!0,ul:!0},sa=1,jh=2,Hi=4;function Bb(t,e,n){return e!=null?(e?sa:0)|(e==="full"?jh:0):t&&t.whitespace=="pre"?sa|jh:n&~Hi}class Ba{constructor(e,n,r,i,a,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=_e.none,this.match=a||(s&Hi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(W.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);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&sa)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=W.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(W.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!fv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ub{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,s=Bb(null,n.preserveWhitespace,0)|(r?Hi:0);i?a=new Ba(i.type,i.attrs,_e.none,!0,n.topMatch||i.type.contentMatch,s):r?a=new Ba(null,null,_e.none,!0,null,s):a=new Ba(e.schema.topNodeType,null,_e.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,a=i.options&jh?"full":this.localPreserveWS||(i.options&sa)>0,{schema:s}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=r.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[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 o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;hv.hasOwnProperty(s)&&this.parser.normalizeLists&&KR(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(l?l.ignore:YR.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);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 u,c=this.needsBlock;if(fv.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),u=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(a),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?o:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],s=r.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,r,i){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(a=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,r,i){let a=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=i==null?null:e.childNodes[i];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+o)&&(i=u,a=l,!u.length))break;if(l.solid){if(r)break;o+=2}}if(!i)return null;this.sync(a);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=_e.none;for(let o of i.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):$b(o.type,e.type))&&(s=o.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let a=this.findPlace(e.create(n),r,!1);return a&&(a=this.enterInner(e,n,r,!0,i)),a}enterInner(e,n,r,i=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=Bb(e,a,s.options);s.options&Hi&&s.content.length==0&&(o|=Hi);let l=_e.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):$b(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Ba(e,n,l,i,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=sa)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&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)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),s=(o,l)=>{for(;o>=0;o--){let u=n[o];if(u==""){if(o==n.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=a?r.node(l-a).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function KR(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&hv.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function XR(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Hb(t){let e={};for(let n in t)e[n]=t[n];return e}function $b(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:u,next:c}=o.edge(l);if(u==e||a.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class wr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ol(n).createDocumentFragment());let i=r,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(a[o][0])||u.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)i=a.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(a.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=ss(ol(n),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,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&ss(ol(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return ss(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new wr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=zb(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return zb(e.marks)}}function zb(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ol(t){return t.document||window.document}const qb=new WeakMap;function ZR(t){let e=qb.get(t);return e===void 0&&qb.set(t,e=QR(t)),e}function QR(t){let e=null;function n(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++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function ss(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(a=ZR(r))&&a.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 s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:h}=ss(t,f,n,r);if(l.appendChild(p),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}const mv=65535,gv=Math.pow(2,16);function JR(t,e){return t+e*gv}function jb(t){return t&mv}function eO(t){return(t-(t&mv))/gv}const bv=1,Ev=2,ls=4,yv=8;class Gh{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&yv)>0}get deletedBefore(){return(this.delInfo&(bv|ls))>0}get deletedAfter(){return(this.delInfo&(Ev|ls))>0}get deletedAcross(){return(this.delInfo&ls)>0}}class Ut{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ut.empty)return Ut.empty}recover(e){let n=0,r=jb(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+eO(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[o+a],c=this.ranges[o+s],d=l+u;if(e<=d){let f=u?e==l?-1:e==d?1:n:n,p=l+i+(f<0?0:c);if(r)return p;let h=e==(n<0?l:d)?null:JR(o/3,e-l),g=e==l?Ev:e==d?bv:ls;return(n<0?e!=l:e!=d)&&(g|=yv),new Gh(p,g,h)}i+=c-u}return r?e+i:new Gh(e+i,0,null)}touches(e,n){let r=0,i=jb(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[o+a],c=l+u;if(e<=c&&o==i*3)return!0;r+=this.ranges[o+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let s=this.ranges[i],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),u=this.ranges[i+n],c=this.ranges[i+r];e(o,o+u,l,l+c),a+=c-u}}invert(){return new Ut(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ut.empty:new Ut(e<0?[0,-e,0]:[0,0,e])}}Ut.empty=new Ut([]);class oa{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new oa(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new oa;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(o.recover);continue}}i|=o.delInfo,e=o.pos}return r?e:new Gh(e,i,null)}}const ll=Object.create(null);class ht{getMap(){return Ut.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ll[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in ll)throw new RangeError("Duplicate use of step JSON ID "+e);return ll[e]=n,n.prototype.jsonID=e,n}}class Ge{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ge(e,null)}static fail(e){return new Ge(null,e)}static fromReplace(e,n,r,i){try{return Ge.ok(e.replace(n,r,i))}catch(a){if(a instanceof Ts)return Ge.fail(a.message);throw a}}}function Ym(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(Ym(a.content,e,a))),a.isInline&&(a=e(a,n,i)),r.push(a)}return W.fromArray(r)}class Gn extends ht{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),a=new ee(Ym(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Ge.fromReplace(e,this.from,this.to,a)}invert(){return new tn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Gn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gn(n.from,n.to,e.markFromJSON(n.mark))}}ht.jsonID("addMark",Gn);class tn extends ht{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ee(Ym(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ge.fromReplace(e,this.from,this.to,r)}invert(){return new Gn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new tn(n.pos,r.pos,this.mark)}merge(e){return e instanceof tn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new tn(n.from,n.to,e.markFromJSON(n.mark))}}ht.jsonID("removeMark",tn);class Vn extends ht{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ge.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ge.fromReplace(e,this.pos,this.pos+1,new ee(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Vn(this.pos,n.marks[i]);return new Vn(this.pos,this.mark)}}return new xr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vn(n.pos,e.markFromJSON(n.mark))}}ht.jsonID("addNodeMark",Vn);class xr extends ht{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ge.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ge.fromReplace(e,this.pos,this.pos+1,new ee(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Vn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new xr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xr(n.pos,e.markFromJSON(n.mark))}}ht.jsonID("removeNodeMark",xr);class Qe extends ht{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Vh(e,this.from,this.to)?Ge.fail("Structure replace would overwrite content"):Ge.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ut([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 n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Qe(n.pos,Math.max(n.pos,r.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 n=this.slice.size+e.slice.size==0?ee.empty:new ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Qe(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Qe(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Qe(n.from,n.to,ee.fromJSON(e,n.slice),!!n.structure)}}ht.jsonID("replace",Qe);class tt extends ht{constructor(e,n,r,i,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&(Vh(e,this.from,this.gapFrom)||Vh(e,this.gapTo,this.to)))return Ge.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ge.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ge.fromReplace(e,this.from,this.to,r):Ge.fail("Content does not fit in gap")}getMap(){return new Ut([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new tt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new tt(n.pos,r.pos,i,a,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new tt(n.from,n.to,n.gapFrom,n.gapTo,ee.fromJSON(e,n.slice),n.insert,!!n.structure)}}ht.jsonID("replaceAround",tt);function Vh(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let s=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function tO(t,e,n,r){let i=[],a=[],s,o;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,e),p=Math.min(u+l.nodeSize,n),h=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(h)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=p:i.push(s=new tn(f,p,d[g])));o&&o.to==f?o.to=p:a.push(o=new Gn(f,p,r))}}),i.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function nO(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(r instanceof ko){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(o+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],f;for(let p=0;p<i.length;p++){let h=i[p];h.step==a-1&&d.eq(i[p].style)&&(f=h)}f?(f.to=u,f.step=a):i.push({style:d,from:Math.max(o,e),to:u,step:a})}}}),i.forEach(s=>t.step(new tn(s.from,s.to,s.style)))}function Km(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<a.childCount;l++){let u=a.child(l),c=o+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new Qe(o,c,ee.empty));else{r=d;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new tn(o,c,u.marks[f]));if(i&&u.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(u.text);)h||(h=new ee(W.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new Qe(o+f.index,o+f.index+f[0].length,h))}}o=c}if(!r.validEnd){let l=r.fillBefore(W.empty,!0);t.replace(o,o,new ee(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function rO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function hi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let s=t.$from.node(r),o=t.$from.index(r)+i,l=t.$to.indexAfter(r)-a;if(r<t.depth&&s.canReplace(o,l,n))return r;if(r==0||s.type.spec.isolating||!rO(s,o,l))break;o&&(i=1),l<s.childCount&&(a=1)}return null}function iO(t,e,n){let{$from:r,$to:i,depth:a}=e,s=r.before(a+1),o=i.after(a+1),l=s,u=o,c=W.empty,d=0;for(let h=a,g=!1;h>n;h--)g||r.index(h)>0?(g=!0,c=W.from(r.node(h).copy(c)),d++):l--;let f=W.empty,p=0;for(let h=a,g=!1;h>n;h--)g||i.after(h+1)<i.end(h)?(g=!0,f=W.from(i.node(h).copy(f)),p++):u++;t.step(new tt(l,u,s,o,new ee(c.append(f),d,p),c.size-d,!0))}function Xm(t,e,n=null,r=t){let i=aO(t,e),a=i&&sO(r,e);return a?i.map(Gb).concat({type:e,attrs:n}).concat(a.map(Gb)):null}function Gb(t){return{type:t,attrs:null}}function aO(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.contentMatchAt(r).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(r,i,s)?a:null}function sO(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.child(r),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:s}function oO(t,e,n){let r=W.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=W.from(n[s].type.create(n[s].attrs,r))}let i=e.start,a=e.end;t.step(new tt(i,a,i,a,new ee(r,0,0),n.length,!0))}function lO(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&uO(t.doc,t.mapping.slice(a).map(o),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?u=!1:!p&&h&&(u=!0)}u===!1&&Sv(t,s,o,a),Km(t,t.mapping.slice(a).map(o,1),r,void 0,u===null);let c=t.mapping.slice(a),d=c.map(o,1),f=c.map(o+s.nodeSize,1);return t.step(new tt(d,f,d+1,f-1,new ee(W.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Tv(t,s,o,a),!1}})}function Tv(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(i.text);){let l=t.mapping.slice(r).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Sv(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
@@ -9,7 +9,7 @@ import{r as U,c as ae,o as Nx,h as Cw,k as _w,j as T,s as Nb,a2 as Ix,b$ as wx,b
9
9
  `);return{dom:l,text:f,slice:e}}function oC(t,e,n,r,i){let a=i.parent.type.spec.code,s,o;if(!n&&!e)return null;let l=!!e&&(r||a||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,a||r,t)}),a)return o=new ee(W.from(t.state.schema.text(e.replace(/\r\n?/g,`
10
10
  `))),0,0),t.someProp("transformPasted",f=>{o=f(o,t,!0)}),o;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)o=d;else{let f=i.marks(),{schema:p}=t.state,h=wr.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=s.appendChild(document.createElement("p"));g&&b.appendChild(h.serializeNode(p.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=PL(n),Ca&&FL(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(o||(o=(t.someProp("clipboardParser")||t.someProp("domParser")||Zn.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!LL.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)o=BL(yE(o,+c[1],+c[2]),c[4]);else if(o=ee.maxOpen(DL(o.content,i),!0),o.openStart||o.openEnd){let d=0,f=0;for(let p=o.content.firstChild;d<o.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=o.content.lastChild;f<o.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);o=yE(o,d,f)}return t.someProp("transformPasted",d=>{o=d(o,t,l)}),o}const LL=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function DL(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),a,s=[];if(t.forEach(o=>{if(!s)return;let l=i.findWrapping(o.type),u;if(!l)return s=null;if(u=s.length&&a.length&&uC(l,a,o,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=cC(s[s.length-1],a.length));let c=lC(o,l);s.push(c),i=i.matchType(c.type),a=l}}),s)return W.from(s)}return t}function lC(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,W.from(t));return t}function uC(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let a=uC(t,e,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(W.from(lC(n,t,i+1))))}}function cC(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,cC(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(W.empty,!0);return t.copy(n.append(r))}function tm(t,e,n,r,i,a){let s=e<0?t.firstChild:t.lastChild,o=s.content;return t.childCount>1&&(a=0),i<r-1&&(o=tm(o,e,n,r,i+1,a)),i>=n&&(o=e<0?s.contentMatchAt(0).fillBefore(o,a<=i).append(o):o.append(s.contentMatchAt(s.childCount).fillBefore(W.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(o))}function yE(t,e,n){return e<t.openStart&&(t=new ee(tm(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ee(tm(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const dC={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let TE=null;function pC(){return TE||(TE=document.implementation.createHTMLDocument("title"))}let gl=null;function ML(t){let e=window.trustedTypes;return e?(gl||(gl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gl.createHTML(t)):t}function PL(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=pC().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&dC[r[1].toLowerCase()])&&(t=i.map(a=>"<"+a+">").join("")+t+i.map(a=>"</"+a+">").reverse().join("")),n.innerHTML=ML(t),i)for(let a=0;a<i.length;a++)n=n.querySelector(i[a])||n;return n}function FL(t){let e=t.querySelectorAll(ot?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function BL(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:a,openEnd:s}=t;for(let o=r.length-2;o>=0;o-=2){let l=n.nodes[r[o]];if(!l||l.hasRequiredAttrs())break;i=W.from(l.create(r[o+1],i)),a++,s++}return new ee(i,a,s)}const vt={},Ct={},UL={touchstart:!0,touchmove:!0};class HL{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function $L(t){for(let e in vt){let n=vt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{qL(t,r)&&!og(t,r)&&(t.editable||!(r.type in Ct))&&n(t,r)},UL[e]?{passive:!0}:void 0)}ft&&t.dom.addEventListener("input",()=>null),nm(t)}function Wn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function zL(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function nm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>og(t,r))})}function og(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function qL(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function jL(t,e){!og(t,e)&&vt[e.type]&&(t.editable||!(e.type in Ct))&&vt[e.type](t,e)}Ct.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!hC(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(xn&&ot&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ni&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,cr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||OL(t,n)?n.preventDefault():Wn(t,"key")};Ct.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ct.keypress=(t,e)=>{let n=e;if(hC(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Wt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof de)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,a))&&t.dispatch(a()),n.preventDefault()}};function Io(t){return{left:t.clientX,top:t.clientY}}function GL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function lg(t,e,n,r,i){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let s=a.depth+1;s>0;s--)if(t.someProp(e,o=>s>a.depth?o(t,n,a.nodeAfter,a.before(s),i,!0):o(t,n,a.node(s),a.before(s),i,!1)))return!0;return!1}function Xr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function VL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&le.isSelectable(r)?(Xr(t,new le(n)),!0):!1}function WL(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof le&&(r=n.node);let a=t.state.doc.resolve(e);for(let s=a.depth+1;s>0;s--){let o=s>a.depth?a.nodeAfter:a.node(s);if(le.isSelectable(o)){r&&n.$from.depth>0&&s>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?i=a.before(n.$from.depth):i=a.before(s);break}}return i!=null?(Xr(t,le.create(t.state.doc,i)),!0):!1}function YL(t,e,n,r,i){return lg(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(i?WL(t,n):VL(t,n))}function KL(t,e,n,r){return lg(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function XL(t,e,n,r){return lg(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||ZL(t,n,r)}function ZL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Xr(t,de.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let a=i.depth+1;a>0;a--){let s=a>i.depth?i.nodeAfter:i.node(a),o=i.before(a);if(s.inlineContent)Xr(t,de.create(r,o+1,o+1+s.content.size));else if(le.isSelectable(s))Xr(t,le.create(r,o));else continue;return!0}}function ug(t){return Cs(t)}const fC=Wt?"metaKey":"ctrlKey";vt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ug(t),i=Date.now(),a="singleClick";i-t.input.lastClick.time<500&&GL(n,t.input.lastClick)&&!n[fC]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let s=t.posAtCoords(Io(n));s&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new QL(t,s,n,!!r)):(a=="doubleClick"?KL:XL)(t,s.pos,s.inside,n)?n.preventDefault():Wn(t,"pointer"))};class QL{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[fC],this.allowDefault=r.shiftKey;let a,s;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);a=c.parent,s=c.depth?c.before():0}const o=i?null:r.target,l=o?e.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof le&&u.from<=s&&u.to>s)&&(this.mightDrag={node:a,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>In(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Io(e))),this.updateAllowDefault(e),this.allowDefault||!n?Wn(this.view,"pointer"):YL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ft&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Xr(this.view,ge.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Wn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}vt.touchstart=t=>{t.input.lastTouch=Date.now(),ug(t),Wn(t,"pointer")};vt.touchmove=t=>{t.input.lastTouch=Date.now(),Wn(t,"pointer")};vt.contextmenu=t=>ug(t);function hC(t,e){return t.composing?!0:ft&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const JL=xn?5e3:-1;Ct.compositionstart=Ct.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&Gv&&e2(t)))t.markCursor=t.state.storedMarks||n.marks(),Cs(t,!0),t.markCursor=null;else if(Cs(t,!e.selection.empty),Zt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let s=a<0?i.lastChild:i.childNodes[a-1];if(!s)break;if(s.nodeType==3){let o=t.domSelection();o&&o.collapse(s,s.nodeValue.length);break}else i=s,a=-1}}t.input.composing=!0}mC(t,JL)};function e2(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ct.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,mC(t,20))};function mC(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Cs(t),e))}function gC(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=n2());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function t2(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=WO(e.focusNode,e.focusOffset),r=YO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function n2(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Cs(t,e=!1){if(!(xn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),gC(t),e||t.docView&&t.docView.dirty){let n=ig(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function r2(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ua=Lt&&Qn<15||ni&&QO<604;vt.copy=Ct.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let a=ua?null:n.clipboardData,s=r.content(),{dom:o,text:l}=sg(t,s);a?(n.preventDefault(),a.clearData(),a.setData("text/html",o.innerHTML),a.setData("text/plain",l)):r2(t,o),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function i2(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function a2(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ca(t,r.value,null,i,e):ca(t,r.textContent,r.innerHTML,i,e)},50)}function ca(t,e,n,r,i){let a=oC(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,a||ee.empty)))return!0;if(!a)return!1;let s=i2(a),o=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(a);return t.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bC(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ct.paste=(t,e)=>{let n=e;if(t.composing&&!xn)return;let r=ua?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ca(t,bC(r),r.getData("text/html"),i,n)?n.preventDefault():a2(t,n)};class EC{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const s2=Wt?"altKey":"ctrlKey";function yC(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[s2]}vt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,a=i.empty?null:t.posAtCoords(Io(n)),s;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof le?i.to-1:i.to))){if(r&&r.mightDrag)s=le.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=le.create(t.state.doc,d.posBefore))}}let o=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=sg(t,o);(!n.dataTransfer.files.length||!ot||jv>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ua?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ua||n.dataTransfer.setData("text/plain",u),t.dragging=new EC(c,yC(t,n),s)};vt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ct.dragover=Ct.dragenter=(t,e)=>e.preventDefault();Ct.drop=(t,e)=>{try{o2(t,e,t.dragging)}finally{t.dragging=null}};function o2(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Io(e));if(!r)return;let i=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",p=>{a=p(a,t,!1)}):a=oC(t,bC(e.dataTransfer),ua?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&yC(t,e));if(t.someProp("handleDrop",p=>p(t,e,a||ee.empty,s))){e.preventDefault();return}if(!a)return;e.preventDefault();let o=a?kv(t.state.doc,i.pos,a):i.pos;o==null&&(o=i.pos);let l=t.state.tr;if(s){let{node:p}=n;p?p.replace(l):l.deleteSelection()}let u=l.mapping.map(o),c=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(d))return;let f=l.doc.resolve(u);if(c&&le.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new le(f));else{let p=l.mapping.map(o);l.mapping.maps[l.mapping.maps.length-1].forEach((h,g,b,E)=>p=E),l.setSelection(ag(t,f,l.doc.resolve(p)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}vt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&In(t)},20))};vt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};vt.beforeinput=(t,e)=>{if(ot&&xn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,cr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Ct)vt[t]=Ct[t];function da(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class _s{constructor(e,n){this.toDOM=e,this.spec=n||Er,this.side=this.spec.side||0}map(e,n,r,i){let{pos:a,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new dt(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof _s&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&da(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class er{constructor(e,n){this.attrs=e,this.spec=n||Er}map(e,n,r,i){let a=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=s?null:new dt(a,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof er&&da(this.attrs,e.attrs)&&da(this.spec,e.spec)}static is(e){return e.type instanceof er}destroy(){}}class cg{constructor(e,n){this.attrs=e,this.spec=n||Er}map(e,n,r,i){let a=e.mapResult(n.from+i,1);if(a.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=a.pos?null:new dt(a.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),a;return i==n.from&&!(a=e.child(r)).isText&&i+a.nodeSize==n.to}eq(e){return this==e||e instanceof cg&&da(this.attrs,e.attrs)&&da(this.spec,e.spec)}destroy(){}}class dt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new dt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new dt(e,e,new _s(n,r))}static inline(e,n,r,i){return new dt(e,n,new er(r,i))}static node(e,n,r,i){return new dt(e,n,new cg(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof er}get widget(){return this.type instanceof _s}}const zr=[],Er={};class Pe{constructor(e,n){this.local=e.length?e:zr,this.children=n.length?n:zr}static create(e,n){return n.length?Ns(n,e,0,Er):ct}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,a){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=n&&o.to>=e&&(!a||a(o.spec))&&r.push(o.copy(o.from+i,o.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,n-o,r,i+o,a)}}map(e,n,r){return this==ct||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Er)}mapInner(e,n,r,i,a){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):a.onRemove&&a.onRemove(this.local[o].spec)}return this.children.length?l2(this.children,s||[],e,n,r,i,a):s?new Pe(s.sort(yr),zr):ct}add(e,n){return n.length?this==ct?Pe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,a=0;e.forEach((o,l)=>{let u=l+r,c;if(c=SC(n,o,u)){for(i||(i=this.children.slice());a<i.length&&i[a]<l;)a+=3;i[a]==l?i[a+2]=i[a+2].addInner(o,c,u+1):i.splice(a,0,l,l+o.nodeSize,Ns(c,o,u+1,Er)),a+=3}});let s=TC(a?AC(n):n,-r);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new Pe(s.length?this.local.concat(s).sort(yr):this.local,i||this.children)}remove(e){return e.length==0||this==ct?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let a=0;a<r.length;a+=3){let s,o=r[a]+n,l=r[a+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>o&&d.to<l&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[a+2].removeInner(s,o+1);u!=ct?r[a+2]=u:(r.splice(a,3),a-=3)}if(i.length){for(let a=0,s;a<e.length;a++)if(s=e[a])for(let o=0;o<i.length;o++)i[o].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(o--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Pe(i,r):ct}forChild(e,n){if(this==ct)return this;if(n.isLeaf)return Pe.empty;let r,i;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(r=this.children[o+2]);break}let a=e+1,s=a+n.content.size;for(let o=0;o<this.local.length;o++){let l=this.local[o];if(l.from<s&&l.to>a&&l.type instanceof er){let u=Math.max(a,l.from)-a,c=Math.min(s,l.to)-a;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let o=new Pe(i.sort(yr),zr);return r?new qn([o,r]):o}return r||ct}eq(e){if(this==e)return!0;if(!(e instanceof Pe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return dg(this.localsInner(e))}localsInner(e){if(this==ct)return zr;if(e.inlineContent||!this.local.some(er.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof er||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Pe.empty=new Pe([],[]);Pe.removeOverlap=dg;const ct=Pe.empty;class qn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Er));return qn.from(r)}forChild(e,n){if(n.isLeaf)return Pe.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(e,n);a!=ct&&(a instanceof qn?r=r.concat(a.members):r.push(a))}return qn.from(r)}eq(e){if(!(e instanceof qn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(e);if(a.length)if(!n)n=a;else{r&&(n=n.slice(),r=!1);for(let s=0;s<a.length;s++)n.push(a[s])}}return n?dg(r?n:n.sort(yr)):zr}static from(e){switch(e.length){case 0:return ct;case 1:return e[0];default:return new qn(e.every(n=>n instanceof Pe)?e:e.reduce((n,r)=>n.concat(r instanceof Pe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function l2(t,e,n,r,i,a,s){let o=t.slice();for(let u=0,c=a;u<n.maps.length;u++){let d=0;n.maps[u].forEach((f,p,h,g)=>{let b=g-h-(p-f);for(let E=0;E<o.length;E+=3){let y=o[E+1];if(y<0||f>y+c-d)continue;let S=o[E]+c-d;p>=S?o[E+1]=f<=S?-2:-1:f>=c&&b&&(o[E]+=b,o[E+1]+=b)}d+=b}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<o.length;u+=3)if(o[u+1]<0){if(o[u+1]==-2){l=!0,o[u+1]=-1;continue}let c=n.map(t[u]+a),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[u+1]+a,-1),p=f-i,{index:h,offset:g}=r.content.findIndex(d),b=r.maybeChild(h);if(b&&g==d&&g+b.nodeSize==p){let E=o[u+2].mapInner(n,b,c+1,t[u]+a+1,s);E!=ct?(o[u]=d,o[u+1]=p,o[u+2]=E):(o[u+1]=-2,l=!0)}else l=!0}if(l){let u=u2(o,t,e,n,i,a,s),c=Ns(u,r,0,s);e=c.local;for(let d=0;d<o.length;d+=3)o[d+1]<0&&(o.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let p=c.children[d];for(;f<o.length&&o[f]<p;)f+=3;o.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Pe(e.sort(yr),o)}function TC(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new dt(i.from+e,i.to+e,i.type))}return n}function u2(t,e,n,r,i,a,s){function o(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,u);d?n.push(d):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)o(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&o(t[l+2],e[l]+a+1);return n}function SC(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let a=0,s;a<t.length;a++)(s=t[a])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[a]=null);return i}function AC(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ns(t,e,n,r){let i=[],a=!1;e.forEach((o,l)=>{let u=SC(t,o,l+n);if(u){a=!0;let c=Ns(u,o,n+l+1,r);c!=ct&&i.push(l,l+o.nodeSize,c)}});let s=TC(a?AC(t):t,-n).sort(yr);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||(r.onRemove&&r.onRemove(s[o].spec),s.splice(o--,1));return s.length||i.length?new Pe(s,i):ct}function yr(t,e){return t.from-e.from||t.to-e.to}function dg(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let a=e[i];if(a.from==r.from){a.to!=r.to&&(e==t&&(e=t.slice()),e[i]=a.copy(a.from,r.to),SE(e,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,a.from),SE(e,i,r.copy(a.from,r.to)));break}}}return e}function SE(t,e,n){for(;e<t.length&&yr(n,t[e])>0;)e++;t.splice(e,0,n)}function bl(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ct&&e.push(r)}),t.cursorWrapper&&e.push(Pe.create(t.state.doc,[t.cursorWrapper.deco])),qn.from(e)}const c2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},d2=Lt&&Qn<=11;class p2{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class f2{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new p2,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Lt&&Qn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ft&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),d2&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,c2)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(fE(this.view)){if(this.suppressingSelectionUpdates)return In(this.view);if(Lt&&Qn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&vr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let a=e.focusNode;a;a=ti(a))n.add(a);for(let a=e.anchorNode;a;a=ti(a))if(n.has(a)){r=a;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&fE(e)&&!this.ignoreSelectionChange(r),a=-1,s=-1,o=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(a=a<0?d.from:Math.min(d.from,a),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(o=!0))}if(l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}else if(Zt&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||g2(e,d)!=p)&&f.remove()}}}let u=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&_o(r)&&(u=ig(e))&&u.eq(ge.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,In(e),this.currentSelection.set(r),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,s),h2(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,b2(e,l)),this.handleDOMChange(a,s,o,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||In(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,a=e.nextSibling;if(Lt&&Qn<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(a=f)}let s=i&&i.parentNode==e.target?at(i)+1:0,o=r.localPosFromDOM(e.target,s,-1),l=a&&a.parentNode==e.target?at(a):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:o,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let AE=new WeakMap,kE=!1;function h2(t){if(!AE.has(t)&&(AE.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Zt,kE)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),kE=!0}}function xE(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,a=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return vr(s.node,s.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function m2(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return xE(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?xE(t,n):null}function g2(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function b2(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let a of e)if(((n=a.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=a.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let o=s;for(;;){let l=o.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;o=l}o.insertBefore(a,o.firstChild),r==a&&t.domSelection().collapse(a,i)}else a.parentNode.removeChild(a)}}function E2(t,e,n){let{node:r,fromOffset:i,toOffset:a,from:s,to:o}=t.docView.parseRange(e,n),l=t.domSelectionRange(),u,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],_o(l)||u.push({node:l.focusNode,offset:l.focusOffset})),ot&&t.input.lastKeyCode===8)for(let b=a;b>i;b--){let E=r.childNodes[b-1],y=E.pmViewDesc;if(E.nodeName=="BR"&&!y){a=b;break}if(!y||y.size)break}let d=t.state.doc,f=t.someProp("domParser")||Zn.fromSchema(t.state.schema),p=d.resolve(s),h=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:y2,context:p});if(u&&u[0].pos!=null){let b=u[0].pos,E=u[1]&&u[1].pos;E==null&&(E=b),h={anchor:b+s,head:E+s}}return{doc:g,sel:h,from:s,to:o}}function y2(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ft&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||ft&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const T2=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function S2(t,e,n,r,i){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let v=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,w=ig(t,v);if(w&&!t.state.selection.eq(w)){if(ot&&xn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",_=>_(t,cr(13,"Enter"))))return;let N=t.state.tr.setSelection(w);v=="pointer"?N.setMeta("pointer",!0):v=="key"&&N.scrollIntoView(),a&&N.setMeta("composition",a),t.dispatch(N)}return}let s=t.state.doc.resolve(e),o=s.sharedDepth(n);e=s.before(o+1),n=t.state.doc.resolve(n).after(o+1);let l=t.state.selection,u=E2(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=x2(d.content,u.doc.content,u.from,f,p);if(h&&t.input.domChangeCount++,(ni&&t.input.lastIOSEnter>Date.now()-225||xn)&&i.some(v=>v.nodeType==1&&!T2.test(v.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",v=>v(t,cr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof de&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let v=vE(t,t.state.doc,u.sel);if(v&&!v.eq(t.state.selection)){let w=t.state.tr.setSelection(v);a&&w.setMeta("composition",a),t.dispatch(w)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof de&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),Lt&&Qn<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>u.from&&u.doc.textBetween(h.start-u.from-1,h.start-u.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let g=u.doc.resolveNoCache(h.start-u.from),b=u.doc.resolveNoCache(h.endB-u.from),E=c.resolve(h.start),y=g.sameParent(b)&&g.parent.inlineContent&&E.end()>=h.endA;if((ni&&t.input.lastIOSEnter>Date.now()-225&&(!y||i.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!y&&g.pos<u.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(u.doc.textBetween(g.pos,b.pos,"","")))&&t.someProp("handleKeyDown",v=>v(t,cr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&k2(c,h.start,h.endA,g,b)&&t.someProp("handleKeyDown",v=>v(t,cr(8,"Backspace")))){xn&&ot&&t.domObserver.suppressSelectionUpdates();return}ot&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),xn&&!y&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==h.endA&&(h.endB-=2,b=u.doc.resolveNoCache(h.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(v){return v(t,cr(13,"Enter"))})},20));let S=h.start,k=h.endA,x=v=>{let w=v||t.state.tr.replace(S,k,u.doc.slice(h.start-u.from,h.endB-u.from));if(u.sel){let N=vE(t,w.doc,u.sel);N&&!(ot&&t.composing&&N.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==S||N.head==w.mapping.map(k)-1)||Lt&&N.empty&&N.head==S)&&w.setSelection(N)}return a&&w.setMeta("composition",a),w.scrollIntoView()},A;if(y)if(g.pos==b.pos){Lt&&Qn<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>In(t),20));let v=x(t.state.tr.delete(S,k)),w=c.resolve(h.start).marksAcross(c.resolve(h.endA));w&&v.ensureMarks(w),t.dispatch(v)}else if(h.endA==h.endB&&(A=A2(g.parent.content.cut(g.parentOffset,b.parentOffset),E.parent.content.cut(E.parentOffset,h.endA-E.start())))){let v=x(t.state.tr);A.type=="add"?v.addMark(S,k,A.mark):v.removeMark(S,k,A.mark),t.dispatch(v)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let v=g.parent.textBetween(g.parentOffset,b.parentOffset),w=()=>x(t.state.tr.insertText(v,S,k));t.someProp("handleTextInput",N=>N(t,S,k,v,w))||t.dispatch(w())}else t.dispatch(x());else t.dispatch(x())}function vE(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ag(t,e.resolve(n.anchor),e.resolve(n.head))}function A2(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,a=r,s,o,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)a=n[c].removeFromSet(a);if(i.length==1&&a.length==0)o=i[0],s="add",l=c=>c.mark(o.addToSet(c.marks));else if(i.length==0&&a.length==1)o=a[0],s="remove",l=c=>c.mark(o.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(W.from(u).eq(t))return{mark:o,type:s}}function k2(t,e,n,r,i){if(n-e<=i.pos-r.pos||El(r,!0,!1)<i.pos)return!1;let a=t.resolve(e);if(!r.parent.isTextblock){let o=a.nodeAfter;return o!=null&&n==e+o.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let s=t.resolve(El(a,!0,!0));return!s.parent.isTextblock||s.pos>n||El(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function El(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function x2(t,e,n,r,i){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:s,b:o}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,a-Math.min(s,o));r-=s+l-a}if(s<a&&t.size<e.size){let l=r<=a&&r>=s?a-r:0;a-=l,a&&a<e.size&&CE(e.textBetween(a-1,a+1))&&(a+=l?1:-1),o=a+(o-s),s=a}else if(o<a){let l=r<=a&&r>=o?a-r:0;a-=l,a&&a<t.size&&CE(t.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-o),o=a}return{start:a,endA:s,endB:o}}function CE(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class kC{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new HL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(RE),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=IE(this),NE(this),this.nodeViews=wE(this),this.docView=oE(this.state.doc,_E(this),bl(this),this.dom,this),this.domObserver=new f2(this,(r,i,a,s)=>S2(this,r,i,a,s)),this.domObserver.start(),$L(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&nm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(RE),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,a=!1,s=!1;e.storedMarks&&this.composing&&(gC(this),s=!0),this.state=e;let o=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(o||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=wE(this);C2(p,this.nodeViews)&&(this.nodeViews=p,a=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&nm(this),this.editable=IE(this),NE(this);let l=bl(this),u=_E(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=a||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(s=!0);let f=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&tL(this);if(s){this.domObserver.stop();let p=d&&(Lt||ot)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&v2(i.selection,e.selection);if(d){let h=ot?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=t2(this)),(a||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=oE(e.doc,u,l,this.dom,this)),h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&vL(this))?In(this,p):(iC(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&nL(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof le){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&tE(this,n.getBoundingClientRect(),e)}else tE(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let a=r.from+(this.state.doc.content.size-n.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==r.node&&(i=a)}this.dragging=new EC(e.slice,e.move,i<0?void 0:le.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let o=this.directPlugins[s].props[e];if(o!=null&&(i=n?n(o):o))return i}let a=this.state.plugins;if(a)for(let s=0;s<a.length;s++){let o=a[s].props[e];if(o!=null&&(i=n?n(o):o))return i}}hasFocus(){if(Lt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&rL(this.dom),In(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return lL(this,e)}coordsAtPos(e,n=1){return Xv(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return fL(this,n||this.state,e)}pasteHTML(e,n){return ca(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ca(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return sg(this,e)}destroy(){this.docView&&(zL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,GO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return jL(this,e)}domSelectionRange(){let e=this.domSelection();return e?ft&&this.root.nodeType===11&&XO(this.dom.ownerDocument)==this.dom&&m2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}kC.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function _E(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[dt.node(0,t.state.doc.content.size,e)]}function NE(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:dt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function IE(t){return!t.someProp("editable",e=>e(t.state)===!1)}function v2(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function wE(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function C2(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function RE(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var tr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Is={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_2=typeof navigator<"u"&&/Mac/.test(navigator.platform),N2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var st=0;st<10;st++)tr[48+st]=tr[96+st]=String(st);for(var st=1;st<=24;st++)tr[st+111]="F"+st;for(var st=65;st<=90;st++)tr[st]=String.fromCharCode(st+32),Is[st]=String.fromCharCode(st);for(var yl in tr)Is.hasOwnProperty(yl)||(Is[yl]=tr[yl]);function I2(t){var e=_2&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||N2&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Is:tr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const w2=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),R2=typeof navigator<"u"&&/Win/.test(navigator.platform);function O2(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,a,s;for(let o=0;o<e.length-1;o++){let l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))w2?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function L2(t){let e=Object.create(null);for(let n in t)e[O2(n)]=t[n];return e}function Tl(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function D2(t){return new Le({props:{handleKeyDown:xC(t)}})}function xC(t){let e=L2(t);return function(n,r){let i=I2(r),a,s=e[Tl(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let o=e[Tl(i,r,!1)];if(o&&o(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(R2&&r.ctrlKey&&r.altKey)&&(a=tr[r.keyCode])&&a!=i){let o=e[Tl(a,r)];if(o&&o(n.state,n.dispatch,n))return!0}}return!1}}var M2=Object.defineProperty,pg=(t,e)=>{for(var n in e)M2(t,n,{get:e[n],enumerable:!0})};function wo(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var Ro=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([s,o])=>[s,(...u)=>{const c=o(...u)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,s=[],o=!!t,l=t||i.tr,u=()=>(!o&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),s.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...h)=>{const g=this.buildProps(l,e),b=f(...h)(g);return s.push(b),c}])),run:u};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,a=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([o,l])=>[o,(...u)=>l(...u)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,s={tr:t,editor:r,view:a,state:wo({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([o,l])=>[o,(...u)=>l(...u)(s)]))}};return s}},vC={};pg(vC,{blur:()=>P2,clearContent:()=>F2,clearNodes:()=>B2,command:()=>U2,createParagraphNear:()=>H2,cut:()=>$2,deleteCurrentNode:()=>z2,deleteNode:()=>q2,deleteRange:()=>j2,deleteSelection:()=>G2,enter:()=>V2,exitCode:()=>W2,extendMarkRange:()=>Y2,first:()=>K2,focus:()=>Z2,forEach:()=>Q2,insertContent:()=>J2,insertContentAt:()=>nD,joinBackward:()=>aD,joinDown:()=>iD,joinForward:()=>sD,joinItemBackward:()=>oD,joinItemForward:()=>lD,joinTextblockBackward:()=>uD,joinTextblockForward:()=>cD,joinUp:()=>rD,keyboardShortcut:()=>pD,lift:()=>fD,liftEmptyBlock:()=>hD,liftListItem:()=>mD,newlineInCode:()=>gD,resetAttributes:()=>bD,scrollIntoView:()=>ED,selectAll:()=>yD,selectNodeBackward:()=>TD,selectNodeForward:()=>SD,selectParentNode:()=>AD,selectTextblockEnd:()=>kD,selectTextblockStart:()=>xD,setContent:()=>vD,setMark:()=>GD,setMeta:()=>VD,setNode:()=>WD,setNodeSelection:()=>YD,setTextDirection:()=>KD,setTextSelection:()=>XD,sinkListItem:()=>ZD,splitBlock:()=>QD,splitListItem:()=>JD,toggleList:()=>eM,toggleMark:()=>tM,toggleNode:()=>nM,toggleWrap:()=>rM,undoInputRule:()=>iM,unsetAllMarks:()=>aM,unsetMark:()=>sM,unsetTextDirection:()=>oM,updateAttributes:()=>lM,wrapIn:()=>uM,wrapInList:()=>cM});var P2=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),F2=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),B2=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:a,$to:s})=>{t.doc.nodesBetween(a.pos,s.pos,(o,l)=>{if(o.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),f=u.resolve(c.map(l+o.nodeSize)),p=d.blockRange(f);if(!p)return;const h=hi(p);if(o.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,g)}(h||h===0)&&e.lift(p,h)})}),!0},U2=t=>e=>t(e),H2=()=>({state:t,dispatch:e})=>Uv(t,e),$2=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,a=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,a.content),r.setSelection(new de(r.doc.resolve(Math.max(s-1,0)))),!0},z2=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(e){const o=i.before(a),l=i.after(a);t.delete(o,l).scrollIntoView()}return!0}return!1};function Ve(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var q2=t=>({tr:e,state:n,dispatch:r})=>{const i=Ve(t,n.schema),a=e.selection.$anchor;for(let s=a.depth;s>0;s-=1)if(a.node(s).type===i){if(r){const l=a.before(s),u=a.after(s);e.delete(l,u).scrollIntoView()}return!0}return!1},j2=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},G2=()=>({state:t,dispatch:e})=>Qm(t,e),V2=()=>({commands:t})=>t.keyboardShortcut("Enter"),W2=()=>({state:t,dispatch:e})=>wO(t,e);function fg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ws(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:fg(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function CC(t,e,n={}){return t.find(r=>r.type===e&&ws(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function OE(t,e,n={}){return!!CC(t,e,n)}function hg(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!CC([...i.node.marks],e,n)))return;let s=i.index,o=t.start()+i.offset,l=s+1,u=o+i.node.nodeSize;for(;s>0&&OE([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&OE([...t.parent.child(l).marks],e,n);)u+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:u}}function Ln(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Y2=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const a=Ln(t,r.schema),{doc:s,selection:o}=n,{$from:l,from:u,to:c}=o;if(i){const d=hg(l,a,e);if(d&&d.from<=u&&d.to>=c){const f=de.create(s,d.from,d.to);n.setSelection(f)}}return!0},K2=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function _C(t){return t instanceof de}function fr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function NC(t,e=null){if(!e)return null;const n=ge.atStart(t),r=ge.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,a=r.to;return e==="all"?de.create(t,fr(0,i,a),fr(t.content.size,i,a)):de.create(t,fr(e,i,a),fr(e,i,a))}function rm(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function pa(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function X2(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Z2=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:a})=>{e={scrollIntoView:!0,...e};const s=()=>{(pa()||rm())&&r.dom.focus(),X2()&&!pa()&&!rm()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(a&&t===null&&!_C(n.state.selection))return s(),!0;const o=NC(i.doc,t)||n.state.selection,l=n.state.selection.eq(o);return a&&(l||i.setSelection(o),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},Q2=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),J2=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),IC=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&IC(r)}return t};function Ha(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return IC(n)}function fa(t,e,n){if(t instanceof Xn||t instanceof W)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return W.fromArray(t.map(o=>e.nodeFromJSON(o)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),fa("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,o="";const l=new pv({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,o=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?Zn.fromSchema(l).parseSlice(Ha(t),n.parseOptions):Zn.fromSchema(l).parse(Ha(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const a=Zn.fromSchema(e);return n.slice?a.parseSlice(Ha(t),n.parseOptions).content:a.parse(Ha(t),n.parseOptions)}return fa("",e,n)}function eD(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Qe||i instanceof tt))return;const a=t.mapping.maps[r];let s=0;a.forEach((o,l,u,c)=>{s===0&&(s=c)}),t.setSelection(ge.near(t.doc.resolve(s),n))}var tD=t=>!("type"in t),nD=(t,e,n)=>({tr:r,dispatch:i,editor:a})=>{var s;if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let o;const l=b=>{a.emit("contentError",{editor:a,error:b,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{fa(e,a.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(b){l(b)}try{o=fa(e,a.schema,{parseOptions:u,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:a.options.enableContentCheck})}catch(b){return l(b),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((tD(o)?o:[o]).forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,p=p?b.isBlock:!1}),c===d&&p){const{parent:b}=r.doc.resolve(c);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(c-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof W){let b="";e.forEach(E=>{E.text&&(b+=E.text)}),g=b}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,c,d)}else{g=o;const b=r.doc.resolve(c),E=b.node(),y=b.parentOffset===0,S=E.isText||E.isTextblock,k=E.content.size>0;y&&S&&k&&(c=Math.max(0,c-1)),r.replaceWith(c,d,g)}n.updateSelection&&eD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:g})}return!0},rD=()=>({state:t,dispatch:e})=>_O(t,e),iD=()=>({state:t,dispatch:e})=>NO(t,e),aD=()=>({state:t,dispatch:e})=>Ov(t,e),sD=()=>({state:t,dispatch:e})=>Pv(t,e),oD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=xo(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},lD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=xo(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},uD=()=>({state:t,dispatch:e})=>vO(t,e),cD=()=>({state:t,dispatch:e})=>CO(t,e);function wC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function dD(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,a,s;for(let o=0;o<e.length-1;o+=1){const l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))pa()||wC()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var pD=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const a=dD(t).split(/-(?!$)/),s=a.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),o=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,o))});return l?.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function nr(t,e,n={}){const{from:r,to:i,empty:a}=t.selection,s=e?Ve(e,t.schema):null,o=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(i,f+d.nodeSize);o.push({node:d,from:p,to:h})});const l=i-r,u=o.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>ws(d.node.attrs,n,{strict:!1}));return a?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=l}var fD=(t,e={})=>({state:n,dispatch:r})=>{const i=Ve(t,n.schema);return nr(n,i,e)?IO(n,r):!1},hD=()=>({state:t,dispatch:e})=>Hv(t,e),mD=t=>({state:e,dispatch:n})=>{const r=Ve(t,e.schema);return $O(r)(e,n)},gD=()=>({state:t,dispatch:e})=>Bv(t,e);function Oo(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function LE(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var bD=(t,e)=>({tr:n,state:r,dispatch:i})=>{let a=null,s=null;const o=Oo(typeof t=="string"?t:t.name,r.schema);if(!o)return!1;o==="node"&&(a=Ve(t,r.schema)),o==="mark"&&(s=Ln(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{a&&a===c.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,LE(c.attrs,e))),s&&c.marks.length&&c.marks.forEach(f=>{s===f.type&&(l=!0,i&&n.addMark(d,d+c.nodeSize,s.create(LE(f.attrs,e))))})})}),l},ED=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),yD=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ht(t.doc);t.setSelection(n)}return!0},TD=()=>({state:t,dispatch:e})=>Dv(t,e),SD=()=>({state:t,dispatch:e})=>Fv(t,e),AD=()=>({state:t,dispatch:e})=>LO(t,e),kD=()=>({state:t,dispatch:e})=>PO(t,e),xD=()=>({state:t,dispatch:e})=>MO(t,e);function im(t,e,n={},r={}){return fa(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var vD=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:s,commands:o})=>{const{doc:l}=a;if(r.preserveWhitespace!=="full"){const u=im(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&a.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!n),!0}return s&&a.setMeta("preventUpdate",!n),o.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function RC(t,e){const n=Ln(e,t.schema),{from:r,to:i,empty:a}=t.selection,s=[];a?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const o=s.find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function OC(t,e){const n=new Nv(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function CD(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function _D(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,a)=>{n(i)&&r.push({node:i,pos:a})}),r}function ND(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Lo(t){return e=>ND(e.$from,t)}function oe(t,e,n){return t.config[e]===void 0&&t.parent?oe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?oe(t.parent,e,n):null}):t.config[e]}function mg(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=oe(e,"addExtensions",n);return r?[e,...mg(r())]:e}).flat(10)}function gg(t,e){const n=wr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function LC(t){return typeof t=="function"}function ke(t,e=void 0,...n){return LC(t)?e?t.bind(e)(...n):t(...n):t}function ID(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ri(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function DC(t){const e=[],{nodeExtensions:n,markExtensions:r}=ri(t),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const o={name:s.name,options:s.options,storage:s.storage,extensions:i},l=oe(s,"addGlobalAttributes",o);if(!l)return;l().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...a,...p}})})})})}),i.forEach(s=>{const o={name:s.name,options:s.options,storage:s.storage},l=oe(s,"addAttributes",o);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const f={...a,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:c,attribute:f})})}),e}function We(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}if(i==="class"){const o=a?String(a).split(" "):[],l=r[i]?r[i].split(" "):[],u=o.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){const o=a?a.split(";").map(c=>c.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;l.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());u.set(d,f)}),o.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());u.set(d,f)}),r[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=a}),r},{})}function ii(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>We(n,r),{})}function wD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function DE(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((a,s)=>{const o=s.attribute.parseHTML?s.attribute.parseHTML(n):wD(n.getAttribute(s.name));return o==null?a:{...a,[s.name]:o}},{});return{...r,...i}}}}function ME(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&ID(n)?!1:n!=null))}function PE(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function RD(t,e){var n;const r=DC(t),{nodeExtensions:i,markExtensions:a}=ri(t),s=(n=i.find(u=>oe(u,"topNode")))==null?void 0:n.name,o=Object.fromEntries(i.map(u=>{const c=r.filter(E=>E.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((E,y)=>{const S=oe(y,"extendNodeSchema",d);return{...E,...S?S(u):{}}},{}),p=ME({...f,content:ke(oe(u,"content",d)),marks:ke(oe(u,"marks",d)),group:ke(oe(u,"group",d)),inline:ke(oe(u,"inline",d)),atom:ke(oe(u,"atom",d)),selectable:ke(oe(u,"selectable",d)),draggable:ke(oe(u,"draggable",d)),code:ke(oe(u,"code",d)),whitespace:ke(oe(u,"whitespace",d)),linebreakReplacement:ke(oe(u,"linebreakReplacement",d)),defining:ke(oe(u,"defining",d)),isolating:ke(oe(u,"isolating",d)),attrs:Object.fromEntries(c.map(PE))}),h=ke(oe(u,"parseHTML",d));h&&(p.parseDOM=h.map(E=>DE(E,c)));const g=oe(u,"renderHTML",d);g&&(p.toDOM=E=>g({node:E,HTMLAttributes:ii(E,c)}));const b=oe(u,"renderText",d);return b&&(p.toText=b),[u.name,p]})),l=Object.fromEntries(a.map(u=>{const c=r.filter(b=>b.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((b,E)=>{const y=oe(E,"extendMarkSchema",d);return{...b,...y?y(u):{}}},{}),p=ME({...f,inclusive:ke(oe(u,"inclusive",d)),excludes:ke(oe(u,"excludes",d)),group:ke(oe(u,"group",d)),spanning:ke(oe(u,"spanning",d)),code:ke(oe(u,"code",d)),attrs:Object.fromEntries(c.map(PE))}),h=ke(oe(u,"parseHTML",d));h&&(p.parseDOM=h.map(b=>DE(b,c)));const g=oe(u,"renderHTML",d);return g&&(p.toDOM=b=>g({mark:b,HTMLAttributes:ii(b,c)})),[u.name,p]}));return new pv({topNode:s,nodes:o,marks:l})}function OD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Rs(t){return t.sort((n,r)=>{const i=oe(n,"priority")||100,a=oe(r,"priority")||100;return i>a?-1:i<a?1:0})}function MC(t){const e=Rs(mg(t)),n=OD(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function PC(t,e,n){const{from:r,to:i}=e,{blockSeparator:a=`
11
11
 
12
- `,textSerializers:s={}}=n||{};let o="";return t.nodesBetween(r,i,(l,u,c,d)=>{var f;l.isBlock&&u>r&&(o+=a);const p=s?.[l.type.name];if(p)return c&&(o+=p({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(o+=(f=l?.text)==null?void 0:f.slice(Math.max(r,u)-u,i-u))}),o}function LD(t,e){const n={from:0,to:t.content.size};return PC(t,n,e)}function FC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function DD(t,e){const n=Ve(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,o=>{a.push(o)});const s=a.reverse().find(o=>o.type.name===n.name);return s?{...s.attrs}:{}}function BC(t,e){const n=Oo(typeof e=="string"?e:e.name,t.schema);return n==="node"?DD(t,e):n==="mark"?RC(t,e):{}}function MD(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function PD(t){const e=MD(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,s)=>s!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function UC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,a)=>{const s=[];if(i.ranges.length)i.forEach((o,l)=>{s.push({from:o,to:l})});else{const{from:o,to:l}=n[a];if(o===void 0||l===void 0)return;s.push({from:o,to:l})}s.forEach(({from:o,to:l})=>{const u=e.slice(a).map(o,-1),c=e.slice(a).map(l),d=e.invert().map(u,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),PD(r)}function bg(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const a=n.resolve(t),s=hg(a,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,a)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:a,to:a+i.nodeSize,mark:s})))}),r}var FD=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let a=r,s=null;for(;a>0&&s===null;){const o=i.node(a);o?.type.name===e?s=o:a-=1}return[s,a]};function $a(t,e){return e.nodes[t]||e.marks[t]||null}function us(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var BD=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,s,o)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:a,parent:s,index:o}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-a))}),n};function am(t,e,n={}){const{empty:r,ranges:i}=t.selection,a=e?Ln(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>a?a.name===d.type.name:!0).find(d=>ws(d.attrs,n,{strict:!1}));let s=0;const o=[];if(i.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;t.doc.nodesBetween(p,h,(g,b)=>{if(!g.isText&&!g.marks.length)return;const E=Math.max(p,b),y=Math.min(h,b+g.nodeSize),S=y-E;s+=S,o.push(...g.marks.map(k=>({mark:k,from:E,to:y})))})}),s===0)return!1;const l=o.filter(d=>a?a.name===d.mark.type.name:!0).filter(d=>ws(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=o.filter(d=>a?d.mark.type!==a&&d.mark.type.excludes(a):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+u:l)>=s}function UD(t,e,n={}){if(!e)return nr(t,null,n)||am(t,null,n);const r=Oo(e,t.schema);return r==="node"?nr(t,e,n):r==="mark"?am(t,e,n):!1}var HD=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const a=Lo(o=>o.type.name===e)(t.selection);if(!a)return!1;const s=t.doc.resolve(a.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},$D=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function FE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function BE(t,e){const{nodeExtensions:n}=ri(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=ke(oe(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function Do(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(a=>{i!==!1&&(Do(a,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function HC(t){return t instanceof le}var $C=class zC{constructor(e){this.position=e}static fromJSON(e){return new zC(e.position)}toJSON(){return{position:this.position}}};function zD(t,e){const n=e.mapping.mapResult(t.position);return{position:new $C(n.pos),mapResult:n}}function qD(t){return new $C(t)}function jD(t,e,n){var r;const{selection:i}=e;let a=null;if(_C(i)&&(a=i.$cursor),a){const o=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(o)||!o.some(u=>u.type.excludes(n)))}const{ranges:s}=i;return s.some(({$from:o,$to:l})=>{let u=o.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(o.pos,l.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=p&&h}return!u}),u})}var GD=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=n,{empty:s,ranges:o}=a,l=Ln(t,r.schema);if(i)if(s){const u=RC(r,l);n.addStoredMark(l.create({...u,...e}))}else o.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,p)=>{const h=Math.max(p,c),g=Math.min(p+f.nodeSize,d);f.marks.find(E=>E.type===l)?f.marks.forEach(E=>{l===E.type&&n.addMark(h,g,l.create({...E.attrs,...e}))}):n.addMark(h,g,l.create(e))})});return jD(r,n,l)},VD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),WD=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const a=Ve(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:o})=>Qb(a,{...s,...e})(n)?!0:o.clearNodes()).command(({state:o})=>Qb(a,{...s,...e})(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},YD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=fr(t,0,r.content.size),a=le.create(r,i);e.setSelection(a)}return!0},KD=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=r;let s,o;return typeof e=="number"?(s=e,o=e):e&&"from"in e&&"to"in e?(s=e.from,o=e.to):(s=a.from,o=a.to),i&&n.doc.nodesBetween(s,o,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},XD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,s=de.atStart(r).from,o=de.atEnd(r).to,l=fr(i,s,o),u=fr(a,s,o),c=de.create(r,l,u);e.setSelection(c)}return!0},ZD=t=>({state:e,dispatch:n})=>{const r=Ve(t,e.schema);return jO(r)(e,n)};function UE(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var QD=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:a,doc:s}=e,{$from:o,$to:l}=a,u=i.extensionManager.attributes,c=us(u,o.node().type.name,o.node().attrs);if(a instanceof le&&a.node.isBlock)return!o.parentOffset||!Nn(s,o.pos)?!1:(r&&(t&&UE(n,i.extensionManager.splittableMarks),e.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=o.depth===0?void 0:CD(o.node(-1).contentMatchAt(o.indexAfter(-1)));let p=d&&f?[{type:f,attrs:c}]:void 0,h=Nn(e.doc,e.mapping.map(o.pos),1,p);if(!p&&!h&&Nn(e.doc,e.mapping.map(o.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:c}]:void 0),r){if(h&&(a instanceof de&&e.deleteSelection(),e.split(e.mapping.map(o.pos),1,p),f&&!d&&!o.parentOffset&&o.parent.type!==f)){const g=e.mapping.map(o.before()),b=e.doc.resolve(g);o.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(o.before()),f)}t&&UE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},JD=(t,e={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var s;const o=Ve(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==o)return!1;const f=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let E=W.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let w=l.depth-y;w>=l.depth-3;w-=1)E=W.from(l.node(w).copy(E));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...us(f,l.node().type.name,l.node().attrs),...e},x=((s=o.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;E=E.append(W.from(o.createAndFill(null,x)||void 0));const A=l.before(l.depth-(y-1));n.replace(A,l.after(-S),new ee(E,4-y,0));let v=-1;n.doc.nodesBetween(A,n.doc.content.size,(w,N)=>{if(v>-1)return!1;w.isTextblock&&w.content.size===0&&(v=N+1)}),v>-1&&n.setSelection(de.near(n.doc.resolve(v))),n.scrollIntoView()}return!0}const p=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...us(f,d.type.name,d.attrs),...e},g={...us(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const b=p?[{type:o,attrs:h},{type:p,attrs:g}]:[{type:o,attrs:h}];if(!Nn(n.doc,l.pos,2))return!1;if(i){const{selection:E,storedMarks:y}=r,{splittableMarks:S}=a.extensionManager,k=y||E.$to.parentOffset&&E.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!k||!i)return!0;const x=k.filter(A=>S.includes(A.type.name));n.ensureMarks(x)}return!0},Sl=(t,e)=>{const n=Lo(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&rr(t.doc,n.pos)&&t.join(n.pos),!0},Al=(t,e)=>{const n=Lo(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&rr(t.doc,r)&&t.join(r),!0},eM=(t,e,n,r={})=>({editor:i,tr:a,state:s,dispatch:o,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,p=Ve(t,s.schema),h=Ve(e,s.schema),{selection:g,storedMarks:b}=s,{$from:E,$to:y}=g,S=E.blockRange(y),k=b||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const x=Lo(A=>BE(A.type.name,d))(g);if(S.depth>=1&&x&&S.depth-x.depth<=1){if(x.node.type===p)return u.liftListItem(h);if(BE(x.node.type.name,d)&&p.validContent(x.node.content)&&o)return l().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>Sl(a,p)).command(()=>Al(a,p)).run()}return!n||!k||!o?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Sl(a,p)).command(()=>Al(a,p)).run():l().command(()=>{const A=c().wrapInList(p,r),v=k.filter(w=>f.includes(w.type.name));return a.ensureMarks(v),A?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Sl(a,p)).command(()=>Al(a,p)).run()},tM=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=n,s=Ln(t,r.schema);return am(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:a}):i.setMark(s,e)},nM=(t,e,n={})=>({state:r,commands:i})=>{const a=Ve(t,r.schema),s=Ve(e,r.schema),o=nr(r,a,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),o?i.setNode(s,l):i.setNode(a,{...l,...n})},rM=(t,e={})=>({state:n,commands:r})=>{const i=Ve(t,n.schema);return nr(n,i,e)?r.lift(i):r.wrapIn(i,e)},iM=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let a;if(i.spec.isInputRules&&(a=i.getState(t))){if(e){const s=t.tr,o=a.transform;for(let l=o.steps.length-1;l>=0;l-=1)s.step(o.steps[l].invert(o.docs[l]));if(a.text){const l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,l))}else s.delete(a.from,a.to)}return!0}}return!1},aM=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},sM=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=Ln(t,r.schema),{$from:u,empty:c,ranges:d}=o;if(!i)return!0;if(c&&s){let{from:f,to:p}=o;const h=(a=u.marks().find(b=>b.type===l))==null?void 0:a.attrs,g=hg(u,l,h);g&&(f=g.from,p=g.to),n.removeMark(f,p,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},oM=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let a,s;return typeof t=="number"?(a=t,s=t):t&&"from"in t&&"to"in t?(a=t.from,s=t.to):(a=i.from,s=i.to),r&&e.doc.nodesBetween(a,s,(o,l)=>{if(o.isText)return;const u={...o.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},lM=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let a=null,s=null;const o=Oo(typeof t=="string"?t:t.name,r.schema);if(!o)return!1;o==="node"&&(a=Ve(t,r.schema)),o==="mark"&&(s=Ln(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,p,h,g;n.selection.empty?r.doc.nodesBetween(c,d,(b,E)=>{a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),f=E,p=b)}):r.doc.nodesBetween(c,d,(b,E)=>{E<c&&a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),f=E,p=b),E>=c&&E<=d&&(a&&a===b.type&&(l=!0,i&&n.setNodeMarkup(E,void 0,{...b.attrs,...e})),s&&b.marks.length&&b.marks.forEach(y=>{if(s===y.type&&(l=!0,i)){const S=Math.max(E,c),k=Math.min(E+b.nodeSize,d);n.addMark(S,k,s.create({...y.attrs,...e}))}}))}),p&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(b=>{s===b.type&&i&&n.addMark(h,g,s.create({...b.attrs,...e}))}))}),l},uM=(t,e={})=>({state:n,dispatch:r})=>{const i=Ve(t,n.schema);return FO(i,e)(n,r)},cM=(t,e={})=>({state:n,dispatch:r})=>{const i=Ve(t,n.schema);return BO(i,e)(n,r)},dM=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Mo=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},pM=(t,e)=>{if(fg(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function za(t){var e;const{editor:n,from:r,to:i,text:a,rules:s,plugin:o}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=BD(u)+a;return s.forEach(f=>{if(c)return;const p=pM(d,f.find);if(!p)return;const h=l.state.tr,g=wo({state:l.state,transaction:h}),b={from:r-(p[0].length-a.length),to:i},{commands:E,chain:y,can:S}=new Ro({editor:n,state:g});f.handler({state:g,range:b,match:p,commands:E,chain:y,can:S})===null||!h.steps.length||(f.undoable&&h.setMeta(o,{transform:h,from:r,to:i,text:a}),l.dispatch(h),c=!0)}),c}function fM(t){const{editor:e,rules:n}=t,r=new Le({state:{init(){return null},apply(i,a,s){const o=i.getMeta(r);if(o)return o;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=gg(W.from(c),s.schema);const{from:d}=l,f=d+c.length;za({editor:e,from:d,to:f,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,s,o){return za({editor:e,from:a,to:s,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&za({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?za({editor:e,from:s.pos,to:s.pos,text:`
12
+ `,textSerializers:s={}}=n||{};let o="";return t.nodesBetween(r,i,(l,u,c,d)=>{var f;l.isBlock&&u>r&&(o+=a);const p=s?.[l.type.name];if(p)return c&&(o+=p({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(o+=(f=l?.text)==null?void 0:f.slice(Math.max(r,u)-u,i-u))}),o}function LD(t,e){const n={from:0,to:t.content.size};return PC(t,n,e)}function FC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function DD(t,e){const n=Ve(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,o=>{a.push(o)});const s=a.reverse().find(o=>o.type.name===n.name);return s?{...s.attrs}:{}}function BC(t,e){const n=Oo(typeof e=="string"?e:e.name,t.schema);return n==="node"?DD(t,e):n==="mark"?RC(t,e):{}}function MD(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function PD(t){const e=MD(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,s)=>s!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function UC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,a)=>{const s=[];if(i.ranges.length)i.forEach((o,l)=>{s.push({from:o,to:l})});else{const{from:o,to:l}=n[a];if(o===void 0||l===void 0)return;s.push({from:o,to:l})}s.forEach(({from:o,to:l})=>{const u=e.slice(a).map(o,-1),c=e.slice(a).map(l),d=e.invert().map(u,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),PD(r)}function bg(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const a=n.resolve(t),s=hg(a,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,a)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:a,to:a+i.nodeSize,mark:s})))}),r}var FD=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let a=r,s=null;for(;a>0&&s===null;){const o=i.node(a);o?.type.name===e?s=o:a-=1}return[s,a]};function $a(t,e){return e.nodes[t]||e.marks[t]||null}function us(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var BD=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,s,o)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:a,parent:s,index:o}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-a))}),n};function am(t,e,n={}){const{empty:r,ranges:i}=t.selection,a=e?Ln(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>a?a.name===d.type.name:!0).find(d=>ws(d.attrs,n,{strict:!1}));let s=0;const o=[];if(i.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;t.doc.nodesBetween(p,h,(g,b)=>{if(!g.isText&&!g.marks.length)return;const E=Math.max(p,b),y=Math.min(h,b+g.nodeSize),S=y-E;s+=S,o.push(...g.marks.map(k=>({mark:k,from:E,to:y})))})}),s===0)return!1;const l=o.filter(d=>a?a.name===d.mark.type.name:!0).filter(d=>ws(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=o.filter(d=>a?d.mark.type!==a&&d.mark.type.excludes(a):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+u:l)>=s}function UD(t,e,n={}){if(!e)return nr(t,null,n)||am(t,null,n);const r=Oo(e,t.schema);return r==="node"?nr(t,e,n):r==="mark"?am(t,e,n):!1}var HD=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const a=Lo(o=>o.type.name===e)(t.selection);if(!a)return!1;const s=t.doc.resolve(a.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},$D=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function FE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function BE(t,e){const{nodeExtensions:n}=ri(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=ke(oe(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function Do(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(a=>{i!==!1&&(Do(a,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function HC(t){return t instanceof le}var $C=class zC{constructor(e){this.position=e}static fromJSON(e){return new zC(e.position)}toJSON(){return{position:this.position}}};function zD(t,e){const n=e.mapping.mapResult(t.position);return{position:new $C(n.pos),mapResult:n}}function qD(t){return new $C(t)}function jD(t,e,n){var r;const{selection:i}=e;let a=null;if(_C(i)&&(a=i.$cursor),a){const o=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(o)||!o.some(u=>u.type.excludes(n)))}const{ranges:s}=i;return s.some(({$from:o,$to:l})=>{let u=o.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(o.pos,l.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=p&&h}return!u}),u})}var GD=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=n,{empty:s,ranges:o}=a,l=Ln(t,r.schema);if(i)if(s){const u=RC(r,l);n.addStoredMark(l.create({...u,...e}))}else o.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,p)=>{const h=Math.max(p,c),g=Math.min(p+f.nodeSize,d);f.marks.find(E=>E.type===l)?f.marks.forEach(E=>{l===E.type&&n.addMark(h,g,l.create({...E.attrs,...e}))}):n.addMark(h,g,l.create(e))})});return jD(r,n,l)},VD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),WD=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const a=Ve(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:o})=>Qb(a,{...s,...e})(n)?!0:o.clearNodes()).command(({state:o})=>Qb(a,{...s,...e})(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},YD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=fr(t,0,r.content.size),a=le.create(r,i);e.setSelection(a)}return!0},KD=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=r;let s,o;return typeof e=="number"?(s=e,o=e):e&&"from"in e&&"to"in e?(s=e.from,o=e.to):(s=a.from,o=a.to),i&&n.doc.nodesBetween(s,o,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},XD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,s=de.atStart(r).from,o=de.atEnd(r).to,l=fr(i,s,o),u=fr(a,s,o),c=de.create(r,l,u);e.setSelection(c)}return!0},ZD=t=>({state:e,dispatch:n})=>{const r=Ve(t,e.schema);return jO(r)(e,n)};function UE(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var QD=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:a,doc:s}=e,{$from:o,$to:l}=a,u=i.extensionManager.attributes,c=us(u,o.node().type.name,o.node().attrs);if(a instanceof le&&a.node.isBlock)return!o.parentOffset||!Nn(s,o.pos)?!1:(r&&(t&&UE(n,i.extensionManager.splittableMarks),e.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=o.depth===0?void 0:CD(o.node(-1).contentMatchAt(o.indexAfter(-1)));let p=d&&f?[{type:f,attrs:c}]:void 0,h=Nn(e.doc,e.mapping.map(o.pos),1,p);if(!p&&!h&&Nn(e.doc,e.mapping.map(o.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:c}]:void 0),r){if(h&&(a instanceof de&&e.deleteSelection(),e.split(e.mapping.map(o.pos),1,p),f&&!d&&!o.parentOffset&&o.parent.type!==f)){const g=e.mapping.map(o.before()),b=e.doc.resolve(g);o.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(o.before()),f)}t&&UE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},JD=(t,e={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var s;const o=Ve(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==o)return!1;const f=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let E=W.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let w=l.depth-y;w>=l.depth-3;w-=1)E=W.from(l.node(w).copy(E));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...us(f,l.node().type.name,l.node().attrs),...e},x=((s=o.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;E=E.append(W.from(o.createAndFill(null,x)||void 0));const A=l.before(l.depth-(y-1));n.replace(A,l.after(-S),new ee(E,4-y,0));let v=-1;n.doc.nodesBetween(A,n.doc.content.size,(w,N)=>{if(v>-1)return!1;w.isTextblock&&w.content.size===0&&(v=N+1)}),v>-1&&n.setSelection(de.near(n.doc.resolve(v))),n.scrollIntoView()}return!0}const p=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...us(f,d.type.name,d.attrs),...e},g={...us(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const b=p?[{type:o,attrs:h},{type:p,attrs:g}]:[{type:o,attrs:h}];if(!Nn(n.doc,l.pos,2))return!1;if(i){const{selection:E,storedMarks:y}=r,{splittableMarks:S}=a.extensionManager,k=y||E.$to.parentOffset&&E.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!k||!i)return!0;const x=k.filter(A=>S.includes(A.type.name));n.ensureMarks(x)}return!0},Sl=(t,e)=>{const n=Lo(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&rr(t.doc,n.pos)&&t.join(n.pos),!0},Al=(t,e)=>{const n=Lo(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&rr(t.doc,r)&&t.join(r),!0},eM=(t,e,n,r={})=>({editor:i,tr:a,state:s,dispatch:o,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,p=Ve(t,s.schema),h=Ve(e,s.schema),{selection:g,storedMarks:b}=s,{$from:E,$to:y}=g,S=E.blockRange(y),k=b||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const x=Lo(A=>BE(A.type.name,d))(g);if(S.depth>=1&&x&&S.depth-x.depth<=1){if(x.node.type===p)return u.liftListItem(h);if(BE(x.node.type.name,d)&&p.validContent(x.node.content)&&o)return l().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>Sl(a,p)).command(()=>Al(a,p)).run()}return!n||!k||!o?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Sl(a,p)).command(()=>Al(a,p)).run():l().command(()=>{const A=c().wrapInList(p,r),v=k.filter(w=>f.includes(w.type.name));return a.ensureMarks(v),A?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Sl(a,p)).command(()=>Al(a,p)).run()},tM=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=n,s=Ln(t,r.schema);return am(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:a}):i.setMark(s,e)},nM=(t,e,n={})=>({state:r,commands:i})=>{const a=Ve(t,r.schema),s=Ve(e,r.schema),o=nr(r,a,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),o?i.setNode(s,l):i.setNode(a,{...l,...n})},rM=(t,e={})=>({state:n,commands:r})=>{const i=Ve(t,n.schema);return nr(n,i,e)?r.lift(i):r.wrapIn(i,e)},iM=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let a;if(i.spec.isInputRules&&(a=i.getState(t))){if(e){const s=t.tr,o=a.transform;for(let l=o.steps.length-1;l>=0;l-=1)s.step(o.steps[l].invert(o.docs[l]));if(a.text){const l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,l))}else s.delete(a.from,a.to)}return!0}}return!1},aM=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},sM=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=Ln(t,r.schema),{$from:u,empty:c,ranges:d}=o;if(!i)return!0;if(c&&s){let{from:f,to:p}=o;const h=(a=u.marks().find(b=>b.type===l))==null?void 0:a.attrs,g=hg(u,l,h);g&&(f=g.from,p=g.to),n.removeMark(f,p,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},oM=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let a,s;return typeof t=="number"?(a=t,s=t):t&&"from"in t&&"to"in t?(a=t.from,s=t.to):(a=i.from,s=i.to),r&&e.doc.nodesBetween(a,s,(o,l)=>{if(o.isText)return;const u={...o.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},lM=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let a=null,s=null;const o=Oo(typeof t=="string"?t:t.name,r.schema);if(!o)return!1;o==="node"&&(a=Ve(t,r.schema)),o==="mark"&&(s=Ln(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,p,h,g;n.selection.empty?r.doc.nodesBetween(c,d,(b,E)=>{a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),f=E,p=b)}):r.doc.nodesBetween(c,d,(b,E)=>{E<c&&a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),f=E,p=b),E>=c&&E<=d&&(a&&a===b.type&&(l=!0,i&&n.setNodeMarkup(E,void 0,{...b.attrs,...e})),s&&b.marks.length&&b.marks.forEach(y=>{if(s===y.type&&(l=!0,i)){const S=Math.max(E,c),k=Math.min(E+b.nodeSize,d);n.addMark(S,k,s.create({...y.attrs,...e}))}}))}),p&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(b=>{s===b.type&&i&&n.addMark(h,g,s.create({...b.attrs,...e}))}))}),l},uM=(t,e={})=>({state:n,dispatch:r})=>{const i=Ve(t,n.schema);return FO(i,e)(n,r)},cM=(t,e={})=>({state:n,dispatch:r})=>{const i=Ve(t,n.schema);return BO(i,e)(n,r)},dM=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Mo=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},pM=(t,e)=>{if(fg(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function za(t){var e;const{editor:n,from:r,to:i,text:a,rules:s,plugin:o}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=BD(u)+a;return s.forEach(f=>{if(c)return;const p=pM(d,f.find);if(!p)return;const h=l.state.tr,g=wo({state:l.state,transaction:h}),b={from:r-(p[0].length-a.length),to:i},{commands:E,chain:y,can:S}=new Ro({editor:n,state:g});f.handler({state:g,range:b,match:p,commands:E,chain:y,can:S})===null||!h.steps.length||(f.undoable&&h.setMeta(o,{transform:h,from:r,to:i,text:a}),l.dispatch(h),c=!0)}),c}function fM(t){const{editor:e,rules:n}=t,r=new Le({state:{init(){return null},apply(i,a,s){const o=i.getMeta(r);if(o)return o;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=gg(W.from(c),s.schema);const{from:d}=l,f=d+c.length;za({editor:e,from:d,to:f,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,s,o){return za({editor:e,from:a,to:s,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&za({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?za({editor:e,from:s.pos,to:s.pos,text:`
13
13
  `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function hM(t){return Object.prototype.toString.call(t).slice(8,-1)}function qa(t){return hM(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function qC(t,e){const n={...t};return qa(t)&&qa(e)&&Object.keys(e).forEach(r=>{qa(e[r])&&qa(t[r])?n[r]=qC(t[r],e[r]):n[r]=e[r]}),n}var Eg=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...ke(oe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>qC(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Rr=class jC extends Eg{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jC(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(u=>u?.type.name===n.name))return!1;const l=s.find(u=>u?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function mM(t){return typeof t=="number"}var gM=class{constructor(t){this.find=t.find,this.handler=t.handler}},bM=(t,e,n)=>{if(fg(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const a=[i.text];return a.index=i.index,a.input=t,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function EM(t){const{editor:e,state:n,from:r,to:i,rule:a,pasteEvent:s,dropEvent:o}=t,{commands:l,chain:u,can:c}=new Ro({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(p,h)=>{var g,b,E,y,S;if((b=(g=p.type)==null?void 0:g.spec)!=null&&b.code||!(p.isText||p.isTextblock||p.isInline))return;const k=(S=(y=(E=p.content)==null?void 0:E.size)!=null?y:p.nodeSize)!=null?S:0,x=Math.max(r,h),A=Math.min(i,h+k);if(x>=A)return;const v=p.isText?p.text||"":p.textBetween(x-h,A-h,void 0,"");bM(v,a.find,s).forEach(N=>{if(N.index===void 0)return;const _=x+N.index+1,D=_+N[0].length,M={from:n.tr.mapping.map(_),to:n.tr.mapping.map(D)},q=a.handler({state:n,range:M,match:N,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:o});d.push(q)})}),d.every(p=>p!==null)}var ja=null,yM=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function TM(t){const{editor:e,rules:n}=t;let r=null,i=!1,a=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,o;try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}const l=({state:c,from:d,to:f,rule:p,pasteEvt:h})=>{const g=c.tr,b=wo({state:c,transaction:g});if(!(!EM({editor:e,state:b,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:o})||!g.steps.length)){try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(c=>new Le({view(d){const f=h=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(h.target)?d.dom.parentElement:null,r&&(ja=e)},p=()=>{ja&&(ja=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(a=r===d.dom.parentElement,o=f,!a){const p=ja;p?.isEditable&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,f)=>{var p;const h=(p=f.clipboardData)==null?void 0:p.getData("text/html");return s=f,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,p)=>{const h=d[0],g=h.getMeta("uiEvent")==="paste"&&!i,b=h.getMeta("uiEvent")==="drop"&&!a,E=h.getMeta("applyPasteRules"),y=!!E;if(!g&&!b&&!y)return;if(y){let{text:x}=E;typeof x=="string"?x=x:x=gg(W.from(x),p.schema);const{from:A}=E,v=A+x.length,w=yM(x);return l({rule:c,state:p,from:A,to:{b:v},pasteEvt:w})}const S=f.doc.content.findDiffStart(p.doc.content),k=f.doc.content.findDiffEnd(p.doc.content);if(!(!mM(S)||!k||S===k.b))return l({rule:c,state:p,from:S,to:k,pasteEvt:s})}}))}var Po=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=MC(t),this.schema=RD(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:$a(e.name,this.schema)},r=oe(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Rs([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:$a(r.name,this.schema)},a=[],s=oe(r,"addKeyboardShortcuts",i);let o={};if(r.type==="mark"&&oe(r,"exitable",i)&&(o.ArrowRight=()=>Rr.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([p,h])=>[p,()=>h({editor:t})]));o={...o,...f}}const l=D2(o);a.push(l);const u=oe(r,"addInputRules",i);if(FE(r,t.options.enableInputRules)&&u){const f=u();if(f&&f.length){const p=fM({editor:t,rules:f}),h=Array.isArray(p)?p:[p];a.push(...h)}}const c=oe(r,"addPasteRules",i);if(FE(r,t.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const p=TM({editor:t,rules:f});a.push(...p)}}const d=oe(r,"addProseMirrorPlugins",i);if(d){const f=d();a.push(...f)}return a})}get attributes(){return DC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ri(this.extensions);return Object.fromEntries(e.filter(n=>!!oe(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ve(n.name,this.schema)},a=oe(n,"addNodeView",i);if(!a)return[];const s=a();if(!s)return[];const o=(l,u,c,d,f)=>{const p=ii(l,r);return s({node:l,view:u,getPos:c,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:p})};return[n.name,o]}))}dispatchTransaction(t){const{editor:e}=this;return Rs([...this.extensions].reverse()).reduceRight((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:$a(i.name,this.schema)},s=oe(i,"dispatchTransaction",a);return s?o=>{s.call(a,{transaction:o,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=ri(this.extensions);return Object.fromEntries(e.filter(n=>!!oe(n,"addMarkView")).map(n=>{const r=this.attributes.filter(o=>o.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ln(n.name,this.schema)},a=oe(n,"addMarkView",i);if(!a)return[];const s=(o,l,u)=>{const c=ii(o,r);return a()({mark:o,view:l,inline:u,editor:t,extension:n,HTMLAttributes:c,updateAttributes:d=>{MM(o,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:$a(e.name,this.schema)};e.type==="mark"&&((n=ke(oe(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=oe(e,"onBeforeCreate",r),a=oe(e,"onCreate",r),s=oe(e,"onUpdate",r),o=oe(e,"onSelectionUpdate",r),l=oe(e,"onTransaction",r),u=oe(e,"onFocus",r),c=oe(e,"onBlur",r),d=oe(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),a&&this.editor.on("create",a),s&&this.editor.on("update",s),o&&this.editor.on("selectionUpdate",o),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};Po.resolve=MC;Po.sort=Rs;Po.flatten=mg;var SM={};pg(SM,{ClipboardTextSerializer:()=>VC,Commands:()=>WC,Delete:()=>YC,Drop:()=>KC,Editable:()=>XC,FocusEvents:()=>QC,Keymap:()=>JC,Paste:()=>e_,Tabindex:()=>t_,TextDirection:()=>n_,focusEventsPluginKey:()=>ZC});var ze=class GC extends Eg{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new GC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},VC=ze.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Le({key:new Fe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:a}=i,s=Math.min(...a.map(c=>c.$from.pos)),o=Math.max(...a.map(c=>c.$to.pos)),l=FC(n);return PC(r,{from:s,to:o},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),WC=ze.create({name:"commands",addCommands(){return{...vC}}}),YC=ze.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const a=()=>{var s,o,l,u;if((u=(l=(o=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:o.filterTransaction)==null?void 0:l.call(o,t))!=null?u:t.getMeta("y-sync$"))return;const c=OC(t.before,[t,...e]);UC(c).forEach(p=>{c.mapping.mapResult(p.oldRange.from).deletedAfter&&c.mapping.mapResult(p.oldRange.to).deletedBefore&&c.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,g)=>{const b=g+h.nodeSize-2,E=p.oldRange.from<=g&&b<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:g,to:b,newFrom:c.mapping.map(g),newTo:c.mapping.map(b),deletedRange:p.oldRange,newRange:p.newRange,partial:!E,editor:this.editor,transaction:t,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((p,h)=>{var g,b;if(p instanceof tn){const E=f.slice(h).map(p.from,-1),y=f.slice(h).map(p.to),S=f.invert().map(E,-1),k=f.invert().map(y),x=(g=c.doc.nodeAt(E-1))==null?void 0:g.marks.some(v=>v.eq(p.mark)),A=(b=c.doc.nodeAt(y))==null?void 0:b.marks.some(v=>v.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:S,to:k},newRange:{from:E,to:y},partial:!!(A||x),editor:this.editor,transaction:t,combinedTransform:c})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(a,0):a()}}),KC=ze.create({name:"drop",addProseMirrorPlugins(){return[new Le({key:new Fe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),XC=ze.create({name:"editable",addProseMirrorPlugins(){return[new Le({key:new Fe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ZC=new Fe("focusEvents"),QC=ze.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Le({key:ZC,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),JC=ze.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:o})=>{const{selection:l,doc:u}=o,{empty:c,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?o.doc.resolve(f-1):d,g=h.parent.type.spec.isolating,b=d.pos-d.parentOffset,E=g&&h.parent.childCount===1?b===d.pos:ge.atStart(u).from===f;return!c||!p.type.isTextblock||p.textContent.length||!E||E&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return pa()||wC()?a:i},addProseMirrorPlugins(){return[new Le({key:new Fe("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:a,from:s,to:o}=e.selection,l=ge.atStart(e.doc).from,u=ge.atEnd(e.doc).to;if(a||!(s===l&&o===u)||!Do(n.doc))return;const f=n.tr,p=wo({state:n,transaction:f}),{commands:h}=new Ro({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),e_=ze.create({name:"paste",addProseMirrorPlugins(){return[new Le({key:new Fe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),t_=ze.create({name:"tabindex",addProseMirrorPlugins(){return[new Le({key:new Fe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),n_=ze.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ri(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Le({key:new Fe("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),AM=class Pi{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Pi(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Pi(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Pi(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,s=n.isInline,o=this.pos+r+(a?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(o);if(!i&&!s&&l.depth<=this.depth)return;const u=new Pi(l,this.editor,i,i||s?n:null);i&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const a=i.node.attrs,s=Object.keys(n);for(let o=0;o<s.length;o+=1){const l=s[o];if(a[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const a=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&a.every(l=>n[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},kM=`.ProseMirror {
14
14
  position: relative;
15
15
  }