allyhub 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/commands/dev.js +6 -2
  3. package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
  4. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  5. package/dist/node_modules/@allyhub/browser/package.json +1 -1
  6. package/dist/node_modules/@allyhub/build/package.json +1 -1
  7. package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
  8. package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
  9. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  10. package/dist/node_modules/@allyhub/check/package.json +1 -1
  11. package/dist/node_modules/@allyhub/cloud/package.json +1 -1
  12. package/dist/node_modules/@allyhub/components/package.json +1 -1
  13. package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
  14. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  15. package/dist/node_modules/@allyhub/doc/package.json +1 -1
  16. package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
  17. package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
  18. package/dist/node_modules/@allyhub/export/package.json +1 -1
  19. package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
  20. package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
  21. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  22. package/dist/node_modules/@allyhub/i18n/package.json +1 -1
  23. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  24. package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
  25. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  26. package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
  27. package/dist/node_modules/@allyhub/image-render/package.json +1 -1
  28. package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
  29. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  30. package/dist/node_modules/@allyhub/jobs/package.json +1 -1
  31. package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -1
  32. package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
  33. package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
  34. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  35. package/dist/node_modules/@allyhub/media/package.json +1 -1
  36. package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
  37. package/dist/node_modules/@allyhub/model/package.json +1 -1
  38. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  39. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  40. package/dist/node_modules/@allyhub/project/package.json +1 -1
  41. package/dist/node_modules/@allyhub/protocol/package.json +1 -1
  42. package/dist/node_modules/@allyhub/registry/package.json +1 -1
  43. package/dist/node_modules/@allyhub/render/package.json +1 -1
  44. package/dist/node_modules/@allyhub/runtime/package.json +1 -1
  45. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  46. package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
  47. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  48. package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
  49. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  50. package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
  51. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  52. package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
  53. package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
  54. package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
  55. package/dist/node_modules/@allyhub/stage/package.json +1 -1
  56. package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
  57. package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
  58. package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
  59. package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
  60. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  61. package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
  62. package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
  63. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  64. package/dist/node_modules/@allyhub/website/package.json +1 -1
  65. package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
  66. package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
  67. package/dist/node_modules/@allyhub/x-model/package.json +1 -1
  68. package/dist/node_modules/@allyhub/x-view/package.json +1 -1
  69. package/dist/package.json +12 -12
  70. package/editor-web/assets/{abnfDiagram-WEYOIA3C-9z0ZEYUq.js → abnfDiagram-WEYOIA3C-arPHIJYC.js} +1 -1
  71. package/editor-web/assets/{architecture-WOLXFQ4H-ELMO_PA6.js → architecture-WOLXFQ4H-XPJlj9Iq.js} +1 -1
  72. package/editor-web/assets/{architectureDiagram-ZHVYKT53-C0yuCWU3.js → architectureDiagram-ZHVYKT53-BZNJvOtd.js} +1 -1
  73. package/editor-web/assets/article-Ck2ii-gZ.js +7 -0
  74. package/editor-web/assets/article-v30Q5cvX.js +3 -0
  75. package/editor-web/assets/bar-button-6Perrucg.js +1 -0
  76. package/editor-web/assets/{blockDiagram-RJAE7QA3-vi6JOg4o.js → blockDiagram-RJAE7QA3-B4L2P9Zz.js} +1 -1
  77. package/editor-web/assets/{c4Diagram-XDPPPE54-Agf_H8uS.js → c4Diagram-XDPPPE54-D5t2-Sm8.js} +1 -1
  78. package/editor-web/assets/channel-B8881pqR.js +1 -0
  79. package/editor-web/assets/{chunk-2E7WHVMD-XalaZaha.js → chunk-2E7WHVMD-bWUHKM6h.js} +1 -1
  80. package/editor-web/assets/{chunk-4EMNKR2T-DUlRZkCS.js → chunk-4EMNKR2T-CGGaxE7r.js} +1 -1
  81. package/editor-web/assets/{chunk-55XCU76K-DTa7whGr.js → chunk-55XCU76K-BXCHI3wC.js} +1 -1
  82. package/editor-web/assets/{chunk-7S6XSTFO-85zCPzj0.js → chunk-7S6XSTFO-H4tWSKhS.js} +1 -1
  83. package/editor-web/assets/{chunk-AQDTSKZB-CWBseIyh.js → chunk-AQDTSKZB-kyBZy8vG.js} +1 -1
  84. package/editor-web/assets/{chunk-DSNLSHJZ-BFnyvrWg.js → chunk-DSNLSHJZ-BlB7YIMo.js} +1 -1
  85. package/editor-web/assets/{chunk-HAGFOTED-DFWda2Rk.js → chunk-HAGFOTED-P8dIUq9O.js} +1 -1
  86. package/editor-web/assets/{chunk-HNE4Q36P-aXibFitC.js → chunk-HNE4Q36P-B_BAZXMj.js} +1 -1
  87. package/editor-web/assets/{chunk-NQOKRVIF-CtJUuFdN.js → chunk-NQOKRVIF-Bubl63jI.js} +1 -1
  88. package/editor-web/assets/{chunk-UHW7PFBP-B6QKSKWE.js → chunk-UHW7PFBP-DYGk0ZDz.js} +1 -1
  89. package/editor-web/assets/{chunk-VQ5W62QI-CF6Al55P.js → chunk-VQ5W62QI-BLFRyEGi.js} +1 -1
  90. package/editor-web/assets/{chunk-WQQL4CDK-w2TKLkyw.js → chunk-WQQL4CDK-kiwalF_c.js} +1 -1
  91. package/editor-web/assets/{chunk-YZO67HFG-DVGOATM3.js → chunk-YZO67HFG-D-bT0L2N.js} +1 -1
  92. package/editor-web/assets/{chunk-ZAUX2LTX-Cq7MMjDP.js → chunk-ZAUX2LTX-C_P5nPKV.js} +1 -1
  93. package/editor-web/assets/{chunk-ZCHMQSOR-GMW_lBh4.js → chunk-ZCHMQSOR-Deizt1PO.js} +1 -1
  94. package/editor-web/assets/{classDiagram-v2-4MYWR3UA-C7AK5Bkj.js → classDiagram-v2-4MYWR3UA-PUtBnliw.js} +1 -1
  95. package/editor-web/assets/collaborator--S95EupA.js +1 -0
  96. package/editor-web/assets/{cynefin-EF2NZ3EQ-ZnDieQsN.js → cynefin-EF2NZ3EQ-C09G_QFD.js} +1 -1
  97. package/editor-web/assets/{cynefinDiagram-WF24UDRP-BrukKIBF.js → cynefinDiagram-WF24UDRP-JxxJ5-Ov.js} +1 -1
  98. package/editor-web/assets/{dagre-NK4GIZVX-DfO0S2p_.js → dagre-NK4GIZVX-6DkhWeGP.js} +1 -1
  99. package/editor-web/assets/{diagram-CBK3MWTC-D43RLesi.js → diagram-CBK3MWTC-kI_Q07du.js} +1 -1
  100. package/editor-web/assets/{diagram-I5XIIV2D-bA1B1QQG.js → diagram-I5XIIV2D-FYaR41qP.js} +1 -1
  101. package/editor-web/assets/{diagram-ODIL2UCW-DAdXBD2K.js → diagram-ODIL2UCW-29WBGOdl.js} +1 -1
  102. package/editor-web/assets/{diagram-PFBEJUXE-C_KyEaws.js → diagram-PFBEJUXE-BFZJ9s9P.js} +1 -1
  103. package/editor-web/assets/{diagram-RJA3I4VV-oXTtENF7.js → diagram-RJA3I4VV-BSNFe4e-.js} +1 -1
  104. package/editor-web/assets/{diagram-TYUNFSNR-Czupe6mO.js → diagram-TYUNFSNR-Cb1wZgqj.js} +1 -1
  105. package/editor-web/assets/dist-B3RkByp0.js +1 -0
  106. package/editor-web/assets/{dist-BPecIPz6.js → dist-BAeqmRLA.js} +55 -55
  107. package/editor-web/assets/{dist-2lNSE-G_.js → dist-BaCVkpwc.js} +1 -1
  108. package/editor-web/assets/{dist-BtRMClDw.js → dist-BlqK1Oua.js} +1 -1
  109. package/editor-web/assets/dist-BuG-vxxb.js +5 -0
  110. package/editor-web/assets/dist-CGJv5-SE.js +45 -0
  111. package/editor-web/assets/dist-CUdvgRW5.js +1 -0
  112. package/editor-web/assets/dist-CnbKC_fW.js +1 -0
  113. package/editor-web/assets/dist-DXUMNYNX.js +16 -0
  114. package/editor-web/assets/dist-DhKxOqdu.js +43 -0
  115. package/editor-web/assets/dist-Dx2yV02v.js +6 -0
  116. package/editor-web/assets/dist-QuK0-suW.js +24 -0
  117. package/editor-web/assets/dist-Sl2_j-4w.js +38 -0
  118. package/editor-web/assets/dist-b5nFx4mV.js +3 -0
  119. package/editor-web/assets/dist-tteqAu5L.js +4 -0
  120. package/editor-web/assets/{ebnfDiagram-V4P3TTPT-BOhNZmtp.js → ebnfDiagram-V4P3TTPT-t3vO5qHB.js} +1 -1
  121. package/editor-web/assets/{elk-QONTBCTQ-DoZH3OoE.js → elk-QONTBCTQ-DfIcGBDb.js} +1 -1
  122. package/editor-web/assets/{erDiagram-KYQIGQAA-Bv0KDJi4.js → erDiagram-KYQIGQAA-Bgy1PYQf.js} +1 -1
  123. package/editor-web/assets/{eventmodeling-K75KTNOO-C-_xzqfj.js → eventmodeling-K75KTNOO-b8j935GM.js} +1 -1
  124. package/editor-web/assets/flowDiagram-IUGLLWBU-CnzC5OOy.js +1 -0
  125. package/editor-web/assets/{ganttDiagram-R7GPNTJY-CAuJlaZX.js → ganttDiagram-R7GPNTJY-B6C_nkwn.js} +1 -1
  126. package/editor-web/assets/{gitGraph-VSP46ZUC-Dx2xLi5C.js → gitGraph-VSP46ZUC-CWtulOri.js} +1 -1
  127. package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-DHsk_UOT.js → gitGraphDiagram-PDYL7XHY-BT80Z9gj.js} +1 -1
  128. package/editor-web/assets/hint-CKIaljPY.js +1 -0
  129. package/editor-web/assets/index-C3A0pCmH.css +2 -0
  130. package/editor-web/assets/index-CFqSJBZ-.js +28 -0
  131. package/editor-web/assets/{info-OHQRW6UA-CnKQHx5m.js → info-OHQRW6UA-CyWiLOaB.js} +1 -1
  132. package/editor-web/assets/{infoDiagram-MVDRKAX5-ibAVFw_2.js → infoDiagram-MVDRKAX5-3TQgBeRh.js} +1 -1
  133. package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-C1OCHt3y.js → ishikawaDiagram-HPEHV2GE-C3RAGFl7.js} +1 -1
  134. package/editor-web/assets/{journeyDiagram-BOSHW7O7-BDdqMOM1.js → journeyDiagram-BOSHW7O7-B3ZJp3pT.js} +1 -1
  135. package/editor-web/assets/{kanban-definition-FNSA4HC5-CSAS_zGn.js → kanban-definition-FNSA4HC5-ChjUoDH7.js} +1 -1
  136. package/editor-web/assets/{mermaid-parser.core-DTLyYXbn.js → mermaid-parser.core-CqJ7hTUI.js} +3 -3
  137. package/editor-web/assets/{mermaid.core-B8478wZ1.js → mermaid.core-DR2O-coV.js} +4 -4
  138. package/editor-web/assets/{mindmap-definition-6OY57UG3-DSWHcglH.js → mindmap-definition-6OY57UG3-Di0DNds3.js} +1 -1
  139. package/editor-web/assets/{packet-JDAUHWVQ-_k1BF29s.js → packet-JDAUHWVQ-CkCyk5LQ.js} +1 -1
  140. package/editor-web/assets/{pegDiagram-ECIUJNBX-B22YyWAa.js → pegDiagram-ECIUJNBX-DGyUszOM.js} +1 -1
  141. package/editor-web/assets/{pie-XZMESJXO-CSwV32hj.js → pie-XZMESJXO-D56l6NOA.js} +1 -1
  142. package/editor-web/assets/{pieDiagram-GNMPY74T-rSFNeWnq.js → pieDiagram-GNMPY74T-C6Gy4c9c.js} +1 -1
  143. package/editor-web/assets/progress-I2qmIfF4.js +6 -0
  144. package/editor-web/assets/props-form-gwp-8pGV.js +1 -0
  145. package/editor-web/assets/{quadrantDiagram-D57K4MC3-Xrntfg4j.js → quadrantDiagram-D57K4MC3-CWfkAwXQ.js} +1 -1
  146. package/editor-web/assets/{radar-ABXABTNO-Dwq5qiNw.js → radar-ABXABTNO-BhyQtVw_.js} +1 -1
  147. package/editor-web/assets/{railroad-I3PHUGI6-sIUGWcZh.js → railroad-I3PHUGI6-CyOyOgY6.js} +1 -1
  148. package/editor-web/assets/{railroad-abnf-LNEFI6M7-1rWlT9BX.js → railroad-abnf-LNEFI6M7-ExhYWNk4.js} +1 -1
  149. package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DWdkzEHc.js → railroad-ebnf-DWYD2UWJ-B7vR6DFd.js} +1 -1
  150. package/editor-web/assets/{railroad-peg-JR7BVNR7-CME0JBbV.js → railroad-peg-JR7BVNR7-hqCnhLuG.js} +1 -1
  151. package/editor-web/assets/{railroadDiagram-Y72NRBL7-Ch4BpP22.js → railroadDiagram-Y72NRBL7-D5X_R2ve.js} +1 -1
  152. package/editor-web/assets/{requirementDiagram-EQYSW5RA-CgE-x3wN.js → requirementDiagram-EQYSW5RA-CIP8sDsk.js} +1 -1
  153. package/editor-web/assets/row-k2eAfT-g.js +1 -0
  154. package/editor-web/assets/{sankeyDiagram-SY24JHO5-DBf4G6n3.js → sankeyDiagram-SY24JHO5-BKDJlzrK.js} +1 -1
  155. package/editor-web/assets/{sequenceDiagram-BLEHNHQU-Bz07CoUS.js → sequenceDiagram-BLEHNHQU-CkRLYFZ7.js} +1 -1
  156. package/editor-web/assets/split-Cjm6rVDC.js +3 -0
  157. package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-DuqAmDPP.js → stateDiagram-v2-A6IESKWZ-CCvwoTcz.js} +1 -1
  158. package/editor-web/assets/surface-BocGwSox.js +1 -0
  159. package/editor-web/assets/swatch-DGdJ5SeN.js +1 -0
  160. package/editor-web/assets/{swimlanes-B3ENRKFQ-C7sOL6rB.js → swimlanes-B3ENRKFQ-BXgW4pi4.js} +1 -1
  161. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-AFpLq-Wf.js +8 -0
  162. package/editor-web/assets/switch-Dwqxw1kp.js +1 -0
  163. package/editor-web/assets/tabs-B0bv2mMP.js +1 -0
  164. package/editor-web/assets/textarea-BNH6Y1-o.js +1 -0
  165. package/editor-web/assets/{timeline-definition-JXYKGLGB-CaLYz9mc.js → timeline-definition-JXYKGLGB-BwuUmgv1.js} +1 -1
  166. package/editor-web/assets/{treeView-D4JQ5SDB-D1P1Kyxc.js → treeView-D4JQ5SDB-Da35tnkE.js} +1 -1
  167. package/editor-web/assets/{treemap-SAJKECNS-2YaFL53t.js → treemap-SAJKECNS-4TcJReov.js} +1 -1
  168. package/editor-web/assets/{usecaseDiagram-WPOLBNNX-uYdbUhUS.js → usecaseDiagram-WPOLBNNX-wj02og_C.js} +1 -1
  169. package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DHepmX4t.js → vennDiagram-Q3Y3IDCW-Cun6o3pg.js} +1 -1
  170. package/editor-web/assets/{video-Xl-OaXRc.js → video-DkuN7Uu7.js} +1 -1
  171. package/editor-web/assets/{wardley-7MLQ67FV-Dx0MOPV1.js → wardley-7MLQ67FV-DiL2aSXm.js} +1 -1
  172. package/editor-web/assets/{wardleyDiagram-IVAIDKWA-BX8ElwDW.js → wardleyDiagram-IVAIDKWA-Cll7rTnv.js} +1 -1
  173. package/editor-web/assets/{words-DFIhHhHF.js → words-B-7GbYO2.js} +1 -1
  174. package/editor-web/assets/{words-B2FXYyeZ.js → words-QKSIyC_P.js} +1 -1
  175. package/editor-web/assets/x-BsePFh6d.js +41 -0
  176. package/editor-web/assets/{xychartDiagram-4URNHDU4-DoWQRJUS.js → xychartDiagram-4URNHDU4-s55eVncs.js} +1 -1
  177. package/editor-web/index.html +4 -3
  178. package/package.json +2 -2
  179. package/editor-web/assets/article-DHFgHYjv.js +0 -3
  180. package/editor-web/assets/article-Dt9id9Y9.js +0 -7
  181. package/editor-web/assets/button-BVQH7zxz.js +0 -41
  182. package/editor-web/assets/channel-Dkg198L0.js +0 -1
  183. package/editor-web/assets/collaborator-2qfw-8OJ.js +0 -1
  184. package/editor-web/assets/dist-5HNrQ9AU.js +0 -45
  185. package/editor-web/assets/dist-BXJKASX4.js +0 -24
  186. package/editor-web/assets/dist-BeDRTqQ8.js +0 -38
  187. package/editor-web/assets/dist-BlL-4sl3.js +0 -43
  188. package/editor-web/assets/dist-BuqBg8k8.js +0 -1
  189. package/editor-web/assets/dist-BwW08gSh.js +0 -1
  190. package/editor-web/assets/dist-C30Thvb3.js +0 -1
  191. package/editor-web/assets/dist-Cj5AmpVb.js +0 -5
  192. package/editor-web/assets/dist-CjjnDOa8.js +0 -3
  193. package/editor-web/assets/dist-D7ur8721.js +0 -6
  194. package/editor-web/assets/dist-DOHhp09C.js +0 -4
  195. package/editor-web/assets/dist-LhFEYZza.js +0 -16
  196. package/editor-web/assets/flowDiagram-IUGLLWBU-C7ZmHJZW.js +0 -1
  197. package/editor-web/assets/hint-mQB8slJ2.js +0 -1
  198. package/editor-web/assets/index-BGAXezRR.js +0 -28
  199. package/editor-web/assets/index-Br4a-QEv.css +0 -2
  200. package/editor-web/assets/progress-udl4pNsP.js +0 -6
  201. package/editor-web/assets/props-form-B6mYjTgZ.js +0 -1
  202. package/editor-web/assets/row-dgHEAE7h.js +0 -1
  203. package/editor-web/assets/split-mDSkdQkd.js +0 -3
  204. package/editor-web/assets/surface-D9qJjJQL.js +0 -1
  205. package/editor-web/assets/swatch-S8YuBYyj.js +0 -1
  206. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CQ2aWYP-.js +0 -8
  207. package/editor-web/assets/switch-D5kPl2jO.js +0 -1
  208. package/editor-web/assets/tabs-C0AHyuE5.js +0 -1
  209. package/editor-web/assets/textarea-mzr9Kfuf.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{v as n}from"./react-Bk7NnOLX.js";import{At as r}from"./button-BVQH7zxz.js";import{t as i}from"./jsx-runtime-DePvh3-m.js";import{t as a}from"./createLucideIcon-REX213UO.js";import{C as o,E as s,S as c,T as l,_ as u,b as d,d as f,f as p,g as m,h,l as g,m as _,o as v,p as y,s as b,t as ee,u as te,v as ne,w as re,x as ie,y as x}from"./dist-BrGYx10E.js";import{D as ae,E as S,O as C,S as oe,T as se,_ as ce,a as le,b as ue,c as w,d as T,g as de,h as fe,i as pe,k as E,l as D,m as me,n as he,o as O,p as ge,r as _e,s as k,t as ve,v as ye,w as be,x as xe}from"./dist-YW8hS4IM.js";var Se=a(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),Ce=Object.defineProperty,we=(e,t)=>{let n={};for(var r in e)Ce(n,r,{get:e[r],enumerable:!0});return t||Ce(n,Symbol.toStringTag,{value:`Module`}),n};function Te(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return Ee(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Ee(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new ae(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ae(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=ue(a,n,r,t);return s?(e&&De(e,t,s,i,n),!0):!1}function De(e,t,n,r,i){let a=S.empty;for(let e=n.length-1;e>=0;e--)a=S.from(n[e].type.create(n[e].attrs,a));e.step(new me(t.start-(r?2:0),t.end,t.start,t.end,new E(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&ye(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function Oe(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?ke(t,n,e,a):Ae(t,n,a):!0:!1}}function ke(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new me(a-1,o,a,o,new E(S.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ae(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=oe(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return ce(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Ae(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?S.empty:S.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new me(d-+!!s,f+ +!!c,d+1,f-1,new E((s?S.empty:S.from(i.copy(S.empty))).append(c?S.empty:S.from(i.copy(S.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function je(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=S.from(r?e.create():null),o=new E(S.from(e.create(null,S.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new me(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}function Me(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),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 A=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:Me({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},Ne=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),Pe=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),Fe=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=oe(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},Ie=e=>t=>e(t),Le=()=>({state:e,dispatch:t})=>g(e,t),Re=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new T(r.doc.resolve(Math.max(o-1,0)))),!0},ze=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function j(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Be=e=>({tr:t,state:n,dispatch:r})=>{let i=j(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Ve=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},He=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Ue=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return He(r)?n===`left`?e.start()-1:e.end()+1:e.pos},We=(e,t,n)=>({from:Ue(e,n,`left`),to:Ue(t,n,`right`)}),Ge=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=We(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(T.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},Ke=()=>({commands:e})=>e.keyboardShortcut(`Enter`),qe=()=>({state:e,dispatch:t})=>te(e,t);function Je(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function Ye(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Je(t[r])?t[r].test(e[r]):t[r]===e[r])}function Xe(e,t,n={}){return e.find(e=>e.type===t&&Ye(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Ze(e,t,n={}){return!!Xe(e,t,n)}function Qe(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!Xe([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&Ze([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&Ze([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function M(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var $e=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=M(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Qe(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=T.create(o,e.from,e.to);n.setSelection(t)}}return!0},et=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function tt(e){return e instanceof T}function N(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function nt(e,t=null){if(!t)return null;let n=D.atStart(e),r=D.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?T.create(e,N(0,i,a),N(e.content.size,i,a)):T.create(e,N(t,i,a),N(t,i,a))}function rt(){return[`Android`].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function P(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function it(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var at=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(P()||rt())&&r.dom.focus(),it()&&!P()&&!rt()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!tt(n.state.selection))return o(),!0;let s=nt(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ot=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),st=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),ct=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&ct(r)}return e};function lt(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return ct(n)}function ut(e){return typeof e?.nodesBetween==`function`}function F(e,t,n){if(ut(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return S.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),F(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new C({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?be.fromSchema(a).parseSlice(lt(e),n.parseOptions):be.fromSchema(a).parse(lt(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=be.fromSchema(t);return n.slice?r.parseSlice(lt(e),n.parseOptions).content:r.parse(lt(e),n.parseOptions)}return F(``,t,n)}function dt(e){return!(`type`in e)}function ft(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof fe||i instanceof me))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(D.near(e.doc.resolve(o),n))}var pt=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{F(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=F(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=dt(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):ut(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=S.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&ft(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0};function mt(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var ht=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=mt(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=F(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&ft(t,t.steps.length-1,-1)),!0):!1},gt=()=>({state:e,dispatch:t})=>m(e,t),_t=()=>({state:e,dispatch:t})=>p(e,t),vt=()=>({state:e,dispatch:t})=>f(e,t),yt=()=>({state:e,dispatch:t})=>y(e,t),bt=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},xt=()=>({state:e,dispatch:t,tr:n})=>{try{let r=xe(e.doc,e.selection.$from.pos,-1);return r==null||!bt(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},St=()=>({state:e,dispatch:t,tr:n})=>{try{let r=xe(e.doc,e.selection.$from.pos,1);return r==null||!bt(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Ct=()=>({state:e,dispatch:t})=>_(e,t),wt=()=>({state:e,dispatch:t})=>h(e,t);function Tt(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function Et(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))P()||Tt()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var Dt=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Et(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function I(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?j(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>Ye(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Ot=(e,t={})=>({state:n,dispatch:r})=>I(n,j(e,n.schema),t)?u(n,r):!1,kt=()=>({state:e,dispatch:t})=>ne(e,t),At=e=>({state:t,dispatch:n})=>Oe(j(e,t.schema))(t,n),jt=()=>({state:e,dispatch:t})=>x(e,t);function Mt(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Nt(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var Pt=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Mt(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=j(e,r.schema)),s===`mark`&&(o=M(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,Nt(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(Nt(a.attrs,t))))})})}),c},Ft=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),It=()=>({tr:e,dispatch:t})=>{if(t){let t=new pe(e.doc);e.setSelection(t)}return!0},Lt=()=>({state:e,dispatch:t})=>d(e,t),Rt=()=>({state:e,dispatch:t})=>ie(e,t),zt=()=>({state:e,dispatch:t})=>c(e,t),Bt=()=>({state:e,dispatch:t})=>o(e,t),Vt=()=>({state:e,dispatch:t})=>re(e,t);function Ht(e,t,n={},r={}){return F(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Ut=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=Ht(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=dt(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function Wt(e,t){let n=M(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function Gt(e,t){let n=new de(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Kt(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function qt(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Jt(e){return t=>qt(t.$from,e)}function L(e,t,n){return e.config[t]===void 0&&e.parent?L(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?L(e.parent,t,n):null}):e.config[t]}function Yt(e){return e.map(e=>{let t=L(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Yt(t())]:e}).flat(10)}function Xt(e,t){let n=se.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Zt(e,t){let n=new Map;for(let t of e){let e=n.get(t.type)??new Map;e.set(t.name,t),n.set(t.type,e)}return[...Object.values(t.nodes),...Object.values(t.marks)].flatMap(e=>Object.entries(e.spec.attrs??{}).map(([t,r])=>{let i=n.get(e.name)?.get(t),a=Object.hasOwn(r,`default`);return{type:e.name,name:t,attribute:{rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,...i?.attribute,default:r.default,isRequired:!a,validate:r.validate}}}))}var Qt={content:`string`,marks:`string`,group:`string`,inline:`boolean`,atom:`boolean`,selectable:`boolean`,draggable:`boolean`,code:`boolean`,whitespace:[`pre`,`normal`],definingAsContext:`boolean`,definingForContent:`boolean`,defining:`boolean`,isolating:`boolean`,linebreakReplacement:`boolean`},$t={inclusive:`boolean`,excludes:`string`,group:`string`,spanning:`boolean`,code:`boolean`};function en(e,t,n){return Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e[t];if(i===void 0)return[];if(!(typeof r==`string`?typeof i===r:typeof i==`string`&&r.includes(i)))throw RangeError(`Invalid schemaSpec field '${n}.${t}'`);return[[t,i]]}))}function tn(e,t,n,r){return{...Object.fromEntries(Object.entries(t).filter(([e])=>e!==`attrs`&&!Object.hasOwn(r,e))),...en(n,r,e),attrs:n.attrs}}function nn(e,t,n){for(let r of Object.keys(t))if(!Object.hasOwn(e,r))throw RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);for(let r of Object.keys(e))if(!Object.hasOwn(t,r))throw RangeError(`Local ${n} extension '${r}' is not in schemaSpec`)}function rn(e,t){nn(e.nodes,t.nodes,`node`),nn(e.marks,t.marks,`mark`);let n=t.spec.nodes,r=t.spec.marks;return t.spec.nodes.forEach((t,r)=>{n=n.update(t,tn(t,e.nodes[t],r,Qt))}),t.spec.marks.forEach((t,n)=>{r=r.update(t,tn(t,e.marks[t],n,$t))}),{topNode:t.topNodeType.name,nodes:n,marks:r}}function an(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function R(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function on(e){let t=[],{nodeExtensions:n,markExtensions:r}=R(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=L(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=L(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function sn(e){return typeof e==`function`}function z(e,t=void 0,...n){return sn(e)?t?e.bind(t)(...n):e(...n):e}function cn(e={}){return Object.keys(e).length===0&&e.constructor===Object}function ln(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i)r=!r,n+=o;else if(o===`"`&&!r)i=!i,n+=o;else{if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}}return n&&t.push(n),t}function un(e){let t=[],n=ln(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function B(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`)Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});else if(!n[e])n[e]=t;else if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...un(n[e]),...un(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function V(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>B(e,t),{})}function dn(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function fn(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):dn(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function pn(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&cn(t)?!1:t!=null))}function mn(e){var t,n;let r={};return!(e!=null&&(t=e.attribute)!=null&&t.isRequired)&&`default`in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function hn(e,t,n=on(e)){let{nodeExtensions:r,markExtensions:i}=R(e);return{topNode:r.find(e=>L(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=pn({...e.reduce((e,t)=>{let n=L(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:z(L(r,`content`,a)),marks:z(L(r,`marks`,a)),group:z(L(r,`group`,a)),inline:z(L(r,`inline`,a)),atom:z(L(r,`atom`,a)),selectable:z(L(r,`selectable`,a)),draggable:z(L(r,`draggable`,a)),code:z(L(r,`code`,a)),whitespace:z(L(r,`whitespace`,a)),linebreakReplacement:z(L(r,`linebreakReplacement`,a)),defining:z(L(r,`defining`,a)),isolating:z(L(r,`isolating`,a)),attrs:Object.fromEntries(i.map(mn))}),s=z(L(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>fn(e,i)));let c=L(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:V(e,i)}));let l=L(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=pn({...e.reduce((e,t)=>{let n=L(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:z(L(r,`inclusive`,a)),excludes:z(L(r,`excludes`,a)),group:z(L(r,`group`,a)),spanning:z(L(r,`spanning`,a)),code:z(L(r,`code`,a)),attrs:Object.fromEntries(i.map(mn))}),s=z(L(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>fn(e,i)));let c=L(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:V(e,i)})),[r.name,o]}))}}function gn(e,t,n){if(n===void 0)return new C(hn(e,t));let r=an(e.filter(e=>e.type!==`extension`).map(e=>e.name));if(r.length)throw RangeError(`Duplicate local schema types: ${r.join(`, `)}`);let i=new C(n),a=hn(e,t,Zt(on(e),i));return new C(rn(a,i))}function _n(e){return e.sort((e,t)=>{let n=L(e,`priority`)||100,r=L(t,`priority`)||100;return n>r?-1:+(n<r)})}function vn(e){let t=_n(Yt(e)),n=an(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function yn(e,t){return gn(vn(e),t)}function bn(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
1
+ import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{v as n}from"./react-Bk7NnOLX.js";import{At as r}from"./x-BsePFh6d.js";import{t as i}from"./jsx-runtime-DePvh3-m.js";import{t as a}from"./createLucideIcon-REX213UO.js";import{C as o,E as s,S as c,T as l,_ as u,b as d,d as f,f as p,g as m,h,l as g,m as _,o as v,p as y,s as b,t as ee,u as te,v as ne,w as re,x as ie,y as x}from"./dist-BrGYx10E.js";import{D as ae,E as S,O as C,S as oe,T as se,_ as ce,a as le,b as ue,c as w,d as T,g as de,h as fe,i as pe,k as E,l as D,m as me,n as he,o as O,p as ge,r as _e,s as k,t as ve,v as ye,w as be,x as xe}from"./dist-YW8hS4IM.js";var Se=a(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),Ce=Object.defineProperty,we=(e,t)=>{let n={};for(var r in e)Ce(n,r,{get:e[r],enumerable:!0});return t||Ce(n,Symbol.toStringTag,{value:`Module`}),n};function Te(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return Ee(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Ee(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new ae(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ae(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=ue(a,n,r,t);return s?(e&&De(e,t,s,i,n),!0):!1}function De(e,t,n,r,i){let a=S.empty;for(let e=n.length-1;e>=0;e--)a=S.from(n[e].type.create(n[e].attrs,a));e.step(new me(t.start-(r?2:0),t.end,t.start,t.end,new E(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&ye(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function Oe(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?ke(t,n,e,a):Ae(t,n,a):!0:!1}}function ke(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new me(a-1,o,a,o,new E(S.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ae(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=oe(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return ce(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Ae(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?S.empty:S.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new me(d-+!!s,f+ +!!c,d+1,f-1,new E((s?S.empty:S.from(i.copy(S.empty))).append(c?S.empty:S.from(i.copy(S.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function je(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=S.from(r?e.create():null),o=new E(S.from(e.create(null,S.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new me(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}function Me(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),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 A=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:Me({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},Ne=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),Pe=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),Fe=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=oe(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},Ie=e=>t=>e(t),Le=()=>({state:e,dispatch:t})=>g(e,t),Re=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new T(r.doc.resolve(Math.max(o-1,0)))),!0},ze=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function j(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Be=e=>({tr:t,state:n,dispatch:r})=>{let i=j(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Ve=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},He=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Ue=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return He(r)?n===`left`?e.start()-1:e.end()+1:e.pos},We=(e,t,n)=>({from:Ue(e,n,`left`),to:Ue(t,n,`right`)}),Ge=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=We(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(T.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},Ke=()=>({commands:e})=>e.keyboardShortcut(`Enter`),qe=()=>({state:e,dispatch:t})=>te(e,t);function Je(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function Ye(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Je(t[r])?t[r].test(e[r]):t[r]===e[r])}function Xe(e,t,n={}){return e.find(e=>e.type===t&&Ye(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Ze(e,t,n={}){return!!Xe(e,t,n)}function Qe(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!Xe([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&Ze([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&Ze([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function M(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var $e=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=M(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Qe(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=T.create(o,e.from,e.to);n.setSelection(t)}}return!0},et=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function tt(e){return e instanceof T}function N(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function nt(e,t=null){if(!t)return null;let n=D.atStart(e),r=D.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?T.create(e,N(0,i,a),N(e.content.size,i,a)):T.create(e,N(t,i,a),N(t,i,a))}function rt(){return[`Android`].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function P(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function it(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var at=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(P()||rt())&&r.dom.focus(),it()&&!P()&&!rt()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!tt(n.state.selection))return o(),!0;let s=nt(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ot=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),st=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),ct=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&ct(r)}return e};function lt(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return ct(n)}function ut(e){return typeof e?.nodesBetween==`function`}function F(e,t,n){if(ut(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return S.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),F(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new C({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?be.fromSchema(a).parseSlice(lt(e),n.parseOptions):be.fromSchema(a).parse(lt(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=be.fromSchema(t);return n.slice?r.parseSlice(lt(e),n.parseOptions).content:r.parse(lt(e),n.parseOptions)}return F(``,t,n)}function dt(e){return!(`type`in e)}function ft(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof fe||i instanceof me))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(D.near(e.doc.resolve(o),n))}var pt=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{F(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=F(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=dt(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):ut(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=S.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&ft(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0};function mt(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var ht=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=mt(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=F(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&ft(t,t.steps.length-1,-1)),!0):!1},gt=()=>({state:e,dispatch:t})=>m(e,t),_t=()=>({state:e,dispatch:t})=>p(e,t),vt=()=>({state:e,dispatch:t})=>f(e,t),yt=()=>({state:e,dispatch:t})=>y(e,t),bt=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},xt=()=>({state:e,dispatch:t,tr:n})=>{try{let r=xe(e.doc,e.selection.$from.pos,-1);return r==null||!bt(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},St=()=>({state:e,dispatch:t,tr:n})=>{try{let r=xe(e.doc,e.selection.$from.pos,1);return r==null||!bt(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Ct=()=>({state:e,dispatch:t})=>_(e,t),wt=()=>({state:e,dispatch:t})=>h(e,t);function Tt(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function Et(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))P()||Tt()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var Dt=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Et(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function I(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?j(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>Ye(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Ot=(e,t={})=>({state:n,dispatch:r})=>I(n,j(e,n.schema),t)?u(n,r):!1,kt=()=>({state:e,dispatch:t})=>ne(e,t),At=e=>({state:t,dispatch:n})=>Oe(j(e,t.schema))(t,n),jt=()=>({state:e,dispatch:t})=>x(e,t);function Mt(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Nt(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var Pt=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Mt(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=j(e,r.schema)),s===`mark`&&(o=M(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,Nt(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(Nt(a.attrs,t))))})})}),c},Ft=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),It=()=>({tr:e,dispatch:t})=>{if(t){let t=new pe(e.doc);e.setSelection(t)}return!0},Lt=()=>({state:e,dispatch:t})=>d(e,t),Rt=()=>({state:e,dispatch:t})=>ie(e,t),zt=()=>({state:e,dispatch:t})=>c(e,t),Bt=()=>({state:e,dispatch:t})=>o(e,t),Vt=()=>({state:e,dispatch:t})=>re(e,t);function Ht(e,t,n={},r={}){return F(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Ut=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=Ht(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=dt(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function Wt(e,t){let n=M(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function Gt(e,t){let n=new de(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Kt(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function qt(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Jt(e){return t=>qt(t.$from,e)}function L(e,t,n){return e.config[t]===void 0&&e.parent?L(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?L(e.parent,t,n):null}):e.config[t]}function Yt(e){return e.map(e=>{let t=L(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Yt(t())]:e}).flat(10)}function Xt(e,t){let n=se.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Zt(e,t){let n=new Map;for(let t of e){let e=n.get(t.type)??new Map;e.set(t.name,t),n.set(t.type,e)}return[...Object.values(t.nodes),...Object.values(t.marks)].flatMap(e=>Object.entries(e.spec.attrs??{}).map(([t,r])=>{let i=n.get(e.name)?.get(t),a=Object.hasOwn(r,`default`);return{type:e.name,name:t,attribute:{rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,...i?.attribute,default:r.default,isRequired:!a,validate:r.validate}}}))}var Qt={content:`string`,marks:`string`,group:`string`,inline:`boolean`,atom:`boolean`,selectable:`boolean`,draggable:`boolean`,code:`boolean`,whitespace:[`pre`,`normal`],definingAsContext:`boolean`,definingForContent:`boolean`,defining:`boolean`,isolating:`boolean`,linebreakReplacement:`boolean`},$t={inclusive:`boolean`,excludes:`string`,group:`string`,spanning:`boolean`,code:`boolean`};function en(e,t,n){return Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e[t];if(i===void 0)return[];if(!(typeof r==`string`?typeof i===r:typeof i==`string`&&r.includes(i)))throw RangeError(`Invalid schemaSpec field '${n}.${t}'`);return[[t,i]]}))}function tn(e,t,n,r){return{...Object.fromEntries(Object.entries(t).filter(([e])=>e!==`attrs`&&!Object.hasOwn(r,e))),...en(n,r,e),attrs:n.attrs}}function nn(e,t,n){for(let r of Object.keys(t))if(!Object.hasOwn(e,r))throw RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);for(let r of Object.keys(e))if(!Object.hasOwn(t,r))throw RangeError(`Local ${n} extension '${r}' is not in schemaSpec`)}function rn(e,t){nn(e.nodes,t.nodes,`node`),nn(e.marks,t.marks,`mark`);let n=t.spec.nodes,r=t.spec.marks;return t.spec.nodes.forEach((t,r)=>{n=n.update(t,tn(t,e.nodes[t],r,Qt))}),t.spec.marks.forEach((t,n)=>{r=r.update(t,tn(t,e.marks[t],n,$t))}),{topNode:t.topNodeType.name,nodes:n,marks:r}}function an(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function R(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function on(e){let t=[],{nodeExtensions:n,markExtensions:r}=R(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=L(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=L(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function sn(e){return typeof e==`function`}function z(e,t=void 0,...n){return sn(e)?t?e.bind(t)(...n):e(...n):e}function cn(e={}){return Object.keys(e).length===0&&e.constructor===Object}function ln(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i)r=!r,n+=o;else if(o===`"`&&!r)i=!i,n+=o;else{if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}}return n&&t.push(n),t}function un(e){let t=[],n=ln(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function B(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`)Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});else if(!n[e])n[e]=t;else if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...un(n[e]),...un(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function V(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>B(e,t),{})}function dn(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function fn(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):dn(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function pn(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&cn(t)?!1:t!=null))}function mn(e){var t,n;let r={};return!(e!=null&&(t=e.attribute)!=null&&t.isRequired)&&`default`in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function hn(e,t,n=on(e)){let{nodeExtensions:r,markExtensions:i}=R(e);return{topNode:r.find(e=>L(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=pn({...e.reduce((e,t)=>{let n=L(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:z(L(r,`content`,a)),marks:z(L(r,`marks`,a)),group:z(L(r,`group`,a)),inline:z(L(r,`inline`,a)),atom:z(L(r,`atom`,a)),selectable:z(L(r,`selectable`,a)),draggable:z(L(r,`draggable`,a)),code:z(L(r,`code`,a)),whitespace:z(L(r,`whitespace`,a)),linebreakReplacement:z(L(r,`linebreakReplacement`,a)),defining:z(L(r,`defining`,a)),isolating:z(L(r,`isolating`,a)),attrs:Object.fromEntries(i.map(mn))}),s=z(L(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>fn(e,i)));let c=L(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:V(e,i)}));let l=L(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=pn({...e.reduce((e,t)=>{let n=L(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:z(L(r,`inclusive`,a)),excludes:z(L(r,`excludes`,a)),group:z(L(r,`group`,a)),spanning:z(L(r,`spanning`,a)),code:z(L(r,`code`,a)),attrs:Object.fromEntries(i.map(mn))}),s=z(L(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>fn(e,i)));let c=L(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:V(e,i)})),[r.name,o]}))}}function gn(e,t,n){if(n===void 0)return new C(hn(e,t));let r=an(e.filter(e=>e.type!==`extension`).map(e=>e.name));if(r.length)throw RangeError(`Duplicate local schema types: ${r.join(`, `)}`);let i=new C(n),a=hn(e,t,Zt(on(e),i));return new C(rn(a,i))}function _n(e){return e.sort((e,t)=>{let n=L(e,`priority`)||100,r=L(t,`priority`)||100;return n>r?-1:+(n<r)})}function vn(e){let t=_n(Yt(e)),n=an(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function yn(e,t){return gn(vn(e),t)}function bn(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
2
2
 
3
3
  `,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;if(e.isText){var d;s+=e==null||(d=e.text)==null?void 0:d.slice(Math.max(r,n)-n,i-n)}}),s}function xn(e,t){return bn(e,{from:0,to:e.content.size},t)}function Sn(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Cn(e,t){let n=j(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function wn(e,t){let n=Mt(typeof t==`string`?t:t.name,e.schema);return n===`node`?Cn(e,t):n===`mark`?Wt(e,t):{}}function Tn(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function En(e){let t=Tn(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Dn(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),En(r)}function On(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=Qe(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&e?.nodeSize!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var kn=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},An=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)};function H(e,t){return t.nodes[e]||t.marks[e]||null}function jn(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var Mn=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function Nn(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?M(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>Ye(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>Ye(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>!a||e.mark.type!==a&&e.mark.type.excludes(a)).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function Pn(e,t,n={}){if(!t)return I(e,null,n)||Nn(e,null,n);let r=Mt(t,e.schema);return r===`node`?I(e,t,n):r===`mark`&&Nn(e,t,n)}var Fn=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=Jt(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},In=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Ln(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function Rn(e,t){let{nodeExtensions:n}=R(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=z(L(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`&&i.split(` `).includes(`list`)}function zn(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(zn(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Bn(e){return e instanceof O}function Vn(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.apply==`function`&&typeof t.getMap==`function`&&typeof t.invert==`function`&&typeof t.map==`function`&&typeof t.merge==`function`&&typeof t.toJSON==`function`}function Hn(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!Vn(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`replace`)}var Un=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Wn(e,t){let n=t.mapping.mapResult(e.position);return{position:new Un(n.pos),mapResult:n}}function Gn(e){return new Un(e)}function Kn(e,t,n){let r=e.state.doc.content.size,i=N(t,0,r),a=N(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function qn(e,t,n){let{selection:r}=t,i=null;if(tt(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Jn=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=M(e,r.schema);if(i){if(o){let e=Wt(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})})}return qn(r,n,c)},Yn=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Xn=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=j(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>l(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>l(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Zn=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=N(e,0,n.content.size),i=O.create(n,r);t.setSelection(i)}return!0},Qn=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},$n=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=T.atStart(n).from,o=T.atEnd(n).to,s=N(r,a,o),c=N(i,a,o),l=T.create(n,s,c);t.setSelection(l)}return!0},er=e=>({state:t,dispatch:n})=>je(j(e,t.schema))(t,n);function tr(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var nr=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=jn(l,s.node().type.name,s.node().attrs);if(a instanceof O&&a.node.isBlock)return!s.parentOffset||!ye(o,s.pos)?!1:(r&&(e&&tr(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:mt(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=a instanceof T&&!a.empty?le.create({doc:t.doc,selection:a}).tr.deleteSelection():null,h=m?m.doc:t.doc,g=m?m.mapping.map(s.pos):s.pos,_=ye(h,g,1,p);if(!p&&!_&&ye(h,g,1,f?[{type:f}]:void 0)&&(_=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(_){let e=t.steps.length;if(a instanceof T&&t.deleteSelection(),t.split(t.mapping.slice(e).map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f){let n=t.mapping.slice(e).map(s.before()),r=t.doc.resolve(n);s.node(-1).canReplaceWith(r.index(),r.index()+1,f)&&t.setNodeMarkup(t.mapping.slice(e).map(s.before()),f)}}e&&tr(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return _},rr=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=j(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=S.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=S.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...jn(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(S.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new E(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(T.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...jn(d,u.type.name,u.attrs),...t},m={...jn(d,s.node().type.name,s.node().attrs),...t},h=s.parentOffset===0&&s.index(-1)===0,g=s.before(-1);n.delete(s.pos,c.pos);let _=h?u.attrs:p,v=f?[{type:o,attrs:_},{type:f,attrs:m}]:[{type:o,attrs:_}];if(!ye(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,v).scrollIntoView(),h&&n.setNodeMarkup(g,void 0,p),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function ir(e,t,n){if(!e.validContent(t))return null;try{return e.create(n,t)}catch{return null}}function ar(e,t){if(e.pendingContent.length===0)return!0;let n=ir(t,S.from(e.pendingContent));return n?(e.items.push(n),e.pendingContent=[],!0):!1}function or(e,t,n){return n.validContent(S.from([...t.pendingContent,e]))?(t.pendingContent.push(e),!0):!ar(t,n)||!n.validContent(S.from(e))?!1:(t.pendingContent.push(e),!0)}function sr(e,t,n,r){let i=r(e,n);if(!i)return!1;let a=ir(n.listType,S.from(i),e.attrs);return a?n.itemType.validContent(S.from([...t.pendingContent,a]))?(t.pendingContent.push(a),!0):ar(t,n.itemType)?(t.items.push(...i),!0):!1:!1}function cr(e,t,n){let r={items:[],pendingContent:[]};for(let i=0;i<e.childCount;i+=1){let a=e.child(i);if(!(t.isListNode(a)?sr(a,r,t,n):or(a,r,t.itemType)))return null}return ar(r,t.itemType)?r.items:null}function lr(e,t){let n=[];for(let r=0;r<e.childCount;r+=1){let i=cr(e.child(r),t,lr);if(!i)return null;n.push(...i)}return n}function ur(e,t){let n=null;return e.descendants((e,r)=>e!==t||(n=r,!1)),n}function dr(e){return!e||e===`1`?null:e}function fr(e,t){return dr(e)===dr(t)}var pr=(e,t)=>{let n=Jt(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&ce(e.doc,n.pos))||!fr(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},mr=(e,t)=>{let n=Jt(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&ce(e.doc,r))||!fr(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function hr(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return T.between(r,i)}var gr=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=j(e,o.schema),m=j(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let ee=Jt(e=>Rn(e.type.name,d))(h),te=h.from===0&&h.to===o.doc.content.size,ne=o.doc.content.content,re=ne.length===1?ne[0]:null,ie=te&&re&&Rn(re.type.name,d)?{node:re,pos:0,depth:0}:null,x=ee??ie,ae=!!ee&&y.depth>=1&&y.depth-ee.depth<=1,C=!!ie;if((ae||C)&&x){if(x.node.type===p)return te&&C?c().command(({tr:e,dispatch:t})=>{let n=hr(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Rn(x.node.type.name,d)&&p.validContent(x.node.content))return c().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>pr(a,p)).command(()=>mr(a,p)).run();if(Rn(x.node.type.name,d)){let e=x.node.firstChild?.type;if(e&&e!==m){let e=lr(x.node,{listType:p,itemType:m,isListNode:e=>Rn(e.type.name,d)}),t=e?S.from(e):null;return!t||!p.validContent(t)?!1:c().command(()=>{let{$anchor:e,$head:n}=a.selection,i=e.parent,o=n.parent,s=e.parentOffset,c=n.parentOffset,l;try{l=p.create(r,t)}catch{return!1}if(a.replaceWith(x.pos,x.pos+x.node.nodeSize,l),i.inlineContent&&o.inlineContent){let e=ur(l,i),t=ur(l,o);if(e!==null&&t!==null){let n=x.pos+e+2+s,r=x.pos+t+2+c;a.setSelection(T.create(a.doc,n,r))}}return!0}).command(()=>pr(a,p)).command(()=>mr(a,p)).run()}}}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>pr(a,p)).command(()=>mr(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>pr(a,p)).command(()=>mr(a,p)).run()},_r=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=M(e,r.schema);return Nn(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},vr=(e,t,n={})=>({state:r,commands:i})=>{let a=j(e,r.schema),o=j(t,r.schema),s=I(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},yr=(e,t={})=>({state:n,commands:r})=>{let i=j(e,n.schema);return I(n,i,t)?r.lift(i):r.wrapIn(i,t)},br=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},xr=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},Sr=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=M(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=Qe(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},Cr=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},wr=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Mt(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=j(e,r.schema)),s===`mark`&&(o=M(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},U=new w(`__tiptap_decorations__`),Tr=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(U,{type:`force`,name:e}),!0),Er=(e,t={})=>({state:n,dispatch:r})=>{let i=j(e,n.schema);return s(i,t)(n,r)},Dr=(e,t={})=>({state:n,dispatch:r})=>Te(j(e,n.schema),t)(n,r),Or=we({blur:()=>Ne,clearContent:()=>Pe,clearNodes:()=>Fe,command:()=>Ie,createParagraphNear:()=>Le,cut:()=>Re,deleteCurrentNode:()=>ze,deleteNode:()=>Be,deleteRange:()=>Ve,deleteSelection:()=>Ge,enter:()=>Ke,exitCode:()=>qe,extendMarkRange:()=>$e,first:()=>et,focus:()=>at,forEach:()=>ot,insertContent:()=>st,insertContentAt:()=>pt,insertDefaultBlock:()=>ht,joinBackward:()=>vt,joinDown:()=>_t,joinForward:()=>yt,joinItemBackward:()=>xt,joinItemForward:()=>St,joinTextblockBackward:()=>Ct,joinTextblockForward:()=>wt,joinUp:()=>gt,keyboardShortcut:()=>Dt,lift:()=>Ot,liftEmptyBlock:()=>kt,liftListItem:()=>At,newlineInCode:()=>jt,resetAttributes:()=>Pt,scrollIntoView:()=>Ft,selectAll:()=>It,selectNodeBackward:()=>Lt,selectNodeForward:()=>Rt,selectParentNode:()=>zt,selectTextblockEnd:()=>Bt,selectTextblockStart:()=>Vt,setContent:()=>Ut,setMark:()=>Jn,setMeta:()=>Yn,setNode:()=>Xn,setNodeSelection:()=>Zn,setTextDirection:()=>Qn,setTextSelection:()=>$n,sinkListItem:()=>er,splitBlock:()=>nr,splitListItem:()=>rr,toggleList:()=>gr,toggleMark:()=>_r,toggleNode:()=>vr,toggleWrap:()=>yr,undoInputRule:()=>br,unsetAllMarks:()=>xr,unsetMark:()=>Sr,unsetTextDirection:()=>Cr,updateAttributes:()=>wr,updateDecorations:()=>Tr,wrapIn:()=>Er,wrapInList:()=>Dr}),W=new WeakMap;function kr(e,t){W.set(e,(W.get(e)??0)+1);try{return t()}finally{let t=(W.get(e)??1)-1;t>0?W.set(e,t):W.delete(e)}}function Ar(e){return W.has(e)}var jr=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Mr=typeof process<`u`&&!1;function Nr(e){return e.kind===`widget`}function Pr(e,t){let n=[],r=new Set;for(let i of e)i.kind===`widget`&&Nr(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function Fr(e,t,n){let{decorations:r,widgetKeys:i}=Pr(t,n);return{set:he.create(e,r),widgetKeys:i}}function Ir({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n||e===n&&n===r}function Lr({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:a}){return e.filter(e=>Ir({position:e.anchor,from:t,to:n,docSize:r})?!0:(e.anchor===n||a.has(i)||(a.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function Rr(e){let t=e.spec?.key;return typeof t==`string`?t:void 0}function zr(e){let t=new Map,n=new Map;for(let r of e.find()){let e=Rr(r);if(!e)continue;let i=r.spec.extensionName??`unknown`,a=t.get(e)??new Set;a.add(i),t.set(e,a),n.set(e,(n.get(e)??0)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>(n.get(e)??0)>1)}function Br(e){return e.jsonID===`attr`}function Vr(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||Br(e))return!0;let n=e;return typeof n.from==`number`&&typeof n.to==`number`}function Hr(e,t){let n=null,r=0,i=0;for(let a=0;a<e.childCount&&!(i>t.to);a+=1){let o=i+e.child(a).nodeSize;o>=t.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function Ur(e,t){if(e.steps.some(e=>!Vr(e)))return{type:`full`};let n=Dn(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!Br(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=Hr(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:`ranges`,ranges:i}}function Wr(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=e?.key;typeof t==`string`&&r.delete(t)}})}function Gr(e,t,n){let r=t.decorationSetsByExtension[e]??he.empty,i=new Set(t.widgetKeysByExtension[e]??[]);return{set:Wr(r,n.mapping,n.doc,i),widgetKeys:i}}function Kr(e,t){let n=Object.values(t).flatMap(e=>e.find());return he.create(e,n)}function qr(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}function Jr(e,t){switch(t.update??`document`){case`document`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case`changedRanges`:if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case`manual`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function Yr(e,t,n){return n?!0:e.update===`manual`?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}var Xr=new Set,Zr=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=U.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>Jr(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return U.getState(this.editor.state)?.widgetKeys??Xr}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new k({key:U,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:qr(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(U),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return kr(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!Yr(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=Gr(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:qr(u)}}},props:{decorations(e){return U.getState(e)?.mergedDecorationSet??he.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=Ur(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??he.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=Wr(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>Ir({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=Rr(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=Pr(Lr({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return Fr(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!Mr)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=zr(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:Kr(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):Kr(n.doc,r)}};function Qr(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof O){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function $r(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function ei(e){return typeof e==`number`}function ti(e){return Object.prototype.toString.call(e).slice(8,-1)}function ni(e){return ti(e)===`Object`&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ri(e,t,n){let r=e.split(`
4
4
  `),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],u=e.match(t.itemPattern);if(!u){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}\n`;continue}return}let d=t.extractItemData(u),{indentLevel:f,mainContent:p}=d;a=`${a}${e}\n`;let m=[p];for(o+=1;o<r.length;){var c;let e=r[o];if(e.trim()===``){var l;let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((((l=r[o+1+t].match(/^(\s*)/))==null||(l=l[1])==null?void 0:l.length)||0)>f){m.push(e),a=`${a}${e}\n`,o+=1;continue}break}if((((c=e.match(/^(\s*)/))==null||(c=c[1])==null?void 0:c.length)||0)>f)m.push(e),a=`${a}${e}\n`,o+=1;else break}let h,g=m.slice(1);if(g.length>0){let e=g.map(e=>e.slice(f+s)).join(`
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,r}from"./dist-BrGYx10E.js";import{$ as i,A as a,B as o,C as s,D as c,E as l,F as u,G as d,K as f,M as p,O as m,Q as h,T as g,U as _,V as ee,W as v,X as y,Y as b,Z as x,_ as te,ct as ne,d as re,et as ie,f as ae,h as oe,it as se,j as ce,k as le,lt as S,nt as C,ot as ue,p as de,q as fe,rt as pe,tt as me,x as he,y as ge,z as _e}from"./dist-2lNSE-G_.js";import{E as ve,c as w,d as T,h as ye,k as be,l as xe,n as E,o as Se,s as D,t as Ce,y as we}from"./dist-YW8hS4IM.js";function Te(e={}){return new D({view(t){return new Ee(t,e)}})}var Ee=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=we(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};g.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new D({key:new w(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var De=g.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Te(this.options)]}});g.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new D({key:new w(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return E.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Ce.node(t,t+e.nodeSize,{class:this.options.className}))}),E.create(e,a)}}})]}});var Oe=g.create({name:`gapCursor`,addProseMirrorPlugins(){return[re()]},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:a(ee(e,`allowGapCursor`,t))??null}}}),ke=`placeholder`,Ae=new w(`tiptap__placeholder`);function je(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),Ce.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function Me(e,t){return typeof e==`function`?e(t):e}function Ne({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&h(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(je({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Me(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function Pe({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&h(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(je({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Me(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...Ne({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return E.create(r,o)}function O(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function k(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function Fe(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function Ie(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function Le(e,t){let n=Fe(e,t.from,t.to);return n.push(k(e,O(e,t.from))),t.to>t.from?n.push(k(e,O(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(k(e,O(e,Math.min(t.from+1,e.content.size)))),n}function Re(e,t,n){let r=[];if(e.docChanged){let t=o(e);for(let e of t)r.push(...Le(n.doc,e.newRange))}return e.selectionSet&&(r.push(k(n.doc,O(n.doc,e.mapping.map(t.selection.anchor)))),r.push(k(n.doc,O(n.doc,n.selection.anchor)))),Ie(r)}function ze(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function Be({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=ze(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=Ne({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function Ve({editor:e,options:t,dataAttribute:n}){return{init(r,i){return Pe({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??E.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:Be({decorations:i.map(r.mapping,r.doc),ranges:Re(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function He(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Ue({editor:e,options:t}){let n=t.dataAttribute?`data-${He(t.dataAttribute)}`:`data-${ke}`,r=t.showOnlyCurrent&&!t.includeChildren;return new D({key:Ae,...r?{}:{state:Ve({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>Pe({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?E.empty:Ae.getState(n)??E.empty}})}var We=g.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:ke,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Ue({editor:this.editor,options:this.options})]}});function Ge(e,t){return!e.selection.empty&&!i(e.selection)&&t.isEditable}function Ke(e,t){return Ge(e,t)&&!t.isFocused&&!t.view.dragging}function qe(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function Je(e){e.focus()}g.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new D({key:new w(`selection`),props:{decorations(n){return Ke(n,e)?E.create(n.doc,[Ce.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return Ge(t.state,e)&&qe(),!1},focus(t){return Ge(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&Je(t)}),!1}}}})]}});function Ye({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Xe=g.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new w(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new D({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!Ye({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!Ye({node:r,types:n})}}})]}}),Ze=g.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:n})=>e(t,n),redo:()=>({state:e,dispatch:n})=>t(e,n)}},addProseMirrorPlugins(){return[n(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Qe=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new be(n,0,0);return e.replace(l,i.after(),r),e.setSelection(T.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},$e=/^\s*>\s$/,et=m.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return s(`blockquote`,{...C(this.options.HTMLAttributes,e),children:s(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
1
+ import{a as e,i as t,n,r}from"./dist-BrGYx10E.js";import{$ as i,A as a,B as o,C as s,D as c,E as l,F as u,G as d,K as f,M as p,O as m,Q as h,T as g,U as _,V as ee,W as v,X as y,Y as b,Z as x,_ as te,ct as ne,d as re,et as ie,f as ae,h as oe,it as se,j as ce,k as le,lt as S,nt as C,ot as ue,p as de,q as fe,rt as pe,tt as me,x as he,y as ge,z as _e}from"./dist-BaCVkpwc.js";import{E as ve,c as w,d as T,h as ye,k as be,l as xe,n as E,o as Se,s as D,t as Ce,y as we}from"./dist-YW8hS4IM.js";function Te(e={}){return new D({view(t){return new Ee(t,e)}})}var Ee=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=we(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};g.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new D({key:new w(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var De=g.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Te(this.options)]}});g.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new D({key:new w(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return E.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Ce.node(t,t+e.nodeSize,{class:this.options.className}))}),E.create(e,a)}}})]}});var Oe=g.create({name:`gapCursor`,addProseMirrorPlugins(){return[re()]},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:a(ee(e,`allowGapCursor`,t))??null}}}),ke=`placeholder`,Ae=new w(`tiptap__placeholder`);function je(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),Ce.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function Me(e,t){return typeof e==`function`?e(t):e}function Ne({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&h(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(je({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Me(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function Pe({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&h(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(je({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Me(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...Ne({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return E.create(r,o)}function O(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function k(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function Fe(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function Ie(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function Le(e,t){let n=Fe(e,t.from,t.to);return n.push(k(e,O(e,t.from))),t.to>t.from?n.push(k(e,O(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(k(e,O(e,Math.min(t.from+1,e.content.size)))),n}function Re(e,t,n){let r=[];if(e.docChanged){let t=o(e);for(let e of t)r.push(...Le(n.doc,e.newRange))}return e.selectionSet&&(r.push(k(n.doc,O(n.doc,e.mapping.map(t.selection.anchor)))),r.push(k(n.doc,O(n.doc,n.selection.anchor)))),Ie(r)}function ze(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function Be({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=ze(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=Ne({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function Ve({editor:e,options:t,dataAttribute:n}){return{init(r,i){return Pe({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??E.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:Be({decorations:i.map(r.mapping,r.doc),ranges:Re(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function He(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Ue({editor:e,options:t}){let n=t.dataAttribute?`data-${He(t.dataAttribute)}`:`data-${ke}`,r=t.showOnlyCurrent&&!t.includeChildren;return new D({key:Ae,...r?{}:{state:Ve({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>Pe({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?E.empty:Ae.getState(n)??E.empty}})}var We=g.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:ke,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Ue({editor:this.editor,options:this.options})]}});function Ge(e,t){return!e.selection.empty&&!i(e.selection)&&t.isEditable}function Ke(e,t){return Ge(e,t)&&!t.isFocused&&!t.view.dragging}function qe(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function Je(e){e.focus()}g.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new D({key:new w(`selection`),props:{decorations(n){return Ke(n,e)?E.create(n.doc,[Ce.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return Ge(t.state,e)&&qe(),!1},focus(t){return Ge(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&Je(t)}),!1}}}})]}});function Ye({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Xe=g.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new w(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new D({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!Ye({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!Ye({node:r,types:n})}}})]}}),Ze=g.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:n})=>e(t,n),redo:()=>({state:e,dispatch:n})=>t(e,n)}},addProseMirrorPlugins(){return[n(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Qe=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new be(n,0,0);return e.replace(l,i.after(),r),e.setSelection(T.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},$e=/^\s*>\s$/,et=m.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return s(`blockquote`,{...C(this.options.HTMLAttributes,e),children:s(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
2
2
  `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
3
3
  `))}),n.join(`
4
4
  >
@@ -0,0 +1,5 @@
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,o as r,p as i,s as a,v as o}from"./react-Bk7NnOLX.js";import{Ot as s,Tt as c,ht as l,n as u,t as d}from"./x-BsePFh6d.js";import{B as f,R as p,V as m,Y as ee,et as h,tt as g}from"./snapshots-CTS2iez5.js";import{t as _}from"./session-CUCSWPTE.js";import{t as v}from"./jsx-runtime-DePvh3-m.js";import{C as y,_ as b,d as x,f as S,g as C,h as w,u as T}from"./bar-button-6Perrucg.js";import{b as te,i as ne,v as re,w as ie,x as ae}from"./dist-Dx2yV02v.js";import{t as E}from"./createLucideIcon-REX213UO.js";import{t as oe}from"./arrow-down-DzZjFrBL.js";import{t as se}from"./arrow-up-hdmh9LVD.js";import{t as ce}from"./chart-no-axes-column-CJmeYOSo.js";import{a as le,c as D,i as ue,l as de,n as fe,r as O,s as pe,t as me}from"./split-Cjm6rVDC.js";import{n as he,t as ge}from"./undo-2-DUGGyBdX.js";import{p as k}from"./index-CFqSJBZ-.js";import{t as A}from"./collaborator--S95EupA.js";import{f as j,i as _e,n as M,o as N,s as P,u as F}from"./browser-C9NP0ZYz.js";import{S as I,b as L,d as ve,f as ye,i as be,l as xe,m as Se,n as R,p as Ce,t as z,u as we,v as B,y as V}from"./words-QKSIyC_P.js";var H=E(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),U=E(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),W=[`following`,`mentionedUsers`,`subscribers`,`verified`],G=g().regex(/^[0-9]{1,19}$/u,`a post's id: 1 to 19 digits`),Te=h({file:g().min(1),alt:g().optional()},{error:e=>e.code===`invalid_type`?`a medium is { file: ./picture.png, alt: … }: its file, from this file's folder, and its alt text`:void 0}),Ee=h({options:f(g()),duration_minutes:ee().int()},{error:e=>e.code===`invalid_type`?`a poll is { options: [ … ], duration_minutes: … }`:void 0}),De=h({text:g().default(``).transform(e=>e.replace(/\n+$/u,``)),media:f(Te).optional(),poll:Ee.optional(),made_with_ai:m().optional(),paid_partnership:m().optional(),reply:h({in_reply_to_tweet_id:G}).optional(),quote_tweet_id:G.optional()},{error:e=>e.code===`invalid_type`?`a post is { text: …, media: [ … ], poll: … }`:void 0}),Oe=h({reply_settings:p(W).optional(),posts:f(De,{error:`posts is the list of its posts: posts: [ { text: … }, … ]`}).min(1,`posts holds at least one post`)},{error:e=>e.code===`invalid_type`?`an x-post's file is { posts: [ { text: … }, … ] }, with reply_settings beside posts`:void 0});function ke(e,t){let n=e;for(let e of t)if(F(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(j(n)&&typeof e==`number`){let t=n.items[e];if(!t)return n;n=t}else return n;return n}function K(e){let t=new _e,n=M(e,{lineCounter:t,prettyErrors:!1}),r=e=>{let r=ke(n.contents,e)?.range?.[0];return r===void 0?void 0:t.linePos(r).line};if(n.errors.length>0)return{errors:n.errors.map(e=>({path:[],message:e.message})),line:e=>e.length===0&&n.errors[0]?.linePos?.[0]?n.errors[0].linePos[0].line:r(e)};let i=Oe.safeParse(n.toJS());return i.success?{value:i.data,errors:[],line:r}:{errors:i.error.issues.map(e=>({path:e.path.filter(e=>typeof e==`string`||typeof e==`number`),message:e.message})),line:r}}function Ae(e,t){let n=e.createNode(t);return t.includes(`
2
+ `)&&(n.type=P.BLOCK_LITERAL),n}var q=e=>JSON.stringify(e,(e,t)=>typeof t==`object`&&t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:+(e>t))):t),J=(e,t)=>q(e)===q(t);function je(e){return{text:e.text,media:e.media===void 0||e.media.length===0?void 0:e.media,poll:e.poll}}function Me(e,t){let n=M(e),r=K(e).value;if(r!==void 0&&J(r,t))return e;F(n.contents)||(n.contents=new N),t.reply_settings===void 0?n.deleteIn([`reply_settings`]):n.getIn([`reply_settings`])!==t.reply_settings&&n.setIn([`reply_settings`],t.reply_settings);let i=n.getIn([`posts`]),a=j(i)?i:void 0,o=(a?.items??[]).map(e=>F(e)?e:void 0),s=(r?.posts??[]).map(e=>q(e)),c=new Set,l=t.posts.map(()=>void 0);t.posts.forEach((e,t)=>{let n=s.findIndex((t,n)=>!c.has(n)&&o[n]&&t===q(e));n>=0&&(c.add(n),l[t]=n)}),t.posts.forEach((e,t)=>{l[t]===void 0&&o[t]&&!c.has(t)&&(c.add(t),l[t]=t)});let u=t.posts.map((e,t)=>{let r=l[t],i=r===void 0?void 0:o[r],a=je(e);if(!i){let t=n.createNode({});t.set(`text`,Ae(n,e.text));for(let e of[`media`,`poll`])a[e]!==void 0&&t.set(e,n.createNode(a[e]));return t}let s=i.get(`text`);(typeof s!=`string`||s.replace(/\n+$/u,``)!==e.text)&&i.set(`text`,Ae(n,e.text));for(let e of[`media`,`poll`]){let t=a[e],r=i.get(e,!0);t===void 0?r!==void 0&&i.delete(e):J(r?.toJSON?.(),t)||i.set(e,n.createNode(t))}return i});return a?a.items=u:n.setIn([`posts`],n.createNode(u)),n.toString({flowCollectionPadding:!1,lineWidth:0})}function Ne(e,t,n){let r=(e,t,n)=>J(t,e)?n:t,i=t.posts.length===e.posts.length?n.posts.length:n.posts.length===e.posts.length?t.posts.length:n.posts.length,a=[];for(let o=0;o<i;o++){let i=e.posts[o],s=t.posts[o],c=n.posts[o],l=c??s;if(l===void 0)continue;if(s===void 0||c===void 0||i===void 0){a.push(l);continue}let u={...c,text:r(i.text,s.text,c.text)};delete u.media,delete u.poll,a.push({...u,...Y(`media`,r(i.media,s.media,c.media)),...Y(`poll`,r(i.poll,s.poll,c.poll))})}let o={...n,posts:a};return delete o.reply_settings,{...o,...Y(`reply_settings`,r(e.reply_settings,t.reply_settings,n.reply_settings))}}function Y(e,t){return t===void 0?{}:{[e]:t}}var X=e(o(),1),Z=v();function Pe(e){let t=e?.part??e?.board;if(typeof t!=`string`)return;let n=/^post-(\d+)$/u.exec(t)?.[1];return n===void 0?void 0:Number(n)-1}var Fe=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ie(e,t){let n=e?.posts??[],r=t.posts;for(let e=0;e<r.length;e++)if(!Fe(n[e],r[e]))return e;if(n.length>r.length&&r.length>0)return r.length-1}function Le(e,t){let n=K(e),r=n.value?.posts.length??0,i=e.split(`
3
+ `).length;for(let e=0;e<r;e++){let a=n.line([`posts`,e]);if(a===void 0)continue;let o=e+1<r?n.line([`posts`,e+1]):void 0,s=o===void 0?i:o-1;if(a<=t.to&&t.from<=s)return e}}function Re(e,t){if(e.from!==void 0&&e.path===t.path)return Le(t.text,{from:e.from,to:e.to??e.from})}var ze=class e{session;file;unreadable;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e){this.session=e,this.read(e.text),this.snapshot=this.make(),e.attach({save:e=>{if(this.file===void 0||this.unreadable!==void 0)return;let t=Me(e,this.file);return t===e?void 0:t},take:(e,t,n)=>{let r=K(e),i=K(t).value,a=n?.kind===`agent`&&r.value?Ie(i,r.value):void 0;a!==void 0&&(this.landed={post:a,at:Date.now()}),r.value?(this.file=this.file===void 0||i===void 0?r.value:Ne(i,this.file,r.value),this.unreadable=void 0):(this.file=void 0,this.unreadable=r.errors.map(e=>e.message).join(` `)),this.emit()}}),this.stops.push(e.onState(()=>{this.emit()}),e.onUndo(()=>{this.emit()}))}read(e){let t=K(e);this.file=t.value,this.unreadable=t.value?void 0:t.errors.map(e=>e.message).join(` `)}static async open(t,n){return new e(await _.open(t,n))}make(){return{file:this.file,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,landed:this.landed}}emit(){this.snapshot=this.make();for(let e of this.listeners)e()}get text(){return this.session.text}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}edit(e,t,n){let r=this.file;if(r===void 0||this.unreadable!==void 0)return;let i=t(r);if(i!==r){if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){let e=this.amending.from;this.session.undo(),this.push(this.amending.label,e,i)}else this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,r,i)}}settle(){this.amending=void 0}push(e,t,n){this.file=n,this.session.pushEdit({label:e,undo:()=>{this.file=t,this.emit()},redo:()=>{this.file=n,this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},Q=(e,t,n)=>({...e,posts:e.posts.map((e,r)=>r===t?n(e):e)});function Be(e,t){let n={...e};return t===void 0||t.length===0?delete n.media:n.media=t,n}function Ve(e){let t={...e};return delete t.poll,t}function He({text:e}){let t=z(),{weighted:n}=L(e),r=I.length.most,i=r-n,a=i<0&&n<=I.length.premium,o=n>I.length.premium,s=Math.min(1,n/r),c=2*Math.PI*9;return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs tabular-nums`,"aria-label":i>=0?t.left(i):t.over(-i),"data-testid":`x-count`,children:[i<=20?(0,Z.jsx)(`span`,{className:l(o?`text-destructive`:a?`text-warning`:`text-muted-foreground`),children:a?n:i}):null,(0,Z.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 22 22`,"aria-hidden":`true`,children:[(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:`var(--ak-x-line)`,strokeWidth:`2`}),(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:o?`#f4212e`:a||i<=20?`#ffd400`:`var(--ak-x-link)`,strokeWidth:`2`,strokeDasharray:`${String(s*c)} ${String(c)}`,transform:`rotate(-90 11 11)`})]})]})}function Ue(e){let t=z();return(0,Z.jsx)(D,{alt:e.alt??``,onAlt:e.onAlt,most:I.alt,trigger:(0,Z.jsx)(u,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,"aria-label":t.altText,children:t.alt})})}function We(e){let t=z();return(0,Z.jsx)(u,{variant:`secondary`,size:`icon-sm`,className:`bg-media/75 text-on-media absolute top-2 right-2 rounded-full`,"aria-label":t.removeMedium,onClick:e.onRemove,children:(0,Z.jsx)(d,{})})}function Ge(e){let t=z(),{options:n,duration_minutes:r}=e.poll,i={days:Math.floor(r/1440),hours:Math.floor(r%1440/60),minutes:r%60},a=(t,n)=>{let r={...i,[t]:Math.max(0,Math.floor(n))};e.onChange({...e.poll,duration_minutes:r.days*1440+r.hours*60+r.minutes})};return(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 rounded-2xl border border-[var(--ak-x-line)] p-3`,"data-testid":`x-poll`,children:[n.map((r,i)=>{let a=V(r)-I.poll.option;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`input`,{className:`aria-invalid:border-destructive h-10 flex-1 rounded-md border border-[var(--ak-x-line)] bg-transparent px-3 text-[15px] outline-none focus:border-[var(--ak-x-link)]`,value:r,"aria-invalid":a>0||void 0,maxLength:I.poll.option,placeholder:t.option(i+1),"aria-label":t.option(i+1),onChange:t=>{e.onChange({...e.poll,options:n.map((e,n)=>n===i?t.target.value:e)},`option-${String(i)}`)}}),a>0?(0,Z.jsx)(`span`,{className:`text-destructive text-sm`,children:t.over(a)}):null,n.length>I.poll.least?(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":t.removeOption,onClick:()=>{e.onChange({...e.poll,options:n.filter((e,t)=>t!==i)})},children:(0,Z.jsx)(d,{})}):null]},i)}),n.length<I.poll.most?(0,Z.jsxs)(u,{variant:`ghost`,size:`sm`,className:`self-start text-[var(--ak-x-link)]`,onClick:()=>{e.onChange({...e.poll,options:[...n,``]})},children:[(0,Z.jsx)(k,{}),t.addOption]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 border-t border-[var(--ak-x-line)] pt-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground mr-auto self-center`,children:t.pollLength}),[`days`,`hours`,`minutes`].map(e=>(0,Z.jsxs)(`label`,{className:`flex flex-col gap-0.5 text-xs`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:t[e]}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:`h-8 w-16 rounded-md border border-[var(--ak-x-line)] bg-transparent px-2 text-sm`,value:i[e],onChange:t=>{a(e,Number(t.target.value))}})]},e)),(0,Z.jsx)(u,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Ke(e){let t=z(),n=t.replies[e.value??`everyone`];return(0,Z.jsxs)(T,{children:[(0,Z.jsx)(y,{asChild:!0,disabled:e.disabled,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`sm`,className:`ak-x-c-replies -ml-2 gap-1 px-2 font-bold text-[var(--ak-x-link)]`,children:[(0,Z.jsx)(H,{}),n]})}),(0,Z.jsxs)(S,{align:`start`,className:`w-72`,children:[(0,Z.jsx)(w,{children:t.whoCanReply}),(0,Z.jsx)(C,{value:e.value??`everyone`,onValueChange:t=>{e.onChange(t===`everyone`?void 0:W.includes(t)?t:void 0)},children:[`everyone`,...W].map(e=>(0,Z.jsx)(b,{value:e,children:t.replies[e]},e))})]})]})}function qe(e){let t=z(),n=e.post.made_with_ai===!0||e.post.paid_partnership===!0;return(0,Z.jsxs)(T,{children:[(0,Z.jsx)(y,{asChild:!0,children:(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)]`,"aria-label":t.disclosure,title:t.disclosure,"aria-pressed":n,children:(0,Z.jsx)(U,{className:l(n&&`fill-current`)})})}),(0,Z.jsxs)(S,{align:`start`,className:`w-56`,children:[(0,Z.jsx)(w,{children:t.disclosure}),(0,Z.jsx)(x,{checked:e.post.made_with_ai===!0,onCheckedChange:t=>{e.onChange({made_with_ai:t})},children:t.madeWithAi}),(0,Z.jsx)(x,{checked:e.post.paid_partnership===!0,onCheckedChange:t=>{e.onChange({paid_partnership:t})},children:t.paidPartnership})]})]})}function $(e){return(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":e.label,title:e.label,disabled:e.disabled,onClick:e.onClick,children:e.children})}var Je=3e4;function Ye({doc:e,dir:r,entry:o}){let l=z(),f=a(),p=i(),m=(0,X.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[ee,h]=(0,X.useState)(),[g,_]=(0,X.useState)(0),[v,y]=(0,X.useState)(),b=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(v===void 0)return;let e=b.current[v.post];e!=null&&(e.focus(),e.setSelectionRange(v.at,v.at),_(v.post),y(void 0))},[v]);let x=m.file,{agent:S,following:C}=t(),w=ie(),T=(()=>{if(S?.doing===void 0)return;let t=Pe(S.place);if(t!==void 0)return t;let n=m.landed!==void 0&&m.landed.at>=S.at-Je;return n&&S.source?.path===o?m.landed?.post:(S.source?Re(S.source,{path:o,text:e.text}):void 0)??(n?m.landed?.post:void 0)})(),E=T!==void 0&&T<(x?.posts.length??0)?T:void 0,D=(0,X.useRef)([]),j=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(C&&E!==void 0)for(let e of[D.current[E],j.current[E]])e?.scrollIntoView({block:`nearest`})},[C,E,m.landed]);let _e=ue(r,(x?.posts??[]).flatMap(e=>(e.media??[]).map(e=>e.file)));n({hold:()=>Promise.resolve({key:`${o}@${String(e.text.length)}`,what:`The X post ${o}${(x?.posts.length??0)>1?`, a thread of ${String(x?.posts.length??0)} posts`:``}`,source:{path:o}}),locate:t=>{let n=x?.posts??[],r=K(e.text),i=e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0},a=e=>e!==void 0&&s(t,e),l=n.flatMap((e,t)=>{if(!a(i(D.current[t]))&&!a(i(j.current[t])))return[];let n=r.line([`posts`,t]);return[{name:`post ${String(t+1)} of the thread`,source:{path:o,...n===void 0?{}:{line:n}},...e.text===``?{}:{text:e.text}}]}),u=c(t)[0],d=e=>e!==void 0&&u!==void 0&&u.x>=e.x&&u.x<=e.x+e.width&&u.y>=e.y&&u.y<=e.y+e.height,f=n.findIndex((e,t)=>d(i(D.current[t]))),p=n.findIndex((e,t)=>d(i(j.current[t]))),m=f>=0?`in post ${String(f+1)}, where it is written`:p>=0?`in post ${String(p+1)}, as X's timeline will show it`:void 0;return Promise.resolve({elements:l,...m===void 0?{}:{where:m}})}});let M=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},N=(t,n,r)=>{p||e.edit(t,n,r)},P=e=>(e.media??[]).map(e=>{let t=_e.get(e.file),n=O(e.file),r=n?void 0:B(e.file.split(`.`).pop()??``);return t===void 0?{kind:`made`,label:n?l.made:e.file}:{kind:r??`picture`,src:t,alt:e.alt,file:e.file}}),F=(0,Z.jsx)(ne,{start:p?void 0:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":l.undo,title:l.undo,disabled:!m.canUndo,onClick:()=>{e.undo()},children:(0,Z.jsx)(ge,{})}),(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":l.redo,title:l.redo,disabled:!m.canRedo,onClick:()=>{e.redo()},children:(0,Z.jsx)(he,{})})]}),saved:{state:m.state},exports:{}}),L=f?.theme===`dark`;if(x===void 0)return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,children:[F,(0,Z.jsx)(`p`,{className:`text-muted-foreground mx-auto max-w-xl p-6 text-sm`,children:l.unreadable(m.unreadable??``)})]});let R=x.posts,V=Math.min(g,R.length-1),H=e=>{N(l.steps.add,t=>({...t,posts:[...t.posts.slice(0,e+1),{text:``},...t.posts.slice(e+1)]})),y({post:e+1,at:0})},U=e=>{let t=R[e],n=R[e-1];if(t===void 0||n===void 0)return!1;let r=e=>(e.media?.length??0)>0||e.poll!==void 0;if(r(t)&&r(n))return!1;let i=n.text===``||t.text===``?``:`
4
+
5
+ `;return N(l.steps.join,a=>({...a,posts:[...a.posts.slice(0,e-1),{...n,...r(t)?{...t.media?{media:t.media}:{},...t.poll?{poll:t.poll}:{}}:{},text:n.text+i+t.text},...a.posts.slice(e+1)]})),y({post:e-1,at:n.text.length+i.length}),!0},W=(0,Z.jsx)(`div`,{className:`ak-x ak-x-editing ak-x-composer`,"data-theme":L?`dark`:`light`,children:R.map((t,n)=>{let i=n===R.length-1,a=n===V,s=t.media??[],c=s.filter(e=>B(e.file.split(`.`).pop()??``)===`picture`||O(e.file)).length,f=s.length>=I.pictures||s.length>c;return(0,Z.jsxs)(`div`,{ref:e=>{D.current[n]=e},className:`ak-x-c-post`,"data-here":a?``:void 0,"data-testid":`x-post`,onFocusCapture:()=>{_(n)},onPointerDown:()=>{_(n)},children:[(0,Z.jsxs)(`div`,{className:`ak-x-side`,children:[(0,Z.jsx)(`div`,{className:`ak-x-avatar`,"aria-hidden":`true`,children:we.name.slice(0,1)}),i?null:(0,Z.jsx)(`div`,{className:`ak-x-thread-line`})]}),(0,Z.jsxs)(`div`,{className:`ak-x-body`,children:[a&&n>0&&!p?(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`ak-x-c-remove`,"aria-label":l.remove,title:l.remove,onClick:()=>{N(l.steps.remove,e=>({...e,posts:e.posts.filter((e,t)=>t!==n)})),y({post:n-1,at:R[n-1]?.text.length??0})},children:(0,Z.jsx)(d,{})}):null,(0,Z.jsxs)(`div`,{className:`ak-x-field`,children:[(0,Z.jsx)(ye,{text:t.text,whole:!0}),(0,Z.jsx)(`textarea`,{ref:e=>{b.current[n]=e},dir:`auto`,value:t.text,placeholder:n===0?l.whatsHappening:l.addAnother,"aria-label":n===0?l.whatsHappening:l.addAnother,readOnly:p,"data-testid":`x-text`,onChange:e=>{let t=e.target.value;N(l.steps.text,e=>Q(e,n,e=>({...e,text:t})),`text-${String(n)}`)},onBlur:()=>{e.settle()},onKeyDown:e=>{let t=e.currentTarget;if(e.key===`Backspace`&&n>0&&t.selectionStart===0&&t.selectionEnd===0&&!p){U(n)&&e.preventDefault();return}if(e.key!==`Enter`||!(e.metaKey||e.ctrlKey))return;e.preventDefault();let r=t.selectionStart;N(l.steps.split,e=>{let t=e.posts[n];if(!t)return e;let i=t.text.slice(0,r).replace(/\s+$/u,``),a=t.text.slice(r).replace(/^\s+/u,``);return{...e,posts:[...e.posts.slice(0,n),{...t,text:i},{text:a},...e.posts.slice(n+1)]}}),y({post:n+1,at:0})}})]}),(0,Z.jsx)(xe,{media:P(t),onAlt:p?void 0:e=>(0,Z.jsx)(Ue,{alt:s[e]?.alt,onAlt:t=>{N(l.steps.alt,r=>Q(r,n,n=>({...n,media:(n.media??[]).map((n,r)=>{if(r!==e)return n;let i={file:n.file};return t.trim()===``?i:{...i,alt:t}})})))}}),onMedium:p?void 0:e=>(0,Z.jsx)(We,{onRemove:()=>{N(l.steps.media,t=>Q(t,n,t=>Be(t,(t.media??[]).filter((t,n)=>n!==e))))}})}),t.poll===void 0?null:p?(0,Z.jsx)(`div`,{className:`ak-x-poll`,children:t.poll.options.map((e,t)=>(0,Z.jsx)(`div`,{className:`ak-x-option`,dir:`auto`,children:e},t))}):(0,Z.jsx)(Ge,{poll:t.poll,onChange:(e,t)=>{N(l.steps.poll,t=>Q(t,n,t=>({...t,poll:e})),t===void 0?void 0:`${t}-${String(n)}`)},onRemove:()=>{N(l.steps.poll,e=>Q(e,n,e=>Ve(e)))}}),t.quote_tweet_id===void 0?null:(0,Z.jsx)(Ce,{id:t.quote_tweet_id}),a?(0,Z.jsx)(Ke,{value:x.reply_settings,disabled:p,onChange:e=>{N(l.whoCanReply,t=>{let n={...t};return e===void 0?delete n.reply_settings:n.reply_settings=e,n})}}):null,a&&!p?(0,Z.jsxs)(`div`,{className:`ak-x-c-tools`,children:[(0,Z.jsxs)(re,{open:ee===n,onOpenChange:e=>{h(e?n:void 0)},children:[(0,Z.jsx)(ae,{asChild:!0,children:(0,Z.jsx)(u,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":l.addMedia,title:l.addMedia,disabled:f||t.poll!==void 0,children:(0,Z.jsx)(de,{})})}),(0,Z.jsx)(te,{className:`w-auto`,align:`start`,children:(0,Z.jsx)(fe,{self:o,types:be,testId:`x-picker`,onPick:e=>{h(void 0),N(l.steps.media,t=>Q(t,n,t=>({...t,media:[...t.media??[],{file:le(r,e)}]})))}})})]}),(0,Z.jsx)($,{label:l.addPoll,disabled:t.poll!==void 0||s.length>0,onClick:()=>{N(l.steps.poll,e=>Q(e,n,e=>({...e,poll:{options:[``,``],duration_minutes:1440}})))},children:(0,Z.jsx)(ce,{})}),(0,Z.jsx)(qe,{post:t,onChange:e=>{N(l.disclosure,t=>Q(t,n,t=>{let n={...t,...e};return n.made_with_ai!==!0&&delete n.made_with_ai,n.paid_partnership!==!0&&delete n.paid_partnership,n}))}}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)($,{label:l.moveUp,disabled:n===0,onClick:()=>{N(l.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n-1,0,r),{...e,posts:t}}),_(n-1)},children:(0,Z.jsx)(se,{})}),(0,Z.jsx)($,{label:l.moveDown,disabled:i,onClick:()=>{N(l.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n+1,0,r),{...e,posts:t}}),_(n+1)},children:(0,Z.jsx)(oe,{})}),(0,Z.jsx)(He,{text:t.text}),(0,Z.jsx)(`span`,{className:`bg-rule mx-1 h-6 w-px`,"aria-hidden":`true`}),(0,Z.jsx)(u,{variant:`outline`,size:`icon-xs`,className:`rounded-full border-[var(--ak-x-line)] text-[var(--ak-x-link)]`,"aria-label":l.addPost,title:l.addPost,onClick:()=>{H(n)},children:(0,Z.jsx)(k,{})})]}):null]}),S&&E===n?(0,Z.jsx)(A,{"data-testid":`x-agent-box`,label:w(S),className:`inset-x-1 inset-y-0`}):null]},n)})}),G=(0,Z.jsx)(`div`,{className:`ak-x`,"data-theme":L?`dark`:`light`,children:R.map((e,t)=>(0,Z.jsxs)(`div`,{ref:e=>{j.current[t]=e},className:`relative`,children:[(0,Z.jsx)(ve,{post:{text:e.text,media:P(e),poll:e.poll,quote:e.quote_tweet_id},joined:t<R.length-1,published:!0}),S&&E===t?(0,Z.jsx)(A,{"data-testid":`x-agent-shown`,className:`inset-0`}):null]},t))});return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,onKeyDown:M,children:[F,(0,Z.jsx)(Se.Provider,{value:pe,children:(0,Z.jsx)(me,{edit:W,preview:G,width:598,background:L?`#000000`:`#ffffff`,testId:`x-preview`})})]})}function Xe(){let e=z(),t=r(),n=a(),i=n?.item.entry,o=n?.item.dir??``,[s,c]=(0,X.useState)(),[l,u]=(0,X.useState)();return(0,X.useEffect)(()=>{if(i===void 0)return;let e,n=!0;return ze.open(t,i).then(t=>{n?(e=t,c(t)):t.close()},e=>{n&&u(e instanceof Error?e.message:String(e))}),()=>{n=!1,e?.close()}},[t,i]),!s||i===void 0?(0,Z.jsx)(`div`,{className:`text-muted-foreground flex size-full items-center justify-center text-sm`,"data-testid":`x-post-editor`,"data-state":l===void 0?`loading`:`error`,children:l===void 0?e.loading:e.couldNotOpen(l)}):(0,Z.jsx)(Ye,{doc:s,dir:o,entry:i})}export{ze as PostDocument,R as WORDS,Xe as XPostEditor,Xe as default};