uigraph 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/README.md +30 -51
  2. package/dist/bin.mjs +1608 -59037
  3. package/dist/viewer/assets/abnfDiagram-VCTEODGH-D7zWJuPJ.js +1 -0
  4. package/dist/viewer/assets/actor-avatar-Bu-mKKXB.js +1 -0
  5. package/dist/viewer/assets/{api-adapters-CnQpLiWI.js → api-adapters-tfr51BsS.js} +1 -1
  6. package/dist/viewer/assets/{api-endpoints-DCA5GNpC.js → api-endpoints-D-Whnnwd.js} +9 -9
  7. package/dist/viewer/assets/{api-group-endpoints-page-Di42W69y.js → api-group-endpoints-page-B9R1EI4i.js} +9 -9
  8. package/dist/viewer/assets/{arc-Cn8owoDw.js → arc-DauzQXFu.js} +1 -1
  9. package/dist/viewer/assets/architectureDiagram-5GKGNRK7-CXzgHd-c.js +36 -0
  10. package/dist/viewer/assets/{arrow-left-DWcMgM2U.js → arrow-left-DpQqmf17.js} +1 -1
  11. package/dist/viewer/assets/avatar-DAFUyk1i.js +43 -0
  12. package/dist/viewer/assets/badge-hR3QvPWv.js +1 -0
  13. package/dist/viewer/assets/better-delete-confirmation-modal-CGEQ5O4X.js +1 -0
  14. package/dist/viewer/assets/better-dialog-DcIxFWwk.js +1 -0
  15. package/dist/viewer/assets/{blockDiagram-I7D4REHJ-CbYzOsL_.js → blockDiagram-I7D4REHJ-CFHWUw4z.js} +2 -2
  16. package/dist/viewer/assets/{brands-Bd4RklRx.js → brands-DtmA1AhP.js} +1 -1
  17. package/dist/viewer/assets/button-DZj74qS7.js +1 -0
  18. package/dist/viewer/assets/{c4Diagram-7LVT6UL2-CLkVbphC.js → c4Diagram-7LVT6UL2-BHSggPKI.js} +6 -6
  19. package/dist/viewer/assets/{calendar-C0xdI_ag.js → calendar-Bolgc8E5.js} +1 -1
  20. package/dist/viewer/assets/channel-CNRSofFP.js +1 -0
  21. package/dist/viewer/assets/{check-XjanpAFg.js → check-BpmCQNbj.js} +1 -1
  22. package/dist/viewer/assets/checkbox-CFJfXL6R.js +1 -0
  23. package/dist/viewer/assets/{chevron-down-R7pQzyLD.js → chevron-down-DDsUE_xz.js} +1 -1
  24. package/dist/viewer/assets/{chevron-up-CRPypfOs.js → chevron-up-DVznKMGv.js} +1 -1
  25. package/dist/viewer/assets/{chunk-2Q5K7J3B-CcvtugCu.js → chunk-2Q5K7J3B-CNfz5YDQ.js} +1 -1
  26. package/dist/viewer/assets/{chunk-5VM5RSS4-CpZHHr12.js → chunk-5VM5RSS4-CwIhjvMe.js} +1 -1
  27. package/dist/viewer/assets/{chunk-F27PBJKO-DeAl4iOc.js → chunk-F27PBJKO-YFexFJof.js} +1 -1
  28. package/dist/viewer/assets/{chunk-IMKFNOWR-BfrPe7pS.js → chunk-IMKFNOWR-GY2yrvuo.js} +1 -1
  29. package/dist/viewer/assets/{chunk-JWPE2WC7-DDjyvUmZ.js → chunk-JWPE2WC7-xd0JGvne.js} +1 -1
  30. package/dist/viewer/assets/chunk-OB3PAWPO-DJIP1M4r.js +12 -0
  31. package/dist/viewer/assets/{chunk-POPQ4Y6H-DkDb0mzz.js → chunk-POPQ4Y6H-Bh6rizEy.js} +1 -1
  32. package/dist/viewer/assets/{chunk-SVP7TREG-D-K2XIGs.js → chunk-SVP7TREG-DtNrjvpq.js} +1 -1
  33. package/dist/viewer/assets/{chunk-TICWLB2K-DWMQQx6z.js → chunk-TICWLB2K-DrERwtw8.js} +1 -1
  34. package/dist/viewer/assets/{chunk-XXDRQBXY-DfkljAyM.js → chunk-XXDRQBXY-fYo04iwY.js} +1 -1
  35. package/dist/viewer/assets/{circle-alert-pm13M-Ef.js → circle-alert-Bl7DXYD_.js} +1 -1
  36. package/dist/viewer/assets/classDiagram-ZZMXUADV-D7PO-ME9.js +1 -0
  37. package/dist/viewer/assets/classDiagram-v2-VYDZK3BY-D7PO-ME9.js +1 -0
  38. package/dist/viewer/assets/color-input-ClkkG_kZ.js +11 -0
  39. package/dist/viewer/assets/{common-Y7ySZBdh.js → common-DLCsGQ-t.js} +1 -1
  40. package/dist/viewer/assets/{component-icons-D1BDAuEt.js → component-icons-MJ61E9nt.js} +2 -2
  41. package/dist/viewer/assets/{copy-CN4K2f_R.js → copy-DMJJonQF.js} +1 -1
  42. package/dist/viewer/assets/cose-bilkent-JH36ORCC-Dplz8nVT.js +1 -0
  43. package/dist/viewer/assets/cross-button-D5qst1tj.js +1 -0
  44. package/dist/viewer/assets/{cynefin-OW5HDTMX-yz-uw9Kz.js → cynefin-OW5HDTMX-DiBs4CI8.js} +1 -1
  45. package/dist/viewer/assets/cynefinDiagram-5FMLGOSQ-COXS8-dI.js +62 -0
  46. package/dist/viewer/assets/{dagre-GXQ25YYZ-zjZDwXOe.js → dagre-GXQ25YYZ-K8qvfG8D.js} +2 -2
  47. package/dist/viewer/assets/dashboard-diagrams-page-Cb0xNr4W.js +2 -0
  48. package/dist/viewer/assets/dashboard-diagrams-page-inner-CD--zr5q.js +1 -0
  49. package/dist/viewer/assets/dashboard-docs-page-BfWR9Ai9.js +2 -0
  50. package/dist/viewer/assets/dashboard-docs-page-inner-BLbX-YwF.js +67 -0
  51. package/dist/viewer/assets/dashboard-layout-sTeeHNsZ.js +1 -0
  52. package/dist/viewer/assets/dashboard-lens-layout-D-tu_4kn.js +1 -0
  53. package/dist/viewer/assets/dashboard-map-frame-page-7pDmbTSe.js +1 -0
  54. package/dist/viewer/assets/dashboard-plans-page-CfwOZ34A.js +1 -0
  55. package/dist/viewer/assets/dashboard-service-apis-k93fjW51.js +1 -0
  56. package/dist/viewer/assets/{dashboard-service-diagrams-CIjk95Jk.js → dashboard-service-diagrams-BIWUxX-Y.js} +3 -3
  57. package/dist/viewer/assets/dashboard-service-docs-CnniTD6Q.js +1 -0
  58. package/dist/viewer/assets/{dashboard-service-overview-CzePVPjl.js → dashboard-service-overview-CGBu4omY.js} +5 -5
  59. package/dist/viewer/assets/dashboard-services-DEscIO2O.js +1 -0
  60. package/dist/viewer/assets/{db-type-badge-DOgu1Pyc.js → db-type-badge-UbPgpwQf.js} +2 -2
  61. package/dist/viewer/assets/debounce-Cp8eREM4-D7o-Pzb-.js +2 -0
  62. package/dist/viewer/assets/{dependencies-CYdEztHw.js → dependencies-DK2GDlhQ.js} +1 -1
  63. package/dist/viewer/assets/{dependency-graph-DbyfN-rC.js → dependency-graph-xBEnCS0J.js} +3 -3
  64. package/dist/viewer/assets/{diagram-S7CK7UJ4-q-NHkUCx.js → diagram-S7CK7UJ4-D-liadVe.js} +2 -2
  65. package/dist/viewer/assets/diagram-UQ7AKVKN-CnA8mgXp.js +41 -0
  66. package/dist/viewer/assets/{diagram-VSXAHHWV-DZc1kHGx.js → diagram-VSXAHHWV-Ck7dgRFR.js} +2 -2
  67. package/dist/viewer/assets/diagram-VX7I27RA-Cm1LHbu3.js +24 -0
  68. package/dist/viewer/assets/diagram-Z3DM3KII-DV3yBUCB.js +24 -0
  69. package/dist/viewer/assets/diagram-live-preview-DzJ7Nxp1.js +2 -0
  70. package/dist/viewer/assets/{diagram-portal-page-CWxuok9E.js → diagram-portal-page-gguGLULH.js} +24 -24
  71. package/dist/viewer/assets/{diagrams-C1xkRPqT.js → diagrams-BqBSv2eb.js} +4 -4
  72. package/dist/viewer/assets/dialog-D7wzTt0L.js +6 -0
  73. package/dist/viewer/assets/{doc-file-content-B06roi8L.js → doc-file-content-Be0au9Vo.js} +4 -4
  74. package/dist/viewer/assets/{download-CLdCXVsO.js → download-DhyZ3g4F.js} +1 -1
  75. package/dist/viewer/assets/ebnfDiagram-PWID7BFC-BXbHVQvG.js +1 -0
  76. package/dist/viewer/assets/{editor-vqK4qAnB.js → editor-F9o4zoeB.js} +2 -2
  77. package/dist/viewer/assets/{erDiagram-RLTQ6QDP-BWuA-aqV.js → erDiagram-RLTQ6QDP-DMfiWput.js} +2 -2
  78. package/dist/viewer/assets/{file-text-BvszilVL.js → file-text-BFqJQ67P.js} +1 -1
  79. package/dist/viewer/assets/flow-diagram-preview-B83UU1n_.js +1 -0
  80. package/dist/viewer/assets/{flowDiagram-HODETNUW-Db0QtNj4.js → flowDiagram-HODETNUW-BNFS2Mkr.js} +1 -1
  81. package/dist/viewer/assets/ganttDiagram-EL5Y4UJY-DFDsYJNp.js +292 -0
  82. package/dist/viewer/assets/gitGraphDiagram-WWUBYQGX-BVHabPDp.js +106 -0
  83. package/dist/viewer/assets/global-loader-XJO9_e0l.js +1 -0
  84. package/dist/viewer/assets/{globe-Jl6eIZmG.js → globe-CJ35KsQW.js} +1 -1
  85. package/dist/viewer/assets/gql-FFIj8zdp.js +1 -0
  86. package/dist/viewer/assets/{grid-scroll-body-CPqSxU6-.js → grid-scroll-body-DC5pYDPJ.js} +2 -2
  87. package/dist/viewer/assets/iconBase-DtqdW2XR.js +1 -0
  88. package/dist/viewer/assets/index-B6MxYIzs.js +1 -0
  89. package/dist/viewer/assets/index-BC5xdBQU.js +48 -0
  90. package/dist/viewer/assets/index-BIrx3oY4.js +1 -0
  91. package/dist/viewer/assets/{index-jm22RWpY.js → index-BZGsDmUx.js} +5 -5
  92. package/dist/viewer/assets/{index-Poftp9f1.js → index-BZXhpoWr.js} +4 -4
  93. package/dist/viewer/assets/index-Bn2bqqMd.js +1 -0
  94. package/dist/viewer/assets/{index-HU5pz3kj.js → index-BpCVYTvP.js} +36 -36
  95. package/dist/viewer/assets/{index-Bt2YHgxl.js → index-CBOYhBKJ.js} +1 -1
  96. package/dist/viewer/assets/index-CH7cEAxj.js +17 -0
  97. package/dist/viewer/assets/index-CIf0GId3.js +74 -0
  98. package/dist/viewer/assets/{index-D7MEHpJf.js → index-Ck66Ic_p.js} +4 -4
  99. package/dist/viewer/assets/index-Cp9mIQ8F.js +1 -0
  100. package/dist/viewer/assets/{index-c6Bxcoqm.js → index-DDmBuMKI.js} +1 -1
  101. package/dist/viewer/assets/{index-BSyJbFDG.js → index-DY3BFyb6.js} +1 -1
  102. package/dist/viewer/assets/{index-BS94XVnd.js → index-DkzZ-ZvR.js} +1 -1
  103. package/dist/viewer/assets/{index-C_43VC19.js → index-PglMbhys.js} +1 -1
  104. package/dist/viewer/assets/infoDiagram-27XIBGKW-CG-wwxBf.js +2 -0
  105. package/dist/viewer/assets/input--C59pq6j.js +1 -0
  106. package/dist/viewer/assets/{ishikawaDiagram-5VMMS53U-C4PzFnZ4.js → ishikawaDiagram-5VMMS53U-BlgV7ceJ.js} +2 -2
  107. package/dist/viewer/assets/{journeyDiagram-3NMN7TZE-Dpn3bBNo.js → journeyDiagram-3NMN7TZE-Cn03_Xl6.js} +2 -2
  108. package/dist/viewer/assets/{kanban-definition-UXKFOSKX-CJ99H4G6.js → kanban-definition-UXKFOSKX-CJogvDPY.js} +6 -6
  109. package/dist/viewer/assets/{layout-Bfvxt_D5.js → layout-B26eC4yQ.js} +1 -1
  110. package/dist/viewer/assets/{lens-run-page-DZneics-.js → lens-run-page-Ba1ppzJt.js} +3 -3
  111. package/dist/viewer/assets/lens-runs-page-BnUS57LM.js +1 -0
  112. package/dist/viewer/assets/{link-2-C75goIOt.js → link-2-D1e0xznG.js} +1 -1
  113. package/dist/viewer/assets/linked-project-dot-BY1gEES9.js +543 -0
  114. package/dist/viewer/assets/{loader-circle-C5jZoM7X.js → loader-circle-CiqyoJF7.js} +1 -1
  115. package/dist/viewer/assets/{merge-Cy7YkrN7.js → merge-BhOMvhW1.js} +1 -1
  116. package/dist/viewer/assets/mermaid.core-BDgZg3kW.js +312 -0
  117. package/dist/viewer/assets/method-badge-DErZP7y5.js +1 -0
  118. package/dist/viewer/assets/{mindmap-definition-YA3MSWOX-yQCKA-K4.js → mindmap-definition-YA3MSWOX-DFkLu0ac.js} +2 -2
  119. package/dist/viewer/assets/nav-links-DZWMpwMR.js +61 -0
  120. package/dist/viewer/assets/{network-COWNXGMM.js → network-B1apzT1s.js} +1 -1
  121. package/dist/viewer/assets/{nosql-editor-modal-DTiWkc_r.js → nosql-editor-modal-CvH0SWAi.js} +5 -5
  122. package/dist/viewer/assets/not-found-page-C-fn8QeM.js +1 -0
  123. package/dist/viewer/assets/organization-dependency-graph-page-BryP-iJL.js +1 -0
  124. package/dist/viewer/assets/pegDiagram-XKGWAZYB-g1cM14-L.js +1 -0
  125. package/dist/viewer/assets/{pieDiagram-E7YTZNPT-DqnkpCX4.js → pieDiagram-E7YTZNPT-WEnDsMY3.js} +2 -2
  126. package/dist/viewer/assets/{plus-DQakmTjA.js → plus-DbyuOgKB.js} +1 -1
  127. package/dist/viewer/assets/popover-476u3TN0.js +1 -0
  128. package/dist/viewer/assets/preload-helper-BlTxHScW.js +1 -0
  129. package/dist/viewer/assets/{quadrantDiagram-AXDQQJYC-iQjJfars.js → quadrantDiagram-AXDQQJYC-NdfQCpzF.js} +2 -2
  130. package/dist/viewer/assets/query-D9oj6LGx.js +50 -0
  131. package/dist/viewer/assets/{quill-rCHj4fCw.js → quill-Cde5JMRD.js} +1 -1
  132. package/dist/viewer/assets/railroadDiagram-O6MQD6OU-BYhlXlMY.js +1 -0
  133. package/dist/viewer/assets/{react-BNzYaZuG.js → react-Bx48XWN4.js} +1 -1
  134. package/dist/viewer/assets/react-flow-wrapper-BcbvHgxz.js +277 -0
  135. package/dist/viewer/assets/{requirementDiagram-BXWQKSXE-Bv-Vh1dW.js → requirementDiagram-BXWQKSXE-C25Bcm2L.js} +2 -2
  136. package/dist/viewer/assets/{sankeyDiagram-P5KCCOFB-C__uD07f.js → sankeyDiagram-P5KCCOFB-h8LiCsgk.js} +2 -2
  137. package/dist/viewer/assets/scroll-area-RagrStGj.js +6 -0
  138. package/dist/viewer/assets/{search-DW-qhXLk.js → search-vw7ucoOs.js} +1 -1
  139. package/dist/viewer/assets/section-loader-C4hOfhQS.js +1 -0
  140. package/dist/viewer/assets/section-not-found-BnrXiPog.js +1 -0
  141. package/dist/viewer/assets/select-D9fbrr7O.js +1 -0
  142. package/dist/viewer/assets/{sequenceDiagram-WJ2MYXX4-1RbvcHwO.js → sequenceDiagram-WJ2MYXX4-CDRVvD30.js} +2 -2
  143. package/dist/viewer/assets/{service-context-C17u_Fw9.js → service-context-D5nBtU18.js} +1 -1
  144. package/dist/viewer/assets/{service-database-list-page-cYuDHIls.js → service-database-list-page-DBjaDLVy.js} +2 -2
  145. package/dist/viewer/assets/service-database-page-CenNCgwf.js +2 -0
  146. package/dist/viewer/assets/service-database-page-inner-gS51TQTZ.js +85 -0
  147. package/dist/viewer/assets/{service-doc-Dir8g83J.js → service-doc-C-jHqT1U.js} +4 -4
  148. package/dist/viewer/assets/{service-doc-preview-modal-bJ6tJ5YR.js → service-doc-preview-modal-5sX6FOu1.js} +2 -2
  149. package/dist/viewer/assets/service-layout-Bf0vZBCH.js +1 -0
  150. package/dist/viewer/assets/service-pages-CFikvX4t.js +1 -0
  151. package/dist/viewer/assets/{services-Crqkffr5.js → services-Ivav34WC.js} +4 -4
  152. package/dist/viewer/assets/{share-2-BmYmqN4k.js → share-2-CQEaWbfH.js} +1 -1
  153. package/dist/viewer/assets/sizeCapture-INFHLROL-BJ6ndnPM.js +1 -0
  154. package/dist/viewer/assets/stateDiagram-D77RDMKH-B_tNCX3o.js +1 -0
  155. package/dist/viewer/assets/stateDiagram-v2-MP3YSRHH-Dl9wqdli.js +1 -0
  156. package/dist/viewer/assets/{style-DgSU0bQl.js → style-BPesJvJr.js} +8 -8
  157. package/dist/viewer/assets/super-circle-loader-DSkos6uP.js +1 -0
  158. package/dist/viewer/assets/super-logo-loader-Cxlbn6MB.js +1 -0
  159. package/dist/viewer/assets/swimlanes-42K2YHIH-CzURzYwf.js +1 -0
  160. package/dist/viewer/assets/swimlanesDiagram-VR7AAH4N-DrIlwFtk.js +8 -0
  161. package/dist/viewer/assets/table-B4pFND-o.js +1 -0
  162. package/dist/viewer/assets/textarea-Clgdv3Oi.js +1 -0
  163. package/dist/viewer/assets/{timeline-definition-24CTP7MA-C4yuLwUH.js → timeline-definition-24CTP7MA-D0YXQE1U.js} +2 -2
  164. package/dist/viewer/assets/ui-graph-logo-gHowu5gP.js +1 -0
  165. package/dist/viewer/assets/{upload-CRsS43j9.js → upload-CYb3nN_5.js} +1 -1
  166. package/dist/viewer/assets/{uploads-BOQHX9l4.js → uploads-CX2kdXbM.js} +8 -8
  167. package/dist/viewer/assets/{use-debounced-value-Ba-kkCUY.js → use-debounced-value-BpNFJd3C.js} +1 -1
  168. package/dist/viewer/assets/{use-localstorage-DIisTx-J.js → use-localstorage-D233xVb0.js} +1 -1
  169. package/dist/viewer/assets/use-permissions-BvmxJJ5r.js +1 -0
  170. package/dist/viewer/assets/{use-scoped-storage-C4RzED-E.js → use-scoped-storage-DL1XVp1j.js} +1 -1
  171. package/dist/viewer/assets/useMutation-D5ZHwHsx.js +1 -0
  172. package/dist/viewer/assets/useQuery-Dhe6uxrL.js +1 -0
  173. package/dist/viewer/assets/{vennDiagram-4TSXK5OY-BCtqXZqe.js → vennDiagram-4TSXK5OY-SSjHlqCQ.js} +2 -2
  174. package/dist/viewer/assets/{wardleyDiagram-VM6X3IG4-D3OtZJoT.js → wardleyDiagram-VM6X3IG4-CZWNdQxH.js} +2 -2
  175. package/dist/viewer/assets/{xychartDiagram-S5SC5T6Z-DxLL2CHH.js → xychartDiagram-S5SC5T6Z-B2qAGeb0.js} +2 -2
  176. package/dist/viewer/assets/zod-BMU4UTQt.js +1 -0
  177. package/dist/viewer/index.html +10 -1
  178. package/package.json +57 -57
  179. package/dist/abort-signals-B4fc3ahg.mjs +0 -34
  180. package/dist/agents.md +0 -28
  181. package/dist/anthropic-messages-KPxCHqBN.mjs +0 -14327
  182. package/dist/auth-storage-BvNH97p9.mjs +0 -2180
  183. package/dist/azure-openai-config-BbeCSg4y.mjs +0 -55
  184. package/dist/azure-openai-responses-BRzy8RfL.mjs +0 -182
  185. package/dist/classifier-shared-DBUHiTGw.mjs +0 -105
  186. package/dist/cli-2R6QQFp1.mjs +0 -451
  187. package/dist/cloudflare-workers-ai-system-one-BfqwmRQf.mjs +0 -44
  188. package/dist/config-D8DMGzIq.mjs +0 -647
  189. package/dist/cross-spawn-B2jIQPlu.mjs +0 -404
  190. package/dist/diagnostics-xdSgQR8t.mjs +0 -131
  191. package/dist/dist-BRyghrKX.mjs +0 -404
  192. package/dist/dist-D0EzrblG.mjs +0 -12161
  193. package/dist/dist-EKhnHWHG.mjs +0 -140221
  194. package/dist/dist-pQtuusFv.mjs +0 -1243
  195. package/dist/easter-egg-3d-C9_btlWn.mjs +0 -1225
  196. package/dist/env-api-keys-uytNub6O.mjs +0 -122
  197. package/dist/error-body-FhmCtR7m.mjs +0 -101
  198. package/dist/esm-D5isprgl.mjs +0 -1533
  199. package/dist/esm-DnqE4pfM.mjs +0 -104876
  200. package/dist/execute-BoTKl80U.mjs +0 -1715
  201. package/dist/github-copilot-headers-DWcTgoXr.mjs +0 -22
  202. package/dist/google-generative-ai-Brs5YpJo.mjs +0 -332
  203. package/dist/google-shared-2CyYa4VE.mjs +0 -33438
  204. package/dist/google-vertex-DZDUQPKa.mjs +0 -378
  205. package/dist/hash-DN7ukSfd.mjs +0 -16
  206. package/dist/headers-GhQHLk-3.mjs +0 -17
  207. package/dist/jiti-9kWALm4Y.mjs +0 -5439
  208. package/dist/jiti-loader-f21DrY1K.mjs +0 -27
  209. package/dist/jiti-static-loader-BI_w28l7.mjs +0 -41704
  210. package/dist/json-parse-B2mHg7o7.mjs +0 -381
  211. package/dist/keybinding-hints-D0nLU3ZH.mjs +0 -17899
  212. package/dist/lib-Dj1gKQJc.mjs +0 -24379
  213. package/dist/llama-cpp-classify-C73BoMYd.mjs +0 -344
  214. package/dist/mistral-conversations-DXVR7znL.mjs +0 -698
  215. package/dist/models-DBdii9gQ.mjs +0 -1255
  216. package/dist/multipart-parser-DLw9Z0uJ.mjs +0 -298
  217. package/dist/node-B0NU8X55.mjs +0 -2479
  218. package/dist/node-B8gaKm9g.mjs +0 -23
  219. package/dist/openai-I3_AqKDX.mjs +0 -17357
  220. package/dist/openai-codex-responses-PcZHDuBD.mjs +0 -1198
  221. package/dist/openai-completions-a_mH01ii.mjs +0 -994
  222. package/dist/openai-decisions-Du8y4mQG.mjs +0 -142
  223. package/dist/openai-prompt-cache-Bc6qNWt0.mjs +0 -8
  224. package/dist/openai-responses-a9lV_U7O.mjs +0 -270
  225. package/dist/openai-responses-shared-CDs_PBiH.mjs +0 -598
  226. package/dist/openrouter-images-D0Zc8Cjs.mjs +0 -125
  227. package/dist/photon_rs-DCvMOMu0.mjs +0 -4252
  228. package/dist/pi-messages-B5ietIBq.mjs +0 -306
  229. package/dist/plan-prompt.md +0 -56
  230. package/dist/prompt.md +0 -44
  231. package/dist/provider-env-BJhgA66g.mjs +0 -37
  232. package/dist/provider-retry-DXYM7rVE.mjs +0 -79
  233. package/dist/runtime-DTkBxiaM.mjs +0 -2822
  234. package/dist/sanitize-unicode-CqChtoM6.mjs +0 -26
  235. package/dist/shell-836_JFnI.mjs +0 -162
  236. package/dist/source-CKPndhKl.mjs +0 -478
  237. package/dist/src-DNm2QRm3.mjs +0 -5028
  238. package/dist/system-one-shared-DUAFtNa8.mjs +0 -75
  239. package/dist/token-DEUkymby.mjs +0 -56
  240. package/dist/token-util-Cx5S4eKt.mjs +0 -3
  241. package/dist/tool-DHDYqsyG.mjs +0 -6673
  242. package/dist/transform-messages-BClk99Vn.mjs +0 -477
  243. package/dist/typesafe-system-one-D2d8j8hZ.mjs +0 -24
  244. package/dist/typescript-Br-vsRJV.mjs +0 -6737
  245. package/dist/uuid-CNCZqNBb.mjs +0 -49
  246. package/dist/v2-1z8ijsD3.mjs +0 -6120
  247. package/dist/viewer/assets/abnfDiagram-VCTEODGH-j5YaKnl9.js +0 -1
  248. package/dist/viewer/assets/actor-avatar-DqmoY8Xc.js +0 -1
  249. package/dist/viewer/assets/architectureDiagram-5GKGNRK7-D80cJKz_.js +0 -36
  250. package/dist/viewer/assets/avatar-BI7D-Aia.js +0 -43
  251. package/dist/viewer/assets/badge-870-A4Y6.js +0 -1
  252. package/dist/viewer/assets/better-delete-confirmation-modal-Dib31LVb.js +0 -1
  253. package/dist/viewer/assets/better-dialog-D3AAiahr.js +0 -1
  254. package/dist/viewer/assets/button-DadqadpO.js +0 -1
  255. package/dist/viewer/assets/channel-DRkt3LIn.js +0 -1
  256. package/dist/viewer/assets/checkbox-BXpR079x.js +0 -1
  257. package/dist/viewer/assets/classDiagram-ZZMXUADV-G5CebNaC.js +0 -1
  258. package/dist/viewer/assets/classDiagram-v2-VYDZK3BY-G5CebNaC.js +0 -1
  259. package/dist/viewer/assets/color-input-Efm-lxDy.js +0 -11
  260. package/dist/viewer/assets/cose-bilkent-JH36ORCC-CrSHFmnp.js +0 -1
  261. package/dist/viewer/assets/cross-button-5Sr5rWVP.js +0 -1
  262. package/dist/viewer/assets/cynefinDiagram-5FMLGOSQ-Bdl_eBdu.js +0 -62
  263. package/dist/viewer/assets/dashboard-diagrams-page-DMupOe1m.js +0 -2
  264. package/dist/viewer/assets/dashboard-diagrams-page-inner-Dh0yKh2A.js +0 -1
  265. package/dist/viewer/assets/dashboard-docs-page-DWJ1qOQz.js +0 -2
  266. package/dist/viewer/assets/dashboard-docs-page-inner-Fs6G3oGo.js +0 -67
  267. package/dist/viewer/assets/dashboard-layout-D36InAaB.js +0 -1
  268. package/dist/viewer/assets/dashboard-lens-layout-Cv1Xx3hY.js +0 -1
  269. package/dist/viewer/assets/dashboard-map-frame-page-CTn61NUO.js +0 -1
  270. package/dist/viewer/assets/dashboard-plans-page-DxFJkrgK.js +0 -1
  271. package/dist/viewer/assets/dashboard-service-apis-BHtD9s5z.js +0 -1
  272. package/dist/viewer/assets/dashboard-service-docs-Uv_1uxxO.js +0 -1
  273. package/dist/viewer/assets/dashboard-services-CUP-L4Jg.js +0 -1
  274. package/dist/viewer/assets/diagram-UQ7AKVKN-DhFcurW6.js +0 -41
  275. package/dist/viewer/assets/diagram-VX7I27RA-DE1nREE8.js +0 -24
  276. package/dist/viewer/assets/diagram-Z3DM3KII-CSrYcCbc.js +0 -24
  277. package/dist/viewer/assets/diagram-live-preview-i5doxXLH.js +0 -2
  278. package/dist/viewer/assets/dialog-D_HtNS17.js +0 -6
  279. package/dist/viewer/assets/ebnfDiagram-PWID7BFC-BfL8m_sf.js +0 -1
  280. package/dist/viewer/assets/flow-diagram-preview-T0Z4iMVU.js +0 -1
  281. package/dist/viewer/assets/ganttDiagram-EL5Y4UJY-CsITpniw.js +0 -292
  282. package/dist/viewer/assets/gitGraphDiagram-WWUBYQGX-B4eCBGoe.js +0 -106
  283. package/dist/viewer/assets/iconBase-BoDZfJgC.js +0 -1
  284. package/dist/viewer/assets/index-5E1tJ7yK.js +0 -125
  285. package/dist/viewer/assets/index-7XpV2DRw.js +0 -1
  286. package/dist/viewer/assets/index-C0Rs3s9Z.js +0 -1
  287. package/dist/viewer/assets/index-CzHjJWeV.js +0 -1
  288. package/dist/viewer/assets/index-DcEA6SIV.js +0 -74
  289. package/dist/viewer/assets/infoDiagram-27XIBGKW-lTebN5Ix.js +0 -2
  290. package/dist/viewer/assets/input-YvHTVS0E.js +0 -1
  291. package/dist/viewer/assets/lens-runs-page-DoAOObxx.js +0 -1
  292. package/dist/viewer/assets/linked-project-dot-Ds2uEmJ9.js +0 -543
  293. package/dist/viewer/assets/mermaid.core-BCRBv8Us.js +0 -312
  294. package/dist/viewer/assets/method-badge-DMYDKdDZ.js +0 -1
  295. package/dist/viewer/assets/nav-links-8vT2ixiI.js +0 -61
  296. package/dist/viewer/assets/not-found-page-CnfLlhS4.js +0 -1
  297. package/dist/viewer/assets/organization-dependency-graph-page-3xqIxjNx.js +0 -1
  298. package/dist/viewer/assets/pegDiagram-XKGWAZYB-CMXqeAum.js +0 -1
  299. package/dist/viewer/assets/popover-CN9ni1N3.js +0 -1
  300. package/dist/viewer/assets/railroadDiagram-O6MQD6OU-CfqToX3W.js +0 -1
  301. package/dist/viewer/assets/react-flow-wrapper-BPlRstyO.js +0 -276
  302. package/dist/viewer/assets/scroll-area-BodE-n7W.js +0 -6
  303. package/dist/viewer/assets/section-loader-BzpYM_Nx.js +0 -1
  304. package/dist/viewer/assets/select-DDtnmSET.js +0 -1
  305. package/dist/viewer/assets/service-database-page-CMi1wF4h.js +0 -2
  306. package/dist/viewer/assets/service-database-page-inner-CoqAj93L.js +0 -85
  307. package/dist/viewer/assets/service-layout-0NMm_bKG.js +0 -1
  308. package/dist/viewer/assets/service-pages-dfnc91SU.js +0 -1
  309. package/dist/viewer/assets/sizeCapture-INFHLROL-BRJi3gCg.js +0 -1
  310. package/dist/viewer/assets/stateDiagram-D77RDMKH-DdLsfxgy.js +0 -1
  311. package/dist/viewer/assets/stateDiagram-v2-MP3YSRHH-DFwg8Qki.js +0 -1
  312. package/dist/viewer/assets/super-circle-loader-D8MElOMh.js +0 -1
  313. package/dist/viewer/assets/super-logo-loader-DJYiRbCS.js +0 -1
  314. package/dist/viewer/assets/swimlanes-42K2YHIH-AuYjrPqh.js +0 -1
  315. package/dist/viewer/assets/swimlanesDiagram-VR7AAH4N-0nIGA8_4.js +0 -8
  316. package/dist/viewer/assets/table-Bi4Auk9Z.js +0 -1
  317. package/dist/viewer/assets/textarea-MgxZ5x6-.js +0 -1
  318. package/dist/viewer/assets/ui-graph-logo-D4jRhd4z.js +0 -1
  319. package/dist/viewer/assets/use-permissions-6JVET753.js +0 -1
  320. package/dist/viewer/assets/useMutation-CmVaR9zz.js +0 -1
  321. package/dist/viewer/assets/useQuery-B8yYhO0c.js +0 -1
  322. package/dist/viewer/assets/zod-Dc4H6VVJ.js +0 -1
  323. package/dist/virtual-modules-DnCx0Gdx.mjs +0 -340
@@ -1,276 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor-vqK4qAnB.js","assets/index-5E1tJ7yK.js","assets/index-m8s6_jQi.css","assets/quill-rCHj4fCw.js","assets/mermaid.core-BCRBv8Us.js","assets/transform-BqqRT-Iy.js","assets/merge-Cy7YkrN7.js","assets/index-HU5pz3kj.js","assets/index-DcEA6SIV.js","assets/index-Dj_05fqk.js","assets/last-DXTTfs9a.js","assets/index-C0Rs3s9Z.js","assets/value-wA6veExk.js","assets/react-BNzYaZuG.js","assets/nav-links-8vT2ixiI.js","assets/iconBase-BoDZfJgC.js","assets/component-icons-D1BDAuEt.js","assets/component-icons-BD8MpcyB.css","assets/style-DgSU0bQl.js","assets/index-D7MEHpJf.js","assets/style-BnuhLJ6X.css","assets/use-localstorage-DIisTx-J.js","assets/avatar-BI7D-Aia.js","assets/useMutation-CmVaR9zz.js","assets/useQuery-B8yYhO0c.js","assets/index-C_43VC19.js","assets/chevron-down-R7pQzyLD.js","assets/super-circle-loader-D8MElOMh.js","assets/button-DadqadpO.js","assets/better-delete-confirmation-modal-Dib31LVb.js","assets/dialog-D_HtNS17.js","assets/scroll-area-BodE-n7W.js","assets/ui-graph-logo-D4jRhd4z.js","assets/check-XjanpAFg.js","assets/badge-870-A4Y6.js","assets/table-Bi4Auk9Z.js","assets/services-Crqkffr5.js","assets/common-Y7ySZBdh.js","assets/editor-njNjsRVH.css"])))=>i.map(i=>d[i]);
2
- import{i as C$,a as P$,d as T$,e as M$,g as A$,k as R$,f as qp,b as xi,m as Rt,n as E$,A as N$}from"./index-HU5pz3kj.js";import{a as ur,c as Up}from"./react-BNzYaZuG.js";import{r as $,J as nx,t as Ku,d as D$,R as dr,j as g,c as V,g as lo,_ as j$,az as I$,u as Ju,n as X$}from"./index-5E1tJ7yK.js";import{c as co,a5 as lf,aG as Bg,aH as L$,aE as Wg,aI as _$,aJ as B$,aK as W$,aL as z$,I as zg,aM as Z$,aB as F$}from"./nav-links-8vT2ixiI.js";import{d as xt,o as en,s as te,B as Nr,u as rx,C as ed,b as Gi,c as fs,L as V$}from"./index-DcEA6SIV.js";import{_ as ix,a as ie,O as Y$,b as q$,A as U$,S as G$,c as H$,d as K$,F as J$,B as eC,f as tC,g as nC,h as rC,i as iC,D as sC,T as oC}from"./component-icons-D1BDAuEt.js";import{a as hi}from"./index-Dj_05fqk.js";import{g as aC,h as lC,H as cn,u as gn,N as fr,j as Gp,k as wn,r as cC,w as uC,S as dC,s as hC,D as sx,l as Rc,m as fC,a as pC,E as mC,V as gC,n as OC,o as bC,i as yC,M as xC,B as SC,p as kC}from"./style-DgSU0bQl.js";import{u as Oo}from"./use-localstorage-DIisTx-J.js";import{U as vC,e as wC,d as QC,A as ox,a as ax,b as lx}from"./avatar-BI7D-Aia.js";import{u as Yo}from"./useMutation-CmVaR9zz.js";import{P as ge,b as ac,M as Bi,g as cx,O as cf,a7 as $C,q as CC,af as PC,_ as jd,L as TC,Z as MC}from"./index-C0Rs3s9Z.js";import{M as AC,j as Id,u as ux,b as dx,P as RC,k as EC,L as NC,m as Wi,l as DC}from"./index-C_43VC19.js";import{G as pr}from"./iconBase-BoDZfJgC.js";import{C as jC}from"./chevron-down-R7pQzyLD.js";import{u as ga}from"./useQuery-B8yYhO0c.js";import{S as Hp}from"./super-circle-loader-D8MElOMh.js";import{B as Nt}from"./button-DadqadpO.js";import{B as IC}from"./better-delete-confirmation-modal-Dib31LVb.js";import{D as XC,a as LC,b as _C,c as Zg,C as BC}from"./scroll-area-BodE-n7W.js";import{C as WC}from"./check-XjanpAFg.js";import{X as zC}from"./dialog-D_HtNS17.js";import{B as Yr}from"./badge-870-A4Y6.js";import{T as hx,a as fx,b as qo,c as $r,d as px,e as nr}from"./table-Bi4Auk9Z.js";import{S as ZC}from"./services-Crqkffr5.js";import{C as Fg}from"./common-Y7ySZBdh.js";/**
3
- * @license lucide-react v0.514.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const FC=[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]],VC=co("component",FC);/**
8
- * @license lucide-react v0.514.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const YC=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],qC=co("ellipsis",YC);/**
13
- * @license lucide-react v0.514.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const UC=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Vg=co("key",UC);/**
18
- * @license lucide-react v0.514.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const GC=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],HC=co("reply",GC);/**
23
- * @license lucide-react v0.514.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const KC=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],JC=co("send",KC);/**
28
- * @license lucide-react v0.514.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const eP=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],tP=co("square-pen",eP),nP=rx([Nr("dynamodb"),Nr("mongodb"),Nr("json")]);nP.or(Nr("nosql"));const Kp=en({name:te(),description:te()}),Ec=ed(()=>en({id:te(),name:te(),type:te(),required:Gi(),fields:xt(Ec).optional(),itemType:te().optional(),itemFields:xt(Ec).optional()})),rP=ed(()=>en({id:te(),name:te(),type:te(),required:Gi(),isArray:Gi(),reference:en({collectionId:te(),fieldId:te().optional()}).optional(),notes:te().optional(),fields:xt(Ec).optional(),itemType:te().optional(),itemFields:xt(Ec).optional()})),iP=en({id:te(),name:te(),fields:xt(te()),unique:Gi(),ttl:te().optional()}),sP=en({id:te(),name:te(),label:te().optional(),description:te().optional(),tags:te().optional(),fields:xt(rP),indexes:xt(iP),sample:te().optional()}),uf=ed(()=>en({id:te(),name:te(),type:te(),required:Gi(),fields:xt(uf).optional(),itemType:te().optional(),itemFields:xt(uf).optional(),refCollectionId:te().nullable().optional()})),oP=en({id:te(),fieldName:te(),order:rx([Nr(1),Nr(-1)])}),aP=en({id:te(),name:te(),fields:xt(oP),unique:Gi()}),lP=en({id:te(),name:te(),tags:te(),description:te(),fields:xt(uf),indexes:xt(aP)}),cP=en({id:te(),name:te(),partitionKey:te(),partitionKeyType:te().optional(),sortKey:te().optional(),sortKeyType:te().optional()}),df=ed(()=>en({id:te(),name:te(),type:te(),required:Gi(),notes:te().optional(),fields:xt(df).optional(),itemType:te().optional(),itemFields:xt(df).optional()})),Bq=Kp.extend({dialect:Nr("dynamodb"),primaryKey:en({partitionKey:te(),partitionKeyType:te().optional(),sortKey:te(),sortKeyType:te().optional()}),globalSecondaryIndexes:xt(cP),attributes:xt(df)}),uP=Kp.extend({dialect:Nr("mongodb"),collections:xt(lP)}),Wq=Kp.extend({dialect:Nr("json"),collections:xt(sP)}),mx=32;function Ar(n){return n.type==="group"||n.type==="c4Boundary"}function Pr(n){return Ar(n)?n.data?.collapsed===!0:!1}function gx(n,e,t){const r=new Map(n.map(s=>[s.id,s]));let i=r.get(e);for(let s=0;s<mx&&i?.parentId;s++){if(i.parentId===t)return!0;i=r.get(i.parentId)}return!1}function dP(n,e){const t=n.find(i=>i.id===e);if(!t)return n;const r=!Pr(t);return n.map(i=>i.id===e?{...i,data:{...i.data,collapsed:r}}:r&&i.selected&&gx(n,i.id,e)?{...i,selected:!1}:i)}function hP(n){const e=new Map(n.map(r=>[r.id,r])),t=new Map;for(const r of n){if(r.type!=="c4Boundary")continue;let i=1,s=r.parentId?e.get(r.parentId):void 0;for(let o=0;o<mx&&s;o++)s.type==="c4Boundary"&&i++,s=s.parentId?e.get(s.parentId):void 0;t.set(r.id,i)}return t}function Ka(n){const e=$.useRef(n);return e.current=n,e}const fP=5,pP=120,mP=80;function gP(n){const[e,t,r]=aC(n.nodes),[i,s,o]=lC(n.edges),[a,l]=$.useState(n.dataSources),[c,d]=$.useState(n.components),[h,f]=$.useState(n.viewport),[p,m]=$.useState(null),O=p!==null,b=p?p.nodes:e,y=p?p.edges:i,S=$.useRef(b),x=$.useRef(y);S.current=b,x.current=y;const k=$.useCallback(R=>{const M=new Map(S.current.map(B=>[B.id,{...B.position}])),D=new Set,N=R.map(B=>{if(B.type==="position"&&"position"in B&&B.position&&B.id){if(S.current.find(re=>re.id===B.id)?.type==="sequenceParticipant"){const re={...B.position,y:0};return M.set(B.id,re),D.add(B.id),{...B,position:re}}M.set(B.id,B.position)}return B}),I=x.current,Z=new Map;for(const B of I){if(B.source.startsWith("participant-")&&B.target.startsWith("message-")){const se=Z.get(B.target)??{from:"",to:""};Z.set(B.target,{...se,from:B.source})}if(B.source.startsWith("message-")&&B.target.startsWith("participant-")){const se=Z.get(B.source)??{from:"",to:""};Z.set(B.source,{...se,to:B.target})}}const ne=S.current,le=[];for(const[B,{from:se,to:re}]of Z){if(!se||!re||!D.has(se)&&!D.has(re))continue;const me=M.get(se),$e=M.get(re),G=ne.find(St=>St.id===B);if(!me||!$e||!G)continue;const fe=G.width??pP,Je=se===re?me.x+mP-fe/2:(me.x+$e.x)/2+fP-fe/2;le.push({type:"position",id:B,position:{x:Je,y:G.position.y}})}r([...N,...le])},[r]),v=$.useMemo(()=>{const R=e.filter(M=>M.selected).map(M=>M.id);return[...new Set(R)]},[e]),w=$.useMemo(()=>{const R=i.filter(M=>M.selected).map(M=>M.id);return[...new Set(R)]},[i]),Q=Ka({latestNodes:e,latestEdges:i,latestViewport:h,latestDataSources:a,latestFlowComponents:c,setLatestNodes:t,setLatestEdges:s,setLatestViewport:f,setLatestDataSources:l,setLatestFlowComponents:d,tempDiagramState:p,setTempDiagramState:m}),C=$.useCallback(R=>{const{setLatestNodes:M}=Q.current;M(D=>D.map(N=>({...N,selected:R.includes(N.id)})))},[Q]),T=$.useCallback(R=>{const{setLatestEdges:M}=Q.current;M(D=>D.map(N=>({...N,selected:R.includes(N.id)})))},[Q]),P=$.useCallback(R=>{m(M=>M?{...M,viewport:typeof R=="function"?R(M.viewport):R}:null)},[m]);return{viewport:p?p.viewport:h,setViewport:p?P:f,nodes:b,setNodes:O?console.error:t,onNodesChange:O?console.error:k,edges:y,setEdges:O?console.error:s,onEdgesChange:O?console.error:o,dataSources:p?p.dataSources:a,setDataSources:O?console.error:l,flowComponents:p?p.components:c,setFlowComponents:O?console.error:d,latestData:{nodes:e,edges:i,viewport:h,dataSources:a,components:c},tempDiagramState:p,setTempDiagramState:m,isPreviewing:O,selectedNodeIds:v,setSelectedNodeIds:C,selectedEdgeIds:w,setSelectedEdgeIds:T,setLatestNodes:t,setLatestEdges:s,setLatestViewport:f,setLatestDataSources:l,setLatestFlowComponents:d}}var Xd,Yg;function OP(){if(Yg)return Xd;Yg=1;var n=1e3,e=n*60,t=e*60,r=t*24,i=r*7,s=r*365.25;Xd=function(d,h){h=h||{};var f=typeof d;if(f==="string"&&d.length>0)return o(d);if(f==="number"&&isFinite(d))return h.long?l(d):a(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function o(d){if(d=String(d),!(d.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(h){var f=parseFloat(h[1]),p=(h[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return f*s;case"weeks":case"week":case"w":return f*i;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*t;case"minutes":case"minute":case"mins":case"min":case"m":return f*e;case"seconds":case"second":case"secs":case"sec":case"s":return f*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(d){var h=Math.abs(d);return h>=r?Math.round(d/r)+"d":h>=t?Math.round(d/t)+"h":h>=e?Math.round(d/e)+"m":h>=n?Math.round(d/n)+"s":d+"ms"}function l(d){var h=Math.abs(d);return h>=r?c(d,h,r,"day"):h>=t?c(d,h,t,"hour"):h>=e?c(d,h,e,"minute"):h>=n?c(d,h,n,"second"):d+" ms"}function c(d,h,f,p){var m=h>=f*1.5;return Math.round(d/f)+" "+p+(m?"s":"")}return Xd}var bP=OP();const yP=nx(bP);function xP({nodes:n,edges:e,components:t,dataSources:r,viewport:i,disabled:s,diagramId:o,diagramName:a,organizationId:l,folderId:c,teamId:d,initialLastUpdatedAt:h}){const[f,p]=$.useState(!1),[m]=Yo(vC),O=$.useMemo(()=>h?new Date(h).getTime():0,[h]),[b,y]=ur(O),S=$.useRef(null),x=$.useRef(null),k=Ka({updateDiagram:m,lastUpdatedAt:b,setLastUpdatedAt:y,nodes:n,edges:e,viewport:i,components:t,dataSources:r,disabled:s,diagramId:o,diagramName:a,organizationId:l,folderId:c,teamId:d}),v=$.useCallback(async(w=!1)=>{S.current&&clearTimeout(S.current),console.log("> Saving meta data");const{updateDiagram:Q,lastUpdatedAt:C,setLastUpdatedAt:T,disabled:P,diagramId:R,diagramName:M,organizationId:D,folderId:N,teamId:I,...Z}=k.current;if(!R||!D||P)return null;const ne={name:M,content:wC({nodes:Z.nodes,edges:Z.edges,viewport:Z.viewport,components:Z.components,dataSources:Z.dataSources}),...N?{folderId:N}:{},...I?{teamId:I}:{}},le=JSON.stringify(ne),B=Ld.has(R)&&Ld.get(R)===le;if(B&&!w)return console.info("Diagram already up to date, skipping update"),_d.get(R)??null;let se=_d.get(R)??null;try{if(p(!0),!B){const re=await Q({variables:{orgId:D,id:R,input:ne}});Ld.set(R,le),se=re.data?.updateDiagram.contentHash??null,se&&_d.set(R,se)}}catch{return Ku.error("Failed to update diagram. Please try again."),null}finally{p(!1)}return se},[k]);return $.useEffect(()=>{const{disabled:w}=k.current;if(!w&&!k.current.nodes.some(Q=>Q.data?.autoLayout)){if(x.current===null){x.current=qg(k.current.diagramName,k.current.nodes,k.current.edges);return}return S.current=setTimeout(()=>{const{diagramName:Q,nodes:C,edges:T}=k.current,P=qg(Q,C,T);P!==x.current&&(x.current=P,v())},SP),()=>{S.current&&clearTimeout(S.current)}}},[n,e,t,r,a,v,k,S]),{isMetaUpdating:f,triggerMetaUpdate:v}}function qg(n,e,t){return C$(e)?JSON.stringify({name:n,...P$(e,t)}):T$(e)?JSON.stringify({name:n,...M$(e,t)}):JSON.stringify({name:n,...A$({nodes:e,edges:t})})}const Ld=new Map,_d=new Map,SP=yP("1s"),[zq,Zr]=Up(({diagramId:n,initialInfo:e,initialData:t,organizationId:r,folderId:i,teamId:s,isEmbedded:o})=>{const a=gP(t),[l,c]=$.useState(e.name??"Blank Diagram"),d=$.useRef(null),[h,f]=$.useState(null),[p,m]=$.useState(!1),[O,b]=$.useState(null),[y,S]=Oo("flow-diagram-cursor-mode","select"),[x,k]=$.useState(!1),[v,w]=D$(),Q=(v.get("children")??"").split(",").filter(G=>G.length>0);function C(G){const fe=new URLSearchParams(v);G.length===0&&fe.delete("children"),G.length>0&&fe.set("children",G.join(",")),w(fe)}function T(G){if(o)return window.parent.__uigraphOpenChild?.(G);C([...Q,G])}const[P,R]=Oo("flow-diagram-show-grid",!0),[M,D]=Oo("flow-diagram-show-minimap",!1),[N,I]=Oo("flow-diagram-drawing-mode",!1),[Z,ne]=Oo("flow-diagram-fullscreen",!1),le=$.useMemo(()=>{const G=a.nodes.filter(fe=>fe.selected&&Ar(fe));return G.length===1?G[0]:null},[a.nodes]),B=$.useMemo(()=>hP(a.nodes),[a.nodes]),se=$.useMemo(()=>a.nodes.some(G=>G.type==="c4"||G.type==="c4Boundary"),[a.nodes]),re=$.useMemo(()=>{const G=new Map;for(const fe of a.dataSources)for(const Je of fe.schemaAst.tables){const St=fe.dialect==="mongodb"?uP.parse(fe.sourceContent).collections.find(On=>On.id===Je.id):void 0;G.set(`${fe.name}@${Je.name}`,{source:fe,table:Je,mongoCollectionSource:St})}return G},[a.dataSources]),{isMetaUpdating:me,triggerMetaUpdate:$e}=xP({diagramId:n,diagramName:l,organizationId:r,folderId:i,teamId:s,disabled:a.isPreviewing,initialLastUpdatedAt:e.lastUpdatedAt,nodes:a.latestData.nodes,edges:a.latestData.edges,viewport:a.latestData.viewport,dataSources:a.latestData.dataSources,components:a.latestData.components});return{...a,reactFLowRef:d,isMetaUpdating:me,triggerMetaUpdate:$e,diagramId:n,organizationId:r,diagramName:l,setDiagramName:c,isEmbedded:o,childDiagramIds:Q,setChildDiagramIds:C,openChildDiagram:T,selectedFrame:le,boundaryDepths:B,dataTablesMap:re,isC4Diagram:se,showGrid:P,setShowGrid:R,showMinimap:M,setShowMinimap:D,drawingMode:N,setDrawingMode:I,isFullscreen:Z,setIsFullscreen:ne,reactFlowInstance:h,setReactFlowInstance:f,sidebarActiveTool:O,setSidebarActiveTool:b,cursorMode:y,setCursorMode:S,isCommandPaletteOpen:x,setIsCommandPaletteOpen:k,isEdgeConnecting:p,setIsEdgeConnecting:m}}),[Zq,Fq]=Up(()=>{const{dataSources:n,setDataSources:e}=Zr();function t(o){e(a=>[...a,o])}function r(o,a){e(l=>l.map(c=>c.id===o?{...c,...a}:c))}function i(o){e(a=>a.filter(l=>l.id!==o))}function s(o){const a=n.find(c=>c.id===o);return!a||!a.schemaAst?"":new R$(a.dialect,2).generate(a.schemaAst)}return{dataSources:n,addDataSource:t,updateDataSource:r,removeDataSource:i,regenerateSql:s}}),kP={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},vP=en({GRAPHQL_URL:V$(),VITE_DEPLOY_ENV:fs(["local","development","production"]).default("production"),VITE_FEATURE_DIAGRAM_IMPORT_EXPORT:fs(["true","false"]).optional().transform(n=>n==="true"),VITE_FEATURE_ENABLE_DEMO_TEST_CASES:fs(["true","false"]).optional().transform(n=>n==="true"),VITE_FEATURE_ENABLE_INSIGHTS:fs(["true","false"]).optional().transform(n=>n==="true"),VITE_FEATURE_ENABLE_DEBUG_DIAGRAM_NODE_BOUNDS:fs(["true","false"]).optional().transform(n=>n==="true"),VITE_FEATURE_ENABLE_ENTERPRISE:fs(["true","false"]).optional().transform(n=>n==="true")}),wP=vP.parse({...kP,GRAPHQL_URL:`${window.location.origin}/graphql`}),Oa=.02,ba=8,Ug=1.25,yl=1,QP=2,$P=1.5,Vq=.15,CP=200,Nc=300;function Ox(n){return n<Oa?Oa:n>ba?ba:n}function Yq(n){const e=Ox(n);if(e<=yl)return yl/e;const t=Math.log(e/yl)/Math.log(ba/yl);return(1+(QP-1)*t)/e}function Gg(n,e){n.zoomTo(Ox(n.getZoom()*e),{duration:CP,interpolate:"linear"})}function PP(n){if(n.getNodes().length===0){n.zoomTo(1,{duration:Nc,interpolate:"linear"});return}n.fitView({padding:{top:"80px",left:"20px",right:"20px",bottom:"20px"},minZoom:Oa,maxZoom:ba,duration:Nc})}function bx(n,e){e.length!==0&&n.fitView({nodes:e.map(t=>({id:t})),padding:.2,minZoom:Oa,maxZoom:$P,duration:Nc})}function Tn(n,e){const t=JSON.stringify(e);return $.useMemo(()=>{const r=JSON.parse(t);if(Object.keys(r).length===0||!n)return null;const i=hi(n),s=qp(i,i),a=i.find(l=>{for(const c in r)if(!(l[c]===r[c]))return!1;return!0})?.componentFieldId;return a?s[a]??null:null},[n,t])}function TP(n,e){if(Object.keys(e).length===0||!n)return null;const t=hi(n),r=qp(t,t),s=t.find(o=>{for(const a in e)if(!(o[a]===e[a]))return!1;return!0})?.componentFieldId;return s?r[s]??null:null}var MP=$.useLayoutEffect,AP=function(e){var t=dr.useRef(e);return MP(function(){t.current=e}),t},Hg=function(e,t){if(typeof e=="function"){e(t);return}e.current=t},RP=function(e,t){var r=dr.useRef();return dr.useCallback(function(i){e.current=i,r.current&&Hg(r.current,null),r.current=t,t&&Hg(t,i)},[t])},Kg={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},EP=function(e){Object.keys(Kg).forEach(function(t){e.style.setProperty(t,Kg[t],"important")})},Jg=EP,_t=null,eO=function(e,t){var r=e.scrollHeight;return t.sizingStyle.boxSizing==="border-box"?r+t.borderSize:r-t.paddingSize};function NP(n,e,t,r){t===void 0&&(t=1),r===void 0&&(r=1/0),_t||(_t=document.createElement("textarea"),_t.setAttribute("tabindex","-1"),_t.setAttribute("aria-hidden","true"),Jg(_t)),_t.parentNode===null&&document.body.appendChild(_t);var i=n.paddingSize,s=n.borderSize,o=n.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(f){var p=f;_t.style[p]=o[p]}),Jg(_t),_t.value=e;var l=eO(_t,n);_t.value=e,l=eO(_t,n),_t.value="x";var c=_t.scrollHeight-i,d=c*t;a==="border-box"&&(d=d+i+s),l=Math.max(d,l);var h=c*r;return a==="border-box"&&(h=h+i+s),l=Math.min(h,l),[l,c]}var tO=function(){},DP=function(e,t){return e.reduce(function(r,i){return r[i]=t[i],r},{})},jP=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],IP=!!document.documentElement.currentStyle,XP=function(e){var t=window.getComputedStyle(e);if(t===null)return null;var r=DP(jP,t),i=r.boxSizing;if(i==="")return null;IP&&i==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var s=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),o=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:s,borderSize:o}},LP=XP;function Jp(n,e,t){var r=AP(t);$.useLayoutEffect(function(){var i=function(o){return r.current(o)};if(n)return n.addEventListener(e,i),function(){return n.removeEventListener(e,i)}},[])}var _P=function(e,t){Jp(document.body,"reset",function(r){e.current.form===r.target&&t(r)})},BP=function(e){Jp(window,"resize",e)},WP=function(e){Jp(document.fonts,"loadingdone",e)},zP=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],ZP=function(e,t){var r=e.cacheMeasurements,i=e.maxRows,s=e.minRows,o=e.onChange,a=o===void 0?tO:o,l=e.onHeightChange,c=l===void 0?tO:l,d=ix(e,zP),h=d.value!==void 0,f=$.useRef(null),p=RP(f,t),m=$.useRef(0),O=$.useRef(),b=function(){var x=f.current,k=r&&O.current?O.current:LP(x);if(k){O.current=k;var v=NP(k,x.value||x.placeholder||"x",s,i),w=v[0],Q=v[1];m.current!==w&&(m.current=w,x.style.setProperty("height",w+"px","important"),c(w,{rowHeight:Q}))}},y=function(x){h||b(),a(x)};return $.useLayoutEffect(b),_P(f,function(){if(!h){var S=f.current.value;requestAnimationFrame(function(){var x=f.current;x&&S!==x.value&&b()})}}),BP(b),WP(b),$.createElement("textarea",ie({},d,{onChange:y,ref:p}))},Zs=$.forwardRef(ZP);const we=2,bo=14,yo=16,nO=16,rO=12,iO=14,FP=40,VP=22,YP=20,Do=.26,lc=.06;function qP({color:n}){return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"absolute inset-x-0 bottom-0 rounded-[1.25rem]",style:{top:`${(Do+lc)*100}%`,border:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute top-0 left-1/2 aspect-square -translate-x-1/2 rounded-full",style:{height:`${Do*100}%`,border:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute left-[14%] w-0",style:{top:`${(Do+lc)*100+10}%`,bottom:"24%",borderLeft:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute right-[14%] w-0",style:{top:`${(Do+lc)*100+10}%`,bottom:"24%",borderRight:`${we}px solid ${n}`}})]})}function UP({color:n}){return g.jsx("div",{className:"absolute inset-0 rounded-[0.625rem]",style:{border:`${we}px solid ${n}`}})}function GP({color:n}){return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"absolute inset-x-0",style:{top:`${bo}px`,bottom:`${bo}px`,borderLeft:`${we}px solid ${n}`,borderRight:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute inset-x-0 top-0 rounded-[50%]",style:{height:`${bo*2}px`,border:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute inset-x-0 bottom-0 overflow-hidden",style:{height:`${bo}px`},children:g.jsx("div",{className:"absolute inset-x-0 bottom-0 rounded-[50%]",style:{height:`${bo*2}px`,border:`${we}px solid ${n}`}})})]})}function HP({color:n}){return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"absolute inset-y-0",style:{left:`${yo}px`,right:`${yo}px`,borderTop:`${we}px solid ${n}`,borderBottom:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute inset-y-0 left-0 rounded-[50%]",style:{width:`${yo*2}px`,border:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute inset-y-0 right-0 overflow-hidden",style:{width:`${yo}px`},children:g.jsx("div",{className:"absolute inset-y-0 right-0 rounded-[50%]",style:{width:`${yo*2}px`,border:`${we}px solid ${n}`}})})]})}function KP({color:n}){return g.jsx("div",{className:"absolute inset-0 rounded-[50%]",style:{border:`${we}px solid ${n}`}})}function JP({color:n}){return g.jsxs(g.Fragment,{children:[g.jsx("svg",{className:"absolute inset-x-0 bottom-0",style:{top:`${nO}px`},preserveAspectRatio:"none",viewBox:"0 0 100 100",children:g.jsx("path",{d:`M0,0 L${rO},100 L${100-rO},100 L100,0`,fill:"none",stroke:n,strokeWidth:we,vectorEffect:"non-scaling-stroke"})}),g.jsx("div",{className:"absolute inset-x-0 top-0 rounded-[50%]",style:{height:`${nO*2}px`,border:`${we}px solid ${n}`}})]})}function eT({color:n}){return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"absolute top-0 left-0 rounded-t-[0.25rem]",style:{width:`${FP}px`,height:`${iO+we}px`,borderTop:`${we}px solid ${n}`,borderLeft:`${we}px solid ${n}`,borderRight:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute inset-x-0 bottom-0 rounded-[0.25rem] rounded-tl-none",style:{top:`${iO}px`,border:`${we}px solid ${n}`}})]})}function tT({color:n}){return g.jsx("div",{className:"absolute inset-0 rounded-[0.375rem]",style:{border:`${we}px solid ${n}`},children:g.jsxs("div",{className:"flex items-center gap-1.5 px-2",style:{height:`${VP}px`,borderBottom:`${we}px solid ${n}`},children:[g.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:n}}),g.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:n}}),g.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:n}}),g.jsx("span",{className:"ml-1 h-2.5 flex-1 rounded-full",style:{border:`1px solid ${n}`}})]})})}function nT({color:n}){return g.jsx("div",{className:"absolute inset-0 rounded-[0.375rem]",style:{border:`${we}px solid ${n}`},children:g.jsx("div",{className:"flex items-center px-2 font-mono text-[0.6875rem] leading-none",style:{height:`${YP}px`,borderBottom:`${we}px solid ${n}`,color:n},children:">_"})})}function rT({color:n}){return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"absolute inset-y-0 rounded-[0.25rem]",style:{left:`${we*3}px`,right:0,border:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute left-0 h-4 w-6 rounded-[0.125rem]",style:{top:"22%",border:`${we}px solid ${n}`}}),g.jsx("div",{className:"absolute left-0 h-4 w-6 rounded-[0.125rem]",style:{bottom:"22%",border:`${we}px solid ${n}`}})]})}const sO={default:UP,db:GP,queue:HP,bucket:JP,folder:eT,browser:tT,terminal:nT,component:rT,ellipse:KP},iT={default:"px-4 py-3",db:"px-4 pt-8 pb-6",queue:"px-10 py-3",bucket:"px-8 pt-8 pb-4",folder:"px-4 pt-6 pb-3",browser:"px-4 pt-8 pb-3",terminal:"px-4 pt-8 pb-3",component:"pt-3 pr-4 pb-3 pl-8",ellipse:"px-8 py-4"};function Si({className:n,...e}){return g.jsx(Ja,{className:V("outline-stock rounded-[0.5rem] outline","[.selected_&]:outline-primary [.selected_&]:shadow-[0_24px_40px_0_rgba(0,0,0,0.08)]",n),...e})}function Ja({children:n,...e}){const{isEdgeConnecting:t}=Zr();return g.jsxs("div",{...e,children:[n,g.jsxs(g.Fragment,{children:[g.jsx(cn,{id:"target-top",type:"target",position:ge.Top,className:V(t&&"connection-enabled")}),g.jsx(cn,{id:"source-top",type:"source",position:ge.Top,className:V(t&&"connection-enabled")}),g.jsx(cn,{id:"target-bottom",type:"target",position:ge.Bottom,className:V(t&&"connection-enabled")}),g.jsx(cn,{id:"source-bottom",type:"source",position:ge.Bottom,className:V(t&&"connection-enabled")}),g.jsx(cn,{id:"target-left",type:"target",position:ge.Left,className:V(t&&"connection-enabled")}),g.jsx(cn,{id:"source-left",type:"source",position:ge.Left,className:V(t&&"connection-enabled")}),g.jsx(cn,{id:"target-right",type:"target",position:ge.Right,className:V(t&&"connection-enabled")}),g.jsx(cn,{id:"source-right",type:"source",position:ge.Right,className:V(t&&"connection-enabled")})]})]})}const qq={person:"Person",system:"System",container:"Container",component:"Component",node:"Node"},sT={person:"Person",system:"Software System",container:"Container",component:"Component",node:"Deployment Node"},oT="#1168BD",oO=60,aT=1;function lT({id:n,data:e,width:t,height:r,selected:i}){const{updateNodeData:s,updateNode:o}=gn(),{setNodes:a}=Zr(),l=Tn(e.componentFields,{componentFieldId:"name"}),c=$.useRef(null),[d,h]=ur(l??"");function f(P){h(P),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{s(n,{componentFields:xi(e.componentFields??[],{name:P})})},1e3)}const p=$.useRef(null),[m,O]=ur(e.description??"");function b(P){O(P),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{s(n,{description:P})},1e3)}const y=e.fill??oT,S=e.fontColor??y,x=e.c4Shape??"default",k=e.c4Kind==="person",v=sO[x]??sO.default,w=sT[e.c4Kind??"system"],C=(e.c4Kind==="container"||e.c4Kind==="component")&&e.technology?`${w}: ${e.technology}`:w,T=$.useRef(null);return $.useLayoutEffect(()=>{const P=T.current;if(!P)return;const R=Math.max(Math.ceil(P.scrollHeight),oO);R<=(r??0)+aT||a(M=>M.map(D=>D.id===n?{...D,height:R}:D))},[n,t,r,x,k,d,C,m,a]),g.jsxs(Ja,{selected:!!i,className:V("relative size-full rounded-[0.25rem]",i&&"outline-primary outline"),children:[g.jsx(fr,{minWidth:140,minHeight:oO,isVisible:i,onResize:(P,R)=>{o(n,{width:R.width,height:R.height})}}),k&&g.jsx(qP,{color:y}),!k&&g.jsx(v,{color:y}),g.jsxs("div",{ref:T,className:V("relative flex min-h-full w-full flex-col items-center justify-center gap-0.5 text-center",k?"px-4 pb-4":iT[x]),style:{color:S,paddingTop:k?`${(Do+lc)*100+8}%`:void 0},children:[g.jsx(Zs,{value:d,placeholder:"Name",onKeyDown:P=>P.stopPropagation(),onMouseDown:P=>P.stopPropagation(),onChange:P=>f(P.currentTarget.value),className:V("w-full cursor-grab resize-none bg-transparent text-center text-sm leading-5 font-bold outline-none",i&&"cursor-text active:cursor-grabbing"),style:{color:S}}),g.jsxs("span",{className:"text-[0.625rem] leading-tight opacity-90",children:["[",C,"]"]}),g.jsx(Zs,{value:m,placeholder:"Description",onKeyDown:P=>P.stopPropagation(),onMouseDown:P=>P.stopPropagation(),onChange:P=>b(P.currentTarget.value),className:V("w-full cursor-grab resize-none bg-transparent text-center text-[0.6875rem] leading-4 opacity-90 outline-none",i&&"cursor-text active:cursor-grabbing"),style:{color:S}})]}),e.subDiagramId&&g.jsx("button",{type:"button",title:"Open sub diagram in a new tab",className:"absolute top-1.5 right-1.5 rounded-sm bg-black/30 p-1 text-white/90 transition-colors hover:bg-black/50",onMouseDown:P=>P.stopPropagation(),onClick:P=>{P.stopPropagation(),window.open(`/diagram/${e.subDiagramId}`,"_blank")},children:g.jsx(lf,{className:"size-3"})})]})}function cT(n){return pr({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M512 1024c-69.1 0-136.2-13.5-199.3-40.2C251.7 958 197 921 150 874c-47-47-84-101.7-109.8-162.7C13.5 648.2 0 581.1 0 512c0-19.9 16.1-36 36-36s36 16.1 36 36c0 59.4 11.6 117 34.6 171.3 22.2 52.4 53.9 99.5 94.3 139.9 40.4 40.4 87.5 72.2 139.9 94.3C395 940.4 452.6 952 512 952c59.4 0 117-11.6 171.3-34.6 52.4-22.2 99.5-53.9 139.9-94.3 40.4-40.4 72.2-87.5 94.3-139.9C940.4 629 952 571.4 952 512c0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.2C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3s-13.5 136.2-40.2 199.3C958 772.3 921 827 874 874c-47 47-101.8 83.9-162.7 109.7-63.1 26.8-130.2 40.3-199.3 40.3z"},child:[]}]})(n)}const uT=lo(`
33
- mutation GenerateDiagramThumbnail($orgId: ID!, $diagramId: ID!) {
34
- generateDiagramThumbnail(orgId: $orgId, diagramId: $diagramId)
35
- }
36
- `);function aO(n){window.open(`/diagram/${n}`,"_blank","noopener,noreferrer")}const dT=260,hT=4;function fT({id:n,data:e,selected:t}){const{organizationId:r,openChildDiagram:i}=Zr(),s=Gp(w=>w.nodeLookup.get(n)?.measured.width),o=s?Math.min(Math.max(s/dT,1),hT):1,a=ga(QC,{variables:{orgId:r,id:e.diagramId},skip:!r||!e.diagramId,fetchPolicy:"cache-first"}),l=a.data?.diagram,c=l?.previewStatus,d=l?.name??e.diagramName??"Untitled diagram",h=l?.previewImageUrl??e.thumbnailUrl,[f,p]=$.useState(!1);$.useEffect(()=>p(!1),[h]);const{startPolling:m,stopPolling:O}=a;$.useEffect(()=>c!=="pending"?O():(m(3e3),()=>O()),[c,m,O]);const[b,{loading:y}]=Yo(uT),S=y||c==="pending",x=!!h&&!f;function k(){r&&e.diagramId&&i(e.diagramId)}async function v(){if(!(!r||!e.diagramId))try{await b({variables:{orgId:r,diagramId:e.diagramId}}),await a.refetch()}catch{Ku.error("Failed to start thumbnail generation")}}return g.jsxs(g.Fragment,{children:[t&&g.jsxs(g.Fragment,{children:[g.jsx(wn,{resizeDirection:"horizontal",position:"top-left",minWidth:180}),g.jsx(wn,{resizeDirection:"horizontal",position:"top-right",minWidth:180}),g.jsx(wn,{resizeDirection:"horizontal",position:"bottom-left",minWidth:180}),g.jsx(wn,{resizeDirection:"horizontal",position:"bottom-right",minWidth:180})]}),g.jsxs(Si,{selected:!!t,onDoubleClick:w=>{w.stopPropagation(),k()},className:"border-stock bg-shading flex w-full flex-col overflow-hidden rounded-[0.5rem] border outline-transparent",children:[!e.hideThumbnail&&g.jsxs("div",{className:"group relative bg-[#0F131C]",children:[e.diagramId?x?g.jsx("img",{src:h,alt:d,draggable:!1,onError:()=>p(!0),className:"block h-auto w-full"}):S?g.jsxs("div",{className:"text-paragraph flex flex-col items-center justify-center gap-1.5 py-10",children:[g.jsx(cT,{className:"size-5 animate-spin"}),g.jsx("span",{className:"text-[0.6875rem]",children:"Generating preview…"})]}):g.jsxs("div",{className:"text-paragraph flex flex-col items-center justify-center gap-1.5 py-10",children:[g.jsx(L$,{className:"size-5"}),g.jsx("span",{className:"text-[0.6875rem]",children:c==="failed"?"Preview failed":"No preview yet"}),g.jsx("button",{type:"button",onMouseDown:w=>w.stopPropagation(),onClick:w=>{w.stopPropagation(),v()},className:"border-stock bg-input mt-1 rounded-md border px-2 py-1 text-[0.6875rem] text-[#F4F7FC]",children:"Create thumbnail"})]}):g.jsxs("div",{className:"text-paragraph flex flex-col items-center justify-center gap-1.5 py-10",children:[g.jsx(Bg,{className:"size-5"}),g.jsx("span",{className:"text-[0.6875rem]",children:"No diagram linked"})]}),e.diagramId&&x&&g.jsxs("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 bg-black/65 opacity-0 transition-opacity group-hover:opacity-100",children:[r&&g.jsxs(Nt,{type:"button",size:"sm",className:"pointer-events-auto",onMouseDown:w=>w.stopPropagation(),onDoubleClick:w=>w.stopPropagation(),onClick:w=>{w.stopPropagation(),k()},children:[g.jsx(Wg,{className:"size-3.5"}),"Open"]}),g.jsx(Nt,{type:"button",size:"sm",variant:"secondary",title:"Open in new tab",className:"pointer-events-auto size-8 p-0",onMouseDown:w=>w.stopPropagation(),onDoubleClick:w=>w.stopPropagation(),onClick:w=>{w.stopPropagation(),aO(e.diagramId)},children:g.jsx(lf,{className:"size-3.5"})})]})]}),g.jsxs("div",{style:{height:28*o,paddingInline:10*o,gap:6*o,fontSize:12*o},className:V("flex shrink-0 items-center",!e.hideThumbnail&&"border-stock border-t"),children:[g.jsx(Bg,{style:{width:12*o,height:12*o},className:"text-paragraph shrink-0"}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-[#F4F7FC]",children:d}),e.hideThumbnail&&e.diagramId&&g.jsxs(g.Fragment,{children:[r&&g.jsx("button",{type:"button",title:"Open",onMouseDown:w=>w.stopPropagation(),onDoubleClick:w=>w.stopPropagation(),onClick:w=>{w.stopPropagation(),k()},className:"text-paragraph shrink-0 transition-colors hover:text-[#F4F7FC]",children:g.jsx(Wg,{style:{width:12*o,height:12*o}})}),g.jsx("button",{type:"button",title:"Open in new tab",onMouseDown:w=>w.stopPropagation(),onDoubleClick:w=>w.stopPropagation(),onClick:w=>{w.stopPropagation(),aO(e.diagramId)},className:"text-paragraph shrink-0 transition-colors hover:text-[#F4F7FC]",children:g.jsx(lf,{style:{width:12*o,height:12*o}})})]})]})]})]})}const pT="_icon_3zpuy_1",mr={icon:pT};function mT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M12.6668 3.34351H3.3335C2.71224 3.34351 2.40162 3.34351 2.15658 3.445C1.82988 3.58033 1.57032 3.83989 1.43499 4.16659C1.3335 4.41163 1.3335 4.72225 1.3335 5.34351C1.3335 5.96476 1.3335 6.27539 1.43499 6.52042C1.57032 6.84712 1.82988 7.10669 2.15658 7.24201C2.40162 7.34351 2.71224 7.34351 3.3335 7.34351H12.6668C13.2881 7.34351 13.5987 7.34351 13.8438 7.24201C14.1704 7.10669 14.43 6.84712 14.5654 6.52042C14.6668 6.27539 14.6668 5.96476 14.6668 5.34351C14.6668 4.72225 14.6668 4.41163 14.5654 4.16659C14.43 3.83989 14.1704 3.58033 13.8438 3.445C13.5987 3.34351 13.2881 3.34351 12.6668 3.34351Z",stroke:"#2463EB",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M12.6668 10.01H3.3335C2.71224 10.01 2.40162 10.01 2.15658 10.1115C1.82988 10.2468 1.57032 10.5064 1.43499 10.8331C1.3335 11.0781 1.3335 11.3887 1.3335 12.01C1.3335 12.6313 1.3335 12.9419 1.43499 13.1869C1.57032 13.5136 1.82988 13.7732 2.15658 13.9085C2.40162 14.01 2.71224 14.01 3.3335 14.01H12.6668C13.2881 14.01 13.5987 14.01 13.8438 13.9085C14.1704 13.7732 14.43 13.5136 14.5654 13.1869C14.6668 12.9419 14.6668 12.6313 14.6668 12.01C14.6668 11.3887 14.6668 11.0781 14.5654 10.8331C14.43 10.5064 14.1704 10.2468 13.8438 10.1115C13.5987 10.01 13.2881 10.01 12.6668 10.01Z",stroke:"#2463EB",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M4 12.01H4.00667",stroke:"#2463EB",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M6.6665 12.01H6.67317",stroke:"#2463EB",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M4 5.34351H4.00667",stroke:"#2463EB",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M6.6665 5.34351H6.67317",stroke:"#2463EB",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M8.00016 15.3433C11.6821 15.3433 14.6668 12.3586 14.6668 8.67668C14.6668 4.99478 11.6821 2.01001 8.00016 2.01001C4.31826 2.01001 1.3335 4.99478 1.3335 8.67668C1.3335 12.3586 4.31826 15.3433 8.00016 15.3433Z",stroke:"#17A34A"}),g.jsx("path",{d:"M5.3335 8.67668C5.3335 12.6767 8.00016 15.3433 8.00016 15.3433C8.00016 15.3433 10.6668 12.6767 10.6668 8.67668C10.6668 4.67668 8.00016 2.01001 8.00016 2.01001C8.00016 2.01001 5.3335 4.67668 5.3335 8.67668Z",stroke:"#17A34A",strokeLinejoin:"round"}),g.jsx("path",{d:"M14 10.6768H2",stroke:"#17A34A",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M14 6.67676H2",stroke:"#17A34A",strokeLinecap:"round",strokeLinejoin:"round"})]})}function OT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M7.99984 6.01001C10.9454 6.01001 13.3332 5.11458 13.3332 4.01001C13.3332 2.90544 10.9454 2.01001 7.99984 2.01001C5.05432 2.01001 2.6665 2.90544 2.6665 4.01001C2.6665 5.11458 5.05432 6.01001 7.99984 6.01001Z",stroke:"#EA580B"}),g.jsx("path",{d:"M4.6665 7.90454C5.06756 8.02514 5.51606 8.12441 5.99984 8.19787",stroke:"#EA580B",strokeLinecap:"round"}),g.jsx("path",{d:"M13.3332 8.67676C13.3332 9.78136 10.9454 10.6768 7.99984 10.6768C5.05432 10.6768 2.6665 9.78136 2.6665 8.67676",stroke:"#EA580B"}),g.jsx("path",{d:"M4.6665 12.5713C5.06756 12.6919 5.51606 12.7912 5.99984 12.8646",stroke:"#EA580B",strokeLinecap:"round"}),g.jsx("path",{d:"M13.3332 4.01001V13.3433C13.3332 14.4479 10.9454 15.3433 7.99984 15.3433C5.05432 15.3433 2.6665 14.4479 2.6665 13.3433V4.01001",stroke:"#EA580B"})]})}function bT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M5.6665 10.3433H10.3332M5.6665 7.01001H7.99984",stroke:"#9334E9",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M9.44723 14.6038C12.2359 14.4185 14.4572 12.1656 14.64 9.33744C14.6758 8.78397 14.6758 8.21077 14.64 7.65731C14.4572 4.82909 12.2359 2.57626 9.44723 2.39089C8.49583 2.32765 7.50256 2.32778 6.55309 2.39089C3.76442 2.57626 1.5431 4.82909 1.36032 7.65731C1.32455 8.21077 1.32455 8.78397 1.36032 9.33744C1.42689 10.3675 1.88245 11.3212 2.41877 12.1266C2.73017 12.6904 2.52465 13.394 2.2003 14.0087C1.96643 14.4519 1.8495 14.6735 1.94339 14.8336C2.03728 14.9936 2.247 14.9988 2.66645 15.009C3.49594 15.0292 4.05528 14.794 4.49928 14.4666C4.75109 14.2809 4.87701 14.188 4.96379 14.1774C5.05056 14.1667 5.22134 14.237 5.56283 14.3777C5.86976 14.5041 6.22613 14.5821 6.55309 14.6038C7.50256 14.667 8.49583 14.6671 9.44723 14.6038Z",stroke:"#9334E9",strokeLinejoin:"round"})]})}function yT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M7.39917 2.67676C4.96653 2.68114 3.69265 2.74087 2.87855 3.5551C2 4.4338 2 5.84804 2 8.67648C2 11.5049 2 12.9192 2.87855 13.7979C3.7571 14.6766 5.17111 14.6766 7.99917 14.6766C10.8271 14.6766 12.2412 14.6766 13.1197 13.7979C13.9338 12.9837 13.9935 11.7095 13.9979 9.27654",stroke:"#DC2625",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M13.7039 3.00734L7.36572 9.38233M13.7039 3.00734C13.3746 2.6776 11.1561 2.70833 10.6871 2.71501M13.7039 3.00734C14.0333 3.33709 14.0025 5.55841 13.9959 6.02802",stroke:"#DC2625",strokeLinecap:"round",strokeLinejoin:"round"})]})}function xT({className:n,...e}){return g.jsx("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:g.jsx("path",{d:"M5.75193 9.12582H5.44596C4.4568 9.12582 3.96222 9.12582 3.75141 8.79969C3.5406 8.47362 3.74146 8.01929 4.1432 7.11064L5.35096 4.37891C5.71622 3.55276 5.89885 3.13968 6.25315 2.90822C6.60745 2.67676 7.0571 2.67676 7.9565 2.67676H9.34944C10.442 2.67676 10.9882 2.67676 11.1942 3.03366C11.4003 3.39056 11.1293 3.86734 10.5872 4.82091L9.87264 6.07801C9.60317 6.55206 9.46844 6.78908 9.4703 6.9831C9.47277 7.23526 9.60684 7.46756 9.82344 7.59476C9.9901 7.69269 10.2616 7.69269 10.8048 7.69269C11.4914 7.69269 11.8347 7.69269 12.0135 7.81156C12.2458 7.96596 12.3674 8.24222 12.3248 8.51889C12.292 8.73182 12.061 8.98716 11.5992 9.49789L7.9091 13.5783C7.1843 14.3798 6.8219 14.7805 6.57855 14.6537C6.33519 14.5268 6.45206 13.9982 6.68577 12.9409L7.14364 10.8698C7.32157 10.0648 7.41057 9.66222 7.19657 9.39402C6.98257 9.12582 6.57235 9.12582 5.75193 9.12582Z",stroke:"#CA8A03",strokeLinejoin:"round"})})}function ST({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M8.00016 15.3433C11.6821 15.3433 14.6668 12.3586 14.6668 8.67668C14.6668 4.99478 11.6821 2.01001 8.00016 2.01001C4.31826 2.01001 1.3335 4.99478 1.3335 8.67668C1.3335 12.3586 4.31826 15.3433 8.00016 15.3433Z",stroke:"#5046E5"}),g.jsx("path",{d:"M8 6.01001V8.67668L9.33333 10.01",stroke:"#5046E5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function kT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M8.00016 15.3433C11.6821 15.3433 14.6668 12.3586 14.6668 8.67668C14.6668 4.99478 11.6821 2.01001 8.00016 2.01001C4.31826 2.01001 1.3335 4.99478 1.3335 8.67668C1.3335 12.3586 4.31826 15.3433 8.00016 15.3433Z",stroke:"#0A91B1"}),g.jsx("path",{d:"M10.6665 7.34351L11.4842 8.04831C11.828 8.34457 11.9998 8.49277 11.9998 8.67684C11.9998 8.86091 11.828 9.00911 11.4842 9.30537L10.6665 10.0102",stroke:"#0A91B1",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M5.33333 7.34351L4.51564 8.04831C4.17188 8.34457 4 8.49277 4 8.67684C4 8.86091 4.17188 9.00911 4.51564 9.30537L5.33333 10.0102",stroke:"#0A91B1",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M8.66683 6.67676L7.3335 10.6768",stroke:"#0A91B1",strokeLinecap:"round",strokeLinejoin:"round"})]})}function vT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M8.00016 15.3433C11.6821 15.3433 14.6668 12.3586 14.6668 8.67668C14.6668 4.99478 11.6821 2.01001 8.00016 2.01001C4.31826 2.01001 1.3335 4.99478 1.3335 8.67668C1.3335 12.3586 4.31826 15.3433 8.00016 15.3433Z",stroke:"#0A91B1"}),g.jsx("path",{d:"M10.6665 7.34351L11.4842 8.04831C11.828 8.34457 11.9998 8.49277 11.9998 8.67684C11.9998 8.86091 11.828 9.00911 11.4842 9.30537L10.6665 10.0102",stroke:"#0A91B1",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M5.33333 7.34351L4.51564 8.04831C4.17188 8.34457 4 8.49277 4 8.67684C4 8.86091 4.17188 9.00911 4.51564 9.30537L5.33333 10.0102",stroke:"#0A91B1",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M8.66683 6.67676L7.3335 10.6768",stroke:"#0A91B1",strokeLinecap:"round",strokeLinejoin:"round"})]})}function wT({className:n,...e}){return g.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:V(mr.icon,n),...e,children:[g.jsx("path",{d:"M5.3335 12.0103H10.6668",stroke:"#DB2877",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M5.3335 9.34326H8.00016",stroke:"#DB2877",strokeLinecap:"round",strokeLinejoin:"round"}),g.jsx("path",{d:"M8.6665 2.34359V2.67692C8.6665 4.56254 8.6665 5.50535 9.2523 6.09113C9.8381 6.67692 10.7809 6.67692 12.6665 6.67692H12.9998M13.3332 7.78152V10.0103C13.3332 12.5244 13.3332 13.7815 12.5521 14.5625C11.7711 15.3436 10.514 15.3436 7.99984 15.3436C5.48568 15.3436 4.2286 15.3436 3.44755 14.5625C2.6665 13.7815 2.6665 12.5244 2.6665 10.0103V6.98081C2.6665 4.81747 2.6665 3.73579 3.25722 3.00314C3.37656 2.85513 3.51138 2.72031 3.65939 2.60097C4.39204 2.01025 5.47372 2.01025 7.63704 2.01025C8.10744 2.01025 8.34257 2.01025 8.55797 2.08626C8.60277 2.10207 8.64664 2.12025 8.6895 2.14075C8.89557 2.23929 9.06184 2.40559 9.39444 2.73817L12.5521 5.89587C12.9375 6.28125 13.1302 6.47393 13.2317 6.71896C13.3332 6.96399 13.3332 7.23649 13.3332 7.78152Z",stroke:"#DB2877",strokeLinecap:"round",strokeLinejoin:"round"})]})}const ya={columnWidth:Rt.COLUMN_WIDTH,rowHeight:Rt.ROW_HEIGHT,headerHeight:Rt.HEADER_HEIGHT,messageNodeWidth:Rt.MESSAGE_NODE_WIDTH,messageNodeHeight:Rt.MESSAGE_NODE_HEIGHT,selfLoopOffset:Rt.SELF_LOOP_OFFSET};function Bd(n,e=ya){return e.headerHeight+n*e.rowHeight+e.rowHeight/2}function xl(n,e,t){return`row-${n}-${e}-${t}`}const QT=Rt.ROW_VERTICAL_PADDING,lO=5;function em(n){const e=new Map;for(const t of n){if(t.source.startsWith("participant-")&&t.target.startsWith("message-")){const r=e.get(t.target)??{};e.set(t.target,{...r,from:t.source})}if(t.source.startsWith("message-")&&t.target.startsWith("participant-")){const r=e.get(t.source)??{};e.set(t.source,{...r,to:t.target})}}return e}function $T(n){const e=n.data?.componentFields;return TP(e,{componentFieldId:"name"})??n.data?.label??""}const cO=/^row-\d+-(left|right)-(source|target)$/;function td(n,e){const t=e.get(n);return!!(t?.from&&t.from===t.to)}function yx(n){return n.id.startsWith("message-")||n.id.startsWith("note-")}function tm(n,e){const t=n.filter(yx).sort((s,o)=>s.position.y-o.position.y),r=new Map;let i=0;for(const s of t)r.set(s.id,i),i+=td(s.id,e)?2:1;return r}function CT(n){const e=n.filter(s=>s.id.startsWith("message-")),t=e.map(s=>s.data?.sequenceNumber).filter(s=>typeof s=="number");if(t.length===0)return new Map;const r=t[0],i=t.length>1?t[1]-t[0]:1;return new Map(e.map((s,o)=>[s.id,Number((r+o*i).toFixed(2))]))}function cc(n){const e=n.data?.sequenceBlock;if(e&&typeof e.startRow=="number"&&typeof e.endRow=="number")return e}function PT(n,e,t){const r=new Array(e+1).fill(0),i=new Array(e+1).fill(0);for(const a of n){const l=cc(a);if(l&&!(l.startRow>e-1)){r[l.startRow]+=Rt.BLOCK_TOP_PADDING+Rt.BLOCK_FRAME_GAP,i[Math.min(l.endRow,e-1)]+=Rt.BLOCK_BOTTOM_PADDING;for(const c of(l.sections??[]).slice(1))c.startRow>e-1||(r[c.startRow]+=Rt.BLOCK_SECTION_PADDING)}}const s=[];let o=Rt.HEADER_HEIGHT;for(let a=0;a<e;a++)o+=r[a],s.push(o),o+=t+i[a];return{tops:s,centers:s.map(a=>a+t/2),height:o}}function Uq(n,e){const t=em(e),r=tm(n,t);let i=0;for(const[s,o]of r)i=Math.max(i,o+(td(s,t)?2:1));return i}function TT(n,e){const t=em(e),r=tm(n,t);if(r.size===0)return{nodes:n,edges:e};const i=e.map(s=>{const o=r.get(s.source),a=o??r.get(s.target);if(a===void 0)return s;const c=o!==void 0&&td(s.source,t)?a+1:a;let d=s.sourceHandle,h=s.targetHandle,f=!1;return d&&cO.test(d)&&(d=d.replace(/^row-\d+-/,`row-${c}-`),f=f||d!==s.sourceHandle),h&&cO.test(h)&&(h=h.replace(/^row-\d+-/,`row-${c}-`),f=f||h!==s.targetHandle),f?{...s,sourceHandle:d,targetHandle:h}:s});return{nodes:n,edges:i}}function MT(n,e,t,r){return r?n+lO+ya.selfLoopOffset:(n+e)/2+lO-t/2}function AT(n,e){const t=n.filter(x=>x.type==="sequenceParticipant"),r=n.filter(yx);if(t.length===0||r.length===0)return{nodes:n,edges:e};const i=em(e),s=new Map(t.map(x=>[x.id,x])),o=[...r].sort((x,k)=>x.position.y-k.position.y),a=new Map(o.map(x=>[x.id,E$($T(x))])),l=Math.max(ya.rowHeight,...o.map(x=>a.get(x.id).height+QT)),c=tm(n,i),d=Math.max(...[...c].map(([x,k])=>k+(td(x,i)?2:1))),h=PT(n,d,l),f=CT(o),p=o.map(x=>{const k=a.get(x.id),v=c.get(x.id),w=h.centers[v]-k.height/2,Q=i.get(x.id),C=Q?.from?s.get(Q.from):void 0,T=Q?.to?s.get(Q.to):void 0,P=C&&T?MT(C.position.x,T.position.x,k.width,Q.from===Q.to):x.position.x,R=x.id.startsWith("note-")?x.width??k.width:k.width,M=f.get(x.id);return{...x,data:M===void 0?x.data:{...x.data,sequenceNumber:M},position:{x:P,y:w},width:R,height:k.height,style:{...x.style??{},width:R,height:k.height}}}),m=new Map(p.map(x=>[x.id,x])),O=t.map(x=>({...x,data:{...x.data,rowHeight:l,rowCount:d,rowYs:h.centers,lifelineHeight:h.height}})),b=new Map(O.map(x=>[x.id,x])),y=new Map;for(const x of n){const k=cc(x);if(k){const v=Math.min(k.startRow,d-1),w=Math.min(k.endRow,d-1),Q=n.filter(R=>{const M=cc(R);return!M||R.id===x.id||(M.depth??0)<=(k.depth??0)?!1:Math.min(M.startRow,d-1)===v}).length,C=n.filter(R=>{const M=cc(R);return!M||R.id===x.id||(M.depth??0)<=(k.depth??0)?!1:Math.min(M.endRow,d-1)===w}).length,T=h.tops[v]-Rt.BLOCK_TOP_PADDING*(Q+1),P=h.tops[w]+l+Rt.BLOCK_BOTTOM_PADDING*(C+1);y.set(x.id,{...x,position:{...x.position,y:T},height:P-T,style:{...x.style??{},height:P-T}});continue}if(x.data?.sequenceBox){const v=h.height+Rt.BOX_TOP_INSET+Rt.BOX_BOTTOM_PADDING;y.set(x.id,{...x,height:v,style:{...x.style??{},height:v}})}}const S=n.map(x=>b.get(x.id)??m.get(x.id)??y.get(x.id)??x);return TT(S,e)}const RT=32;function ET(n,e){let t=n.position.x,r=n.position.y,i=n,s=0;for(;i.parentId&&s<RT;){const o=e.get(i.parentId);if(!o)break;t+=o.position.x,r+=o.position.y,i=o,s++}return{x:t,y:r}}function xa(n){return{width:n.measured?.width??n.width??0,height:n.measured?.height??n.height??0}}function Fs(n,e){const{x:t,y:r}=ET(n,e),{width:i,height:s}=xa(n);return{x:t,y:r,width:i,height:s}}function uO(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function hf(n,e){const t=uO(n),r=uO(e),i=Math.abs(t.x-r.x),s=Math.abs(t.y-r.y);return i>s?t.x>r.x?ge.Left:ge.Right:t.y>r.y?ge.Top:ge.Bottom}function dO(n,e){return`${e}-${n}`}const NT=new Set([void 0,"default","straight","step","smoothstep","simplebezier"]);function Dc(n){return n.type==="sequenceParticipant"||n.id.startsWith("message-")}function Gq(n,e){const t=new Map(n.map(r=>[r.id,r]));return e.map(r=>{if(r.data?.handlesLocked||!NT.has(r.type))return r;const i=t.get(r.source),s=t.get(r.target);if(!i||!s||Dc(i)||Dc(s))return r;const o=Fs(i,t),a=Fs(s,t),l=hf(o,a),c=hf(a,o);return{...r,sourceHandle:dO(l,"source"),targetHandle:dO(c,"target")}})}function DT(n){const e=document.querySelector(".react-flow"),t=document.querySelector(".react-flow__viewport");if(!e||!t)return ac(n);const r=new DOMMatrixReadOnly(getComputedStyle(t).transform),i=r.a;if(i===0)return ac(n);const s=e.getBoundingClientRect();let o=1/0,a=1/0,l=-1/0,c=-1/0;for(const d of e.querySelectorAll(".react-flow__node"))for(const h of[d,...d.querySelectorAll("*")]){if(h.classList.contains("react-flow__handle"))continue;const f=h.getBoundingClientRect();f.width===0&&f.height===0||(o=Math.min(o,f.left),a=Math.min(a,f.top),l=Math.max(l,f.right),c=Math.max(c,f.bottom))}return o===1/0?ac(n):{x:(o-s.left-r.e)/i,y:(a-s.top-r.f)/i,width:(l-o)/i,height:(c-a)/i}}function hO(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function jT(...n){return e=>{let t=!1;const r=n.map(i=>{const s=hO(i,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():hO(n[i],null)}}}}function IT(...n){return $.useCallback(jT(...n),n)}class XT extends $.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(Id(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=t.offsetParent,i=Id(r)&&r.offsetWidth||0,s=Id(r)&&r.offsetHeight||0,o=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=i-a.width-a.left,a.bottom=s-a.height-a.top,a.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function LT({children:n,isPresent:e,anchorX:t,anchorY:r,root:i,pop:s}){const o=$.useId(),a=$.useRef(null),l=$.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=$.useContext(AC),d=s!==!1?n.props?.ref??n?.ref:void 0,h=IT(a,d);return $.useInsertionEffect(()=>{const{width:f,height:p,top:m,left:O,right:b,bottom:y,direction:S}=l.current;if(e||s===!1||!a.current||!f||!p)return;const x=S==="rtl",k=t==="left"?x?`right: ${b}`:`left: ${O}`:x?`left: ${O}`:`right: ${b}`,v=r==="bottom"?`bottom: ${y}`:`top: ${m}`;a.current.dataset.motionPopId=o;const w=document.createElement("style");c&&(w.nonce=c);const Q=i??document.head;return Q.appendChild(w),w.sheet&&w.sheet.insertRule(`
37
- [data-motion-pop-id="${o}"] {
38
- position: absolute !important;
39
- width: ${f}px !important;
40
- height: ${p}px !important;
41
- ${k}px !important;
42
- ${v}px !important;
43
- }
44
- `),()=>{a.current?.removeAttribute("data-motion-pop-id"),Q.contains(w)&&Q.removeChild(w)}},[e]),g.jsx(XT,{isPresent:e,childRef:a,sizeRef:l,pop:s,children:s===!1?n:$.cloneElement(n,{ref:h})})}const _T=({children:n,initial:e,isPresent:t,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:o,anchorX:a,anchorY:l,root:c})=>{const d=ux(BT),h=$.useId(),f=$.useRef(t),p=$.useRef(r);dx(()=>{f.current=t,p.current=r});let m=!0,O=$.useMemo(()=>(m=!1,{id:h,initial:e,isPresent:t,custom:i,onExitComplete:b=>{d.set(b,!0);for(const y of d.values())if(!y)return;r&&r()},register:b=>(d.set(b,!1),()=>{d.delete(b),!f.current&&!d.size&&p.current?.()})}),[t,d,r]);return s&&m&&(O={...O}),$.useMemo(()=>{d.forEach((b,y)=>d.set(y,!1))},[t]),$.useEffect(()=>{!t&&!d.size&&r&&r()},[t]),n=g.jsx(LT,{pop:o==="popLayout",isPresent:t,anchorX:a,anchorY:l,root:c,children:n}),g.jsx(RC.Provider,{value:O,children:n})};function BT(){return new Map}const Sl=n=>n.key||"";function fO(n){const e=[];return $.Children.forEach(n,t=>{$.isValidElement(t)&&e.push(t)}),e}const uc=({children:n,custom:e,initial:t=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:o=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[d,h]=EC(o),f=$.useMemo(()=>fO(n),[n]),p=o&&!d?[]:f.map(Sl),m=$.useRef(!0),O=$.useRef(f),b=ux(()=>new Map),y=$.useRef(new Set),[S,x]=$.useState(f),[k,v]=$.useState(f);dx(()=>{m.current=!1,O.current=f;for(let C=0;C<k.length;C++){const T=Sl(k[C]);p.includes(T)?(b.delete(T),y.current.delete(T)):b.get(T)!==!0&&b.set(T,!1)}},[k,p.length,p.join("-")]);const w=[];if(f!==S){let C=[...f];for(let T=0;T<k.length;T++){const P=k[T],R=Sl(P);p.includes(R)||(C.splice(T,0,P),w.push(P))}return s==="wait"&&w.length&&(C=w),v(fO(C)),x(f),null}const{forceRender:Q}=$.useContext(NC);return g.jsx(g.Fragment,{children:k.map(C=>{const T=Sl(C),P=o&&!d?!1:f===k||p.includes(T),R=()=>{if(y.current.has(T))return;if(b.has(T))y.current.add(T),b.set(T,!0);else return;let M=!0;b.forEach(D=>{D||(M=!1)}),M&&(Q?.(),v(O.current),o&&h?.(),r&&r())};return g.jsx(_T,{isPresent:P,initial:!m.current||t?void 0:!1,custom:e,presenceAffectsLayout:i,mode:s,root:c,onExitComplete:P?void 0:R,anchorX:a,anchorY:l,children:C},T)})})},xx=1024;let WT=0,Qn=class{constructor(e,t){this.from=e,this.to=t}};class de{constructor(e={}){this.id=WT++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=mn.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}de.closedBy=new de({deserialize:n=>n.split(" ")});de.openedBy=new de({deserialize:n=>n.split(" ")});de.group=new de({deserialize:n=>n.split(" ")});de.isolate=new de({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});de.contextHash=new de({perNode:!0});de.lookAhead=new de({perNode:!0});de.mounted=new de({perNode:!0});class Rs{constructor(e,t,r,i=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[de.mounted.id]}}const zT=Object.create(null);let mn=class Sx{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):zT,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Sx(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(de.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(de.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?r.name:i[s]];if(o)return o}}}};mn.none=new mn("",Object.create(null),0,8);class nm{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}t.push(i?new mn(r.name,i,r.id,r.flags):r)}return new nm(t)}}const kl=new WeakMap,pO=new WeakMap;var Oe;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(Oe||(Oe={}));class qe{constructor(e,t,r,i,s){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Rs.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new jc(this.topNode,e)}cursorAt(e,t=0,r=0){let i=kl.get(this)||this.topNode,s=new jc(i);return s.moveTo(e,t),kl.set(this,s._tree),s}get topNode(){return new jt(this,0,0,null)}resolve(e,t=0){let r=Sa(kl.get(this)||this.topNode,e,t,!1);return kl.set(this,r),r}resolveInner(e,t=0){let r=Sa(pO.get(this)||this.topNode,e,t,!0);return pO.set(this,r),r}resolveStack(e,t=0){return VT(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&Oe.IncludeAnonymous)>0;for(let l=this.cursor(o|Oe.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:sm(mn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new qe(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new qe(mn.none,t,r,i)))}static build(e){return YT(e)}}qe.empty=new qe(mn.none,[],[],0);class rm{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new rm(this.buffer,this.index)}}class fi{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return mn.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(kx(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new fi(s,o,this.set)}}function kx(n,e,t,r){switch(n){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Sa(n,e,t,r){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!r&&n instanceof jt&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=r?0:Oe.IgnoreOverlays;if(r)for(let o=n,a=o.parent;a;o=a,a=o.parent)o instanceof jt&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(n=a);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class vx{cursor(e=0){return new jc(this,e)}getChild(e,t=null,r=null){let i=mO(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return mO(this,e,t,r)}resolve(e,t=0){return Sa(this,e,t,!1)}resolveInner(e,t=0){return Sa(this,e,t,!0)}matchContext(e){return ff(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class jt extends vx{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=t>0?a.length:-1;e!=c;e+=t){let d=a[e],h=l[e]+o.from,f;if(!(!(s&Oe.EnterBracketed&&d instanceof qe&&(f=Rs.get(d))&&!f.overlay&&f.bracketed&&r>=h&&r<=h+d.length)&&!kx(i,r,h,h+d.length))){if(d instanceof fi){if(s&Oe.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,t,r-h,i);if(p>-1)return new sr(new ZT(o,d,e,h),null,p)}else if(s&Oe.IncludeAnonymous||!d.type.isAnonymous||im(d)){let p;if(!(s&Oe.IgnoreMounts)&&(p=Rs.get(d))&&!p.overlay)return new jt(p.tree,h,e,o);let m=new jt(d,h,e,o);return s&Oe.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?d.children.length-1:0,t,r,i,s)}}}if(s&Oe.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let i;if(!(r&Oe.IgnoreOverlays)&&(i=Rs.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Oe.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((t>0||o?a<=s:a<s)&&(t<0||o?l>=s:l>s))return new jt(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function mO(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function ff(n,e,t=e.length-1){for(let r=n;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class ZT{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class sr extends vx{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new sr(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&Oe.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new sr(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new sr(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new sr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),t.push(0)}return new qe(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function wx(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof jt&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new FT(i,t)}class FT{constructor(e,t){this.heads=e,this.node=t}get next(){return wx(this.heads)}}function VT(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof jt?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,t)),s=o}else{let o=Rs.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new jt(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Sa(a,e,t,!1))}}return i?wx(i):r}class jc{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Oe.EnterBracketed,e instanceof jt)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof jt?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&Oe.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Oe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Oe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Oe.IncludeAnonymous||a instanceof fi||!a.type.isAnonymous||im(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new sr(this.buffer,t,this.stack[i]);return this.bufferNode=new sr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return ff(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return ff(this._tree,e,i);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function im(n){return n.children.some(e=>e instanceof fi||!e.type.isAnonymous||im(e))}function YT(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=xx,reused:s=[],minRepeatType:o=r.types.length}=n,a=Array.isArray(t)?new rm(t,t.length):t,l=r.types,c=0,d=0;function h(v,w,Q,C,T,P){let{id:R,start:M,end:D,size:N}=a,I=d,Z=c;if(N<0)if(a.next(),N==-1){let re=s[R];Q.push(re),C.push(M-v);return}else if(N==-3){c=R;return}else if(N==-4){d=R;return}else throw new RangeError(`Unrecognized record size: ${N}`);let ne=l[R],le,B,se=M-v;if(D-M<=i&&(B=b(a.pos-w,T))){let re=new Uint16Array(B.size-B.skip),me=a.pos-B.size,$e=re.length;for(;a.pos>me;)$e=y(B.start,re,$e);le=new fi(re,D-B.start,r),se=B.start-v}else{let re=a.pos-N;a.next();let me=[],$e=[],G=R>=o?R:-1,fe=0,Je=D;for(;a.pos>re;)G>=0&&a.id==G&&a.size>=0?(a.end<=Je-i&&(m(me,$e,M,fe,a.end,Je,G,I,Z),fe=me.length,Je=a.end),a.next()):P>2500?f(M,re,me,$e):h(M,re,me,$e,G,P+1);if(G>=0&&fe>0&&fe<me.length&&m(me,$e,M,fe,M,Je,G,I,Z),me.reverse(),$e.reverse(),G>-1&&fe>0){let St=p(ne,Z);le=sm(ne,me,$e,0,me.length,0,D-M,St,St)}else le=O(ne,me,$e,D-M,I-D,Z)}Q.push(le),C.push(se)}function f(v,w,Q,C){let T=[],P=0,R=-1;for(;a.pos>w;){let{id:M,start:D,end:N,size:I}=a;if(I>4)a.next();else{if(R>-1&&D<R)break;R<0&&(R=N-i),T.push(M,D,N),P++,a.next()}}if(P){let M=new Uint16Array(P*4),D=T[T.length-2];for(let N=T.length-3,I=0;N>=0;N-=3)M[I++]=T[N],M[I++]=T[N+1]-D,M[I++]=T[N+2]-D,M[I++]=I;Q.push(new fi(M,T[2]-D,r)),C.push(D-v)}}function p(v,w){return(Q,C,T)=>{let P=0,R=Q.length-1,M,D;if(R>=0&&(M=Q[R])instanceof qe){if(!R&&M.type==v&&M.length==T)return M;(D=M.prop(de.lookAhead))&&(P=C[R]+M.length+D)}return O(v,Q,C,T,P,w)}}function m(v,w,Q,C,T,P,R,M,D){let N=[],I=[];for(;v.length>C;)N.push(v.pop()),I.push(w.pop()+Q-T);v.push(O(r.types[R],N,I,P-T,M-P,D)),w.push(T-Q)}function O(v,w,Q,C,T,P,R){if(P){let M=[de.contextHash,P];R=R?[M].concat(R):[M]}if(T>25){let M=[de.lookAhead,T];R=R?[M].concat(R):[M]}return new qe(v,w,Q,C,R)}function b(v,w){let Q=a.fork(),C=0,T=0,P=0,R=Q.end-i,M={size:0,start:0,skip:0};e:for(let D=Q.pos-v;Q.pos>D;){let N=Q.size;if(Q.id==w&&N>=0){M.size=C,M.start=T,M.skip=P,P+=4,C+=4,Q.next();continue}let I=Q.pos-N;if(N<0||I<D||Q.start<R)break;let Z=Q.id>=o?4:0,ne=Q.start;for(Q.next();Q.pos>I;){if(Q.size<0)if(Q.size==-3||Q.size==-4)Z+=4;else break e;else Q.id>=o&&(Z+=4);Q.next()}T=ne,C+=N,P+=Z}return(w<0||C==v)&&(M.size=C,M.start=T,M.skip=P),M.size>4?M:void 0}function y(v,w,Q){let{id:C,start:T,end:P,size:R}=a;if(a.next(),R>=0&&C<o){let M=Q;if(R>4){let D=a.pos-(R-4);for(;a.pos>D;)Q=y(v,w,Q)}w[--Q]=M,w[--Q]=P-v,w[--Q]=T-v,w[--Q]=C}else R==-3?c=C:R==-4&&(d=C);return Q}let S=[],x=[];for(;a.pos>0;)h(n.start||0,n.bufferStart||0,S,x,-1,0);let k=(e=n.length)!==null&&e!==void 0?e:S.length?x[0]+S[0].length:0;return new qe(l[n.topID],S.reverse(),x.reverse(),k)}const gO=new WeakMap;function dc(n,e){if(!n.isAnonymous||e instanceof fi||e.type!=n)return 1;let t=gO.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof qe)){t=1;break}t+=dc(n,r)}gO.set(e,t)}return t}function sm(n,e,t,r,i,s,o,a,l){let c=0;for(let m=r;m<i;m++)c+=dc(n,e[m]);let d=Math.ceil(c*1.5/8),h=[],f=[];function p(m,O,b,y,S){for(let x=b;x<y;){let k=x,v=O[x],w=dc(n,m[x]);for(x++;x<y;x++){let Q=dc(n,m[x]);if(w+Q>=d)break;w+=Q}if(x==k+1){if(w>d){let Q=m[k];p(Q.children,Q.positions,0,Q.children.length,O[k]+S);continue}h.push(m[k])}else{let Q=O[x-1]+m[x-1].length-v;h.push(sm(n,m,O,k,x,v,Q,null,l))}f.push(v+S-s)}}return p(e,t,r,i,0),(a||l)(h,f,o)}class om{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof sr?this.setBuffer(e.context.buffer,e.index,t):e instanceof jt&&this.map.set(e.tree,t)}get(e){return e instanceof sr?this.getBuffer(e.context.buffer,e.index):e instanceof jt?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Dr{constructor(e,t,r,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new Dr(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<t.length?t[a]:null,h=d?d.fromA:1e9;if(h-l>=r)for(;o&&o.from<h;){let f=o;if(l>=f.from||h<=f.to||c){let p=Math.max(f.from,l)-c,m=Math.min(f.to,h)-c;f=p>=m?null:new Dr(p,m,f.tree,f.offset+c,a>0,!!d)}if(f&&i.push(f),o.to>h)break;o=s<e.length?e[s++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return i}}class Qx{startParse(e,t,r){return typeof e=="string"&&(e=new qT(e)),r=r?r.length?r.map(i=>new Qn(i.from,i.to)):[new Qn(0,0)]:[new Qn(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let s=i.advance();if(s)return s}}}class qT{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function UT(n){return(e,t,r,i)=>new HT(e,n,t,r,i)}class OO{constructor(e,t,r,i,s,o){this.parser=e,this.parse=t,this.overlay=r,this.bracketed=i,this.target=s,this.from=o}}function bO(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class GT{constructor(e,t,r,i,s,o,a,l){this.parser=e,this.predicate=t,this.mounts=r,this.index=i,this.start=s,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const pf=new de({perNode:!0});class HT{constructor(e,t,r,i,s){this.nest=t,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new qe(r.type,r.children,r.positions,r.length,r.propValues.concat([[pf,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[de.mounted.id]=new Rs(t,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new e5(this.fragments),t=null,r=null,i=new jc(new jt(this.baseTree,this.ranges[0].from,0,null),Oe.IncludeAnonymous|Oe.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(t){let c=t.mounts.find(d=>d.frag.from<=i.from&&d.frag.to>=i.to&&d.mount.overlay);if(c)for(let d of c.mount.overlay){let h=d.from+c.pos,f=d.to+c.pos;h>=i.from&&f<=i.to&&!t.ranges.some(p=>p.from<f&&p.to>h)&&t.ranges.push({from:h,to:f})}}a=!1}else if(r&&(o=KT(r.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||(JT(i),t&&t.depth++,r&&r.depth++);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new GT(s.parser,s.overlay,c,this.inner.length,i.from,!!s.bracketed,i.tree,t);else{let d=SO(this.ranges,s.overlay||(i.from<i.to?[new Qn(i.from,i.to)]:[]));d.length&&bO(d),(d.length||!s.overlay)&&this.inner.push(new OO(s.parser,d.length?s.parser.startParse(this.input,kO(c,d),d):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new Qn(h.from-i.from,h.to-i.from)):null,!!s.bracketed,i.tree,d.length?d[0].from:i.from)),s.overlay?d.length&&(r={ranges:d,depth:0,prev:r}):a=!1}}else if(t&&(l=t.predicate(i))&&(l===!0&&(l=new Qn(i.from,i.to)),l.from<l.to)){let c=t.ranges.length-1;c>=0&&t.ranges[c].to==l.from?t.ranges[c]={from:t.ranges[c].from,to:l.to}:t.ranges.push(l)}if(a&&i.firstChild())t&&t.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let c=SO(this.ranges,t.ranges);c.length&&(bO(c),this.inner.splice(t.index,0,new OO(t.parser,t.parser.startParse(this.input,kO(t.mounts,c),c),t.ranges.map(d=>new Qn(d.from-t.start,d.to-t.start)),t.bracketed,t.target,c[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function KT(n,e,t){for(let r of n){if(r.from>=t)break;if(r.to>e)return r.from<=e&&r.to>=t?2:1}return 0}function yO(n,e,t,r,i,s){if(e<t){let o=n.buffer[e+1];r.push(n.slice(e,t,o)),i.push(o-s)}}function JT(n){let{node:e}=n,t=[],r=e.context.buffer;do t.push(n.index),n.parent();while(!n.tree);let i=n.tree,s=i.children.indexOf(r),o=i.children[s],a=o.buffer,l=[s];function c(d,h,f,p,m,O){let b=t[O],y=[],S=[];yO(o,d,b,y,S,p);let x=a[b+1],k=a[b+2];l.push(y.length);let v=O?c(b+4,a[b+3],o.set.types[a[b]],x,k-x,O-1):e.toTree();return y.push(v),S.push(x-p),yO(o,a[b+3],h,y,S,p),new qe(f,y,S,m)}i.children[s]=c(0,a.length,mn.none,0,o.length,t.length-1);for(let d of l){let h=n.tree.children[d],f=n.tree.positions[d];n.yield(new jt(h,f+n.from,d,n._tree))}}class xO{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Oe.IncludeAnonymous|Oe.IgnoreMounts|Oe.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)if(!(t.to>=r&&t.enter(r,1,Oe.IncludeAnonymous|Oe.IgnoreOverlays|Oe.ExcludeBuffers)))if(t.to<=r)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof qe)t=t.children[0];else break}return!1}}let e5=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(t=r.tree.prop(pf))!==null&&t!==void 0?t:r.to,this.inner=new xO(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(pf))!==null&&e!==void 0?e:t.to,this.inner=new xO(t.tree,-t.offset)}}findMounts(e,t){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(de.mounted);if(o&&o.parser==t)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}};function SO(n,e){let t=null,r=e;for(let i=1,s=0;i<n.length;i++){let o=n[i-1].to,a=n[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=a)break;l.to<=o||(t||(r=t=e.slice()),l.from<o?(t[s]=new Qn(l.from,o),l.to>a&&t.splice(s+1,0,new Qn(a,l.to))):l.to>a?t[s--]=new Qn(a,l.to):t.splice(s--,1))}}return r}function t5(n,e,t,r){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let d=i==n.length?1e9:o?n[i].to:n[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let f=Math.max(l,t),p=Math.min(d,h,r);f<p&&c.push(new Qn(f,p))}if(l=Math.min(d,h),l==1e9)break;d==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function kO(n,e){let t=[];for(let{pos:r,mount:i,frag:s}of n){let o=r+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let d=i.overlay.map(f=>new Qn(f.from+r,f.to+r)),h=t5(e,d,l,c);for(let f=0,p=l;;f++){let m=f==h.length,O=m?c:h[f].from;if(O>p&&t.push(new Dr(p,O,i.tree,-o,s.from>=p||s.openStart,s.to<=O||s.openEnd)),m)break;p=h[f].to}}else t.push(new Dr(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return t}var vO={};class Ic{constructor(e,t,r,i,s,o,a,l,c,d=0,h){this.p=e,this.stack=t,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let i=e.parser.context;return new Ic(e,[],t,r,r,0,[],0,i?new wO(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=s.dynamicPrecedence(i);if(a&&(this.score+=a),r==0){i<s.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from;i<s.minRepeatTerm&&c==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let d=this.reducePos-c;d>=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=d));let h=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-h;if(i<s.minRepeatTerm||e&131072){let p=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=s.getGoto(p,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,t,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this.buffer.length;if(o>0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==r)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,t,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=i;let a=o.stateFlag(s,1);!a&&(i>r||t<=o.maxNode)&&(this.reducePos=i),this.pushState(s,a?r:Math.min(r,this.reducePos)),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,i,4)}else this.pos=i,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,i,4)}apply(e,t,r,i){e&65536?this.reduce(e):this.shift(e,t,r,i)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new Ic(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new n5(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if((r&65536)==0)return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<8&&s<t.length;s+=2){let o=t[s+1];i.some((a,l)=>l&1&&a==o)||i.push(t[s],o)}t=i}let r=[];for(let i=0;i<t.length&&r.length<4;i+=2){let s=t[i+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[i],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,i=t&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new wO(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class wO{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class n5{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Xc{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Xc(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Xc(this.stack,this.pos,this.index)}}function jo(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let r=0,i=0;r<n.length;){let s=0;for(;;){let o=n.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[i++]=s:t=new e(s)}return t}class hc{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const QO=new hc;class r5{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=QO,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!i)return null;let o=this.ranges[--i];s-=r.from-o.to,r=o}for(;t<0?s>r.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,i;if(t>=0&&t<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=QO,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return r}}class Es{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;$x(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}Es.prototype.contextual=Es.prototype.fallback=Es.prototype.extend=!1;class ka{constructor(e,t,r){this.precTable=t,this.elseToken=r,this.data=typeof e=="string"?jo(e):e}token(e,t){let r=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if($x(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}ka.prototype.contextual=Es.prototype.fallback=Es.prototype.extend=!1;class nn{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function $x(n,e,t,r,i,s){let o=0,a=1<<r,{dialect:l}=t.p.parser;e:for(;(a&n[o])!=0;){let c=n[o+1];for(let p=o+3;p<c;p+=2)if((n[p+1]&a)>0){let m=n[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||i5(m,e.token.value,i,s))){e.acceptToken(m);break}}let d=e.next,h=0,f=n[o+2];if(e.next<0&&f>h&&n[c+f*3-3]==65535){o=n[c+f*3-1];continue e}for(;h<f;){let p=h+f>>1,m=c+p+(p<<1),O=n[m],b=n[m+1]||65536;if(d<O)f=p;else if(d>=b)h=p+1;else{o=n[m+2],e.advance();continue e}}break}}function $O(n,e,t){for(let r=e,i;(i=n[r])!=65535;r++)if(i==t)return r-e;return-1}function i5(n,e,t,r){let i=$O(t,r,e);return i<0||$O(t,r,n)<i}const on=typeof process<"u"&&vO&&/\bparse\b/.test(vO.LOG);let Wd=null;function CO(n,e,t){let r=n.cursor(Oe.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(n.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:n.length}}class s5{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?CO(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?CO(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],i=this.index[t];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[i],o=this.start[t]+r.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof qe){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(de.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class o5{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new hc)}getActions(e){let t=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if((1<<c&o)==0)continue;let d=s[c],h=this.tokens[c];if(!(r&&!d.fallback)&&((d.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,d,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let f=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!d.extend&&(r=h,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new hc,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new hc,{pos:r,p:i}=e;return t.start=r,t.end=Math.min(r+1,i.stream.end),t.value=r==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,r){let i=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,r,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=r,i}addActions(e,t,r,i){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Cr(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(Cr(a,c+2),t,r,i));break}a[c]==t&&(i=this.putAction(Cr(a,c+1),t,r,i))}return i}}class a5{constructor(e,t,r,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new r5(t,i),this.tokens=new o5(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[Ic.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new s5(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&c5(i);if(o)return on&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw on&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return on&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let i=e.pos,{parser:s}=this,o=on?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,d=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(i);h;){let f=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(f>-1&&h.length&&(!c||(h.prop(de.contextHash)||0)==d))return e.useNode(h,f),on&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof qe)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof qe&&h.positions[0]==0)h=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),on&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let d=l[c++],h=l[c++],f=l[c++],p=c==l.length||!r,m=p?e:e.split(),O=this.tokens.mainToken;if(m.apply(d,h,O?O.start:m.pos,f),on&&console.log(o+this.stackID(m)+` (via ${(d&65536)==0?"shift":`reduce of ${s.getName(d&65535)}`} for ${s.getName(h)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?t.push(m):r.push(m)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return PO(e,t),!0}}runRecovery(e,t,r){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],d=on?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),on&&console.log(d+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let h=a.split(),f=d;for(let p=0;p<10&&h.forceReduce()&&(on&&console.log(f+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,r));p++)on&&(f=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))on&&console.log(d+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),on&&console.log(d+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),PO(a,r)):(!i||i.score<h.score)&&(i=h)}return i}stackToTree(e){return e.close(),qe.build({buffer:Xc.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Wd||(Wd=new WeakMap)).get(e);return t||Wd.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function PO(n,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==n.pos&&r.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class l5{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const zd=n=>n;class am{constructor(e){this.start=e.start,this.shift=e.shift||zd,this.reduce=e.reduce||zd,this.reuse=e.reuse||zd,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Hi extends Qx{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=de[l]);for(let c=1;c<a.length;){let d=a[c++];if(d>=0)s(d,l,a[c++]);else{let h=a[c+-d];for(let f=-d;f>0;f--)s(a[c++],l,h);c++}}}this.nodeSet=new nm(t.map((a,l)=>mn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=xx;let o=jo(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(TO),this.states=jo(e.states,Uint32Array),this.data=jo(e.stateData),this.goto=jo(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Es(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let i=new a5(this,e,t,r);for(let s of this.wrappers)i=s(i,e,t,r);return i}getGoto(e,t,r=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,t){let r=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Cr(r,s+2)];else{if(r[s+1]==2)return Cr(r,s+2);break}if(o==t||o==0)return Cr(r,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),i=r?t(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Cr(this.data,s+2);else break;i=t(Cr(this.data,s+1))}return i}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Cr(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[r],i)}}return t}configure(e){let t=Object.assign(Object.create(Hi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[i]=TO(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new l5(e,r,i)}static deserialize(e){return new Hi(e)}}function Cr(n,e){return n[e]|n[e+1]<<16}function c5(n){let e=null;for(let t of n){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function TO(n){if(n.external){let e=n.extend?1:0;return(t,r)=>n.external(t,r)<<1|e}return n.get}let u5=0;class vn{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=u5++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof vn&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let i=new vn(r,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new Lc(e);return r=>r.modified.indexOf(t)>-1?r:Lc.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let d5=0;class Lc{constructor(e){this.name=e,this.instances=[],this.id=d5++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&h5(t,a.modified));if(r)return r;let i=[],s=new vn(e.name,i,e,t);for(let a of t)a.instances.push(s);let o=f5(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(Lc.get(a,l));return s}}function h5(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function f5(n){let e=[[]];for(let t=0;t<n.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(n[t]));return e.sort((t,r)=>r.length-t.length)}function el(n){let e=Object.create(null);for(let t in n){let r=n[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==i.length)break;let p=i[h++];if(h==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let d=new va(r,o,l>0?s.slice(0,l):null);e[c]=d.sort(e[c])}}return Cx.add(e)}const Cx=new de({combine(n,e){let t,r,i;for(;n||e;){if(!n||e&&n.depth<=e.depth?(i=e,e=e.next):(i=n,n=n.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let s=new va(i.tags,i.mode,i.context);t?t.next=s:r=s,t=s}return r}});class va{constructor(e,t,r,i){this.tags=e,this.mode=t,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}va.empty=new va([],2,null);function Px(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function p5(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function m5(n,e,t,r=0,i=n.length){let s=new g5(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class g5{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,d=O5(e)||va.empty,h=p5(s,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,a),c),d.opaque)return;let f=e.tree&&e.tree.prop(de.mounted);if(f&&f.overlay){let p=e.node.enter(f.overlay[0].from+a,1),m=this.highlighters.filter(b=>!b.scope||b.scope(f.tree.type)),O=e.firstChild();for(let b=0,y=a;;b++){let S=b<f.overlay.length?f.overlay[b]:null,x=S?S.from+a:l,k=Math.max(t,y),v=Math.min(r,x);if(k<v&&O)for(;e.from<v&&(this.highlightRange(e,k,v,i,s),this.startSpan(Math.min(v,e.to),c),!(e.to>=x||!e.nextSibling())););if(!S||x>r)break;y=S.to+a,y>t&&(this.highlightRange(p.cursor(),Math.max(t,S.from+a),Math.min(r,y),"",m),this.startSpan(Math.min(r,y),c))}O&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function O5(n){let e=n.type.prop(Cx);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const L=vn.define,vl=L(),Ur=L(),MO=L(Ur),AO=L(Ur),Gr=L(),wl=L(Gr),Zd=L(Gr),Kn=L(),Ci=L(Kn),Un=L(),Gn=L(),mf=L(),xo=L(mf),Ql=L(),u={comment:vl,lineComment:L(vl),blockComment:L(vl),docComment:L(vl),name:Ur,variableName:L(Ur),typeName:MO,tagName:L(MO),propertyName:AO,attributeName:L(AO),className:L(Ur),labelName:L(Ur),namespace:L(Ur),macroName:L(Ur),literal:Gr,string:wl,docString:L(wl),character:L(wl),attributeValue:L(wl),number:Zd,integer:L(Zd),float:L(Zd),bool:L(Gr),regexp:L(Gr),escape:L(Gr),color:L(Gr),url:L(Gr),keyword:Un,self:L(Un),null:L(Un),atom:L(Un),unit:L(Un),modifier:L(Un),operatorKeyword:L(Un),controlKeyword:L(Un),definitionKeyword:L(Un),moduleKeyword:L(Un),operator:Gn,derefOperator:L(Gn),arithmeticOperator:L(Gn),logicOperator:L(Gn),bitwiseOperator:L(Gn),compareOperator:L(Gn),updateOperator:L(Gn),definitionOperator:L(Gn),typeOperator:L(Gn),controlOperator:L(Gn),punctuation:mf,separator:L(mf),bracket:xo,angleBracket:L(xo),squareBracket:L(xo),paren:L(xo),brace:L(xo),content:Kn,heading:Ci,heading1:L(Ci),heading2:L(Ci),heading3:L(Ci),heading4:L(Ci),heading5:L(Ci),heading6:L(Ci),contentSeparator:L(Kn),list:L(Kn),quote:L(Kn),emphasis:L(Kn),strong:L(Kn),link:L(Kn),monospace:L(Kn),strikethrough:L(Kn),inserted:L(),deleted:L(),changed:L(),invalid:L(),meta:Ql,documentMeta:L(Ql),annotation:L(Ql),processingInstruction:L(Ql),definition:vn.defineModifier("definition"),constant:vn.defineModifier("constant"),function:vn.defineModifier("function"),standard:vn.defineModifier("standard"),local:vn.defineModifier("local"),special:vn.defineModifier("special")};for(let n in u){let e=u[n];e instanceof vn&&(e.name=n)}Px([{tag:u.link,class:"tok-link"},{tag:u.heading,class:"tok-heading"},{tag:u.emphasis,class:"tok-emphasis"},{tag:u.strong,class:"tok-strong"},{tag:u.keyword,class:"tok-keyword"},{tag:u.atom,class:"tok-atom"},{tag:u.bool,class:"tok-bool"},{tag:u.url,class:"tok-url"},{tag:u.labelName,class:"tok-labelName"},{tag:u.inserted,class:"tok-inserted"},{tag:u.deleted,class:"tok-deleted"},{tag:u.literal,class:"tok-literal"},{tag:u.string,class:"tok-string"},{tag:u.number,class:"tok-number"},{tag:[u.regexp,u.escape,u.special(u.string)],class:"tok-string2"},{tag:u.variableName,class:"tok-variableName"},{tag:u.local(u.variableName),class:"tok-variableName tok-local"},{tag:u.definition(u.variableName),class:"tok-variableName tok-definition"},{tag:u.special(u.variableName),class:"tok-variableName2"},{tag:u.definition(u.propertyName),class:"tok-propertyName tok-definition"},{tag:u.typeName,class:"tok-typeName"},{tag:u.namespace,class:"tok-namespace"},{tag:u.className,class:"tok-className"},{tag:u.macroName,class:"tok-macroName"},{tag:u.propertyName,class:"tok-propertyName"},{tag:u.operator,class:"tok-operator"},{tag:u.comment,class:"tok-comment"},{tag:u.meta,class:"tok-meta"},{tag:u.invalid,class:"tok-invalid"},{tag:u.punctuation,class:"tok-punctuation"}]);const b5=148,RO=1,y5=149,x5=150,Tx=2,S5=151,k5=3,v5=4,w5=152,Mx=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Q5=58,$5=40,Ax=95,C5=91,fc=45,P5=46,T5=35,M5=37,A5=38,R5=92,E5=10,N5=42;function wa(n){return n>=65&&n<=90||n>=97&&n<=122||n>=161}function lm(n){return n>=48&&n<=57}function EO(n){return lm(n)||n>=97&&n<=102||n>=65&&n<=70}const Rx=(n,e,t)=>(r,i)=>{for(let s=!1,o=0,a=0;;a++){let{next:l}=r;if(wa(l)||l==fc||l==Ax||s&&lm(l))!s&&(l!=fc||a>0)&&(s=!0),o===a&&l==fc&&o++,r.advance();else if(l==R5&&r.peek(1)!=E5){if(r.advance(),EO(r.next)){do r.advance();while(EO(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();s=!0}else{s&&r.acceptToken(o>=2&&i.canShift(Tx)?e:l==$5?t:n);break}}},D5=new nn(Rx(y5,Tx,x5),{contextual:!0}),j5=new nn(Rx(S5,k5,v5),{contextual:!0}),I5=new nn(n=>{if(Mx.includes(n.peek(-1))){let{next:e}=n;(wa(e)||e==Ax||e==T5||e==P5||e==N5||e==C5||e==Q5&&wa(n.peek(1))||e==fc||e==A5)&&n.acceptToken(b5)}}),X5=new nn(n=>{if(!Mx.includes(n.peek(-1))){let{next:e}=n;if(e==M5&&(n.advance(),n.acceptToken(RO)),wa(e)){do n.advance();while(wa(n.next)||lm(n.next));n.acceptToken(RO)}}});function NO(n){return/^#[a-f\d]{3}([a-f\d]{3}([a-f\d]{2})?)?$/i.test(n)?w5:-1}const L5=el({"AtKeyword import charset namespace keyframes media supports font-feature-values":u.definitionKeyword,"from to selector scope MatchFlag":u.keyword,NamespaceName:u.namespace,KeyframeName:u.labelName,KeyframeRangeName:u.operatorKeyword,TagName:u.tagName,ClassName:u.className,PseudoClassName:u.constant(u.className),IdName:u.labelName,"FeatureName PropertyName":u.propertyName,AttributeName:u.attributeName,NumberLiteral:u.number,KeywordQuery:u.keyword,UnaryQueryOp:u.operatorKeyword,"CallTag ValueName FontName":u.atom,VariableName:u.variableName,Callee:u.operatorKeyword,Unit:u.unit,"UniversalSelector NestingSelector":u.definitionOperator,"MatchOp CompareOp":u.compareOperator,"ChildOp SiblingOp, LogicOp":u.logicOperator,BinOp:u.arithmeticOperator,Important:u.modifier,Comment:u.blockComment,ColorLiteral:u.color,"ParenthesizedContent StringLiteral":u.string,":":u.punctuation,PseudoOp:u.derefOperator,"; , |":u.separator,"( )":u.paren,"[ ]":u.squareBracket,"{ }":u.brace}),_5={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:88,url:158,"url-prefix":158,domain:158,regexp:158},B5={__proto__:null,or:102,and:102,not:112,only:112,layer:212},W5={__proto__:null,selector:118,style:124,layer:208},z5={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252},Z5={__proto__:null,to:249},F5=Hi.deserialize({version:14,states:"MrQYQdOOO$TQdOOP$[O`OOO%XQaO'#CfOOQP'#Ce'#CeO%`QdO'#CgO%eQ`O'#CgO%jQaO'#FrO&eQdO'#CkO'XQaO'#CcO'cQdO'#CnOOQP'#ES'#ESOOQP'#ER'#ERO'nQdO'#ETO'yQdO'#E[O'yQdO'#E_OOQP'#Fr'#FrO)`QhO'#FQOO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Q$n!zQ$t#RQ$w#VQ$z#YQ%g$PQ&`$vQ'^&[Q'a&aR(S']SoP!SQ#^pQ%O#[R&g%PZnPp!S#[%PQ$}#ZQ&e${R'd&dR$g!rQ'R%{R(['yR#OhR#QiR$s#QS&[$r&]R(Q'[V&Y$r&]'[R#YlQ#`rR%S#`QdOSpP!SU!kdp%PR%P#[Q%]#p[&l%]&r'i'r'x(bQ&r%aQ'i&mQ'r&wQ'x'OR(b(VQ$[!mQ$^!nQ$`!oV%v$[$^$`Q&Q$iR'X&QQ&v%iS'q&v(WR(W'rQ&n%]R'j&nQ&j%YR'h&jQ!RXR#l!RQ&d${R'c&dQ#]oS%Q#]%RR%R#^Q'z'RR(]'zQ$m!yR&U$mQ&]$rR'_&]Q']&[R(R']Q#XlR$y#XQ$P!cR%f$P_cOPdp!S#[%P^XOPdp!S#[%PQ!_^Q!`_Q#h}Q#i!OQ#j!PQ#k!QQ$u#SQ%Y#oR'g&iR%^#pQ!reQ!{g[$X!m!n!o$[$^$`Q${#Zh%[#p%]%a&m&r&w'O'i'r'x(V(bQ%`#uQ%z$cS&b${&dQ&h%WQ'b&cR'|'T]$Z!m!n!o$[$^$`Q!caU!yf!r$gQ#RjQ#x!bS#|!c$PQ$R!dQ%d#}Q%e$OQ%i$SS&O$i&QQ&T$lR'o&uQ#{!bW%s$W%m&z'uQ&t%bQ'w&}Q(U'mR(d(ZQ%u$WQ&y%mQ't&zR(Y'uR%k$SR%Z#oQqPR#n!SQ!zfQ$f!rR%}$g",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NamespacedTagSelector NamespaceName TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery ColorLiteral CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector StyleQuery style ParenthesedQuery CallQuery ArgList PropertyName , PropertyName UnaryQuery ParenthesedQuery BinaryQuery ParenthesedQuery ParenthesedQuery StyleFeature PropertyName StyleRange PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values FontName AtRule Styles",maxTerm:176,nodeProps:[["isolate",-2,5,38,""],["openedBy",23,"(",30,"[",33,"{"],["closedBy",24,")",31,"]",34,"}"]],propSources:[L5],skippedNodes:[0,5,130],repeatNodeCount:17,tokenData:"IO~R!bOX%ZX^&R^p%Zpq&Rqr)ers)vst+jtu/wuv%Zvw0qwx1Sxy2qyz3Sz{3X{|3r|}8e}!O8v!O!P9e!P!Q9|!Q![:u![!];p!]!^<l!^!_<}!_!`=y!`!a>^!a!b%Z!b!c?_!c!k%Z!k!lAl!l!u%Z!u!vAl!v!}%Z!}#OA}#O#P%Z#P#QB`#Q#R/w#R#]%Z#]#^Bq#^#g%Z#g#hAl#h#o%Z#o#pGU#p#qGg#q#rHO#r#sHa#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`Hx<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!r`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&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("m~RRYZ[z{a~~g~aO$c~~dP!P!Qg~lO$d~~",28,156)],topRules:{StyleSheet:[0,6],Styles:[1,129]},dynamicPrecedences:{97:1},specialized:[{term:172,get:(n,e)=>NO(n)<<1,external:NO},{term:150,get:n=>_5[n]||-1},{term:151,get:n=>B5[n]||-1},{term:4,get:n=>W5[n]||-1},{term:28,get:n=>z5[n]||-1},{term:149,get:n=>Z5[n]||-1}],tokenPrec:2433});let gf=[],Ex=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?Ex:gf).push(t=t+n[e])})();function V5(n){if(n<768)return!1;for(let e=0,t=gf.length;;){let r=e+t>>1;if(n<gf[r])t=r;else if(n>=Ex[r])e=r+1;else return!0;if(e==t)return!1}}function DO(n){return n>=127462&&n<=127487}const jO=8205;function Y5(n,e,t=!0,r=!0){return(t?Nx:q5)(n,e,r)}function Nx(n,e,t){if(e==n.length)return e;e&&Dx(n.charCodeAt(e))&&jx(n.charCodeAt(e-1))&&e--;let r=Fd(n,e);for(e+=IO(r);e<n.length;){let i=Fd(n,e);if(r==jO||i==jO||t&&V5(i))e+=IO(i),r=i;else if(DO(i)){let s=0,o=e-2;for(;o>=0&&DO(Fd(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function q5(n,e,t){for(;e>1;){let r=Nx(n,e-2,t);if(r<e)return r;e--}return 0}function Fd(n,e){let t=n.charCodeAt(e);if(!jx(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return Dx(r)?(t-55296<<10)+(r-56320)+65536:t}function Dx(n){return n>=56320&&n<57344}function jx(n){return n>=55296&&n<56320}function IO(n){return n<65536?1:2}let ye=class Ix{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=Vs(this,e,t);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(t,this.length,i,1),pc.from(i,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vs(this,e,t);let r=[];return this.decompose(e,t,r,0),pc.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Uo(this),s=new Uo(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new Uo(this,e)}iterRange(e,t=this.length){return new Xx(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Lx(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Ix.empty:e.length<=32?new at(e):pc.from(at.split(e,[]))}};class at extends ye{constructor(e,t=U5(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?r:a)>=e)return new G5(i,a,r,o);i=a+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new at(XO(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=mc(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new at(a,o.length+s.length));else{let l=a.length>>1;r.push(new at(a.slice(0,l)),new at(a.slice(l)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof at))return super.replace(e,t,r);[e,t]=Vs(this,e,t);let i=mc(this.text,mc(r.text,XO(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new at(i,s):pc.from(at.split(i,[]),s)}sliceString(e,t=this.length,r=`
45
- `){[e,t]=Vs(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new at(r,i)),r=[],i=-1);return i>-1&&t.push(new at(r,i)),t}}let pc=class ys extends ye{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,i);i=a+1,r=l+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=i&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?r.push(a):a.decompose(e-o,t-o,r,c)}o=l+1}}replace(e,t,r){if([e,t]=Vs(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[i]=l,new ys(d,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
46
- `){[e,t]=Vs(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ys))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let m of e)m.flatten(p);return new at(p,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,d=[];function h(p){let m;if(p.lines>s&&p instanceof ys)for(let O of p.children)h(O);else p.lines>o&&(l>o||!l)?(f(),a.push(p)):p instanceof at&&l&&(m=d[d.length-1])instanceof at&&p.lines+m.lines<=32?(l+=p.lines,c+=p.length+1,d[d.length-1]=new at(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>i&&f(),l+=p.lines,c+=p.length+1,d.push(p))}function f(){l!=0&&(a.push(d.length==1?d[0]:ys.from(d,c)),c=-1,l=d.length=0)}for(let p of e)h(p);return f(),a.length==1?a[0]:new ys(a,t)}};ye.empty=new at([""],0);function U5(n){let e=-1;for(let t of n)e+=t.length+1;return e}function mc(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],l=i+a.length;l>=t&&(l>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function XO(n,e,t){return mc(n,[""],e,t)}class Uo{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof at?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof at?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
47
- `,this;e--}else if(i instanceof at){let l=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof at?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Xx{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Uo(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Lx{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ye.prototype[Symbol.iterator]=function(){return this.iter()},Uo.prototype[Symbol.iterator]=Xx.prototype[Symbol.iterator]=Lx.prototype[Symbol.iterator]=function(){return this});class G5{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function Vs(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Ot(n,e,t=!0,r=!0){return Y5(n,e,t,r)}function H5(n){return n>=56320&&n<57344}function K5(n){return n>=55296&&n<56320}function Yt(n,e){let t=n.charCodeAt(e);if(!K5(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return H5(r)?(t-55296<<10)+(r-56320)+65536:t}function cm(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function rr(n){return n<65536?1:2}const Of=/\r\n?|\n/;var $t=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})($t||($t={}));class lr{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){bf(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new lr(e)}composeDesc(e){return this.empty?e:e.empty?this:_x(this,e)}mapDesc(e,t=!1){return e.empty?this:yf(this,e,t)}mapPos(e,t=-1,r=$t.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=$t.Simple&&c>=e&&(r==$t.TrackDel&&i<e&&c>e||r==$t.TrackBefore&&i<e||r==$t.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new lr(e)}static create(e){return new lr(e)}}class ht extends lr{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return bf(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return yf(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(ye.empty);r.push(o?e.slice(s,s+o):ye.empty)}s+=o}return new ht(t,r)}compose(e){return this.empty?e:e.empty?this:_x(this,e,!0)}map(e,t=!1){return e.empty?this:yf(this,e,t,!0)}iterChanges(e,t=!1){bf(this,e,t)}get desc(){return lr.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new Qa(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let d=Math.min(s.len,l-a);At(i,d,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;At(t,d,h),h>0&&ni(r,t,s.text),s.forward(d),a+=d}let c=e[o++];for(;a<c;){if(s.done)break e;let d=Math.min(s.len,c-a);At(t,d,-1),At(i,d,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(d),a+=d}}return{changes:new ht(t,r),filtered:lr.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],i=this.sections[t+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let i=[],s=[],o=0,a=null;function l(d=!1){if(!d&&!i.length)return;o<t&&At(i,t-o,-1);let h=new ht(i,s);a=a?a.compose(h.map(a)):h,i=[],s=[],o=0}function c(d){if(Array.isArray(d))for(let h of d)c(h);else if(d instanceof ht){if(d.length!=t)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${t})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:f=h,insert:p}=d;if(h>f||h<0||f>t)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${t})`);let m=p?typeof p=="string"?ye.of(p.split(r||Of)):p:ye.empty,O=m.length;if(h==f&&O==0)return;h<o&&l(),h>o&&At(i,h-o,-1),At(i,f-h,O),ni(s,i,m),o=f}}return c(e),l(!a),a}static empty(e){return new ht(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<i;)r.push(ye.empty);r[i]=ye.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new ht(t,r)}static createSet(e,t){return new ht(e,t)}}function At(n,e,t,r=!1){if(e==0&&t<=0)return;let i=n.length-2;i>=0&&t<=0&&t==n[i+1]?n[i]+=e:i>=0&&e==0&&n[i]==0?n[i+1]+=t:r?(n[i]+=e,n[i+1]+=t):n.push(e,t)}function ni(n,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<r;)n.push(ye.empty);n.push(t)}}function bf(n,e,t){let r=n.inserted;for(let i=0,s=0,o=0;o<n.sections.length;){let a=n.sections[o++],l=n.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,d=s,h=ye.empty;for(;c+=a,d+=l,l&&r&&(h=h.append(r[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],l=n.sections[o++];e(i,c,s,d,h),i=c,s=d}}}function yf(n,e,t,r=!1){let i=[],s=r?[]:null,o=new Qa(n),a=new Qa(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);At(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(At(i,a.ins,-1);c;){let d=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=d&&(At(i,0,o.ins),s&&ni(s,i,o.text),l=o.i),o.forward(d),c-=d}a.next()}else if(o.ins>=0){let c=0,d=o.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);c+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;At(i,c,l<o.i?o.ins:0),s&&l<o.i&&ni(s,i,o.text),l=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return s?ht.createSet(i,s):lr.create(i);throw new Error("Mismatched change set lengths")}}}function _x(n,e,t=!1){let r=[],i=t?[]:null,s=new Qa(n),o=new Qa(e);for(let a=!1;;){if(s.done&&o.done)return i?ht.createSet(r,i):lr.create(r);if(s.ins==0)At(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)At(r,0,o.ins,a),i&&ni(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;At(r,l,d,a),i&&d&&ni(i,r,o.text)}else o.ins==-1?(At(r,s.off?0:s.len,l,a),i&&ni(i,r,s.textBit(l))):(At(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&ni(i,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}class Qa{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ye.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?ye.empty:t[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let So=class xf{constructor(e,t,r,i){this.from=e,this.to=t,this.flags=r,this.goalColumn=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new xf(r,i,this.flags,this.goalColumn)}extend(e,t=e,r=0){if(e<=this.anchor&&t>=this.anchor)return A.range(e,t,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return A.range(this.anchor,i,void 0,void 0,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return A.range(e.anchor,e.head)}static create(e,t,r,i){return new xf(e,t,r,i)}};class A{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:A.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new A([this.main],0)}addRange(e,t=!0){return A.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,A.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new A(e.ranges.map(t=>So.fromJSON(t)),e.main)}static single(e,t=e){return new A([A.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return A.normalized(e.slice(),t);r=s.to}return new A(e,t)}static cursor(e,t=0,r,i){return So.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r)),i)}static range(e,t,r,i,s){let o=i==null?7:Math.min(6,i);return!s&&e!=t&&(s=t<e?1:-1),s&&(o|=s<0?8:16),t<e?So.create(t,e,o|32,r):So.create(e,t,o,r)}static undirectionalRange(e,t){return So.create(e,t,64,void 0)}static normalized(e,t=0){let r=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?A.range(l,a):A.range(a,l))}}return new A(e,t)}}function Bx(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let um=0;class W{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=um++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new W(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:dm),!!e.static,e.enables)}of(e){return new gc([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new gc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new gc(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function dm(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class gc{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=um++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,d=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:(((t=e[h.id])!==null&&t!==void 0?t:1)&1)==0&&d.push(e[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Sf(h,d)){let p=r(h);if(a?!LO(p,h.values[o],i):!i(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,f)=>{let p,m=f.config.address[s];if(m!=null){let O=_c(f,m);if(this.dependencies.every(b=>b instanceof W?f.facet(b)===h.facet(b):b instanceof Tt?f.field(b,!1)==h.field(b,!1):!0)||(a?LO(p=r(h),O,i):i(p=r(h),O)))return h.values[o]=O,0}else p=r(h);return h.values[o]=p,1}}}}function LO(n,e,t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!t(n[r],e[r]))return!1;return!0}function Sf(n,e){let t=!1;for(let r of e)Go(n,r)&1&&(t=!0);return t}function J5(n,e,t){let r=t.map(l=>n[l.id]),i=t.map(l=>l.type),s=r.filter(l=>!(l&1)),o=n[e.id]>>1;function a(l){let c=[];for(let d=0;d<r.length;d++){let h=_c(l,r[d]);if(i[d]==2)for(let f of h)c.push(f);else c.push(h)}return e.combine(c)}return{create(l){for(let c of r)Go(l,c);return l.values[o]=a(l),1},update(l,c){if(!Sf(l,s))return 0;let d=a(l);return e.compare(d,l.values[o])?0:(l.values[o]=d,1)},reconfigure(l,c){let d=Sf(l,r),h=c.config.facets[e.id],f=c.facet(e);if(h&&!d&&dm(t,h))return l.values[o]=f,0;let p=a(l);return e.compare(p,f)?(l.values[o]=f,0):(l.values[o]=p,1)}}}const $l=W.define({static:!0});class Tt{constructor(e,t,r,i,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new Tt(um++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet($l).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,i)=>{let s=r.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,i)=>{let s=r.facet($l),o=i.facet($l),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[t]=a.create(r),1):i.config.address[this.id]!=null?(r.values[t]=i.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,$l.of({field:this,create:e})]}get extension(){return this}}const Mi={lowest:4,low:3,default:2,high:1,highest:0};function ko(n){return e=>new Wx(e,n)}const ki={highest:ko(Mi.highest),high:ko(Mi.high),default:ko(Mi.default),low:ko(Mi.low),lowest:ko(Mi.lowest)};class Wx{constructor(e,t){this.inner=e,this.prec=t}}class nd{of(e){return new kf(this,e)}reconfigure(e){return nd.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class kf{constructor(e,t){this.compartment=e,this.inner=t}}let _O=class zx{constructor(e,t,r,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let i=[],s=Object.create(null),o=new Map;for(let f of eM(e,t,o))f instanceof Tt?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of i)a[f.id]=c.length<<1,c.push(p=>f.slot(p));let d=r?.config.facets;for(let f in s){let p=s[f],m=p[0].facet,O=d&&d[f]||[];if(p.every(b=>b.type==0))if(a[m.id]=l.length<<1|1,dm(O,p))l.push(r.facet(m));else{let b=m.combine(p.map(y=>y.value));l.push(r&&m.compare(b,r.facet(m))?r.facet(m):b)}else{for(let b of p)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=c.length<<1,c.push(y=>b.dynamicSlot(y)));a[m.id]=c.length<<1,c.push(b=>J5(b,m,p))}}let h=c.map(f=>f(a));return new zx(e,o,h,a,l,s)}};function eM(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof kf&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof kf){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,a)}else if(o instanceof Wx)s(o.inner,o.prec);else if(o instanceof Tt)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof gc)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,Mi.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(n,Mi.default),r.reduce((o,a)=>o.concat(a))}function Go(n,e){if(e&1)return 2;let t=e>>1,r=n.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;n.status[t]=4;let i=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|i}function _c(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Zx=W.define(),vf=W.define({combine:n=>n.some(e=>e),static:!0}),Fx=W.define({combine:n=>n.length?n[0]:void 0,static:!0}),Vx=W.define(),Yx=W.define(),qx=W.define(),Ux=W.define({combine:n=>n.length?n[0]:!1});class gr{constructor(e,t){this.type=e,this.value=t}static define(){return new tM}}class tM{of(e){return new gr(this,e)}}class nM{constructor(e){this.map=e}of(e){return new oe(this,e)}}class oe{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new oe(this.type,t)}is(e){return this.type==e}static define(e={}){return new nM(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(t);s&&r.push(s)}return r}}oe.reconfigure=oe.define();oe.appendConfig=oe.define();let Wt=class Io{constructor(e,t,r,i,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Bx(r,t.newLength),s.some(a=>a.type==Io.time)||(this.annotations=s.concat(Io.time.of(Date.now())))}static create(e,t,r,i,s,o){return new Io(e,t,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Io.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};Wt.time=gr.define();Wt.userEvent=gr.define();Wt.addToHistory=gr.define();Wt.remote=gr.define();function rM(n,e){let t=[];for(let r=0,i=0;;){let s,o;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],o=n[r++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Gx(n,e,t){var r;let i,s,o;return t?(i=e.changes,s=ht.empty(e.changes.length),o=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:oe.mapEffects(n.effects,i).concat(oe.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function wf(n,e,t){let r=e.selection,i=Ns(e.annotations);return e.userEvent&&(i=i.concat(Wt.userEvent.of(e.userEvent))),{changes:e.changes instanceof ht?e.changes:ht.of(e.changes||[],t,n.facet(Fx)),selection:r&&(r instanceof A?r:A.single(r.anchor,r.head)),effects:Ns(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function Hx(n,e,t){let r=wf(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=Gx(r,wf(n,e[s],o?r.changes.newLength:n.doc.length),o)}let i=Wt.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return sM(t?iM(i):i)}function iM(n){let e=n.startState,t=!0;for(let i of e.facet(Vx)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:rM(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=ht.empty(e.doc.length);else{let o=n.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=Wt.create(e,i,n.selection&&n.selection.map(s),oe.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(Yx);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof Wt?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Wt?n=s[0]:n=Hx(e,Ns(s),!1)}return n}function sM(n){let e=n.startState,t=e.facet(qx),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=Gx(r,wf(e,s,n.changes.newLength),!0))}return r==n?n:Wt.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const oM=[];function Ns(n){return n==null?oM:Array.isArray(n)?n:[n]}var Ue=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Ue||(Ue={}));const aM=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qf;try{Qf=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function lM(n){if(Qf)return Qf.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||aM.test(t)))return!0}return!1}function cM(n){return e=>{if(!/\S/.test(e))return Ue.Space;if(lM(e))return Ue.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Ue.Word;return Ue.Other}}let Ge=class Dn{constructor(e,t,r,i,s,o){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Go(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return Go(this,r),_c(this,r)}update(...e){return Hx(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let a of e.effects)a.is(nd.reconfigure)?(t&&(i=new Map,t.compartments.forEach((l,c)=>i.set(c,l)),t=null),i.set(a.value.compartment,a.value.extension)):a.is(oe.reconfigure)?(t=null,r=a.value):a.is(oe.appendConfig)&&(t=null,r=Ns(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=_O.resolve(r,i,this),s=new Dn(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(vf)?e.newSelection:e.newSelection.asSingle();new Dn(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:A.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Ns(r.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),d=c.map(i);for(let f=0;f<a;f++)s[f]=s[f].map(d);let h=i.mapDesc(c,!0);s.push(l.range.map(h)),i=i.compose(d),o=oe.mapEffects(o,d).concat(oe.mapEffects(Ns(l.effects),h))}return{changes:i,selection:A.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ht?e:ht.of(e,this.doc.length,this.facet(Dn.lineSeparator))}toText(e){return ye.of(e.split(this.facet(Dn.lineSeparator)||Of))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Go(this,t),_c(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Tt&&this.config.address[i.id]!=null&&(t[r]=i.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Dn.create({doc:e.doc,selection:A.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=_O.resolve(e.extensions||[],new Map),r=e.doc instanceof ye?e.doc:ye.of((e.doc||"").split(t.staticFacet(Dn.lineSeparator)||Of)),i=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return Bx(i,r.length),t.staticFacet(vf)||(i=i.asSingle()),new Dn(t,r,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Dn.tabSize)}get lineBreak(){return this.facet(Dn.lineSeparator)||`
48
- `}get readOnly(){return this.facet(Ux)}phrase(e,...t){for(let r of this.facet(Dn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(Zx))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return cM(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Ot(t,o,!1);if(s(t.slice(l,o))!=Ue.Word)break;o=l}for(;a<i;){let l=Ot(t,a);if(s(t.slice(a,l))!=Ue.Word)break;a=l}return o==a?null:A.range(o+r,a+r)}};Ge.allowMultipleSelections=vf;Ge.tabSize=W.define({combine:n=>n.length?n[0]:4});Ge.lineSeparator=Fx;Ge.readOnly=Ux;Ge.phrases=W.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});Ge.languageData=Zx;Ge.changeFilter=Vx;Ge.transactionFilter=Yx;Ge.transactionExtender=qx;nd.reconfigure=oe.define();function Or(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class pi{eq(e){return this==e}range(e,t=e){return $a.create(e,t,this)}}pi.prototype.startSide=pi.prototype.endSide=0;pi.prototype.point=!1;pi.prototype.mapMode=$t.TrackDel;function hm(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}class $a{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new $a(e,t,r)}}function $f(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class fm{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+e,h=this.to[l]+e,f,p;if(d==h){let m=t.mapPos(d,c.startSide,c.mapMode);if(m==null||(f=p=m,c.startSide!=c.endSide&&(p=t.mapPos(d,c.endSide),p<f)))continue}else if(f=t.mapPos(d,c.startSide),p=t.mapPos(h,c.endSide),f>p||f==p&&c.startSide>0&&c.endSide<=0)continue;(p-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,p-f)),r.push(c),i.push(f-o),s.push(p-o))}return{mapped:r.length?new fm(i,s,r,a):null,pos:o}}}class pe{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new pe(e,t,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort($f)),this.isEmpty)return t.length?pe.of(t):this;let a=new Kx(this,null,-1).goto(0),l=0,c=[],d=new Lr;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push($a.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?pe.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),r.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new pe(r,t,s||pe.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Ca.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ca.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=BO(o,a,r),c=new vo(o,l,s),d=new vo(a,l,s);r.iterGaps((h,f,p)=>WO(c,h,d,f,p,i)),r.empty&&r.length==0&&WO(c,0,d,0,0,i)}static eq(e,t,r=0,i){i==null&&(i=999999999);let s=e.filter(d=>!d.isEmpty&&t.indexOf(d)<0),o=t.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=BO(s,o),l=new vo(s,a,0).goto(r),c=new vo(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Cf(l.active,c.active)||l.point&&(!c.point||!hm(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,t,r,i,s=-1){let o=new vo(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),h=o.pointFrom<t?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,l);i.point(a,c,o.point,d,h,o.pointRank),l=Math.min(o.openEnd(c),d.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new Lr;for(let i of e instanceof $a?[e]:t?uM(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return pe.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=pe.empty;i=i.nextLayer)t=new pe(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}pe.empty=new pe([],[],null,-1);function uM(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if($f(e,r)>0)return n.slice().sort($f);e=r}return n}pe.empty.nextLayer=pe.empty;class Lr{finishChunk(e){this.chunks.push(new fm(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new Lr)).add(e,t,r)}addInner(e,t,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(pe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=pe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function BO(n,e,t){let r=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class Kx{constructor(e,t,r,i=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Ca{constructor(e){this.heap=e}static from(e,t=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new Kx(o,t,r,s));return i.length==1?i[0]:new Ca(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)Vd(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)Vd(this.heap,r);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Vd(this.heap,0)}}}function Vd(n,e){for(let t=n[e];;){let r=(e<<1)+1;if(r>=n.length)break;let i=n[r];if(r+1<n.length&&i.compare(n[r+1])>=0&&(i=n[r+1],r++),t.compare(i)<0)break;n[r]=t,n[e]=i,e=r}}class vo{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Ca.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Cl(this.active,e),Cl(this.activeTo,e),Cl(this.activeRank,e),this.minActive=zO(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;Pl(this.active,t,r),Pl(this.activeTo,t,i),Pl(this.activeRank,t,s),e&&Pl(e,t,this.cursor.from),this.minActive=zO(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Cl(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function WO(n,e,t,r,i,s){n.goto(e),t.goto(r);let o=r+i,a=r,l=r-e,c=!!s.boundChange;for(let d=!1;;){let h=n.to+l-t.to,f=h||n.endSide-t.endSide,p=f<0?n.to+l:t.to,m=Math.min(p,o);if(n.point||t.point?(n.point&&t.point&&hm(n.point,t.point)&&Cf(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(a,m,n.point,t.point),d=!1):(d&&s.boundChange(a),m>a&&!Cf(n.active,t.active)&&s.compareRange(a,m,n.active,t.active),c&&m<o&&(h||n.openEnd(p)!=t.openEnd(p))&&(d=!0)),p>o)break;a=p,f<=0&&n.next(),f>=0&&t.next()}}function Cf(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!hm(n[t],e[t]))return!1;return!0}function Cl(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function Pl(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function zO(n,e){let t=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||n[i].endSide-n[t].endSide)<0&&(t=i,r=e[i]);return t}function uo(n,e,t=n.length){let r=0;for(let i=0;i<t&&i<n.length;)n.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=Ot(n,i));return r}function Pf(n,e,t,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==n.length)break;s+=n.charCodeAt(i)==9?t-s%t:1,i=Ot(n,i)}return r===!0?-1:n.length}const Tf="ͼ",ZO=typeof Symbol>"u"?"__"+Tf:Symbol.for(Tf),Mf=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),FO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class mi{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let d=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(O=>o.map(b=>O.replace(/&/,b))).reduce((O,b)=>O.concat(b)),m,l);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,d,f)}else m!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,O=>"-"+O.toLowerCase())+": "+m+";")}(d.length||f)&&l.push((r&&!h&&!c?o.map(r):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
49
- `)}static newName(){let e=FO[ZO]||1;return FO[ZO]=e+1,Tf+e.toString(36)}static mount(e,t,r){let i=e[Mf],s=r&&r.nonce;i?s&&i.setNonce(s):i=new dM(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let VO=new Map;class dM{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=VO.get(r);if(s)return e[Mf]=s;this.sheet=new i.CSSStyleSheet,VO.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Mf]=this}mount(e,t){let r=this.sheet,i=0,s=0,o=!1;for(let a=0;a<e.length;a++){let l=e[a],c=this.modules.indexOf(l);if(c<s&&c>-1&&(this.modules.splice(c,1),o=!0,s--,c=-1),c==-1){if(this.modules.splice(s++,0,l),o=!0,r)for(let d=0;d<l.rules.length;d++)r.insertRule(l.rules[d],i++)}else{for(;s<c;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(o){let l="";for(let c=0;c<this.modules.length;c++)l+=this.modules[c].getRules()+`
50
- `;this.styleTag.textContent=l}let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var _r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Pa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hM=typeof navigator<"u"&&/Mac/.test(navigator.platform),fM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var wt=0;wt<10;wt++)_r[48+wt]=_r[96+wt]=String(wt);for(var wt=1;wt<=24;wt++)_r[wt+111]="F"+wt;for(var wt=65;wt<=90;wt++)_r[wt]=String.fromCharCode(wt+32),Pa[wt]=String.fromCharCode(wt);for(var Yd in _r)Pa.hasOwnProperty(Yd)||(Pa[Yd]=_r[Yd]);function Jx(n){var e=hM&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||fM&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Pa:_r)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Ce(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)eS(n,arguments[e]);return n}function eS(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)eS(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let Bt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Af=typeof document<"u"?document:{documentElement:{style:{}}};const Rf=/Edge\/(\d+)/.exec(Bt.userAgent),tS=/MSIE \d/.test(Bt.userAgent),Ef=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Bt.userAgent),rd=!!(tS||Ef||Rf),YO=!rd&&/gecko\/(\d+)/i.test(Bt.userAgent),qd=!rd&&/Chrome\/(\d+)/.exec(Bt.userAgent),qO="webkitFontSmoothing"in Af.documentElement.style,Nf=!rd&&/Apple Computer/.test(Bt.vendor),UO=Nf&&(/Mobile\/\w+/.test(Bt.userAgent)||Bt.maxTouchPoints>2);var _={mac:UO||/Mac/.test(Bt.platform),windows:/Win/.test(Bt.platform),linux:/Linux|X11/.test(Bt.platform),ie:rd,ie_version:tS?Af.documentMode||6:Ef?+Ef[1]:Rf?+Rf[1]:0,gecko:YO,gecko_version:YO?+(/Firefox\/(\d+)/.exec(Bt.userAgent)||[0,0])[1]:0,chrome:!!qd,chrome_version:qd?+qd[1]:0,ios:UO,android:/Android\b/.test(Bt.userAgent),webkit:qO,webkit_version:qO?+(/\bAppleWebKit\/(\d+)/.exec(Bt.userAgent)||[0,0])[1]:0,safari:Nf,safari_version:Nf?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Bt.userAgent)||[0,0])[1]:0,tabSize:Af.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function pm(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const Bc=Object.create(null);function mm(n,e,t){if(n==e)return!0;n||(n=Bc),e||(e=Bc);let r=Object.keys(n),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function pM(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function GO(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function mM(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}let zn=class{eq(e){return!1}updateDOM(e,t,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}};var Pt=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Pt||(Pt={}));let U=class extends pi{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new tl(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ki(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=nS(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new Ki(e,r,i,t,e.widget||null,!0)}static line(e){return new nl(e)}static set(e,t=!1){return pe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};U.none=pe.empty;class tl extends U{constructor(e){let{start:t,end:r}=nS(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?pm(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Bc}eq(e){return this==e||e instanceof tl&&this.tagName==e.tagName&&mm(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}tl.prototype.point=!1;class nl extends U{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof nl&&this.spec.class==e.spec.class&&mm(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}nl.prototype.mapMode=$t.TrackBefore;nl.prototype.point=!0;class Ki extends U{constructor(e,t,r,i,s,o){super(t,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?$t.TrackBefore:$t.TrackAfter:$t.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ki&&gM(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Ki.prototype.point=!0;function nS(n,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=n;return t==null&&(t=n.inclusive),r==null&&(r=n.inclusive),{start:t??e,end:r??e}}function gM(n,e){return n==e||!!(n&&e&&n.compare(e))}function Ds(n,e,t,r=0){let i=t.length-1;i>=0&&t[i]+r>=n?t[i]=Math.max(t[i],e):t.push(n,e)}class Ta extends pi{constructor(e,t,r){super(),this.tagName=e,this.attributes=t,this.rank=r}eq(e){return e==this||e instanceof Ta&&this.tagName==e.tagName&&mm(this.attributes,e.attributes)}static create(e){return new Ta(e.tagName,e.attributes||Bc,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return pe.of(e,t)}}Ta.prototype.startSide=Ta.prototype.endSide=-1;function Ma(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Df(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Ho(n,e){if(!e.anchorNode)return!1;try{return Df(n,e.anchorNode)}catch{return!1}}function Ko(n){return n.nodeType==3?Ra(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Jo(n,e,t,r){return t?HO(n,e,t,r,-1)||HO(n,e,t,r,1):!1}function gi(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function Wc(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function HO(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Br(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=gi(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=i<0?Br(n):0}else return!1}}function Br(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Aa(n,e){let{left:t,right:r}=n;if(t==r)return n;let i=e?t:r;return{left:i,right:i,top:n.top,bottom:n.bottom}}function OM(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function rS(n,e){let t=e.width/n.offsetWidth,r=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-n.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function bM(n,e,t,r,i,s,o,a){let l=n.ownerDocument,c=l.defaultView||window;for(let d=n,h=!1;d&&!h;)if(d.nodeType==1){let f,p=d==l.body,m=1,O=1;if(p)f=OM(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(h=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let S=d.getBoundingClientRect();({scaleX:m,scaleY:O}=rS(d,S)),f={left:S.left,right:S.left+d.clientWidth*m,top:S.top,bottom:S.top+d.clientHeight*O}}let b=0,y=0;if(i=="nearest")e.top<f.top+o?(y=e.top-(f.top+o),t>0&&e.bottom>f.bottom+y&&(y=e.bottom-f.bottom+o)):e.bottom>f.bottom-o&&(y=e.bottom-f.bottom+o,t<0&&e.top-y<f.top&&(y=e.top-(f.top+o)));else{let S=e.bottom-e.top,x=f.bottom-f.top;y=(i=="center"&&S<=x?e.top+S/2-x/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-x+o)-f.top}if(r=="nearest"?e.left<f.left+s?(b=e.left-(f.left+s),t>0&&e.right>f.right+b&&(b=e.right-f.right+s)):e.right>f.right-s&&(b=e.right-f.right+s,t<0&&e.left<f.left+b&&(b=e.left-(f.left+s))):b=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-s:e.right-(f.right-f.left)+s)-f.left,b||y)if(p)c.scrollBy(b,y);else{let S=0,x=0;if(y){let k=d.scrollTop;d.scrollTop+=y/O,x=(d.scrollTop-k)*O}if(b){let k=d.scrollLeft;d.scrollLeft+=b/m,S=(d.scrollLeft-k)*m}e={left:e.left-S,top:e.top-x,right:e.right-S,bottom:e.bottom-x},S&&Math.abs(S-b)<1&&(r="nearest"),x&&Math.abs(x-y)<1&&(i="nearest")}if(p)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function iS(n,e=!0){let t=n.ownerDocument,r=null,i=null;for(let s=n.parentNode;s&&!(s==t.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class yM{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?Br(t):0),r,Math.min(e.focusOffset,r?Br(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}function sS(n){let e=[];for(let t=n;t;t=t.nodeType==11?t.host:t.parentNode)t.nodeType==1&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function oS(n,e=!0){for(let{node:t,left:r,top:i}of n)e&&t.scrollTop!=i&&(t.scrollTop=i),t.scrollLeft!=r&&(t.scrollLeft=r)}let Ti=null;_.safari&&_.safari_version>=26&&(Ti=!1);function aS(n){if(n.setActive)return n.setActive();if(Ti)return n.focus(Ti);let e=sS(n);n.focus(Ti==null?{get preventScroll(){return Ti={preventScroll:!0},!0}}:void 0),Ti||(Ti=!1,oS(e))}let KO;function Ra(n,e,t=e){let r=KO||(KO=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function js(n,e,t,r){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function xM(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function SM(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,Br(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=Br(t))}else{if(t==n)return!0;r=gi(t),t=t.parentNode}}function lS(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function cS(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=Br(t)}else if(t.parentNode&&!Wc(t))r=gi(t),t=t.parentNode;else return null}}function uS(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!Wc(t))r=gi(t)+1,t=t.parentNode;else return null}}class Xn{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new Xn(e.parentNode,gi(e),t)}static after(e,t){return new Xn(e.parentNode,gi(e)+1,t)}}var Re=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(Re||(Re={}));const Ji=Re.LTR,gm=Re.RTL;function dS(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const kM=dS("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),vM=dS("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),jf=Object.create(null),Hn=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);jf[e]=t,jf[t]=-e}function hS(n){return n<=247?kM[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?vM[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const wM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class or{get dir(){return this.level%2?gm:Ji}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function fS(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],i=e[t];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!fS(r.inner,i.inner))return!1}return!0}const Me=[];function QM(n,e,t,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,l=s?256:i;for(let c=o,d=l,h=l;c<a;c++){let f=hS(n.charCodeAt(c));f==512?f=d:f==8&&h==4&&(f=16),Me[c]=f==4?2:f,f&7&&(h=f),d=f}for(let c=o,d=l,h=l;c<a;c++){let f=Me[c];if(f==128)c<a-1&&d==Me[c+1]&&d&24?f=Me[c]=d:Me[c]=256;else if(f==64){let p=c+1;for(;p<a&&Me[p]==64;)p++;let m=c&&d==8||p<t&&Me[p]==8?h==1?1:8:256;for(let O=c;O<p;O++)Me[O]=m;c=p-1}else f==8&&h==1&&(Me[c]=1);d=f,f&7&&(h=f)}}}function $M(n,e,t,r,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,d=o<r.length?r[o].from:t;for(let h=c,f,p,m;h<d;h++)if(p=jf[f=n.charCodeAt(h)])if(p<0){for(let O=a-3;O>=0;O-=3)if(Hn[O+1]==-p){let b=Hn[O+2],y=b&2?i:b&4?b&1?s:i:0;y&&(Me[h]=Me[Hn[O]]=y),a=O;break}}else{if(Hn.length==189)break;Hn[a++]=h,Hn[a++]=f,Hn[a++]=l}else if((m=Me[h])==2||m==1){let O=m==i;l=O?0:1;for(let b=a-3;b>=0;b-=3){let y=Hn[b+2];if(y&2)break;if(O)Hn[b+2]|=2;else{if(y&4)break;Hn[b+2]|=4}}}}}function CM(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let o=i?t[i-1].to:n,a=i<t.length?t[i].from:e;for(let l=o;l<a;){let c=Me[l];if(c==256){let d=l+1;for(;;)if(d==a){if(i==t.length)break;d=t[i++].to,a=i<t.length?t[i].from:e}else if(Me[d]==256)d++;else break;let h=s==1,f=(d<e?Me[d]:r)==1,p=h==f?h?1:2:r;for(let m=d,O=i,b=O?t[O-1].to:n;m>l;)m==b&&(m=t[--O].from,b=O?t[O-1].to:n),Me[--m]=p;l=d}else s=c,l++}}}function If(n,e,t,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<t;){let d=!0,h=!1;if(c==s.length||l<s[c].from){let O=Me[l];O!=a&&(d=!1,h=O==16)}let f=!d&&a==1?[]:null,p=d?r:r+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(h)break e;let O=s[c];if(!d)for(let b=O.to,y=c+1;;){if(b==t)break e;if(y<s.length&&s[y].from==b)b=s[y++].to;else{if(Me[b]==a)break e;break}}if(c++,f)f.push(O);else{O.from>l&&o.push(new or(l,O.from,p));let b=O.direction==Ji!=!(p%2);Xf(n,b?r+1:r,i,O.inner,O.from,O.to,o),l=O.to}m=O.to}else{if(m==t||(d?Me[m]!=a:Me[m]==a))break;m++}f?If(n,l,m,r+1,i,f,o):l<m&&o.push(new or(l,m,p)),l=m}else for(let l=t,c=s.length;l>e;){let d=!0,h=!1;if(!c||l>s[c-1].to){let O=Me[l-1];O!=a&&(d=!1,h=O==16)}let f=!d&&a==1?[]:null,p=d?r:r+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(h)break e;let O=s[--c];if(!d)for(let b=O.from,y=c;;){if(b==e)break e;if(y&&s[y-1].to==b)b=s[--y].from;else{if(Me[b-1]==a)break e;break}}if(f)f.push(O);else{O.to<l&&o.push(new or(O.to,l,p));let b=O.direction==Ji!=!(p%2);Xf(n,b?r+1:r,i,O.inner,O.from,O.to,o),l=O.from}m=O.from}else{if(m==e||(d?Me[m-1]!=a:Me[m-1]==a))break;m--}f?If(n,m,l,r+1,i,f,o):m<l&&o.push(new or(m,l,p)),l=m}}function Xf(n,e,t,r,i,s,o){let a=e%2?2:1;QM(n,i,s,r,a),$M(n,i,s,r,a),CM(i,s,r,a),If(n,i,s,e,t,r,o)}function PM(n,e,t){if(!n)return[new or(0,0,e==gm?1:0)];if(e==Ji&&!t.length&&!wM.test(n))return pS(n.length);if(t.length)for(;n.length>Me.length;)Me[Me.length]=256;let r=[],i=e==Ji?0:1;return Xf(n,i,i,t,0,n.length,r),r}function pS(n){return[new or(0,n,0)]}let mS="";function TM(n,e,t,r,i){var s;if(!n.length)return null;let o=r.head-n.from,a;if(r.head==n.from&&r.assoc<0){if(!i)return null;o=e[a=0].side(!1,t)}else if(r.head==n.to&&r.assoc>0){if(i)return null;o=e[a=e.length-1].side(!0,t)}else a=or.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc);let l=e[a],c=l.side(i,t);if(o==c){let f=a+=i?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!i,t),c=l.side(i,t)}let d=Ot(n.text,o,l.forward(i,t));(d<l.from||d>l.to)&&(d=c),mS=n.text.slice(Math.min(o,d),Math.max(o,d));let h=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];if(d==c){if(!h)return i?A.cursor(n.to,1):A.cursor(n.from,-1);if(h.level+(i?0:1)<l.level)return A.cursor(h.side(!i,t)+n.from,h.forward(i,t)?1:-1,h.level)}return A.cursor(d+n.from,l.forward(i,t)?-1:1,l.level)}function MM(n,e,t){for(let r=e;r<t;r++){let i=hS(n.charCodeAt(r));if(i==1)return Ji;if(i==2||i==4)return gm}return Ji}const gS=W.define(),OS=W.define(),bS=W.define(),yS=W.define(),Lf=W.define(),xS=W.define(),SS=W.define(),Om=W.define(),bm=W.define(),kS=W.define({combine:n=>n.some(e=>e)}),vS=W.define({combine:n=>n.some(e=>e)}),wS=W.define();class Is{constructor(e,t,r,i,s,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Is(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Is(A.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Tl=oe.define({map:(n,e)=>n.map(e)}),QS=oe.define();function Ht(n,e,t){let r=n.facet(yS);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Tr=W.define({combine:n=>n.length?n[0]:!0});let AM=0;const Ps=W.define({combine(n){return n.filter((e,t)=>{for(let r=0;r<t;r++)if(n[r].plugin==e.plugin)return!1;return!0})}});class it{constructor(e,t,r,i,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Ps.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Ps.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=t||{};return new it(AM++,e,r,i,a=>{let l=[];return o&&l.push(id.of(c=>{let d=c.plugin(a);return d?o(d):U.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return it.define((r,i)=>new e(r,i),t)}}class Ud{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(Ht(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Ht(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){Ht(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const $S=W.define(),ym=W.define(),id=W.define(),CS=W.define(),xm=W.define(),rl=W.define(),PS=W.define();function JO(n,e){let t=n.state.facet(PS);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return pe.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,d=o-e.from,h=i;for(let f=a.length-1;f>=0;f--,l--){let p=a[f].spec.bidiIsolate,m;if(p==null&&(p=MM(e.text,c,d)),l>0&&h.length&&(m=h[h.length-1]).to==c&&m.direction==p)m.to=d,h=m.inner;else{let O={from:c,to:d,direction:p,inner:[]};h.push(O),h=O.inner}}}}),i}const TS=W.define();function Sm(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(TS)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:r,bottom:i}}const Xo=W.define();class $n{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new $n(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,l=s<t.length?t[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let d=c+o,h=c,f=d;for(;;)if(s<t.length&&t[s]<=h){let p=t[s+1];s+=2,h=Math.max(h,p);for(let m=i;m<e.length&&e[m].fromB<=h;m++)o=e[m].toA-e[m].toB;f=Math.max(f,p+o)}else if(i<e.length&&e[i].fromB<=h){let p=e[i++];h=Math.max(h,p.toB),f=Math.max(f,p.toA),o=p.toA-p.toB}else break;r.push(new $n(d,f,c,h))}return r}}class zc{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=ht.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new $n(s,o,a,l))),this.changedRanges=i}static create(e,t,r){return new zc(e,t,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const RM=[];class rt{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return RM}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&pM(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let r=t;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,r){return null}domPosFor(e,t){let r=gi(this.dom),i=this.length?e>0:t>0;return new Xn(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof od)return e;return null}static get(e){return e.cmTile}}class sd extends rt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,r=null,i,s=e?.node==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:t.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==t)for(;i&&i!=a.dom;)i=e0(i);else t.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:t.firstChild,s&&i&&(s.written=!0);i;)i=e0(i);this.length=o}}function e0(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class od extends sd{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=rt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!t.length)return;r=r.parent,r.breakAfter&&s++,i=t.pop()}else{let o=r.children[i++];if(o instanceof jr)t.push(i),r=o,i=0;else{let a=s+o.length,l=e(o,s);if(l!==void 0)return l;s=a+o.breakAfter}}}resolveBlock(e,t){let r,i=-1,s,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(t<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-l),(c>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-l)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&t<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class jr extends sd{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let r=new jr(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class Ys extends sd{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let i=new Ys(t||document.createElement("div"),e);return(!t||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,r){let i=null,s=-1,o=null,a=-1;function l(d,h){for(let f=0,p=0;f<d.children.length&&p<=h;f++){let m=d.children[f],O=p+m.length;O>=h&&(m.isComposite()?l(m,h-p):(!o||o.isHidden&&(t>0&&!(o.flags&32)||r&&NM(o,m)))&&(O>h||m.flags&32&&t<=1)?(o=m,a=h-p):(p<h||m.flags&16&&!m.isHidden&&t>=-1)&&(i=m,s=h-p)),p=O}}l(this,e);let c=(t<0?i:o)||i||o;return c?{tile:c,offset:c==i?s:a}:null}coordsIn(e,t,r){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t,r):EM(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Xn(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:t);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Xn(l.dom,0);l==r.tile&&(a=!0)}}return new Xn(this.dom,0)}}function EM(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Ko(e);return t[t.length-1]||null}function NM(n,e){let t=n.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}class Gt extends sd{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new Gt(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class Ei extends rt{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,r){let i=this.dom.nodeValue.length;e>i&&(e=i);let s=e,o=e,a=0;e==0&&t<0||e==i&&t>=0?_.chrome||_.gecko||(e?(s--,a=1):o<i&&(o++,a=-1)):t<0?s--:o<i&&o++;let l=Ra(this.dom,s,o).getClientRects();if(!l.length)return null;let c=l[(a?a<0:t>=0)?0:l.length-1];return _.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(l,d=>d.width)||c),r==null?c:Aa(c,(a?a>0:t<0)==r)}static of(e,t){let r=new Ei(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class es extends rt{constructor(e,t,r,i){super(e,t,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,r){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(r)return Aa(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?s.length-1:0;o=s[l],!(e>0?l==0:l==s.length-1||o.top<o.bottom);l+=a?-1:1);return Aa(o,!a)}}get overrideDOMText(){if(!this.length)return ye.empty;let{root:e}=this;if(!e)return ye.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,r,i,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new es(s,r,e,i)}}class Zc extends rt{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ye.empty}coordsIn(e,t,r){let i=this.dom.getBoundingClientRect();return r==null?i:Aa(i,t>0==r)}}class DM{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!a.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++}else{let l=i.children[s],c=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,s++,e-=l.length):(a.push({tile:i,index:s}),i=l,s=0,r&&l.isComposite()&&r.enter(l))}else{let l=i.length;if(s<l&&e){let c=Math.min(e,l-s);r&&r.skip(i,s,s+c),e-=c,s+=c}if(s==l)o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++;else if(!e)break}return this.tile=i,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class jM{constructor(e,t,r,i){this.from=e,this.to=t,this.wrapper=r,this.rank=i}}class IM{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,i){var s;this.flushBuffer();let o=this.ensureMarks(t,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Ei(a.dom,a.text+e);l.parent=o}else o.append(i||Ei.of(e,(s=this.cache.find(Ei))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?Gd(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=r;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],c=i.lastChild;if(c instanceof Gt&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(Gd(l.dom)),i=c;else{let{dom:d}=l;this.cache.reused.get(l)&&rt.get(l.dom)&&(d=Gd(l.dom));let h=Gt.of(l.mark,d);i.append(h),i=h}this.cache.reused.set(l,2)}let s=rt.get(e.text);s&&this.cache.reused.set(s,2);let o=new Ei(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,t,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(t,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var r;e||(e=MS);let i=Ys.start(e,t||((r=this.cache.find(Ys))===null||r===void 0?void 0:r.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(t>0&&(a=i.lastChild)&&a instanceof Gt&&a.mark.eq(o))i=a,t--;else{let l=Gt.of(o,(r=this.cache.find(Gt,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(l),i=l,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!t0(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(_.ios&&t0(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Hd,0,32)||new es(Hd.toDOM(),0,Hd,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,r=new jM(e.from,e.to,e.value,t),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r of this.wrappers){let i=t.lastChild;if(r.from<this.pos&&i instanceof jr&&i.wrapper.eq(r.wrapper))t=i;else{let s=jr.of(r.wrapper,(e=this.cache.find(jr,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(Zc,void 0,1);return r&&(r.flags=t),r||new Zc(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class XM{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let a=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}const Fc=[es,Ys,Ei,Gt,Zc,jr,od];for(let n=0;n<Fc.length;n++)Fc[n].bucket=n;class LM{constructor(e){this.view=e,this.buckets=Fc.map(()=>[]),this.index=Fc.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let a=0;a<s.length;a++){let l=(a+o)%s.length,c=s[l];if((!t||t(c))&&!this.reused.has(c))return s.splice(l,1),l<o&&this.index[i]--,this.reused.set(c,r),c}return null}findWidget(e,t,r){let i=this.buckets[0];if(i.length)for(let s=0,o=0;;s++){if(s==i.length){if(o)return null;o=1,s=0}let a=i[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new es(a.dom,t,e,a.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class _M{constructor(e,t,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new LM(e),this.text=new XM(e.state.doc),this.builder=new IM(this.cache,new od(e,e.contentDOM),pe.iter(r)),this.cache.reused.set(t,2),this.old=new DM(t),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let r=t&&this.getCompositionContext(t.text);for(let i=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>i){let c=l-i;this.preserve(c,!o,!a),i=l,s+=c}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(s,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(s,a.toB)),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let i=zM(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?es.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,i,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),i,s)),s=i.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Zc)this.cache.add(o);else if(o instanceof Gt)this.builder.ensureLine(null),this.builder.addMark(o,i,s),this.cache.reused.set(o,1),s=i.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Gt&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof Gt&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,i=this.builder,s=-1,o=pe.spans(this.decorations,e,t,{point:(a,l,c,d,h,f)=>{if(c instanceof Ki){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,h>d.length)i.continueWidget(l-a);else{let p=c.widget||(c.block?qs.block:qs.inline),m=BM(c),O=this.cache.findWidget(p,l-a,m)||es.of(p,this.view,l-a,m);c.block?(c.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(O)):(i.ensureLine(r),i.addInlineWidget(O,d,h))}r=null}else r=WM(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,d)=>{for(let h=a;h<l;){let f=this.text.next(Math.min(512,l-h));f==null?(i.addLineStartIfNotCovered(r),i.addBreak(),h++):(i.ensureLine(r),i.addText(f,c,h==a?d:c.length),h+=f.length),r=null}s=c.length}});s>-1&&(this.openWidget=o>s),this.openWidget||i.addLineStartIfNotCovered(r),this.openMarks=o}forward(e,t,r=1){t-e<=10?this.old.advance(t-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=rt.get(i);if(i==this.view.contentDOM)break;s instanceof Gt?t.push(s):s?.isLine()?r=s:s instanceof jr||(i.nodeName=="DIV"&&!r?r=new Ys(i,MS):r||t.push(Gt.of(new tl({tagName:i.nodeName.toLowerCase(),attributes:mM(i)}),i)))}return r?{line:r,marks:t}:null}}function t0(n,e){let t=r=>{for(let i of r.children)if((e?i.isText():i.length)||t(i))return!0;return!1};return t(n)}function BM(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const MS={class:"cm-line"};function WM(n,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(n||(n={class:"cm-line"}),t&&pm(t,n),r&&(n.class+=" "+r)),n}function zM(n){let e=[];for(let t=n.parents.length;t>1;t--){let r=t==n.parents.length?n.tile:n.parents[t].tile;r instanceof Gt&&e.push(r.mark)}return e}function Gd(n){let e=rt.get(n);return e&&e.setDOM(n.cloneNode()),n}class qs extends zn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}qs.inline=new qs("span");qs.block=new qs("div");const Hd=new class extends zn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class n0{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=U.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new od(e,e.contentDOM),this.updateInner([new $n(0,0,0,e.state.doc.length)],null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!KM(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?FM(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;r=new $n(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(_.ie||_.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=qM(o,this.decorations,e.changes);l.length&&(r=$n.extendWithRanges(r,l));let c=GM(a,this.blockWrappers,e.changes);return c.length&&(r=$n.extendWithRanges(r,c)),s&&!r.some(d=>d.fromA<=s.range.fromA&&d.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let o=this.tile,a=new _M(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&rt.get(t.text)&&a.cache.reused.set(rt.get(t.text),2),this.tile=a.run(e,t),_f(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=_.chrome||_.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof Kd&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(QS)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,o=!s&&!(this.view.state.facet(Tr)||r.tabIndex>-1)&&Ho(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,d;if(l.empty?d=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(d=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),_.gecko&&l.empty&&!this.hasComposition&&ZM(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Xn(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!Jo(c.node,c.offset,h.anchorNode,h.anchorOffset)||!Jo(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{_.android&&_.chrome&&r.contains(h.focusNode)&&HM(h.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=Ma(this.view.root);if(f)if(l.empty){if(_.gecko){let p=VM(c.node,c.offset);if(p&&p!=3){let m=(p==1?cS:uS)(c.node,c.offset);m&&(c=new Xn(m.node,m.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),p.setEnd(d.node,d.offset),p.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Xn(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Xn(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Jo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=Ma(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let d=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(d.node,d.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&r.collapse(i,s)}posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[t];else{let o=Br(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!rt.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,a=i;;o++){let l=r.children[o];if(l.dom==s)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?i+t:i+(t?r.length:0):i}domAtPos(e,t){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(i,t):r.domIn(i,t)}inlineDOMNearPos(e,t){let r,i=-1,s=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,d)=>{if(c.isWidget()){if(c.flags&32&&d>=e)return!0;c.flags&16&&(s=!0)}else{let h=d+c.length;if(d<=e&&(r=c,i=e-d,s=h<e),h>=e&&!o&&(o=c,a=e-d,l=d>e),d>e&&o)return!0}}),!r&&!o?this.domAtPos(e,t):(s&&o?r=null:l&&r&&(o=null),r&&t<0||!o?r.domIn(i,t):o.domIn(a,t))}coordsAt(e,t,r){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof Kd?null:i.coordsInWidget(s,t,!0):i.coordsIn(s,t,r)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let l=i(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=Ot(s.text,o);if(a==o)return null;let l=Ra(s.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(c==l.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return i(t,r)}measureVisibleLineHeights(e){let t=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Re.LTR,c=0,d=(h,f,p)=>{for(let m=0;m<h.children.length&&!(f>i);m++){let O=h.children[m],b=f+O.length,y=O.dom.getBoundingClientRect(),{height:S}=y;if(p&&!m&&(c+=y.top-p.top),O instanceof jr)b>r&&d(O,f,y);else if(f>=r&&(c>0&&t.push(-c),t.push(S+c),c=0,o)){let x=O.dom.lastChild,k=x?Ko(x):[];if(k.length){let v=k[k.length-1],w=l?v.right-y.left:y.right-v.left;w>a&&(a=w,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=b)}}p&&m==h.children.length-1&&(c+=p.bottom-y.bottom),f=b+O.breakAfter}};return d(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Re.RTL:Re.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let d=Ko(c.dom);if(d.length!=1)return;a+=d[0].width,l=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),r,i,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Ko(t.firstChild)[0];r=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,t.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(U.replace({widget:new Kd(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return U.set(e)}updateDeco(){let e=1,t=this.view.state.facet(id).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(xm).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(pe.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(CS).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(wS))try{if(c(this.view,e.range,e))return!0}catch(d){Ht(this.view.state,d,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),i;if(!r)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=Sm(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(bM(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Re.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.visualViewport.offsetTop)){let c=this.view.docView.lineAt(t.head,1);if(c){let d=sS(c.dom);c.dom.scrollIntoView({block:"nearest"}),oS(d,!1)}}}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){_f(this.tile)}}function _f(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let r of n.children)_f(r,e)}}function ZM(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function AS(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=cS(t.focusNode,t.focusOffset),i=uS(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=rt.get(i.node);if(!a||a.isText()&&a.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let l=rt.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(n.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function FM(n,e,t){let r=AS(n,t);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||n.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new $n(l.mapPos(s),l.mapPos(o),s,o),text:i}}function VM(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let YM=class{constructor(){this.changes=[]}compareRange(e,t){Ds(e,t,this.changes)}comparePoint(e,t){Ds(e,t,this.changes)}boundChange(e){Ds(e,e,this.changes)}};function qM(n,e,t){let r=new YM;return pe.compare(n,e,t,r),r.changes}class UM{constructor(){this.changes=[]}compareRange(e,t){Ds(e,t,this.changes)}comparePoint(){}boundChange(e){Ds(e,e,this.changes)}}function GM(n,e,t){let r=new UM;return pe.compare(n,e,t,r),r.changes}function HM(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function KM(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}class Kd extends zn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function JM(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return A.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=Ot(i.text,s,!1):a=Ot(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let c=Ot(i.text,o,!1);if(r(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Ot(i.text,a);if(r(i.text.slice(a,c))!=l)break;a=c}return A.undirectionalRange(o+i.from,a+i.from)}function e3(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,l=Math.floor((i-t.top-(n.defaultLineHeight-a)*.5)/a);s+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Pf(o,s,n.state.tabSize)}function Bf(n,e,t){let r=n.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==Pt.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function t3(n,e,t,r){let i=Bf(n,e.head,e.assoc||-1),s=!r||i.type!=Pt.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(i.from),l=n.posAtCoords({x:t==(a==Re.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return A.cursor(l,t?-1:1)}return A.cursor(t?i.to:i.from,t?-1:1)}function r0(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),o=n.textDirectionAt(i.from);for(let a=e,l=null;;){let c=TM(i,s,o,a,t),d=mS;if(!c){if(i.number==(t?n.state.doc.lines:1))return a;d=`
51
- `,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),c=t?A.cursor(i.from,-1):A.cursor(i.to,1)}if(l){if(!l(d))return a}else{if(!r)return c;l=r(d)}a=c}}function n3(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==Ue.Space&&(i=o),i==o}}function r3(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return A.cursor(i,e.assoc);let o=e.goalColumn,a,l=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=n.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let m=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,n.defaultCharacterWidth*(i-m.from))),a=(s<0?m.top:m.bottom)+d}let h=l.left+o,f=n.viewState.heightOracle.textHeight>>1,p=r??f;for(let m=0;;m+=f){let O=a+(p+m)*s,b=Wf(n,{x:h,y:O},!1,s);if(t?O>l.bottom:O<l.top)return A.cursor(b.pos,b.assoc);let y=n.coordsAtPos(b.pos,b.assoc),S=y?(y.top+y.bottom)/2:0;if(!y||(t?S>a:S<a))return A.cursor(b.pos,b.assoc,void 0,o)}}function ea(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function RS(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=ea(n,i.from,0);o!=i.from&&(s=A.cursor(o,-1))}else{let o=ea(n,i.from,-1),a=ea(n,i.to,1);(o!=i.from||a!=i.to)&&(i.undirectional?s=A.undirectionalRange(i.from,i.to):s=A.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?A.create(t,e.mainIndex):e}function Jd(n,e,t){let r=ea(n.state.facet(rl).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:A.cursor(r,r<t.from?1:-1)}class ir{constructor(e,t){this.pos=e,this.assoc=t}}function Wf(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new ir(0,1);if(l>n.viewState.docHeight)return new ir(n.state.doc.length,-1);if(c=n.elementAtHeight(l),r==null)break;if(c.type==Pt.Text){if(r<0?c.to<n.viewport.from:c.from>n.viewport.to)break;let f=n.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(f&&(r<0?f.top<=l+s:f.bottom>=l+s))break}let h=n.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+h:c.top-h}if(n.viewport.from>=c.to||n.viewport.to<=c.from){if(t)return null;if(c.type==Pt.Text){let h=e3(n,i,c,o,a);return new ir(h,h==c.from?1:-1)}}if(c.type!=Pt.Text)return l<(c.top+c.bottom)/2?new ir(c.from,1):new ir(c.to,-1);let d=n.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=n.docView.lineAt(c.from,-2)),new i3(n,o,a,n.textDirectionAt(c.from)).scanTile(d,c.from)}class i3{constructor(e,t,r,i){this.view=e,this.x=t,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[or.find(i,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:i}=this.bidiSpansAt(e);return i[or.find(i,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<t)}scan(e,t,r=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,d=-1,h=1e9,f;e:for(;i<s;){let m=s-i,O=i+s>>1;t:if(o.has(O)){for(let S=1;S<m;S++){let x=O+S;if(x>=s&&(x-=m),!o.has(x)){O=x;break t}}break e}o.add(O);let b=t(O),y=0;if(b)for(let S=0;S<b.length;S++){let x=b[S];if(!(x.width==0&&b.length>1))if(x.bottom<this.y)(!l||l.bottom<x.bottom)&&(l=x),y=1;else if(x.top>this.y)(!c||c.top>x.top)&&(c=x),y=-1;else{let k=x.left>this.x?this.x-x.left:x.right<this.x?this.x-x.right:0,v=Math.abs(k);v<h&&(d=O,h=v,f=x),k&&(y=k<0==(this.baseDir==Re.LTR)?-1:1)}}y==-1&&(!a||this.baseDirAt(e[O],1))?s=O:y==1&&(!a||this.baseDirAt(e[O+1],-1))&&(i=O+1)}if(!f){if(!c&&!l)return{i:0,after:!1};let m=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(m.top+m.bottom)/2,this.scan(e,t,!0)}if(h&&!r){let{top:m,bottom:O}=f;if(l&&l.bottom>(m+m+O)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(c&&c.top<(m+O+O)/3)return this.y=c.top+1,this.scan(e,t,!0)}let p=(a?this.dirAt(e[d],1):this.baseDir)==Re.LTR;return{i:d,after:this.x>(f.left+f.right)/2==p}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=Ot(e.text,s))r.push(t+s);r.push(t+e.length);let i=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return Ra(e.dom,o,a).getClientRects()});return i.after?new ir(r[i.i+1],-1):new ir(r[i.i],1)}scanTile(e,t){if(!e.length)return new ir(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let r=[t];for(let a=0,l=t;a<e.children.length;a++)r.push(l+=e.children[a].length);let i=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ra(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new ir(r[i.i+1],-1):new ir(o,1)}}const xs="￿";class s3{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(Ge.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=xs}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=rt.get(i),a=i.nextSibling;if(a==t){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=rt.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Wc(i))||Wc(a)&&(i.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!a3(a,t)&&this.lineBreak(),i=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){let t=rt.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(o3(e,r.node,r.offset)?t:0))}}function o3(n,e,t){for(;;){if(!e||t<Br(e))return!1;if(e==n)return!0;t=gi(e)+1,e=e.parentNode}}function a3(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let r=rt.get(n);if(!r?.isWidget())return!1;r&&(t||(t=[])).push(r)}if(t)for(let r of t){let i=r.overrideDOMText;if(i?.length)return!1}return!0}class i0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class l3{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=ES(e.docView.tile,t,r,0))){let l=s||o?[]:u3(e),c=new s3(l,e);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=d3(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Df(e.contentDOM,l.focusNode)?a.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),d=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Df(e.contentDOM,l.anchorNode)?a.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=e.viewport;if((_.ios||_.chrome)&&c!=d&&Math.min(c,d)<=a.main.from&&Math.max(c,d)>=a.main.to&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(c,d),p=Math.max(c,d),m=h.from-f,O=h.to-p;(m==0||m==1||f==0)&&(O==0||O==-1||p==e.state.doc.length)&&(c=0,d=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(A.range(d,c));else if(e.lineWrapping&&d==c&&!(a.main.empty&&a.main.head==c)&&e.inputState.lastTouchTime>Date.now()-100){let f=e.coordsAtPos(c,-1),p=0;f&&(p=e.inputState.lastTouchY<=f.bottom?-1:1),this.newSel=A.create([A.cursor(c,p)])}else this.newSel=A.single(d,c)}}}function ES(n,e,t,r){if(n.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,d=r;l<n.children.length;l++){let h=n.children[l],f=c+h.length;if(c<e&&f>t)return ES(h,e,t,c);if(f>=e&&i==-1&&(i=l,s=c),c>t&&h.dom.parentNode==n.dom){o=l,a=d;break}d=f,c=f+h.breakAfter}return{from:s,to:a<0?r+n.length:a,startDOM:(i?n.children[i-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:r,to:r+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function NS(n,e){let t,{newSel:r}=e,{state:i}=n,s=i.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,c=s.from,d=null;(o===8||_.android&&e.text.length<l-a)&&(c=s.to,d="end");let h=i.doc.sliceString(a,l,xs),f,p;!s.empty&&s.from>=a&&s.to<=l&&(e.typeOver||h!=e.text)&&h.slice(0,s.from-a)==e.text.slice(0,s.from-a)&&h.slice(s.to-a)==e.text.slice(f=e.text.length-(h.length-(s.to-a)))?t={from:s.from,to:s.to,insert:ye.of(e.text.slice(s.from-a,f).split(xs))}:(p=DS(h,e.text,c-a,d))&&(_.chrome&&o==13&&p.toB==p.from+2&&e.text.slice(p.from,p.toB)==xs+xs&&p.toB--,t={from:a+p.from,to:a+p.toA,insert:ye.of(e.text.slice(p.from,p.toB).split(xs))})}else r&&(!n.hasFocus&&i.facet(Tr)||Vc(r,s))&&(r=null);if(!t&&!r)return!1;if((_.mac||_.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=A.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:ye.of([t.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&n.docView.lineHasWidget(s.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:s.from,to:s.to,insert:i.toText(n.inputState.insertingText)}:_.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
52
- `&&n.lineWrapping&&(r&&(r=A.single(r.main.anchor-1,r.main.head-1)),t={from:s.from,to:s.to,insert:ye.of([" "])}),t)return km(n,t,r,o);if(r&&!Vc(r,s)){let a=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(a=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=RS(i.facet(rl).map(c=>c(n)),r))),n.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function km(n,e,t,r=-1){if(_.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(_.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&js(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&js(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&js(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=c3(n,e,t));return n.state.facet(xS).some(l=>l(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function c3(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,d=ea(i.facet(rl).map(h=>h(n)),c,l);e.from==d&&(o=d)}if(o>-1)r={changes:e,selection:A.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let l=i.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=n.state.sliceDoc(e.from,e.to),h,f=t&&AS(n,t.main.head);if(f){let m=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-m}}else h=n.state.doc.lineAt(s.head);let p=s.to-e.to;r=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:c||m.map(l)};let O=m.to-p,b=O-d.length;if(n.state.sliceDoc(b,O)!=d||O>=h.from&&b<=h.to)return{range:m};let y=i.changes({from:b,to:O,insert:e.insert}),S=m.to-s.to;return{changes:y,range:c?A.range(Math.max(0,c.anchor+S),Math.max(0,c.head+S)):m.map(y)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function DS(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&n.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function u3(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new i0(t,r)),(i!=t||s!=r)&&e.push(new i0(i,s))),e}function d3(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t<0||r<0?null:t==r?A.create([A.cursor(r+e,-1)]):A.single(t+e,r+e)}function Vc(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}let h3=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,_.safari&&e.contentDOM.addEventListener("input",()=>null),_.gecko&&P3(e.contentDOM.ownerDocument)}handleEvent(e){!S3(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=p3(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&IS.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),_.android&&_.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(_.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(jS.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||m3.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&_.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&f3(this.view.win)&&(t.shiftKey=!1);let r=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==r&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,js(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:_.safari&&!_.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function f3(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function s0(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){Ht(t.state,i)}}}function p3(n){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of n){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&t(a).handlers.push(s0(r.value,l))}if(o)for(let a in o){let l=o[a];l&&t(a).observers.push(s0(r.value,l))}}for(let r in Wn)t(r).handlers.push(Wn[r]);for(let r in Zt)t(r).observers.push(Zt[r]);return e}const jS=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],m3="dthko",IS=[16,17,18,20,91,92,224,225],Ml=6;function Al(n){return Math.max(0,n)*.7+8}function g3(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class O3{constructor(e,t,r,i){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=iS(e.contentDOM),this.atoms=e.state.facet(rl).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Ge.allowMultipleSelections)&&b3(e,t),this.dragging=x3(e,t)&&_S(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&g3(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Sm(this.view);e.clientX-l.left<=i+Ml?t=-Al(i-e.clientX):e.clientX+l.right>=o-Ml&&(t=Al(e.clientX-o)),e.clientY-l.top<=s+Ml?r=-Al(s-e.clientY):e.clientY+l.bottom>=a-Ml&&(r=Al(e.clientY-a)),this.setScrollSpeed(t,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,r=RS(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function b3(n,e){let t=n.state.facet(gS);return t.length?t[0](e):_.mac?e.metaKey:e.ctrlKey}function y3(n,e){let t=n.state.facet(OS);return t.length?t[0](e):_.mac?!e.altKey:!e.ctrlKey}function x3(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=Ma(n.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function S3(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=rt.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Wn=Object.create(null),Zt=Object.create(null),XS=_.ie&&_.ie_version<15||_.ios&&_.webkit_version<604;function k3(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),LS(n,t.value)},50)}function ad(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function LS(n,e){e=ad(n.state,Om,e);let{state:t}=n,r,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(zf!=null&&t.selection.ranges.every(l=>l.empty)&&zf==s.toString()){let l=-1;r=t.changeByRange(c=>{let d=t.doc.lineAt(c.from);if(d.from==l)return{range:c};l=d.from;let h=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:d.from,insert:h},range:A.cursor(c.from+h.length,-1)}})}else o?r=t.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:A.cursor(l.from+c.length,-1)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Zt.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,_.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};Zt.wheel=Zt.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Wn.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Zt.touchstart=(n,e)=>{let t=n.inputState,r=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),r&&(t.lastTouchX=r.clientX,t.lastTouchY=r.clientY),t.setSelectionOrigin("select.pointer")};Zt.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Zt.touchend=(n,e)=>{n.inputState.touchActive=!1};Wn.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of n.state.facet(bS))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=w3(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new O3(n,e,t,r)),r&&n.observer.ignore(()=>{aS(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let i=n.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function o0(n,e,t,r){if(r==1)return A.cursor(e,t);if(r==2)return JM(n.state,e,t);{let i=n.docView.lineAt(e,t),s=n.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<n.state.doc.length&&a==s.to&&a++,A.undirectionalRange(o,a)}}const v3=_.ie&&_.ie_version<=11;let a0=null,l0=0,c0=0;function _S(n){if(!v3)return n.detail;let e=a0,t=c0;return a0=n,c0=Date.now(),l0=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(l0+1)%3:1}function w3(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=_S(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let l=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,d=o0(n,l.pos,l.assoc,r);if(t.pos!=l.pos&&!o){let h=o0(n,t.pos,t.assoc,r),f=Math.min(h.from,d.from),p=Math.max(h.to,d.to);d=f<d.from?A.range(f,p,d.assoc):A.range(p,f,d.assoc)}return o?i.replaceRange(i.main.extend(d.from,d.to,d.assoc)):a&&r==1&&i.ranges.length>1&&(c=Q3(i,l.pos))?c:a?i.addRange(d):A.create([d])}}}function Q3(n,e){for(let t=0;t<n.ranges.length;t++){let{from:r,to:i}=n.ranges[t];if(r<=e&&i>=e)return A.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Wn.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let i=n.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=A.undirectionalRange(s,o))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",ad(n.state,bm,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Wn.dragend=n=>(n.inputState.draggedContent=null,!1);function u0(n,e,t,r){if(t=ad(n.state,Om,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=r&&s&&y3(n,e)?{from:s.from,to:s.to}:null,a={from:i,insert:t},l=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Wn.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),i=0,s=()=>{++i==t.length&&u0(n,e,r.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return u0(n,e,r,!0),!0}return!1};Wn.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=XS?null:e.clipboardData;return t?(LS(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(k3(n),!1)};function $3(n,e){let t=n.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),n.focus()},50)}function C3(n){let e=[],t=[],r=!1;for(let i of n.selection.ranges)i.empty||(e.push(n.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),i=o.number}r=!0}return{text:ad(n,bm,e.join(n.lineBreak)),ranges:t,linewise:r}}let zf=null;Wn.copy=Wn.cut=(n,e)=>{if(!Ho(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:r,linewise:i}=C3(n.state);if(!t&&!i)return!1;zf=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=XS?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):($3(n,t),!1)};const BS=gr.define();function WS(n,e){let t=[];for(let r of n.facet(SS)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:BS.of(!0)}):null}function zS(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=WS(n.state,e);t?n.dispatch(t):n.update([])}},10)}Zt.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),zS(n)};Zt.blur=n=>{n.observer.clearSelectionRange(),zS(n)};Zt.compositionstart=Zt.compositionupdate=n=>{if(!n.observer.editContext&&(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0)){let{main:e}=n.state.selection;!e.empty&&n.lineBlockAt(e.from).from!=n.lineBlockAt(e.to).from&&n.dispatch({changes:n.state.selection.ranges.filter(t=>!t.empty).map(t=>({from:t.from,to:t.to})),userEvent:"input"}),n.inputState.composing=0}};Zt.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,_.chrome&&_.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Zt.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Wn.beforeinput=(n,e)=>{var t,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=n.posAtDOM(a.startContainer,a.startOffset),c=n.posAtDOM(a.endContainer,a.endOffset);return km(n,{from:l,to:c,insert:n.state.toText(s)},null),!0}}let i;if(_.chrome&&_.android&&(i=jS.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return _.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),_.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Zt.compositionend(n,e),20),!1};const d0=new Set;function P3(n){d0.has(n)||(d0.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const h0=["pre-wrap","normal","pre-line","break-spaces"];let Us=!1;function f0(){Us=!1}class T3{constructor(e){this.lineWrapping=e,this.doc=ye.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return h0.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,r,i,s,o){let a=h0.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let d=o[c];d<0?c++:this.heightSamples[Math.floor(d*10)]=!0}}return l}}class M3{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class jn{constructor(e,t,r,i,s){this.from=e,this.length=t,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?Pt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Ki?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new jn(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ze=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(ze||(ze={}));const Oc=.001;class zt{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Oc&&(Us=!0),this.height=e)}replace(e,t,r){return zt.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:d,toB:h}=i[a],f=s.lineAt(l,ze.ByPosNoHeight,r.setDoc(t),0,0),p=f.to>=c?f:s.lineAt(c,ze.ByPosNoHeight,r,0,0);for(h+=p.to-c,c=p.to;a>0&&f.from<=i[a-1].toA;)l=i[a-1].fromA,d=i[a-1].fromB,a--,l<f.from&&(f=s.lineAt(l,ze.ByPosNoHeight,r,0,0));d+=f.from-l,l=f.from;let m=vm.build(r.setDoc(o),e,d,h);s=Yc(s,s.replace(l,c,m))}return s.updateHeight(r,0)}static empty(){return new un(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,i=0,s=0;for(;;)if(t==r)if(i>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=!1;return e[t-1]==null?(o=!0,t--):e[t]==null&&(o=!0,r++),new R3(zt.of(e.slice(0,t)),o,zt.of(e.slice(r)))}}function Yc(n,e){return n==e?n:(n.constructor!=e.constructor&&(Us=!0),e)}zt.prototype.size=1;const A3=U.replace({});class ZS extends zt{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new jn(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new jn(i,0,r,this.spaceAbove,A3):this.mainBlock(r,i)}lineAt(e,t,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,t,r,i,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,ze.ByPos,r,i,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class un extends ZS{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new jn(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let i=r[0];return r.length==1&&(i instanceof un||i instanceof vt&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof vt?i=new un(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):zt.of(r)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class vt extends zt{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),d=t.doc.lineAt(c),h=a+d.length*l,f=Math.max(r,e-h/2);return new jn(d.from,d.length,f,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:d,length:h}=t.doc.line(s+c);return new jn(d,h,r+a*c,a,0)}}lineAt(e,t,r,i,s){if(t==ze.ByHeight)return this.blockAt(e,r,i,s);if(t==ze.ByPosNoHeight){let{from:p,to:m}=r.doc.lineAt(e);return new jn(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),d=a+c.length*l,h=c.number-o,f=i+a*h+l*(c.from-s-h);return new jn(c.from,c.length,Math.max(i,Math.min(f,i+this.height-d)),d,0)}forEachLine(e,t,r,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let d=e,h=i;d<=t;){let f=r.doc.lineAt(d);if(d==e){let m=f.number-a;h+=l*m+c*(e-s-m)}let p=l+c*f.length;o(new jn(f.from,f.length,h,p,0)),h+=p,d=f.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof vt?r[r.length-1]=new vt(s.length+i):r.push(null,new vt(i-1))}if(e>0){let s=r[0];s instanceof vt?r[0]=new vt(e+s.length):r.unshift(new vt(e-1),null)}return zt.of(r)}decomposeLeft(e,t){t.push(new vt(e-1),null)}decomposeRight(e,t){t.push(null,new vt(this.length-e-1))}updateHeight(e,t=0,r=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),l=-1;for(i.from>t&&o.push(new vt(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let d=e.doc.lineAt(a).length;o.length&&o.push(null);let h=i.heights[i.index++],f=0;h<0&&(f=-h,h=i.heights[i.index++]),l==-1?l=h:Math.abs(h-l)>=Oc&&(l=-2);let p=new un(d,h,f);p.outdated=!1,o.push(p),a+=d+1}a<=s&&o.push(null,new vt(s-a).updateHeight(e,a));let c=zt.of(o);return(l<0||Math.abs(c.height-this.height)>=Oc||Math.abs(l-this.heightMetrics(e,t).perLine)>=Oc)&&(Us=!0),Yc(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class R3 extends zt{constructor(e,t,r){super(e.length+(t?1:0)+r.length,e.height+r.height,(t?1:0)|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=t==ze.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let d=t==ze.ByPosNoHeight?ze.ByPosNoHeight:ze.ByPos;return l?c.join(this.right.lineAt(a,d,r,o,a)):this.left.lineAt(a,d,r,i,s).join(c)}forEachLine(e,t,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,r,i,s,o),t>=l&&this.right.forEachLine(e,t,r,a,l,o);else{let c=this.lineAt(l,ze.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),r,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,r,a,l,o)}}replace(e,t,r){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&p0(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),p0(s,a)}return zt.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?zt.of(this.break?[e,null,t]:[e,t]):(this.left=Yc(this.left,e),this.right=Yc(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return i&&i.from<=t+s.length&&i.more?l=s=s.updateHeight(e,t,r,i):s.updateHeight(e,t,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function p0(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof vt&&(r=n[e+1])instanceof vt&&n.splice(e-1,3,new vt(t.length+1+r.length))}const E3=5;class vm{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof un?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new un(r-this.pos,-1,0)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new ZS(o,i,r)):(o||s||i>=E3)&&this.addLineDeco(i,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new un(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new vt(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof un)return e;let t=new un(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof un)&&!this.isCovered?this.nodes.push(new un(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof un&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,t,r,i){let s=new vm(r,e);return pe.spans(t,r,i,s,0),s.finish(r)}}function N3(n,e,t){let r=new D3;return pe.compare(n,e,t,r,0),r.changes}class D3{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&Ds(e,t,this.changes,5)}}function j3(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(i.innerHeight,t.bottom);for(let c=n.parentNode;c&&c!=r.body;)if(c.nodeType==1){let d=c,h=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&h.overflow!="visible"){let f=d.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==n.parentNode?i.innerHeight:l,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?d.offsetParent:d.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function I3(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function X3(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class eh{constructor(e,t,r,i){this.from=e,this.to=t,this.size=r,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=t[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return U.replace({widget:new L3(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class L3 extends zn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class m0{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=g0,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Re.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=t.facet(ym).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new T3(r),this.stateDeco=O0(t),this.heightMap=zt.empty().applyChanges(this.stateDeco,ye.empty,this.heightOracle.setDoc(t.doc),[new $n(0,0,0,t.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=U.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let i=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Rl(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?g0:new wm(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Lo(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=O0(this.state);let i=e.changedRanges,s=$n.extendWithRanges(i,N3(r,this.stateDeco,e?e.changes:ht.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);f0(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Us)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(vS)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Re.RTL:Re.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,d=0;if(a.width&&a.height){let{scaleX:v,scaleY:w}=rS(t,a);(v>.005&&Math.abs(this.scaleX-v)>.005||w>.005&&Math.abs(this.scaleY-w)>.005)&&(this.scaleX=v,this.scaleY=w,c|=16,o=l=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let p=iS(this.view.contentDOM,!1).y;p!=this.scrollParent&&(this.scrollParent=p,this.scrollAnchorHeight=-1,this.scrollOffset=0);let m=this.getScrollOffset();this.scrollOffset!=m&&(this.scrollAnchorHeight=-1,this.scrollOffset=m),this.scrolledToBottom=lS(this.scrollParent||e.win);let O=(this.printing?X3:j3)(t,this.paddingTop),b=O.top-this.pixelViewport.top,y=O.bottom-this.pixelViewport.bottom;this.pixelViewport=O;let S=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(S!=this.inView&&(this.inView=S,S&&(l=!0)),!this.inView&&!this.scrollTarget&&!I3(e.dom))return 0;let x=a.width;if((this.contentDOMWidth!=x||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(v)&&(o=!0),o||i.lineWrapping&&Math.abs(x-this.contentDOMWidth)>i.charWidth){let{lineHeight:w,charWidth:Q,textHeight:C}=e.docView.measureTextSize();o=w>0&&i.refresh(s,w,Q,C,Math.max(5,x/Q),v),o&&(e.docView.minWidth=0,c|=16)}b>0&&y>0?d=Math.max(b,y):b<0&&y<0&&(d=Math.min(b,y)),f0();for(let w of this.viewports){let Q=w.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(w);this.heightMap=(o?zt.empty().applyChanges(this.stateDeco,ye.empty,this.heightOracle,[new $n(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new M3(w.from,Q))}Us&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Rl(i.lineAt(o-r*1e3,ze.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,ze.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,ze.ByPos,s,0,0),f;t.y=="center"?f=(h.top+h.bottom)/2-d/2:t.y=="start"||t.y=="nearest"&&c<l.from?f=h.top:f=h.bottom-d,l=new Rl(i.lineAt(f-1e3/2,ze.ByHeight,s,0,0).from,i.lineAt(f+d+1e3/2,ze.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let r=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Rl(this.heightMap.lineAt(r,ze.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,ze.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,ze.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,ze.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let i of e)t.touchesRange(i.from,i.to)||r.push(new eh(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Re.LTR&&!r)return[];let a=[],l=(d,h,f,p)=>{if(h-d<s)return;let m=this.state.selection.main,O=[m.from];m.empty||O.push(m.to);for(let y of O)if(y>d&&y<h){l(d,y-10,f,p),l(y+10,h,f,p);return}let b=B3(e,y=>y.from>=f.from&&y.to<=f.to&&Math.abs(y.from-d)<s&&Math.abs(y.to-h)<s&&!O.some(S=>y.from<S&&y.to>S));if(!b){if(h<f.to&&t&&r&&t.visibleRanges.some(x=>x.from<=h&&x.to>=h)){let x=t.moveToLineBoundary(A.cursor(h),!1,!0).head;x>d&&(h=x)}let y=this.gapSize(f,d,h,p),S=r||y<2e6?y:2e6;b=new eh(d,h,y,S)}a.push(b)},c=d=>{if(d.length<o||d.type!=Pt.Text)return;let h=_3(d.from,d.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,p,m;if(r){let O=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,y;if(f!=null){let S=Nl(h,f),x=((this.visibleBottom-this.visibleTop)/2+O)/d.height;b=S-x,y=S+x}else b=(this.visibleTop-d.top-O)/d.height,y=(this.visibleBottom-d.top+O)/d.height;p=El(h,b),m=El(h,y)}else{let O=h.total*this.heightOracle.charWidth,b=i*this.heightOracle.charWidth,y=0;if(O>2e6)for(let w of e)w.from>=d.from&&w.from<d.to&&w.size!=w.displaySize&&w.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=w.size-w.displaySize);let S=this.pixelViewport.left+y,x=this.pixelViewport.right+y,k,v;if(f!=null){let w=Nl(h,f),Q=((x-S)/2+b)/O;k=w-Q,v=w+Q}else k=(S-b)/O,v=(x+b)/O;p=El(h,k),m=El(h,v)}p>d.from&&l(d.from,p,d,h),m<d.to&&l(m,d.to,d,h)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(c):c(d);return a}gapSize(e,t,r,i){let s=Nl(i,r)-Nl(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){eh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=U.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];pe.spans(t,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Lo(this.heightMap.lineAt(e,ze.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Lo(this.heightMap.lineAt(this.scaler.fromDOM(e),ze.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Lo(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Rl{constructor(e,t){this.from=e,this.to=t}}function _3(n,e,t){let r=[],i=n,s=0;return pe.spans(t,n,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function El({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(n*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function Nl(n,e){let t=0;for(let{from:r,to:i}of n.ranges){if(e<=i){t+=e-r;break}t+=i-r}return t/n.total}function B3(n,e){for(let t of n)if(e(t))return t}const g0={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function O0(n){let e=n.facet(id).filter(r=>typeof r!="function"),t=n.facet(xm).filter(r=>typeof r!="function");return t.length&&e.push(pe.join(t)),e}class wm{constructor(e,t,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=t.lineAt(a,ze.ByPos,e,0,0).top,d=t.lineAt(l,ze.ByPos,e,0,0).bottom;return i+=d-c,{from:a,to:l,top:c,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof wm?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function Lo(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new jn(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>Lo(i,e)):n._content)}const Dl=W.define({combine:n=>n.join(" ")}),Zf=W.define({combine:n=>n.indexOf(!0)>-1}),Ff=mi.newName(),FS=mi.newName(),VS=mi.newName(),YS={"&light":"."+FS,"&dark":"."+VS};function Vf(n,e,t){return new mi(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return n;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):n+" "+r}})}const W3=Vf("."+Ff,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},YS),z3={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},th=_.ie&&_.ie_version<=11;let Z3=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new yM,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let r of t)this.queue.push(r);(_.ie&&_.ie_version<=11||_.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&_.android&&e.constructor.EDIT_CONTEXT!==!1&&!(_.chrome&&_.chrome_version<126)&&(this.editContext=new V3(e),e.state.facet(Tr)&&(e.contentDOM.editContext=this.editContext.editContext)),th&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(Tr)?r.root.activeElement!=this.dom:!Ho(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(_.ie&&_.ie_version<=11||_.android&&_.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Jo(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ma(e.root);if(!t)return!1;let r=_.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&F3(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=Ho(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&SM(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,z3),th&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),th&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&js(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Ho(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new l3(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,i=NS(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!Vc(this.view.state.selection,t.newSel.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let r=b0(t,e.previousSibling||e.target.previousSibling,-1),i=b0(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Tr)!=e.state.facet(Tr)&&(e.view.contentDOM.editContext=e.state.facet(Tr)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function b0(n,e,t){for(;e;){let r=rt.get(e);if(r&&r.parent==n)return r;let i=e.parentNode;e=i!=n.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function y0(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Jo(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function F3(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return y0(n,i)}let t=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",r,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",r,!0),t?y0(n,t):null}class V3{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&s<this.from?a=s:l==this.to&&s>this.to&&(l=s);let d=DS(e.state.sliceDoc(a,l),r.text,(c?i.from:i.to)-a,c?"end":null);if(!d){let f=A.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Vc(f,i)||e.dispatch({selection:f,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:ye.of(r.text.slice(d.from,d.toB).split(`
53
- `))};if((_.mac||_.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:ye.of([r.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);km(e,h,A.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(U.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:QS.of(U.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=Ma(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let d=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}let X=class bc{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||xM(e.parent)||document,this.viewState=new m0(this,e.state||Ge.create(e)),e.scrollTo&&e.scrollTo.is(Tl)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ps).map(i=>new Ud(i));for(let i of this.plugins)i.update(this);this.observer=new Z3(this),this.inputState=new h3(this),this.inputState.ensureHandlers(this.plugins),this.docView=new n0(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Wt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,i,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(BS))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=WS(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,d=null;if(c?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet(Ge.phrases)!=this.state.facet(Ge.phrases))return this.setState(s);i=zc.create(this,s,e),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:p}=f.state.selection,{x:m,y:O}=this.state.facet(bc.cursorScrollMargin);h=new Is(p.empty?p:A.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",O,m)}for(let p of f.effects)p.is(Tl)&&(h=p.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=qc.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(Xo)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Dl)!=i.state.facet(Dl)&&(this.viewState.mustMeasureContent=!0),(t||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(Lf))try{f(i)}catch(p){Ht(this.state,p,"update listener")}(l||d)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),d&&!NS(this,d)&&c.force&&js(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new m0(this,e),this.plugins=e.facet(Ps).map(r=>new Ud(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new n0(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ps),r=e.state.facet(Ps);if(t!=r){let i=[];for(let s of r){let o=t.indexOf(s);if(o<0)i.push(new Ud(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){Ht(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o,scaleY:a}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0){if(lS(r||this.win))s=-1,o=this.viewState.heightMap.height/this.viewState.scaleY;else{let m=this.viewState.scrollAnchorAt(i);s=m.from,o=m.top}a=this.viewState.scaleY}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(m=>{try{return m.read(this)}catch(O){return Ht(this.state,O),x0}}),f=zc.create(this,this.state,[]),p=!1;f.flags|=c,t?t.flags|=c:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),p=this.docView.update(f),p&&this.docViewUpdate());for(let m=0;m<d.length;m++)if(h[m]!=x0)try{let O=d[m];O.write&&O.write(h[m],this)}catch(O){Ht(this.state,O)}if(p&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let O=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)/this.viewState.scaleY-o/a;if((O>1||O<-1)&&!(_.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+O,r?s<0?r.scrollTop=r.scrollHeight:r.scrollTop+=O:this.win.scrollBy(0,O),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Lf))l(t)}get themeClasses(){return Ff+" "+(this.state.facet(Zf)?VS:FS)+" "+this.state.facet(Dl)}updateAttrs(){let e=S0(this,$S,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Tr)?"true":"false",class:"cm-content",style:`${_.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),S0(this,ym,t);let r=this.observer.ignore(()=>{let i=GO(this.contentDOM,this.contentAttrs,t),s=GO(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let i of r.effects)if(i.is(bc.announce)){t&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1);let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Xo);let e=this.state.facet(bc.cspNonce);mi.mount(this.root,this.styleModules.concat(W3).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,r){return Jd(this,e,r0(this,e,t,r))}moveByGroup(e,t){return Jd(this,e,r0(this,e,t,r=>n3(this,e.head,r)))}visualLineSide(e,t){return t?A.cursor(e.to,1):A.cursor(e.from,-1)}moveToLineBoundary(e,t,r=!0){return t3(this,e,t,r)}moveVertically(e,t,r){return Jd(this,e,r3(this,e,t,r))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let r=Wf(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Wf(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),s=i[or.find(i,e-r.from,-1,t)];return r.length&&(e==r.from&&t<0||e==r.to&&t>0)&&s.dir!=this.textDirectionAt(r.from)&&(e==r.to?(e=r.from+s.from,t=1):(e=r.from+s.to,t=-1)),this.docView.coordsAt(e,t,s.dir==Re.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(kS)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Y3)return pS(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||fS(s.isolates,r=JO(this,e))))return s.order;r||(r=JO(this,e));let i=PM(e.text,t,r);return this.bidiCache.push(new qc(e.from,e.to,t,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||_.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{aS(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var r,i,s,o;return Tl.of(new Is(typeof e=="number"?A.cursor(e):e,(r=t.y)!==null&&r!==void 0?r:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(s=t.yMargin)!==null&&s!==void 0?s:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Tl.of(new Is(A.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return it.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return it.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=mi.newName(),i=[Dl.of(r),Xo.of(Vf(`.${r}`,e))];return t&&t.dark&&i.push(Zf.of(!0)),i}static baseTheme(e){return ki.lowest(Xo.of(Vf("."+Ff,e,YS)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&rt.get(r)||rt.get(e);return((t=i?.root)===null||t===void 0?void 0:t.view)||null}};X.styleModule=Xo;X.inputHandler=xS;X.clipboardInputFilter=Om;X.clipboardOutputFilter=bm;X.scrollHandler=wS;X.focusChangeEffect=SS;X.perLineTextDirection=kS;X.exceptionSink=yS;X.updateListener=Lf;X.editable=Tr;X.mouseSelectionStyle=bS;X.dragMovesSelection=OS;X.clickAddsSelectionRange=gS;X.decorations=id;X.blockWrappers=CS;X.outerDecorations=xm;X.atomicRanges=rl;X.bidiIsolatedRanges=PS;X.cursorScrollMargin=W.define({combine:n=>{let e=5,t=5;for(let r of n)typeof r=="number"?e=t=r:{x:e,y:t}=r;return{x:e,y:t}}});X.scrollMargins=TS;X.darkTheme=Zf;X.cspNonce=W.define({combine:n=>n.length?n[0]:""});X.contentAttributes=ym;X.editorAttributes=$S;X.lineWrapping=X.contentAttributes.of({class:"cm-lineWrapping"});X.announce=oe.define();const Y3=4096,x0={};class qc{constructor(e,t,r,i,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Re.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&r.push(new qc(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function S0(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(n):s;o&&pm(o,t)}return t}const q3=_.mac?"mac":_.windows?"win":_.linux?"linux":"key";function U3(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function jl(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const G3=ki.default(X.domEventHandlers({keydown(n,e){return US(qS(e.state),n,e,"editor")}})),il=W.define({enables:G3}),k0=new WeakMap;function qS(n){let e=n.facet(il),t=k0.get(e);return t||k0.set(e,t=J3(e.reduce((r,i)=>r.concat(i),[]))),t}function H3(n,e,t){return US(qS(n.state),e,n,t)}let ei=null;const K3=4e3;function J3(n,e=q3){let t=Object.create(null),r=Object.create(null),i=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,d)=>{var h,f;let p=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(y=>U3(y,e));for(let y=1;y<m.length;y++){let S=m.slice(0,y).join(" ");i(S,!0),p[S]||(p[S]={preventDefault:!0,stopPropagation:!1,run:[x=>{let k=ei={view:x,prefix:S,scope:o};return setTimeout(()=>{ei==k&&(ei=null)},K3),!0}]})}let O=m.join(" ");i(O,!1);let b=p[O]||(p[O]={preventDefault:!1,stopPropagation:!1,run:((f=(h=p._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});l&&b.run.push(l),c&&(b.preventDefault=!0),d&&(b.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let d=t[c]||(t[c]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in d)d[f].run.push(p=>h(p,Yf))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}let Yf=null;function US(n,e,t,r){Yf=e;let i=Jx(e),s=Yt(i,0),o=rr(s)==i.length&&i!=" ",a="",l=!1,c=!1,d=!1;ei&&ei.view==t&&ei.scope==r&&(a=ei.prefix+" ",IS.indexOf(e.keyCode)<0&&(c=!0,ei=null));let h=new Set,f=b=>{if(b){for(let y of b.run)if(!h.has(y)&&(h.add(y),y(t)))return b.stopPropagation&&(d=!0),!0;b.preventDefault&&(b.stopPropagation&&(d=!0),c=!0)}return!1},p=n[r],m,O;return p&&(f(p[a+jl(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(_.windows&&e.ctrlKey&&e.altKey)&&!(_.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=_r[e.keyCode])&&m!=i?(f(p[a+jl(m,e,!0)])||e.shiftKey&&(O=Pa[e.keyCode])!=i&&O!=m&&f(p[a+jl(O,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(p[a+jl(i,e,!0)])&&(l=!0),!l&&f(p._any)&&(l=!0)),c&&(l=!0),l&&d&&e.stopPropagation(),Yf=null,l}class zi{constructor(e,t,r,i,s){this.className=e,this.left=t,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=GS(e);return[new zi(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return eA(e,t,r)}}function GS(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Re.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function v0(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=n.posAtCoords({x:s.left+1,y:o}),l=n.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function eA(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let r=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),s=n.textDirection==Re.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),l=GS(n),c=o.querySelector(".cm-line"),d=c&&window.getComputedStyle(c),h=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),f=a.right-(d?parseInt(d.paddingRight):0),p=Bf(n,r,1),m=Bf(n,i,-1),O=p.type==Pt.Text?p:null,b=m.type==Pt.Text?m:null;if(O&&(n.lineWrapping||p.widgetLineBreaks)&&(O=v0(n,r,1,O)),b&&(n.lineWrapping||m.widgetLineBreaks)&&(b=v0(n,i,-1,b)),O&&b&&O.from==b.from&&O.to==b.to)return S(x(t.from,t.to,O));{let v=O?x(t.from,null,O):k(p,!1),w=b?x(null,t.to,b):k(m,!0),Q=[];return(O||p).to<(b||m).from-(O&&b?1:0)||p.widgetLineBreaks>1&&v.bottom+n.defaultLineHeight/2<w.top?Q.push(y(h,v.bottom,f,w.top)):v.bottom<w.top&&n.elementAtHeight((v.bottom+w.top)/2).type==Pt.Text&&(v.bottom=w.top=(v.bottom+w.top)/2),S(v).concat(Q).concat(S(w))}function y(v,w,Q,C){return new zi(e,v-l.left,w-l.top,Math.max(0,Q-v),C-w)}function S({top:v,bottom:w,horizontal:Q}){let C=[];for(let T=0;T<Q.length;T+=2)C.push(y(Q[T],v,Q[T+1],w));return C}function x(v,w,Q){let C=1e9,T=-1e9,P=[];function R(N,I,Z,ne,le){let B=n.coordsAtPos(N,N==Q.to?-2:2),se=n.coordsAtPos(Z,Z==Q.from?2:-2);!B||!se||(C=Math.min(B.top,se.top,C),T=Math.max(B.bottom,se.bottom,T),le==Re.LTR?P.push(s&&I?h:B.left,s&&ne?f:se.right):P.push(!s&&ne?h:se.left,!s&&I?f:B.right))}let M=v??Q.from,D=w??Q.to;for(let N of n.visibleRanges)if(N.to>M&&N.from<D)for(let I=Math.max(N.from,M),Z=Math.min(N.to,D);;){let ne=n.state.doc.lineAt(I);for(let le of n.bidiSpans(ne)){let B=le.from+ne.from,se=le.to+ne.from;if(B>=Z)break;se>I&&R(Math.max(B,I),v==null&&B<=M,Math.min(se,Z),w==null&&se>=D,le.dir)}if(I=ne.to+1,I>=Z)break}return P.length==0&&R(M,v==null,D,w==null,n.textDirection),{top:C,bottom:T,horizontal:P}}function k(v,w){let Q=a.top+(w?v.top:v.bottom);return{top:Q,bottom:Q,horizontal:[]}}}function tA(n,e){return n.constructor==e.constructor&&n.eq(e)}class nA{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(yc)!=e.state.facet(yc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,r=e.facet(yc);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!tA(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[r].constructor&&i.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e,_.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const yc=W.define();function HS(n){return[it.define(e=>new nA(e,n)),yc.of(n)]}const Gs=W.define({combine(n){return Or(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function rA(n={}){return[Gs.of(n),iA,sA,aA,vS.of(!0)]}function KS(n){return n.startState.facet(Gs)!=n.state.facet(Gs)}const iA=HS({above:!0,markers(n){let{state:e}=n,t=e.facet(Gs),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor&&!(s&&_.ios&&t.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:A.cursor(i.head,i.assoc);for(let l of zi.forRange(n,o,a))r.push(l)}}return r},update(n,e){n.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=KS(n);return t&&w0(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){w0(e.state,n)},class:"cm-cursorLayer"});function w0(n,e){e.style.animationDuration=n.facet(Gs).cursorBlinkRate+"ms"}const sA=HS({above:!1,markers(n){let e=[],{main:t,ranges:r}=n.state.selection;for(let i of r)if(!i.empty)for(let s of zi.forRange(n,"cm-selectionBackground",i))e.push(s);if(_.ios&&!t.empty&&n.state.facet(Gs).iosSelectionHandles){for(let i of zi.forRange(n,"cm-selectionHandle cm-selectionHandle-start",A.cursor(t.from,1)))e.push(i);for(let i of zi.forRange(n,"cm-selectionHandle cm-selectionHandle-end",A.cursor(t.to,1)))e.push(i)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||KS(n)},class:"cm-selectionLayer"}),oA=_.gecko&&_.gecko_version==153?"#ffffff01":"transparent",aA=ki.highest(X.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${oA} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),JS=oe.define({map(n,e){return n==null?null:e.mapPos(n)}}),_o=Tt.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(JS)?r.value:t,n)}}),lA=it.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(_o);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(_o)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(_o),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let r=n.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-r.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(_o)!=n&&this.view.dispatch({effects:JS.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function cA(){return[_o,lA]}function Q0(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function uA(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let r=[];for(let{from:i,to:s}of t)i=Math.max(n.state.doc.lineAt(i).from,i-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class dA{constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(a,l,c,d)=>i(d,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,d)=>{let h=r(a,l,c);h&&d(c,c+a[0].length,h)};else if(r)this.addMatch=(a,l,c,d)=>d(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Lr,r=t.add.bind(t);for(let{from:i,to:s}of uA(e,this.maxLength))Q0(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),r,i):t}updateRange(e,t,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,d=Math.max(s.from,l.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){d=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let f=[],p,m=(O,b,y)=>f.push(y.range(O,b));if(l==c)for(this.regexp.lastIndex=d-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,m);else Q0(e.state.doc,this.regexp,d,h,(O,b)=>this.addMatch(b,e,O,m));t=t.update({filterFrom:d,filterTo:h,filter:(O,b)=>O<d||b>h,add:f})}}return t}}const qf=/x/.unicode!=null?"gu":"g",hA=new RegExp(`[\0-\b
54
- --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,qf),fA={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let nh=null;function pA(){var n;if(nh==null&&typeof document<"u"&&document.body){let e=document.body.style;nh=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return nh||!1}const xc=W.define({combine(n){let e=Or(n,{render:null,specialChars:hA,addSpecialChars:null});return(e.replaceTabs=!pA())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,qf)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,qf)),e}});function mA(n={}){return[xc.of(n),gA()]}let $0=null;function gA(){return $0||($0=it.fromClass(class{constructor(n){this.view=n,this.decorations=U.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(xc)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new dA({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=Yt(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,l=uo(o.text,a,r-o.from);return U.replace({widget:new xA((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=U.replace({widget:new yA(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(xc);n.startState.facet(xc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const OA="•";function bA(n){return n>=32?OA:n==10?"␤":String.fromCharCode(9216+n)}class yA extends zn{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=bA(this.code),r=e.state.phrase("Control character")+" "+(fA[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xA extends zn{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function SA(){return vA}const kA=U.line({class:"cm-activeLine"}),vA=it.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(kA.range(i.from)),e=i.from)}return U.set(t)}},{decorations:n=>n.decorations});let wA=class extends zn{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Ko(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),i=Aa(t[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}};function QA(n){let e=it.fromClass(class{constructor(t){this.view=t,this.placeholder=n?U.set([U.widget({widget:new wA(n),side:1}).range(0)]):U.none}get decorations(){return this.view.state.doc.length?U.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,X.contentAttributes.of({"aria-placeholder":n})]:e}const Uf=2e3;function $A(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Uf||t.off>Uf||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=i;l++){let c=n.doc.line(l);c.length<=a&&s.push(A.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=i;l++){let c=n.doc.line(l),d=Pf(c.text,o,n.tabSize,!0);if(d<0)s.push(A.cursor(c.to));else{let h=Pf(c.text,a,n.tabSize);s.push(A.range(c.from+d,c.from+h))}}}return s}function CA(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function C0(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>Uf?-1:i==r.length?CA(n,e.clientX):uo(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function PA(n,e){let t=C0(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=C0(n,i);if(!a)return r;let l=$A(n.state,t,a);return l.length?o?A.create(l.concat(r.ranges)):A.create(l):r}}:null}function TA(n){let e=(t=>t.altKey&&t.button==0);return X.mouseSelectionStyle.of((t,r)=>e(r)?PA(t,r):null)}const MA={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},AA={style:"cursor: crosshair"};function RA(n={}){let[e,t]=MA[n.key||"Alt"],r=it.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[r,X.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?AA:null})]}const Il="-10000px";class ek{constructor(e,t,r,i){this.facet=t,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<s.length;l++){let c=s[l],d=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(d=h)}if(d<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[d];a&&(a[l]=t[d]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function EA(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const rh=W.define({combine:n=>{var e,t,r;return{position:_.ios?"absolute":((e=n.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=n.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||EA}}}),P0=new WeakMap,Qm=it.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(rh);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new ek(n,$m,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,r=n.state.facet(rh);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.appendChild(i)}return t.dom.style.position=this.position,t.dom.style.top=Il,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(n=r.destroy)===null||n===void 0||n.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(_.safari){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Sm(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(rh).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:d}=c,h=n.pos[a],f=n.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(t.top,r.top)||h.top>=Math.min(t.bottom,r.bottom)||h.right<Math.max(t.left,r.left)-.1||h.left>Math.min(t.right,r.right)+.1)){d.style.top=Il;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,O=f.right-f.left,b=(e=P0.get(c))!==null&&e!==void 0?e:f.bottom-f.top,y=c.offset||DA,S=this.view.textDirection==Re.LTR,x=f.width>r.right-r.left?S?r.left:r.right-f.width:S?Math.max(r.left,Math.min(h.left-(p?14:0)+y.x,r.right-O)):Math.min(Math.max(r.left,h.left-O+(p?14:0)-y.x),r.right-O),k=this.above[a];!l.strictSide&&(k?h.top-b-m-y.y<r.top:h.bottom+b+m+y.y>r.bottom)&&k==r.bottom-h.bottom>h.top-r.top&&(k=this.above[a]=!k);let v=(k?h.top-r.top:r.bottom-h.bottom)-m;if(v<b&&c.resize!==!1){if(v<this.view.defaultLineHeight){d.style.top=Il;continue}P0.set(c,b),d.style.height=(b=v)/s+"px"}else d.style.height&&(d.style.height="");let w=k?h.top-b-m-y.y:h.bottom+m+y.y,Q=x+O;if(c.overlap!==!0)for(let C of o)C.left<Q&&C.right>x&&C.top<w+b&&C.bottom>w&&(w=k?C.top-b-2-m:C.bottom+m+2);if(this.position=="absolute"?(d.style.top=(w-n.parent.top)/s+"px",T0(d,(x-n.parent.left)/i)):(d.style.top=w/s+"px",T0(d,x/i)),p){let C=h.left+(S?y.x:-y.x)-(x+14-7);p.style.left=C/i+"px"}c.overlap!==!0&&o.push({left:x,top:w,right:Q,bottom:w+b}),d.classList.toggle("cm-tooltip-above",k),d.classList.toggle("cm-tooltip-below",!k),c.positioned&&c.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Il}},{eventObservers:{scroll(){this.maybeMeasure()}}});function T0(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const NA=X.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),DA={x:0,y:0},$m=W.define({enables:[Qm,NA]}),Uc=W.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class ld{static create(e){return new ld(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new ek(e,Uc,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const jA=$m.compute([Uc],n=>{let e=n.facet(Uc);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:ld.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),tk=W.define();class IA{constructor(e,t,r,i,s,o){this.view=e,this.source=t,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,r=e.docView.tile.nearest(t.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let o=e.coordsAtPos(i);if(!o||t.y<o.top||t.y>o.bottom||t.x<o.left-e.defaultCharacterWidth||t.x>o.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),l=a&&a.dir==Re.RTL?-1:1;s=t.x<o.left?-l:l}this.activateHover(e,i,s)}activateHover(e,t,r,i){let s=this.source(e,t,r),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let l=Array.isArray(a)?a:[a];i&&this.locked.set(l,i),e.dispatch({effects:this.setHover.of(l)})}};if(s&&"then"in s){let a=this.pending={pos:t};s.then(l=>{this.pending==a&&(this.pending=null,o(l))},l=>Ht(e.state,l,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(Qm),t=e?e.manager.tooltips.findIndex(r=>r.create==ld.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!XA(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!LA(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Xl=4;function XA(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=t-Xl&&e.clientX<=r+Xl&&e.clientY>=i-Xl&&e.clientY<=s+Xl}function LA(n,e,t,r,i,s){let o=n.scrollDOM.getBoundingClientRect(),a=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=n.posAtCoords({x:r,y:i},!1);return l>=e&&l<=t}function _A(n,e={}){let t=oe.define(),r=new WeakMap,i=Tt.define({create(){return[]},update(o,a){let l=r.get(o);if(o.length&&(e.hideOnChange&&(a.docChanged||a.selection)?o=[]:l&&l(a)?o=[]:e.hideOn&&(o=o.filter(c=>!e.hideOn(a,c)))),a.docChanged&&o.length){let c=[];for(let d of o){let h=a.changes.mapPos(d.pos,-1,$t.TrackDel);if(h!=null){let f=Object.assign(Object.create(null),d);f.pos=h,f.end!=null&&(f.end=a.changes.mapPos(f.end)),c.push(f)}}o=c}for(let c of a.effects)c.is(t)&&(o=c.value,l=void 0),(c.is(WA)&&!c.value||c.value==i)&&(o=[]);return o.length&&l&&r.set(o,l),o},provide:o=>Uc.from(o)});const s=it.define(o=>new IA(o,n,i,r,t,e.hoverTime||300));return{active:i,extension:[i,s,tk.of(s),jA]}}function BA(n,e,t,r={}){var i;let s=n.state.facet(tk).map(o=>n.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=s.find(a=>a.field==r.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(n,e,t,(i=r.until)!==null&&i!==void 0?i:(()=>!1))}function nk(n,e){let t=n.plugin(Qm);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const WA=oe.define(),M0=W.define({combine(n){let e,t;for(let r of n)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function cd(n,e){let t=n.plugin(rk),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const rk=it.fromClass(class{constructor(n){this.input=n.state.facet(Ea),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(M0);this.top=new Ll(n,!0,e.topContainer),this.bottom=new Ll(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(M0);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ll(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ll(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Ea);if(t!=this.input){let r=t.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),d;c<0?(d=l(n.view),a.push(d)):(d=this.panels[c],d.update&&d.update(n)),i.push(d),(d.top?s:o).push(d)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>X.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Ll{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=A0(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=A0(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function A0(n){let e=n.nextSibling;return n.remove(),e}const Ea=W.define({enables:rk});function zA(n,e){let t,r=new Promise(o=>t=o),i=o=>FA(o,e,t);n.state.field(Sc,!1)?n.dispatch({effects:ik.of(i)}):n.dispatch({effects:oe.appendConfig.of(Sc.init(()=>[i]))});let s=sk.of(i);return{close:s,result:r.then(o=>((n.win.queueMicrotask||(l=>n.win.setTimeout(l,10)))(()=>{n.state.field(Sc).indexOf(i)>-1&&n.dispatch({effects:s})}),o))}}function ZA(n,e){let t=n.state.field(Sc,!1)||[];for(let r of t){let i=cd(n,r);if(i&&i.dom.classList.contains(e))return i}return null}const Sc=Tt.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(ik)?n=[t.value].concat(n):t.is(sk)&&(n=n.filter(r=>r!=t.value));return n},provide:n=>Ea.computeN([n],e=>e.field(n))}),ik=oe.define(),sk=oe.define();function FA(n,e,t){let r=e.content?e.content(n,()=>o(null)):null;if(!r){if(r=Ce("form"),e.input){let a=Ce("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(Ce("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(Ce("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<i.length;a++){let l=i[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let s=Ce("div",r,Ce("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(a){s.contains(s.ownerDocument.activeElement)&&n.focus(),t(a)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class Wr extends pi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Wr.prototype.elementClass="";Wr.prototype.toDOM=void 0;Wr.prototype.mapMode=$t.TrackBefore;Wr.prototype.startSide=Wr.prototype.endSide=-1;Wr.prototype.point=!0;const kc=W.define(),VA=W.define(),YA={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>pe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ta=W.define();function qA(n){return[ok(),ta.of({...YA,...n})]}const R0=W.define({combine:n=>n.some(e=>e)});function ok(n){return[UA]}const UA=it.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(ta).map(e=>new N0(n,e)),this.fixed=!n.state.facet(R0);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(R0)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=pe.iter(this.view.state.facet(kc),this.view.viewport.from),r=[],i=this.gutters.map(s=>new GA(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Pt.Text&&o){Gf(t,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Pt.Text){Gf(t,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(ta),t=n.state.facet(ta),r=n.docChanged||n.heightChanged||n.viewportChanged||!pe.eq(n.startState.facet(kc),n.state.facet(kc),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(r=!0);else{r=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new N0(this.view,s)):(this.gutters[o].update(n),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>X.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Re.LTR?{left:r,right:i}:{right:r,left:i}})});function E0(n){return Array.isArray(n)?n:[n]}function Gf(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class GA{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=pe.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new ak(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];Gf(this.cursor,i,t.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),i=r?[r]:null;for(let s of e.state.facet(VA)){let o=s(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class N0{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in t.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=E0(t.markers(e)),t.initialSpacer&&(this.spacer=new ak(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=E0(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!pe.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class ak{constructor(e,t,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,i)}update(e,t,r,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),HA(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!1;if(l){let d=l.elementClass;d&&(r+=" "+d);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function HA(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const KA=W.define(),JA=W.define(),Ts=W.define({combine(n){return Or(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],o=t[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class ih extends Wr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function sh(n,e){return n.state.facet(Ts).formatNumber(e,n.state)}const eR=ta.compute([Ts],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(KA)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new ih(sh(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(JA)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Ts)!=e.state.facet(Ts),initialSpacer(e){return new ih(sh(e,D0(e.state.doc.lines)))},updateSpacer(e,t){let r=sh(t.view,D0(t.view.state.doc.lines));return r==e.number?e:new ih(r)},domEventHandlers:n.facet(Ts).domEventHandlers,side:"before"}));function tR(n={}){return[Ts.of(n),ok(),eR]}function D0(n){let e=9;for(;e<n;)e=e*10+9;return e}const nR=new class extends Wr{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},rR=kc.compute(["selection"],n=>{let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head).from;i>t&&(t=i,e.push(nR.range(i)))}return pe.of(e)});function iR(){return rR}var oh;const Ms=new de;function lk(n){return W.define({combine:n?e=>e.concat(n):void 0})}const Cm=new de;class Ln{constructor(e,t,r=[],i=""){this.data=e,this.name=i,Ge.prototype.hasOwnProperty("tree")||Object.defineProperty(Ge.prototype,"tree",{get(){return Ke(this)}}),this.parser=t,this.extension=[Oi.of(this),Ge.languageData.of((s,o,a)=>{let l=j0(s,o,a),c=l.type.prop(Ms);if(!c)return[];let d=s.facet(c),h=l.type.prop(Cm);if(h){let f=l.resolve(o-l.from,a);for(let p of h)if(p.test(f,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(d)}}return d})].concat(r)}isActiveAt(e,t,r=-1){return j0(e,t,r).type.prop(Ms)==this.data}findRegions(e){let t=e.facet(Oi);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Ms)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(de.mounted);if(a){if(a.tree.prop(Ms)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof qe&&i(c,s.positions[l]+o)}};return i(Ke(e),0),r}get allowsNesting(){return!0}}Ln.setState=oe.define();function j0(n,e,t){let r=n.facet(Oi),i=Ke(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Oe.ExcludeBuffers|Oe.EnterBracketed))s.type.isTop&&(i=s);return i}class ts extends Ln{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=lk(e.languageData);return new ts(t,e.parser.configure({props:[Ms.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new ts(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ke(n){let e=n.field(Ln.state,!1);return e?e.tree:qe.empty}class sR{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let wo=null,oR=class Hf{constructor(e,t,r=[],i,s,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new Hf(e,t,[],qe.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sR(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=qe.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Dr.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Dr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=wo;wo=this;try{return e()}finally{wo=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=I0(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,d,h,f)=>l.push({fromA:c,toA:d,fromB:h,toB:f})),r=Dr.applyChanges(r,l),i=qe.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let d=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);d<h&&a.push({from:d,to:h})}}}return new Hf(this.parser,t,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=I0(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Qx{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=wo;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new qe(mn.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return wo}};function I0(n,e,t){return Dr.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Hs{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new Hs(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=oR.create(e.facet(Oi).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new Hs(r)}}Ln.state=Tt.define({create:Hs.init,update(n,e){for(let t of e.effects)if(t.is(Ln.setState))return t.value;return e.startState.facet(Oi)!=e.state.facet(Oi)?Hs.init(e.state):n.apply(e)}});let ck=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ck=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ah=typeof navigator<"u"&&(!((oh=navigator.scheduling)===null||oh===void 0)&&oh.isInputPending)?()=>navigator.scheduling.isInputPending():null,aR=it.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Ln.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ln.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ck(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Ln.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!ah?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>ah&&ah()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ln.setState.of(new Hs(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ht(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Oi=W.define({combine(n){return n.length?n[0]:null},enables:n=>[Ln.state,aR,X.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class ud{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const lR=W.define(),sl=W.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Gc(n){let e=n.facet(sl);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Na(n,e){let t="",r=n.tabSize,i=n.facet(sl)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function Pm(n,e){n instanceof Ge&&(n=new dd(n));for(let r of n.state.facet(lR)){let i=r(n,e);if(i!==void 0)return i}let t=Ke(n.state);return t.length>=e?cR(n,t,e):null}class dd{constructor(e,t={}){this.state=e,this.options=t,this.unit=Gc(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return uo(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ol=new de;function cR(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return uk(r,n,t)}function uk(n,e,t){for(let r=n;r;r=r.next){let i=dR(r.node);if(i)return i(Tm.create(e,t,r))}return 0}function uR(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function dR(n){let e=n.type.prop(ol);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(de.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>hk(o,!0,1,void 0,s&&!uR(o)?i.from:void 0)}return n.parent==null?hR:null}function hR(){return 0}class Tm extends dd{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new Tm(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(fR(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return uk(this.context.next,this.base,this.pos)}}function fR(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function pR(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+c}}a=l.to}}function dk({closing:n,align:e=!0,units:t=1}){return r=>hk(r,e,t,n)}function hk(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==n.pos+o,l=e?pR(n):null;return l?a?n.column(l.from):n.column(l.to):n.baseIndent+(a?0:n.unit*t)}const fk=n=>n.baseIndent;function Xs({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const mR=200;function gR(){return Ge.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+mR)return n;let s=t.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return n;let{state:o}=n,a=-1,l=[];for(let{head:c}of o.selection.ranges){let d=o.doc.lineAt(c);if(d.from==a)continue;a=d.from;let h=Pm(o,d.from);if(h==null)continue;let f=/^\s*/.exec(d.text)[0],p=Na(o,h);f!=p&&l.push({from:d.from,to:d.from+f.length,insert:p})}return l.length?[n,{changes:l,sequential:!0}]:n})}const OR=W.define(),al=new de;function Mm(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function bR(n,e,t){let r=Ke(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let l=a.type.prop(al);if(l&&(a.to<r.length-50||r.length==n.doc.length||!yR(a))){let c=l(a,n);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function yR(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Hc(n,e,t){for(let r of n.facet(OR)){let i=r(n,e,t);if(i)return i}return bR(n,e,t)}function pk(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const hd=oe.define({map:pk}),ll=oe.define({map:pk});function mk(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const ns=Tt.define({create(){return U.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,i)=>n=X0(n,r,i)),n=n.map(e.changes);let t=[];for(let r of e.effects)r.is(hd)&&!xR(n,r.value.from,r.value.to)?t.push(r.value):r.is(ll)&&(n=n.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(t.length){let{preparePlaceholder:r}=e.state.facet(bk),i=t.map(s=>(r?U.replace({widget:new CR(r(e.state,s))}):L0).range(s.from,s.to));n=n.update({add:i})}return e.selection&&(n=X0(n,e.selection.main.head)),n},provide:n=>X.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(L0.range(r,i))}return U.set(e,!0)}});function X0(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function Kc(n,e,t){var r;let i=null;return(r=n.field(ns,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function xR(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function gk(n,e){return n.field(ns,!1)?e:e.concat(oe.appendConfig.of(yk()))}const SR=n=>{for(let e of mk(n)){let t=Hc(n.state,e.from,e.to);if(t)return n.dispatch({effects:gk(n.state,[hd.of(t),Ok(n,t)])}),!0}return!1},kR=n=>{if(!n.state.field(ns,!1))return!1;let e=[];for(let t of mk(n)){let r=Kc(n.state,t.from,t.to);r&&e.push(ll.of(r),Ok(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function Ok(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return X.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const vR=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=Hc(e,i.from,i.to);s&&t.push(hd.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:gk(n.state,t)}),!!t.length},wR=n=>{let e=n.state.field(ns,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(ll.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},QR=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:SR},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:kR},{key:"Ctrl-Alt-[",run:vR},{key:"Ctrl-Alt-]",run:wR}],$R={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bk=W.define({combine(n){return Or(n,$R)}});function yk(n){return[ns,MR]}function xk(n,e){let{state:t}=n,r=t.facet(bk),i=o=>{let a=n.lineBlockAt(n.posAtDOM(o.target)),l=Kc(n.state,a.from,a.to);l&&n.dispatch({effects:ll.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const L0=U.replace({widget:new class extends zn{toDOM(n){return xk(n,null)}}});class CR extends zn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return xk(e,this.value)}}const PR={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class lh extends Wr{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function TR(n={}){let e={...PR,...n},t=new lh(e,!0),r=new lh(e,!1),i=it.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Oi)!=o.state.facet(Oi)||o.startState.field(ns,!1)!=o.state.field(ns,!1)||Ke(o.startState)!=Ke(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Lr;for(let l of o.viewportLineBlocks){let c=Kc(o.state,l.from,l.to)?r:Hc(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,qA({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||pe.empty},initialSpacer(){return new lh(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=Kc(o.state,a.from,a.to);if(c)return o.dispatch({effects:ll.of(c)}),!0;let d=Hc(o.state,a.from,a.to);return d?(o.dispatch({effects:hd.of(d)}),!0):!1}}}),yk()]}const MR=X.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ho{constructor(e,t){this.specs=e;let r;function i(a){let l=mi.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Ln?a=>a.prop(Ms)==o.data:o?a=>a==o:void 0,this.style=Px(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new mi(r):null,this.themeType=t.themeType}static define(e,t){return new ho(e,t||{})}}const Kf=W.define(),Sk=W.define({combine(n){return n.length?[n[0]]:null}});function ch(n){let e=n.facet(Kf);return e.length?e:n.facet(Sk)}function Am(n,e){let t=[RR],r;return n instanceof ho&&(n.module&&t.push(X.styleModule.of(n.module)),r=n.themeType),e?.fallback?t.push(Sk.of(n)):r?t.push(Kf.computeN([X.darkTheme],i=>i.facet(X.darkTheme)==(r=="dark")?[n]:[])):t.push(Kf.of(n)),t}class AR{constructor(e){this.markCache=Object.create(null),this.tree=Ke(e.state),this.decorations=this.buildDeco(e,ch(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Ke(e.state),r=ch(e.state),i=r!=ch(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return U.none;let r=new Lr;for(let{from:i,to:s}of e.visibleRanges)m5(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=U.mark({class:l})))},i,s);return r.finish()}}const RR=ki.high(it.fromClass(AR,{decorations:n=>n.decorations})),ER=ho.define([{tag:u.meta,color:"#404740"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,textDecoration:"underline",fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.strong,fontWeight:"bold"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.keyword,color:"#708"},{tag:[u.atom,u.bool,u.url,u.contentSeparator,u.labelName],color:"#219"},{tag:[u.literal,u.inserted],color:"#164"},{tag:[u.string,u.deleted],color:"#a11"},{tag:[u.regexp,u.escape,u.special(u.string)],color:"#e40"},{tag:u.definition(u.variableName),color:"#00f"},{tag:u.local(u.variableName),color:"#30a"},{tag:[u.typeName,u.namespace],color:"#085"},{tag:u.className,color:"#167"},{tag:[u.special(u.variableName),u.macroName],color:"#256"},{tag:u.definition(u.propertyName),color:"#00c"},{tag:u.comment,color:"#940"},{tag:u.invalid,color:"#f00"}]),NR=X.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),kk=1e4,vk="()[]{}",wk=W.define({combine(n){return Or(n,{afterCursor:!0,brackets:vk,maxScanDistance:kk,renderMatch:IR})}}),DR=U.mark({class:"cm-matchingBracket"}),jR=U.mark({class:"cm-nonmatchingBracket"});function IR(n){let e=[],t=n.matched?DR:jR;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function _0(n){let e=[],t=n.facet(wk);for(let r of n.selection.ranges){if(!r.empty)continue;let i=ar(n,r.head,-1,t)||r.head>0&&ar(n,r.head-1,1,t)||t.afterCursor&&(ar(n,r.head,1,t)||r.head<n.doc.length&&ar(n,r.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,n)))}return U.set(e,!0)}const XR=it.fromClass(class{constructor(n){this.paused=!1,this.decorations=_0(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=_0(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),LR=[XR,NR];function _R(n={}){return[wk.of(n),LR]}const Qk=new de;function Jf(n,e,t){let r=n.prop(e<0?de.openedBy:de.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function ep(n){let e=n.type.prop(Qk);return e?e(n.node):n}function ar(n,e,t,r={}){let i=r.maxScanDistance||kk,s=r.brackets||vk,o=Ke(n),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=Jf(l.type,t,s);if(c&&l.from<l.to){let d=ep(l);if(d&&(t>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return BR(n,e,t,l,d,c,s)}}return WR(n,e,t,o,a.type,i,s)}function BR(n,e,t,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,d=a?.cursor();if(d&&(t<0?d.childBefore(r.from):d.childAfter(r.to)))do if(t<0?d.to<=r.from:d.from>=r.to){if(c==0&&s.indexOf(d.type.name)>-1&&d.from<d.to){let h=ep(d);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Jf(d.type,t,o))c++;else if(Jf(d.type,-t,o)){if(c==0){let h=ep(d);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function WR(n,e,t,r,i,s,o){if(t<0?!e:e==n.doc.length)return null;let a=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},d=n.doc.iterRange(e,t>0?n.doc.length:0),h=0;for(let f=0;!d.next().done&&f<=s;){let p=d.value;t<0&&(f+=p.length);let m=e+f*t;for(let O=t>0?0:p.length-1,b=t>0?p.length:-1;O!=b;O+=t){let y=o.indexOf(p[O]);if(!(y<0||r.resolveInner(m+O,1).type!=i))if(y%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:m+O,to:m+O+1},matched:y>>1==l>>1};h--}}t>0&&(f+=p.length)}return d.done?{start:c,matched:!1}:null}const zR=Object.create(null),B0=[mn.none],W0=[],z0=Object.create(null),ZR=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ZR[n]=FR(zR,e);function uh(n,e){W0.indexOf(n)>-1||(W0.push(n),console.warn(e))}function FR(n,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=n[c]||u[c];d?typeof d=="function"?l.length?l=l.map(d):uh(c,`Modifier ${c} used at start of tag`):l.length?uh(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:uh(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=z0[i];if(s)return s.id;let o=z0[i]=mn.define({id:B0.length,name:r,props:[el({[r]:t})]});return B0.push(o),o.id}Re.RTL,Re.LTR;let dh=null;function hh(){if(!dh&&typeof document=="object"&&document.body){let{style:n}=document.body,e=[],t=new Set;for(let r in n)r!="cssText"&&r!="cssFloat"&&typeof n[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),t.has(r)||(e.push(r),t.add(r)));dh=e.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return dh||[]}const Z0=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(n=>({type:"class",label:n})),F0=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(n=>({type:"keyword",label:n})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(n=>({type:"constant",label:n}))),VR=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(n=>({type:"type",label:n})),YR=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(n=>({type:"keyword",label:n})),yr=/^(\w[\w-]*|-\w[\w-]*|)$/,qR=/^-(-[\w-]*)?$/;function UR(n,e){var t;if((n.name=="("||n.type.isError)&&(n=n.parent||n),n.name!="ArgList")return!1;let r=(t=n.parent)===null||t===void 0?void 0:t.firstChild;return r?.name!="Callee"?!1:e.sliceString(r.from,r.to)=="var"}const V0=new om,GR=["Declaration"];function HR(n){for(let e=n;;){if(e.type.isTop)return e;if(!(e=e.parent))return n}}function $k(n,e,t){if(e.to-e.from>4096){let r=V0.get(e);if(r)return r;let i=[],s=new Set,o=e.cursor(Oe.IncludeAnonymous);if(o.firstChild())do for(let a of $k(n,o.node,t))s.has(a.label)||(s.add(a.label),i.push(a));while(o.nextSibling());return V0.set(e,i),i}else{let r=[],i=new Set;return e.cursor().iterate(s=>{var o;if(t(s)&&s.matchContext(GR)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=n.sliceString(s.from,s.to);i.has(a)||(i.add(a),r.push({label:a,type:"variable"}))}}),r}}const KR=n=>e=>{let{state:t,pos:r}=e,i=Ke(t).resolveInner(r,-1),s=i.type.isError&&i.from==i.to-1&&t.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:hh(),validFor:yr};if(i.name=="ValueName")return{from:i.from,options:F0,validFor:yr};if(i.name=="PseudoClassName")return{from:i.from,options:Z0,validFor:yr};if(n(i)||(e.explicit||s)&&UR(i,t.doc))return{from:n(i)||s?i.from:r,options:$k(t.doc,HR(i),n),validFor:qR};if(i.name=="TagName"){for(let{parent:l}=i;l;l=l.parent)if(l.name=="Block")return{from:i.from,options:hh(),validFor:yr};return{from:i.from,options:VR,validFor:yr}}if(i.name=="AtKeyword")return{from:i.from,options:YR,validFor:yr};if(!e.explicit)return null;let o=i.resolve(r),a=o.childBefore(r);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:r,options:Z0,validFor:yr}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:r,options:F0,validFor:yr}:o.name=="Block"||o.name=="Styles"?{from:r,options:hh(),validFor:yr}:null},JR=KR(n=>n.name=="VariableName"),Jc=ts.define({name:"css",parser:F5.configure({props:[ol.add({Declaration:Xs()}),al.add({"Block KeyframeList":Mm})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Ck(){return new ud(Jc,Jc.data.of({autocomplete:JR}))}const eE=177,tE=179,nE=184,rE=12,iE=13,sE=17,oE=20,aE=25,lE=53,cE=95,uE=142,dE=144,hE=145,fE=148,pE=10,mE=13,gE=32,OE=9,Y0=47,bE=41,yE=125,xE=new nn((n,e)=>{for(let t=0,r=n.next;(e.context&&(r<0||r==pE||r==mE||r==Y0&&n.peek(t+1)==Y0)||r==bE||r==yE)&&n.acceptToken(eE),!(r!=gE&&r!=OE);)r=n.peek(++t)},{contextual:!0});let SE=new Set([cE,nE,oE,rE,sE,dE,hE,uE,fE,iE,lE,aE]);const kE=new am({start:!1,shift:(n,e)=>e==tE?n:SE.has(e)}),vE=el({"func interface struct chan map const type var":u.definitionKeyword,"import package":u.moduleKeyword,"switch for go select return break continue goto fallthrough case if else defer":u.controlKeyword,range:u.keyword,Bool:u.bool,String:u.string,Rune:u.character,Number:u.number,Nil:u.null,VariableName:u.variableName,DefName:u.definition(u.variableName),TypeName:u.typeName,LabelName:u.labelName,FieldName:u.propertyName,"FunctionDecl/DefName":u.function(u.definition(u.variableName)),"TypeSpec/DefName":u.definition(u.typeName),"CallExpr/VariableName":u.function(u.variableName),LineComment:u.lineComment,BlockComment:u.blockComment,LogicOp:u.logicOperator,ArithOp:u.arithmeticOperator,BitOp:u.bitwiseOperator,"DerefOp .":u.derefOperator,"UpdateOp IncDecOp":u.updateOperator,CompareOp:u.compareOperator,"= :=":u.definitionOperator,"<-":u.operator,'~ "*"':u.modifier,"; ,":u.separator,"... :":u.punctuation,"( )":u.paren,"[ ]":u.squareBracket,"{ }":u.brace}),wE={__proto__:null,package:10,import:18,true:380,false:380,nil:383,struct:48,func:68,interface:78,chan:94,map:118,make:157,new:159,const:204,type:212,var:224,if:236,else:238,switch:242,case:248,default:250,for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ructType struct } { StructBody FieldDecl FieldName , PointerType * FunctionType func Parameters Parameter ... InterfaceType interface InterfaceBody MethodElem UnderlyingType ~ TypeElem LogicOp ChannelType chan <- ParenthesizedType QualifiedType TypeName ParameterizedType ] [ TypeArgs ArrayType SliceType MapType map LiteralValue Element Key : Element Key ParenthesizedExpr FunctionLiteral Block Conversion SelectorExpr IndexExpr SliceExpr TypeAssertion CallExpr ParameterizedExpr Arguments CallExpr make new Arguments UnaryExp ArithOp LogicOp BitOp DerefOp BinaryExp ArithOp BitOp BitOp CompareOp LogicOp LogicOp SendStatement IncDecStatement IncDecOp Assignment = UpdateOp VarDecl := ConstDecl const ConstSpec SpecList TypeDecl type TypeSpec TypeParams TypeParam SpecList VarDecl var VarSpec SpecList LabeledStatement LabelName IfStatement if else SwitchStatement switch SwitchBlock Case case default TypeSwitchStatement SwitchBlock Case ForStatement for ForClause RangeClause range GoStatement go SelectStatement select SelectBlock Case ReceiveStatement ReturnStatement return GotoStatement break continue goto FallthroughStatement fallthrough DeferStatement defer FunctionDecl MethodDecl",maxTerm:218,context:kE,nodeProps:[["isolate",-3,2,12,20,""],["group",-18,12,17,18,19,20,21,22,66,67,69,70,71,72,73,74,77,81,86,"Expr",-20,16,68,93,94,96,99,101,105,111,115,117,120,126,129,134,136,141,143,147,149,"Statement",-12,23,31,33,38,46,49,50,51,52,56,57,58,"Type"],["openedBy",13,"(",25,"{",53,"["],["closedBy",14,")",26,"}",54,"]"]],propSources:[vE],skippedNodes:[0,1,2,153],repeatNodeCount:23,tokenData:":b~RvXY#iYZ#i]^#ipq#iqr#zrs$Xuv&Pvw&^wx&yxy(qyz(vz{({{|)T|})e}!O)j!O!P)u!P!Q+}!Q!R,y!R![-t![!]2^!]!^2k!^!_2p!_!`3]!`!a3e!c!}3x!}#O4j#P#Q4o#Q#R4t#R#S4|#S#T9X#T#o3x#o#p9q#p#q9v#q#r:W#r#s:]$g;'S3x;'S;=`4d<%lO3x~#nS$y~XY#iYZ#i]^#ipq#iU$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constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Ke(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(Mk(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function q0(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function $E(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=q0(e)+q0(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Rm(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:$E(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function Tk(n,e){return t=>{for(let r=Ke(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(n.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}class U0{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function Zi(n){return n.selection.main.from}function Mk(n,e){var t;let{source:r}=n,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?n:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Em=gr.define();function CE(n,e,t,r){let{main:i}=n.selection,s=t-i.from,o=r-i.from;return{...n.changeByRange(a=>{if(a!=i&&t!=r&&n.sliceDoc(a.from+s,a.from+o)!=n.sliceDoc(t,r))return{range:a};let l=n.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:l},range:A.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const G0=new WeakMap;function PE(n){if(!Array.isArray(n))return n;let e=G0.get(n);return e||G0.set(n,e=Rm(n)),e}const eu=oe.define(),Da=oe.define();class TE{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=Yt(e,t),i=rr(r);this.chars.push(r);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(Yt(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:s,byWord:o}=this;if(t.length==1){let S=Yt(e,0),x=rr(S),k=x==e.length?0:-100;if(S!=t[0])if(S==r[0])k+=-200;else return null;return this.ret(k,[0,x])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,c=0;if(a<0){for(let S=0,x=Math.min(e.length,200);S<x&&c<l;){let k=Yt(e,S);(k==t[c]||k==r[c])&&(i[c++]=S),S+=rr(k)}if(c<l)return null}let d=0,h=0,f=!1,p=0,m=-1,O=-1,b=/[a-z]/.test(e),y=!0;for(let S=0,x=Math.min(e.length,200),k=0;S<x&&h<l;){let v=Yt(e,S);a<0&&(d<l&&v==t[d]&&(s[d++]=S),p<l&&(v==t[p]||v==r[p]?(p==0&&(m=S),O=S+1,p++):p=0));let w,Q=v<255?v>=48&&v<=57||v>=97&&v<=122?2:v>=65&&v<=90?1:0:(w=cm(v))!=w.toLowerCase()?1:w!=w.toUpperCase()?2:0;(!S||Q==1&&b||k==0&&Q!=0)&&(t[h]==v||r[h]==v&&(f=!0)?o[h++]=S:o.length&&(y=!1)),k=Q,S+=rr(v)}return h==l&&o[0]==0&&y?this.result(-100+(f?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(O==e.length?0:-100),[0,O]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[m,O]):h==l?this.result(-100+(f?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],s=0;for(let o of t){let a=o+(this.astral?rr(Yt(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class ME{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const gt=W.define({combine(n){return Or(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:AE,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>H0(e(r),t(r)),optionClass:(e,t)=>r=>H0(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function H0(n,e){return n?e?n+" "+e:n:e}function AE(n,e,t,r,i,s){let o=n.textDirection==Re.RTL,a=o,l=!1,c="top",d,h,f=e.left-i.left,p=i.right-e.right,m=r.right-r.left,O=r.bottom-r.top;if(a&&f<Math.min(m,p)?a=!1:!a&&p<Math.min(m,f)&&(a=!0),m<=(a?f:p))d=Math.max(i.top,Math.min(t.top,i.bottom-O))-e.top,h=Math.min(400,a?f:p);else{l=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let S=i.bottom-e.bottom;S>=O||S>e.top?d=t.bottom-e.top:(c="bottom",d=e.bottom-t.top)}let b=(e.bottom-e.top)/s.offsetHeight,y=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${d/b}px; max-width: ${h/y}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const Nm=oe.define();function RE(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<s.length;){let d=s[c++],h=s[c++];d>l&&o.appendChild(document.createTextNode(a.slice(l,d)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(d,h))),f.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function fh(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let r=Math.ceil((n-e)/t);return{from:n-r*t,to:n-(r-1)*t}}class EE{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(gt);this.optionContent=RE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=fh(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(t).open;for(let d=l.target,h;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(h=/-(\d+)$/.exec(d.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}if(l.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(e.dispatch({effects:Nm.of(d)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(gt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Da.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=fh(s.length,o,e.state.facet(gt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=fh(t.options.length,t.selected,this.view.state.facet(gt).maxRenderedOptions),this.showOptions(t.options,e.id));let r=this.updateSelectedOption(t.selected);if(r){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>Ht(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return t&&DE(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(gt).positionInfo(this.view,t,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=f}}const d=i.appendChild(document.createElement("li"));d.id=t+"-"+o,d.setAttribute("role","option");let h=this.optionClass(a);h&&(d.className=h);for(let f of this.optionContent){let p=f(a,this.view.state,this.view,l);p&&d.appendChild(p)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function NE(n,e){return t=>new EE(t,n,e)}function DE(n,e){let t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.height/n.offsetHeight;r.top<t.top?n.scrollTop-=(t.top-r.top)/i:r.bottom>t.bottom&&(n.scrollTop+=(r.bottom-t.bottom)/i)}function K0(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function jE(n,e){let t=[],r=null,i=null,s=d=>{t.push(d);let{section:h}=d.completion;if(h){r||(r=[]);let f=typeof h=="string"?h:h.name;r.some(p=>p.name==f)||r.push(typeof h=="string"?{name:f}:h)}},o=e.facet(gt);for(let d of n)if(d.hasResult()){let h=d.result.getMatch;if(d.result.filter===!1)for(let f of d.result.options)s(new U0(f,d.source,h?h(f):[],1e9-t.length));else{let f=e.sliceDoc(d.from,d.to),p,m=o.filterStrict?new ME(f):new TE(f);for(let O of d.result.options)if(p=m.match(O.label)){let b=O.displayLabel?h?h(O,p.matched):[]:p.matched,y=p.score+(O.boost||0);if(s(new U0(O,d.source,b,y)),typeof O.section=="object"&&O.section.rank==="dynamic"){let{name:S}=O.section;i||(i=Object.create(null)),i[S]=Math.max(y,i[S]||-1e9)}}}}if(r){let d=Object.create(null),h=0,f=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?i[m.name]-i[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of r.sort(f))h-=1e5,d[p.name]=h;for(let p of t){let{section:m}=p.completion;m&&(p.score+=d[typeof m=="string"?m:m.name])}}let a=[],l=null,c=o.compareCompletions;for(let d of t.sort((h,f)=>f.score-h.score||c(h.completion,f.completion))){let h=d.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(d):K0(d.completion)>K0(l)&&(a[a.length-1]=d),l=d.completion}return a}class As{constructor(e,t,r,i,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new As(this.options,J0(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=jE(e,t);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=t.facet(gt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==c){l=d;break}}return new As(a,J0(r,l),{pos:e.reduce((c,d)=>d.hasResult()?Math.min(c,d.from):c,1e8),create:WE,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new As(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new As(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class tu{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new tu(_E,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(gt),s=(r.override||t.languageDataAt("autocomplete",Zi(t)).map(PE)).map(l=>(this.active.find(d=>d.source==l)||new Cn(l,this.active.some(d=>d.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let o=this.open,a=e.effects.some(l=>l.is(Dm));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!IE(s,this.active)||a?o=As.build(s,t,this.id,o,r,a):o&&o.disabled&&!s.some(l=>l.isPending)&&(o=null),!o&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Cn(l.source,0):l));for(let l of e.effects)l.is(Nm)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new tu(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XE:LE}}function IE(n,e){if(n==e)return!0;for(let t=0,r=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let i=t==n.length,s=r==e.length;if(i||s)return i==s;if(n[t++].result!=e[r++].result)return!1}}const XE={"aria-autocomplete":"list"},LE={};function J0(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const _E=[];function Ak(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(Em);if(r&&e.activateOnCompletion(r))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Cn{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=Ak(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new Cn(i.source,0)),r&4&&i.state==0&&(i=new Cn(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(eu))i=new Cn(i.source,1,s.value);else if(s.is(Da))i=new Cn(i.source,0);else if(s.is(Dm))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Zi(e.state))}}class Ls extends Cn{constructor(e,t,r,i,s,o){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Zi(e.state);if(a>o||!i||t&2&&(Zi(e.startState)==this.from||a<this.limit))return new Cn(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);return BE(i.validFor,e.state,s,o)?new Ls(this.source,this.explicit,l,i,s,o):i.update&&(i=i.update(i,s,o,new Pk(e.state,a,!1)))?new Ls(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:Zi(e.state)):new Cn(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new Ls(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new Cn(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function BE(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):Mk(n,!0).test(i)}const Dm=oe.define({map(n,e){return n.map(t=>t.map(e))}}),qt=Tt.define({create(){return tu.start()},update(n,e){return n.update(e)},provide:n=>[$m.from(n,e=>e.tooltip),X.contentAttributes.from(n,e=>e.attrs)]});function jm(n,e){const t=e.completion.apply||e.completion.label;let r=n.state.field(qt).active.find(i=>i.source==e.source);return r instanceof Ls?(typeof t=="string"?n.dispatch({...CE(n.state,t,r.from,r.to),annotations:Em.of(e.completion)}):t(n,e.completion,r.from,r.to),!0):!1}const WE=NE(qt,jm);function _l(n,e="option"){return t=>{let r=t.state.field(qt,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(gt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=nk(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:Nm.of(a)}),!0}}const zE=n=>{let e=n.state.field(qt,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(gt).interactionDelay?!1:jm(n,e.open.options[e.open.selected])},ph=n=>n.state.field(qt,!1)?(n.dispatch({effects:eu.of(!0)}),!0):!1,ZE=n=>{let e=n.state.field(qt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Da.of(null)}),!0)};class FE{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const VE=50,YE=1e3,qE=it.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(qt).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(qt),t=n.state.facet(gt);if(!n.selectionSet&&!n.docChanged&&n.startState.field(qt)==e)return;let r=n.transactions.some(s=>{let o=Ak(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>VE&&Date.now()-o.time>YE){for(let a of o.context.abortListeners)try{a()}catch(l){Ht(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(eu)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(qt);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gt).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Zi(e),r=new Pk(e,t,n.explicit,this.view),i=new FE(n,r);this.running.push(i),Promise.resolve(n.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Da.of(null)}),Ht(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gt).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(gt),r=this.view.state.field(qt);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let a=Zi(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(a,s.done.from+(s.active.explicit?0:1)),c=new Ls(s.active.source,s.active.explicit,l,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:a);for(let d of s.updates)c=c.update(d,t);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new Cn(s.active.source,0);for(let l of s.updates)a=a.update(l,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Dm.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(qt,!1);if(e&&e.tooltip&&this.view.state.facet(gt).closeOnBlur){let t=e.open&&nk(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Da.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:eu.of(!1)}),20),this.composing=0}}}),UE=typeof navigator=="object"&&/Win/.test(navigator.platform),GE=ki.highest(X.domEventHandlers({keydown(n,e){let t=e.state.field(qt,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(UE&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&jm(e,r),!1}})),Rk=X.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class HE{constructor(e,t,r,i){this.field=e,this.line=t,this.from=r,this.to=i}}class Im{constructor(e,t,r){this.field=e,this.from=t,this.to=r}map(e){let t=e.mapPos(this.from,-1,$t.TrackDel),r=e.mapPos(this.to,1,$t.TrackDel);return t==null||r==null?null:new Im(this.field,t,r)}}class Xm{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=o,d=/^\t*/.exec(l)[0].length;for(let h=0;h<d;h++)c+=e.facet(sl);i.push(t+c.length-d),l=c+l.slice(d)}r.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new Im(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let t=[],r=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1;a===0&&(a=1e9);let d=l.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h<t.length;h++)(a!=null?t[h].seq==a:d&&t[h].name==d)&&(c=h);if(c<0){let h=0;for(;h<t.length&&(a==null||t[h].seq!=null&&t[h].seq<a);)h++;t.splice(h,0,{seq:a,name:d}),c=h;for(let f of i)f.field>=c&&f.field++}for(let h of i)if(h.line==r.length&&h.from>s.index){let f=s[2]?3+(s[1]||"").length:2;h.from-=f,h.to-=f}i.push(new HE(c,r.length,s.index,s.index+d.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let d of i)d.line==r.length&&d.from>c&&(d.from--,d.to--);return l}),r.push(o)}return new Xm(r,i)}}let KE=U.widget({widget:new class extends zn{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),JE=U.mark({class:"cm-snippetField"});class fo{constructor(e,t){this.ranges=e,this.active=t,this.deco=U.set(e.map(r=>(r.from==r.to?KE:JE).range(r.from,r.to)),!0)}map(e){let t=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;t.push(i)}return new fo(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(r=>r.field==this.active&&r.from<=t.from&&r.to>=t.to))}}const cl=oe.define({map(n,e){return n&&n.map(e)}}),eN=oe.define(),ja=Tt.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(cl))return t.value;if(t.is(eN)&&n)return new fo(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>X.decorations.from(n,e=>e?e.deco:U.none)});function Lm(n,e){return A.create(n.filter(t=>t.field==e).map(t=>A.range(t.from,t.to)))}function tN(n){let e=Xm.parse(n);return(t,r,i,s)=>{let{text:o,ranges:a}=e.instantiate(t.state,i),{main:l}=t.state.selection,c={changes:{from:i,to:s==l.from?l.to:s,insert:ye.of(o)},scrollIntoView:!0,annotations:r?[Em.of(r),Wt.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=Lm(a,0)),a.some(d=>d.field>0)){let d=new fo(a,0),h=c.effects=[cl.of(d)];t.state.field(ja,!1)===void 0&&h.push(oe.appendConfig.of([ja,oN,aN,Rk]))}t.dispatch(t.state.update(c))}}function Ek(n){return({state:e,dispatch:t})=>{let r=e.field(ja,!1);if(!r||n<0&&r.active==0)return!1;let i=r.active+n,s=n>0&&!r.ranges.some(o=>o.field==i+n);return t(e.update({selection:Lm(r.ranges,i),effects:cl.of(s?null:new fo(r.ranges,i)),scrollIntoView:!0})),!0}}const nN=({state:n,dispatch:e})=>n.field(ja,!1)?(e(n.update({effects:cl.of(null)})),!0):!1,rN=Ek(1),iN=Ek(-1),sN=[{key:"Tab",run:rN,shift:iN},{key:"Escape",run:nN}],e1=W.define({combine(n){return n.length?n[0]:sN}}),oN=ki.highest(il.compute([e1],n=>n.facet(e1)));function ve(n,e){return{...e,apply:tN(n)}}const aN=X.domEventHandlers({mousedown(n,e){let t=e.state.field(ja,!1),r;if(!t||(r=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let i=t.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==t.active?!1:(e.dispatch({selection:Lm(t.ranges,i.field),effects:cl.of(t.ranges.some(s=>s.field>i.field)?new fo(t.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Ia={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ni=oe.define({map(n,e){let t=e.mapPos(n,-1,$t.TrackAfter);return t??void 0}}),_m=new class extends pi{};_m.startSide=1;_m.endSide=-1;const Nk=Tt.define({create(){return pe.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(Ni)&&(n=n.update({add:[_m.range(t.value,t.value+1)]}));return n}});function lN(){return[uN,Nk]}const mh="()[]{}<>«»»«[]{}";function Dk(n){for(let e=0;e<mh.length;e+=2)if(mh.charCodeAt(e)==n)return mh.charAt(e+1);return cm(n<128?n:n+1)}function jk(n,e){return n.languageDataAt("closeBrackets",e)[0]||Ia}const cN=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),uN=X.inputHandler.of((n,e,t,r)=>{if((cN?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&rr(Yt(r,0))==1||e!=i.from||t!=i.to)return!1;let s=fN(n.state,r);return s?(n.dispatch(s),!0):!1}),dN=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=jk(n,n.selection.main.head).brackets||Ia.brackets,i=null,s=n.changeByRange(o=>{if(o.empty){let a=pN(n.doc,o.head);for(let l of r)if(l==a&&fd(n.doc,o.head)==Dk(Yt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:A.cursor(o.head-l.length)}}return{range:i=o}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},hN=[{key:"Backspace",run:dN}];function fN(n,e){let t=jk(n,n.selection.main.head),r=t.brackets||Ia.brackets;for(let i of r){let s=Dk(Yt(i,0));if(e==i)return s==i?ON(n,i,r.indexOf(i+i+i)>-1,t):mN(n,i,s,t.before||Ia.before);if(e==s&&Ik(n,n.selection.main.from))return gN(n,i,s)}return null}function Ik(n,e){let t=!1;return n.field(Nk).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function fd(n,e){let t=n.sliceString(e,e+2);return t.slice(0,rr(Yt(t,0)))}function pN(n,e){let t=n.sliceString(e-2,e);return rr(Yt(t,0))==t.length?t:t.slice(1)}function mN(n,e,t,r){let i=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ni.of(o.to+e.length),range:A.range(o.anchor+e.length,o.head+e.length)};let a=fd(n.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Ni.of(o.head+e.length),range:A.cursor(o.head+e.length)}:{range:i=o}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function gN(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&fd(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:A.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function ON(n,e,t,r){let i=r.stringPrefixes||Ia.stringPrefixes,s=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ni.of(a.to+e.length),range:A.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=fd(n.doc,l),d;if(c==e){if(t1(n,l))return{changes:{insert:e+e,from:l},effects:Ni.of(l+e.length),range:A.cursor(l+e.length)};if(Ik(n,l)){let f=t&&n.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:A.cursor(l+f.length)}}}else{if(t&&n.sliceDoc(l-2*e.length,l)==e+e&&(d=n1(n,l-2*e.length,i))>-1&&t1(n,d))return{changes:{insert:e+e+e+e,from:l},effects:Ni.of(l+e.length),range:A.cursor(l+e.length)};if(n.charCategorizer(l)(c)!=Ue.Word&&n1(n,l,i)>-1&&!bN(n,l,e,i))return{changes:{insert:e+e,from:l},effects:Ni.of(l+e.length),range:A.cursor(l+e.length)}}return{range:s=a}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function t1(n,e){let t=Ke(n).resolveInner(e+1);return t.parent&&t.from==e}function bN(n,e,t,r){let i=Ke(n).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let d=i.firstChild;for(;d&&d.from==i.from&&d.to-d.from>t.length+l;){if(n.sliceDoc(d.to-t.length,d.to)==t)return!1;d=d.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function n1(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=Ue.Word)return e;for(let i of t){let s=e-i.length;if(n.sliceDoc(s,e)==i&&r(n.sliceDoc(s-1,s))!=Ue.Word)return s}return-1}function yN(n={}){return[GE,qt,gt.of(n),qE,xN,Rk]}const Xk=[{key:"Ctrl-Space",run:ph},{mac:"Alt-`",run:ph},{mac:"Alt-i",run:ph},{key:"Escape",run:ZE},{key:"ArrowDown",run:_l(!0)},{key:"ArrowUp",run:_l(!1)},{key:"PageDown",run:_l(!0,"page")},{key:"PageUp",run:_l(!1,"page")},{key:"Enter",run:zE}],xN=ki.highest(il.computeN([gt],n=>n.facet(gt).defaultKeymap?[Xk]:[])),SN=[ve("func ${name}(${params}) ${type} {\n ${}\n}",{label:"func",detail:"declaration",type:"keyword"}),ve("func (${receiver}) ${name}(${params}) ${type} {\n ${}\n}",{label:"func",detail:"method declaration",type:"keyword"}),ve("var ${name} = ${value}",{label:"var",detail:"declaration",type:"keyword"}),ve("type ${name} ${type}",{label:"type",detail:"declaration",type:"keyword"}),ve("const ${name} = ${value}",{label:"const",detail:"declaration",type:"keyword"}),ve("type ${name} = ${type}",{label:"type",detail:"alias declaration",type:"keyword"}),ve("for ${init}; ${test}; ${update} {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),ve("for ${i} := range ${value} {\n ${}\n}",{label:"for",detail:"range",type:"keyword"}),ve(`select {
55
- \${}
56
- }`,{label:"select",detail:"statement",type:"keyword"}),ve("case ${}:\n${}",{label:"case",type:"keyword"}),ve("switch ${} {\n ${}\n}",{label:"switch",detail:"statement",type:"keyword"}),ve("switch ${}.(${type}) {\n ${}\n}",{label:"switch",detail:"type statement",type:"keyword"}),ve("if ${} {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),ve(`if \${} {
57
- \${}
58
- } else {
59
- \${}
60
- }`,{label:"if",detail:"/ else block",type:"keyword"}),ve('import ${name} "${module}"\n${}',{label:"import",detail:"declaration",type:"keyword"})],r1=new om,Lk=new Set(["SourceFile","Block","FunctionDecl","MethodDecl","FunctionLiteral","ForStatement","SwitchStatement","TypeSwitchStatement","IfStatement"]);function ps(n,e){return(t,r)=>{e:for(let i=t.node.firstChild,s=0,o=null;;){for(;!i;){if(!s)break e;s--,i=o.nextSibling,o=o.parent}e&&i.name==e||i.name=="SpecList"?(s++,o=i,i=i.firstChild):(i.name=="DefName"&&r(i,n),i=i.nextSibling)}return!0}}const kN={FunctionDecl:ps("function"),VarDecl:ps("var","VarSpec"),ConstDecl:ps("constant","ConstSpec"),TypeDecl:ps("type","TypeSpec"),ImportDecl:ps("constant","ImportSpec"),Parameter:ps("var"),__proto__:null};function _k(n,e){let t=r1.get(e);if(t)return t;let r=[],i=!0;function s(o,a){let l=n.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(Oe.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=kN[o.name];if(a&&a(o,s)||Lk.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of _k(n,o.node))r.push(a);return!1}}),r1.set(e,r),r}const i1=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Bk=["String","LineComment","BlockComment","DefName","LabelName","FieldName",".","?."],vN=n=>{let e=Ke(n.state).resolveInner(n.pos,-1);if(Bk.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&i1.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let r=[];for(let i=e;i;i=i.parent)Lk.has(i.name)&&(r=r.concat(_k(n.state.doc,i)));return{options:r,from:t?e.from:n.pos,validFor:i1}},gh=ts.define({name:"go",parser:QE.configure({props:[ol.add({IfStatement:Xs({except:/^\s*({|else\b)/}),LabeledStatement:fk,"SwitchBlock SelectBlock":n=>{let e=n.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t||r?0:n.unit)},Block:dk({closing:"}"}),BlockComment:()=>null,Statement:Xs({except:/^{/})}),al.add({"Block SwitchBlock SelectBlock LiteralValue InterfaceType StructType SpecList":Mm,BlockComment(n){return{from:n.from+2,to:n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case\b|default\b|\})$/}});let wN=n=>({label:n,type:"keyword"});const QN="interface struct chan map package go return break continue goto fallthrough else defer range true false nil".split(" ").map(wN);function $N(){let n=SN.concat(QN);return new ud(gh,[gh.data.of({autocomplete:Tk(Bk,Rm(n))}),gh.data.of({autocomplete:vN})])}const CN=55,PN=1,TN=56,MN=2,AN=57,RN=3,s1=4,EN=5,Bm=6,Wk=7,zk=8,Zk=9,Fk=10,NN=11,DN=12,jN=13,Oh=58,IN=14,XN=15,o1=59,Vk=21,LN=23,Yk=24,_N=25,tp=27,qk=28,BN=29,WN=32,zN=35,ZN=37,FN=38,VN=0,YN=1,qN={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},UN={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},a1={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function GN(n){return n==45||n==46||n==58||n>=65&&n<=90||n==95||n>=97&&n<=122||n>=161}let l1=null,c1=null,u1=0;function np(n,e){let t=n.pos+e;if(u1==t&&c1==n)return l1;let r=n.peek(e),i="";for(;GN(r);)i+=String.fromCharCode(r),r=n.peek(++e);return c1=n,u1=t,l1=i?i.toLowerCase():r==HN||r==KN?void 0:null}const Uk=60,nu=62,Wm=47,HN=63,KN=33,JN=45;function d1(n,e){this.name=n,this.parent=e}const e4=[Bm,Fk,Wk,zk,Zk],t4=new am({start:null,shift(n,e,t,r){return e4.indexOf(e)>-1?new d1(np(r,1)||"",n):n},reduce(n,e){return e==Vk&&n?n.parent:n},reuse(n,e,t,r){let i=e.type.id;return i==Bm||i==ZN?new d1(np(r,1)||"",n):n},strict:!1}),n4=new nn((n,e)=>{if(n.next!=Uk){n.next<0&&e.context&&n.acceptToken(Oh);return}n.advance();let t=n.next==Wm;t&&n.advance();let r=np(n,0);if(r===void 0)return;if(!r)return n.acceptToken(t?XN:IN);let i=e.context?e.context.name:null;if(t){if(r==i)return n.acceptToken(NN);if(i&&UN[i])return n.acceptToken(Oh,-2);if(e.dialectEnabled(VN))return n.acceptToken(DN);for(let s=e.context;s;s=s.parent)if(s.name==r)return;n.acceptToken(jN)}else{if(r=="script")return n.acceptToken(Wk);if(r=="style")return n.acceptToken(zk);if(r=="textarea")return n.acceptToken(Zk);if(qN.hasOwnProperty(r))return n.acceptToken(Fk);i&&a1[i]&&a1[i][r]?n.acceptToken(Oh,-1):n.acceptToken(Bm)}},{contextual:!0}),r4=new nn(n=>{for(let e=0,t=0;;t++){if(n.next<0){t&&n.acceptToken(o1);break}if(n.next==JN)e++;else if(n.next==nu&&e>=2){t>=3&&n.acceptToken(o1,-2);break}else e=0;n.advance()}});function i4(n){for(;n;n=n.parent)if(n.name=="svg"||n.name=="math")return!0;return!1}const s4=new nn((n,e)=>{if(n.next==Wm&&n.peek(1)==nu){let t=e.dialectEnabled(YN)||i4(e.context);n.acceptToken(t?EN:s1,2)}else n.next==nu&&n.acceptToken(s1,1)});function zm(n,e,t){let r=2+n.length;return new nn(i=>{for(let s=0,o=0,a=0;;a++){if(i.next<0){a&&i.acceptToken(e);break}if(s==0&&i.next==Uk||s==1&&i.next==Wm||s>=2&&s<r&&i.next==n.charCodeAt(s-2))s++,o++;else if(s==r&&i.next==nu){a>o?i.acceptToken(e,-o):i.acceptToken(t,-(o-2));break}else if((i.next==10||i.next==13)&&a){i.acceptToken(e,1);break}else s=o=0;i.advance()}})}const o4=zm("script",CN,PN),a4=zm("style",TN,MN),l4=zm("textarea",AN,RN),c4=el({"Text RawText IncompleteTag IncompleteCloseTag":u.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":u.angleBracket,TagName:u.tagName,"MismatchedCloseTag/TagName":[u.tagName,u.invalid],AttributeName:u.attributeName,"AttributeValue UnquotedAttributeValue":u.attributeValue,Is:u.definitionOperator,"EntityReference CharacterReference":u.character,Comment:u.blockComment,ProcessingInst:u.processingInstruction,DoctypeDecl:u.documentMeta}),u4=Hi.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`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~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:t4,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[c4],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pTaPOv'kw!^'k!_;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#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[o4,a4,l4,s4,n4,r4,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function Gk(n,e){let t=Object.create(null);for(let r of n.getChildren(Yk)){let i=r.getChild(_N),s=r.getChild(tp)||r.getChild(qk);i&&(t[e.read(i.from,i.to)]=s?s.type.id==tp?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return t}function h1(n,e){let t=n.getChild(LN);return t?e.read(t.from,t.to):" "}function bh(n,e,t){let r;for(let i of t)if(!i.attrs||i.attrs(r||(r=Gk(n.node.parent.firstChild,e))))return{parser:i.parser,bracketed:!0};return null}function Hk(n=[],e=[]){let t=[],r=[],i=[],s=[];for(let a of n)(a.tag=="script"?t:a.tag=="style"?r:a.tag=="textarea"?i:s).push(a);let o=e.length?Object.create(null):null;for(let a of e)(o[a.name]||(o[a.name]=[])).push(a);return UT((a,l)=>{let c=a.type.id;if(c==BN)return bh(a,l,t);if(c==WN)return bh(a,l,r);if(c==zN)return bh(a,l,i);if(c==Vk&&s.length){let d=a.node,h=d.firstChild,f=h&&h1(h,l),p;if(f){for(let m of s)if(m.tag==f&&(!m.attrs||m.attrs(p||(p=Gk(h,l))))){let O=d.lastChild,b=O.type.id==FN?O.from:d.to;if(b>h.to)return{parser:m.parser,overlay:[{from:h.to,to:b}]}}}}if(o&&c==Yk){let d=a.node,h;if(h=d.firstChild){let f=o[l.read(h.from,h.to)];if(f)for(let p of f){if(p.tagName&&p.tagName!=h1(d.parent,l))continue;let m=d.lastChild;if(m.type.id==tp){let O=m.from+1,b=m.lastChild,y=m.to-(b&&b.isError?0:1);if(y>O)return{parser:p.parser,overlay:[{from:O,to:y}],bracketed:!0}}else if(m.type.id==qk)return{parser:p.parser,overlay:[{from:m.from,to:m.to}]}}}}return null})}const d4=317,h4=318,f1=1,f4=2,p4=3,m4=4,g4=319,O4=321,b4=322,y4=5,x4=6,S4=0,rp=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Kk=125,k4=59,ip=47,v4=42,w4=43,Q4=45,$4=60,C4=44,P4=63,T4=46,M4=91,A4=new am({start:!1,shift(n,e){return e==y4||e==x4||e==O4?n:e==b4},strict:!1}),R4=new nn((n,e)=>{let{next:t}=n;(t==Kk||t==-1||e.context)&&n.acceptToken(g4)},{contextual:!0,fallback:!0}),E4=new nn((n,e)=>{let{next:t}=n,r;rp.indexOf(t)>-1||t==ip&&((r=n.peek(1))==ip||r==v4)||t!=Kk&&t!=k4&&t!=-1&&!e.context&&n.acceptToken(d4)},{contextual:!0}),N4=new nn((n,e)=>{n.next==M4&&!e.context&&n.acceptToken(h4)},{contextual:!0}),D4=new nn((n,e)=>{let{next:t}=n;if(t==w4||t==Q4){if(n.advance(),t==n.next){n.advance();let r=!e.context&&e.canShift(f1);n.acceptToken(r?f1:f4)}}else t==P4&&n.peek(1)==T4&&(n.advance(),n.advance(),(n.next<48||n.next>57)&&n.acceptToken(p4))},{contextual:!0});function yh(n,e){return n>=65&&n<=90||n>=97&&n<=122||n==95||n>=192||!e&&n>=48&&n<=57}const j4=new nn((n,e)=>{if(n.next!=$4||!e.dialectEnabled(S4)||(n.advance(),n.next==ip))return;let t=0;for(;rp.indexOf(n.next)>-1;)n.advance(),t++;if(yh(n.next,!0)){for(n.advance(),t++;yh(n.next,!1);)n.advance(),t++;for(;rp.indexOf(n.next)>-1;)n.advance(),t++;if(n.next==C4)return;for(let r=0;;r++){if(r==7){if(!yh(n.next,!0))return;break}if(n.next!="extends".charCodeAt(r))break;n.advance(),t++}}n.acceptToken(m4,-t)}),I4=el({"get set async static":u.modifier,"for while do if else switch try catch finally return throw break continue default case defer":u.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":u.operatorKeyword,"let var const using function class extends":u.definitionKeyword,"import export from":u.moduleKeyword,"with debugger new":u.keyword,TemplateString:u.special(u.string),super:u.atom,BooleanLiteral:u.bool,this:u.self,null:u.null,Star:u.modifier,VariableName:u.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":u.function(u.variableName),VariableDefinition:u.definition(u.variableName),Label:u.labelName,PropertyName:u.propertyName,PrivatePropertyName:u.special(u.propertyName),"CallExpression/MemberExpression/PropertyName":u.function(u.propertyName),"FunctionDeclaration/VariableDefinition":u.function(u.definition(u.variableName)),"ClassDeclaration/VariableDefinition":u.definition(u.className),"NewExpression/VariableName":u.className,PropertyDefinition:u.definition(u.propertyName),PrivatePropertyDefinition:u.definition(u.special(u.propertyName)),UpdateOp:u.updateOperator,"LineComment Hashbang":u.lineComment,BlockComment:u.blockComment,Number:u.number,String:u.string,Escape:u.escape,ArithOp:u.arithmeticOperator,LogicOp:u.logicOperator,BitOp:u.bitwiseOperator,CompareOp:u.compareOperator,RegExp:u.regexp,Equals:u.definitionOperator,Arrow:u.function(u.punctuation),": Spread":u.punctuation,"( )":u.paren,"[ ]":u.squareBracket,"{ }":u.brace,"InterpolationStart InterpolationEnd":u.special(u.brace),".":u.derefOperator,", ;":u.separator,"@":u.meta,TypeName:u.typeName,TypeDefinition:u.definition(u.typeName),"type enum interface implements namespace module declare":u.definitionKeyword,"abstract global Privacy readonly override":u.modifier,"is keyof unique infer asserts":u.operatorKeyword,JSXAttributeValue:u.attributeValue,JSXText:u.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":u.angleBracket,"JSXIdentifier JSXNameSpacedName":u.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":u.attributeName,"JSXBuiltin/JSXIdentifier":u.standard(u.tagName)}),X4={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:237,private:237,protected:237,readonly:239,instanceof:258,satisfies:261,import:294,keyof:351,unique:355,infer:361,asserts:397,is:399,abstract:419,implements:421,type:423,let:426,var:428,using:431,interface:437,enum:441,namespace:447,module:449,declare:453,global:457,defer:473,for:478,of:487,while:490,with:494,do:498,if:502,else:504,switch:508,case:514,try:520,catch:524,finally:528,return:532,throw:536,break:540,continue:544,debugger:548},L4={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:403},_4={__proto__:null,"<":193},B4=Hi.deserialize({version:14,states:"$FvQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&j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U%gO~On3dO!_'aO%j3cO~Oh%VOn3dO!_'aO%j3cO~O#l%baP%baR%ba[%baa%baj%bar%ba!S%ba!l%ba!p%ba#R%ba#o%ba#p%ba#q%ba#r%ba#s%ba#t%ba#u%ba#v%ba#w%ba#y%ba#{%ba#|%ba'{%ba(b%ba(s%ba!k%ba!Y%ba'x%bav%ba!_%ba%j%ba!g%ba~P#LmO#l%daP%daR%da[%daa%daj%dar%da!S%da!l%da!p%da#R%da#o%da#p%da#q%da#r%da#s%da#t%da#u%da#v%da#w%da#y%da#{%da#|%da'{%da(b%da(s%da!k%da!Y%da'x%dav%da!_%da%j%da!g%da~P#M`O#l%baP%baR%ba[%baa%baj%bar%ba!S%ba!]%ba!l%ba!p%ba#R%ba#o%ba#p%ba#q%ba#r%ba#s%ba#t%ba#u%ba#v%ba#w%ba#y%ba#{%ba#|%ba'{%ba(b%ba(s%ba!k%ba!Y%ba'x%ba#`%bav%ba!_%ba%j%ba!g%ba~P#/eO#l%daP%daR%da[%daa%daj%dar%da!S%da!]%da!l%da!p%da#R%da#o%da#p%da#q%da#r%da#s%da#t%da#u%da#v%da#w%da#y%da#{%da#|%da'{%da(b%da(s%da!k%da!Y%da'x%da#`%dav%da!_%da%j%da!g%da~P#/eO#l}aP}a[}aa}aj}ar}a!l}a!p}a#R}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#w}a#y}a#{}a#|}a'{}a(b}a(s}a!k}a!Y}a'x}av}a!_}a%j}a!g}a~P$(TO#l$taP$taR$ta[$taa$taj$tar$ta!S$ta!l$ta!p$ta#R$ta#o$ta#p$ta#q$ta#r$ta#s$ta#t$ta#u$ta#v$ta#w$ta#y$ta#{$ta#|$ta'{$ta(b$ta(s$ta!k$ta!Y$ta'x$tav$ta!_$ta%j$ta!g$ta~P$)PO#l$vaP$vaR$va[$vaa$vaj$var$va!S$va!l$va!p$va#R$va#o$va#p$va#q$va#r$va#s$va#t$va#u$va#v$va#w$va#y$va#{$va#|$va'{$va(b$va(s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%lm,qR1l,ZR,i&gQ&U|S,P&V&WR1_,QR+u&PT&p!W&sT&q!W&sT2_,z2`",nodeNames:"⚠ ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty VariableDefinition Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:381,context:A4,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,208,212,216,217,219,222,225,235,238,244,246,248,250,253,259,265,267,269,271,273,275,276,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,121,122,137,140,142,143,144,145,146,148,149,168,170,172,"Expression",-23,31,33,37,41,43,45,174,176,178,179,181,182,183,185,186,187,189,190,191,202,204,206,207,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",161,"JSXStartCloseTag"],["closedBy",-2,24,169,">",40,"InterpolationEnd",50,"]",61,"}",74,")",166,"JSXEndTag"]],propSources:[I4],skippedNodes:[0,5,6,279],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$<r#p#q$=h#q#r$>x#r#s$@U#s$f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07[$D|k$j&j(Xp([!b(O0/l$^#t(U,2j(f$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[E4,N4,D4,j4,2,3,4,5,6,7,8,9,10,11,12,13,14,R4,new ka("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(d~~",141,341),new ka("j~RQYZXz{^~^O(R~~aP!P!Qd~iO(S~~",25,324)],topRules:{Script:[0,7],SingleExpression:[1,277],SingleClassItem:[2,278]},dialects:{jsx:0,ts:15152},dynamicPrecedences:{80:1,82:1,94:1,170:1,200:1},specialized:[{term:328,get:n=>X4[n]||-1},{term:344,get:n=>L4[n]||-1},{term:95,get:n=>_4[n]||-1}],tokenPrec:15178}),Jk=[ve("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),ve("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),ve("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),ve("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),ve("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),ve(`try {
61
- \${}
62
- } catch (\${error}) {
63
- \${}
64
- }`,{label:"try",detail:"/ catch block",type:"keyword"}),ve("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),ve(`if (\${}) {
65
- \${}
66
- } else {
67
- \${}
68
- }`,{label:"if",detail:"/ else block",type:"keyword"}),ve(`class \${name} {
69
- constructor(\${params}) {
70
- \${}
71
- }
72
- }`,{label:"class",detail:"definition",type:"keyword"}),ve('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),ve('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],W4=Jk.concat([ve("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),ve("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),ve("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),p1=new om,ev=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Qo(n){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,n),!0}}const z4=["FunctionDeclaration"],Z4={FunctionDeclaration:Qo("function"),ClassDeclaration:Qo("class"),ClassExpression:()=>!0,EnumDeclaration:Qo("constant"),TypeAliasDeclaration:Qo("type"),NamespaceDeclaration:Qo("namespace"),VariableDefinition(n,e){n.matchContext(z4)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function tv(n,e){let t=p1.get(e);if(t)return t;let r=[],i=!0;function s(o,a){let l=n.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(Oe.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=Z4[o.name];if(a&&a(o,s)||ev.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of tv(n,o.node))r.push(a);return!1}}),p1.set(e,r),r}const m1=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,nv=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function F4(n){let e=Ke(n.state).resolveInner(n.pos,-1);if(nv.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&m1.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let r=[];for(let i=e;i;i=i.parent)ev.has(i.name)&&(r=r.concat(tv(n.state.doc,i)));return{options:r,from:t?e.from:n.pos,validFor:m1}}const cr=ts.define({name:"javascript",parser:B4.configure({props:[ol.add({IfStatement:Xs({except:/^\s*({|else\b)/}),TryStatement:Xs({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:fk,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:r?1:2)*n.unit},Block:dk({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":Xs({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),al.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Mm,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,r=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:r.type.isError?n.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),rv={test:n=>/^JSX/.test(n.name),facet:lk({commentTokens:{block:{open:"{/*",close:"*/}"}}})},iv=cr.configure({dialect:"ts"},"typescript"),sv=cr.configure({dialect:"jsx",props:[Cm.add(n=>n.isTop?[rv]:void 0)]}),ov=cr.configure({dialect:"jsx ts",props:[Cm.add(n=>n.isTop?[rv]:void 0)]},"typescript");let av=n=>({label:n,type:"keyword"});const lv="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(av),V4=lv.concat(["declare","implements","private","protected","public"].map(av));function Y4(n={}){let e=n.jsx?n.typescript?ov:sv:n.typescript?iv:cr,t=n.typescript?W4.concat(V4):Jk.concat(lv);return new ud(e,[cr.data.of({autocomplete:Tk(nv,Rm(t))}),cr.data.of({autocomplete:F4}),n.jsx?G4:[]])}function q4(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function g1(n,e,t=n.length){for(let r=e?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return n.sliceString(r.from,Math.min(r.to,t));return""}const U4=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),G4=X.inputHandler.of((n,e,t,r,i)=>{if((U4?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||r!=">"&&r!="/"||!cr.isActiveAt(n.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:d}=l,h=Ke(o).resolveInner(d-1,-1),f;if(h.name=="JSXStartTag"&&(h=h.parent),!(o.doc.sliceString(d-1,d)!=r||h.name=="JSXAttributeValue"&&h.to>d)){if(r==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:d,insert:"</>"}};if(r=="/"&&h.name=="JSXStartCloseTag"){let p=h.parent,m=p.parent;if(m&&p.from==d-2&&((f=g1(o.doc,m.firstChild,d))||((c=m.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let O=`${f}>`;return{range:A.cursor(d+O.length,-1),changes:{from:d,insert:O}}}}else if(r==">"){let p=q4(h);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(d,d+2))&&(f=g1(o.doc,p,d)))return{range:l,changes:{from:d,insert:`</${f}>`}}}}return{range:l}});return a.changes.empty?!1:(n.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),$o=["_blank","_self","_top","_parent"],xh=["ascii","utf-8","utf-16","latin1","latin1"],Sh=["get","post","put","delete"],kh=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],an=["true","false"],Y={},H4={a:{attrs:{href:null,ping:null,type:null,media:null,target:$o,hreflang:null}},abbr:Y,address:Y,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Y,aside:Y,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Y,base:{attrs:{href:null,target:$o}},bdi:Y,bdo:Y,blockquote:{attrs:{cite:null}},body:Y,br:Y,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:kh,formmethod:Sh,formnovalidate:["novalidate"],formtarget:$o,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Y,center:Y,cite:Y,code:Y,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Y,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Y,div:Y,dl:Y,dt:Y,em:Y,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Y,figure:Y,footer:Y,form:{attrs:{action:null,name:null,"accept-charset":xh,autocomplete:["on","off"],enctype:kh,method:Sh,novalidate:["novalidate"],target:$o}},h1:Y,h2:Y,h3:Y,h4:Y,h5:Y,h6:Y,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Y,hgroup:Y,hr:Y,html:{attrs:{manifest:null}},i:Y,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:kh,formmethod:Sh,formnovalidate:["novalidate"],formtarget:$o,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Y,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Y,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Y,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:xh,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Y,noscript:Y,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Y,param:{attrs:{name:null,value:null}},pre:Y,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Y,rt:Y,ruby:Y,samp:Y,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:xh}},section:Y,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Y,source:{attrs:{src:null,type:null,media:null}},span:Y,strong:Y,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Y,summary:Y,sup:Y,table:Y,tbody:Y,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Y,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Y,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Y,time:{attrs:{datetime:null}},title:Y,tr:Y,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Y,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Y},cv={accesskey:null,class:null,contenteditable:an,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:an,autocorrect:an,autocapitalize:an,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":an,"aria-autocomplete":["inline","list","both","none"],"aria-busy":an,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":an,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":an,"aria-hidden":an,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":an,"aria-multiselectable":an,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":an,"aria-relevant":null,"aria-required":an,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},uv="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(n=>"on"+n);for(let n of uv)cv[n]=null;let ru=class{constructor(e,t){this.tags={...H4,...e},this.globalAttrs={...cv,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};ru.default=new ru;function rs(n,e,t=n.length){if(!e)return"";let r=e.firstChild,i=r&&r.getChild("TagName");return i?n.sliceString(i.from,Math.min(i.to,t)):""}function Ks(n,e=!1){for(;n;n=n.parent)if(n.name=="Element")if(e)e=!1;else return n;return null}function dv(n,e,t){let r=t.tags[rs(n,Ks(e))];return r?.children||t.allTags}function Zm(n,e){let t=[];for(let r=Ks(e);r&&!r.type.isTop;r=Ks(r.parent)){let i=rs(n,r);if(i&&r.lastChild.name=="CloseTag")break;i&&t.indexOf(i)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&t.push(i)}return t}const hv=/^[:\-\.\w\u00b7-\uffff]*$/;function O1(n,e,t,r,i){let s=/\s*>/.test(n.sliceDoc(i,i+5))?"":">",o=Ks(t,t.name=="StartTag"||t.name=="TagName");return{from:r,to:i,options:dv(n.doc,o,e).map(a=>({label:a,type:"type"})).concat(Zm(n.doc,t).map((a,l)=>({label:"/"+a,apply:"/"+a+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function b1(n,e,t,r){let i=/\s*>/.test(n.sliceDoc(r,r+5))?"":">";return{from:t,to:r,options:Zm(n.doc,e).map((s,o)=>({label:s,apply:s+i,type:"type",boost:99-o})),validFor:hv}}function K4(n,e,t,r){let i=[],s=0;for(let o of dv(n.doc,t,e))i.push({label:"<"+o,type:"type"});for(let o of Zm(n.doc,t))i.push({label:"</"+o+">",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function J4(n,e,t,r,i){let s=Ks(t),o=s?e.tags[rs(n.doc,s)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:i,options:l.map(c=>({label:c,type:"property"})),validFor:hv}}function eD(n,e,t,r,i){var s;let o=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),a=[],l;if(o){let c=n.sliceDoc(o.from,o.to),d=e.globalAttrs[c];if(!d){let h=Ks(t),f=h?e.tags[rs(n.doc,h)]:null;d=f?.attrs&&f.attrs[c]}if(d){let h=n.sliceDoc(r,i).toLowerCase(),f='"',p='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,f="",p=n.sliceDoc(i,i+1)==h[0]?"":h[0],h=h.slice(1),r++):l=/^[^\s<>='"]*$/;for(let m of d)a.push({label:m,apply:f+m+p,type:"constant"})}}return{from:r,to:i,options:a,validFor:l}}function tD(n,e){let{state:t,pos:r}=e,i=Ke(t).resolveInner(r,-1),s=i.resolve(r);for(let o=r,a;s==i&&(a=i.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.from<l.to)break;s=i=a,o=l.from}return i.name=="TagName"?i.parent&&/CloseTag$/.test(i.parent.name)?b1(t,i,i.from,r):O1(t,n,i,i.from,r):i.name=="StartTag"||i.name=="IncompleteTag"?O1(t,n,i,r,r):i.name=="StartCloseTag"||i.name=="IncompleteCloseTag"?b1(t,i,r,r):i.name=="OpenTag"||i.name=="SelfClosingTag"||i.name=="AttributeName"?J4(t,n,i,i.name=="AttributeName"?i.from:r,r):i.name=="Is"||i.name=="AttributeValue"||i.name=="UnquotedAttributeValue"?eD(t,n,i,i.name=="Is"?r:i.from,r):e.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?K4(t,n,i,r):null}function nD(n){let{extraTags:e,extraGlobalAttributes:t}=n,r=t||e?new ru(e,t):ru.default;return i=>tD(r,i)}const rD=cr.parser.configure({top:"SingleExpression"}),fv=[{tag:"script",attrs:n=>n.type=="text/typescript"||n.lang=="ts",parser:iv.parser},{tag:"script",attrs:n=>n.type=="text/babel"||n.type=="text/jsx",parser:sv.parser},{tag:"script",attrs:n=>n.type=="text/typescript-jsx",parser:ov.parser},{tag:"script",attrs(n){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(n.type)},parser:rD},{tag:"script",attrs(n){return!n.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(n.type)},parser:cr.parser},{tag:"style",attrs(n){return(!n.lang||n.lang=="css")&&(!n.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(n.type))},parser:Jc.parser}],pv=[{name:"style",parser:Jc.parser.configure({top:"Styles"})}].concat(uv.map(n=>({name:n,parser:cr.parser}))),mv=ts.define({name:"html",parser:u4.configure({props:[ol.add({Element(n){let e=/^(\s*)(<\/)?/.exec(n.textAfter);return n.node.to<=n.pos+e[0].length?n.continue():n.lineIndent(n.node.from)+(e[2]?0:n.unit)},"OpenTag CloseTag SelfClosingTag"(n){return n.column(n.node.from)+n.unit},Document(n){if(n.pos+/\s*/.exec(n.textAfter)[0].length<n.node.to)return n.continue();let e=null,t;for(let r=n.node;;){let i=r.lastChild;if(!i||i.name!="Element"||i.to!=r.to)break;e=r=i}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?n.lineIndent(e.from)+n.unit:null}}),al.add({Element(n){let e=n.firstChild,t=n.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:n.to}}}),Qk.add({"OpenTag CloseTag":n=>n.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),vc=mv.configure({wrap:Hk(fv,pv)});function iD(n={}){let e="",t;n.matchClosingTags===!1&&(e="noMatch"),n.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(n.nestedLanguages&&n.nestedLanguages.length||n.nestedAttributes&&n.nestedAttributes.length)&&(t=Hk((n.nestedLanguages||[]).concat(fv),(n.nestedAttributes||[]).concat(pv)));let r=t?mv.configure({wrap:t,dialect:e}):e?vc.configure({dialect:e}):vc;return new ud(r,[vc.data.of({autocomplete:nD(n)}),n.autoCloseTags!==!1?oD:[],Y4().support,Ck().support])}const y1=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function sD(n,e,t){for(var r;;){if(((r=e.lastChild)===null||r===void 0?void 0:r.name)!="CloseTag")return!1;let i=e.parent;if(!i||rs(n,i)!=t)return!0;e=i}}const oD=X.inputHandler.of((n,e,t,r,i)=>{if(n.composing||n.state.readOnly||e!=t||r!=">"&&r!="/"||!vc.isActiveAt(n.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let d=o.doc.sliceString(l.from-1,l.to)==r,{head:h}=l,f=Ke(o).resolveInner(h,-1),p;if(d&&r==">"&&f.name=="EndTag"){let m=f.parent;if((p=rs(o.doc,m.parent,h))&&!y1.has(p)&&!sD(o.doc,m.parent,p)){let O=h+(o.doc.sliceString(h,h+1)===">"?1:0),b=`</${p}>`;return{range:l,changes:{from:h,to:O,insert:b}}}}else if(d&&r=="/"&&f.name=="IncompleteCloseTag"){let m=f.parent;if(f.from==h-2&&((c=m.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(p=rs(o.doc,m,h))&&!y1.has(p)){let O=h+(o.doc.sliceString(h,h+1)===">"?1:0),b=`${p}>`;return{range:A.cursor(h+b.length,-1),changes:{from:h,to:O,insert:b}}}}return{range:l}});return a.changes.empty?!1:(n.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var ae=n=>{var e=n.theme,t=n.settings,r=t===void 0?{}:t,i=n.styles,s=i===void 0?[]:i,o={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),r.fontSize&&(a.fontSize=r.fontSize),(r.background||r.foreground)&&(o["&"]=a),r.fontFamily&&(o["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(o[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(o[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(o[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(o[".cm-content"]={caretColor:r.caret},o[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var l={};r.gutterActiveForeground&&(l.color=r.gutterActiveForeground),r.lineHighlight&&(o[".cm-activeLine"]={backgroundColor:r.lineHighlight},l.backgroundColor=r.lineHighlight),o[".cm-activeLineGutter"]=l,r.selection&&(o["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(o["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var c=X.theme(o,{dark:e==="dark"}),d=ho.define(s),h=[c,Am(d)];return h},aD={background:"#0f0f0f",foreground:"#defdef",caret:"#00FF00",selection:"#515151",selectionMatch:"#515151",gutterBackground:"#555",gutterForeground:"#FFFFFF",lineHighlight:"#0a6bcb3d"},lD=[{tag:u.keyword,color:"darkgoldenrod",fontWeight:"bold"},{tag:u.atom,color:"#77F"},{tag:u.comment,color:"#7a7b7c",fontStyle:"italic"},{tag:u.number,color:"violet"},{tag:u.definition(u.variableName),color:"#fffabc"},{tag:u.variableName,color:"#abcdef"},{tag:u.function(u.variableName),color:"#fffabc"},{tag:u.typeName,color:"#FFDD44"},{tag:u.tagName,color:"#def"},{tag:u.string,color:"#2b4"},{tag:u.meta,color:"#C9F"},{tag:u.bracket,color:"#8a8a8a"},{tag:u.attributeName,color:"#DDFF00"},{tag:u.heading,color:"aquamarine",fontWeight:"bold"},{tag:u.link,color:"blueviolet",fontWeight:"bold"}],cD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},aD,s),styles:[...lD,...a]})};cD();var Ne={background:"#000c18",foreground:"#6688cc",selection:"#770811",selectionMatch:"#770811",cursor:"#ddbb88",activeLine:"#0055ff30",keyword:"#225588",variable:"#2277ff",function:"#9966b8",string:"#22aa44",constant:"#f280d0",type:"#9966b8",class:"#ddbb88",number:"#f280d0",comment:"#384887",heading:"#6688cc",invalid:"#A22D44",regexp:"#22aa44",tag:"#225588"},uD={background:Ne.background,foreground:Ne.foreground,caret:Ne.cursor,selection:Ne.selection,selectionMatch:Ne.selectionMatch,gutterBackground:Ne.background,gutterForeground:Ne.foreground,lineHighlight:Ne.activeLine},dD=[{tag:u.keyword,color:Ne.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:Ne.variable},{tag:[u.propertyName],color:Ne.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Ne.string},{tag:[u.function(u.variableName),u.labelName],color:Ne.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Ne.constant},{tag:[u.definition(u.name),u.separator],color:Ne.variable},{tag:[u.className],color:Ne.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:Ne.number},{tag:[u.typeName],color:Ne.type,fontStyle:Ne.type},{tag:[u.operator,u.operatorKeyword],color:Ne.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:Ne.regexp},{tag:[u.meta,u.comment],color:Ne.comment},{tag:u.tagName,color:Ne.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Ne.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:Ne.variable},{tag:u.invalid,color:Ne.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],hD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},uD,s),styles:[...dD,...a]})};hD();var fD={background:"#282b2e",foreground:"#a9b7c6",caret:"#00FF00",selection:"#4e5254",selectionMatch:"#4e5254",lineHighlight:"#7f85891f"},pD=[{tag:[u.keyword,u.deleted,u.className],color:"#cc7832"},{tag:[u.number,u.literal,u.derefOperator],color:"#6897bb"},{tag:[u.link,u.variableName],color:"#629755"},{tag:[u.comment,u.quote],color:"grey"},{tag:[u.meta,u.documentMeta],color:"#bbb529"},{tag:[u.string,u.propertyName,u.attributeValue],color:"#6a8759"},{tag:[u.heading,u.typeName],color:"#ffc66d"},{tag:[u.attributeName],color:"#a9b7c6"},{tag:[u.emphasis],fontStyle:"italic"}],mD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},fD,s),styles:[...pD,...a]})};mD();var Pe={background:"#23262E",foreground:"#D5CED9",selection:"#db45a280",selectionMatch:"#db45a280",cursor:"#FFF",activeLine:"#596a992e",keyword:"#c74ded",variable:"#00e8c6",function:"#FFE66D",string:"#96E072",constant:"#ee5d43",type:"#FFE66D",class:"#FFE66D",number:"#ee5d43",comment:"#A0A1A7cc",heading:"#ff00aa",invalid:null,regexp:"#96E072",tag:"#f92672"},gD={background:Pe.background,foreground:Pe.foreground,caret:Pe.cursor,selection:Pe.selection,selectionMatch:Pe.selectionMatch,gutterBackground:Pe.background,gutterForeground:Pe.foreground,lineHighlight:Pe.activeLine},OD=[{tag:u.keyword,color:Pe.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:Pe.variable},{tag:[u.propertyName],color:Pe.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Pe.string},{tag:[u.function(u.variableName),u.labelName],color:Pe.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Pe.constant},{tag:[u.definition(u.name),u.separator],color:Pe.variable},{tag:[u.className],color:Pe.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:Pe.number},{tag:[u.typeName],color:Pe.type,fontStyle:Pe.type},{tag:[u.operator],color:Pe.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:Pe.regexp},{tag:[u.meta,u.comment],color:Pe.comment},{tag:u.tagName,color:Pe.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Pe.heading},{tag:[u.atom,u.special(u.variableName)],color:Pe.variable},{tag:u.invalid,color:Pe.invalid},{tag:u.strikethrough,textDecoration:"line-through"},{tag:[u.operatorKeyword,u.bool,u.null,u.variableName],color:Pe.constant}],bD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},gD,s),styles:[...OD,...a]})};bD();var yD={background:"#272C35",foreground:"#9d9b97",caret:"#797977",selection:"#3d4c64",selectionMatch:"#3d4c64",gutterBackground:"#272C35",gutterForeground:"#465063",gutterBorder:"transparent",lineHighlight:"#2e3f5940"},xD=[{tag:[u.function(u.variableName),u.function(u.propertyName),u.url,u.processingInstruction],color:"hsl(207, 82%, 66%)"},{tag:[u.tagName,u.heading],color:"#e06c75"},{tag:u.comment,color:"#54636D"},{tag:[u.propertyName],color:"hsl(220, 14%, 71%)"},{tag:[u.attributeName,u.number],color:"hsl( 29, 54%, 61%)"},{tag:u.className,color:"hsl( 39, 67%, 69%)"},{tag:u.keyword,color:"hsl(286, 60%, 67%)"},{tag:[u.string,u.regexp,u.special(u.propertyName)],color:"#98c379"}],SD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},yD,s),styles:[...xD,...a]})};SD();var kD={background:"#21202e",foreground:"#edecee",caret:"#a277ff",selection:"#5a51898f",selectionMatch:"#5a51898f",gutterBackground:"#21202e",gutterForeground:"#edecee",gutterBorder:"transparent",lineHighlight:"#a394f033"},vD=[{tag:u.keyword,color:"#a277ff"},{tag:[u.name,u.deleted,u.character,u.macroName],color:"#edecee"},{tag:[u.propertyName],color:"#ffca85"},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:"#61ffca"},{tag:[u.function(u.variableName),u.labelName],color:"#ffca85"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#61ffca"},{tag:[u.definition(u.name),u.separator],color:"#edecee"},{tag:[u.className],color:"#82e2ff"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#61ffca"},{tag:[u.typeName],color:"#82e2ff"},{tag:[u.operator,u.operatorKeyword],color:"#a277ff"},{tag:[u.url,u.escape,u.regexp,u.link],color:"#61ffca"},{tag:[u.meta,u.comment],color:"#6d6d6d"},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:"#a277ff"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#edecee"},{tag:u.invalid,color:"#ff6767"},{tag:u.strikethrough,textDecoration:"line-through"}],wD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},kD,s),styles:[...vD,...a]})};wD();var QD={background:"#2E3235",foreground:"#DDDDDD",caret:"#DDDDDD",selection:"#202325",selectionMatch:"#202325",gutterBackground:"#292d30",gutterForeground:"#808080",gutterBorder:"1px solid #ffffff10",lineHighlight:"#B9D2FF30"},$D=[{tag:u.keyword,color:"#fda331"},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:"#b5bd68"},{tag:[u.variableName],color:"#6fb3d2"},{tag:[u.function(u.variableName)],color:"#fda331"},{tag:[u.labelName],color:"#fc6d24"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#fda331"},{tag:[u.definition(u.name),u.separator],color:"#cc99cc"},{tag:[u.brace],color:"#cc99cc"},{tag:[u.annotation],color:"#fc6d24"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#fda331"},{tag:[u.typeName,u.className],color:"#6fb3d2"},{tag:[u.operator,u.operatorKeyword],color:"#cc99cc"},{tag:[u.tagName],color:"#fda331"},{tag:[u.squareBracket],color:"#cc99cc"},{tag:[u.angleBracket],color:"#cc99cc"},{tag:[u.attributeName],color:"#6fb3d2"},{tag:[u.regexp],color:"#fda331"},{tag:[u.quote],color:"#DDDDDD"},{tag:[u.string],color:"#b5bd68"},{tag:u.link,color:"#6987AF",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[u.url,u.escape,u.special(u.string)],color:"#8abeb7"},{tag:[u.meta],color:"#A54543"},{tag:[u.comment],color:"#808080",fontStyle:"italic"},{tag:u.monospace,color:"#DDDDDD"},{tag:u.strong,fontWeight:"bold",color:"#fda331"},{tag:u.emphasis,fontStyle:"italic",color:"#6fb3d2"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.heading,fontWeight:"bold",color:"#DDDDDD"},{tag:u.special(u.heading1),fontWeight:"bold",color:"#DDDDDD"},{tag:u.heading1,fontWeight:"bold",color:"#DDDDDD"},{tag:[u.heading2,u.heading3,u.heading4],fontWeight:"bold",color:"#DDDDDD"},{tag:[u.heading5,u.heading6],color:"#DDDDDD"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#8abeb7"},{tag:[u.processingInstruction,u.inserted],color:"#8abeb7"},{tag:[u.contentSeparator],color:"#6fb3d2"},{tag:u.invalid,color:"#B9D2FF",borderBottom:"1px dotted #fc6d24"}],CD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},QD,s),styles:[...$D,...a]})};CD();var PD={background:"#ffffff",foreground:"#2e3440",caret:"#3b4252",selection:"#eceff4",selectionMatch:"#e5e9f0",gutterBackground:"#eceff4",gutterForeground:"#2e3440",gutterBorder:"none",lineHighlight:"#02255f11"},TD=[{tag:u.keyword,color:"#5e81ac"},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:"#d08770"},{tag:[u.variableName],color:"#d08770"},{tag:[u.function(u.variableName)],color:"#5e81ac"},{tag:[u.labelName],color:"#81a1c1"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#5e81ac"},{tag:[u.definition(u.name),u.separator],color:"#a3be8c"},{tag:[u.brace],color:"#8fbcbb"},{tag:[u.annotation],color:"#d30102"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#88c0d0"},{tag:[u.typeName,u.className],color:"#ebcb8b"},{tag:[u.operator,u.operatorKeyword],color:"#a3be8c"},{tag:[u.tagName],color:"#b48ead"},{tag:[u.squareBracket],color:"#bf616a"},{tag:[u.angleBracket],color:"#d08770"},{tag:[u.attributeName],color:"#ebcb8b"},{tag:[u.regexp],color:"#5e81ac"},{tag:[u.quote],color:"#3b4252"},{tag:[u.string],color:"#d08770"},{tag:u.link,color:"#8fbcbb",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[u.url,u.escape,u.special(u.string)],color:"#d08770"},{tag:[u.meta],color:"#88c0d0"},{tag:[u.comment],color:"#434c5e",fontStyle:"italic"},{tag:u.strong,fontWeight:"bold",color:"#5e81ac"},{tag:u.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.heading,fontWeight:"bold",color:"#5e81ac"},{tag:u.special(u.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:u.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[u.heading2,u.heading3,u.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[u.heading5,u.heading6],color:"#5e81ac"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#d08770"},{tag:[u.processingInstruction,u.inserted],color:"#8fbcbb"},{tag:[u.contentSeparator],color:"#ebcb8b"},{tag:u.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],MD=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},PD,s),styles:[...TD,...a]})};MD();var AD={background:"#FFFFFF",foreground:"#000000",caret:"#FBAC52",selection:"#FFD420",selectionMatch:"#FFD420",gutterBackground:"#f5f5f5",gutterForeground:"#4D4D4C",gutterBorder:"transparent",lineHighlight:"#00000012"},RD=[{tag:[u.meta,u.comment],color:"#804000"},{tag:[u.keyword,u.strong],color:"#0000FF"},{tag:[u.number],color:"#FF0080"},{tag:[u.string],color:"#FF0080"},{tag:[u.variableName],color:"#006600"},{tag:[u.escape],color:"#33CC33"},{tag:[u.tagName],color:"#1C02FF"},{tag:[u.heading],color:"#0C07FF"},{tag:[u.quote],color:"#000000"},{tag:[u.list],color:"#B90690"},{tag:[u.documentMeta],color:"#888888"},{tag:[u.function(u.variableName)],color:"#0000A2"},{tag:[u.definition(u.typeName),u.typeName],color:"#6D79DE"}],ED=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},AD,s),styles:[...RD,...a]})};ED();var ND={background:"#28211c",foreground:"#9d9b97",caret:"#797977",selection:"#4f382b",selectionMatch:"#4f382b",gutterBackground:"#28211c",gutterForeground:"#666666",lineHighlight:"#ffffff1a"},DD=[{tag:[u.atom,u.number,u.link,u.bool],color:"#9b859d"},{tag:u.comment,color:"#937121"},{tag:[u.keyword,u.tagName],color:"#cf6a4c"},{tag:u.string,color:"#f9ee98"},{tag:u.bracket,color:"#9d9b97"},{tag:[u.variableName],color:"#5ea6ea"},{tag:u.definition(u.variableName),color:"#cf7d34"},{tag:[u.function(u.variableName),u.className],color:"#cf7d34"},{tag:[u.propertyName,u.attributeName],color:"#54be0d"}],jD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},ND,s),styles:[...DD,...a]})};jD();var ID={background:"#000",foreground:"#fff",caret:"#fff",selection:"#5c6c9b",selectionMatch:"#2a3967",gutterBackground:"#000",gutterForeground:"#ada9a9",gutterActiveForeground:"#fff",lineHighlight:"#82828275"},XD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},ID,s),styles:[...a]})};XD();var LD={background:"#fff",foreground:"#000",caret:"#000",selection:"#c2d2ff",selectionMatch:"#b1c1ef",gutterBackground:"#fff",gutterForeground:"#ada9a9",gutterActiveForeground:"#000",lineHighlight:"#c7c5c575"},_D=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},LD,s),styles:[...a]})};_D();var Te={background:"#232a2f",foreground:"#939da5",selection:"#204062",selectionMatch:"#204062",cursor:"#939da5",activeLine:"#4469832b",keyword:"#ba8ef7",variable:"#939da5",function:"#ffea6b",string:"#5bec95",constant:"#939da5",type:"#89ddff",class:"#ffea6b",number:"#89ddff",comment:"#707a84",heading:"#5bec95",invalid:"#ff6a80",regexp:"#56adb7",tag:"#ff6a80"},BD={background:Te.background,foreground:Te.foreground,caret:Te.cursor,selection:Te.selection,selectionMatch:Te.selectionMatch,gutterBackground:Te.background,gutterForeground:Te.foreground,lineHighlight:Te.activeLine},WD=[{tag:u.keyword,color:Te.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:Te.variable},{tag:[u.propertyName],color:Te.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Te.string},{tag:[u.function(u.variableName),u.labelName],color:Te.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Te.constant},{tag:[u.definition(u.name),u.separator],color:Te.variable},{tag:[u.className],color:Te.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:Te.number},{tag:[u.typeName],color:Te.type,fontStyle:Te.type},{tag:[u.operator],color:Te.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:Te.regexp},{tag:[u.meta,u.comment],color:Te.comment},{tag:u.tagName,color:Te.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Te.heading},{tag:[u.atom,u.special(u.variableName)],color:Te.variable},{tag:u.invalid,color:Te.invalid},{tag:u.strikethrough,textDecoration:"line-through"},{tag:[u.operatorKeyword,u.bool,u.null,u.variableName],color:Te.constant}],zD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},BD,s),styles:[...WD,...a]})};zD();var ZD={background:"#2B2B2B",foreground:"#f8f8f2",caret:"#FFFFFF",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"rgba(255, 255, 255, 0.1)",gutterForeground:"#999",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},FD=[{tag:[u.atom,u.number],color:"#bd93f9"},{tag:[u.comment],color:"#61A151"},{tag:[u.string],color:"#6A8759"},{tag:[u.variableName,u.operator],color:"#A9B7C6"},{tag:[u.meta,u.className],color:"#A9B7C6"},{tag:[u.propertyName],color:"#FFC66D"},{tag:[u.keyword],color:"#CC7832"},{tag:[u.tagName],color:"#ff79c6"},{tag:[u.typeName],color:"#ffb86c"}],VD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},ZD,s),styles:[...FD,...a]})};VD();var YD={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},qD=[{tag:u.comment,color:"#6272a4"},{tag:u.string,color:"#f1fa8c"},{tag:u.atom,color:"#bd93f9"},{tag:u.meta,color:"#f8f8f2"},{tag:[u.keyword,u.operator,u.tagName],color:"#ff79c6"},{tag:[u.function(u.propertyName),u.propertyName],color:"#66d9ef"},{tag:[u.definition(u.variableName),u.function(u.variableName),u.className,u.attributeName],color:"#50fa7b"},{tag:u.atom,color:"#bd93f9"}],UD=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},YD,s),styles:[...qD,...a]})};UD();var GD={background:"#faf8f5",foreground:"#b29762",caret:"#93abdc",selection:"#e3dcce",selectionMatch:"#e3dcce",gutterBackground:"#faf8f5",gutterForeground:"#cdc4b1",gutterBorder:"transparent",lineHighlight:"#ddceb154"},HD=[{tag:[u.comment,u.bracket],color:"#b6ad9a"},{tag:[u.atom,u.number,u.keyword,u.link,u.attributeName,u.quote],color:"#063289"},{tag:[u.emphasis,u.heading,u.tagName,u.propertyName,u.variableName],color:"#2d2006"},{tag:[u.typeName,u.url,u.string],color:"#896724"},{tag:[u.operator,u.string],color:"#1659df"},{tag:[u.propertyName],color:"#b29762"},{tag:[u.unit,u.punctuation],color:"#063289"}],KD=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},GD,s),styles:[...HD,...a]})};KD();var JD={background:"#2a2734",foreground:"#6c6783",caret:"#ffad5c",selection:"#91ff6c26",selectionMatch:"#91ff6c26",gutterBackground:"#2a2734",gutterForeground:"#545167",lineHighlight:"#36334280"},e9=[{tag:[u.comment,u.bracket],color:"#6c6783"},{tag:[u.atom,u.number,u.keyword,u.link,u.attributeName,u.quote],color:"#ffcc99"},{tag:[u.emphasis,u.heading,u.tagName,u.propertyName,u.className,u.variableName],color:"#eeebff"},{tag:[u.typeName,u.url],color:"#7a63ee"},{tag:u.operator,color:"#ffad5c"},{tag:u.string,color:"#ffb870"},{tag:[u.propertyName],color:"#9a86fd"},{tag:[u.unit,u.punctuation],color:"#e09142"}],t9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},JD,s),styles:[...e9,...a]})};t9();var n9={background:"#fff",foreground:"#000",caret:"#FFFFFF",selection:"#d7d4f0",selectionMatch:"#d7d4f0",gutterBackground:"#f7f7f7",gutterForeground:"#999",lineHighlight:"#006fff1c",gutterBorder:"transparent"},r9=[{tag:[u.comment],color:"#3F7F5F"},{tag:[u.documentMeta],color:"#FF1717"},{tag:u.keyword,color:"#7F0055",fontWeight:"bold"},{tag:u.atom,color:"#00f"},{tag:u.number,color:"#164"},{tag:u.propertyName,color:"#164"},{tag:[u.variableName,u.definition(u.variableName)],color:"#0000C0"},{tag:u.function(u.variableName),color:"#0000C0"},{tag:u.string,color:"#2A00FF"},{tag:u.operator,color:"black"},{tag:u.tagName,color:"#170"},{tag:u.attributeName,color:"#00c"},{tag:u.link,color:"#219"}],i9=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},n9,s),styles:[...r9,...a]})};i9();var s9={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},o9=[{tag:[u.standard(u.tagName),u.tagName],color:"#116329"},{tag:[u.comment,u.bracket],color:"#6a737d"},{tag:[u.className,u.propertyName],color:"#6f42c1"},{tag:[u.variableName,u.attributeName,u.number,u.operator],color:"#005cc5"},{tag:[u.keyword,u.typeName,u.typeOperator,u.typeName],color:"#d73a49"},{tag:[u.string,u.meta,u.regexp],color:"#032f62"},{tag:[u.name,u.quote],color:"#22863a"},{tag:[u.heading,u.strong],color:"#24292e",fontWeight:"bold"},{tag:[u.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[u.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#e36209"},{tag:[u.url,u.escape,u.regexp,u.link],color:"#032f62"},{tag:u.link,textDecoration:"underline"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.invalid,color:"#cb2431"}],a9=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},s9,s),styles:[...o9,...a]})};a9();var l9={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},c9=[{tag:[u.standard(u.tagName),u.tagName],color:"#7ee787"},{tag:[u.comment,u.bracket],color:"#8b949e"},{tag:[u.className,u.propertyName],color:"#d2a8ff"},{tag:[u.variableName,u.attributeName,u.number,u.operator],color:"#79c0ff"},{tag:[u.keyword,u.typeName,u.typeOperator,u.typeName],color:"#ff7b72"},{tag:[u.string,u.meta,u.regexp],color:"#a5d6ff"},{tag:[u.name,u.quote],color:"#7ee787"},{tag:[u.heading,u.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[u.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[u.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#ffab70"},{tag:u.link,textDecoration:"underline"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.invalid,color:"#f97583"}],u9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},l9,s),styles:[...c9,...a]})};u9();var d9={background:"#282828",foreground:"#ebdbb2",caret:"#ebdbb2",selection:"#b99d555c",selectionMatch:"#b99d555c",lineHighlight:"#baa1602b",gutterBackground:"#282828",gutterForeground:"#7c6f64"},h9=[{tag:u.keyword,color:"#fb4934"},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:"#8ec07c"},{tag:[u.variableName],color:"#83a598"},{tag:[u.function(u.variableName)],color:"#b8bb26",fontStyle:"bold"},{tag:[u.labelName],color:"#ebdbb2"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#d3869b"},{tag:[u.definition(u.name),u.separator],color:"#ebdbb2"},{tag:[u.brace],color:"#ebdbb2"},{tag:[u.annotation],color:"#fb4934d"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#d3869b"},{tag:[u.typeName,u.className],color:"#fabd2f"},{tag:[u.operator,u.operatorKeyword],color:"#fb4934"},{tag:[u.tagName],color:"#8ec07c",fontStyle:"bold"},{tag:[u.squareBracket],color:"#fe8019"},{tag:[u.angleBracket],color:"#83a598"},{tag:[u.attributeName],color:"#8ec07c"},{tag:[u.regexp],color:"#8ec07c"},{tag:[u.quote],color:"#928374"},{tag:[u.string],color:"#ebdbb2"},{tag:u.link,color:"#a89984",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[u.url,u.escape,u.special(u.string)],color:"#d3869b"},{tag:[u.meta],color:"#fabd2f"},{tag:[u.comment],color:"#928374",fontStyle:"italic"},{tag:u.strong,fontWeight:"bold",color:"#fe8019"},{tag:u.emphasis,fontStyle:"italic",color:"#b8bb26"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.heading,fontWeight:"bold",color:"#b8bb26"},{tag:[u.heading1,u.heading2],fontWeight:"bold",color:"#b8bb26"},{tag:[u.heading3,u.heading4],fontWeight:"bold",color:"#fabd2f"},{tag:[u.heading5,u.heading6],color:"#fabd2f"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#d3869b"},{tag:[u.processingInstruction,u.inserted],color:"#83a598"},{tag:[u.contentSeparator],color:"#fb4934"},{tag:u.invalid,color:"#fe8019",borderBottom:"1px dotted #fb4934d"}],f9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},d9,s),styles:[...h9,...a]})};f9();var p9={background:"#fbf1c7",foreground:"#3c3836",caret:"#af3a03",selection:"#bdae9391",selectionMatch:"#bdae9391",lineHighlight:"#a37f2238",gutterBackground:"#ebdbb2",gutterForeground:"#665c54",gutterBorder:"transparent"},m9=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},p9,s),styles:[{tag:u.keyword,color:"#9d0006"},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:"#427b58"},{tag:[u.variableName],color:"#076678"},{tag:[u.function(u.variableName)],color:"#79740e",fontStyle:"bold"},{tag:[u.labelName],color:"#3c3836"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#8f3f71"},{tag:[u.definition(u.name),u.separator],color:"#3c3836"},{tag:[u.brace],color:"#3c3836"},{tag:[u.annotation],color:"#9d0006"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#8f3f71"},{tag:[u.typeName,u.className],color:"#b57614"},{tag:[u.operator,u.operatorKeyword],color:"#9d0006"},{tag:[u.tagName],color:"#427b58",fontStyle:"bold"},{tag:[u.squareBracket],color:"#af3a03"},{tag:[u.angleBracket],color:"#076678"},{tag:[u.attributeName],color:"#427b58"},{tag:[u.regexp],color:"#427b58"},{tag:[u.quote],color:"#928374"},{tag:[u.string],color:"#3c3836"},{tag:u.link,color:"#7c6f64",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[u.url,u.escape,u.special(u.string)],color:"#8f3f71"},{tag:[u.meta],color:"#b57614"},{tag:[u.comment],color:"#928374",fontStyle:"italic"},{tag:u.strong,fontWeight:"bold",color:"#af3a03"},{tag:u.emphasis,fontStyle:"italic",color:"#79740e"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.heading,fontWeight:"bold",color:"#79740e"},{tag:[u.heading1,u.heading2],fontWeight:"bold",color:"#79740e"},{tag:[u.heading3,u.heading4],fontWeight:"bold",color:"#b57614"},{tag:[u.heading5,u.heading6],color:"#b57614"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#8f3f71"},{tag:[u.processingInstruction,u.inserted],color:"#076678"},{tag:[u.contentSeparator],color:"#9d0006"},{tag:u.invalid,color:"#af3a03",borderBottom:"1px dotted #9d0006"},...a]})};m9();var De={background:"#221a0f",foreground:"#d3af86",selection:"#84613daa",cursor:"#d3af86",activeLine:"#5e452b52",keyword:"#98676a",variable:"#dc3958",function:"#7e602c",string:"#889b4a",constant:"#f79a32",type:"#f06431",class:"#f06431",number:"#f79a32",comment:"#a57a4c",heading:"#8ab1b0",invalid:"#dc3958",regexp:"#7e602c",tag:"#dc3958"},g9={background:De.background,foreground:De.foreground,caret:De.cursor,selection:De.selection,selectionMatch:De.selection,gutterBackground:De.background,gutterForeground:De.foreground,lineHighlight:De.activeLine},O9=[{tag:u.keyword,color:De.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:De.variable},{tag:[u.propertyName],color:De.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:De.string},{tag:[u.function(u.variableName),u.labelName],color:De.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:De.constant},{tag:[u.definition(u.name),u.separator],color:De.variable},{tag:[u.className],color:De.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:De.number},{tag:[u.typeName],color:De.type,fontStyle:De.type},{tag:[u.operator,u.operatorKeyword],color:De.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:De.regexp},{tag:[u.meta,u.comment],color:De.comment},{tag:u.tagName,color:De.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:De.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:De.variable},{tag:u.invalid,color:De.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],b9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},g9,s),styles:[...O9,...a]})};b9();var y9={background:"#2e3235",foreground:"#bdbdbd",caret:"#a0a4ae",selection:"#d7d4f063",selectionMatch:"#d7d4f063",gutterBackground:"#2e3235",gutterForeground:"#999",gutterActiveForeground:"#4f5b66",lineHighlight:"#545b6130"},x9=[{tag:u.keyword,color:"#cf6edf"},{tag:[u.name,u.deleted,u.character,u.macroName],color:"#56c8d8"},{tag:[u.propertyName],color:"#facf4e"},{tag:[u.variableName],color:"#bdbdbd"},{tag:[u.function(u.variableName)],color:"#56c8d8"},{tag:[u.labelName],color:"#cf6edf"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#facf4e"},{tag:[u.definition(u.name),u.separator],color:"#fa5788"},{tag:[u.brace],color:"#cf6edf"},{tag:[u.annotation],color:"#ff5f52"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#ffad42"},{tag:[u.typeName,u.className],color:"#ffad42"},{tag:[u.operator,u.operatorKeyword],color:"#7186f0"},{tag:[u.tagName],color:"#99d066"},{tag:[u.squareBracket],color:"#ff5f52"},{tag:[u.angleBracket],color:"#606f7a"},{tag:[u.attributeName],color:"#bdbdbd"},{tag:[u.regexp],color:"#ff5f52"},{tag:[u.quote],color:"#6abf69"},{tag:[u.string],color:"#99d066"},{tag:u.link,color:"#56c8d8",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[u.url,u.escape,u.special(u.string)],color:"#facf4e"},{tag:[u.meta],color:"#707d8b"},{tag:[u.comment],color:"#707d8b",fontStyle:"italic"},{tag:u.monospace,color:"#bdbdbd"},{tag:u.strong,fontWeight:"bold",color:"#ff5f52"},{tag:u.emphasis,fontStyle:"italic",color:"#99d066"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.heading,fontWeight:"bold",color:"#facf4e"},{tag:u.heading1,fontWeight:"bold",color:"#facf4e"},{tag:[u.heading2,u.heading3,u.heading4],fontWeight:"bold",color:"#facf4e"},{tag:[u.heading5,u.heading6],color:"#facf4e"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#56c8d8"},{tag:[u.processingInstruction,u.inserted],color:"#ff5f52"},{tag:[u.contentSeparator],color:"#56c8d8"},{tag:u.invalid,color:"#606f7a",borderBottom:"1px dotted #ff5f52"}],gv=n=>{var e=n||{},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},y9,s),styles:[...x9,...a]})};gv();gv();var S9={background:"#FAFAFA",foreground:"#90A4AE",caret:"#272727",selection:"#80CBC440",selectionMatch:"#80CBC440",gutterBackground:"#FAFAFA",gutterForeground:"#90A4AE",gutterBorder:"transparent",lineHighlight:"#CCD7DA50"},k9=[{tag:u.keyword,color:"#39ADB5"},{tag:[u.name,u.deleted,u.character,u.macroName],color:"#90A4AE"},{tag:[u.propertyName],color:"#6182B8"},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:"#91B859"},{tag:[u.function(u.variableName),u.labelName],color:"#6182B8"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#39ADB5"},{tag:[u.definition(u.name),u.separator],color:"#90A4AE"},{tag:[u.className],color:"#E2931D"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#F76D47"},{tag:[u.typeName],color:"#E2931D",fontStyle:"#E2931D"},{tag:[u.operator,u.operatorKeyword],color:"#39ADB5"},{tag:[u.url,u.escape,u.regexp,u.link],color:"#91B859"},{tag:[u.meta,u.comment],color:"#90A4AE"},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:"#39ADB5"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#90A4AE"},{tag:u.invalid,color:"#E5393570"},{tag:u.strikethrough,textDecoration:"line-through"}],v9=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},S9,s),styles:[...k9,...a]})};v9();var je={background:"#272822",foreground:"#f8f8f2",selection:"#4a4a76",cursor:"#f8f8f0",activeLine:"#3e3d3257",keyword:"#F92672",variable:"#FD971F",function:"#66D9EF",string:"#E6DB74",constant:"#AE81FF",type:"#66D9EF",class:"#A6E22E",number:"#AE81FF",comment:"#88846f",heading:"#A6E22E",invalid:"#F44747",regexp:"#E6DB74",tag:"#F92672"},w9={background:je.background,foreground:je.foreground,caret:je.cursor,selection:je.selection,selectionMatch:je.selection,gutterBackground:je.background,gutterForeground:je.foreground,lineHighlight:je.activeLine},Q9=[{tag:u.keyword,color:je.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:je.variable},{tag:[u.propertyName],color:je.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:je.string},{tag:[u.function(u.variableName),u.labelName],color:je.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:je.constant},{tag:[u.definition(u.name),u.separator],color:je.variable},{tag:[u.className],color:je.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:je.number},{tag:[u.typeName],color:je.type,fontStyle:je.type},{tag:[u.operator,u.operatorKeyword],color:je.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:je.regexp},{tag:[u.meta,u.comment],color:je.comment},{tag:u.tagName,color:je.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:je.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:je.variable},{tag:u.invalid,color:je.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],$9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},w9,s),styles:[...Q9,...a]})};$9();var Ie={background:"#1e1e1e",foreground:"#c5c8c6",selection:"#4747a1",cursor:"#c07020",activeLine:"#30303078",keyword:"#676867",variable:"#c7444a",function:"#9872A2",string:"#D08442",constant:"#8080FF",type:"#9B0000",class:"#CE6700",number:"#6089B4",comment:"#9A9B99",heading:"#D0B344",invalid:"#FF0B00",regexp:"#D08442",tag:"#6089B4"},C9={background:Ie.background,foreground:Ie.foreground,caret:Ie.cursor,selection:Ie.selection,selectionMatch:Ie.selection,gutterBackground:Ie.background,gutterForeground:Ie.foreground,lineHighlight:Ie.activeLine},P9=[{tag:u.keyword,color:Ie.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:Ie.variable},{tag:[u.propertyName],color:Ie.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Ie.string},{tag:[u.function(u.variableName),u.labelName],color:Ie.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Ie.constant},{tag:[u.definition(u.name),u.separator],color:Ie.variable},{tag:[u.className],color:Ie.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:Ie.number},{tag:[u.typeName],color:Ie.type,fontStyle:Ie.type},{tag:[u.operator,u.operatorKeyword],color:Ie.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:Ie.regexp},{tag:[u.meta,u.comment],color:Ie.comment},{tag:u.tagName,color:Ie.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Ie.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:Ie.variable},{tag:u.invalid,color:Ie.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],T9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},C9,s),styles:[...P9,...a]})};T9();var M9={background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",selectionMatch:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#16067911"},A9=[{tag:u.comment,color:"#9995b7"},{tag:u.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[u.definitionKeyword,u.modifier],color:"#ff5792"},{tag:[u.className,u.tagName,u.definition(u.typeName)],color:"#0094f0"},{tag:[u.number,u.bool,u.null,u.special(u.brace)],color:"#5842ff"},{tag:[u.definition(u.propertyName),u.function(u.variableName)],color:"#0095a8"},{tag:u.typeName,color:"#b3694d"},{tag:[u.propertyName,u.variableName],color:"#fa8900"},{tag:u.operator,color:"#ff5792"},{tag:u.self,color:"#e64100"},{tag:[u.string,u.regexp],color:"#00b368"},{tag:[u.paren,u.bracket],color:"#0431fa"},{tag:u.labelName,color:"#00bdd6"},{tag:u.attributeName,color:"#e64100"},{tag:u.angleBracket,color:"#9995b7"}],R9=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},M9,s),styles:[...A9,...a]})};R9();var E9={background:"#2e3440",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#00000073",selectionMatch:"#00000073",gutterBackground:"#2e3440",gutterForeground:"#4c566a",gutterActiveForeground:"#d8dee9",lineHighlight:"#4c566a29"},N9=[{tag:u.keyword,color:"#5e81ac"},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:"#88c0d0"},{tag:[u.variableName],color:"#8fbcbb"},{tag:[u.function(u.variableName)],color:"#8fbcbb"},{tag:[u.labelName],color:"#81a1c1"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#5e81ac"},{tag:[u.definition(u.name),u.separator],color:"#a3be8c"},{tag:[u.brace],color:"#8fbcbb"},{tag:[u.annotation],color:"#d30102"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#b48ead"},{tag:[u.typeName,u.className],color:"#ebcb8b"},{tag:[u.operator,u.operatorKeyword],color:"#a3be8c"},{tag:[u.tagName],color:"#b48ead"},{tag:[u.squareBracket],color:"#bf616a"},{tag:[u.angleBracket],color:"#d08770"},{tag:[u.attributeName],color:"#ebcb8b"},{tag:[u.regexp],color:"#5e81ac"},{tag:[u.quote],color:"#b48ead"},{tag:[u.string],color:"#a3be8c"},{tag:u.link,color:"#a3be8c",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[u.url,u.escape,u.special(u.string)],color:"#8fbcbb"},{tag:[u.meta],color:"#88c0d0"},{tag:[u.monospace],color:"#d8dee9",fontStyle:"italic"},{tag:[u.comment],color:"#4c566a",fontStyle:"italic"},{tag:u.strong,fontWeight:"bold",color:"#5e81ac"},{tag:u.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.heading,fontWeight:"bold",color:"#5e81ac"},{tag:u.special(u.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:u.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[u.heading2,u.heading3,u.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[u.heading5,u.heading6],color:"#5e81ac"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#d08770"},{tag:[u.processingInstruction,u.inserted],color:"#8fbcbb"},{tag:[u.contentSeparator],color:"#ebcb8b"},{tag:u.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],D9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},E9,s),styles:[...N9,...a]})};D9();var j9={background:"#272822",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#49483E",selectionMatch:"#49483E",gutterBackground:"#272822",gutterForeground:"#FFFFFF70",lineHighlight:"#0000003b"},I9=[{tag:[u.comment,u.documentMeta],color:"#8292a2"},{tag:[u.number,u.bool,u.null,u.atom],color:"#ae81ff"},{tag:[u.attributeValue,u.className,u.name],color:"#e6db74"},{tag:[u.propertyName,u.attributeName],color:"#a6e22e"},{tag:[u.variableName],color:"#9effff"},{tag:[u.squareBracket],color:"#bababa"},{tag:[u.string,u.special(u.brace)],color:"#e6db74"},{tag:[u.regexp,u.className,u.typeName,u.definition(u.typeName)],color:"#66d9ef"},{tag:[u.definition(u.variableName),u.definition(u.propertyName),u.function(u.variableName)],color:"#fd971f"},{tag:[u.keyword,u.definitionKeyword,u.modifier,u.tagName,u.angleBracket],color:"#f92672"}],X9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},j9,s),styles:[...I9,...a]})};X9();var Xe={background:"#F5F5F5",foreground:"#333333",selection:"#C9D0D9",cursor:"#54494B",activeLine:"#79ff002b",keyword:"#4B69C6",variable:"#7A3E9D",function:"#AA3731",string:"#448C27",constant:"#9C5D27",type:"#7A3E9D",class:"#AA3731",number:"#9C5D27",comment:"#AAAAAA",heading:"#AA3731",invalid:"#cd3131",regexp:"#4B69C6",tag:"#4B69C6"},L9={background:Xe.background,foreground:Xe.foreground,caret:Xe.cursor,selection:Xe.selection,selectionMatch:Xe.selection,gutterBackground:Xe.background,gutterForeground:Xe.foreground,gutterBorder:"transparent",lineHighlight:Xe.activeLine},_9=[{tag:u.keyword,color:Xe.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:Xe.variable},{tag:[u.propertyName],color:Xe.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Xe.string},{tag:[u.function(u.variableName),u.labelName],color:Xe.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Xe.constant},{tag:[u.definition(u.name),u.separator],color:Xe.variable},{tag:[u.className],color:Xe.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:Xe.number},{tag:[u.typeName],color:Xe.type,fontStyle:Xe.type},{tag:[u.operator,u.operatorKeyword],color:Xe.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:Xe.regexp},{tag:[u.meta,u.comment],color:Xe.comment},{tag:u.tagName,color:Xe.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Xe.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:Xe.variable},{tag:u.invalid,color:Xe.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],B9=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},L9,s),styles:[..._9,...a]})};B9();var Le={background:"#390000",foreground:"#F8F8F8",selection:"#750000",cursor:"#970000",activeLine:"#ff000033",keyword:"#f12727ff",variable:"#edef7dff",function:"#ffb454ff",string:"#edef7dff",constant:"#ec0d1e",type:"#9df39fff",class:"#fec758ff",number:"#994646ff",comment:"#e7c0c0ff",heading:"#fec758ff",invalid:"#ffffffff",regexp:"#edef7dff",tag:"#aa5507ff"},W9={background:Le.background,foreground:Le.foreground,caret:Le.cursor,selection:Le.selection,selectionMatch:Le.selection,gutterBackground:Le.background,gutterForeground:Le.foreground,lineHighlight:Le.activeLine},z9=[{tag:u.keyword,color:Le.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:Le.variable},{tag:[u.propertyName],color:Le.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Le.string},{tag:[u.function(u.variableName),u.labelName],color:Le.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Le.constant},{tag:[u.definition(u.name),u.separator],color:Le.variable},{tag:[u.className],color:Le.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:Le.number},{tag:[u.typeName],color:Le.type,fontStyle:Le.type},{tag:[u.operator,u.operatorKeyword],color:Le.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:Le.regexp},{tag:[u.meta,u.comment],color:Le.comment},{tag:u.tagName,color:Le.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Le.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:Le.variable},{tag:u.invalid,color:Le.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],Z9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},W9,s),styles:[...z9,...a]})};Z9();var _e={background:"#002B36",foreground:"#839496",selection:"#004454AA",cursor:"#D30102",activeLine:"#00cafe11",keyword:"#859900",variable:"#268BD2",function:"#268BD2",string:"#2AA198",constant:"#CB4B16",type:"#859900",class:"#268BD2",number:"#D33682",comment:"#586E75",heading:"#268BD2",invalid:"#DC322F",regexp:"#DC322F",tag:"#268BD2"},F9={background:_e.background,foreground:_e.foreground,caret:_e.cursor,selection:_e.selection,selectionMatch:_e.selection,gutterBackground:_e.background,gutterForeground:_e.foreground,gutterBorder:"transparent",lineHighlight:_e.activeLine},V9=[{tag:u.keyword,color:_e.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:_e.variable},{tag:[u.propertyName],color:_e.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:_e.string},{tag:[u.function(u.variableName),u.labelName],color:_e.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:_e.constant},{tag:[u.definition(u.name),u.separator],color:_e.variable},{tag:[u.className],color:_e.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:_e.number},{tag:[u.typeName],color:_e.type,fontStyle:_e.type},{tag:[u.operator,u.operatorKeyword],color:_e.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:_e.regexp},{tag:[u.meta,u.comment],color:_e.comment},{tag:u.tagName,color:_e.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:_e.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:_e.variable},{tag:u.invalid,color:_e.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],Y9=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},F9,s),styles:[...V9,...a]})};Y9();var Be={background:"#FDF6E3",foreground:"#657B83",selection:"#EEE8D5",selectionMatch:"#EEE8D5",cursor:"#657B83",activeLine:"#3d392d11",keyword:"#859900",variable:"#268BD2",function:"#268BD2",string:"#2AA198",constant:"#CB4B16",type:"#859900",class:"#268BD2",number:"#D33682",comment:"#93A1A1",heading:"#268BD2",invalid:"#DC322F",regexp:"#DC322F",tag:"#268BD2"},q9={background:Be.background,foreground:Be.foreground,caret:Be.cursor,selection:Be.selection,selectionMatch:Be.selectionMatch,gutterBackground:Be.background,gutterForeground:Be.foreground,gutterBorder:"transparent",lineHighlight:Be.activeLine},U9=[{tag:u.keyword,color:Be.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:Be.variable},{tag:[u.propertyName],color:Be.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Be.string},{tag:[u.function(u.variableName),u.labelName],color:Be.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Be.constant},{tag:[u.definition(u.name),u.separator],color:Be.variable},{tag:[u.className],color:Be.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:Be.number},{tag:[u.typeName],color:Be.type,fontStyle:Be.type},{tag:[u.operator,u.operatorKeyword],color:Be.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:Be.regexp},{tag:[u.meta,u.comment],color:Be.comment},{tag:u.tagName,color:Be.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Be.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:Be.variable},{tag:u.invalid,color:Be.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],G9=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},q9,s),styles:[...U9,...a]})};G9();var H9={background:"#303841",foreground:"#FFFFFF",caret:"#FBAC52",selection:"#4C5964",selectionMatch:"#3A546E",gutterBackground:"#303841",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},K9=[{tag:[u.meta,u.comment],color:"#A2A9B5"},{tag:[u.attributeName,u.keyword],color:"#B78FBA"},{tag:u.function(u.variableName),color:"#5AB0B0"},{tag:[u.string,u.regexp,u.attributeValue],color:"#99C592"},{tag:u.operator,color:"#f47954"},{tag:[u.tagName,u.modifier],color:"#E35F63"},{tag:[u.number,u.definition(u.tagName),u.className,u.definition(u.variableName)],color:"#fbac52"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#E35F63"},{tag:u.variableName,color:"#539ac4"},{tag:[u.propertyName,u.typeName],color:"#629ccd"},{tag:u.propertyName,color:"#36b7b5"}];function J9(n){var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},H9,s),styles:[...K9,...a]})}J9();var ej={background:"#1a1b26",foreground:"#787c99",caret:"#c0caf5",selection:"#515c7e40",selectionMatch:"#16161e",gutterBackground:"#1a1b26",gutterForeground:"#787c99",gutterBorder:"transparent",lineHighlight:"#474b6611"},tj=[{tag:u.keyword,color:"#bb9af7"},{tag:[u.name,u.deleted,u.character,u.macroName],color:"#c0caf5"},{tag:[u.propertyName],color:"#7aa2f7"},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:"#9ece6a"},{tag:[u.function(u.variableName),u.labelName],color:"#7aa2f7"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#bb9af7"},{tag:[u.definition(u.name),u.separator],color:"#c0caf5"},{tag:[u.className],color:"#c0caf5"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#ff9e64"},{tag:[u.typeName],color:"#0db9d7"},{tag:[u.operator,u.operatorKeyword],color:"#bb9af7"},{tag:[u.url,u.escape,u.regexp,u.link],color:"#b4f9f8"},{tag:[u.meta,u.comment],color:"#444b6a"},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:"#89ddff"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#c0caf5"},{tag:u.invalid,color:"#ff5370"},{tag:u.strikethrough,textDecoration:"line-through"}],nj=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},ej,s),styles:[...tj,...a]})};nj();var rj={background:"#24283b",foreground:"#7982a9",caret:"#c0caf5",selection:"#6f7bb630",selectionMatch:"#343b5f",gutterBackground:"#24283b",gutterForeground:"#7982a9",gutterBorder:"transparent",lineHighlight:"#292e427a"},ij=[{tag:u.keyword,color:"#bb9af7"},{tag:[u.name,u.deleted,u.character,u.macroName],color:"#c0caf5"},{tag:[u.propertyName],color:"#7aa2f7"},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:"#9ece6a"},{tag:[u.function(u.variableName),u.labelName],color:"#7aa2f7"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#bb9af7"},{tag:[u.definition(u.name),u.separator],color:"#c0caf5"},{tag:[u.className],color:"#c0caf5"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#ff9e64"},{tag:[u.typeName],color:"#2ac3de",fontStyle:"#2ac3de"},{tag:[u.operator,u.operatorKeyword],color:"#bb9af7"},{tag:[u.url,u.escape,u.regexp,u.link],color:"#b4f9f8"},{tag:[u.meta,u.comment],color:"#565f89"},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:"#89ddff"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#c0caf5"},{tag:u.invalid,color:"#ff5370"},{tag:u.strikethrough,textDecoration:"line-through"}],sj=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},rj,s),styles:[...ij,...a]})};sj();var oj={background:"#e1e2e7",foreground:"#3760bf",caret:"#3760bf",selection:"#99a7df",selectionMatch:"#99a7df",gutterBackground:"#e1e2e7",gutterForeground:"#3760bf",gutterBorder:"transparent",lineHighlight:"#5f5faf11"},aj=[{tag:u.keyword,color:"#007197"},{tag:[u.name,u.deleted,u.character,u.macroName],color:"#3760bf"},{tag:[u.propertyName],color:"#3760bf"},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:"#587539"},{tag:[u.function(u.variableName),u.labelName],color:"#3760bf"},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:"#3760bf"},{tag:[u.definition(u.name),u.separator],color:"#3760bf"},{tag:[u.className],color:"#3760bf"},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:"#b15c00"},{tag:[u.typeName],color:"#007197",fontStyle:"#007197"},{tag:[u.operator,u.operatorKeyword],color:"#007197"},{tag:[u.url,u.escape,u.regexp,u.link],color:"#587539"},{tag:[u.meta,u.comment],color:"#848cb5"},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:"#b15c00"},{tag:[u.atom,u.bool,u.special(u.variableName)],color:"#3760bf"},{tag:u.invalid,color:"#f52a65"},{tag:u.strikethrough,textDecoration:"line-through"}],lj=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},oj,s),styles:[...aj,...a]})};lj();var We={background:"#002451",foreground:"#ffffff",selection:"#003f8e",cursor:"#ffffff",activeLine:"#00346e7a",keyword:"#EBBBFF",variable:"#FFC58F",function:"#BBDAFF",string:"#D1F1A9",constant:"#FFC58F",type:"#FFEEAD",class:"#BBDAFF",number:"#FFC58F",comment:"#7285B7",heading:"#D1F1A9",invalid:"#a92049",regexp:"#D1F1A9",tag:"#FF9DA4"},cj={background:We.background,foreground:We.foreground,caret:We.cursor,selection:We.selection,selectionMatch:We.selection,gutterBackground:We.background,gutterForeground:We.foreground,lineHighlight:We.activeLine},uj=[{tag:u.keyword,color:We.keyword},{tag:[u.name,u.deleted,u.character,u.macroName],color:We.variable},{tag:[u.propertyName],color:We.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:We.string},{tag:[u.function(u.variableName),u.labelName],color:We.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:We.constant},{tag:[u.definition(u.name),u.separator],color:We.variable},{tag:[u.className],color:We.class},{tag:[u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:We.number},{tag:[u.typeName],color:We.type,fontStyle:We.type},{tag:[u.operator,u.operatorKeyword],color:We.keyword},{tag:[u.url,u.escape,u.regexp,u.link],color:We.regexp},{tag:[u.meta,u.comment],color:We.comment},{tag:u.tagName,color:We.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:We.heading},{tag:[u.atom,u.bool,u.special(u.variableName)],color:We.variable},{tag:u.invalid,color:We.invalid},{tag:u.strikethrough,textDecoration:"line-through"}],dj=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},cj,s),styles:[...uj,...a]})};dj();var hj={background:"#ffffff",foreground:"#383a42",caret:"#000",selection:"#add6ff",selectionMatch:"#a8ac94",lineHighlight:"#99999926",gutterBackground:"#fff",gutterForeground:"#237893",gutterActiveForeground:"#0b216f",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},fj=[{tag:[u.keyword,u.operatorKeyword,u.modifier,u.color,u.constant(u.name),u.standard(u.name),u.standard(u.tagName),u.special(u.brace),u.atom,u.bool,u.special(u.variableName)],color:"#0000ff"},{tag:[u.moduleKeyword,u.controlKeyword],color:"#af00db"},{tag:[u.name,u.deleted,u.character,u.macroName,u.propertyName,u.variableName,u.labelName,u.definition(u.name)],color:"#0070c1"},{tag:u.heading,fontWeight:"bold",color:"#0070c1"},{tag:[u.typeName,u.className,u.tagName,u.number,u.changed,u.annotation,u.self,u.namespace],color:"#267f99"},{tag:[u.function(u.variableName),u.function(u.propertyName)],color:"#795e26"},{tag:[u.number],color:"#098658"},{tag:[u.operator,u.punctuation,u.separator,u.url,u.escape,u.regexp],color:"#383a42"},{tag:[u.regexp],color:"#af00db"},{tag:[u.special(u.string),u.processingInstruction,u.string,u.inserted],color:"#a31515"},{tag:[u.angleBracket],color:"#383a42"},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:[u.meta,u.comment],color:"#008000"},{tag:u.link,color:"#4078f2",textDecoration:"underline"},{tag:u.invalid,color:"#e45649"}];function pj(n){var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},hj,s),styles:[...fj,...a]})}pj();var mj={background:"#1e1e1e",foreground:"#9cdcfe",caret:"#c6c6c6",selection:"#6199ff2f",selectionMatch:"#72a1ff59",lineHighlight:"#ffffff0f",gutterBackground:"#1e1e1e",gutterForeground:"#838383",gutterActiveForeground:"#fff",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},gj=[{tag:[u.keyword,u.operatorKeyword,u.modifier,u.color,u.constant(u.name),u.standard(u.name),u.standard(u.tagName),u.special(u.brace),u.atom,u.bool,u.special(u.variableName)],color:"#569cd6"},{tag:[u.controlKeyword,u.moduleKeyword],color:"#c586c0"},{tag:[u.name,u.deleted,u.character,u.macroName,u.propertyName,u.variableName,u.labelName,u.definition(u.name)],color:"#9cdcfe"},{tag:u.heading,fontWeight:"bold",color:"#9cdcfe"},{tag:[u.typeName,u.className,u.tagName,u.number,u.changed,u.annotation,u.self,u.namespace],color:"#4ec9b0"},{tag:[u.function(u.variableName),u.function(u.propertyName)],color:"#dcdcaa"},{tag:[u.number],color:"#b5cea8"},{tag:[u.operator,u.punctuation,u.separator,u.url,u.escape,u.regexp],color:"#d4d4d4"},{tag:[u.regexp],color:"#d16969"},{tag:[u.special(u.string),u.processingInstruction,u.string,u.inserted],color:"#ce9178"},{tag:[u.angleBracket],color:"#808080"},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:[u.meta,u.comment],color:"#6a9955"},{tag:u.link,color:"#6a9955",textDecoration:"underline"},{tag:u.invalid,color:"#ff0000"}];function Oj(n){var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},mj,s),styles:[...gj,...a]})}var bj=Oj(),Fe={background:"#000",foreground:"#fff",selection:"#7d46fc3f",selectionMatch:"#7d46fc7f",cursor:"#7d46fc",activeLine:"#00346eb0",keyword:null,variable:null,function:null,string:"#a8a8b1",constant:null,type:null,class:null,comment:"#2e2e37",heading:null,invalid:null,regexp:"#a8a8b1",tag:null},yj={background:Fe.background,foreground:Fe.foreground,caret:Fe.cursor,selection:Fe.selection,selectionMatch:Fe.selectionMatch,gutterBackground:Fe.background,gutterForeground:Fe.foreground,lineHighlight:Fe.activeLine},xj=[{tag:u.keyword,color:Fe.keyword,fontWeight:"bold"},{tag:[u.name,u.deleted,u.character,u.macroName],color:Fe.variable},{tag:[u.propertyName],color:Fe.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Fe.string},{tag:[u.function(u.variableName),u.labelName],color:Fe.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Fe.constant},{tag:[u.definition(u.name),u.separator],color:Fe.variable},{tag:[u.className],color:Fe.class},{tag:[u.typeName],color:Fe.type,fontStyle:Fe.type},{tag:[u.url,u.escape,u.regexp,u.link],color:Fe.regexp},{tag:[u.meta,u.comment],color:Fe.comment},{tag:u.tagName,color:Fe.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Fe.heading},{tag:[u.atom,u.special(u.variableName)],color:Fe.variable},{tag:u.invalid,color:Fe.invalid},{tag:u.strikethrough,textDecoration:"line-through"},{tag:[u.operatorKeyword,u.bool,u.null,u.variableName],color:Fe.constant},{tag:[u.operator],color:"#bb9af7"},{tag:[u.number],color:"#a8a8b1"},{tag:[u.bracket],color:"#bb9af7"}],Sj=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},yj,s),styles:[...xj,...a]})};Sj();var Ve={background:"#fff",foreground:"#000",selection:"#0064ff26",selectionMatch:"#0064ff4c",cursor:"#004bff",activeLine:"#0064ff0c",keyword:null,variable:null,function:null,string:"#6b7a88",constant:null,type:null,class:null,comment:"#bec9d3",heading:null,invalid:null,regexp:"#6b7a88",tag:null},kj={background:Ve.background,foreground:Ve.foreground,caret:Ve.cursor,selection:Ve.selection,selectionMatch:Ve.selectionMatch,gutterBackground:Ve.background,gutterForeground:Ve.foreground,lineHighlight:Ve.activeLine},vj=[{tag:u.keyword,color:Ve.keyword,fontWeight:"bold"},{tag:[u.name,u.deleted,u.character,u.macroName],color:Ve.variable},{tag:[u.propertyName],color:Ve.function},{tag:[u.processingInstruction,u.string,u.inserted,u.special(u.string)],color:Ve.string},{tag:[u.function(u.variableName),u.labelName],color:Ve.function},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:Ve.constant},{tag:[u.definition(u.name),u.separator],color:Ve.variable},{tag:[u.className],color:Ve.class},{tag:[u.typeName],color:Ve.type,fontStyle:Ve.type},{tag:[u.url,u.escape,u.regexp,u.link],color:Ve.regexp},{tag:[u.meta,u.comment],color:Ve.comment},{tag:u.tagName,color:Ve.tag},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:Ve.heading},{tag:[u.atom,u.special(u.variableName)],color:Ve.variable},{tag:u.invalid,color:Ve.invalid},{tag:u.strikethrough,textDecoration:"line-through"},{tag:[u.operatorKeyword,u.bool,u.null,u.variableName],color:Ve.constant},{tag:[u.operator],color:"#0431fa"},{tag:[u.number],color:"#a8a8b1"},{tag:[u.bracket],color:"#0431fa"}],wj=n=>{var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},kj,s),styles:[...vj,...a]})};wj();var Qj={background:"#fff",foreground:"#3D3D3D",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#AFAFAF",lineHighlight:"#d5e6ff69"},$j=[{tag:[u.comment,u.quote],color:"#707F8D"},{tag:[u.typeName,u.typeOperator],color:"#aa0d91"},{tag:[u.keyword],color:"#aa0d91",fontWeight:"bold"},{tag:[u.string,u.meta],color:"#D23423"},{tag:[u.name],color:"#032f62"},{tag:[u.typeName],color:"#522BB2"},{tag:[u.variableName],color:"#23575C"},{tag:[u.definition(u.variableName)],color:"#327A9E"},{tag:[u.regexp,u.link],color:"#0e0eff"}];function Cj(n){var e={},t=e.theme,r=t===void 0?"light":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},Qj,s),styles:[...$j,...a]})}Cj();var Pj={background:"#292A30",foreground:"#CECFD0",caret:"#fff",selection:"#727377",selectionMatch:"#727377",lineHighlight:"#ffffff0f"},Tj=[{tag:[u.comment,u.quote],color:"#7F8C98"},{tag:[u.keyword],color:"#FF7AB2",fontWeight:"bold"},{tag:[u.string,u.meta],color:"#FF8170"},{tag:[u.typeName],color:"#DABAFF"},{tag:[u.definition(u.variableName)],color:"#6BDFFF"},{tag:[u.name],color:"#6BAA9F"},{tag:[u.variableName],color:"#ACF2E4"},{tag:[u.regexp,u.link],color:"#FF8170"}],Mj=n=>{var e={},t=e.theme,r=t===void 0?"dark":t,i=e.settings,s=i===void 0?{}:i,o=e.styles,a=o===void 0?[]:o;return ae({theme:r,settings:ie({},Pj,s),styles:[...Tj,...a]})};Mj();const Aj=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=Vm(n.state,t.from);return r.line?Rj(n):r.block?Nj(n):!1};function Fm(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}const Rj=Fm(Ij,0),Ej=Fm(Ov,0),Nj=Fm((n,e)=>Ov(n,e,jj(e)),0);function Vm(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Co=50;function Dj(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-Co,r),o=n.sliceDoc(i,i+Co),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,h;i-r<=2*Co?d=h=n.sliceDoc(r,i):(d=n.sliceDoc(r,r+Co),h=n.sliceDoc(i-Co,i));let f=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(h)[0].length,m=h.length-p-t.length;return d.slice(f,f+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:r+f+e.length,margin:/\s/.test(d.charAt(f+e.length))?1:0},close:{pos:i-p-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function jj(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function Ov(n,e,t=e.selection.ranges){let r=t.map(s=>Vm(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>Dj(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:d}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:s}}return null}function Ij(n,e,t=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of t){let a=r.length,l=1e9,c;for(let d=s;d<=o;){let h=e.doc.lineAt(d);if(c==null&&(c=Vm(e,h.from).line,!c))continue e;if(h.from>i&&(s==o||o>h.from)){i=h.from;let f=/^\s*/.exec(h.text)[0].length,p=f==h.length,m=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<l&&(l=f),r.push({line:h,comment:m,token:c,indent:f,empty:p,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=l);r.length==a+1&&(r[a].single=!0)}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of r)(h||!d)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,s.push({from:c,to:d})}return{changes:s}}return null}const sp=gr.define(),Xj=gr.define(),Lj=W.define(),bv=W.define({combine(n){return Or(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),yv=Tt.define({create(){return na.empty},update(n,e){let t=e.state.facet(bv),r=e.annotation(sp);if(r){let l=Kt.fromTransaction(e,r.selection),c=r.side,d=c==0?n.undone:n.done;return l?d=iu(d,d.length,t.minDepth,l):d=kv(d,e.startState.selection),new na(c==0?r.rest:d,c==0?d:r.rest)}let i=e.annotation(Xj);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(Wt.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Kt.fromTransaction(e),o=e.annotation(Wt.time),a=e.annotation(Wt.userEvent);return s?n=n.addChanges(s,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new na(n.done.map(Kt.fromJSON),n.undone.map(Kt.fromJSON))}});function _j(n={}){return[yv,bv.of(n),X.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?xv:e.inputType=="historyRedo"?op:null;return r?(e.preventDefault(),r(t)):!1}})]}function pd(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(yv,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const xv=pd(0,!1),op=pd(1,!1),Bj=pd(0,!0),Wj=pd(1,!0);class Kt{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new Kt(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Kt(e.changes&&ht.fromJSON(e.changes),[],e.mapped&&lr.fromJSON(e.mapped),e.startSelection&&A.fromJSON(e.startSelection),e.selectionsAfter.map(A.fromJSON))}static fromTransaction(e,t){let r=Pn;for(let i of e.startState.facet(Lj)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Kt(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,Pn)}static selection(e){return new Kt(void 0,Pn,void 0,void 0,e)}}function iu(n,e,t,r){let i=e+1>t+20?e-t-1:0,s=n.slice(i,e);return s.push(r),s}function zj(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],d=t[l++];a>=c&&o<=d&&(r=!0)}}),r}function Zj(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function Sv(n,e){return n.length?e.length?n.concat(e):n:e}const Pn=[],Fj=200;function kv(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Fj));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),iu(n,n.length-1,1e9,t.setSelAfter(r)))}else return[Kt.selection([e])]}function Vj(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function vh(n,e){if(!n.length)return n;let t=n.length,r=Pn;for(;t;){let i=Yj(n[t-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=n.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,r=i.selectionsAfter}return r.length?[Kt.selection(r)]:Pn}function Yj(n,e,t){let r=Sv(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):Pn,t);if(!n.changes)return Kt.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new Kt(i,oe.mapEffects(n.effects,e),o,n.startSelection.map(s),r)}const qj=/^(input\.type|delete)($|\.)/;let na=class Bo{constructor(e,t,r=0,i=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Bo(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||qj.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,zj(a.changes,e.changes))||r=="input.type.compose")?o=iu(o,o.length-1,i.minDepth,new Kt(e.changes.compose(a.changes),Sv(oe.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Pn)):o=iu(o,o.length,i.minDepth,e),new Bo(o,Pn,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Pn;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Zj(s[s.length-1],e)?this:new Bo(kv(this.done,e),this.undone,t,r)}addMapping(e){return new Bo(vh(this.done,e),vh(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):t.selection);if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:sp.of({side:e,rest:Vj(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?Pn:i.slice(0,i.length-1);return s.mapped&&(a=vh(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:sp.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};na.empty=new na(Pn,Pn);const Uj=[{key:"Mod-z",run:xv,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:op,preventDefault:!0},{linux:"Ctrl-Shift-z",run:op,preventDefault:!0},{key:"Mod-u",run:Bj,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Wj,preventDefault:!0}];function po(n,e){return A.create(n.ranges.map(e),n.mainIndex)}function Zn(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Fn({state:n,dispatch:e},t){let r=po(n.selection,t);return r.eq(n.selection,!0)?!1:(e(Zn(n,r)),!0)}function md(n,e){return A.cursor(e?n.to:n.from)}function vv(n,e){return Fn(n,t=>t.empty?n.moveByChar(t,e):md(t,e))}function Xt(n){return n.textDirectionAt(n.state.selection.main.head)==Re.LTR}const wv=n=>vv(n,!Xt(n)),Qv=n=>vv(n,Xt(n));function $v(n,e){return Fn(n,t=>t.empty?n.moveByGroup(t,e):md(t,e))}const Gj=n=>$v(n,!Xt(n)),Hj=n=>$v(n,Xt(n));function Kj(n,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function gd(n,e,t){let r=Ke(n).resolveInner(e.head),i=t?de.closedBy:de.openedBy;for(let l=e.head;;){let c=t?r.childAfter(l):r.childBefore(l);if(!c)break;Kj(n,c,i)?r=c:l=t?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=t?ar(n,r.from,1):ar(n,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,A.cursor(a,t?-1:1)}const Jj=n=>Fn(n,e=>gd(n.state,e,!Xt(n))),e6=n=>Fn(n,e=>gd(n.state,e,Xt(n)));function Cv(n,e){return Fn(n,t=>{if(!t.empty)return md(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const Pv=n=>Cv(n,!1),Tv=n=>Cv(n,!0);function Mv(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,r=0,i;if(e){for(let s of n.state.facet(X.scrollMargins)){let o=s(n);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(r=Math.max(o?.bottom,r))}i=n.scrollDOM.clientHeight-t-r}else i=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(n.defaultLineHeight,i-5)}}function Av(n,e){let t=Mv(n),{state:r}=n,i=po(r.selection,o=>o.empty?n.moveVertically(o,e,t.height):md(o,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(r.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=X.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return n.dispatch(Zn(r,i),{effects:s}),!0}const x1=n=>Av(n,!1),ap=n=>Av(n,!0);function vi(n,e,t){let r=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?r.to:r.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==r.from&&r.length){let s=/^\s*/.exec(n.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=A.cursor(r.from+s))}return i}const t6=n=>Fn(n,e=>vi(n,e,!0)),n6=n=>Fn(n,e=>vi(n,e,!1)),r6=n=>Fn(n,e=>vi(n,e,!Xt(n))),i6=n=>Fn(n,e=>vi(n,e,Xt(n))),s6=n=>Fn(n,e=>n.moveToLineBoundary(e,!1,!1)),o6=n=>Fn(n,e=>n.moveToLineBoundary(e,!0,!1));function a6(n,e,t){let r=!1,i=po(n.selection,s=>{let o=ar(n,s.head,-1)||ar(n,s.head,1)||s.head>0&&ar(n,s.head-1,1)||s.head<n.doc.length&&ar(n,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return A.cursor(a)});return r?(e(Zn(n,i)),!0):!1}const l6=({state:n,dispatch:e})=>a6(n,e);function An(n,e,t){let r=po(n.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=A.range(i.head,i.anchor));let s=t(i);return A.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(n.state.selection)?!1:(n.dispatch(Zn(n.state,r)),!0)}function Rv(n,e){return An(n,e,t=>n.moveByChar(t,e))}const Ev=n=>Rv(n,!Xt(n)),Nv=n=>Rv(n,Xt(n));function Dv(n,e){return An(n,e,t=>n.moveByGroup(t,e))}const c6=n=>Dv(n,!Xt(n)),u6=n=>Dv(n,Xt(n)),d6=n=>{let e=!Xt(n);return An(n,e,t=>gd(n.state,t,e))},h6=n=>{let e=Xt(n);return An(n,e,t=>gd(n.state,t,e))};function jv(n,e){return An(n,e,t=>n.moveVertically(t,e))}const Iv=n=>jv(n,!1),Xv=n=>jv(n,!0);function Lv(n,e){return An(n,e,t=>n.moveVertically(t,e,Mv(n).height))}const S1=n=>Lv(n,!1),k1=n=>Lv(n,!0),f6=n=>An(n,!0,e=>vi(n,e,!0)),p6=n=>An(n,!1,e=>vi(n,e,!1)),m6=n=>{let e=!Xt(n);return An(n,e,t=>vi(n,t,e))},g6=n=>{let e=Xt(n);return An(n,e,t=>vi(n,t,e))},O6=n=>An(n,!1,e=>A.cursor(n.lineBlockAt(e.head).from)),b6=n=>An(n,!0,e=>A.cursor(n.lineBlockAt(e.head).to)),v1=({state:n,dispatch:e})=>(e(Zn(n,{anchor:0})),!0),w1=({state:n,dispatch:e})=>(e(Zn(n,{anchor:n.doc.length})),!0),Q1=({state:n,dispatch:e})=>(e(Zn(n,{anchor:n.selection.main.anchor,head:0})),!0),$1=({state:n,dispatch:e})=>(e(Zn(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),y6=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),x6=({state:n,dispatch:e})=>{let t=Od(n).map(({from:r,to:i})=>A.undirectionalRange(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:A.create(t),userEvent:"select"})),!0},S6=({state:n,dispatch:e})=>{let t=po(n.selection,r=>{let i=Ke(n),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return A.undirectionalRange(a.from,a.to)}return r});return t.eq(n.selection)?!1:(e(Zn(n,t)),!0)};function _v(n,e){let{state:t}=n,r=t.selection,i=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let a=s;;){let l=n.moveVertically(a,e);if(l.head<o.from||l.head>o.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(n.dispatch(Zn(t,A.create(i,i.length-1))),!0)}const k6=n=>_v(n,!1),v6=n=>_v(n,!0),w6=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=A.create([t.main]):t.main.empty||(r=A.create([A.cursor(t.main.head)])),r?(e(Zn(n,r)),!0):!1};function ul(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=Bl(n,l,!1)):l>o&&(t="delete.forward",l=Bl(n,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Bl(n,o,!1),a=Bl(n,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:A.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(n.dispatch(r.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?X.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Bl(n,e,t){if(n instanceof X)for(let r of n.state.facet(X.atomicRanges).map(i=>i(n)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const Bv=(n,e,t)=>ul(n,r=>{let i=r.from,{state:s}=n,o=s.doc.lineAt(i),a,l;if(t&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let c=uo(a,s.tabSize),d=c%Gc(s)||Gc(s);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)i--;l=i}else l=Ot(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=Ot(o.text,l-o.from,!1,!1)+o.from);return l}),lp=n=>Bv(n,!1,!0),Wv=n=>Bv(n,!0,!1),zv=(n,e)=>ul(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=Ot(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),d=o(c);if(a!=null&&d!=a)break;(c!=" "||r!=t.head)&&(a=d),r=l}return r}),Zv=n=>zv(n,!1),Q6=n=>zv(n,!0),$6=n=>ul(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),C6=n=>ul(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),P6=n=>ul(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),T6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ye.of(["",""])},range:A.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},M6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,s=n.doc.lineAt(i),o=i==s.from?i-1:Ot(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Ot(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:n.doc.slice(i,a).append(n.doc.slice(o,i))},range:A.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Od(n){let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.from),s=n.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=n.doc.lineAt(r.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});t=s.number+1}return e}function Fv(n,e,t){if(n.readOnly)return!1;let r=[],i=[];for(let s of Od(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let l of s.ranges)i.push(A.range(Math.min(n.doc.length,l.anchor+a),Math.min(n.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let l of s.ranges)i.push(A.range(l.anchor-a,l.head-a))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:A.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const A6=({state:n,dispatch:e})=>Fv(n,e,!1),R6=({state:n,dispatch:e})=>Fv(n,e,!0);function Vv(n,e,t){if(n.readOnly)return!1;let r=[];for(let s of Od(n))t?r.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):r.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let i=n.changes(r);return e(n.update({changes:i,selection:n.selection.map(i,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const E6=({state:n,dispatch:e})=>Vv(n,e,!1),N6=({state:n,dispatch:e})=>Vv(n,e,!0),D6=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Od(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=po(e.selection,i=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(i.head),a=n.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+n.documentTop-a.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,s)}).map(t);return n.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function j6(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Ke(n).resolveInner(e),r=t.childBefore(e),i=t.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(de.closedBy))&&s.indexOf(i.name)>-1&&n.doc.lineAt(r.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const C1=Yv(!1),I6=Yv(!0);function Yv(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!n&&s==o&&j6(e,s);n&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new dd(e,{simulateBreak:s,simulateDoubleBreak:!!l}),d=Pm(c,s);for(d==null&&(d=uo(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let h=["",Na(e,d)];return l&&h.push(Na(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:ye.of(h)},range:A.cursor(s+1+h[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ym(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=n.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,i,r),t=a.number),o=a.to+1}let s=n.changes(i);return{changes:i,range:A.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const X6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new dd(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=Ym(n,(s,o,a)=>{let l=Pm(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],d=Na(n,l);(c!=d||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:d}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},qv=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Ym(n,(t,r)=>{r.push({from:t.from,insert:n.facet(sl)})}),{userEvent:"input.indent"})),!0),Uv=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Ym(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=uo(i,n.tabSize),o=0,a=Na(n,Math.max(0,s-Gc(n)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),L6=n=>(n.setTabFocusMode(),!0),_6=[{key:"Ctrl-b",run:wv,shift:Ev,preventDefault:!0},{key:"Ctrl-f",run:Qv,shift:Nv},{key:"Ctrl-p",run:Pv,shift:Iv},{key:"Ctrl-n",run:Tv,shift:Xv},{key:"Ctrl-a",run:s6,shift:O6},{key:"Ctrl-e",run:o6,shift:b6},{key:"Ctrl-d",run:Wv},{key:"Ctrl-h",run:lp},{key:"Ctrl-k",run:$6},{key:"Ctrl-Alt-h",run:Zv},{key:"Ctrl-o",run:T6},{key:"Ctrl-t",run:M6},{key:"Ctrl-v",run:ap}],B6=[{key:"ArrowLeft",run:wv,shift:Ev,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Gj,shift:c6,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:r6,shift:m6,preventDefault:!0},{key:"ArrowRight",run:Qv,shift:Nv,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Hj,shift:u6,preventDefault:!0},{mac:"Cmd-ArrowRight",run:i6,shift:g6,preventDefault:!0},{key:"ArrowUp",run:Pv,shift:Iv,preventDefault:!0},{mac:"Cmd-ArrowUp",run:v1,shift:Q1},{mac:"Ctrl-ArrowUp",run:x1,shift:S1},{key:"ArrowDown",run:Tv,shift:Xv,preventDefault:!0},{mac:"Cmd-ArrowDown",run:w1,shift:$1},{mac:"Ctrl-ArrowDown",run:ap,shift:k1},{key:"PageUp",run:x1,shift:S1},{key:"PageDown",run:ap,shift:k1},{key:"Home",run:n6,shift:p6,preventDefault:!0},{key:"Mod-Home",run:v1,shift:Q1},{key:"End",run:t6,shift:f6,preventDefault:!0},{key:"Mod-End",run:w1,shift:$1},{key:"Enter",run:C1,shift:C1},{key:"Mod-a",run:y6},{key:"Backspace",run:lp,shift:lp,preventDefault:!0},{key:"Delete",run:Wv,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Zv,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Q6,preventDefault:!0},{mac:"Mod-Backspace",run:C6,preventDefault:!0},{mac:"Mod-Delete",run:P6,preventDefault:!0}].concat(_6.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),W6=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Jj,shift:d6},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e6,shift:h6},{key:"Alt-ArrowUp",run:A6},{key:"Shift-Alt-ArrowUp",run:E6},{key:"Alt-ArrowDown",run:R6},{key:"Shift-Alt-ArrowDown",run:N6},{key:"Mod-Alt-ArrowUp",run:k6},{key:"Mod-Alt-ArrowDown",run:v6},{key:"Escape",run:w6},{key:"Mod-Enter",run:I6},{key:"Alt-l",mac:"Ctrl-l",run:x6},{key:"Mod-i",run:S6,preventDefault:!0},{key:"Mod-[",run:Uv},{key:"Mod-]",run:qv},{key:"Mod-Alt-\\",run:X6},{key:"Shift-Mod-k",run:D6},{key:"Shift-Mod-\\",run:l6},{key:"Mod-/",run:Aj},{key:"Alt-A",mac:"Ctrl-A",run:Ej},{key:"Ctrl-m",mac:"Shift-Alt-m",run:L6}].concat(B6),z6={key:"Tab",run:qv,shift:Uv},P1=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Js{constructor(e,t,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(P1(a)):P1,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Yt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=cm(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=rr(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<t.length&&t.charCodeAt(s)==l?o++:a=!1}}}match(e,t,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:i,precise:r&&s}:this.matches.push({from:t,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Js.prototype[Symbol.iterator]=function(){return this});const Gv={from:-1,to:-1,match:/.*/.exec(""),precise:!0},qm="gm"+(/x/.unicode==null?"":"u");class Hv{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=Gv,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Kv(e,t,r,i,s);this.re=new RegExp(t,qm+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=su(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=su(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const wh=new WeakMap;class _s{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=wh.get(e);if(!i||i.from>=r||i.to<=t){let a=new _s(t,e.sliceString(t,r));return wh.set(e,a),a}if(i.from==t&&i.to==r)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<r&&(s+=e.sliceString(i.to,r)),wh.set(e,new _s(o,s)),new _s(t,s.slice(t-o,r-o))}}class Kv{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=Gv,this.matchPos=su(e,i),this.re=new RegExp(t,qm+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=_s.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,i=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,precise:!0,match:t},this.matchPos=su(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=_s.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Hv.prototype[Symbol.iterator]=Kv.prototype[Symbol.iterator]=function(){return this});function Z6(n){try{return new RegExp(n,qm),!0}catch{return!1}}function su(n,e){if(e>=n.length)return e;let t=n.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}const F6=n=>{let e=ZA(n,"cm-goto-line");if(e){let o=e.dom.querySelector("input[type=text]");return o&&o.select(),!0}let{state:t}=n,r=String(t.doc.lineAt(n.state.selection.main.head).number),{close:i,result:s}=zA(n,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:t.phrase("go")});return s.then(o=>{let a=o&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);if(!a){n.dispatch({effects:i});return}let l=t.doc.lineAt(t.selection.main.head),[,c,d,h,f]=a,p=h?+h.slice(1):0,m=d?+d:l.number;if(d&&f){let y=m/100;c&&(y=y*(c=="-"?-1:1)+l.number/t.doc.lines),m=Math.round(t.doc.lines*y)}else d&&c&&(m=m*(c=="-"?-1:1)+l.number);let O=t.doc.line(Math.max(1,Math.min(t.doc.lines,m))),b=A.cursor(O.from+Math.max(0,Math.min(p,O.length)));n.dispatch({effects:[i,X.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},V6={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Y6=W.define({combine(n){return Or(n,V6,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function q6(n){return[J6,K6]}const U6=U.mark({class:"cm-selectionMatch"}),G6=U.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function T1(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=Ue.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=Ue.Word)}function H6(n,e,t,r){return n(e.sliceDoc(t,t+1))==Ue.Word&&n(e.sliceDoc(r-1,r))==Ue.Word}const K6=it.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(Y6),{state:t}=n,r=t.selection;if(r.ranges.length>1)return U.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return U.none;let l=t.wordAt(i.head);if(!l)return U.none;o=t.charCategorizer(i.head),s=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return U.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(T1(o,t,i.from,i.to)&&H6(o,t,i.from,i.to)))return U.none}else if(s=t.sliceDoc(i.from,i.to),!s)return U.none}let a=[];for(let l of n.visibleRanges){let c=new Js(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:d,to:h}=c.value;if((!o||T1(o,t,d,h))&&(i.empty&&d<=i.from&&h>=i.to?a.push(G6.range(d,h)):(d>=i.to||h<=i.from)&&a.push(U6.range(d,h)),a.length>e.maxMatches))return U.none}}return U.set(a)}},{decorations:n=>n.decorations}),J6=X.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),eI=({state:n,dispatch:e})=>{let{selection:t}=n,r=A.create(t.ranges.map(i=>n.wordAt(i.head)||A.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function tI(n,e){let{main:t,ranges:r}=n.selection,i=n.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new Js(n.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Js(n.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=n.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const nI=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return eI({state:n,dispatch:e});let r=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=r))return!1;let i=tI(n,r);return i?(e(n.update({selection:n.selection.addRange(A.range(i.from,i.to),!1),effects:X.scrollIntoView(i.to)})),!0):!1},mo=W.define({combine(n){return Or(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new gI(e),scrollToMatch:e=>X.scrollIntoView(e)})}});class Jv{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Z6(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
73
- `:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new lI(this):new sI(this)}getCursor(e,t=0,r){let i=e.doc?e:Ge.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?ks(this,i,t,r):Ss(this,i,t,r)}}class ew{constructor(e){this.spec=e}}function rI(n,e,t){return(r,i,s,o)=>{if(t&&!t(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return n(a,e,r,i)}}function Ss(n,e,t,r){let i;return n.wholeWord&&(i=iI(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=rI(n.test,e,i)),new Js(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:s=>s.toLowerCase(),i)}function iI(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(ou(i,t-s))!=Ue.Word||e(au(i,t-s))!=Ue.Word)&&(e(au(i,r-s))!=Ue.Word||e(ou(i,r-s))!=Ue.Word))}class sI extends ew{constructor(e){super(e)}nextMatch(e,t,r){let i=Ss(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=Ss(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=Ss(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=Ss(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=Ss(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function oI(n,e,t){return(r,i,s)=>(!t||t(r,i,s))&&n(s[0],e,r,i)}function ks(n,e,t,r){let i;return n.wholeWord&&(i=aI(e.charCategorizer(e.selection.main.head))),n.test&&(i=oI(n.test,e,i)),new Hv(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,r)}function ou(n,e){return n.slice(Ot(n,e,!1),e)}function au(n,e){return n.slice(e,Ot(n,e))}function aI(n){return(e,t,r)=>!r[0].length||(n(ou(r.input,r.index))!=Ue.Word||n(au(r.input,r.index))!=Ue.Word)&&(n(au(r.input,r.index+r[0].length))!=Ue.Word||n(ou(r.input,r.index+r[0].length))!=Ue.Word)}class lI extends ew{nextMatch(e,t,r){let i=ks(this.spec,e,r,e.doc.length).next();return i.done&&(i=ks(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=ks(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=ks(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=ks(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Xa=oe.define(),Um=oe.define(),si=Tt.define({create(n){return new Qh(cp(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Xa)?n=new Qh(t.value.create(),n.panel):t.is(Um)&&(n=new Qh(n.query,t.value?Gm:null));return n},provide:n=>Ea.from(n,e=>e.panel)});class Qh{constructor(e,t){this.query=e,this.panel=t}}const cI=U.mark({class:"cm-searchMatch"}),uI=U.mark({class:"cm-searchMatch cm-searchMatch-selected"}),dI=it.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(si))}update(n){let e=n.state.field(si);(e!=n.startState.field(si)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return U.none;let{view:t}=this,r=new Lr;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-500;)l=s[++i].to;n.highlight(t.state,a,l,(c,d)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==d);r.add(c,d,h?uI:cI)})}return r.finish()}},{decorations:n=>n.decorations});function dl(n){return e=>{let t=e.state.field(si,!1);return t&&t.query.spec.valid?n(e,t):rw(e)}}const lu=dl((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=A.single(r.from,r.to),s=n.state.facet(mo);return n.dispatch({selection:i,effects:[Hm(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),nw(n),!0}),cu=dl((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=A.single(i.from,i.to),o=n.state.facet(mo);return n.dispatch({selection:s,effects:[Hm(n,i),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),nw(n),!0}),hI=dl((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:A.create(t.map(r=>A.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),fI=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:i}=t.main,s=[],o=0;for(let a=new Js(n.doc,n.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(A.range(a.value.from,a.value.to))}return e(n.update({selection:A.create(s,o),userEvent:"select.search.matches"})),!0},M1=dl((n,{query:e})=>{let{state:t}=n,{from:r,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=s,a=[],l,c,d=[];o.precise?o.from==r&&o.to==i&&(c=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),d.push(X.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+"."))):o=e.nextMatch(t,o.from,o.to);let h=n.state.changes(a);return o&&(l=A.single(o.from,o.to).map(h),d.push(Hm(n,o)),d.push(t.facet(mo).scrollToMatch(l.main,n))),n.dispatch({changes:h,selection:l,effects:d,userEvent:"input.replace"}),!0}),pI=dl((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let i of e.matchAll(n.state,1e9)){let{from:s,to:o,precise:a}=i;a&&t.push({from:s,to:o,insert:e.getReplacement(i)})}if(!t.length)return!1;let r=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:X.announce.of(r),userEvent:"input.replace.all"}),!0});function Gm(n){return n.state.facet(mo).createPanel(n)}function cp(n,e){var t,r,i,s,o;let a=n.selection.main,l=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=n.facet(mo);return new Jv({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function tw(n){let e=cd(n,Gm);return e&&e.dom.querySelector("[main-field]")}function nw(n){let e=tw(n);e&&e==n.root.activeElement&&e.select()}const rw=n=>{let e=n.state.field(si,!1);if(e&&e.panel){let t=tw(n);if(t&&t!=n.root.activeElement){let r=cp(n.state,e.query.spec);r.valid&&n.dispatch({effects:Xa.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[Um.of(!0),e?Xa.of(cp(n.state,e.query.spec)):oe.appendConfig.of(bI)]});return!0},iw=n=>{let e=n.state.field(si,!1);if(!e||!e.panel)return!1;let t=cd(n,Gm);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Um.of(!1)}),!0},mI=[{key:"Mod-f",run:rw,scope:"editor search-panel"},{key:"F3",run:lu,shift:cu,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:lu,shift:cu,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:iw,scope:"editor search-panel"},{key:"Mod-Shift-l",run:fI},{key:"Mod-Alt-g",run:F6},{key:"Mod-d",run:nI,preventDefault:!0}];class gI{constructor(e){this.view=e;let t=this.query=e.state.field(si).query.spec;this.commit=this.commit.bind(this),this.searchField=Ce("input",{value:t.search,placeholder:ln(e,"Find"),"aria-label":ln(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ce("input",{value:t.replace,placeholder:ln(e,"Replace"),"aria-label":ln(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ce("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ce("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ce("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(i,s,o){return Ce("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Ce("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>lu(e),[ln(e,"next")]),r("prev",()=>cu(e),[ln(e,"previous")]),r("select",()=>hI(e),[ln(e,"all")]),Ce("label",null,[this.caseField,ln(e,"match case")]),Ce("label",null,[this.reField,ln(e,"regexp")]),Ce("label",null,[this.wordField,ln(e,"by word")]),...e.state.readOnly?[]:[Ce("br"),this.replaceField,r("replace",()=>M1(e),[ln(e,"replace")]),r("replaceAll",()=>pI(e),[ln(e,"replace all")])],Ce("button",{name:"close",onclick:()=>iw(e),"aria-label":ln(e,"close"),type:"button"},["×"])])}commit(){let e=new Jv({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Xa.of(e)}))}keydown(e){H3(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?cu:lu)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),M1(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Xa)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(mo).top}}function ln(n,e){return n.state.phrase(e)}const Wl=30,zl=/[\s\.,:;?!]/;function Hm(n,{from:e,to:t}){let r=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,s=Math.max(r.from,e-Wl),o=Math.min(i,t+Wl),a=n.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<Wl;l++)if(!zl.test(a[l+1])&&zl.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-Wl;l--)if(!zl.test(a[l-1])&&zl.test(a[l])){a=a.slice(0,l);break}}return X.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${r.number}.`)}const OI=X.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),bI=[si,ki.low(dI),OI];class A1{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class Ai{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(La).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((p,m)=>p.from-m.from||p.to-m.to),o=new Lr,a=[],l=0,c=r.doc.iter(),d=0,h=r.doc.length;for(let p=0;;){let m=p==s.length?null:s[p];if(!m&&!a.length)break;let O,b;if(a.length)O=l,b=a.reduce((x,k)=>Math.min(x,k.to),m&&m.from>O?m.from:1e8);else{if(O=m.from,O>h)break;b=m.to,a.push(m),p++}for(;p<s.length;){let x=s[p];if(x.from==O&&(x.to>x.from||x.to==O))a.push(x),p++,b=Math.min(x.to,b);else{b=Math.min(x.from,b);break}}b=Math.min(b,h);let y=!1;if(a.some(x=>x.from==O&&(x.to==b||b==h))&&(y=O==b,!y&&b-O<10)){let x=O-(d+c.value.length);x>0&&(c.next(x),d=O);for(let k=O;;){if(k>=b){y=!0;break}if(!c.lineBreak&&d+c.value.length>k)break;k=d+c.value.length,d+=c.value.length,c.next()}}let S=AI(a);if(y)o.add(O,O,U.widget({widget:new CI(S),diagnostics:a.slice()}));else{let x=a.reduce((k,v)=>v.markClass?k+" "+v.markClass:k,"");o.add(O,b,U.mark({class:"cm-lintRange cm-lintRange-"+S+x,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>b)}))}if(l=b,l==h)break;for(let x=0;x<a.length;x++)a[x].to<=l&&a.splice(x--,1)}let f=o.finish();return new Ai(f,t,bi(f))}}function bi(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new A1(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new A1(r.from,s,r.diagnostic)}}),r}function yI(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(La).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(sw))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function xI(n,e){return n.field(hn,!1)?e:e.concat(oe.appendConfig.of(RI))}const sw=oe.define(),Km=oe.define(),ow=oe.define(),hn=Tt.define({create(){return new Ai(U.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),r=null,i=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);r=bi(t,n.selected.diagnostic,s)||bi(t,null,s)}!t.size&&i&&e.state.facet(La).autoPanel&&(i=null),n=new Ai(t,i,r)}for(let t of e.effects)if(t.is(sw)){let r=e.state.facet(La).autoPanel?t.value.length?_a.open:null:n.panel;n=Ai.init(t.value,r,e.state)}else t.is(Km)?n=new Ai(n.diagnostics,t.value?_a.open:null,n.selected):t.is(ow)&&(n=new Ai(n.diagnostics,n.panel,t.value));return n},provide:n=>[Ea.from(n,e=>e.panel),X.decorations.from(n,e=>e.diagnostics)]}),SI=U.mark({class:"cm-lintRange cm-lintRange-active"});function kI(n,e,t){let{diagnostics:r}=n.state.field(hn),i,s=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:d})=>{if(e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0)))return i=d.diagnostics,s=l,o=c,!1});let a=n.state.facet(La).tooltipFilter;return i&&a&&(i=a(i,n.state)),i?{pos:s,end:o,above:!0,create(){return{dom:vI(n,i)}}}:null}function vI(n,e){return Ce("ul",{class:"cm-tooltip-lint"},e.map(t=>lw(n,t,!1)))}const wI=n=>{let e=n.state.field(hn,!1);(!e||!e.panel)&&n.dispatch({effects:xI(n.state,[Km.of(!0)])});let t=cd(n,_a.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},R1=n=>{let e=n.state.field(hn,!1);return!e||!e.panel?!1:(n.dispatch({effects:Km.of(!1)}),!0)},QI=n=>{let e=n.state.field(hn,!1);if(!e)return!1;let t=n.state.selection.main,r=bi(e.diagnostics,null,t.to+1);return!r&&(r=bi(e.diagnostics,null,0),!r||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),BA(n,r.from,1,{tooltip:cw,until:i=>i.docChanged||i.newSelection.main.head<r.from||i.newSelection.main.head>r.to}),!0)},$I=[{key:"Mod-Shift-m",run:wI,preventDefault:!0},{key:"F8",run:QI}],La=W.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Or(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:E1,tooltipFilter:E1,needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t,hideOn:(e,t)=>e?t?(r,i,s)=>e(r,i,s)||t(r,i,s):e:t,autoPanel:(e,t)=>e||t})}}});function E1(n,e){return n?e?(t,r)=>e(n(t,r),r):n:e}function aw(n){let e=[];if(n)e:for(let{name:t}of n){for(let r=0;r<t.length;r++){let i=t[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function lw(n,e,t){var r;let i=t?aw(e.actions):[];return Ce("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ce("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let m=bi(n.state.field(hn).diagnostics,e);m&&s.apply(n,m.from,m.to)},{name:c}=s,d=i[o]?c.indexOf(i[o]):-1,h=d<0?c:[c.slice(0,d),Ce("u",c.slice(d,d+1)),c.slice(d+1)],f=s.markClass?" "+s.markClass:"";return Ce("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${d<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&Ce("div",{class:"cm-diagnosticSource"},e.source))}class CI extends zn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ce("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class N1{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=lw(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class _a{constructor(e){this.view=e,this.items=[];let t=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)R1(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=aw(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=bi(this.view.state.field(hn).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()}},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=Ce("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=Ce("div",{class:"cm-panel-lint"},this.list,Ce("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>R1(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(hn).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(hn),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let d of c.diagnostics){if(o.has(d))continue;o.add(d);let h=-1,f;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==d){h=p;break}h<0?(f=new N1(this.view,d),this.items.splice(r,0,f),i=!0):(f=this.items[h],h>r&&(this.items.splice(r,h-r),i=!0)),t&&f.diagnostic==t.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new N1(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(hn),r=bi(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:ow.of(r)})}static open(e){return new _a(e)}}function PI(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Zl(n){return PI(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const TI=X.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Zl("#f11")},".cm-lintRange-warning":{backgroundImage:Zl("orange")},".cm-lintRange-info":{backgroundImage:Zl("#999")},".cm-lintRange-hint":{backgroundImage:Zl("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function MI(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function AI(n){let e="hint",t=1;for(let r of n){let i=MI(r.severity);i>t&&(t=i,e=r.severity)}return e}const cw=_A(kI,{hideOn:yI}),RI=[hn,X.decorations.compute([hn],n=>{let{selected:e,panel:t}=n.field(hn);return!e||!t||e.from==e.to?U.none:U.set([SI.range(e.from,e.to)])}),cw,TI];var D1=function(e){e===void 0&&(e={});var t=e,r=t.crosshairCursor,i=r===void 0?!1:r,s=[];e.closeBracketsKeymap!==!1&&(s=s.concat(hN)),e.defaultKeymap!==!1&&(s=s.concat(W6)),e.searchKeymap!==!1&&(s=s.concat(mI)),e.historyKeymap!==!1&&(s=s.concat(Uj)),e.foldKeymap!==!1&&(s=s.concat(QR)),e.completionKeymap!==!1&&(s=s.concat(Xk)),e.lintKeymap!==!1&&(s=s.concat($I));var o=[];return e.lineNumbers!==!1&&o.push(tR()),e.highlightActiveLineGutter!==!1&&o.push(iR()),e.highlightSpecialChars!==!1&&o.push(mA()),e.history!==!1&&o.push(_j()),e.foldGutter!==!1&&o.push(TR()),e.drawSelection!==!1&&o.push(rA()),e.dropCursor!==!1&&o.push(cA()),e.allowMultipleSelections!==!1&&o.push(Ge.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&o.push(gR()),e.syntaxHighlighting!==!1&&o.push(Am(ER,{fallback:!0})),e.bracketMatching!==!1&&o.push(_R()),e.closeBrackets!==!1&&o.push(lN()),e.autocompletion!==!1&&o.push(yN()),e.rectangularSelection!==!1&&o.push(TA()),i!==!1&&o.push(RA()),e.highlightActiveLine!==!1&&o.push(SA()),e.highlightSelectionMatches!==!1&&o.push(q6()),e.tabSize&&typeof e.tabSize=="number"&&o.push(sl.of(" ".repeat(e.tabSize))),o.concat([il.of(s.flat())]).filter(Boolean)};const EI="#e5c07b",j1="#e06c75",NI="#56b6c2",DI="#ffffff",wc="#abb2bf",up="#7d8799",jI="#61afef",II="#98c379",I1="#d19a66",XI="#c678dd",LI="#21252b",X1="#2c313a",L1="#282c34",$h="#353a42",_I="#3E4451",_1="#528bff",BI=X.theme({"&":{color:wc,backgroundColor:L1},".cm-content":{caretColor:_1},".cm-cursor, .cm-dropCursor":{borderLeftColor:_1},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:_I},".cm-panels":{backgroundColor:LI,color:wc},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:L1,color:up,border:"none"},".cm-activeLineGutter":{backgroundColor:X1},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:$h},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:$h,borderBottomColor:$h},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:X1,color:wc}}},{dark:!0}),WI=ho.define([{tag:u.keyword,color:XI},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:j1},{tag:[u.function(u.variableName),u.labelName],color:jI},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:I1},{tag:[u.definition(u.name),u.separator],color:wc},{tag:[u.typeName,u.className,u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:EI},{tag:[u.operator,u.operatorKeyword,u.url,u.escape,u.regexp,u.link,u.special(u.string)],color:NI},{tag:[u.meta,u.comment],color:up},{tag:u.strong,fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.link,color:up,textDecoration:"underline"},{tag:u.heading,fontWeight:"bold",color:j1},{tag:[u.atom,u.bool,u.special(u.variableName)],color:I1},{tag:[u.processingInstruction,u.string,u.inserted],color:II},{tag:u.invalid,color:DI}]),zI=[BI,Am(WI)];var ZI=X.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),FI=function(e){e===void 0&&(e={});var t=e,r=t.indentWithTab,i=r===void 0?!0:r,s=t.editable,o=s===void 0?!0:s,a=t.readOnly,l=a===void 0?!1:a,c=t.theme,d=c===void 0?"light":c,h=t.placeholder,f=h===void 0?"":h,p=t.basicSetup,m=p===void 0?!0:p,O=[];switch(i&&O.unshift(il.of([z6])),m&&(typeof m=="boolean"?O.unshift(D1()):O.unshift(D1(m))),f&&O.unshift(QA(f)),d){case"light":O.push(ZI);break;case"dark":O.push(zI);break;case"none":break;default:O.push(d);break}return o===!1&&O.push(X.editable.of(!1)),l&&O.push(Ge.readOnly.of(!0)),[...O]},VI=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class YI{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class B1{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Ch=null,qI=()=>typeof window>"u"?new B1:(Ch||(Ch=new B1),Ch),UI=X.theme({"& .cm-scroller":{height:"100% !important"}}),W1=null,Ph=null;function GI(n,e,t,r,i,s){if(!n&&!e&&!t&&!r&&!i&&!s)return null;var o=JSON.stringify({height:n,minHeight:e,maxHeight:t,width:r,minWidth:i,maxWidth:s});return o===W1||(W1=o,Ph=X.theme({"&":{height:n,minHeight:e,maxHeight:t,width:r,minWidth:i,maxWidth:s}})),Ph}var z1=gr.define(),HI=200,KI=[];function JI(n){var e=n.value,t=n.selection,r=n.onChange,i=n.onStatistics,s=n.onCreateEditor,o=n.onUpdate,a=n.extensions,l=a===void 0?KI:a,c=n.autoFocus,d=n.theme,h=d===void 0?"light":d,f=n.height,p=f===void 0?null:f,m=n.minHeight,O=m===void 0?null:m,b=n.maxHeight,y=b===void 0?null:b,S=n.width,x=S===void 0?null:S,k=n.minWidth,v=k===void 0?null:k,w=n.maxWidth,Q=w===void 0?null:w,C=n.placeholder,T=C===void 0?"":C,P=n.editable,R=P===void 0?!0:P,M=n.readOnly,D=M===void 0?!1:M,N=n.indentWithTab,I=N===void 0?!0:N,Z=n.basicSetup,ne=Z===void 0?!0:Z,le=n.root,B=n.initialState,se=$.useState(),re=se[0],me=se[1],$e=$.useState(),G=$e[0],fe=$e[1],Je=$.useState(),St=Je[0],On=Je[1],mt=$.useState(()=>({current:null}))[0],Rn=$.useState(()=>({current:null}))[0],br=GI(p,O,y,x,v,Q),En=X.updateListener.of(ut=>{if(ut.docChanged&&typeof r=="function"&&!ut.transactions.some(F=>F.annotation(z1))){mt.current?mt.current.reset():(mt.current=new YI(()=>{if(Rn.current){var F=Rn.current;Rn.current=null,F()}mt.current=null},HI),qI().add(mt.current));var Vn=ut.state.doc,Yn=Vn.toString();r(Yn,ut)}i&&i(VI(ut))}),xe=FI({theme:h,editable:R,readOnly:D,placeholder:T,indentWithTab:I,basicSetup:ne}),Ee=[En,...br?[br]:[],UI,...xe];return o&&typeof o=="function"&&Ee.push(X.updateListener.of(o)),Ee=Ee.concat(l),$.useLayoutEffect(()=>{if(re&&!St){var ut={doc:e,selection:t,extensions:Ee},Vn=B?Ge.fromJSON(B.json,ut,B.fields):Ge.create(ut);if(On(Vn),!G){var Yn=new X({state:Vn,parent:re,root:le});fe(Yn),s&&s(Yn,Vn)}}return()=>{G&&(On(void 0),fe(void 0))}},[re,St]),$.useEffect(()=>{n.container&&me(n.container)},[n.container]),$.useEffect(()=>()=>{G&&(G.destroy(),fe(void 0)),mt.current&&(mt.current.cancel(),mt.current=null)},[G]),$.useEffect(()=>{c&&G&&G.focus()},[c,G]),$.useEffect(()=>{G&&G.dispatch({effects:oe.reconfigure.of(Ee)})},[h,l,p,O,y,x,v,Q,T,R,D,I,ne,r,o]),$.useEffect(()=>{if(e!==void 0){var ut=G?G.state.doc.toString():"";if(G&&e!==ut){var Vn=mt.current&&!mt.current.isDone,Yn=()=>{G&&e!==G.state.doc.toString()&&G.dispatch({changes:{from:0,to:G.state.doc.toString().length,insert:e||""},annotations:[z1.of(!0)]})};Vn?Rn.current=Yn:Yn()}}},[e,G]),{state:St,setState:On,view:G,setView:fe,container:re,setContainer:me}}var e7=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],uw=$.forwardRef((n,e)=>{var t=n.className,r=n.value,i=r===void 0?"":r,s=n.selection,o=n.extensions,a=o===void 0?[]:o,l=n.onChange,c=n.onStatistics,d=n.onCreateEditor,h=n.onUpdate,f=n.autoFocus,p=n.theme,m=p===void 0?"light":p,O=n.height,b=n.minHeight,y=n.maxHeight,S=n.width,x=n.minWidth,k=n.maxWidth,v=n.basicSetup,w=n.placeholder,Q=n.indentWithTab,C=n.editable,T=n.readOnly,P=n.root,R=n.initialState,M=ix(n,e7),D=$.useRef(null),N=JI({root:P,value:i,autoFocus:f,theme:m,height:O,minHeight:b,maxHeight:y,width:S,minWidth:x,maxWidth:k,basicSetup:v,placeholder:w,indentWithTab:Q,editable:C,readOnly:T,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:a,initialState:R}),I=N.state,Z=N.view,ne=N.container,le=N.setContainer;$.useImperativeHandle(e,()=>({editor:D.current,state:I,view:Z}),[D,ne,I,Z]);var B=$.useCallback(re=>{D.current=re,le(re)},[le]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var se=typeof m=="string"?"cm-theme-"+m:"cm-theme";return g.jsx("div",ie({ref:B,className:""+se+(t?" "+t:"")},M))});uw.displayName="CodeMirror";const t7=X.theme({"&":{backgroundColor:"#1E2533"},".cm-scroller":{backgroundColor:"#1E2533"},".cm-gutters":{backgroundColor:"#141925",borderRight:"1px solid #2A3242",fontFamily:"'Fira Code', monospace"},".cm-gutterElement":{display:"flex",alignItems:"center",justifyContent:"end"},".cm-activeLineGutter":{backgroundColor:"#1E2533"}}),n7=X.theme({".cm-content ":{fontFamily:"'Fira Code', monospace",padding:"0",lineHeight:"1.6"}}),r7=[$N(),Ck(),iD(),t7,bj,n7];function Jm({className:n,fontSize:e,lineHeight:t,disableWordWrap:r=!1,...i}){const s=$.useMemo(()=>{const o=[...r7,r?null:X.lineWrapping,X.theme({".cm-content ":{fontSize:e?.toString()?`${e}px !important`:"",lineHeight:t?.toString()?`${t} !important`:""}})];return hi(o)},[r,e,t]);return g.jsx(uw,{theme:"none",width:"100%",onKeyDown:o=>o.stopPropagation(),extensions:s,...i,className:V("cursor-text text-[14px]",n)})}const dw=$.createContext("default");function aU({theme:n,children:e}){return g.jsx(dw.Provider,{value:n,children:e})}function i7(){return $.useContext(dw)}function s7(){const n=i7()==="modal";return{input:V("text-foreground w-full text-sm",n?"h-[56px] rounded-[16px] border border-[#2A3242] bg-transparent px-6 focus:outline-none":"border-stock h-[3.5rem] rounded-[1rem] border bg-white px-4"),textarea:V("text-foreground field-sizing-fixed w-full min-w-0 p-4 resize-none text-sm leading-normal break-words",n?"min-h-[6.75rem] rounded-[16px] border border-[#2A3242] bg-transparent focus:outline-none":"border-stock h-[6.75rem] rounded-[1rem] border bg-white"),select:V("text-foreground w-full text-sm [&[data-placeholder]]:text-muted-foreground",n?"h-[56px]! rounded-[16px] border border-[#2A3242] bg-transparent px-6 focus:outline-none":"border-stock [&[data-placeholder]]:text-paragraph !h-[3.5rem] rounded-[1rem] border bg-white px-4"),surface:V("text-foreground w-full",n?"min-h-14 rounded-[16px] border border-[#2A3242] bg-transparent px-4 py-3":"border-stock min-h-14 rounded-[1rem] border bg-white px-4 py-3"),surfaceRow:V(n?"flex h-14 items-center gap-2 rounded-[16px] border border-[#2A3242] bg-transparent px-4 py-3":"flex h-14 items-center gap-2 rounded-[1rem] bg-white px-4 py-3"),surfaceWrap:V(n?"flex min-h-14 flex-wrap items-center gap-4 rounded-[16px] border border-[#2A3242] bg-transparent px-4 py-3":"flex min-h-14 flex-wrap items-center gap-4 rounded-[1rem] bg-white px-4 py-3"),uploadZone:V("flex h-[8.75rem] w-full flex-col items-center justify-center gap-4 p-6",n?"rounded-[16px] border-2 border-dashed border-[#2A3242] bg-transparent":"border-primary/20 rounded-2xl border-2 border-dashed bg-white"),colorInput:V("text-foreground w-full text-sm uppercase outline-none transition-all focus:ring-[3px] focus:ring-ring/50",n?"h-[56px] rounded-[16px] border border-[#2A3242] bg-transparent px-4 pl-11 ring-0":"ring-ring/50 h-[3.5rem] rounded-[1rem] border-none bg-white px-4 pl-11 ring-0"),slider:V("flex h-14 items-center gap-3 px-4",n?"rounded-[16px] border border-[#2A3242] bg-transparent":"rounded-[1rem] bg-white"),dateButton:V("text-foreground h-[3.5rem] w-full justify-between px-4 text-sm font-normal",n?"rounded-[16px] border border-[#2A3242] bg-transparent hover:bg-transparent":"border-stock rounded-[1rem] border bg-white"),dateRangeButton:V("text-foreground h-auto min-h-14 w-full justify-between px-4 font-normal sm:text-sm",n?"rounded-[16px] border border-[#2A3242] bg-transparent hover:bg-transparent":"border-stock rounded-[1rem] border bg-white"),codeEditorWrapper:V("w-full overflow-hidden",n?"rounded-[16px] border border-[#2A3242] bg-transparent":"border-stock rounded-[0.75rem] border bg-white"),fieldLabel:V("mb-2 block text-sm",n?"font-normal text-muted-foreground/70":"text-foreground mb-3 font-medium capitalize"),fieldValue:V(n?"text-foreground font-medium":"")}}var Mr=(n=>(n.TextInput="Text Input",n.URLInput="URL Input",n.NumberInput="Number Input",n.TextBox="Text Editor",n.DatePicker="Date Picker",n.DropdownSelect="Dropdown",n.MultiSelect="Multi Select",n.BooleanToggle="Boolean Toggle",n.LinkOrFileUpload="Link or File Upload",n.RichTextEditor="Rich Text Editor",n.CodeEditor="Code Editor",n.KeyValueList="Key-Value List",n.TagInput="Tag Input",n.DateRangePicker="Date Range Picker",n.ColorPicker="Color Picker",n.Slider="Slider",n.FileUpload="File Upload",n.SearchSelect="Search Select",n.CheckboxGroup="Checkbox Group",n))(Mr||{});const o7=$.lazy(()=>j$(()=>import("./editor-vqK4qAnB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38])).then(n=>({default:n.QuillRichTextEditor})));function lU(n){return g.jsx($.Suspense,{children:g.jsx(o7,{...n})})}function cU({value:n,height:e="10rem",readonly:t=!1,setValue:r}){const i=s7();return g.jsx("div",{className:i.codeEditorWrapper,children:g.jsx(Jm,{height:e,value:n??"",onChange:r,readOnly:t})})}function Th(n){if(!(!n?.type||n.type==="none"))return n.type===Bi.Arrow||n.type===Bi.ArrowClosed?{color:"context-stroke",strokeWidth:1.5,...n}:n.type}function uU(n){if(n)return typeof n=="string"?{type:n}:n}function Bs(){return crypto.randomUUID()}function dU(n){return pr({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{d:"M11.5793 2.05685C11.5826 2.05744 11.5858 2.05815 11.5891 2.05881L11.591 2.05978C11.5963 2.06087 11.6014 2.06242 11.6066 2.06369C11.6243 2.06801 11.6416 2.07297 11.6584 2.07932C11.6711 2.08411 11.6833 2.09003 11.6955 2.09592C11.705 2.10052 11.7147 2.10436 11.7238 2.10959L11.7336 2.11545C11.739 2.11873 11.744 2.12269 11.7492 2.12619C11.7837 2.14933 11.8151 2.17666 11.842 2.20822C11.9093 2.28675 11.9504 2.38867 11.9504 2.50021V4.50021C11.9503 4.74857 11.7485 4.95031 11.5002 4.95041C11.2517 4.95041 11.0501 4.74863 11.05 4.50021V2.95041H8.04999V12.05H9.25409C9.50262 12.05 9.70428 12.2517 9.70428 12.5002C9.7042 12.7175 9.54981 12.8986 9.34491 12.9406L9.25409 12.9504H5.75409L5.66327 12.9406C5.45848 12.8985 5.30398 12.7174 5.30389 12.5002C5.30389 12.2829 5.45845 12.1019 5.66327 12.0598L5.75409 12.05H6.95038V2.95041H3.95038V4.50021C3.95025 4.74857 3.74854 4.9503 3.50018 4.95041C3.25173 4.95041 3.05011 4.74863 3.04999 4.50021V2.50021C3.04999 2.4456 3.06047 2.39339 3.07831 2.34494C3.07994 2.3405 3.08045 2.33564 3.08221 2.33127C3.08731 2.31866 3.09459 2.30714 3.10077 2.29514C3.10725 2.2825 3.11368 2.26993 3.12128 2.25803C3.12798 2.24757 3.13524 2.2376 3.14276 2.22775C3.14853 2.22018 3.15411 2.21248 3.16034 2.20529L3.18182 2.18185C3.18639 2.17728 3.19171 2.17353 3.19647 2.16916C3.20838 2.15819 3.22054 2.14755 3.23358 2.13791C3.24267 2.13121 3.25231 2.12537 3.2619 2.11935C3.27449 2.11144 3.28758 2.10453 3.30096 2.09787C3.31229 2.09225 3.3233 2.08594 3.33514 2.08127C3.3506 2.07516 3.36675 2.07101 3.383 2.06662C3.3934 2.06382 3.40356 2.05989 3.41425 2.05783C3.44199 2.05247 3.47087 2.05002 3.50018 2.05002H11.5002L11.5793 2.05685Z",fill:"currentColor"},child:[]}]})(n)}function a7(n){return pr({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{d:"M12.6533 1.00781C13.4097 1.08461 14 1.72334 14 2.5V12.5L13.9922 12.6533C13.9205 13.3593 13.3593 13.9205 12.6533 13.9922L12.5 14H2.5L2.34668 13.9922C1.64069 13.9205 1.07949 13.3593 1.00781 12.6533L1 12.5V2.5C1 1.72334 1.59028 1.08461 2.34668 1.00781L2.5 1H12.5L12.6533 1.00781ZM2 12.5C2 12.7761 2.22386 13 2.5 13H7V10H2V12.5ZM8 13H12.5C12.7761 13 13 12.7761 13 12.5V10H8V13ZM2 6V9H7V6H2ZM8 6V9H13V6H8ZM2.5 2C2.22386 2 2 2.22386 2 2.5V5H7V2H2.5ZM8 5H13V2.5C13 2.22386 12.7761 2 12.5 2H8V5Z",fill:"currentColor"},child:[]}]})(n)}function hU(n){return pr({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{d:"M1.44995 10.95C1.72609 10.95 1.94995 11.1738 1.94995 11.45V12.95H3.44995C3.72609 12.95 3.94995 13.1738 3.94995 13.45C3.94995 13.7261 3.72609 13.95 3.44995 13.95H1.44995C1.17381 13.95 0.949951 13.7261 0.949951 13.45V11.45C0.949951 11.1738 1.17381 10.95 1.44995 10.95ZM8.94995 12.95C9.22609 12.95 9.44995 13.1738 9.44995 13.45C9.44995 13.7261 9.22609 13.95 8.94995 13.95H5.94995C5.67381 13.95 5.44995 13.7261 5.44995 13.45C5.44995 13.1738 5.67381 12.95 5.94995 12.95H8.94995ZM13.45 10.95C13.7261 10.95 13.95 11.1738 13.95 11.45V13.45C13.9499 13.7261 13.7261 13.9499 13.45 13.95H11.45C11.1738 13.95 10.95 13.7261 10.95 13.45C10.95 13.1738 11.1738 12.95 11.45 12.95H12.949L12.95 11.45C12.95 11.1738 13.1738 10.95 13.45 10.95ZM1.44995 5.44995C1.72609 5.44995 1.94995 5.67381 1.94995 5.94995V8.94995C1.94995 9.22609 1.72609 9.44995 1.44995 9.44995C1.17381 9.44995 0.949951 9.22609 0.949951 8.94995V5.94995C0.949951 5.67381 1.17381 5.44995 1.44995 5.44995ZM13.45 5.44995C13.7261 5.44995 13.95 5.67381 13.95 5.94995V8.94995C13.95 9.22609 13.7261 9.44995 13.45 9.44995C13.1738 9.44995 12.95 9.22609 12.95 8.94995V5.94995C12.95 5.67381 13.1738 5.44995 13.45 5.44995ZM3.44995 0.949951C3.72609 0.949951 3.94995 1.17381 3.94995 1.44995C3.94995 1.72609 3.72609 1.94995 3.44995 1.94995H1.94995V3.44995C1.94995 3.72609 1.72609 3.94995 1.44995 3.94995C1.17382 3.94994 0.949953 3.72609 0.949951 3.44995V1.44995C0.949951 1.31734 1.00267 1.1902 1.09644 1.09644C1.1902 1.00267 1.31734 0.949951 1.44995 0.949951H3.44995ZM13.449 0.949951C13.7251 0.949951 13.95 1.17381 13.95 1.44995V3.44995C13.95 3.72609 13.7261 3.94994 13.45 3.94995C13.1738 3.94995 12.95 3.72609 12.95 3.44995V1.94995H11.45C11.1738 1.94995 10.95 1.72609 10.95 1.44995C10.95 1.17381 11.1738 0.949951 11.45 0.949951H13.449ZM8.94995 0.949951C9.22609 0.949951 9.44995 1.17381 9.44995 1.44995C9.44995 1.72609 9.22609 1.94995 8.94995 1.94995H5.94995C5.67381 1.94995 5.44995 1.72609 5.44995 1.44995C5.44995 1.17381 5.67381 0.949951 5.94995 0.949951H8.94995Z",fill:"currentColor"},child:[]}]})(n)}function fU(n){return pr({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{d:"M13.8779 2.00684C14.5082 2.07092 15 2.60285 15 3.25V10.75C15 11.4404 14.4404 12 13.75 12H9.92676L10.1699 13.2988L10.1797 13.4238C10.1678 13.7104 9.93104 13.95 9.62988 13.9502H5.37012C5.02598 13.95 4.76674 13.6371 4.83008 13.2988L5.07324 12H1.25C0.559644 12 2.14752e-08 11.4404 0 10.75V3.25C1.34221e-09 2.55964 0.559644 2 1.25 2H13.75L13.8779 2.00684ZM5.98926 12L5.79297 13.0498H9.20703L9.01074 12H5.98926ZM1.25 3C1.11193 3 1 3.11193 1 3.25V10.75C1 10.8881 1.11193 11 1.25 11H13.75C13.8881 11 14 10.8881 14 10.75V3.25C14 3.12931 13.9145 3.02833 13.8008 3.00488L13.75 3H1.25Z",fill:"currentColor"},child:[]}]})(n)}function pU(n){return pr({attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{d:"M11.5 12C11.7761 12 12 11.7761 12 11.5C12 11.2239 11.7761 11 11.5 11H9.90039C8.77204 11 7.9554 10.9997 7.31348 10.9473C6.67741 10.8953 6.25672 10.7942 5.91113 10.6182C5.25262 10.2826 4.71738 9.74738 4.38184 9.08887C4.20575 8.74328 4.10471 8.32259 4.05273 7.68652C4.00029 7.0446 4 6.22796 4 5.09961V3.5C4 3.22386 3.77614 3 3.5 3C3.22386 3 3 3.22386 3 3.5V5.09961C3 6.21131 3.00012 7.07553 3.05664 7.76758C3.11366 8.46547 3.23038 9.03293 3.49023 9.54297C3.92166 10.3897 4.6103 11.0783 5.45703 11.5098C5.96707 11.7696 6.53453 11.8863 7.23242 11.9434C7.92447 11.9999 8.78869 12 9.90039 12H11.5Z",fill:"currentColor"},child:[]}]})(n)}const eo=new Set;function l7(){for(const n of eo)n.remove();eo.clear()}typeof document<"u"&&document.addEventListener("dragend",l7);function c7(n,e){const t=document.createElement("div");t.style.cssText=["position: fixed","top: -1000px","left: -1000px","display: block","width: 140px","overflow: hidden","border-radius: 10px","border: 1px solid #2A3242","background: #141925","box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45)","pointer-events: none","z-index: 9999"].join(";");const r=document.createElement("img");if(r.src=e,r.style.cssText=["display: block","width: 100%","height: auto"].join(";"),t.appendChild(r),document.body.appendChild(t),eo.add(t),!n.dataTransfer){t.remove(),eo.delete(t);return}const{width:i,height:s}=t.getBoundingClientRect();n.dataTransfer.setDragImage(t,i/2,s/2)}function u7(n,e){const t=document.createElement("div");if(t.style.cssText=["position: fixed","top: -1000px","left: -1000px","display: inline-flex","align-items: center","gap: 8px","padding: 8px 12px","border-radius: 8px","border: 1px solid #2A3242","background: #141925","color: #F4F7FC","font-size: 14px","font-weight: 500","font-family: system-ui, -apple-system, sans-serif","box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35)","pointer-events: none","white-space: nowrap","z-index: 9999"].join(";"),t.textContent=e,document.body.appendChild(t),eo.add(t),!n.dataTransfer){t.remove(),eo.delete(t);return}n.dataTransfer.setDragImage(t,16,20)}function mU(n,e,t,r,i,s){const o=n.dataTransfer,a={type:e,id:Bs(),data:{...t},...r};if(o.setData("application/react-flow",JSON.stringify(a)),o.effectAllowed="move",s){c7(n.nativeEvent,s);return}u7(n.nativeEvent,i??d7(t))}function d7(n){if(typeof n.componentName=="string"&&n.componentName)return n.componentName;if(typeof n.name=="string"&&n.name)return n.name;const r=n.componentFields?.find(i=>i.label==="Name")?.data?.[0]?.value;return r||"Component"}function h7(n){const e=n.getData("application/react-flow");if(!e)return null;const t=JSON.parse(e);return{id:Bs(),...t,data:{...t.data,componentFields:t?.data?.componentFields??[]}}}const Z1=lo(`
74
- query Comments($orgId: ID!, $resourceId: ID!) {
75
- comments(orgId: $orgId, resourceId: $resourceId) {
76
- id
77
- resourceId
78
- parentCommentId
79
- text
80
- createdBy
81
- createdAt
82
- createdByActor {
83
- id
84
- name
85
- avatarUrl
86
- }
87
- }
88
- }
89
- `),f7=lo(`
90
- mutation CreateComment($orgId: ID!, $input: CreateCommentInput!) {
91
- createComment(orgId: $orgId, input: $input) {
92
- id
93
- }
94
- }
95
- `),p7=lo(`
96
- mutation UpdateComment($orgId: ID!, $id: ID!, $input: UpdateCommentInput!) {
97
- updateComment(orgId: $orgId, id: $id, input: $input) {
98
- id
99
- }
100
- }
101
- `),m7=lo(`
102
- mutation DeleteComment($orgId: ID!, $id: ID!) {
103
- deleteComment(orgId: $orgId, id: $id)
104
- }
105
- `);var hw=cC(),F1=Object.defineProperty,g7=(n,e)=>{let t={};for(var r in n)F1(t,r,{get:n[r],enumerable:!0});return F1(t,Symbol.toStringTag,{value:"Module"}),t};function kt(n){this.content=n}kt.prototype={constructor:kt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new kt(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new kt(t)},addToStart:function(n,e){return new kt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new kt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new kt(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=kt.from(n),n.size?new kt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=kt.from(n),n.size?new kt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=kt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};kt.from=function(n){if(n instanceof kt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new kt(e)};function fw(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,a=s.text,l=0;for(;o[l]==a[l];l++)t++;return l&&l<o.length&&l<a.length&&gw(o.charCodeAt(l-1))&&mw(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=fw(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function pw(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=o.text,d=a.text,h=c.length,f=d.length;for(;h>0&&f>0&&c[h-1]==d[f-1];)h--,f--,t--,r--;return h&&f&&h<c.length&&gw(c.charCodeAt(h-1))&&mw(c.charCodeAt(h))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let c=pw(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}function mw(n){return n>=56320&&n<57344}function gw(n){return n>=55296&&n<56320}class E{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,i+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new E(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new E(r,i)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new E(i,s)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return fw(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return pw(this,e,t,r)}findIndex(e){if(e==0)return Fl(0,e);if(e==this.size)return Fl(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Fl(t+1,s):Fl(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return E.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new E(t||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const Mh={index:0,offset:0};function Fl(n,e){return Mh.index=n,Mh.offset=e,Mh}function uu(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!uu(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!uu(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Ae=class dp{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&uu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return dp.none;if(e instanceof dp)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Ae.none=[];class Ba extends Error{}class z{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=bw(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new z(r,this.openStart,this.openEnd)}removeBetween(e,t){return new z(Ow(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return z.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new z(E.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new z(e,r,i)}}z.empty=new z(E.empty,0,0);function Ow(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Ow(s.content,e-i-1,t-i-1)))}function bw(n,e,t,r,i,s){let{index:o,offset:a}=n.findIndex(e),l=n.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=bw(l.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,l);return c&&n.replaceChild(o,l.copy(c))}function O7(n,e,t){if(t.openStart>n.depth)throw new Ba("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ba("Inconsistent open depths");return yw(n,e,t,0)}function yw(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=yw(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Vi(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=b7(t,n);return Vi(s,Sw(n,o,a,e,r))}else return Vi(s,du(n,e,r))}function xw(n,e){if(!e.type.compatibleContent(n.type))throw new Ba("Cannot join "+e.type.name+" onto "+n.type.name)}function hp(n,e,t){let r=n.node(t);return xw(r,e.node(t)),r}function Fi(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ra(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Fi(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Fi(i.child(a),r);e&&e.depth==t&&e.textOffset&&Fi(e.nodeBefore,r)}function Vi(n,e){if(!n.type.validContent(e))throw new Ba("Invalid content for node "+n.type.name);return n.copy(e)}function Sw(n,e,t,r,i){let s=n.depth>i&&hp(n,e,i+1),o=r.depth>i&&hp(t,r,i+1),a=[];return ra(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(xw(s,o),Fi(Vi(s,Sw(n,e,t,r,i+1)),a)):(s&&Fi(Vi(s,du(n,e,i+1)),a),ra(e,t,i,a),o&&Fi(Vi(o,du(t,r,i+1)),a)),ra(r,null,i,a),new E(a)}function du(n,e,t){let r=[];if(ra(null,n,t,r),n.depth>t){let i=hp(n,e,t+1);Fi(Vi(i,du(n,e,t+1)),r)}return ra(e,null,t,r),new E(r)}function b7(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(E.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Wa{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ae.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new hu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new Wa(t,r,s)}static resolveCached(e,t){let r=V1.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else V1.set(e,r=new y7);let i=r.elts[r.i]=Wa.resolve(e,t);return r.i=(r.i+1)%x7,i}}class y7{constructor(){this.elts=[],this.i=0}}const x7=12,V1=new WeakMap;class hu{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const S7=Object.create(null);let oi=class fp{constructor(e,t,r,i=Ae.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||E.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&uu(this.attrs,t||e.defaultAttrs||S7)&&Ae.sameSet(this.marks,r||Ae.none)}copy(e=null){return e==this.content?this:new fp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new fp(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return z.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new z(c,i.depth-o,s.depth-o)}replace(e,t,r){return O7(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Wa.resolveCached(this,e)}resolveNoCache(e){return Wa.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),kw(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=E.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),Y1(this.type.attrs,this.attrs,"node",this.type.name);let e=Ae.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];Y1(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Ae.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=E.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};oi.prototype.text=void 0;let k7=class pp extends oi{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kw(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new pp(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pp(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function kw(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Y1(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(e[i])}class is{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new v7(e,t);if(r.next==null)return is.empty;let i=vw(r);r.next&&r.err("Unexpected trailing text");let s=M7(T7(i));return A7(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return E.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:h}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(h)==-1){i.push(h);let f=s(h,a.concat(d));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
106
- `)}}is.empty=new is(!0);class v7{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function vw(n){let e=[];do e.push(w7(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function w7(n){let e=[];do e.push(Q7(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Q7(n){let e=P7(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=$7(n,e);else break;return e}function q1(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function $7(n,e){let t=q1(n),r=t;return n.eat(",")&&(n.next!="}"?r=q1(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function C7(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function P7(n){if(n.eat("(")){let e=vw(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=C7(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function T7(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,l),d),l=d}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();r(l,d),i(s(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ww(n,e){return e-n}function U1(n,e){let t=[];return r(e),t.sort(ww);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function M7(n){let e=Object.create(null);return t(U1(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);U1(n,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new is(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(ww);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function A7(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Qw(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function $w(n,e){let t=Object.create(null);for(let r in n){let i=n[r],s=e&&e[r];if(s===void 0)if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r);else i.validate&&i.validate(s);t[r]=s}return t}function Cw(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new E7(n,r,e[r]);return t}let G1=class Pw{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Cw(e,r.attrs),this.defaultAttrs=Qw(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==is.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$w(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new oi(this,this.computeAttrs(e),E.from(t),Ae.setFrom(r))}createChecked(e=null,t,r){return t=E.from(t),this.checkContent(t),new oi(this,this.computeAttrs(e),t,Ae.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=E.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(E.empty,!0);return s?new oi(this,e,t.append(s),Ae.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Ae.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Pw(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function R7(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class E7{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?R7(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bd{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Cw(e,i.attrs),this.excluded=null;let s=Qw(this.attrs);this.instance=s?new Ae(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Ae(this,$w(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new bd(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class Tw{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=kt.from(e.nodes),t.marks=kt.from(e.marks||{}),this.nodes=G1.compile(this.spec.nodes,this),this.marks=bd.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=is.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?H1(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:H1(this,o.split(" "))}this.nodeFromJSON=i=>oi.fromJSON(this,i),this.markFromJSON=i=>Ae.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof G1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new k7(r,r.defaultAttrs,e,Ae.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function H1(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function N7(n){return n.tag!=null}function D7(n){return n.style!=null}class ai{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(N7(i))this.tags.push(i);else if(D7(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new J1(this,t,!1);return r.addAll(e,Ae.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new J1(this,t,!0);return r.addAll(e,Ae.none,t.from,t.to),z.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(X7(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=eb(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=eb(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ai(e,ai.schemaRules(e)))}}const Mw={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},j7={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Aw={ol:!0,ul:!0},za=1,mp=2,ia=4;function K1(n,e,t){return e!=null?(e?za:0)|(e==="full"?mp:0):n&&n.whitespace=="pre"?za|mp:t&~ia}class Vl{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ae.none,this.match=s||(o&ia?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&za)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Mw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class J1{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=K1(null,t.preserveWhitespace,0)|(r?ia:0);i?s=new Vl(i.type,i.attrs,Ae.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Vl(null,null,Ae.none,!0,null,o):s=new Vl(e.schema.topNodeType,null,Ae.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&mp?"full":this.localPreserveWS||(i.options&za)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
107
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Aw.hasOwnProperty(o)&&this.parser.normalizeLists&&I7(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:j7.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Mw.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let h=l&&l.skip?t:this.readStyles(e,t);h&&this.addAll(e,h),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
108
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Ae.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):tb(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=K1(e,s,o.options);o.options&ia&&o.content.length==0&&(a|=ia);let l=Ae.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):tb(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Vl(e,t,l,i,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=za)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function I7(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Aw.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function X7(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function eb(n){let e={};for(let t in n)e[t]=n[t];return e}function tb(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class us{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Yl(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){if(e.isText)return Yl(t).createTextNode(e.text);let{dom:r,contentDOM:i}=Qc(Yl(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Qc(Yl(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:Qc(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new us(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=nb(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return nb(e.marks)}}function nb(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Yl(n){return n.document||window.document}const rb=new WeakMap;function L7(n){let e=rb.get(n);return e===void 0&&rb.set(n,e=_7(n)),e}function _7(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function Qc(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=L7(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let h in c)if(c[h]!=null){let f=h.indexOf(" ");f>0?l.setAttributeNS(h.slice(0,f),h.slice(f+1),c[h]):h=="style"&&l.style?l.style.cssText=c[h]:l.setAttribute(h,c[h])}}for(let h=d;h<e.length;h++){let f=e[h];if(f===0){if(h<e.length-1||h>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(n.createTextNode(f));else{let{dom:p,contentDOM:m}=Qc(n,f,t,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const Rw=65535,Ew=Math.pow(2,16);function B7(n,e){return n+e*Ew}function ib(n){return n&Rw}function W7(n){return(n-(n&Rw))/Ew}const Nw=1,Dw=2,$c=4,jw=8;class gp{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&jw)>0}get deletedBefore(){return(this.delInfo&(Nw|$c))>0}get deletedAfter(){return(this.delInfo&(Dw|$c))>0}get deletedAcross(){return(this.delInfo&$c)>0}}class dn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&dn.empty)return dn.empty}recover(e){let t=0,r=ib(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+W7(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],d=this.ranges[a+o],h=l+c;if(e<=h){let f=c?e==l?-1:e==h?1:t:t,p=l+i+(f<0?0:d);if(r)return p;let m=e==(t<0?l:h)?null:B7(a/3,e-l),O=0;return c&&(O|=e==l?Dw:e==h?Nw:$c,(t<0?e!=l:e!=h)&&(O|=jw)),new gp(p,O,m)}i+=d-c}return r?e+i:new gp(e+i,0,null)}touches(e,t){let r=0,i=ib(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],d=l+c;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+r];e(a,a+c,l,l+d),s+=d-c}}invert(){return new dn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?dn.empty:new dn(e<0?[0,-e,0]:[0,0,e])}}dn.empty=new dn([]);class Za{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Za(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Za;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new gp(e,i,null)}}const Ah=Object.create(null);class Lt{getMap(){return dn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ah[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ah)throw new RangeError("Duplicate use of step JSON ID "+e);return Ah[e]=t,t.prototype.jsonID=e,t}}class ct{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ct(e,null)}static fail(e){return new ct(null,e)}static fromReplace(e,t,r,i){try{return ct.ok(e.replace(t,r,i))}catch(s){if(s instanceof Ba)return ct.fail(s.message);throw s}}}function eg(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(eg(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return E.fromArray(r)}class ri extends Lt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new z(eg(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ct.fromReplace(e,this.from,this.to,s)}invert(){return new _n(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ri(t.pos,r.pos,this.mark)}merge(e){return e instanceof ri&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ri(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ri(t.from,t.to,e.markFromJSON(t.mark))}}Lt.jsonID("addMark",ri);class _n extends Lt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new z(eg(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ct.fromReplace(e,this.from,this.to,r)}invert(){return new ri(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new _n(t.pos,r.pos,this.mark)}merge(e){return e instanceof _n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new _n(t.from,t.to,e.markFromJSON(t.mark))}}Lt.jsonID("removeMark",_n);class ii extends Lt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ct.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ct.fromReplace(e,this.pos,this.pos+1,new z(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new ii(this.pos,t.marks[i]);return new ii(this.pos,this.mark)}}return new ss(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ii(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ii(t.pos,e.markFromJSON(t.mark))}}Lt.jsonID("addNodeMark",ii);class ss extends Lt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ct.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ct.fromReplace(e,this.pos,this.pos+1,new z(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ii(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ss(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ss(t.pos,e.markFromJSON(t.mark))}}Lt.jsonID("removeNodeMark",ss);class lt extends Lt{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Op(e,this.from,this.to)?ct.fail("Structure replace would overwrite content"):ct.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dn([this.from,this.to-this.from,this.slice.size])}invert(e){return new lt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&lt.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new lt(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof lt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?z.empty:new z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new lt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?z.empty:new z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new lt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new lt(t.from,t.to,z.fromJSON(e,t.slice),!!t.structure)}}lt.MAP_BIAS=1;Lt.jsonID("replace",lt);class bt extends Lt{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Op(e,this.from,this.gapFrom)||Op(e,this.gapTo,this.to)))return ct.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ct.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ct.fromReplace(e,this.from,this.to,r):ct.fail("Content does not fit in gap")}getMap(){return new dn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new bt(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new bt(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new bt(t.from,t.to,t.gapFrom,t.gapTo,z.fromJSON(e,t.slice),t.insert,!!t.structure)}}Lt.jsonID("replaceAround",bt);function Op(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function z7(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let h=l.marks;if(!r.isInSet(h)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,t),m=r.addToSet(h);for(let O=0;O<h.length;O++)h[O].isInSet(m)||(o&&o.to==f&&o.mark.eq(h[O])?o.to=p:i.push(o=new _n(f,p,h[O])));a&&a.to==f?a.to=p:s.push(a=new ri(f,p,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function Z7(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof bd){let c=o.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let d=0;d<l.length;d++){let h=l[d],f;for(let p=0;p<i.length;p++){let m=i[p];m.step==s-1&&h.eq(i[p].style)&&(f=m)}f?(f.to=c,f.step=s):i.push({style:h,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>n.step(new _n(o.from,o.to,o.style)))}function tg(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),d=a+c.nodeSize,h=r.matchType(c.type);if(!h)o.push(new lt(a,d,z.empty));else{r=h;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new _n(a,d,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(c.text);)m||(m=new z(E.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new lt(a+f.index,a+f.index+f[0].length,m))}}a=d}if(!r.validEnd){let l=r.fillBefore(E.empty,!0);n.replace(a,a,new z(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function F7(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function go(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-s;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!F7(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function V7(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,d=E.empty,h=0;for(let m=s,O=!1;m>t;m--)O||r.index(m)>0?(O=!0,d=E.from(r.node(m).copy(d)),h++):l--;let f=E.empty,p=0;for(let m=s,O=!1;m>t;m--)O||i.after(m+1)<i.end(m)?(O=!0,f=E.from(i.node(m).copy(f)),p++):c++;n.step(new bt(l,c,o,a,new z(d.append(f),h,p),d.size-h,!0))}function ng(n,e,t=null,r=n){let i=Y7(n,e),s=i&&q7(r,e);return s?i.map(sb).concat({type:e,attrs:t}).concat(s.map(sb)):null}function sb(n){return{type:n,attrs:null}}function Y7(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function q7(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function U7(n,e,t){let r=E.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=E.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new bt(i,s,i,s,new z(r,0,0),t.length,!0))}function G7(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&H7(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&Xw(n,o,a,s),tg(n,n.mapping.slice(s).map(a,1),r,void 0,c===null);let d=n.mapping.slice(s),h=d.map(a,1),f=d.map(a+o.nodeSize,1);return n.step(new bt(h,f,h+1,f-1,new z(E.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Iw(n,o,a,s),!1}})}function Iw(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Xw(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
109
- `))}})}function H7(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function K7(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new bt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new z(E.from(o),0,0),1,!0))}function Ir(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>s;c--,d--){let h=i.node(c),f=i.index(c);if(h.type.spec.isolating)return!1;let p=h.content.cutByIndex(f,h.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let O=r&&r[d]||h;if(!h.canReplace(f+1,h.childCount)||!O.type.validContent(p))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function J7(n,e,t=1,r){let i=n.doc.resolve(e),s=E.empty,o=E.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=E.from(i.node(a).copy(s));let d=r&&r[c];o=E.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}n.step(new lt(e,e,new z(s.append(o),t,t),!0))}function wi(n,e){let t=n.resolve(e),r=t.index();return Lw(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function eX(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Lw(n,e){return!!(n&&e&&!n.isLeaf&&eX(n,e))}function yd(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&Lw(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function tX(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",h=!!o.contentMatch.matchType(i);d&&!h?r=!1:!d&&h&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);Xw(n,d.node(),d.before(),a)}o.inlineContent&&tg(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new lt(c,l.map(e+t,-1),z.empty,!0)),r===!0){let d=n.doc.resolve(c);Iw(n,d.node(),d.before(),n.steps.length)}return n}function nX(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function _w(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),d=!1;if(s==1)d=c.canReplace(l,l,i);else{let h=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=h&&c.canReplaceWith(l,l,h[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function xd(n,e,t=e,r=z.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Bw(i,s,r)?new lt(e,t,r):new rX(i,s,r).fit()}function Bw(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class rX{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=E.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=E.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new z(s,o,a);return e>-1?new bt(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new lt(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=ob(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,h=null;if(t==1&&(o?c.matchType(o.type)||(h=c.fillBefore(E.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:h};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced;return ab(e,-1)<=t?!1:(this.unplaced.size>1&&ab(e,1)>r&&r++,this.unplaced=new z(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ob(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new z(Wo(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new z(Wo(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let O=0;O<s.length;O++)this.openFrontierNode(s[O]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,d=[],{match:h,type:f}=this.frontier[t];if(i){for(let O=0;O<i.childCount;O++)d.push(i.child(O));h=h.matchFragment(i)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let O=a.child(c),b=h.matchType(O.type);if(!b)break;c++,(c>1||l==0||O.content.size)&&(h=b,d.push(Ww(O.mark(f.allowedMarks(O.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=zo(this.placed,t,E.from(d)),this.frontier[t].match=h,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let O=0,b=a;O<p;O++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=m?e==0?z.empty:new z(Wo(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new z(Wo(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Rh(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Rh(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Rh(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=zo(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=zo(this.placed,this.depth,E.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(E.empty,!0);t.childCount&&(this.placed=zo(this.placed,this.frontier.length,t))}}function Wo(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Wo(n.firstChild.content,e-1,t)))}function zo(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(zo(n.lastChild.content,e-1,t)))}function ob(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Ww(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Ww(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(E.empty,!0)))),n.copy(r)}function Rh(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!iX(t,s.content,o)?a:null}function iX(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function sX(n){return n.spec.defining||n.spec.definingForContent}function ab(n,e){for(let t=0;;t++){let r=e<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return t;n=r.content}}function oX(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Bw(i,s,r))return n.step(new lt(e,t,r));let o=Zw(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,p=i.pos-1;f>0;f--,p--){let m=i.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==p&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],d=r.openStart;for(let f=r.content,p=0;;p++){let m=f.firstChild;if(c.push(m),p==r.openStart)break;f=m.content}for(let f=d-1;f>=0;f--){let p=c[f],m=sX(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(a)-1)))d=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),m=c[p];if(m)for(let O=0;O<o.length;O++){let b=o[(O+l)%o.length],y=!0;b<0&&(y=!1,b=-b);let S=i.node(b-1),x=i.index(b-1);if(S.canReplaceWith(x,x,m.type,m.marks))return n.replace(i.before(b),y?s.after(b):t,new z(zw(r.content,0,r.openStart,p),p,r.openEnd))}}let h=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>h));f--){let p=o[f];p<0||(e=i.before(p),t=s.after(p))}}function zw(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(zw(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(E.empty,!0))}return n}function aX(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=nX(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new z(E.from(r),0,0))}function lX(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(t),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&t==i.start(l);l--)t=i.before(l);r=n.doc.resolve(e),i=n.doc.resolve(t)}}let s=Zw(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function Zw(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Ws extends Lt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ct.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ct.fromReplace(e,this.pos,this.pos+1,new z(E.from(i),0,t.isLeaf?0:1))}getMap(){return dn.empty}invert(e){return new Ws(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ws(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ws(t.pos,t.attr,t.value)}}Lt.jsonID("attr",Ws);class Fa extends Lt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ct.ok(r)}getMap(){return dn.empty}invert(e){return new Fa(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Fa(t.attr,t.value)}}Lt.jsonID("docAttr",Fa);let to=class extends Error{};to=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};to.prototype=Object.create(Error.prototype);to.prototype.constructor=to;to.prototype.name="TransformError";class Fw{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Za}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new to(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=z.empty){let i=xd(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new z(E.from(r),0,0))}delete(e,t){return this.replace(e,t,z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return oX(this,e,t,r),this}replaceRangeWith(e,t,r){return aX(this,e,t,r),this}deleteRange(e,t){return lX(this,e,t),this}lift(e,t){return V7(this,e,t),this}join(e,t=1){return tX(this,e,t),this}wrap(e,t){return U7(this,e,t),this}setBlockType(e,t=e,r,i=null){return G7(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return K7(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ws(e,t,r)),this}setDocAttribute(e,t){return this.step(new Fa(e,t)),this}addNodeMark(e,t){return this.step(new ii(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Ae)t.isInSet(r.marks)&&this.step(new ss(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new ss(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return J7(this,e,t,r),this}addMark(e,t,r){return z7(this,e,t,r),this}removeMark(e,t,r){return Z7(this,e,t,r),this}clearIncompatible(e,t,r){return tg(this,e,t,r),this}}const Eh=Object.create(null);class ue{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new cX(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=z.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(l.pos),d.map(c.pos),a?z.empty:t),a==0&&ub(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),d=l.map(a.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),ub(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new ee(e):vs(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?vs(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):vs(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new fn(e.node(0))}static atStart(e){return vs(e,e,0,0,1)||new fn(e)}static atEnd(e){return vs(e,e,e.content.size,e.childCount,-1)||new fn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Eh[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Eh)throw new RangeError("Duplicate use of selection JSON ID "+e);return Eh[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ee.between(this.$anchor,this.$head).getBookmark()}}ue.prototype.visible=!0;class cX{constructor(e,t){this.$from=e,this.$to=t}}let lb=!1;function cb(n){!lb&&!n.parent.inlineContent&&(lb=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ee extends ue{constructor(e,t=e){cb(e),cb(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return ue.near(r);let i=e.resolve(t.map(this.anchor));return new ee(i.parent.inlineContent?i:r,r)}replace(e,t=z.empty){if(super.replace(e,t),t==z.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ee&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Sd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ee(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=ue.findFrom(t,r,!0)||ue.findFrom(t,-r,!0);if(s)t=s.$head;else return ue.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(ue.findFrom(e,-r,!0)||ue.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new ee(e,t)}}ue.jsonID("text",ee);class Sd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Sd(e.map(this.anchor),e.map(this.head))}resolve(e){return ee.between(e.resolve(this.anchor),e.resolve(this.head))}}class J extends ue{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?ue.near(s):new J(s)}content(){return new z(E.from(this.node),0,0)}eq(e){return e instanceof J&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new rg(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new J(e.resolve(t.anchor))}static create(e,t){return new J(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}J.prototype.visible=!1;ue.jsonID("node",J);class rg{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Sd(r,r):new rg(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&J.isSelectable(r)?new J(t):ue.near(t)}}class fn extends ue{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=z.empty){if(t==z.empty){e.delete(0,e.doc.content.size);let r=ue.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new fn(e)}map(e){return new fn(e)}eq(e){return e instanceof fn}getBookmark(){return uX}}ue.jsonID("all",fn);const uX={map(){return this},resolve(n){return new fn(n)}};function vs(n,e,t,r,i,s=!1){if(e.inlineContent)return ee.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&J.isSelectable(a))return J.create(n,t-(i<0?a.nodeSize:0))}else{let l=vs(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function ub(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof lt||i instanceof bt))return;let s=n.mapping.maps[r],o;s.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(ue.near(n.doc.resolve(o),t))}const db=1,ql=2,hb=4;class dX extends Fw{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|db)&~ql,this.storedMarks=null,this}get selectionSet(){return(this.updated&db)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ql,this}ensureMarks(e){return Ae.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ql)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ql,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ae.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(ue.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=hb,this}get scrolledIntoView(){return(this.updated&hb)>0}}function fb(n,e){return!e||!n?n:n.bind(e)}class Zo{constructor(e,t,r){this.name=e,this.init=fb(t.init,r),this.apply=fb(t.apply,r)}}const hX=[new Zo("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Zo("selection",{init(n,e){return n.selection||ue.atStart(e.doc)},apply(n){return n.selection}}),new Zo("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Zo("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Nh{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=hX.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Zo(r.key,r.spec.state,r))})}}class Di{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let h=0;h<this.config.plugins.length;h++)i.push(h<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Di(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new dX(this)}static create(e){let t=new Nh(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Di(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Nh(this.schema,e.plugins),r=t.fields,i=new Di(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Nh(e.schema,e.plugins),s=new Di(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=oi.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=ue.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Vw(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Vw(i,e,{})),t[r]=i}return t}class Ze{constructor(e){this.spec=e,this.props={},e.props&&Vw(e.props,this,this.props),this.key=e.key?e.key.key:Yw("plugin")}getState(e){return e[this.key]}}const Dh=Object.create(null);function Yw(n){return n in Dh?n+"$"+ ++Dh[n]:(Dh[n]=0,n+"$")}class st{constructor(e="key"){this.key=Yw(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qw=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Uw(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Gw=(n,e,t)=>{let r=Uw(n,t);if(!r)return!1;let i=ig(r);if(!i){let o=r.blockRange(),a=o&&go(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(s2(n,i,e,-1))return!0;if(r.parent.content.size==0&&(no(s,"end")||J.isSelectable(s)))for(let o=r.depth;;o--){let a=xd(n.doc,r.before(o),r.after(o),z.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(no(s,"end")?ue.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):J.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},fX=(n,e,t)=>{let r=Uw(n,t);if(!r)return!1;let i=ig(r);return i?Hw(n,i,e):!1},pX=(n,e,t)=>{let r=Jw(n,t);if(!r)return!1;let i=sg(r);return i?Hw(n,i,e):!1};function Hw(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=xd(n.doc,s,l,z.empty);if(!c||c.from!=s||c instanceof lt&&c.slice.size>=l-s)return!1;if(t){let d=n.tr.step(c);d.setSelection(ee.create(d.doc,s)),t(d.scrollIntoView())}return!0}function no(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Kw=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=ig(r)}let o=s&&s.nodeBefore;return!o||!J.isSelectable(o)?!1:(e&&e(n.tr.setSelection(J.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ig(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Jw(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const e2=(n,e,t)=>{let r=Jw(n,t);if(!r)return!1;let i=sg(r);if(!i)return!1;let s=i.nodeAfter;if(s2(n,i,e,1))return!0;if(r.parent.content.size==0&&(no(s,"start")||J.isSelectable(s))){let o=xd(n.doc,r.before(),r.after(),z.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(no(s,"start")?ue.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):J.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},t2=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=sg(r)}let o=s&&s.nodeAfter;return!o||!J.isSelectable(o)?!1:(e&&e(n.tr.setSelection(J.create(n.doc,s.pos)).scrollIntoView()),!0)};function sg(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const mX=(n,e)=>{let t=n.selection,r=t instanceof J,i;if(r){if(t.node.isTextblock||!wi(n.doc,t.from))return!1;i=t.from}else if(i=yd(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(J.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},gX=(n,e)=>{let t=n.selection,r;if(t instanceof J){if(t.node.isTextblock||!wi(n.doc,t.to))return!1;r=t.to}else if(r=yd(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},OX=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&go(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},n2=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
110
- `).scrollIntoView()),!0)};function og(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const bX=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=og(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ue.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},r2=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof fn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=og(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(o,s.createAndFill());a.setSelection(ee.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},i2=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ir(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&go(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function yX(n){return(e,t)=>{if(e.selection instanceof J&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!Ir(e.doc,p.pos)?!1:(t&&t(e.tr.split(p.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof ee||e.selection instanceof fn)&&r.deleteSelection();let{$from:i}=r.selection,s=r.steps.length,o=[],a,l,c=!1,d=!1;for(let p=i.depth;;p--)if(i.node(p).isBlock){c=i.end(p)==i.pos+(i.depth-p),d=i.start(p)==i.pos-(i.depth-p),l=og(i.node(p-1).contentMatchAt(i.indexAfter(p-1))),o.unshift(c&&l?{type:l}:null),a=p;break}else{if(p==1)return!1;o.unshift(null)}let h=i.pos,f=Ir(r.doc,h,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Ir(r.doc,h,o.length,o)),!f)return!1;if(r.split(h,o.length,o),!c&&d&&i.node(a).type!=l){let p=r.mapping.slice(s),m=p.map(i.before(a)),O=r.doc.resolve(m);l&&i.node(a-1).canReplaceWith(O.index(),O.index()+1,l)&&r.setNodeMarkup(p.map(i.before(a)),l)}return t&&t(r.scrollIntoView()),!0}}const xX=yX(),SX=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(J.create(n.doc,i))),!0)};function kX(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||wi(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function s2(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&kX(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,m=E.empty;for(let y=o.length-1;y>=0;y--)m=E.from(o[y].create(null,m));m=E.from(i.copy(m));let O=n.tr.step(new bt(e.pos-1,p,e.pos,p,new z(m,1,0),o.length,!0)),b=O.doc.resolve(p+2*o.length);b.nodeAfter&&b.nodeAfter.type==i.type&&wi(O.doc,b.pos)&&O.join(b.pos),t(O.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&l?null:ue.findFrom(e,1),h=d&&d.$from.blockRange(d.$to),f=h&&go(h);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(h,f).scrollIntoView()),!0;if(c&&no(s,"start",!0)&&no(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let O=s,b=1;for(;!O.isTextblock;O=O.firstChild)b++;if(p.canReplace(p.childCount,p.childCount,O.content)){if(t){let y=E.empty;for(let x=m.length-1;x>=0;x--)y=E.from(m[x].copy(y));let S=n.tr.step(new bt(e.pos-m.length,e.pos+s.nodeSize,e.pos+b,e.pos+s.nodeSize-b,new z(y,m.length,0),0,!0));t(S.scrollIntoView())}return!0}}return!1}function o2(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(ee.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const vX=o2(-1),wX=o2(1);function QX(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&ng(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function pb(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let d=t.doc.resolve(c),h=d.index();i=d.parent.canReplaceWith(h,h+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,n,e)}r(s.scrollIntoView())}return!0}}function ag(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}ag(qw,Gw,Kw);ag(qw,e2,t2);ag(n2,r2,i2,xX);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function $X(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=r?t.tr:null;return CX(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function CX(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new hu(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new hu(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=ng(s,t,r,e);return a?(n&&PX(n,e,a,i,t),!0):!1}function PX(n,e,t,r,i){let s=E.empty;for(let d=t.length-1;d>=0;d--)s=E.from(t[d].type.create(t[d].attrs,s));n.step(new bt(e.start-(r?2:0),e.end,e.start,e.end,new z(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let a=t.length-o,l=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,h=e.endIndex,f=!0;d<h;d++,f=!1)!f&&Ir(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function TX(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?MX(e,t,n,s):AX(e,t,s):!0:!1}}function MX(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new bt(s-1,o,s,o,new z(E.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new hu(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=go(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return wi(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function AX(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,m=t.endIndex-1,O=t.startIndex;m>O;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?E.empty:E.from(i))))return!1;let h=s.pos,f=h+o.nodeSize;return r.step(new bt(h-(a?1:0),f+(l?1:0),h+1,f-1,new z((a?E.empty:E.from(i.copy(E.empty))).append(l?E.empty:E.from(i.copy(E.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function RX(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,d=E.from(c?n.create():null),h=new z(E.from(n.create(null,E.from(a.type.create(null,d)))),c?3:1,0),f=s.start,p=s.end;t(e.tr.step(new bt(f-(c?3:1),p,f,p,h,1,!0)).scrollIntoView())}return!0}}const Qt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},ro=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let bp=null;const Qr=function(n,e,t){let r=bp||(bp=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},EX=function(){bp=null},as=function(n,e,t,r){return t&&(mb(n,e,t,r,-1)||mb(n,e,t,r,1))},NX=/^(img|br|input|textarea|hr)$/i;function mb(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Et(n))){let o=n.parentNode;if(!o||!K(o)||hl(n)||NX.test(n.nodeName)||n.contentEditable=="false")return!1;e=Qt(n)+(i<0?0:1),n=o}else if(K(n)){let o=n.childNodes[e+(i<0?-1:0)];if(K(o)&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?Et(n):0}else return!1}}function Et(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function K(n){return n.nodeType==1}function ft(n){return n.nodeType==3}function ls(n,e){return e?n.contains(K(e)?e:e.parentNode):!1}function DX(n,e){for(;;){if(ft(n)&&e)return n;if(K(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Et(n)}else if(n.parentNode&&!hl(n))e=Qt(n),n=n.parentNode;else return null}}function jX(n,e){for(;;){if(ft(n)&&e<n.nodeValue.length)return n;if(K(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!hl(n))e=Qt(n)+1,n=n.parentNode;else return null}}function IX(n,e,t){for(let r=e==0,i=e==Et(n);r||i;){if(n==t)return!0;let s=Qt(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Et(n)}}function hl(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const kd=function(n){return n.focusNode&&as(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Ri(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function XX(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function LX(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Et(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Et(r.startContainer),r.startOffset)}}}const hr=typeof navigator<"u"?navigator:null,gb=typeof document<"u"?document:null,Qi=hr&&hr.userAgent||"",yp=/Edge\/(\d+)/.exec(Qi),a2=/MSIE \d/.exec(Qi),xp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qi),Jt=!!(a2||xp||yp),li=a2?document.documentMode:xp?+xp[1]:yp?+yp[1]:0,pn=!Jt&&/gecko\/(\d+)/i.test(Qi);pn&&+(/Firefox\/(\d+)/.exec(Qi)||[0,0])[1];const Sp=!Jt&&/Chrome\/(\d+)/.exec(Qi),Ct=!!Sp,l2=Sp?+Sp[1]:0,It=!Jt&&!!hr&&/Apple Computer/.test(hr.vendor),io=It&&(/Mobile\/\w+/.test(Qi)||!!hr&&hr.maxTouchPoints>2),kn=io||(hr?/Mac/.test(hr.platform):!1),c2=hr?/Win/.test(hr.platform):!1,Rr=/Android \d/.test(Qi),vd=!!gb&&"webkitFontSmoothing"in gb.documentElement.style,_X=vd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function BX(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function xr(n,e){return typeof n=="number"?n:n[e]}function WX(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ob(n,e,t){if(!kp(e)&&e.left==0)return;let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(!K(o)){o=ro(o);continue}let a=o==s.body,l=a?BX(s):WX(o),c=0,d=0;if(e.top<l.top+xr(r,"top")?d=-(l.top-e.top+xr(i,"top")):e.bottom>l.bottom-xr(r,"bottom")&&(d=e.bottom-e.top>l.bottom-l.top?e.top+xr(i,"top")-l.top:e.bottom-l.bottom+xr(i,"bottom")),e.left<l.left+xr(r,"left")?c=-(l.left-e.left+xr(i,"left")):e.right>l.right-xr(r,"right")&&(c=e.right-l.right+xr(i,"right")),c||d)if(a)s.defaultView.scrollBy(c,d);else{let f=o.scrollLeft,p=o.scrollTop;d&&(o.scrollTop+=d),c&&(o.scrollLeft+=c);let m=o.scrollLeft-f,O=o.scrollTop-p;e={left:e.left-m,top:e.top-O,right:e.right-m,bottom:e.bottom-O}}let h=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:ro(o)}}function zX(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(s,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:u2(n.dom)}}function u2(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=ro(r));return e}function ZX({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;d2(t,r==0?0:r-e)}function d2(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let ms=null;function FX(n){if(n.setActive)return n.setActive();if(ms)return n.focus(ms);let e=u2(n);n.focus(ms==null?{get preventScroll(){return ms={preventScroll:!0},!0}}:void 0),ms||(ms=!1,d2(e,0))}function h2(n,e){let t,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,h=0;d;d=d.nextSibling,h++){let f;if(K(d))f=d.getClientRects();else if(ft(d))f=Qr(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let O=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(O<r){t=d,r=O,i=O&&ft(t)?{left:m.right<e.left?m.right:m.left,top:e.top}:e,K(d)&&O&&(s=h+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=h+1)}}return!t&&l&&(t=l,i=c,r=0),t&&ft(t)?VX(t,i):!t||r?{node:n,offset:s}:h2(t,i)}function VX(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let s=0;s<t;s++){r.setEnd(n,s+1),r.setStart(n,s);let o=qr(r,1);if(o.top!=o.bottom&&lg(e,o)){i={node:n,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function lg(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function YX(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function qX(n,e,t){let{node:r,offset:i}=h2(e,t),s=-1;if(K(r)&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function UX(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),l;if(!a)return null;if(K(a.dom)&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function f2(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(K(o)){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(lg(e,c))return f2(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function GX(n,e){let t=n.dom.ownerDocument,r,i=0,s=LX(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o)){let c=n.dom.getBoundingClientRect();if(!lg(e,c)||(o=f2(n.dom,e,c),!o))return null}if(It)for(let c=o;r&&c;c=ro(c))c.draggable&&(r=void 0);if(o=YX(o,e),r){if(pn&&K(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}let c;vd&&i&&K(r)&&K(c=r.childNodes[i-1])&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&K(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||!K(r)||r.childNodes[i-1].nodeName!="BR")&&(a=UX(n,r,i,e))}a==null&&(a=qX(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function kp(n){return n.top<n.bottom||n.left<n.right}function qr(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(kp(r))return r}return Array.prototype.find.call(t,kp)||n.getBoundingClientRect()}const HX=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function p2(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=vd||pn;if(ft(r))if(o&&(HX.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=qr(Qr(r,i,i),t);if(pn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=qr(Qr(r,i-1,i-1),-1);if(c.top==l.top){let d=qr(Qr(r,i,i+1),-1);if(d.top!=l.top)return Po(d,d.left<c.left)}}return l}else{let l=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==r.nodeValue.length?(l--,d=1):t<0?l--:c++,Po(qr(Qr(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Et(r))){let l=r.childNodes[i-1];if(K(l))return jh(l.getBoundingClientRect(),!1)}if(s==null&&i<Et(r)){let l=r.childNodes[i];if(K(l))return jh(l.getBoundingClientRect(),!0)}return jh(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Et(r))){let l=r.childNodes[i-1],c=ft(l)?Qr(l,Et(l)-(o?0:1)):K(l)&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Po(qr(c,1),!1)}if(s==null&&i<Et(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?ft(l)?Qr(l,0,o?0:1):K(l)?l:null:null;if(c)return Po(qr(c,-1),!0)}return Po(qr(ft(r)?Qr(r):r,-t),t>=0)}function Po(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function jh(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function m2(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function KX(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return m2(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=p2(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(K(a))l=a.getClientRects();else if(ft(a))l=Qr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const JX=/[\u0590-\u08ac]/;function eL(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return a?!JX.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:m2(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:h}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:O}=n.domSelectionRange(),b=m&&!ls(p,m)||l==m&&c==O;try{a.collapse(d,h),l&&(l!=d||c!=h)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),b}):r.pos==r.start()||r.pos==r.end()}let bb=null,yb=null,xb=!1;function tL(n,e,t){return bb==e&&yb==t?xb:(bb=e,yb=t,xb=t=="up"||t=="down"?KX(n,e,t):eL(n,e,t))}const Mn=0,Sb=1,ji=2,Bn=3;class fl{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Mn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&ls(this.contentDOM,e))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Qt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(K(o)?ls(o,e):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(;r>0;r--){let s=this.children[r-1];if(s.size||!(s instanceof O2||s instanceof g2&&s.side>=0))break}if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Qt(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Qt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let h=a;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Qt(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;d<this.children.length;d++){let h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){s=Qt(h.dom);break}t+=h.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(!K(t)||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let p=0,m=0;p<this.children.length;p++){let O=this.children[p],b=m+O.size;if(s>m&&o<b)return O.setSelection(e-m-O.border,t-m-O.border,r,i);m=b}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),h=!1;if((pn||It)&&e==t){let{node:p,offset:m}=a;if(ft(p)){if(h=!!(m&&p.nodeValue[m-1]==`
111
- `),h&&m==p.nodeValue.length)for(let O=p,b;O;O=O.parentNode){if(b=O.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:Qt(b)+1});break}let y=O.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let O=p.childNodes[m-1];h=O&&(O.nodeName=="BR"||O.contentEditable=="false")}}if(pn&&d.focusNode&&d.focusNode!=l.node&&K(d.focusNode)){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||h&&It)&&as(a.node,a.offset,d.anchorNode,d.anchorOffset)&&as(l.node,l.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(h&&pn)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>t){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?ji:Sb,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Bn:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ji:Bn}r=o}this.dirty=ji}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ji:Sb;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class g2 extends fl{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){let a=K(o)?o:document.createElement("span");a!=o&&a.appendChild(o),a.hasAttribute("contenteditable")||(a.contentEditable="false"),a.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Mn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class nL extends fl{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ci extends fl{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=us.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new ci(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Bn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Bn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Mn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Mn}}slice(e,t,r){let i=ci.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=wp(s,t,o,r)),e>0&&(s=wp(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ui extends fl{constructor(e,t,r,i,s,o,a){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,h=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(!ft(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:h}=us.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!h&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let f=d;return d=x2(d,r,t),c?l=new rL(e,t,r,i,d,h||null,f,c):t.isText?new wd(e,t,r,i,d,f):new ui(e,t,r,i,d,h||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){t.contentElement=i.dom.parentNode;break}}if(!t.contentElement){let r=e&&e.find(i=>K(i)&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?t.contentElement=r:t.getContent=()=>E.empty}}return t}matchesNode(e,t,r){return this.dirty==Mn&&e.eq(this.node)&&fu(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new sL(this,o&&o.node,e),c=this.node.inlineContent,d=c&&this.node.isBlock;lL(this.node,this.innerDeco,(h,f,p)=>{h.spec.marks?l.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!p&&l.syncToMarks(f==this.node.childCount?Ae.none:this.node.child(f).marks,r,e,f),l.placeWidget(h,e,i)},(h,f,p,m)=>{l.syncToMarks(h.marks,r,e,m),d&&h.isAtom&&!h.isText&&l.addHackNode("IMG",l.top);let O;l.findNodeMatch(h,f,p,m)||a&&e.state.selection.from>i&&e.state.selection.to<i+h.nodeSize&&(O=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(h,f,p,O,e)||l.updateNextNode(h,f,p,e,m,i)||l.addNode(h,f,p,e,i),i+=h.nodeSize,c&&(d=h.isAtom&&!h.isText)}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ji)&&(o&&this.protectLocalComposition(e,o),b2(this.contentDOM,this.children,e),io&&cL(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ee)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=uL(this.node.content,o,r-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new nL(this,s,t,i);e.input.compositionNodes.push(o),this.children=wp(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Bn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Mn}updateOuterDeco(e){if(fu(e,this.outerDeco))return;let t=!K(this.nodeDOM),r=this.dom;this.dom=y2(this.dom,this.nodeDOM,vp(this.outerDeco,this.node,t),vp(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){K(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){K(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function kb(n,e,t,r,i){x2(r,e,n);let s=new ui(void 0,n,e,t,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class wd extends ui{constructor(e,t,r,i,s,o){super(e,t,r,i,s,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Bn||this.dirty!=Mn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Mn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Mn,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new wd(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Bn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class O2 extends fl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Mn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class rL extends ui{constructor(e,t,r,i,s,o,a,l){super(e,t,r,i,s,o,a),this.spec=l}update(e,t,r,i){if(this.dirty==Bn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function b2(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=vb(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(o instanceof ci){let l=r?r.previousSibling:n.lastChild;b2(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=vb(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const sa=function(n){n&&(this.nodeName=n)};sa.prototype=Object.create(null);const Ii=[new sa];function vp(n,e,t){if(n.length==0)return Ii;let r=t?Ii[0]:new sa,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new sa(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(r=new sa(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function y2(n,e,t,r){if(t==Ii&&r==Ii)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Ii[0]),i=l}iL(i,a||Ii[0],o)}return i}function iL(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function x2(n,e,t){return y2(n,n,Ii,vp(e,t,!K(n)))}function fu(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function vb(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class sL{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=oL(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Mn,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let h=this.top.children[d];if(h.matchesMark(e[o])&&!this.isLocked(h.dom)){l=d;break}}if(l<0&&this.index<this.top.children.length){let d=this.top.children[this.index];d instanceof ci&&d.dirty!=Bn&&d.mark.type==e[o].type&&d.spec.update&&!this.isLocked(d.dom)&&d.spec.update(e[o])&&(d.mark=e[o],l=this.index,this.changed=!0)}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=ci.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==Bn&&o.dom==o.contentDOM&&(o.dirty=ji),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof ui){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let d=l.dom,h,f=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Bn&&fu(t,l.outerDeco));if(!f&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(l,e,t,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=ji,h.updateChildren(i,o+1),h.dirty=Mn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!fu(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=ui.create(this.top,t,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,s){let o=ui.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new g2(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ci;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof wd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((It||Ct)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new O2(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||K(e)&&e.contains(this.lock.parentNode))}}function oL(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof ci)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function aL(n,e){return n.type.side-e.type.side}function lL(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,h;for(;o<i.length&&i[o].to==s;){let b=i[o++];b.widget&&(d?(h||(h=[d])).push(b):d=b)}if(d)if(h){h.sort(aL);for(let b=0;b<h.length;b++)t(h[b],c,!!l)}else t(d,c,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(c<n.childCount)p=c,f=n.child(c++);else break;for(let b=0;b<a.length;b++)a[b].to<=s&&a.splice(b--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let m=s+f.nodeSize;if(f.isText){let b=m;o<i.length&&i[o].from<b&&(b=i[o].from);for(let y=0;y<a.length;y++)a[y].to<b&&(b=a[y].to);b<m&&(l=f.cut(b-s),f=f.cut(0,b-s),m=b,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let O=f.isInline&&!f.isLeaf?a.filter(b=>!b.inline):a.slice();r(f,O,e.forChild(s,f),p),s=m}}function cL(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function uL(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function wp(n,e,t,r,i){let s=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),d>t&&s.push(l.slice(t-c,l.size,r)))}return s}function cg(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(kd(t)){for(l=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&J.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&IX(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new J(o==h?a:r.resolve(h))}else if(pn&&e=="key"&&o>n.state.selection.to&&K(t.focusNode)&&t.focusOffset==t.focusNode.childNodes.length&&i&&i.posAtStart>n.state.selection.to)for(let h=t.focusNode;;h=h.parentNode){if(getComputedStyle(h).overflow!="visible"){c=ue.findFrom(r.resolve(i.posAtStart),1);break}if(h==i.dom||h.nextSibling||!h.parentNode||!K(h.parentNode))break}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=o,f=o;for(let p=0;p<t.rangeCount;p++){let m=t.getRangeAt(p);h=Math.min(h,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(h<0)return null;[l,o]=f==n.state.selection.anchor?[f,h]:[h,f],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let h=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;c=ug(n,d,a,h)}return c}function S2(n){return n.editable?n.hasFocus():v2(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Xr(n,e=!1){let t=n.state.selection;if(k2(n,t),!S2(n))return;let r=n.input.mouseDown;if(!e&&Ct&&r){let i=n.domSelectionRange(),s=n.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&as(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)hL(n);else{let{anchor:i,head:s}=t,o,a;wb&&!(t instanceof ee)&&(t.$from.parent.inlineContent||(o=Qb(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Qb(n,t.to))),n.docView.setSelection(i,s,n,e),wb&&(o&&$b(o),a&&$b(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&dL(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}const wb=It||Ct&&l2<63;function Qb(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(It&&i&&i.contentEditable=="false")return Ih(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Ih(i);if(s)return Ih(s)}}function Ih(n){return n.contentEditable="true",It&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function $b(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function dL(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!S2(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function hL(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Qt(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Jt&&li<=11&&(t.disabled=!0,t.disabled=!1)}function k2(n,e){if(e instanceof J){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Cb(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Cb(n)}function Cb(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ug(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ee.between(e,t,r)}function Pb(n){return n.editable&&!n.hasFocus()?!1:v2(n)}function v2(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return ls(n.dom,e.anchorNode)&&(n.editable||ls(n.dom,e.focusNode))}catch{return!1}}function fL(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return as(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Qp(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ue.findFrom(s,e)}function Hr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Tb(n,e,t){let r=n.state.selection;if(r instanceof ee)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Hr(n,new ee(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Qp(n.state,e);return i&&i instanceof J?Hr(n,i):!1}else if(!(kn&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?J.isSelectable(s)?Hr(n,new J(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Hr(n,new ee(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1}}else return!1;else{if(r instanceof J&&r.node.isInline)return Hr(n,new ee(e>0?r.$to:r.$from));{let i=Qp(n.state,e);return i?Hr(n,i):!1}}}function oa(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):K(n)&&n.contentEditable=="false"}function gs(n,e){return e<0?pL(n):mL(n)}function pL(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(pn&&K(t)&&r<Et(t)&&oa(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!K(t))break;let a=t.childNodes[r-1];if(oa(a,-1))i=t,s=--r;else if(ft(a))t=a,r=t.nodeValue.length;else break}else{if(w2(t))break;{let a=t.previousSibling;for(;a&&oa(a,-1);)i=t.parentNode,s=Qt(a),a=a.previousSibling;if(a)t=a,r=Et(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?$p(n,t,r):i&&$p(n,i,s)}function mL(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Et(t),s,o;for(;;)if(r<i){if(!K(t))break;let a=t.childNodes[r];if(oa(a,1))s=t,o=++r;else break}else{if(w2(t))break;{let a=t.nextSibling;for(;a&&oa(a,1);)s=a.parentNode,o=Qt(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=Et(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&$p(n,s,o)}function w2(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function gL(n,e){for(;n&&e==n.childNodes.length&&!hl(n);)e=Qt(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(ft(t))return t;if(K(t)&&t.contentEditable=="false")break;n=t,e=0}}function OL(n,e){for(;n&&!e&&!hl(n);)e=Qt(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(ft(t))return t;if(K(t)&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function $p(n,e,t){if(!ft(e)){let s,o;(o=gL(e,t))?(e=o,t=0):(s=OL(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(kd(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Xr(n)},50)}function Mb(n,e){let t=n.state.doc.resolve(e);if(!(Ct||c2)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Ab(n,e,t){let r=n.state.selection;if(r instanceof ee&&!r.empty||t.indexOf("s")>-1||kn&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Qp(n.state,e);if(o&&o instanceof J)return Hr(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof fn?ue.near(o,e):ue.findFrom(o,e);return a?Hr(n,a):!1}return!1}function Rb(n,e){if(!(n.state.selection instanceof ee))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Eb(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function bL(n){if(!It||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&K(e)&&t==0&&e.firstChild&&K(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Eb(n,r,"true"),setTimeout(()=>Eb(n,r,"false"),20)}return!1}function yL(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function xL(n,e){let t=e.keyCode,r=yL(e);if(t==8||kn&&t==72&&r=="c")return Rb(n,-1)||gs(n,-1);if(t==46&&!e.shiftKey||kn&&t==68&&r=="c")return Rb(n,1)||gs(n,1);if(t==13||t==27)return!0;if(t==37||kn&&t==66&&r=="c"){let i=t==37?Mb(n,n.state.selection.from)=="ltr"?-1:1:-1;return Tb(n,i,r)||gs(n,i)}else if(t==39||kn&&t==70&&r=="c"){let i=t==39?Mb(n,n.state.selection.from)=="ltr"?1:-1:1;return Tb(n,i,r)||gs(n,i)}else{if(t==38||kn&&t==80&&r=="c")return Ab(n,-1,r)||gs(n,-1);if(t==40||kn&&t==78&&r=="c")return bL(n)||Ab(n,1,r)||gs(n,1);if(r==(kn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function dg(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||us.fromSchema(n.state.schema),a=M2(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,d,h=0;for(;c&&K(c)&&(d=T2[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=a.createElement(d[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),h++}c=l.firstChild}c&&K(c)&&c.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
112
-
113
- `);return{dom:l,text:f,slice:e}}function Q2(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return a=new z(E.from(n.state.schema.text(e.replace(/\r\n?/g,`
114
- `))),0,0),n.someProp("transformPasted",f=>{a=f(a,n,!0)}),a;let h=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(h)a=h;else{let f=i.marks(),{schema:p}=n.state,m=us.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(O=>{let b=o.appendChild(document.createElement("p"));O&&b.appendChild(m.serializeNode(p.text(O,f)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),o=wL(t),vd&&QL(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let h=+d[3];h>0;h--){let f=o.firstChild;for(;f&&!K(f);)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||ai.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!SL.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)a=$L(Nb(a,+d[1],+d[2]),d[4]);else if(a=z.maxOpen(kL(a.content,i),!0),a.openStart||a.openEnd){let h=0,f=0;for(let p=a.content.firstChild;h<a.openStart&&!p.type.spec.isolating;h++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=Nb(a,h,f)}return n.someProp("transformPasted",h=>{a=h(a,n,l)}),a}const SL=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function kL(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&C2(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=P2(o[o.length-1],s.length));let d=$2(a,l);o.push(d),i=i.matchType(d.type),s=l}}),o)return E.from(o)}return n}function $2(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,E.from(n));return n}function C2(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=C2(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(E.from($2(t,n,i+1))))}}function P2(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,P2(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(E.empty,!0);return n.copy(t.append(r))}function Cp(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(s=0),i<r-1&&(a=Cp(a,e,t,r,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(E.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Nb(n,e,t){return e<n.openStart&&(n=new z(Cp(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new z(Cp(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const T2={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function M2(){return document.implementation.createHTMLDocument("title")}let To=null;function vL(n){let e=window.trustedTypes;if(!e)return n;if(!To){if(To=e.defaultPolicy)try{return To.createHTML(n)}catch{}To=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return To.createHTML(n)}function wL(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=M2(),r=t.body,i=/<([a-z][^>\s]+)/i.exec(n),s;if((s=i&&T2[i[1].toLowerCase()])&&(n=s.map(o=>"<"+o+">").join("")+n+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=vL(n),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;for(let o=0;o<t.styleSheets.length;o++){let a=t.styleSheets[o];for(let l=0;l<a.rules.length;l++){let c=a.rules[l];if(c instanceof CSSStyleRule){let d=r.querySelectorAll(c.selectorText);for(let h=0;h<d.length;h++)d[h].style.cssText+=c.style.cssText}}}return r}function QL(n){let e=n.querySelectorAll(Ct?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function $L(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;try{i=E.from(l.create(r[a+1],i))}catch{break}s++,o++}return new z(i,s,o)}const Ft={},Vt={},CL={touchstart:!0,touchmove:!0};class PL{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function TL(n){for(let e in Ft){let t=Ft[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{AL(n,r)&&!hg(n,r)&&(n.editable||!(r.type in Vt))&&t(n,r)},CL[e]?{passive:!0}:void 0)}It&&n.dom.addEventListener("input",()=>null),Pp(n)}function Er(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ML(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Pp(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>hg(n,r))})}function hg(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function AL(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function RL(n,e){!hg(n,e)&&Ft[e.type]&&(n.editable||!(e.type in Vt))&&Ft[e.type](n,e)}Vt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!N2(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Rr&&Ct&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),io&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Ri(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||xL(n,t)?t.preventDefault():Er(n,"key")};Vt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Vt.keypress=(n,e)=>{let t=e;if(N2(n)||!t.charCode||t.ctrlKey&&!t.altKey||kn&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ee)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function pl(n){return{left:n.clientX,top:n.clientY}}function EL(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function fg(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function ml(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function NL(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&J.isSelectable(r)?(ml(n,new J(t)),!0):!1}function DL(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof J&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(J.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(ml(n,J.create(n.state.doc,i)),!0):!1}function jL(n,e,t,r,i){return fg(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?DL(n,t):NL(n,t))}function IL(n,e,t,r){return fg(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function XL(n,e,t,r){return fg(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||LL(n,t,r)}function LL(n,e,t){if(t.button!=0)return!1;let r=A2(n,e,!0),i=n.state.doc;return r?(ml(n,r),r instanceof ee&&i.eq(n.state.doc)&&(n.input.mouseDown=new BL(n,r)),!0):!1}function A2(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?ee.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)return ee.create(r,a+1,a+1+o.content.size);if(t&&J.isSelectable(o))return J.create(r,a)}return null}function pg(n){return pu(n)}const R2=kn?"metaKey":"ctrlKey";Ft.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=pg(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&EL(t,n.input.lastClick)&&!t[R2]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let o=n.posAtCoords(pl(t));o&&(s=="singleClick"?n.input.mouseDown=new _L(n,o,t,!!r):(s=="doubleClick"?IL:XL)(n,o.pos,o.inside,t)?t.preventDefault():Er(n,"pointer"))};class E2{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class _L extends E2{constructor(e,t,r,i){super(e),this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[R2],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&K(l.nodeDOM)?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof J&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&pn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),Er(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Xr(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(pl(e))),this.updateAllowDefault(e),this.allowDefault||!t?Er(this.view,"pointer"):jL(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||It&&this.mightDrag&&!this.mightDrag.node.isAtom||Ct&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(ml(this.view,ue.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Er(this.view,"pointer")}move(e){this.updateAllowDefault(e),Er(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class BL extends E2{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Er(this.view,"pointer");let t=this.view.posAtCoords(pl(e)),r=t&&A2(this.view,t.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,a]=r.from<s.from?[s.to,r.from]:[s.from,r.to];ml(this.view,ee.create(i,o,a))}}Ft.touchstart=n=>{n.input.lastTouch=Date.now(),pg(n),Er(n,"pointer")};Ft.touchmove=n=>{n.input.lastTouch=Date.now(),Er(n,"pointer")};Ft.contextmenu=n=>pg(n);function N2(n,e){return n.composing?!0:It&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const WL=Rr?5e3:-1;Vt.compositionstart=Vt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof ee&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ct&&c2&&zL(n)))n.markCursor=n.state.storedMarks||t.marks(),pu(n,!0),n.markCursor=null;else if(pu(n,!e.selection.empty),pn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&K(i)&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(ft(o)){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}D2(n,WL)};function zL(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||!K(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return K(r)&&r.contentEditable=="false"}Vt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,D2(n,20))};function D2(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>pu(n),e))}function j2(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ZL(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=DX(e.focusNode,e.focusOffset),r=jX(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function pu(n,e=!1){if(!(Rr&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),j2(n),e||n.docView&&n.docView.dirty){let t=cg(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function FL(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Va=Jt&&li<15||io&&_X<604;Ft.copy=Vt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Va?null:t.clipboardData,o=r.content(),{dom:a,text:l}=dg(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):FL(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function VL(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function YL(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Ya(n,r.value,null,i,e):Ya(n,r.textContent,r.innerHTML,i,e)},50)}function Ya(n,e,t,r,i){let s=Q2(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||z.empty)))return!0;if(!s)return!1;let o=VL(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function I2(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Vt.paste=(n,e)=>{let t=e;if(n.composing&&!Rr)return;let r=Va?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Ya(n,I2(r),r.getData("text/html"),i,t)?t.preventDefault():YL(n,t)};class X2{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const qL=kn?"altKey":"ctrlKey";function L2(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[qL]}Ft.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(pl(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof J?i.to-1:i.to))){if(r&&r.mightDrag)o=J.create(n.state.doc,r.mightDrag.pos);else if(t.target&&K(t.target)){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(o=J.create(n.state.doc,h.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=dg(n,a);(!t.dataTransfer.files.length||!Ct||l2>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Va?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Va||t.dataTransfer.setData("text/plain",c),n.dragging=new X2(d,L2(n,t),o)};Ft.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Vt.dragover=Vt.dragenter=(n,e)=>e.preventDefault();Vt.drop=(n,e)=>{try{UL(n,e,n.dragging)}finally{n.dragging=null}};function UL(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(pl(e));if(!r)return;let i=n.state.doc.resolve(r.pos),s=t&&t.slice;s?n.someProp("transformPasted",p=>{s=p(s,n,!1)}):s=Q2(n,I2(e.dataTransfer),Va?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&L2(n,e));if(n.someProp("handleDrop",p=>p(n,e,s||z.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?_w(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=n.state.tr;if(o){let{node:p}=t;p?p.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=l.doc;if(d?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(h))return;let f=l.doc.resolve(c);if(d&&J.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new J(f));else{let p=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,O,b,y)=>p=y),l.setSelection(ug(n,f,l.doc.resolve(p)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}Ft.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Xr(n)},20))};Ft.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Ft.beforeinput=(n,e)=>{if(Rr&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Ri(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Vt)Ft[n]=Vt[n];function qa(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class mu{constructor(e,t){this.toDOM=e,this.spec=t||Yi,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Dt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof mu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&qa(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class di{constructor(e,t){this.attrs=e,this.spec=t||Yi}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Dt(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof di&&qa(this.attrs,e.attrs)&&qa(this.spec,e.spec)}static is(e){return e.type instanceof di}destroy(){}}class mg{constructor(e,t){this.attrs=e,this.spec=t||Yi}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Dt(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof mg&&qa(this.attrs,e.attrs)&&qa(this.spec,e.spec)}destroy(){}}class Dt{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Dt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Dt(e,e,new mu(t,r))}static inline(e,t,r,i){return new Dt(e,t,new di(r,i))}static node(e,t,r,i){return new Dt(e,t,new mg(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof di}get widget(){return this.type instanceof mu}}const ws=[],Yi={};class be{constructor(e,t){this.local=e.length?e:ws,this.children=t.length?t:ws}static create(e,t){return t.length?gu(t,e,0,Yi):Mt}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==Mt||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Yi)}mapInner(e,t,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?GL(this.children,o||[],e,t,r,i,s):o?new be(o.sort(qi),ws):Mt}add(e,t){return t.length?this==Mt?be.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,d;if(d=B2(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,d,c+1):i.splice(s,0,l,l+a.nodeSize,gu(d,a,c+1,Yi)),s+=3}});let o=_2(s?W2(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new be(o.length?this.local.concat(o).sort(qi):this.local,i||this.children)}remove(e){return e.length==0||this==Mt?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+t,l=r[s+1]+t;for(let d=0,h;d<e.length;d++)(h=e[d])&&h.from>a&&h.to<l&&(e[d]=null,(o||(o=[])).push(h));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=Mt?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new be(i,r):Mt}forChild(e,t){if(this==Mt)return this;if(t.isLeaf)return be.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof di){let c=Math.max(s,l.from)-s,d=Math.min(o,l.to)-s;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new be(i.sort(qi),ws);return r?new ti([a,r]):a}return r||Mt}eq(e){if(this==e)return!0;if(!(e instanceof be)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return gg(this.localsInner(e))}localsInner(e){if(this==Mt)return ws;if(e.inlineContent||!this.local.some(di.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof di||t.push(this.local[r]);return t}forEachSet(e){e(this)}}be.empty=new be([],[]);be.removeOverlap=gg;const Mt=be.empty;class ti{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Yi));return ti.from(r)}forChild(e,t){if(t.isLeaf)return be.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Mt&&(s instanceof ti?r=r.concat(s.members):r.push(s))}return ti.from(r)}eq(e){if(!(e instanceof ti)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?gg(r?t:t.sort(qi)):ws}static from(e){switch(e.length){case 0:return Mt;case 1:return e[0];default:return new ti(e.every(t=>t instanceof be)?e:e.reduce((t,r)=>t.concat(r instanceof be?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function GL(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,d=s;c<t.maps.length;c++){let h=0;t.maps[c].forEach((f,p,m,O)=>{let b=O-m-(p-f);for(let y=0;y<a.length;y+=3){let S=a[y+1];if(S<0||f>S+d-h)continue;let x=a[y]+d-h;p>=x?a[y+1]=f<=x?-2:-1:f>=d&&b&&(a[y]+=b,a[y+1]+=b)}h+=b}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+s),h=d-i;if(h<0||h>=r.content.size){l=!0;continue}let f=t.map(n[c+1]+s,-1),p=f-i,{index:m,offset:O}=r.content.findIndex(h),b=r.maybeChild(m);if(b&&O==h&&O+b.nodeSize==p){let y=a[c+2].mapInner(t,b,d+1,n[c]+s+1,o);y!=Mt?(a[c]=h,a[c+1]=p,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=HL(a,n,e,t,i,s,o),d=gu(c,r,0,o);e=d.local;for(let h=0;h<a.length;h+=3)a[h+1]<0&&(a.splice(h,3),h-=3);for(let h=0,f=0;h<d.children.length;h+=3){let p=d.children[h];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,d.children[h],d.children[h+1],d.children[h+2])}}return new be(e.sort(qi),a)}function _2(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new Dt(i.from+e,i.to+e,i.type))}return t}function HL(n,e,t,r,i,s,o){function a(l,c){for(let d=0;d<l.local.length;d++){let h=l.local[d].map(r,i,c);h?t.push(h):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+s+1);return t}function B2(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function W2(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function gu(n,e,t,r){let i=[],s=!1;e.forEach((a,l)=>{let c=B2(n,a,l+t);if(c){s=!0;let d=gu(c,a,t+l+1,r);d!=Mt&&i.push(l,l+a.nodeSize,d)}});let o=_2(s?W2(n):n,-t).sort(qi);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new be(o,i):Mt}function qi(n,e){return n.from-e.from||n.to-e.to}function gg(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Db(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Db(e,i,r.copy(s.from,r.to)));break}}}return e}function Db(n,e,t){for(;e<n.length&&qi(t,n[e])>0;)e++;n.splice(e,0,t)}function Xh(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Mt&&e.push(r)}),n.cursorWrapper&&e.push(be.create(n.state.doc,[n.cursorWrapper.deco])),ti.from(e)}const KL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},JL=Jt&&li<=11;class e8{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class t8{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new e8,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Jt&&li<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():It&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),JL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,KL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Pb(this.view)){if(this.suppressingSelectionUpdates)return Xr(this.view);if(Jt&&li<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&as(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=ro(s))t.add(s);for(let s=e.anchorNode;s;s=ro(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:ft(r)?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Pb(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<t.length;d++){let h=this.registerMutation(t[d],l);h&&(s=s<0?h.from:Math.min(h.from,s),o=o<0?h.to:Math.max(h.to,o),h.typeOver&&(a=!0))}if(l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Ct&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let h=d.nextSibling;for(;h&&K(h);){if(h.contentEditable=="false"){d.parentNode.removeChild(d);break}h=h.firstChild}}}else if(pn&&l.length){let d=l.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,f]=d;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!h||i8(e,h)!=p)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&kd(r)&&(c=cg(e))&&c.eq(ue.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Xr(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),n8(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,s8(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Xr(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let h=e.addedNodes[d];t.push(h),ft(h)&&(this.lastChangedTextNode=h)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Jt&&li<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:h,nextSibling:f}=e.addedNodes[d];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?Qt(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Qt(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let jb=new WeakMap,Ib=!1;function n8(n){if(!jb.has(n)&&(jb.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=pn,Ib)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ib=!0}}function Xb(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return as(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function r8(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Xb(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Xb(n,t):null}function i8(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function s8(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let s of e)if(((t=s.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||!K(l)||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&n.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function o8(n,e,t,r){let{node:i,fromOffset:s,toOffset:o,from:a,to:l}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,h=c.anchorNode;if(h&&ls(n.dom,h)&&(d=[{node:h,offset:c.anchorOffset}],kd(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Ct&&n.input.lastKeyCode===8)for(let y=o;y>s;y--){let S=i.childNodes[y-1],x=S.pmViewDesc;if(S.nodeName=="BR"&&!x){o=y;break}if(!x||x.size)break}let f=n.state.doc,p=n.someProp("domParser")||ai.fromSchema(n.state.schema),m=f.resolve(a),O=null,b=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:s,to:o,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:a8(r),context:m});if(d&&d[0].pos!=null){let y=d[0].pos,S=d[1]&&d[1].pos;S==null&&(S=y),O={anchor:y+a,head:S+a}}return{doc:b,sel:O,from:a,to:l}}const a8=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(It&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||It&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},l8=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function c8(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let Q=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,C=cg(n,Q);if(C&&!n.state.selection.eq(C)){if(Ct&&Rr&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",P=>P(n,Ri(13,"Enter"))))return;let T=n.state.tr.setSelection(C);Q=="pointer"?T.setMeta("pointer",!0):Q=="key"&&T.scrollIntoView(),s&&T.setMeta("composition",s),n.dispatch(T)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=o8(n,e,t,i),d=n.state.doc,h=d.slice(c.from,c.to),f,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,p="end"):(f=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let m=f8(h.content,c.doc.content,c.from,f,p);if(m&&n.input.domChangeCount++,(io&&n.input.lastIOSEnter>Date.now()-225||Rr)&&i.some(Q=>K(Q)&&!l8.test(Q.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",Q=>Q(n,Ri(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof ee&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let Q=Lb(n,n.state.doc,c.sel);if(Q&&!Q.eq(n.state.selection)){let C=n.state.tr.setSelection(Q);s&&C.setMeta("composition",s),n.dispatch(C)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof ee&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),Jt&&li<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let O=c.doc.resolveNoCache(m.start-c.from),b=c.doc.resolveNoCache(m.endB-c.from),y=d.resolve(m.start),S=O.sameParent(b)&&O.parent.inlineContent&&y.end()>=m.endA;if((io&&n.input.lastIOSEnter>Date.now()-225&&(!S||i.some(Q=>Q.nodeName=="DIV"||Q.nodeName=="P"))||!S&&h8(c.doc,O.pos,b.pos))&&n.someProp("handleKeyDown",Q=>Q(n,Ri(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&d8(d,m.start,m.endA,O,b)&&n.someProp("handleKeyDown",Q=>Q(n,Ri(8,"Backspace")))){Rr&&Ct&&n.domObserver.suppressSelectionUpdates();return}Ct&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Rr&&!S&&O.start()!=b.start()&&b.parentOffset==0&&O.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,b=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(Q){return Q(n,Ri(13,"Enter"))})},20));let x=m.start,k=m.endA,v=Q=>{let C=Q||n.state.tr.replace(x,k,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let T=Lb(n,C.doc,c.sel);T&&!(Ct&&n.composing&&T.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(T.head==x||T.head==C.mapping.map(k)-1)||Jt&&T.empty&&T.head==x)&&C.setSelection(T)}return s&&C.setMeta("composition",s),C.scrollIntoView()},w;if(S)if(O.pos==b.pos){Jt&&li<=11&&O.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Xr(n),20));let Q=v(n.state.tr.delete(x,k)),C=d.resolve(m.start).marksAcross(d.resolve(m.endA));C&&Q.ensureMarks(C),n.dispatch(Q)}else if(m.endA==m.endB&&(w=u8(O.parent.content.cut(O.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let Q=v(n.state.tr);w.type=="add"?Q.addMark(x,k,w.mark):Q.removeMark(x,k,w.mark),n.dispatch(Q)}else if(O.parent.child(O.index()).isText&&O.index()==b.index()-(b.textOffset?0:1)){let Q=O.parent.textBetween(O.parentOffset,b.parentOffset),C=()=>v(n.state.tr.insertText(Q,x,k));n.someProp("handleTextInput",T=>T(n,x,k,Q,C))||n.dispatch(C())}else n.dispatch(v());else n.dispatch(v())}function Lb(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ug(n,e.resolve(t.anchor),e.resolve(t.head))}function u8(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(E.from(c).eq(n))return{mark:a,type:o}}function d8(n,e,t,r,i){if(t-e<=i.pos-r.pos||Lh(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Lh(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Lh(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function h8(n,e,t){let r=0,i=0;return n.nodesBetween(e,t,(s,o)=>{s.isTextblock&&o>=e&&o<t?r++:(s.isText?/\S/.test(s.text.slice(Math.max(0,e-o),Math.min(s.nodeSize,t-o))):s.isLeaf)&&i++}),i==0&&r==1}function Lh(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function f8(n,e,t,r,i){let s=n.findDiffStart(e,t),o=t+n.size,a=t+e.size;if(s==null)return null;let{a:l,b:c}=n.findDiffEnd(e,o,a);if(i=="end"){let d=Math.max(0,s-Math.min(l,c));r-=l+d-s}if(l<s&&o<a){let d=r<=s&&r>=l?s-r:0;s-=d,c=s+(c-l),l=s}else if(c<s){let d=r<=s&&r>=c?s-r:0;s-=d,l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}class z2{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new PL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Zb),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Wb(this),Bb(this),this.nodeViews=zb(this),this.docView=kb(this.state.doc,_b(this),Xh(this),this.dom,this),this.domObserver=new t8(this,(r,i,s,o)=>c8(this,r,i,s,o)),this.domObserver.start(),TL(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Pp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Zb),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(j2(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=zb(this);m8(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Pp(this),this.editable=Wb(this),Bb(this);let l=Xh(this),c=_b(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",h=s||!this.docView.matchesNode(e.doc,c,l);(h||!e.selection.eq(i.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&zX(this);if(o){this.domObserver.stop();let p=h&&(Jt||Ct)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&p8(i.selection,e.selection);if(h){let O=Ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ZL(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=kb(e.doc,c,l,this.dom,this)),O&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let m=this.input.mouseDown;p||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&fL(this)&&m.delaySelUpdate())?Xr(this,p):(k2(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&ZX(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!ls(this.dom,e))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof J){let t=this.docView.domAfterPos(this.state.selection.from);K(t)&&Ob(this,t.getBoundingClientRect(),e)}else Ob(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new X2(e.slice,e.move,i<0?void 0:J.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(Jt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&FX(this.dom),Xr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return GX(this,e)}coordsAtPos(e,t=1){return p2(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return tL(this,t||this.state,e)}pasteHTML(e,t){return Ya(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ya(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return dg(this,e)}destroy(){this.docView&&(ML(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xh(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,EX())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return RL(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?It&&this.root.nodeType===11&&XX(this.dom.ownerDocument)==this.dom&&r8(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}z2.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function _b(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Dt.node(0,n.state.doc.content.size,e)]}function Bb(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Dt.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Wb(n){return!n.someProp("editable",e=>e(n.state)===!1)}function p8(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function zb(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function m8(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Zb(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const g8=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),O8=typeof navigator<"u"&&/Win/.test(navigator.platform);function b8(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))g8?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function y8(n){let e=Object.create(null);for(let t in n)e[b8(t)]=n[t];return e}function _h(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function x8(n){return new Ze({props:{handleKeyDown:Z2(n)}})}function Z2(n){let e=y8(n);return function(t,r){let i=Jx(r),s,o=e[_h(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[_h(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(O8&&r.ctrlKey&&r.altKey)&&(s=_r[r.keyCode])&&s!=i){let a=e[_h(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}function Qd(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}var zs=class F2{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...d)=>{const h=l(...d)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,d=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(f=>f===!0)),h={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...O)=>{const b=this.buildProps(c,t),y=p(...O)(b);return a.push(y),h}])),run:d};return h}static createFakeChain(){const e=new Proxy({},{get:(t,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}static createFallbackCan(){const e=F2.createFakeChain();return new Proxy({chain:()=>e},{get:(t,r)=>{if(r!=="then")return r==="chain"?t.chain:()=>!1}})}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Qd({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...d)=>c(...d)(a)]))}};return a}};const S8=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{if(!n.isDestroyed){var t;e.dom.blur(),(t=window)===null||t===void 0||(t=t.getSelection())===null||t===void 0||t.removeAllRanges()}}),!0),k8=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),v8=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,h=c.resolve(d.map(l)),f=c.resolve(d.map(l+a.nodeSize)),p=h.blockRange(f);if(!p)return;const m=go(p);if(a.type.isTextblock){const{defaultType:O}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(p.start,O)}(m||m===0)&&e.lift(p,m)})}),!0},w8=n=>e=>n(e),Q8=()=>({state:n,dispatch:e})=>r2(n,e),$8=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ee(r.doc.resolve(Math.max(o-1,0)))),!0},C8=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const o=i.before(s),a=i.after(s);n.delete(o,a).scrollIntoView()}return!0}return!1};function pt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}const P8=n=>({tr:e,state:t,dispatch:r})=>{const i=pt(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),l=s.after(o);e.delete(a,l).scrollIntoView()}return!0}return!1},T8=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},M8=n=>n.content?/^text(\*|\+)/.test(n.content):!1,Fb=(n,e,t)=>{if(!n.parent.isInline||t==="left"&&n.pos>n.start()||t==="right"&&n.pos<n.end())return n.pos;const r=e.nodes[n.parent.type.name].spec;return M8(r)?t==="left"?n.start()-1:n.end()+1:n.pos},A8=(n,e,t)=>({from:Fb(n,t,"left"),to:Fb(e,t,"right")}),R8=()=>({state:n,dispatch:e})=>{if(n.selection.empty)return!1;if(e){const t=n.tr,{ranges:r}=n.selection,i=t.steps.length;r.forEach(s=>{const o=t.mapping.slice(i),a=t.doc.resolve(o.map(s.$from.pos)),l=t.doc.resolve(o.map(s.$to.pos)),{from:c,to:d}=A8(a,l,n.schema);t.deleteRange(c,d)}),t.selection.empty||t.setSelection(ee.near(t.doc.resolve(t.selection.from))),t.scrollIntoView(),e(t)}return!0},E8=()=>({commands:n})=>n.keyboardShortcut("Enter"),N8=()=>({state:n,dispatch:e})=>bX(n,e);function Og(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ou(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Og(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function V2(n,e,t={}){return n.find(r=>r.type===e&&Ou(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Vb(n,e,t={}){return!!V2(n,e,t)}function bg(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(l=>l.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(l=>l.type===e))return;if(!t){const l=r.node.marks.find(c=>c.type===e);l&&(t=l.attrs)}if(!V2([...r.node.marks],e,t))return;let i=r.index,s=n.start()+r.offset,o=i+1,a=s+r.node.nodeSize;for(;i>0&&Vb([...n.parent.child(i-1).marks],e,t);)i-=1,s-=n.parent.child(i).nodeSize;for(;o<n.parent.childCount&&Vb([...n.parent.child(o).marks],e,t);)a+=n.parent.child(o).nodeSize,o+=1;return{from:s,to:a}}function Fr(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const D8=(n,e)=>({tr:t,state:r,dispatch:i})=>{const s=Fr(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(i){const h=bg(l,s,e);if(h&&h.from<=c&&h.to>=d){const f=ee.create(o,h.from,h.to);t.setSelection(f)}}return!0},j8=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Y2(n){return n instanceof ee}function Xi(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Tp(n,e=null){if(!e)return null;const t=ue.atStart(n),r=ue.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?ee.create(n,Xi(0,i,s),Xi(n.content.size,i,s)):ee.create(n,Xi(e,i,s),Xi(e,i,s))}function Yb(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function bu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function I8(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const X8=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(bu()||Yb())&&r.dom.focus(),I8()&&!bu()&&!Yb()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(s&&n===null&&!Y2(t.state.selection))return o(),!0;const a=Tp(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},L8=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),_8=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),q2=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&q2(r)}return n};function Ul(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return q2(t)}function U2(n){return typeof n?.nodesBetween=="function"}function so(n,e,t){if(U2(n))return n;const r=typeof n=="object"&&n!==null;t={slice:!0,parseOptions:{},...t};const i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return E.fromArray(n.map(o=>e.nodeFromJSON(o)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),so("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Tw({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?ai.fromSchema(l).parseSlice(Ul(n),t.parseOptions):ai.fromSchema(l).parse(Ul(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=ai.fromSchema(e);return t.slice?s.parseSlice(Ul(n),t.parseOptions).content:s.parse(Ul(n),t.parseOptions)}return so("",e,t)}function G2(n){return!("type"in n)}function H2(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof lt||i instanceof bt))return;const s=n.mapping.maps[r];let o=0;s.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(ue.near(n.doc.resolve(o),t))}const B8=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=b=>{s.emit("contentError",{editor:s,error:b,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{so(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(b){l(b)}try{var o;a=so(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(b){return l(b),!1}let{from:d,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,p=!0;const m=G2(a)?a.content:[a];if(m.forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,p=p?b.isBlock:!1}),d===h&&p){const{parent:b}=r.doc.resolve(d);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(d-=1,h+=1)}let O;if(f)Array.isArray(e)?O=e.map(b=>b.text||"").join(""):U2(e)?O=m.map(b=>{var y;return(y=b.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?O=e.text:O=e,r.insertText(O,d,h);else{O=E.from(m);const b=r.doc.resolve(d),y=b.node(),S=b.parentOffset===0,x=y.isText||y.isTextblock,k=y.content.size>0;S&&x&&k&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,h,m)}t.updateSelection&&H2(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:O}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:O})}return!0};function K2(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const W8=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{pos:i,attrs:s,content:o,updateSelection:a=!0}=n;let l;typeof i=="number"?l=e.doc.resolve(i):i?l=i:l=e.selection.$from;const c=K2(l.parent.contentMatchAt(l.index()));if(!c)return!1;const d=Object.keys(c.spec.attrs||{}),h=s?Object.fromEntries(Object.entries(s).filter(([p])=>d.includes(p))):{};let f;if(o){const p=so(o,r.schema);f=c.createAndFill(h,p)}else f=c.createAndFill(h);return f?(t&&(e.insert(l.pos,f),a&&H2(e,e.steps.length-1,-1)),!0):!1},z8=()=>({state:n,dispatch:e})=>mX(n,e),Z8=()=>({state:n,dispatch:e})=>gX(n,e),F8=()=>({state:n,dispatch:e})=>Gw(n,e),V8=()=>({state:n,dispatch:e})=>e2(n,e),Y8=()=>({state:n,dispatch:e,tr:t})=>{try{const r=yd(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},q8=()=>({state:n,dispatch:e,tr:t})=>{try{const r=yd(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},U8=()=>({state:n,dispatch:e})=>fX(n,e),G8=()=>({state:n,dispatch:e})=>pX(n,e);function J2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function H8(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))bu()||J2()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}const K8=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=H8(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function zr(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?pt(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const l=i-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Ou(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=l}const J8=(n,e={})=>({state:t,dispatch:r})=>zr(t,pt(n,t.schema),e)?OX(t,r):!1,e_=()=>({state:n,dispatch:e})=>i2(n,e),t_=n=>({state:e,dispatch:t})=>{const r=pt(n,e.schema);return TX(r)(e,t)},n_=()=>({state:n,dispatch:e})=>n2(n,e);function $d(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function qb(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const r_=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=$d(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=pt(n,r.schema)),a==="mark"&&(o=Fr(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,h)=>{s&&s===d.type&&(l=!0,i&&t.setNodeMarkup(h,void 0,qb(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(f=>{o===f.type&&(l=!0,i&&t.addMark(h,h+d.nodeSize,o.create(qb(f.attrs,e))))})})}),l},i_=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),s_=()=>({tr:n,dispatch:e})=>{if(e){const t=new fn(n.doc);n.setSelection(t)}return!0},o_=()=>({state:n,dispatch:e})=>Kw(n,e),a_=()=>({state:n,dispatch:e})=>t2(n,e),l_=()=>({state:n,dispatch:e})=>SX(n,e),c_=()=>({state:n,dispatch:e})=>wX(n,e),u_=()=>({state:n,dispatch:e})=>vX(n,e);function Mp(n,e,t={},r={}){return so(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const d_=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Mp(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});if(o){const d=G2(c)?c.content:[c];s.replaceWith(0,l.content.size,d).setMeta("preventUpdate",!t)}return!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function eQ(n,e){const t=Fr(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function tQ(n,e){const t=new Fw(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function h_(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function f_(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Cd(n){return e=>f_(e.$from,n)}function q(n,e,t){return n.config[e]===void 0&&n.parent?q(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?q(n.parent,e,t):null}):n.config[e]}function yg(n){return n.map(e=>{const t=q(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...yg(t())]:e}).flat(10)}function xg(n,e){const t=us.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function nQ(n){return typeof n=="function"}function Se(n,e=void 0,...t){return nQ(n)?e?n.bind(e)(...t):n(...t):n}function p_(n={}){return Object.keys(n).length===0&&n.constructor===Object}function oo(n){return{baseExtensions:n.filter(e=>e.type==="extension"),nodeExtensions:n.filter(e=>e.type==="node"),markExtensions:n.filter(e=>e.type==="mark")}}function rQ(n){const e=[],{nodeExtensions:t,markExtensions:r}=oo(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return n.forEach(c=>{const d=q(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:i});d&&d().forEach(h=>{let f;Array.isArray(h.types)?f=h.types:h.types==="*"?f=l:h.types==="nodes"?f=o:h.types==="marks"?f=a:f=[],f.forEach(p=>{Object.entries(h.attributes).forEach(([m,O])=>{e.push({type:p,name:m,attribute:{...s,...O}})})})})}),i.forEach(c=>{const d=q(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!d)return;const h=d();Object.entries(h).forEach(([f,p])=>{const m={...s,...p};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:c.name,name:f,attribute:m})})}),e}function m_(n){const e=[];let t="",r=!1,i=!1,s=0;const o=n.length;for(let a=0;a<o;a+=1){const l=n[a];if(l==="'"&&!i){r=!r,t+=l;continue}if(l==='"'&&!r){i=!i,t+=l;continue}if(!r&&!i){if(l==="("){s+=1,t+=l;continue}if(l===")"&&s>0){s-=1,t+=l;continue}if(l===";"&&s===0){e.push(t),t="";continue}}t+=l}return t&&e.push(t),e}function Ub(n){const e=[],t=m_(n||""),r=t.length;for(let i=0;i<r;i+=1){const s=t[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),l=s.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function He(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:s,writable:!0});return}if(!r[i]){r[i]=s;return}if(i==="class"){const o=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],l=o.filter(c=>!a.includes(c));r[i]=[...a,...l].join(" ")}else if(i==="style"){const o=new Map([...Ub(r[i]),...Ub(s)]);r[i]=Array.from(o.entries()).map(([a,l])=>`${a}: ${l}`).join("; ")}else r[i]=s}),r},{})}function Ua(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>He(t,r),{})}function g_(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Gb(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):g_(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Hb(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&p_(t)?!1:t!=null))}function Kb(n){var e,t;const r={};return!(!(n==null||(e=n.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),(n==null||(t=n.attribute)===null||t===void 0?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function O_(n,e){var t;const r=rQ(n),{nodeExtensions:i,markExtensions:s}=oo(n),o=(t=i.find(c=>q(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(i.map(c=>{const d=r.filter(b=>b.type===c.name),h={name:c.name,options:c.options,storage:c.storage,editor:e},f=Hb({...n.reduce((b,y)=>{const S=q(y,"extendNodeSchema",h);return{...b,...S?S(c):{}}},{}),content:Se(q(c,"content",h)),marks:Se(q(c,"marks",h)),group:Se(q(c,"group",h)),inline:Se(q(c,"inline",h)),atom:Se(q(c,"atom",h)),selectable:Se(q(c,"selectable",h)),draggable:Se(q(c,"draggable",h)),code:Se(q(c,"code",h)),whitespace:Se(q(c,"whitespace",h)),linebreakReplacement:Se(q(c,"linebreakReplacement",h)),defining:Se(q(c,"defining",h)),isolating:Se(q(c,"isolating",h)),attrs:Object.fromEntries(d.map(Kb))}),p=Se(q(c,"parseHTML",h));p&&(f.parseDOM=p.map(b=>Gb(b,d)));const m=q(c,"renderHTML",h);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:Ua(b,d)}));const O=q(c,"renderText",h);return O&&(f.toText=O),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const d=r.filter(O=>O.type===c.name),h={name:c.name,options:c.options,storage:c.storage,editor:e},f=Hb({...n.reduce((O,b)=>{const y=q(b,"extendMarkSchema",h);return{...O,...y?y(c):{}}},{}),inclusive:Se(q(c,"inclusive",h)),excludes:Se(q(c,"excludes",h)),group:Se(q(c,"group",h)),spanning:Se(q(c,"spanning",h)),code:Se(q(c,"code",h)),attrs:Object.fromEntries(d.map(Kb))}),p=Se(q(c,"parseHTML",h));p&&(f.parseDOM=p.map(O=>Gb(O,d)));const m=q(c,"renderHTML",h);return m&&(f.toDOM=O=>m({mark:O,HTMLAttributes:Ua(O,d)})),[c.name,f]}));return new Tw({topNode:o,nodes:a,marks:l})}function b_(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function aa(n){return n.sort((t,r)=>{const i=q(t,"priority")||100,s=q(r,"priority")||100;return i>s?-1:i<s?1:0})}function iQ(n){const e=aa(yg(n)),t=b_(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function sQ(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
115
-
116
- `,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,d,h)=>{l.isBlock&&c>r&&(a+=s);const f=o?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:h,range:e})),!1;if(l.isText){var p;a+=l==null||(p=l.text)===null||p===void 0?void 0:p.slice(Math.max(r,c)-c,i-c)}}),a}function y_(n,e){return sQ(n,{from:0,to:n.content.size},e)}function oQ(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function x_(n,e){const t=pt(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function aQ(n,e){const t=$d(typeof e=="string"?e:e.name,n.schema);return t==="node"?x_(n,e):t==="mark"?eQ(n,e):{}}function S_(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function k_(n){const e=S_(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,s)=>s!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function Pd(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),d=e.slice(s).map(l),h=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:h,to:f},newRange:{from:c,to:d}})})}),k_(r)}function Sg(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=bg(t.resolve(n),i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}const v_=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]},w_=n=>{const e=n.depth-1;if(e<0)return null;const t=n.index(e);return t===0?null:n.node(e).child(t-1)};function Os(n,e){return e.nodes[n]||e.marks[n]||null}function Cc(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const Q_=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const d=((l=(c=i.type.spec).toText)===null||l===void 0?void 0:l.call(c,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t};function Ap(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?Fr(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Ou(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;n.doc.nodesBetween(f,p,(m,O)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;const b=Math.max(f,O),y=Math.min(p,O+m.nodeSize),S=y-b;o+=S,a.push(...m.marks.map(x=>({mark:x,from:b,to:y})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Ou(d.mark.attrs,t,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+c:l)>=o}function $_(n,e,t={}){if(!e)return zr(n,null,t)||Ap(n,null,t);const r=$d(e,n.schema);return r==="node"?zr(n,e,t):r==="mark"?Ap(n,e,t):!1}const C_=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=Cd(a=>a.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},P_=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Jb(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Bh(n,e){const{nodeExtensions:t}=oo(e),r=t.find(s=>s.name===n);if(!r)return!1;const i=Se(q(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function gl(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){if(t){if(n.type.name==="hardBreak")return!0;if(n.isText){var r;return!/\S/.test((r=n.text)!==null&&r!==void 0?r:"")}}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(gl(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function lQ(n){return n instanceof J}var cQ=class uQ{constructor(e){this.position=e}static fromJSON(e){return new uQ(e.position)}toJSON(){return{position:this.position}}};function T_(n,e){const t=e.mapping.mapResult(n.position);return{position:new cQ(t.pos),mapResult:t}}function M_(n){return new cQ(n)}function A_(n,e,t){const{selection:r}=e;let i=null;if(Y2(r)&&(i=r.$cursor),i){var s;const a=(s=n.storedMarks)!==null&&s!==void 0?s:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(l=>l.type.excludes(t)))}const{ranges:o}=r;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,h,f)=>{if(c)return!1;if(d.isInline){const p=!f||f.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(O=>O.type.excludes(t));c=p&&m}return!c}),c})}const R_=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=Fr(n,r.schema);if(i)if(o){const c=eQ(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,h=c.$to.pos;r.doc.nodesBetween(d,h,(f,p)=>{const m=Math.max(p,d),O=Math.min(p+f.nodeSize,h);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&t.addMark(m,O,l.create({...b.attrs,...e}))}):t.addMark(m,O,l.create(e))})});return A_(r,t,l)},E_=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),N_=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=pt(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>pb(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>pb(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},D_=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Xi(n,0,r.content.size),s=J.create(r,i);e.setSelection(s)}return!0},j_=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:n})}),!0},I_=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=ee.atStart(r).from,a=ee.atEnd(r).to,l=Xi(i,o,a),c=Xi(s,o,a),d=ee.create(r,l,c);e.setSelection(d)}return!0},X_=n=>({state:e,dispatch:t})=>{const r=pt(n,e.schema);return RX(r)(e,t)};function ey(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const L_=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,d=Cc(c,a.node().type.name,a.node().attrs);if(s instanceof J&&s.node.isBlock)return!a.parentOffset||!Ir(o,a.pos)?!1:(r&&(n&&ey(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const h=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:K2(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=h&&f?[{type:f,attrs:d}]:void 0,m=Ir(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Ir(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(m&&(s instanceof ee&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!h&&!a.parentOffset&&a.parent.type!==f)){const O=e.mapping.map(a.before()),b=e.doc.resolve(O);a.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&ey(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},__=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{const o=pt(n,r.schema),{$from:a,$to:l}=r.selection,c=r.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const d=a.node(-1);if(d.type!==o)return!1;const h=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){var f;let y=E.empty;const S=a.index(-1)?1:a.index(-2)?2:3;for(let C=a.depth-S;C>=a.depth-3;C-=1)y=E.from(a.node(C).copy(y));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...Cc(h,a.node().type.name,a.node().attrs),...e},v=((f=o.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(k))||void 0;y=y.append(E.from(o.createAndFill(null,v)||void 0));const w=a.before(a.depth-(S-1));t.replace(w,a.after(-x),new z(y,4-S,0));let Q=-1;t.doc.nodesBetween(w,t.doc.content.size,(C,T)=>{if(Q>-1)return!1;C.isTextblock&&C.content.size===0&&(Q=T+1)}),Q>-1&&t.setSelection(ee.near(t.doc.resolve(Q))),t.scrollIntoView()}return!0}const p=l.pos===a.end()?d.contentMatchAt(0).defaultType:null,m={...Cc(h,d.type.name,d.attrs),...e},O={...Cc(h,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,l.pos);const b=p?[{type:o,attrs:m},{type:p,attrs:O}]:[{type:o,attrs:m}];if(!Ir(t.doc,a.pos,2))return!1;if(i){const{selection:y,storedMarks:S}=r,{splittableMarks:x}=s.extensionManager,k=S||y.$to.parentOffset&&y.$from.marks();if(t.split(a.pos,2,b).scrollIntoView(),!k||!i)return!0;const v=k.filter(w=>x.includes(w.type.name));t.ensureMarks(v)}return!0};function ty(n){return!n||n==="1"?null:n}function dQ(n,e){return ty(n)===ty(e)}const Wh=(n,e)=>{const t=Cd(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return!(t.node.type===i?.type&&wi(n.doc,t.pos))||!dQ(t.node.attrs.type,i?.attrs.type)||n.join(t.pos),!0},zh=(n,e)=>{const t=Cd(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return!(t.node.type===i?.type&&wi(n.doc,r))||!dQ(t.node.attrs.type,i?.attrs.type)||n.join(r),!0};function B_(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),i=e.resolve(t.nodeSize-1);return ee.between(r,i)}const W_=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:h,splittableMarks:f}=i.extensionManager,p=pt(n,o.schema),m=pt(e,o.schema),{selection:O,storedMarks:b}=o,{$from:y,$to:S}=O,x=y.blockRange(S),k=b||O.$to.parentOffset&&O.$from.marks();if(!x)return!1;const v=Cd(D=>Bh(D.type.name,h))(O),w=O.from===0&&O.to===o.doc.content.size,Q=o.doc.content.content,C=Q.length===1?Q[0]:null,T=w&&C&&Bh(C.type.name,h)?{node:C,pos:0}:null,P=v??T,R=!!v&&x.depth>=1&&x.depth-v.depth<=1,M=!!T;if((R||M)&&P){if(P.node.type===p)return w&&M?l().command(({tr:D,dispatch:N})=>{const I=B_(D);return I?(D.setSelection(I),N&&N(D),!0):!1}).liftListItem(m).run():c.liftListItem(m);if(Bh(P.node.type.name,h)&&p.validContent(P.node.content))return l().command(()=>(s.setNodeMarkup(P.pos,p),!0)).command(()=>Wh(s,p)).command(()=>zh(s,p)).run()}return!t||!k||!a?l().command(()=>d().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Wh(s,p)).command(()=>zh(s,p)).run():l().command(()=>{const D=d().wrapInList(p,r),N=k.filter(I=>f.includes(I.type.name));return s.ensureMarks(N),D?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Wh(s,p)).command(()=>zh(s,p)).run()},z_=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Fr(n,r.schema);return Ap(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Z_=(n,e,t={})=>({state:r,commands:i})=>{const s=pt(n,r.schema),o=pt(e,r.schema),a=zr(r,s,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},F_=(n,e={})=>({state:t,commands:r})=>{const i=pt(n,t.schema);return zr(t,i,e)?r.lift(i):r.wrapIn(i,e)},V_=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},Y_=(n={})=>({tr:e,dispatch:t,editor:r})=>{const{ignoreClearable:i=!1}=n,{selection:s}=e,{empty:o,ranges:a}=s;if(o)return!0;const{nonClearableMarks:l}=r.extensionManager;if(t){const c=Object.values(r.schema.marks).filter(d=>i||!l.includes(d.name));a.forEach(d=>{for(const h of c)e.removeMark(d.$from.pos,d.$to.pos,h)})}return!0},q_=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=e,{selection:o}=t,a=Fr(n,r.schema),{$from:l,empty:c,ranges:d}=o;if(!i)return!0;if(c&&s){var h;let{from:f,to:p}=o;const m=bg(l,a,(h=l.marks().find(O=>O.type===a))===null||h===void 0?void 0:h.attrs);m&&(f=m.from,p=m.to),t.removeMark(f,p,a)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},U_=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let s,o;return typeof n=="number"?(s=n,o=n):n&&"from"in n&&"to"in n?(s=n.from,o=n.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},G_=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=$d(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=pt(n,r.schema)),a==="mark"&&(o=Fr(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{const d=c.$from.pos,h=c.$to.pos;let f,p,m,O;t.selection.empty?r.doc.nodesBetween(d,h,(b,y)=>{s&&s===b.type&&(l=!0,m=Math.max(y,d),O=Math.min(y+b.nodeSize,h),f=y,p=b)}):r.doc.nodesBetween(d,h,(b,y)=>{y<d&&s&&s===b.type&&(l=!0,m=Math.max(y,d),O=Math.min(y+b.nodeSize,h),f=y,p=b),y>=d&&y<=h&&(s&&s===b.type&&(l=!0,i&&t.setNodeMarkup(y,void 0,{...b.attrs,...e})),o&&b.marks.length&&b.marks.forEach(S=>{if(o===S.type&&(l=!0,i)){const x=Math.max(y,d),k=Math.min(y+b.nodeSize,h);t.addMark(x,k,o.create({...S.attrs,...e}))}}))}),p&&(f!==void 0&&i&&t.setNodeMarkup(f,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(b=>{o===b.type&&i&&t.addMark(m,O,o.create({...b.attrs,...e}))}))}),l},Qs=new st("__tiptap_decorations__"),H_=n=>({tr:e,dispatch:t})=>(t&&e.setMeta(Qs,{type:"force",name:n}),!0),K_=(n,e={})=>({state:t,dispatch:r})=>{const i=pt(n,t.schema);return QX(i,e)(t,r)},J_=(n,e={})=>({state:t,dispatch:r})=>{const i=pt(n,t.schema);return $X(i,e)(t,r)};var eB=g7({blur:()=>S8,clearContent:()=>k8,clearNodes:()=>v8,command:()=>w8,createParagraphNear:()=>Q8,cut:()=>$8,deleteCurrentNode:()=>C8,deleteNode:()=>P8,deleteRange:()=>T8,deleteSelection:()=>R8,enter:()=>E8,exitCode:()=>N8,extendMarkRange:()=>D8,first:()=>j8,focus:()=>X8,forEach:()=>L8,insertContent:()=>_8,insertContentAt:()=>B8,insertDefaultBlock:()=>W8,joinBackward:()=>F8,joinDown:()=>Z8,joinForward:()=>V8,joinItemBackward:()=>Y8,joinItemForward:()=>q8,joinTextblockBackward:()=>U8,joinTextblockForward:()=>G8,joinUp:()=>z8,keyboardShortcut:()=>K8,lift:()=>J8,liftEmptyBlock:()=>e_,liftListItem:()=>t_,newlineInCode:()=>n_,resetAttributes:()=>r_,scrollIntoView:()=>i_,selectAll:()=>s_,selectNodeBackward:()=>o_,selectNodeForward:()=>a_,selectParentNode:()=>l_,selectTextblockEnd:()=>c_,selectTextblockStart:()=>u_,setContent:()=>d_,setMark:()=>R_,setMeta:()=>E_,setNode:()=>N_,setNodeSelection:()=>D_,setTextDirection:()=>j_,setTextSelection:()=>I_,sinkListItem:()=>X_,splitBlock:()=>L_,splitListItem:()=>__,toggleList:()=>W_,toggleMark:()=>z_,toggleNode:()=>Z_,toggleWrap:()=>F_,undoInputRule:()=>V_,unsetAllMarks:()=>Y_,unsetMark:()=>q_,unsetTextDirection:()=>U_,updateAttributes:()=>G_,updateDecorations:()=>H_,wrapIn:()=>K_,wrapInList:()=>J_});const Mo=new WeakMap;function tB(n,e){var t;Mo.set(n,((t=Mo.get(n))!==null&&t!==void 0?t:0)+1);try{return e()}finally{var r;const i=((r=Mo.get(n))!==null&&r!==void 0?r:1)-1;i>0?Mo.set(n,i):Mo.delete(n)}}var nB=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function rB(n){return n.kind==="widget"}function hQ(n,e){const t=[],r=new Set;for(const i of n)i.kind==="widget"&&rB(i)&&r.add(i.key),t.push(i.toPMDecoration(e));return{decorations:t,widgetKeys:r}}function iB(n,e,t){const{decorations:r,widgetKeys:i}=hQ(e,t);return{set:be.create(n,r),widgetKeys:i}}function fQ({position:n,from:e,to:t,docSize:r}){return n<e?!1:n<t?!0:n===t&&t===r}function sB({decorations:n,from:e,to:t,docSize:r,extensionName:i,warnedExtensions:s}){return n.filter(o=>fQ({position:o.anchor,from:e,to:t,docSize:r})?!0:(o.anchor===t||s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${e}, ${t}). It was ignored.`)),!1))}function oB(n){var e;const t=(e=n.spec)===null||e===void 0?void 0:e.key;return typeof t=="string"?t:void 0}function pQ(n){return n.jsonID==="attr"}function aB(n){let e=!1;if(n.getMap().forEach(()=>{e=!0}),e||pQ(n))return!0;const t=n;return typeof t.from=="number"&&typeof t.to=="number"}function lB(n,e){let t=null,r=0,i=0;for(let s=0;s<n.childCount&&!(i>e.to);s+=1){const o=i+n.child(s).nodeSize;o>=e.from&&(t===null&&(t=i),r=o),i=o}return t===null?null:{from:t,to:r}}function cB(n,e){if(n.steps.some(s=>!aB(s)))return{type:"full"};const t=Pd(n).map(({newRange:s})=>s);n.steps.forEach((s,o)=>{if(!pQ(s))return;const a=n.mapping.slice(o);t.push({from:a.map(s.pos,-1),to:a.map(s.pos+1)})});const r=[];for(const s of t){const o=lB(e,s);o&&r.push(o)}r.sort((s,o)=>s.from-o.from);const i=[];for(const s of r){const o=i[i.length-1];o&&s.from<=o.to?o.to=Math.max(o.to,s.to):i.push({...s})}return{type:"ranges",ranges:i}}function mQ(n,e,t,r){return n.map(e,t,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function uB(n,e,t){var r,i;const s=(r=e.decorationSetsByExtension[n])!==null&&r!==void 0?r:be.empty,o=new Set((i=e.widgetKeysByExtension[n])!==null&&i!==void 0?i:[]);return{set:mQ(s,t.mapping,t.doc,o),widgetKeys:o}}function ny(n,e){const t=Object.values(e).flatMap(r=>r.find());return be.create(n,t)}function ry(n){const e=new Set;for(const t of Object.values(n))for(const r of t)e.add(r);return e}function dB(n,e){var t;switch((t=e.update)!==null&&t!==void 0?t:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${n}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${n}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${n}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function hB(n,e,t){return t?!0:n.update==="manual"?!1:n.shouldUpdate?n.shouldUpdate(e):e.tr.docChanged}const fB=new Set;var pB=class{constructor(n){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const t=Qs.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=n.editor,this.entries=this.resolveEntries(n.entries),this.entries.forEach(({name:e,spec:t})=>dB(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var n,e;return(n=(e=Qs.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&n!==void 0?n:fB}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(n){const e=[];for(const{name:t,addDecorations:r}of n){const i=r();i&&e.push({name:t,spec:i})}return e}createPlugin(){const{editor:n,entries:e}=this;return new Ze({key:Qs,state:{init:(t,r)=>{const i={},s={};for(const{name:a,spec:l}of e){const{set:c,widgetKeys:d}=this.buildFullSet(a,l,r);i[a]=c,s[a]=d}const o={decorationSetsByExtension:i,widgetKeysByExtension:s,mergedDecorationSet:this.buildMergedSet(r.doc,i),widgetKeys:ry(s)};return this.warnDuplicateWidgetKeys(o),o},apply:(t,r,i,s)=>{const o=t.getMeta(Qs),a=o?.type==="force"&&!o.name,l=o?.type==="force"?o.name:void 0,c={},d={},h=new Set;return tB(n,()=>{for(const{name:f,spec:p}of e){const m=a||l===f;if(hB(p,{editor:n,tr:t,oldState:i,newState:s},m))if(p.update==="changedRanges"&&t.docChanged&&!m){const O=this.applyChangedRangesRecompute(f,p,r,t,s);c[f]=O.set,d[f]=O.widgetKeys,h.add(f)}else{const{set:O,widgetKeys:b}=this.buildFullSet(f,p,s);c[f]=O,d[f]=b,h.add(f)}else{const O=uB(f,r,t);c[f]=O.set,d[f]=O.widgetKeys}}}),h.size===0&&!t.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:d,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:t,decorationSetsByExtension:c,recomputedNames:h}),widgetKeys:ry(d)}}},props:{decorations(t){var r,i;return(r=(i=Qs.getState(t))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:be.empty}}})}applyChangedRangesRecompute(n,e,t,r,i){const s=cB(r,i.doc);return s.type==="full"?this.buildFullSet(n,e,i):this.rebuildRanges(n,e,t,r,i,s.ranges)}rebuildRanges(n,e,t,r,i,s){var o,a;const l=(o=t.decorationSetsByExtension[n])!==null&&o!==void 0?o:be.empty,c=new Set((a=t.widgetKeysByExtension[n])!==null&&a!==void 0?a:[]);let d=mQ(l,r.mapping,r.doc,c);const h=i.doc.content.size;for(const{from:f,to:p}of s){const m=d.find(f,p).filter(y=>fQ({position:y.from,from:f,to:p,docSize:h}));for(const y of m){const S=oB(y);S&&c.delete(S)}d=d.remove(m);const{decorations:O,widgetKeys:b}=hQ(sB({decorations:this.runCreate(n,"createInRange",()=>e.createInRange({editor:this.editor,state:i,view:this.mountedView,from:f,to:p})),from:f,to:p,docSize:h,extensionName:n,warnedExtensions:this.warnedOutOfRangeExtensions}),n);d=d.add(i.doc,O);for(const y of b)c.add(y)}return{set:d,widgetKeys:c}}buildFullSet(n,e,t){const r=this.runCreate(n,"create",()=>e.create({editor:this.editor,state:t,view:this.mountedView}));return iB(t.doc,r,n)}runCreate(n,e,t){try{return t()}catch(r){return console.error(`[tiptap error]: Extension "${n}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(n){}buildMergedSet(n,e){const t=Object.keys(e);return t.length===1?e[t[0]]:ny(n,e)}mergeAfterApply({entries:n,previous:e,tr:t,decorationSetsByExtension:r,recomputedNames:i}){return n.length===1?r[n[0].name]:i.size===0?e.mergedDecorationSet.map(t.mapping,t.doc):ny(t.doc,r)}};function mB(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof J){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function gB(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}function OB(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function bB(n){return typeof n=="number"}function yB(n){return Object.prototype.toString.call(n).slice(8,-1)}function Gl(n){return yB(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function kg(n){return/\s/.test(n)}function gQ(n){return/^\w$/.test(n)}function xB(n,e){for(;e<n.length&&kg(n[e]);)e+=1;return e}function Td(n,e){for(;e<n.length&&!kg(n[e]);)e+=1;return e}function SB(n,e,t){for(;e<n.length&&(gQ(n[e])||t);)e+=1;return e}function kB(n,e){const t=n.indexOf(n[e],e+1);return{nextIndex:Td(n,t===-1?e:t+1)}}function vB(n,e,t,r){let i=t;if(n[i]!=="=")return;i=i+1;const s=n[i];if(s!=='"'&&s!=="'")return;const o=n.indexOf(s,i+1);if(o!==-1)return{token:{type:"keyValue",name:e,value:n.slice(i+1,o)},nextIndex:Td(n,o+1)}}function wB(n,e,t){const r=t==="pandoc",i=SB(n,e+1,r),s=n.slice(e,i),o=vB(n,s,i);if(o)return o;const a=i===n.length||kg(n[i]);return{token:r&&a?{type:"boolean",name:s}:void 0,nextIndex:t==="shortcode"?Td(n,i):i}}function QB(n,e,t){const r=n[e];return r==='"'||r==="'"?kB(n,e):gQ(r)?wB(n,e,t):{nextIndex:Td(n,e)}}function $B(n,e){const t=[];let r=0;for(;r<n.length&&(r=xB(n,r),!(r>=n.length));){const i=QB(n,r,e);i.token&&t.push(i.token),r=i.nextIndex}return t}function CB(n){const e={};return $B(n,"shortcode").forEach(t=>{t.type==="keyValue"&&(e[t.name]=t.value)}),e}function PB(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function TB(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=CB,serializeAttributes:s=PB,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,d=f=>{if(!l)return f;const p={};return l.forEach(m=>{const O=typeof m=="string"?m:m.name,b=typeof m=="string"?void 0:m.skipIfDefault;if(O in f){const y=f[O];if(b!==void 0&&y===b)return;p[O]=y}}),p},h=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const m={...o,...f.attributes};if(a)return p.createNode(e,m);const O=r?r(f):f.content||"";return O?p.createNode(e,m,[p.createTextNode(O)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(f){const p=a?new RegExp(`\\[${h}\\s*[^\\]]*\\]`):new RegExp(`\\[${h}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${h}\\]`),m=f.match(p),O=m?.index;return O!==void 0?O:-1},tokenize(f,p,m){const O=a?new RegExp(`^\\[${h}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${h}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${h}\\]`),b=f.match(O);if(!b)return;let y="",S="";if(a){const[,k]=b;S=k}else{const[,k,v]=b;S=k,y=v||""}const x=i(S.trim());return{type:e,raw:b[0],content:y.trim(),attributes:x}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const m=d(f.attrs||{}),O=s(m),b=O?` ${O}`:"";return a?`[${c}${b}]`:`[${c}${b}]${p}[/${c}]`}}}function iy(n,e,t){const r=n.split(`
117
- `),i=[];let s="",o=0;const a=e.baseIndentSize||2;for(;o<r.length;){const d=r[o],h=d.match(e.itemPattern);if(!h){if(i.length>0)break;if(d.trim()===""){o+=1,s=`${s}${d}
118
- `;continue}else return}const f=e.extractItemData(h),{indentLevel:p,mainContent:m}=f;s=`${s}${d}
119
- `;const O=[m];for(o+=1;o<r.length;){var l;const x=r[o];if(x.trim()===""){var c;const k=r.slice(o+1).findIndex(v=>v.trim()!=="");if(k===-1)break;if((((c=r[o+1+k].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>p){O.push(x),s=`${s}${x}
120
- `,o+=1;continue}else break}if((((l=x.match(/^(\s*)/))===null||l===void 0||(l=l[1])===null||l===void 0?void 0:l.length)||0)>p)O.push(x),s=`${s}${x}
121
- `,o+=1;else break}let b;const y=O.slice(1);if(y.length>0){const x=y.map(k=>k.slice(p+a)).join(`
122
- `);x.trim()&&(e.customNestedParser?b=e.customNestedParser(x):b=t.blockTokens(x))}const S=e.createToken(f,b);i.push(S)}if(i.length!==0)return{items:i,raw:s}}const sy=4;function oy(n){let e=0;for(const t of n)e=t===" "?e+sy-e%sy:e+1;return e}function OQ(n,e,t,r,i){if(!n||!Array.isArray(n.content))return"";const s=typeof t=="function"?t(r):t,[o,...a]=n.content;let l=`${s}${e.renderChildren([o])}`;return a&&a.length>0&&a.forEach((c,d)=>{var h,f;const p=(h=(f=e.renderChild)===null||f===void 0?void 0:f.call(e,c,d+1))!==null&&h!==void 0?h:e.renderChildren([c]);if(p!=null){const m=b=>{if(!i?.alignNestedToPrefix)return e.indent(b);const y=e.indent(""),S=oy(s);return(oy(y)>=S?y:" ".repeat(S))+b},O=p.split(`
123
- `).map(b=>m(b||"")).join(`
124
- `);l+=c.type==="paragraph"?`
125
-
126
- ${O}`:`
127
- ${O}`}}),l}function bQ(n,e){const t={...n};return Gl(n)&&Gl(e)&&Object.keys(e).forEach(r=>{Gl(e[r])&&Gl(n[r])?t[r]=bQ(n[r],e[r]):t[r]=e[r]}),t}function MB(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((a,l)=>{const c=s.mapping.map(l),d=s.mapping.map(l)+a.nodeSize;let h=null;if(a.marks.forEach(p=>{if(p!==o)return!1;h=p}),!h)return;let f=!1;if(Object.keys(t).forEach(p=>{t[p]!==h.attrs[p]&&(f=!0)}),f){const p=n.type.create({...n.attrs,...t});s.removeMark(c,d,n.type),s.addMark(c,d,p)}}),s.docChanged&&e.view.dispatch(s)}var Ol=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!==null&&e!==void 0?e:!0}};const AB=(n,e)=>{if(Og(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Hl(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const h=Q_(c)+s;return o.forEach(f=>{if(d)return;const p=AB(h,f.find);if(!p)return;const m=p[0].length-s.length;if(m>0){const v=c.parentOffset-m;if(v<0||c.parent.textBetween(v,c.parentOffset)!==p[0].slice(0,m))return}const O=l.state.tr,b=Qd({state:l.state,transaction:O}),y={from:r-(p[0].length-s.length),to:i},{commands:S,chain:x,can:k}=new zs({editor:t,state:b});f.handler({state:b,range:y,match:p,commands:S,chain:x,can:k})===null||!O.steps.length||(f.undoable&&O.setMeta(a,{transform:O,from:r,to:i,text:s}),l.dispatch(O),d=!0)}),d}function RB(n){const{editor:e,rules:t}=n,r=new Ze({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=xg(E.from(c),o.schema);const{from:d}=l,h=d+c.length;Hl({editor:e,from:d,to:h,text:c,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Hl({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Hl({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Hl({editor:e,from:o.pos,to:o.pos,text:`
128
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}var vg=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Se(q(this,"addOptions",{name:this.name}))}}get storage(){return{...Se(q(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>bQ(this.options,n)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},ds=class yQ extends vg{constructor(...e){super(...e),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new yQ(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!s.find(a=>a?.type.name===t.name))return!1;const o=s.find(a=>a?.type.name===t.name);return o&&r.removeStoredMark(o),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},xQ=class{constructor(n){this.find=n.find,this.handler=n.handler}};const EB=(n,e,t)=>{if(Og(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function NB(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:d}=new zs({editor:e,state:t}),h=[];return t.doc.nodesBetween(r,i,(f,p)=>{var m,O,b,y;if(!((m=f.type)===null||m===void 0||(m=m.spec)===null||m===void 0)&&m.code||!(f.isText||f.isTextblock||f.isInline))return;const S=(O=(b=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&b!==void 0?b:f.nodeSize)!==null&&O!==void 0?O:0,x=Math.max(r,p),k=Math.min(i,p+S);if(x>=k)return;const v=f.isText?f.text||"":f.textBetween(x-p,k-p,void 0,"");EB(v,s.find,o).forEach(w=>{if(w.index===void 0)return;const Q=x+w.index+1,C=Q+w[0].length,T={from:t.tr.mapping.map(Q),to:t.tr.mapping.map(C)},P=s.handler({state:t,range:T,match:w,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});h.push(P)})}),h.every(f=>f!==null)}let Kl=null;const DB=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function jB(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:c,from:d,to:h,rule:f,pasteEvt:p})=>{const m=c.tr,O=Qd({state:c,transaction:m});if(!(!NB({editor:e,state:O,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(c=>new Ze({view(d){const h=p=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,r&&(Kl=e)},f=()=>{Kl&&(Kl=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(s=r===d.dom.parentElement,a=h,!s){const f=Kl;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,O=p.getMeta("uiEvent")==="drop"&&!s,b=p.getMeta("applyPasteRules"),y=!!b;if(!m&&!O&&!y)return;if(y){let{text:k}=b;typeof k=="string"?k=k:k=xg(E.from(k),f.schema);const{from:v}=b,w=v+k.length,Q=DB(k);return l({rule:c,state:f,from:v,to:{b:w},pasteEvt:Q})}const S=h.doc.content.findDiffStart(f.doc.content),x=h.doc.content.findDiffEnd(f.doc.content);if(!(!bB(S)||!x||S===x.b))return l({rule:c,state:f,from:S,to:x,pasteEvt:o})}}))}var Md=class{constructor(n,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=n,this.extensions=iQ(n),this.schema=O_(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t=q(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Os(e.name,this.schema)});return t?{...n,...t()}:n},{})}get plugins(){const{editor:n}=this,e=aa([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Os(r.name,this.schema)},s=[],o=q(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&q(r,"exitable",i)&&(a.ArrowRight=()=>ds.handleExit({editor:n,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:n})]));a={...a,...f}}const l=x8(a);s.push(l);const c=q(r,"addInputRules",i);if(Jb(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const p=RB({editor:n,rules:f}),m=Array.isArray(p)?p:[p];s.push(...m)}}const d=q(r,"addPasteRules",i);if(Jb(r,n.options.enablePasteRules)&&d){const f=d();if(f&&f.length){const p=jB({editor:n,rules:f});s.push(...p)}}const h=q(r,"addProseMirrorPlugins",i);if(h){const f=h();s.push(...f)}return s}),t=this.createDecorationPlugin();return t&&e.push(t),e}createDecorationPlugin(){var n;const{editor:e}=this;(n=this.decorationManager)===null||n===void 0||n.destroy();const t=[];return this.extensions.forEach(r=>{const i=q(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Os(r.name,this.schema)});i&&t.push({name:r.name,addDecorations:i})}),this.decorationManager=new pB({editor:e,entries:t}),this.decorationManager.plugin}get attributes(){return rQ(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=oo(this.extensions);return Object.fromEntries(e.filter(t=>!!q(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i=q(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:pt(t.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const o=(a,l,c,d,h)=>{const f=Ua(a,r);return s({node:a,view:l,getPos:c,decorations:d,innerDecorations:h,editor:n,extension:t,HTMLAttributes:f})};return[t.name,o]}))}dispatchTransaction(n){const{editor:e}=this;return aa([...this.extensions].reverse()).reduceRight((t,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Os(r.name,this.schema)},s=q(r,"dispatchTransaction",i);return s?o=>{s.call(i,{transaction:o,next:t})}:t},n)}transformPastedHTML(n){const{editor:e}=this;return aa([...this.extensions]).reduce((t,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Os(r.name,this.schema)},s=q(r,"transformPastedHTML",i);return s?(o,a)=>{const l=t(o,a);return s.call(i,l)}:t},n||(t=>t))}get markViews(){const{editor:n}=this,{markExtensions:e}=oo(this.extensions);return Object.fromEntries(e.filter(t=>!!q(t,"addMarkView")).map(t=>{const r=this.attributes.filter(o=>o.type===t.name),i=q(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Fr(t.name,this.schema)});if(!i)return[];const s=(o,a,l)=>{const c=Ua(o,r);return i()({mark:o,view:a,inline:l,editor:n,extension:t,HTMLAttributes:c,updateAttributes:d=>{MB(o,n,d)}})};return[t.name,s]}))}destroy(){var n;(n=this.decorationManager)===null||n===void 0||n.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){const r=t.parent;r.child===t&&(r.child=null),t=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Os(e.name,this.schema)};if(e.type==="mark"){var r,i;(!((r=Se(q(e,"keepOnSplit",t)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((i=Se(q(e,"clearable",t)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(e.name)}const s=q(e,"onBeforeCreate",t),o=q(e,"onCreate",t),a=q(e,"onUpdate",t),l=q(e,"onSelectionUpdate",t),c=q(e,"onTransaction",t),d=q(e,"onFocus",t),h=q(e,"onBlur",t),f=q(e,"onDestroy",t);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),h&&this.editor.on("blur",h),f&&this.editor.on("destroy",f)})}};Md.resolve=iQ;Md.sort=aa;Md.flatten=yg;var ot=class SQ extends vg{constructor(...e){super(...e),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new SQ(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};const IB=ot.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ze({key:new st("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,s=oQ(t),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((l,c)=>l.$from.pos-c.$from.pos).map(({$from:l,$to:c})=>sQ(r,{from:l.pos,to:c.pos},a)).join(o??`
129
-
130
- `)}}})]}}),XB=ot.create({name:"commands",addCommands(){return{...eB}}}),LB=ot.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r;const i=()=>{var s,o,a;if((s=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(a=o.filterTransaction)===null||a===void 0?void 0:a.call(o,n))!==null&&s!==void 0?s:n.getMeta("y-sync$"))return;const l=tQ(n.before,[n,...e]);Pd(l).forEach(d=>{l.mapping.mapResult(d.oldRange.from).deletedAfter&&l.mapping.mapResult(d.oldRange.to).deletedBefore&&l.before.nodesBetween(d.oldRange.from,d.oldRange.to,(h,f)=>{const p=f+h.nodeSize-2,m=d.oldRange.from<=f&&p<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:f,to:p,newFrom:l.mapping.map(f),newTo:l.mapping.map(p),deletedRange:d.oldRange,newRange:d.newRange,partial:!m,editor:this.editor,transaction:n,combinedTransform:l})})});const c=l.mapping;l.steps.forEach((d,h)=>{if(d instanceof _n){var f,p;const m=c.slice(h).map(d.from,-1),O=c.slice(h).map(d.to),b=c.invert().map(m,-1),y=c.invert().map(O),S=m>0?(f=l.doc.nodeAt(m-1))===null||f===void 0?void 0:f.marks.some(k=>k.eq(d.mark)):!1,x=(p=l.doc.nodeAt(O))===null||p===void 0?void 0:p.marks.some(k=>k.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:b,to:y},newRange:{from:m,to:O},partial:!!(x||S),editor:this.editor,transaction:n,combinedTransform:l})}})};!((t=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&t!==void 0)||t?setTimeout(i,0):i()}}),_B=ot.create({name:"drop",addProseMirrorPlugins(){return[new Ze({key:new st("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),BB=ot.create({name:"editable",addProseMirrorPlugins(){return[new Ze({key:new st("editable"),props:{editable:()=>this.editor.options.editable}})]}}),WB=new st("focusEvents"),zB=ot.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ze({key:WB,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ZB=ot.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:h}=l,{pos:f,parent:p}=h,m=h.parent.isTextblock&&f>0?a.doc.resolve(f-1):h,O=m.parent.type.spec.isolating,b=h.pos-h.parentOffset,y=O&&m.parent.childCount===1?b===h.pos:ue.atStart(c).from===f;return!d||!p.type.isTextblock||p.textContent.length||!y||y&&h.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return bu()||J2()?s:i},addProseMirrorPlugins(){return[new Ze({key:new st("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(p=>p.getMeta("composition")))return;const r=n.some(p=>p.docChanged)&&!e.doc.eq(t.doc),i=n.some(p=>p.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=ue.atStart(e.doc).from,c=ue.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!gl(t.doc))return;const d=t.tr,h=Qd({state:t,transaction:d}),{commands:f}=new zs({editor:this.editor,state:h});if(f.clearNodes(),!!d.steps.length)return d}})]}}),FB=ot.create({name:"paste",addProseMirrorPlugins(){return[new Ze({key:new st("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),VB=ot.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Ze({key:new st("tabindex"),props:{attributes:()=>{var n;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(n=this.options.value)!==null&&n!==void 0?n:"0"}}}})]}}),YB=ot.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=oo(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ze({key:new st("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});let ay=!1;function qB(n){if(ay)return;ay=!0;let e;try{e=lt.fromJSON(n,{from:0,to:0}).slice.content}catch{return}e instanceof E||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var UB=class Fo{get name(){return this.node.type.name}constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Fo(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Fo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Fo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=t.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;const c=new Fo(l,this.editor,i,i||o?t:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(a=>t[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};const GB=`.ProseMirror {
131
- position: relative;
132
- }
133
-
134
- .ProseMirror {
135
- word-wrap: break-word;
136
- white-space: pre-wrap;
137
- white-space: break-spaces;
138
- -webkit-font-variant-ligatures: none;
139
- font-variant-ligatures: none;
140
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
141
- }
142
-
143
- .ProseMirror [contenteditable="false"] {
144
- white-space: normal;
145
- }
146
-
147
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
148
- white-space: pre-wrap;
149
- }
150
-
151
- .ProseMirror pre {
152
- white-space: pre-wrap;
153
- }
154
-
155
- img.ProseMirror-separator {
156
- display: inline !important;
157
- border: none !important;
158
- margin: 0 !important;
159
- width: 0 !important;
160
- height: 0 !important;
161
- }
162
-
163
- .ProseMirror-gapcursor {
164
- display: none;
165
- pointer-events: none;
166
- position: absolute;
167
- margin: 0;
168
- }
169
-
170
- .ProseMirror-gapcursor:after {
171
- content: "";
172
- display: block;
173
- position: absolute;
174
- top: -2px;
175
- width: 20px;
176
- border-top: 1px solid black;
177
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
178
- }
179
-
180
- @keyframes ProseMirror-cursor-blink {
181
- to {
182
- visibility: hidden;
183
- }
184
- }
185
-
186
- .ProseMirror-hideselection *::selection {
187
- background: transparent;
188
- }
189
-
190
- .ProseMirror-hideselection *::-moz-selection {
191
- background: transparent;
192
- }
193
-
194
- .ProseMirror-hideselection * {
195
- caret-color: transparent;
196
- }
197
-
198
- .ProseMirror-focused .ProseMirror-gapcursor {
199
- display: block;
200
- }`;var HB=class extends nB{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:T_,createMappablePosition:M_},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:t,slice:r,moved:i})=>this.options.onDrop(t,r,i)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const t=Tp(e,this.options.autofocus);this.editorState=Di.create({doc:e,schema:this.schema,selection:t||void 0})}qB(this.schema),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():zs.createFakeChain()}can(){return this.commandManager?this.commandManager.can():zs.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=gB(GB,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=nQ(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const t=[...this.options.enableCoreExtensions?[BB,IB.configure({blockSeparator:(n=this.options.coreExtensionOptions)===null||n===void 0||(n=n.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),XB,zB,ZB,VB.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),_B,FB,LB,YB.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Md(t,this)}createCommandManager(){this.commandManager=new zs({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=Mp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const t=Mp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Di.create({doc:t,schema:this.schema,selection:Tp(t,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=t?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new z2(n,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var d;return(d=this.capturedTransaction)===null||d===void 0?void 0:d.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return aQ(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return $_(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return xg(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
201
-
202
- `,textSerializers:t={}}=n||{};return y_(this.state.doc,{blockSeparator:e,textSerializers:{...oQ(this.schema),...t}})}get isEmpty(){return gl(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var n,e;return(n=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&n!==void 0?n:!0}$node(n,e){var t;return((t=this.$doc)===null||t===void 0?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)===null||t===void 0?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n),t=n>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new UB(e,this,!1,t)}get $doc(){return this.$pos(0)}};function cs(n){return new Ol({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Se(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),d=c+o.length;if(Sg(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(p=>p===n.type&&p!==f.mark.type)).filter(f=>f.to>c).length)return null;d<t.to&&s.delete(d,t.to),c>t.from&&s.delete(t.from+l,c);const h=t.from+l+o.length;s.addMark(t.from+l,h,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function KB(n){return new Ol({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Se(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){let c=o+r[0].lastIndexOf(r[1]);c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(c,a,l)}else if(r[0]){const c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function Rp(n){return new Ol({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=Se(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function ao(n){return new Ol({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=Se(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),l=a&&ng(a,n.type,s);if(!l)return null;if(o.wrap(a,l),n.keepMarks&&n.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(O=>f.includes(O.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(t.from-1).nodeBefore;c&&c.type===n.type&&wi(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&o.join(t.from-1)},undoable:n.undoable})}var rn=class kQ extends vg{constructor(...e){super(...e),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new kQ(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function yi(n){return new xQ({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=Se(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const d=l.search(/\S/),h=t.from+l.indexOf(a),f=h+a.length;if(Sg(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===n.type&&m!==p.mark.type)).filter(p=>p.to>h).length)return null;f<t.to&&o.delete(f,t.to),h>t.from&&o.delete(t.from+d,h),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:JB,getOwnPropertySymbols:eW}=Object,{hasOwnProperty:tW}=Object.prototype;function Ao(n,e){return function(r,i,s){return n(r,i,s)&&e(r,i,s)}}function Ro(n){return function(t,r,i){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,i);const{cache:s}=i,o=s.get(t),a=s.get(r);if(o&&a)return o===r&&a===t;s.set(t,r),s.set(r,t);const l=n(t,r,i);return s.delete(t),s.delete(r),l}}function nW(n){return n?.[Symbol.toStringTag]}function ly(n){return JB(n).concat(eW(n))}const rW=Object.hasOwn||((n,e)=>tW.call(n,e));function hs(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const iW="__v",sW="__o",oW="_owner",aW=typeof Float16Array<"u",{getOwnPropertyDescriptor:cy,keys:uy}=Object;function lW(n,e){return n.byteLength===e.byteLength&&yu(new Uint8Array(n),new Uint8Array(e))}function cW(n,e,t){let r=n.length;if(e.length!==r)return!1;for(;r-- >0;)if(!t.equals(n[r],e[r],r,r,n,e,t))return!1;return!0}function uW(n,e){return n.byteLength===e.byteLength&&yu(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function dW(n,e){return hs(n.getTime(),e.getTime())}function dy(n,e,t){return n.name===e.name&&n.message===e.message&&n.stack===e.stack&&t.equals(n.cause,e.cause,"cause","cause",n,e,t)}function hW(n,e){return n===e}function hy(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=n.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let d=!1,h=0;for(;(a=c.next())&&!a.done;){if(i[h]){h++;continue}const f=o.value,p=a.value;if(t.equals(f[0],p[0],l,h,n,e,t)&&t.equals(f[1],p[1],f[0],p[0],n,e,t)){d=i[h]=!0;break}h++}if(!d)return!1;l++}return!0}const fW=hs;function fy(n,e,t){const r=uy(n);let i=r.length;if(uy(e).length!==i)return!1;for(;i-- >0;)if(!vQ(n,e,t,r[i]))return!1;return!0}function bs(n,e,t){const r=ly(n);let i=r.length;if(ly(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=r[i],!vQ(n,e,t,s)||(o=cy(n,s),a=cy(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function pW(n,e){return hs(n.valueOf(),e.valueOf())}function mW(n,e){return n.source===e.source&&n.flags===e.flags}function py(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=n.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let c=!1,d=0;for(;(a=l.next())&&!a.done;){if(!i[d]&&t.equals(o.value,a.value,o.value,a.value,n,e,t)){c=i[d]=!0;break}d++}if(!c)return!1}return!0}function yu(n,e){let t=n.length;if(e.length!==t||n.byteOffset!==e.byteOffset)return!1;if(n instanceof Float64Array||n instanceof Float32Array||aW&&n instanceof Float16Array){for(;t-- >0;)if(n[t]!==e[t]&&(n[t]===n[t]||e[t]===e[t]))return!1;return!0}for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}function gW(n,e){return n.href===e.href?!0:n.protocol===e.protocol&&n.username===e.username&&n.password===e.password&&n.host===e.host&&n.pathname===e.pathname&&n.hash===e.hash&&OW(n.searchParams,e.searchParams)}function OW(n,e){const t=n.toString(),r=e.toString();return t===r||my(t)===my(r)}function my(n){return n.split("&").sort().join("&")}function vQ(n,e,t,r){return(r===oW||r===sW||r===iW)&&(n.$$typeof||e.$$typeof)?!0:rW(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const bW="[object ArrayBuffer]",yW="[object Arguments]",xW="[object Boolean]",SW="[object DataView]",kW="[object Date]",vW="[object Error]",wW="[object Map]",QW="[object Number]",$W="[object Object]",CW="[object RegExp]",PW="[object Set]",TW="[object String]",MW={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},AW="[object URL]",RW=Object.prototype.toString;function EW({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:h,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(b,y,S){if(b===y)return!0;if(b==null||y==null)return!1;const x=typeof b;if(x!==typeof y)return!1;if(x!=="object")return x==="number"?a(b,y,S):x==="function"?s(b,y,S):!1;const k=b.constructor;if(k!==y.constructor)return!1;if(k===Object)return l(b,y,S);if(Array.isArray(b))return e(b,y,S);if(k===Date)return r(b,y,S);if(k===RegExp)return d(b,y,S);if(k===Map)return o(b,y,S);if(k===Set)return h(b,y,S);if(k==null)return l(b,y,S);const v=RW.call(b);if(v===kW)return r(b,y,S);if(v===CW)return d(b,y,S);if(v===wW)return o(b,y,S);if(v===PW)return h(b,y,S);if(v===$W)return typeof b.then!="function"&&typeof y.then!="function"&&l(b,y,S);if(v===AW)return p(b,y,S);if(v===vW)return i(b,y,S);if(v===yW)return l(b,y,S);if(MW[v])return f(b,y,S);if(v===bW)return n(b,y,S);if(v===SW)return t(b,y,S);if(v===xW||v===QW||v===TW)return c(b,y,S);if(m){let w=m[v];if(!w){const Q=nW(b);Q&&(w=m[Q])}if(w)return w(b,y,S)}return!1}}function NW({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:lW,areArraysEqual:t?bs:cW,areDataViewsEqual:uW,areDatesEqual:dW,areErrorsEqual:t?Ao(dy,bs):Ao(dy,fy),areFunctionsEqual:hW,areMapsEqual:t?Ao(hy,bs):hy,areNumbersEqual:fW,areObjectsEqual:t?bs:fy,arePrimitiveWrappersEqual:pW,areRegExpsEqual:mW,areSetsEqual:t?Ao(py,bs):py,areTypedArraysEqual:t?Ao(yu,bs):yu,areUrlsEqual:gW,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const i=Ro(r.areArraysEqual),s=Ro(r.areErrorsEqual),o=Ro(r.areMapsEqual),a=Ro(r.areObjectsEqual),l=Ro(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areErrorsEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:l})}return r}function DW(n){return function(e,t,r,i,s,o,a){return n(e,t,a)}}function jW({circular:n,comparator:e,createState:t,equals:r,strict:i}){if(t)return function(a,l){const{cache:c=n?new WeakMap:void 0,meta:d}=t();return e(a,l,{cache:c,equals:r,meta:d,strict:i})};if(n)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const IW=$i();$i({strict:!0});$i({circular:!0});$i({circular:!0,strict:!0});$i({createInternalComparator:()=>hs});$i({strict:!0,createInternalComparator:()=>hs});$i({circular:!0,createInternalComparator:()=>hs});$i({circular:!0,createInternalComparator:()=>hs,strict:!0});function $i(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:i=!1}=n,s=NW(n),o=EW(s),a=t?t(o):DW(o);return jW({circular:e,comparator:o,createState:r,equals:a,strict:i})}const XW=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},LW=({contentComponent:n})=>{const e=hw.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(e)})};function _W(){const n=new Set;let e={},t=!1;const r=()=>{t||!n.size||(t=!0,queueMicrotask(()=>{t=!1,n.forEach(i=>i())}))};return{subscribe(i){return n.add(i),()=>{n.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,s){e={...e,[i]:I$.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var BW=class extends dr.Component{constructor(n){super(n),this.editorContentRef=dr.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((n=e.view.dom)===null||n===void 0)&&n.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=_W(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const n=this.props.editor;if(n){n.isEditorContentInitialized=!1,n.isDestroyed||n.view.setProps({nodeViews:{}}),n.contentComponent=null;try{var e;if(!(!((e=n.view.dom)===null||e===void 0)&&e.parentNode))return;const t=document.createElement("div");t.append(...n.view.dom.parentNode.childNodes),n.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:XW(e,this.editorContentRef),...t}),n?.contentComponent&&g.jsx(LW,{contentComponent:n.contentComponent})]})}};const WW=$.forwardRef((n,e)=>{const t=dr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return dr.createElement(BW,{key:t,innerRef:e,...n})}),wg=dr.memo(WW),zW=typeof window<"u"?$.useLayoutEffect:$.useEffect;var ZW=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){let e;const t=i=>{i?.transaction!==void 0&&i.transaction===e||(e=i?.transaction,this.transactionNumber+=1,this.subscribers.forEach(s=>s()))},r=this.editor;return r.on("transaction",t),r.on("update",t),()=>{r.off("transaction",t),r.off("update",t)}}}};function FW(n){var e;const[t]=$.useState(()=>new ZW(n.editor)),r=uC.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:IW);return zW(()=>t.watch(n.editor),[n.editor,t]),$.useDebugValue(r),r}const VW=!1,wQ=typeof window>"u",YW=wQ||!!(typeof window<"u"&&window.next);var qW=class QQ{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){const e=this.options.current.immediatelyRender;let t=e??!0;return wQ?(t&&VW&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):YW&&e===void 0&&(t=!1),t?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...t)=>{var r,i;return(r=(i=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(i,...t)},onBlur:(...t)=>{var r,i;return(r=(i=this.options.current).onBlur)===null||r===void 0?void 0:r.call(i,...t)},onCreate:(...t)=>{var r,i;return(r=(i=this.options.current).onCreate)===null||r===void 0?void 0:r.call(i,...t)},onDestroy:(...t)=>{var r,i;return(r=(i=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(i,...t)},onFocus:(...t)=>{var r,i;return(r=(i=this.options.current).onFocus)===null||r===void 0?void 0:r.call(i,...t)},onSelectionUpdate:(...t)=>{var r,i;return(r=(i=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(i,...t)},onTransaction:(...t)=>{var r,i;return(r=(i=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(i,...t)},onUpdate:(...t)=>{var r,i;return(r=(i=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(i,...t)},onContentError:(...t)=>{var r,i;return(r=(i=this.options.current).onContentError)===null||r===void 0?void 0:r.call(i,...t)},onDrop:(...t)=>{var r,i;return(r=(i=this.options.current).onDrop)===null||r===void 0?void 0:r.call(i,...t)},onPaste:(...t)=>{var r,i;return(r=(i=this.options.current).onPaste)===null||r===void 0?void 0:r.call(i,...t)},onDelete:(...t)=>{var r,i;return(r=(i=this.options.current).onDelete)===null||r===void 0?void 0:r.call(i,...t)},onMount:(...t)=>{var r,i;return(r=(i=this.options.current).onMount)===null||r===void 0?void 0:r.call(i,...t)},onUnmount:(...t)=>{var r,i;return(r=(i=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(i,...t)}};return new HB(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=t.extensions)===null||o===void 0?void 0:o[s])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?QQ.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,r)=>t===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function UW(n={},e=[]){const t=$.useRef(n);t.current=n;const[r]=$.useState(()=>new qW(t)),i=hw.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return $.useDebugValue(i),$.useEffect(r.onRender(e)),FW({editor:i,selector:({transactionNumber:s})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&s===0?0:s+1}),i}const $Q=$.createContext({editor:null});$Q.Consumer;const GW=$.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),HW=()=>$.useContext(GW);dr.forwardRef((n,e)=>{const{onDragStart:t}=HW(),r=n.as||"div";return g.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});dr.createContext({markViewContentRef:()=>{}});const Qg=$.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Qg.displayName="TiptapContext";const KW=()=>$.useContext(Qg);function CQ({children:n,...e}){const t="editor"in e?e.editor:e.instance;if(!t)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=$.useMemo(()=>({editor:t}),[t]),i=$.useMemo(()=>({editor:t}),[t]);return g.jsx($Q.Provider,{value:i,children:g.jsx(Qg.Provider,{value:r,children:n})})}CQ.displayName="Tiptap";function PQ({...n}){const{editor:e}=KW();return g.jsx(wg,{editor:e,...n})}PQ.displayName="Tiptap.Content";Object.assign(CQ,{Content:PQ});const JW=lo(`
203
- query Members($orgId: ID!) {
204
- members(orgId: $orgId) {
205
- userId
206
- email
207
- name
208
- avatarUrl
209
- role
210
- teamId
211
- }
212
- }
213
- `);function ez(n){var e;const{char:t,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,$position:a}=n,l=r&&!i,c=OB(t),d=new RegExp(`\\s${c}$`),h=o?"^":"",f=i?"":c,p=l?new RegExp(`${h}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${h}(?:^)?${c}[^\\s${f}]*`,"gm"),m=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!m)return null;const O=a.pos-m.length,b=Array.from(m.matchAll(p)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const y=b.input.slice(Math.max(0,b.index-1),b.index),S=new RegExp(`^[${s?.join("")}\0]?$`).test(y);if(s!==null&&!S)return null;const x=O+b.index;let k=x+b[0].length;return l&&d.test(m.slice(k-1,k+1))&&(b[0]+=" ",k+=1),x<a.pos&&k>=a.pos?{range:{from:x,to:k},query:b[0].slice(t.length),text:b[0]}:null}function tz(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const r=t.content.textBetween(0,t.content.size,`
214
- `);return/\s/.test(r)}):!1}function nz(n){return()=>{const e=n.state.selection.$anchor.pos,{top:t,right:r,bottom:i,left:s}=n.view.coordsAtPos(e);try{return new DOMRect(s,t,r-s,i-t)}catch{return null}}}function rz(n,e,t,r){return t?()=>{const i=r.getState(n.state),s=i?.decorationId,o=e.dom.querySelector(`[data-decoration-id="${s}"]`);return o?.getBoundingClientRect()||null}:nz(n)}function iz({match:n,dismissedRange:e,state:t,transaction:r,editor:i,shouldResetDismissed:s,effectiveAllowSpaces:o}){return s?.({editor:i,state:t,range:e,match:n,transaction:r,allowSpaces:o})?!1:o?n.range.from===e.from:n.range.from===e.from&&!tz(r)}function sz({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function oz({pluginKey:n,decorationTag:e,decorationClass:t,decorationContent:r,decorationEmptyClass:i,renderer:s,dispatchExit:o}){return{handleKeyDown(a,l){var c;const d=n.getState(a.state);if(!d.active)return!1;if(l.key==="Escape"||l.key==="Esc"){var h;return s==null||(h=s.onKeyDown)===null||h===void 0||h.call(s,{view:a,event:l,range:d.range}),o(a),!0}return(s==null||(c=s.onKeyDown)===null||c===void 0?void 0:c.call(s,{view:a,event:l,range:d.range}))||!1},decorations(a){const{active:l,range:c,decorationId:d,query:h}=n.getState(a);if(!l)return null;const f=!h?.length,p=[t];return f&&p.push(i),be.create(a.doc,[Dt.inline(c.from,c.to,{nodeName:e,class:p.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":r})])}}}function az({editor:n,char:e,effectiveAllowSpaces:t,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,findSuggestionMatch:o,allow:a,shouldShow:l,shouldKeepDismissed:c,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(h,f,p,m){const{isEditable:O}=n,{composing:b}=n.view,{selection:y}=h,{empty:S,from:x}=y,k={...f},v=h.getMeta(d);if(v&&v.exit)return k.active=!1,k.decorationId=null,k.range={from:0,to:0},k.query=null,k.text=null,k.dismissedRange=f.active?{...f.range}:f.dismissedRange,k;if(k.composing=b,h.docChanged&&k.dismissedRange!==null&&(k.dismissedRange={from:h.mapping.map(k.dismissedRange.from),to:h.mapping.map(k.dismissedRange.to)}),O&&(S||n.view.composing)){(x<f.range.from||x>f.range.to)&&!b&&!f.composing&&(k.active=!1);const w=o({char:e,allowSpaces:t,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:y.$from}),Q=`id_${Math.floor(Math.random()*4294967295)}`;w&&a({editor:n,state:m,range:w.range,isActive:f.active})&&(!l||l({editor:n,range:w.range,query:w.query,text:w.text,transaction:h}))?(k.dismissedRange!==null&&!c({match:w,dismissedRange:k.dismissedRange,state:m,transaction:h})&&(k.dismissedRange=null),k.dismissedRange===null?(k.active=!0,k.decorationId=f.decorationId||Q,k.range=w.range,k.query=w.query,k.text=w.text):k.active=!1):(w||(k.dismissedRange=null),k.active=!1)}else k.active=!1;return k.active||(k.decorationId=null,k.range={from:0,to:0},k.query=null,k.text=null),k}}}function lz({editor:n,items:e}){let t=null,r=null,i=null;const s=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=c=>new Promise(d=>{i=d,r=setTimeout(()=>{r=null;const h=i;i=null,h?.()},c)}),a=()=>{t?.abort(),s(),t=null};return{abort:a,fetch:async(c,d)=>{a(),t=new AbortController;const h=t;if(d>0&&await o(d),t!==h||h.signal.aborted)return{status:"aborted"};try{const f=await e({editor:n,query:c,signal:h.signal});return t!==h||h.signal.aborted?{status:"aborted"}:{status:"resolved",items:f}}catch{return t!==h||h.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function cz({placement:n,offset:e,flip:t,floatingUi:r}){var i,s,o,a;const l=[_$({mainAxis:(i=e.mainAxis)!==null&&i!==void 0?i:4,crossAxis:(s=e.crossAxis)!==null&&s!==void 0?s:0})];return t&&l.push(B$()),!(r==null||(o=r.middleware)===null||o===void 0)&&o.length&&l.push(...r.middleware),{placement:n,strategy:(a=r?.strategy)!==null&&a!==void 0?a:"absolute",middleware:l}}function uz(n){if(n instanceof HTMLElement)return n;if(typeof n=="string")try{const e=document.querySelector(n);if(e)return e}catch{return document.body}return document.body}function dz({getReferenceRect:n,contextElement:e,config:t,container:r,dismissOnOutsideClick:i,dismiss:s}){return(o,a={})=>{const l={getBoundingClientRect:()=>{var m;return(m=n())!==null&&m!==void 0?m:new DOMRect},contextElement:e};let c=!1;const d=!o.isConnected;d&&uz(r).appendChild(o),a.onPosition||(o.style.visibility="hidden",o.style.width="max-content");const f=W$(l,o,()=>{z$(l,o,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:m,y:O,placement:b,strategy:y})=>{if(a.onPosition){a.onPosition({x:m,y:O,placement:b,strategy:y});return}Object.assign(o.style,{position:y,left:`${m}px`,top:`${O}px`}),c||(c=!0,o.style.visibility="")})},a.autoUpdate);let p;return i&&(p=m=>{const O=m.target;!(O instanceof Node)||o.contains(O)||e.contains(O)||s()},document.addEventListener("pointerdown",p,!0)),()=>{f(),p&&document.removeEventListener("pointerdown",p,!0),d&&o.remove()}}}function hz({editor:n,pluginKey:e,items:t,renderer:r,minQueryLength:i,debounce:s,initialItems:o,placement:a,offset:l,container:c,flip:d,floatingUi:h,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:O}){let b;const y=lz({editor:n,items:t}),S=cz({placement:a,offset:l,flip:d,floatingUi:h});function x(k,v){switch(k){case"started":var w;r==null||(w=r.onStart)===null||w===void 0||w.call(r,v);break;case"updated":var Q;r==null||(Q=r.onUpdate)===null||Q===void 0||Q.call(r,v);break;case"stopped":var C;r==null||(C=r.onExit)===null||C===void 0||C.call(r,v)}}return{update:async(k,v)=>{var w,Q;const C=e.getState(v),T=e.getState(k.state);if(!C||!T)return;let P=null;const R=C.query!==T.query,M=C.text!==T.text,D=C.range.from!==T.range.from||C.range.to!==T.range.to,N=R||M||D;if(!C.active&&T.active)P="started";else if(C.active&&!T.active)P="stopped";else if(T.active&&N)P="updated";else return;const I=P==="stopped"?C:T,Z=k.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`),ne=m(k,Z),le=i===0||(I.query?I.query.length>=i:!1),B=(P==="started"||P==="updated")&&le;if(b={editor:n,range:I.range,query:I.query||"",text:I.text||"",items:o??[],command:me=>p({editor:n,range:I.range,props:me}),decorationNode:Z,clientRect:ne,loading:B,placement:a,offset:{mainAxis:(w=l.mainAxis)!==null&&w!==void 0?w:4,crossAxis:(Q=l.crossAxis)!==null&&Q!==void 0?Q:0},container:c,flip:d,floatingUi:S,mount:dz({getReferenceRect:ne,contextElement:k.dom,config:S,container:c,dismissOnOutsideClick:f,dismiss:()=>O(n.view)})},P==="started"){var se;r==null||(se=r.onBeforeStart)===null||se===void 0||se.call(r,b)}if(P==="updated"){var re;r==null||(re=r.onBeforeUpdate)===null||re===void 0||re.call(r,b)}if(P==="started"&&x(P,b),P==="started"||P==="updated")if(!B)y.abort(),b={...b,items:o??[],loading:!1};else{b={...b,items:o??[],loading:!0},P="updated",x(P,b);const me=await y.fetch(I.query||"",s);if(me.status==="aborted")return;const $e=e.getState(k.state);if(!$e?.active){y.abort();return}b=me.status==="resolved"?{...b,items:me.items,loading:!1}:{...b,loading:!1}}if(P==="stopped"){y.abort(),x(P,b),b=void 0;return}P==="updated"&&x(P,b)},destroy:()=>{var k;y.abort(),b&&(r==null||(k=r.onExit)===null||k===void 0||k.call(r,b))}}}const fz=new st("suggestion");function pz({pluginKey:n=fz,editor:e,char:t="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:o=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:h=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:O,placement:b="bottom-start",offset:y={},container:S,flip:x=!0,floatingUi:k,dismissOnOutsideClick:v=!0,render:w=()=>({}),allow:Q=()=>!0,findSuggestionMatch:C=ez,shouldShow:T,shouldResetDismissed:P}){const R=w?.(),M=r&&!i,D=(Z,ne)=>rz(e,Z,ne,n);function N(Z){return iz({...Z,editor:e,shouldResetDismissed:P,effectiveAllowSpaces:M})}const I=Z=>sz({view:Z,pluginKeyRef:n});return new Ze({key:n,view:()=>hz({editor:e,pluginKey:n,items:f,renderer:R,minQueryLength:p,debounce:m,initialItems:O,placement:b,offset:y,container:S,flip:x,floatingUi:k,dismissOnOutsideClick:v,command:h,clientRectFor:D,dispatchExit:I}),state:az({editor:e,char:t,effectiveAllowSpaces:M,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:o,findSuggestionMatch:C,allow:Q,shouldShow:T,shouldKeepDismissed:N,pluginKey:n}),props:oz({pluginKey:n,decorationTag:a,decorationClass:l,decorationContent:c,decorationEmptyClass:d,renderer:R,dispatchExit:I})})}function mz({editor:n,overrideSuggestionOptions:e,extensionName:t,char:r="@"}){return{editor:n,char:r,pluginKey:new st,command:({editor:i,range:s,props:o})=>{var a,l;const c=i.view.state.selection.$to.nodeAfter;!(c==null||(a=c.text)===null||a===void 0)&&a.startsWith(" ")&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:t,attrs:{...o,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(l=i.view.dom.ownerDocument.defaultView)===null||l===void 0||(l=l.getSelection())===null||l===void 0||l.collapseToEnd()},allow:({state:i,range:s})=>{const o=i.doc.resolve(s.from),a=i.schema.nodes[t];return!!o.parent.type.contentMatch.matchType(a)},...e}}function TQ(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>mz({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function gy(n,e){const t=TQ(n),r=t.find(i=>i.char===e);return r||(t.length?t[0]:null)}const gz=rn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,r;return`${(t=e?.char)!==null&&t!==void 0?t:"@"}${(r=n.attrs.label)!==null&&r!==void 0?r:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var r,i;return["span",He(this.HTMLAttributes,n.HTMLAttributes),`${(r=t?.char)!==null&&r!==void 0?r:"@"}${(i=e.attrs.label)!==null&&i!==void 0?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=gy(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",He({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const r={...this.options};r.HTMLAttributes=He({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:r,node:n,suggestion:t});return typeof i=="string"?["span",He({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...TB({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(?:^|\s)(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,s,o]=r;e[i==="char"?"mentionSuggestionChar":i]=s??o,r=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:gy(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:i,anchor:s}=r;if(!i)return!1;let o=new oi,a=0;return e.doc.nodesBetween(s-1,s,(l,c)=>{if(l.type.name===this.name)return t=!0,o=l,a=c,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,a,a+o.nodeSize),t})}},addProseMirrorPlugins(){return TQ(this).map(pz)}});var Oz=gz;function bz(n={}){return new Ze({view(e){return new yz(e,n)}})}class yz{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let h=e.nodeBefore,f=e.nodeAfter;if(h||f){let p=this.editorView.nodeDOM(this.cursorPos-(h?h.nodeSize:0));if(p){let m=p.getBoundingClientRect(),O=h?m.bottom:m.top;h&&f&&(O=(O+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*a;r={left:m.left,right:m.right,top:O-b,bottom:O+b}}}}if(!r){let h=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:h.left-f,right:h.left+f,top:h.top,bottom:h.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let h=l.getBoundingClientRect(),f=h.width/l.offsetWidth,p=h.height/l.offsetHeight;c=h.left-l.scrollLeft*f,d=h.top-l.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(!t||s)return null;let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=_w(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class nt extends ue{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return nt.valid(r)?new nt(r):ue.near(r)}content(){return z.empty}eq(e){return e instanceof nt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new nt(e.resolve(t.pos))}getBookmark(){return new $g(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!xz(e)||!Sz(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&nt.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(nt.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!J.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(nt.valid(a))return a}return null}}}nt.prototype.visible=!1;nt.findFrom=nt.findGapCursorFrom;ue.jsonID("gapcursor",nt);class $g{constructor(e){this.pos=e}map(e){return new $g(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return nt.valid(t)?new nt(t):ue.near(t)}}function MQ(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function xz(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||MQ(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Sz(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||MQ(i.type))return!0;if(i.inlineContent)return!1}}return!0}function kz(){return new Ze({props:{decorations:$z,createSelectionBetween(n,e,t){return e.pos==t.pos&&nt.valid(t)?new nt(t):null},handleClick:wz,handleKeyDown:vz,handleDOMEvents:{beforeinput:Qz}}})}const vz=Z2({ArrowLeft:Jl("horiz",-1),ArrowRight:Jl("horiz",1),ArrowUp:Jl("vert",-1),ArrowDown:Jl("vert",1)});function Jl(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof ee){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=nt.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new nt(c))),!0):!1}}function wz(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!nt.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&J.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new nt(r))),!0)}function Qz(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof nt))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=E.empty;for(let o=r.length-1;o>=0;o--)i=E.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new z(i,0,0));return s.setSelection(ee.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function $z(n){if(!(n.selection instanceof nt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",be.create(n.doc,[Dt.widget(n.selection.head,e,{key:"gapcursor"})])}var xu=200,yt=function(){};yt.prototype.append=function(e){return e.length?(e=yt.from(e),!this.length&&e||e.length<xu&&this.leafAppend(e)||this.length<xu&&e.leafPrepend(this)||this.appendInner(e)):this};yt.prototype.prepend=function(e){return e.length?yt.from(e).append(this):this};yt.prototype.appendInner=function(e){return new Cz(this,e)};yt.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?yt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};yt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};yt.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};yt.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};yt.from=function(e){return e instanceof yt?e:e&&e.length?new AQ(e):yt.empty};var AQ=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=xu)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=xu)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(yt);yt.empty=new AQ([]);var Cz=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(yt);const Pz=500;class In{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((h,f)=>{if(!h.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,d.push(h);return}if(i){d.push(new Jn(h.map));let p=h.step.map(i.slice(s)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new Jn(m,void 0,void 0,c.length+d.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(h.step);if(h.selection)return a=i?h.selection.map(i.slice(s)):h.selection,l=new In(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let h=e.steps[d].invert(e.docs[d]),f=new Jn(e.mapping.maps[d],h,t),p;(p=l&&l.merge(f))&&(f=p,d?s.pop():a=a.slice(0,a.length-1)),s.push(f),t&&(o++,t=void 0),i||(l=f)}let c=o-r.depth;return c>Mz&&(a=Tz(a,c),o-=c),new In(a.append(s),o)}remapping(e,t){let r=new Za;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new In(this.items.append(e.map(t=>new Jn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;t=Math.min(this.items.length,t);let r=[],i=this.items.length-t,s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let p=s.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=s.maps[p];if(f.step){let O=e.steps[p].invert(e.docs[p]),b=f.selection&&f.selection.map(s.slice(l+1,p));b&&a++,r.push(new Jn(m,O,b))}else r.push(new Jn(m))},i);let c=[];for(let f=t;f<o;f++)c.push(new Jn(s.maps[f]));let d=this.items.slice(0,i).append(c).append(r),h=new In(d,a);return h.emptyItemCount()>Pz&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let h=new Jn(c.invert(),l,d),f,p=i.length-1;(f=i.length&&i[p].merge(h))?i[p]=f:i.push(h)}}else o.map&&r--},this.items.length,0),new In(yt.from(i.reverse()),s)}}In.empty=new In(yt.empty,0);function Tz(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Jn{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Jn(t.getMap().invert(),t,this.selection)}}}class Kr{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Mz=20;function Az(n,e,t,r){let i=t.getMeta(Ui),s;if(i)return i.historyState;t.getMeta(Nz)&&(n=new Kr(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Ui))return o.getMeta(Ui).redo?new Kr(n.done.addTransform(t,void 0,r,Pc(e)),n.undone,Oy(t.mapping.maps),n.prevTime,n.prevComposition):new Kr(n.done,n.undone.addTransform(t,void 0,r,Pc(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Rz(t,n.prevRanges)),c=o?Zh(n.prevRanges,t.mapping):Oy(t.mapping.maps);return new Kr(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,Pc(e)),In.empty,c,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Kr(n.done.rebased(t,s),n.undone.rebased(t,s),Zh(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Kr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Zh(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Rz(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Oy(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Zh(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function Ez(n,e,t){let r=Pc(e),i=Ui.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Kr(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Ui,{redo:t,historyState:l})}let Fh=!1,by=null;function Pc(n){let e=n.plugins;if(by!=e){Fh=!1,by=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Fh=!0;break}}return Fh}const Ui=new st("history"),Nz=new st("closeHistory");function Dz(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ze({key:Ui,state:{init(){return new Kr(In.empty,In.empty,null,0,-1)},apply(e,t,r){return Az(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?EQ:r=="historyRedo"?NQ:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function RQ(n,e){return(t,r)=>{let i=Ui.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=Ez(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const EQ=RQ(!1,!0),NQ=RQ(!0,!0);ot.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Ze({key:new st("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const a=o-i,l=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,a=o-(s-r),l=o;return e.deleteRange(a,l),!(this.storage.characters({node:e.doc})>r)}})]}});const jz=ot.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[bz(this.options)]}});ot.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ze({key:new st("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return be.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(!l.isText){if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1}});let a=0;return n.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Dt.node(c,c+l.nodeSize,{class:this.options.className}))}),be.create(n,s)}}})]}});const Iz=ot.create({name:"gapCursor",addProseMirrorPlugins(){return[kz()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Se(q(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),DQ="placeholder",yy=new st("tiptap__placeholder");function jQ(n){const{editor:e,placeholder:t,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=n,d=[l];return o&&d.push(c),Dt.node(i,i+s.nodeSize,{class:d.join(" "),[r]:typeof t=="function"?t({editor:e,node:s,pos:i,hasAnchor:a}):t})}function IQ(n,e){return typeof n=="function"?n(e):n}function XQ({editor:n,options:e,dataAttribute:t,doc:r,selection:i,from:s,to:o}){const{anchor:a}=i,l=[],c=n.isEmpty;return r.nodesBetween(s,o,(d,h)=>{const f=a>=h&&a<=h+d.nodeSize,p=!d.isLeaf&&gl(d);return d.type.isTextblock&&(f||!e.showOnlyCurrent)&&p&&l.push(jQ({editor:n,isEmptyDoc:c,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:IQ(e.emptyNodeClass,{editor:n,node:d,pos:h,hasAnchor:f})},node:d,pos:h})),e.includeChildren}),l}function LQ({editor:n,options:e,dataAttribute:t,doc:r,selection:i}){if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:s}=i,o=[],a=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const l=r.resolve(s),c=l.depth>0?l.node(1):l.nodeAfter,d=l.depth>0?l.before(1):s;if(c&&c.type.isTextblock&&gl(c)){const h=s>=d&&s<=d+c.nodeSize;o.push(jQ({editor:n,isEmptyDoc:a,dataAttribute:t,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:IQ(e.emptyNodeClass,{editor:n,node:c,pos:d,hasAnchor:h})},node:c,pos:d}))}}else o.push(...XQ({editor:n,options:e,dataAttribute:t,doc:r,selection:i,from:0,to:r.content.size}));return be.create(r,o)}function la(n,e){const t=n.resolve(e);if(t.depth===0){var r;const s=(r=t.nodeAfter)!==null&&r!==void 0?r:t.nodeBefore;if(!s)return{from:e,to:e};const o=t.nodeAfter?e:e-s.nodeSize;return{from:o,to:o+s.nodeSize}}const i=t.before(1);return{from:i,to:i+t.node(1).nodeSize}}function ca(n,e){return{from:Math.max(0,e.from-1),to:Math.min(n.content.size,e.to-1)}}function Xz(n,e,t){const r=[];return n.forEach((i,s)=>{const o=s,a=o+i.nodeSize,l=o+1,c=a+1;l<t&&c>e&&r.push({from:o,to:a})}),r}function Lz(n){if(n.length===0)return[];const e=[...n].sort((r,i)=>r.from-i.from),t=[{...e[0]}];for(let r=1;r<e.length;r+=1){const i=t[t.length-1],s=e[r];s.from<=i.to?i.to=Math.max(i.to,s.to):t.push({...s})}return t}function _z(n,e){const t=Xz(n,e.from,e.to);return t.push(ca(n,la(n,e.from))),e.to>e.from?t.push(ca(n,la(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(ca(n,la(n,Math.min(e.from+1,n.content.size)))),t}function Bz(n,e,t){const r=[];if(n.docChanged){const i=Pd(n);for(const s of i)r.push(..._z(t.doc,s.newRange))}return n.selectionSet&&(r.push(ca(t.doc,la(t.doc,n.mapping.map(e.selection.anchor)))),r.push(ca(t.doc,la(t.doc,t.selection.anchor)))),Lz(r)}function Wz(n,e,t){const r=Math.max(0,Math.min(n,t.content.size));return{from:r,to:Math.max(r,Math.min(e,t.content.size))}}function zz({decorations:n,ranges:e,editor:t,options:r,dataAttribute:i,doc:s,selection:o}){let a=n;for(const l of e){const{from:c,to:d}=Wz(l.from,l.to,s),h=a.find(c,d).filter(p=>p.from>=c&&p.to<=d);h.length&&(a=a.remove(h));const f=XQ({editor:t,options:r,dataAttribute:i,doc:s,selection:o,from:c,to:d});f.length&&(a=a.add(s,f))}return a}function Zz({editor:n,options:e,dataAttribute:t}){return{init(r,i){const s=LQ({editor:n,options:e,dataAttribute:t,doc:i.doc,selection:i.selection});return s??be.empty},apply(r,i,s,o){return!r.docChanged&&!r.selectionSet?i:zz({decorations:i.map(r.mapping,r.doc),ranges:Bz(r,s,o),editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection})}}}function Fz(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Vz({editor:n,options:e}){const t=e.dataAttribute?`data-${Fz(e.dataAttribute)}`:`data-${DQ}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Ze({key:yy,...r?{}:{state:Zz({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:i,selection:s})=>LQ({editor:n,options:e,dataAttribute:t,doc:i,selection:s}):i=>{var s;return e.showOnlyWhenEditable&&!n.isEditable?be.empty:(s=yy.getState(i))!==null&&s!==void 0?s:be.empty}}})}const Yz=ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:DQ,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Vz({editor:this.editor,options:this.options})]}});function Ep(n,e){return!n.selection.empty&&!lQ(n.selection)&&e.isEditable}function qz(n,e){return Ep(n,e)&&!e.isFocused&&!e.view.dragging}function Uz(){var n;(n=window.getSelection())===null||n===void 0||n.removeAllRanges()}function Gz(n){n.focus()}ot.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Ze({key:new st("selection"),props:{decorations(t){return qz(t,n)?be.create(t.doc,[Dt.inline(t.selection.from,t.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(t){return Ep(t.state,n)&&Uz(),!1},focus(t){return Ep(t.state,n)&&requestAnimationFrame(()=>{!n.isDestroyed&&t.hasFocus()&&Gz(t)}),!1}}}})]}});function xy({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}const Hz=ot.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new st(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)===null||n===void 0?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Ze({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,d=e.getState(o),h=a.content.size,f=c.nodes[t];if(!i.some(p=>p.getMeta("skipTrailingNode"))&&d)return l.insert(h,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!xy({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!xy({node:o,types:r})}}})]}}),Kz=ot.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>EQ(n,e),redo:()=>({state:n,dispatch:e})=>NQ(n,e)}},addProseMirrorPlugins(){return[Dz(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()}}});var Jz=Yz;const _Q=new WeakSet,BQ=new WeakSet;function Pi(n){const e=n;return _Q.add(e),e}function Np(n){return Array.isArray(n)&&_Q.has(n)}function WQ(n){return n.flatMap(e=>e==null?[]:Array.isArray(e)&&BQ.has(e)&&!Np(e)?WQ(e):[e])}function eZ(n,e){if(n==="slot")return 0;if(n instanceof Function){const i=n(e);return Array.isArray(i)&&!Np(i)&&!BQ.has(i)?Pi(i):i}const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(t)){if(Np(t))return Pi([n,r,t]);if(t.length===0)return Pi([n,r]);const i=WQ(t);return i.length===0?Pi([n,r]):Pi([n,r,...i])}return t!=null?Pi([n,r,t]):Pi([n,r])}const Su=(n,e)=>eZ(n,e),tZ=(n,e)=>{var t;const{state:r}=n,{selection:i}=r;if(!i.empty)return!1;const{$from:s}=i;if(s.parentOffset!==0)return!1;const o=s.depth-1;if(o<0)return!1;const a=s.node(o),l=s.index(o);if(l===0)return!1;if(a.type===e)return n.commands.lift(e.name);const c=a.child(l-1);if(c.type!==e||!(!((t=c.lastChild)===null||t===void 0)&&t.isTextblock))return!1;const d=s.before()-1-1;return n.commands.command(({tr:h,dispatch:f})=>{if(!f)return!0;const p=s.parent.content,m=new z(p,0,0);return h.replace(d,s.after(),m),h.setSelection(ee.create(h.doc,d+p.size)),h.scrollIntoView(),f(h),!0})},nZ=/^\s*>\s$/,rZ=rn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Su("blockquote",{...He(this.options.HTMLAttributes,n),children:Su("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((i,s)=>{var o,a;const l=((o=(a=e.renderChild)===null||a===void 0?void 0:a.call(e,i,s))!==null&&o!==void 0?o:e.renderChildren([i])).split(`
215
- `).map(c=>c.trim()===""?t:`${t} ${c}`);r.push(l.join(`
216
- `))}),r.join(`
217
- ${t}
218
- `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>tZ(this.editor,this.type)}},addInputRules(){return[ao({find:nZ,type:this.type})]}}),iZ=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,sZ=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,oZ=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,aZ=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,lZ=ds.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Su("strong",{...He(this.options.HTMLAttributes,n),children:Su("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[cs({find:iZ,type:this.type}),cs({find:oZ,type:this.type})]},addPasteRules(){return[yi({find:sZ,type:this.type}),yi({find:aZ,type:this.type})]}}),cZ=n=>{const e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},uZ=n=>{const e=/`([^`]+)`(?!`)/g,t=[];let r;for(;(r=e.exec(n))!==null;)r.index>0&&n[r.index-1]==="`"||t.push({index:r.index,text:r[0],replaceWith:r[1]});return t},dZ=ds.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",He(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[cs({find:cZ,type:this.type})]},addPasteRules(){return[yi({find:uZ,type:this.type})]}}),Vh=4,hZ=/^```([a-z]+)?[\s\n]$/,fZ=/^~~~([a-z]+)?[\s\n]$/,pZ=rn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Vh,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const r=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(t)).map(i=>i.replace(t,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",He(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t,r;return((t=n.raw)===null||t===void 0?void 0:t.startsWith("```"))===!1&&((r=n.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)===null||t===void 0?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`
219
- `):r=`\`\`\`${i}
220
-
221
- \`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!==null&&e!==void 0?e:Vh,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:l})=>{const{from:c,to:d}=i,h=r.doc.textBetween(c,d,`
222
- `,`
223
- `).split(`
224
- `).map(f=>a+f).join(`
225
- `);return l.replaceWith(c,d,r.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!==null&&e!==void 0?e:Vh,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var l;const{pos:c}=s,d=s.start(),h=s.end(),f=r.doc.textBetween(d,h,`
226
- `,`
227
- `).split(`
228
- `);let p=0,m=0;const O=c-d;for(let x=0;x<f.length;x+=1){if(m+f[x].length>=O){p=x;break}m+=f[x].length+1}const b=((l=f[p].match(/^ */))===null||l===void 0?void 0:l[0])||"",y=Math.min(b.length,t);if(y===0)return!0;let S=d;for(let x=0;x<p;x+=1)S+=f[x].length+1;return a.delete(S,S+y),c-S<=y&&a.setSelection(ee.create(a.doc,S)),!0}):n.commands.command(({tr:a})=>{const{from:l,to:c}=i,d=r.doc.textBetween(l,c,`
229
- `,`
230
- `).split(`
231
- `).map(h=>{var f;const p=((f=h.match(/^ */))===null||f===void 0?void 0:f[0])||"",m=Math.min(p.length,t);return h.slice(m)}).join(`
232
- `);return a.replaceWith(l,c,r.schema.text(d)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
233
-
234
- `);return!s||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:n})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;const s=r.before();return s>0?!1:n.commands.insertDefaultBlock({pos:s})},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const o=i.after();return o===void 0?!1:r.nodeAt(o)?n.commands.command(({tr:a})=>(a.setSelection(ue.near(r.resolve(o))),!0)):n.commands.exitCode()}}},addInputRules(){return[Rp({find:hZ,type:this.type,getAttributes:n=>({language:n[1]})}),Rp({find:fZ,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Ze({key:new st("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,`
235
- `));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(ee.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),mZ=rn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
236
-
237
- `):""}),gZ=rn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",He(this.options.HTMLAttributes,n)]},renderText(){return`
238
- `},renderMarkdown:()=>`
239
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&o){const h=l.filter(f=>a.includes(f.type.name));c.ensureMarks(h)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),OZ=rn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,He(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=!((t=n.attrs)===null||t===void 0)&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Rp({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),bZ=rn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",He(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!mB(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return lQ(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(ee.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(J.create(o.doc,l.pos)):o.setSelection(ee.create(o.doc,l.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,h=d?.create();h&&(o.insert(c,h),o.setSelection(ee.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[KB({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),yZ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,xZ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,SZ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,kZ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,vZ=ds.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[cs({find:yZ,type:this.type}),cs({find:SZ,type:this.type})]},addPasteRules(){return[yi({find:xZ,type:this.type}),yi({find:kZ,type:this.type})]}}),wZ="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",QZ="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Dp="numeric",jp="ascii",Ip="alpha",ua="asciinumeric",Vo="alphanumeric",Xp="domain",zQ="emoji",$Z="scheme",CZ="slashscheme",Yh="whitespace";function PZ(n,e){return n in e||(e[n]=[]),e[n]}function Li(n,e,t){e[Dp]&&(e[ua]=!0,e[Vo]=!0),e[jp]&&(e[ua]=!0,e[Ip]=!0),e[ua]&&(e[Vo]=!0),e[Ip]&&(e[Vo]=!0),e[Vo]&&(e[Xp]=!0),e[zQ]&&(e[Xp]=!0);for(const r in e){const i=PZ(r,t);i.indexOf(n)<0&&i.push(n)}}function TZ(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ut(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Ut.groups={};Ut.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||Ut.groups;let i;return e&&e.j?i=e:(i=new Ut(e),t&&r&&Li(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||Ut.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,a=i.go(n);if(a?(o=new Ut,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Ut,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(TZ(o.t,r),t);Li(s,l,r)}else t&&Li(s,t,r);o.t=s}return i.j[n]=o,o}};const he=(n,e,t,r,i)=>n.ta(e,t,r,i),tt=(n,e,t,r,i)=>n.tr(e,t,r,i),Sy=(n,e,t,r,i)=>n.ts(e,t,r,i),j=(n,e,t,r,i)=>n.tt(e,t,r,i),wr="WORD",Lp="UWORD",ZQ="ASCIINUMERICAL",FQ="ALPHANUMERICAL",Ga="LOCALHOST",_p="TLD",Bp="UTLD",Tc="SCHEME",$s="SLASH_SCHEME",Cg="NUM",Wp="WS",Pg="NL",da="OPENBRACE",ha="CLOSEBRACE",ku="OPENBRACKET",vu="CLOSEBRACKET",wu="OPENPAREN",Qu="CLOSEPAREN",$u="OPENANGLEBRACKET",Cu="CLOSEANGLEBRACKET",Pu="FULLWIDTHLEFTPAREN",Tu="FULLWIDTHRIGHTPAREN",Mu="LEFTCORNERBRACKET",Au="RIGHTCORNERBRACKET",Ru="LEFTWHITECORNERBRACKET",Eu="RIGHTWHITECORNERBRACKET",Nu="FULLWIDTHLESSTHAN",Du="FULLWIDTHGREATERTHAN",ju="AMPERSAND",Iu="APOSTROPHE",Xu="ASTERISK",Jr="AT",Lu="BACKSLASH",_u="BACKTICK",Bu="CARET",_i="COLON",Tg="COMMA",Wu="DOLLAR",er="DOT",zu="EQUALS",Mg="EXCLAMATION",Sn="HYPHEN",fa="PERCENT",Zu="PIPE",Fu="PLUS",Vu="POUND",pa="QUERY",Ag="QUOTE",VQ="FULLWIDTHMIDDLEDOT",Rg="SEMI",tr="SLASH",ma="TILDE",Yu="UNDERSCORE",YQ="EMOJI",qu="SYM";var qQ=Object.freeze({__proto__:null,ALPHANUMERICAL:FQ,AMPERSAND:ju,APOSTROPHE:Iu,ASCIINUMERICAL:ZQ,ASTERISK:Xu,AT:Jr,BACKSLASH:Lu,BACKTICK:_u,CARET:Bu,CLOSEANGLEBRACKET:Cu,CLOSEBRACE:ha,CLOSEBRACKET:vu,CLOSEPAREN:Qu,COLON:_i,COMMA:Tg,DOLLAR:Wu,DOT:er,EMOJI:YQ,EQUALS:zu,EXCLAMATION:Mg,FULLWIDTHGREATERTHAN:Du,FULLWIDTHLEFTPAREN:Pu,FULLWIDTHLESSTHAN:Nu,FULLWIDTHMIDDLEDOT:VQ,FULLWIDTHRIGHTPAREN:Tu,HYPHEN:Sn,LEFTCORNERBRACKET:Mu,LEFTWHITECORNERBRACKET:Ru,LOCALHOST:Ga,NL:Pg,NUM:Cg,OPENANGLEBRACKET:$u,OPENBRACE:da,OPENBRACKET:ku,OPENPAREN:wu,PERCENT:fa,PIPE:Zu,PLUS:Fu,POUND:Vu,QUERY:pa,QUOTE:Ag,RIGHTCORNERBRACKET:Au,RIGHTWHITECORNERBRACKET:Eu,SCHEME:Tc,SEMI:Rg,SLASH:tr,SLASH_SCHEME:$s,SYM:qu,TILDE:ma,TLD:_p,UNDERSCORE:Yu,UTLD:Bp,UWORD:Lp,WORD:wr,WS:Wp});const Sr=/[a-z]/,Eo=/\p{L}/u,qh=/\p{Emoji}/u,kr=/\d/,Uh=/\s/,ky="\r",Gh=`
240
- `,MZ="️",AZ="‍",Hh="";let ec=null,tc=null;function RZ(n=[]){const e={};Ut.groups=e;const t=new Ut;ec==null&&(ec=vy(wZ)),tc==null&&(tc=vy(QZ)),j(t,"'",Iu),j(t,"{",da),j(t,"}",ha),j(t,"[",ku),j(t,"]",vu),j(t,"(",wu),j(t,")",Qu),j(t,"<",$u),j(t,">",Cu),j(t,"(",Pu),j(t,")",Tu),j(t,"「",Mu),j(t,"」",Au),j(t,"『",Ru),j(t,"』",Eu),j(t,"<",Nu),j(t,">",Du),j(t,"&",ju),j(t,"*",Xu),j(t,"@",Jr),j(t,"`",_u),j(t,"^",Bu),j(t,":",_i),j(t,",",Tg),j(t,"$",Wu),j(t,".",er),j(t,"=",zu),j(t,"!",Mg),j(t,"-",Sn),j(t,"%",fa),j(t,"|",Zu),j(t,"+",Fu),j(t,"#",Vu),j(t,"?",pa),j(t,'"',Ag),j(t,"/",tr),j(t,";",Rg),j(t,"~",ma),j(t,"_",Yu),j(t,"\\",Lu),j(t,"・",VQ);const r=tt(t,kr,Cg,{[Dp]:!0});tt(r,kr,r);const i=tt(r,Sr,ZQ,{[ua]:!0}),s=tt(r,Eo,FQ,{[Vo]:!0}),o=tt(t,Sr,wr,{[jp]:!0});tt(o,kr,i),tt(o,Sr,o),tt(i,kr,i),tt(i,Sr,i);const a=tt(t,Eo,Lp,{[Ip]:!0});tt(a,Sr),tt(a,kr,s),tt(a,Eo,a),tt(s,kr,s),tt(s,Sr),tt(s,Eo,s);const l=j(t,Gh,Pg,{[Yh]:!0}),c=j(t,ky,Wp,{[Yh]:!0}),d=tt(t,Uh,Wp,{[Yh]:!0});j(t,Hh,d),j(c,Gh,l),j(c,Hh,d),tt(c,Uh,d),j(d,ky),j(d,Gh),tt(d,Uh,d),j(d,Hh,d);const h=tt(t,qh,YQ,{[zQ]:!0});j(h,"#"),tt(h,qh,h),j(h,MZ,h);const f=j(h,AZ);j(f,"#"),tt(f,qh,h);const p=[[Sr,o],[kr,i]],m=[[Sr,null],[Eo,a],[kr,s]];for(let O=0;O<ec.length;O++)Vr(t,ec[O],_p,wr,p);for(let O=0;O<tc.length;O++)Vr(t,tc[O],Bp,Lp,m);Li(_p,{tld:!0,ascii:!0},e),Li(Bp,{utld:!0,alpha:!0},e),Vr(t,"file",Tc,wr,p),Vr(t,"mailto",Tc,wr,p),Vr(t,"http",$s,wr,p),Vr(t,"https",$s,wr,p),Vr(t,"ftp",$s,wr,p),Vr(t,"ftps",$s,wr,p),Li(Tc,{scheme:!0,ascii:!0},e),Li($s,{slashscheme:!0,ascii:!0},e),n=n.sort((O,b)=>O[0]>b[0]?1:-1);for(let O=0;O<n.length;O++){const b=n[O][0],S=n[O][1]?{[$Z]:!0}:{[CZ]:!0};b.indexOf("-")>=0?S[Xp]=!0:Sr.test(b)?kr.test(b)?S[ua]=!0:S[jp]=!0:S[Dp]=!0,Sy(t,b,b,S)}return Sy(t,"localhost",Ga,{ascii:!0}),t.jd=new Ut(qu),{start:t,tokens:Object.assign({groups:e},qQ)}}function UQ(n,e){const t=EZ(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let a=n,l=null,c=0,d=null,h=-1,f=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(h=0,f=0,d=a):h>=0&&(h+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=h,o-=f,c-=h,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function EZ(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function Vr(n,e,t,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?s=n.j[l]:(s=new Ut(r),s.jr=i.slice(),n.j[l]=s),n=s}return s=new Ut(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function vy(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Ha={defaultProtocol:"http",events:null,format:wy,formatHref:wy,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Eg(n,e=null){let t=Object.assign({},Ha);n&&(t=Object.assign(t,n instanceof Eg?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Eg.prototype={o:Ha,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Ha[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function wy(n){return n}function GQ(n,e){this.t="token",this.v=n,this.tk=e}GQ.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Ha.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),h=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:h}}};function Ad(n,e){class t extends GQ{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const NZ=Ad("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Qy=Ad("text"),DZ=Ad("nl"),nc=Ad("url",{isLink:!0,toHref(n=Ha.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ga&&n[1].t===_i}}),xn=n=>new Ut(n);function jZ({groups:n}){const e=n.domain.concat([ju,Xu,Jr,Lu,_u,Bu,Wu,zu,Sn,Cg,fa,Zu,Fu,Vu,tr,qu,ma,Yu]),t=[Iu,_i,Tg,er,Mg,fa,pa,Ag,Rg,$u,Cu,da,ha,vu,ku,wu,Qu,Pu,Tu,Mu,Au,Ru,Eu,Nu,Du],r=[ju,Iu,Xu,Lu,_u,Bu,Wu,zu,Sn,da,ha,fa,Zu,Fu,Vu,pa,tr,qu,ma,Yu],i=xn(),s=j(i,ma);he(s,r,s),he(s,n.domain,s);const o=xn(),a=xn(),l=xn();he(i,n.domain,o),he(i,n.scheme,a),he(i,n.slashscheme,l),he(o,r,s),he(o,n.domain,o);const c=j(o,Jr);j(s,Jr,c),j(a,Jr,c),j(l,Jr,c);const d=j(s,er);he(d,r,s),he(d,n.domain,s);const h=xn();he(c,n.domain,h),he(h,n.domain,h);const f=j(h,er);he(f,n.domain,h);const p=xn(NZ);he(f,n.tld,p),he(f,n.utld,p),j(c,Ga,p);const m=j(h,Sn);j(m,Sn,m),he(m,n.domain,h),he(p,n.domain,h),j(p,er,f),j(p,Sn,m);const O=j(o,Sn),b=j(o,er);j(O,Sn,O),he(O,n.domain,o),he(b,r,s),he(b,n.domain,o);const y=xn(nc);he(b,n.tld,y),he(b,n.utld,y),he(y,n.domain,o),he(y,r,s),j(y,er,b),j(y,Sn,O),j(y,Jr,c);const S=j(y,_i),x=xn(nc);he(S,n.numeric,x);const k=xn(nc),v=xn();he(k,e,k),he(k,t,v),he(v,e,k),he(v,t,v),j(y,tr,k),j(x,tr,k);const w=j(a,_i),Q=j(l,_i),C=j(Q,tr),T=j(C,tr);he(a,n.domain,o),j(a,er,b),j(a,Sn,O),he(l,n.domain,o),j(l,er,b),j(l,Sn,O),he(w,n.domain,k),j(w,tr,k),j(w,pa,k),he(T,n.domain,k),he(T,e,k),j(T,tr,k);const P=[[da,ha],[ku,vu],[wu,Qu],[$u,Cu],[Pu,Tu],[Mu,Au],[Ru,Eu],[Nu,Du]];for(let R=0;R<P.length;R++){const[M,D]=P[R],N=j(k,M);j(v,M,N);const I=xn(nc);he(N,e,I);const Z=xn();he(N,t,Z),j(N,D,k),he(I,e,I),he(I,t,Z),he(Z,e,I),he(Z,t,Z),j(I,D,k),j(Z,D,k)}return j(i,Ga,y),j(i,Pg,DZ),{start:i,tokens:qQ}}function IZ(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let a=n,l=null,c=null,d=0,h=null,f=-1;for(;i<r&&!(l=a.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=l||a.go(t[i].t));)l=null,a=c,a.accepts()?(f=0,h=a):f>=0&&f++,i++,d++;if(f<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Kh(Qy,e,o)),o=[]),i-=f,d-=f;const p=h.t,m=t.slice(i-d,i);s.push(Kh(p,e,m))}}return o.length>0&&s.push(Kh(Qy,e,o)),s}function Kh(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const XZ=typeof console<"u"&&console&&console.warn||(()=>{}),LZ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ye={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function _Z(){return Ut.groups={},Ye.scanner=null,Ye.parser=null,Ye.tokenQueue=[],Ye.pluginQueue=[],Ye.customSchemes=[],Ye.initialized=!1,Ye}function $y(n,e=!1){if(Ye.initialized&&XZ(`linkifyjs: already initialized - will not register custom scheme "${n}" ${LZ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
241
- 1. Must only contain digits, lowercase ASCII letters or "-"
242
- 2. Cannot start or end with "-"
243
- 3. "-" cannot repeat`);Ye.customSchemes.push([n,e])}function BZ(){Ye.scanner=RZ(Ye.customSchemes);for(let n=0;n<Ye.tokenQueue.length;n++)Ye.tokenQueue[n][1]({scanner:Ye.scanner});Ye.parser=jZ(Ye.scanner.tokens);for(let n=0;n<Ye.pluginQueue.length;n++)Ye.pluginQueue[n][1]({scanner:Ye.scanner,parser:Ye.parser});return Ye.initialized=!0,Ye}function Ng(n){return Ye.initialized||BZ(),IZ(Ye.parser.start,n,UQ(Ye.scanner.start,n))}Ng.scan=UQ;function HQ(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Eg(t),i=Ng(n),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}const Dg="[\0-   ᠎ -\u2029  ]",WZ=new RegExp(Dg),zZ=new RegExp(`${Dg}$`),ZZ=new RegExp(Dg,"g");function FZ(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function VZ(n){return new Ze({key:new st("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(l=>l.docChanged)&&!t.doc.eq(r.doc),s=e.some(l=>l.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=tQ(t.doc,[...e]);if(Pd(a).forEach(({newRange:l})=>{const c=h_(r.doc,l,f=>f.isTextblock);let d,h;if(c.length>1)d=c[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(l.from,l.to," "," ");if(!zZ.test(f))return;d=c[0],h=r.doc.textBetween(d.pos,l.to,void 0," ")}if(d&&h){const f=h.split(WZ).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const O=Ng(p).map(b=>b.toObject(n.defaultProtocol));if(!FZ(O))return!1;O.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Sg(b.from,b.to,r.doc).some(y=>y.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function YZ(n){return new Ze({key:new st("handleClickLink"),props:{handleClick:(e,t,r)=>{if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const l=r.target;if(!l)return!1;const c=n.editor.view.dom;i=l.closest("a"),i&&!c.contains(i)&&(i=null)}if(!i)return!1;let s=!1;if(n.enableClickSelection&&(s=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){var o,a;const l=aQ(e.state,n.type.name),c=(o=i.href)!==null&&o!==void 0?o:l.href,d=(a=i.target)!==null&&a!==void 0?a:l.target;c&&(window.open(c,d),s=!0)}return s}}})}const qZ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,UZ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function KQ(n,e){let t=0;for(let r=e-1;r>=0&&n[r]==="\\";r-=1)t+=1;return t%2===1}function GZ(n,e){let t=0,r=0;for(;r<e;){if(n[r]!=="`"){r+=1;continue}if(t===0&&KQ(n,r)){r+=1;continue}let i=0;for(;r<e&&n[r]==="`";)i+=1,r+=1;t===0?t=i:i===t&&(t=0)}return t>0}function JQ(n,e,t){var r,i;const[,s,o]=e;return(e.index?n[e.index-1]:void 0)==="!"||KQ(n,(r=e.index)!==null&&r!==void 0?r:0)||GZ(n,(i=e.index)!==null&&i!==void 0?i:0)?!1:!!s.trim()&&t(o)}function e$(n){var e,t;const[r,i,s,,o,a,l]=n,c=(e=o??a)!==null&&e!==void 0?e:l;return{index:(t=n.index)!==null&&t!==void 0?t:0,text:r,replaceWith:i,data:{href:s,title:c||null,markdown:!0}}}function HZ(n,e){return n.index<e.index+e.text.length&&e.index<n.index+n.text.length}function t$(n){var e,t,r;return{href:(e=n.data)===null||e===void 0?void 0:e.href,title:(t=(r=n.data)===null||r===void 0?void 0:r.title)!==null&&t!==void 0?t:null}}function KZ(n){const e=cs({find:t=>{const r=qZ.exec(t);return!r||!JQ(t,r,n.isAllowedHref)?null:e$(r)},type:n.type,getAttributes:t$});return new Ol({find:e.find,handler:t=>{const r=e.handler(t);return r!==null&&t.state.tr.steps.length&&t.state.tr.setMeta("preventAutolink",!0),r}})}function JZ(n){const e=yi({find:t=>{var r,i;const s=[];for(const a of t.matchAll(UZ))JQ(t,a,n.isAllowedHref)&&s.push(e$(a));const o=((r=(i=n.findPlainUrls)===null||i===void 0?void 0:i.call(n,t))!==null&&r!==void 0?r:[]).filter(a=>!s.some(l=>HZ(l,a)));return[...s,...o]},type:n.type,getAttributes:t$});return new xQ({find:e.find,handler:t=>{var r;const i=e.handler(t);return i!==null&&t.state.tr.steps.length&&(!((r=t.match.data)===null||r===void 0)&&r.markdown)&&t.state.tr.setMeta("preventAutolink",!0),i}})}function eF(n){return new Ze({key:new st("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=HQ(l,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||i!==void 0&&!i(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function vr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(ZZ,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const tF=ds.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){$y(n);return}$y(n.scheme,n.optionalSlashes)})},onDestroy(){_Z()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!vr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var n,e,t;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(n=this.options.HTMLAttributes.target)!==null&&n!==void 0?n:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(t=this.options.HTMLAttributes.class)!==null&&t!==void 0?t:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!vr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!vr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",He(this.options.HTMLAttributes,n),0]:["a",He(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,i,s;const o=(t=(r=n.attrs)===null||r===void 0?void 0:r.href)!==null&&t!==void 0?t:"",a=(i=(s=n.attrs)===null||s===void 0?void 0:s.title)!==null&&i!==void 0?i:"",l=e.renderChildren(n);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!vr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!vr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[KZ({type:this.type,isAllowedHref:n=>this.options.isAllowedUri(n,{defaultValidate:e=>!!vr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const n=e=>{const t=[];if(e){const{protocols:r,defaultProtocol:i}=this.options;HQ(e).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!vr(o,r),protocols:r,defaultProtocol:i})).forEach(s=>{this.options.shouldAutoLink(s.value)&&t.push({text:s.value,data:{href:s.href},index:s.start})})}return t};return this.options.markdownLinks?[JZ({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:t=>!!vr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:n})]:[yi({find:n,type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(VZ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!vr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(YZ({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(eF({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),nF="listItem",Cy="textStyle",Py=/^\s*([-+*])\s$/,n$=rn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",He(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
244
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(nF,this.editor.getAttributes(Cy)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=ao({find:Py,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ao({find:Py,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Cy),editor:this.editor})),[n]}}),rF=(n,e,t)=>{const{selection:r}=n;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let p=i.depth;p>0;p-=1)if(i.node(p).type.name===e){s=p;break}if(s<0)return null;const o=i.node(s),a=i.index(s);if(a+1>=o.childCount)return null;const l=o.child(a+1);if(!t.includes(l.type.name))return null;const c=n.schema.nodes[e];let d=!1;if(l.forEach(p=>{p.type===c&&p.childCount>1&&(d=!0)}),!d)return null;const h=n.doc.resolve(i.after()).nodeAfter;if(!h||!t.includes(h.type.name))return null;const f=[];return h.forEach(p=>{f.push(p)}),f.length===0?null:{listItemDepth:s,nestedList:h,nestedListPos:i.after(),insertPos:i.after(s),items:f}},iF=(n,e,t,r)=>{const i=rF(n,t,r);if(!i)return!1;const{selection:s}=n,{nestedList:o,nestedListPos:a,insertPos:l,items:c}=i,d=n.tr;d.delete(a,a+o.nodeSize);const h=d.mapping.map(l);return d.insert(h,E.from(c)),d.setSelection(s.map(d.doc,d.mapping)),e&&e(d),!0},sF=(n,e,t)=>iF(n.state,n.view.dispatch,e,t),r$=(n,e)=>ot.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>sF(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),i$=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],rc="abcdefghijklmnopqrstuvwxyz",s$=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function Rd(n){let e=n,t="";for(const[r,i]of i$)for(;e>=r;)t+=i,e-=r;return t}function jg(n){return Rd(n).toUpperCase()}function o$(n){const e=n.toLowerCase();let t=0,r=0;for(;t<e.length;){let i=!1;for(const[s,o]of i$)if(e.startsWith(o,t)){r+=s,t+=o.length,i=!0;break}if(!i)return 0}return r}function oF(n){if(!/^[ivxlcdmIVXLCDM]+$/.test(n))return!1;const e=o$(n);return e<=0?!1:(n===n.toLowerCase()?Rd(e):jg(e))===n}function aF(n){const e=n.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const t=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(t+1)*26+r+1}return 0}function Uu(n){if(n<=26)return rc[n-1];const e=Math.floor((n-1)/26)-1,t=(n-1)%26;return e<0?rc[t]:rc[e]+rc[t]}function Ed(n){if(!(!n||/^\d+$/.test(n))){if(oF(n))return n===n.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(n))return"a";if(/^[A-Z]{1,2}$/.test(n))return"A"}}function Ig(n){if(/^\d+$/.test(n))return parseInt(n,10);const e=Ed(n);if(e==="i"||e==="I")return o$(n);if(e==="a"||e==="A"){const r=aF(n);return r>0?r:1}const t=parseInt(n,10);return Number.isNaN(t)?1:t}function lF(n,e){if(n==="numeric")return String(e);switch(n){case"a":return Uu(e);case"A":return Uu(e).toUpperCase();case"i":return Rd(e);case"I":return jg(e);default:return String(e)}}function cF(n){var e;if(n.length===0)return!1;const t=(e=Ed(n[0]))!==null&&e!==void 0?e:"numeric",r=Ig(n[0]);if(r<1)return!1;for(let i=0;i<n.length;i++){const s=lF(t,r+i);if(n[i]!==s)return!1}return!0}function uF(n){return{type:Ed(n),start:Ig(n)}}function dF(n){const{type:e,start:t}=uF(n),r={};return e&&(r.type=e),t!==1&&(r.start=t),r}function hF(n,e,t=". "){const r=e+1;if(!n||n==="1")return`${r}${t}`;switch(n){case"a":return`${Uu(r)}${t}`;case"A":return`${Uu(r).toUpperCase()}${t}`;case"i":return`${Rd(r)}${t}`;case"I":return`${jg(r)}${t}`;default:return`${r}${t}`}}function fF(n){var e,t;const r=(e=n.tokens)===null||e===void 0?void 0:e[0];return!!(n.text&&((t=n.tokens)===null||t===void 0?void 0:t.length)===1&&r?.type==="list"&&r.ordered&&r.raw===n.text)}function pF(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}const a$=rn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",He(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!==null&&t!==void 0?t:e.parseChildren;let i=[];if(n.tokens&&n.tokens.length>0){if(fF(n))return{type:"listItem",content:[{type:"paragraph",content:pF(n.text||"",e)}]};if(n.tokens.some(s=>s.type==="paragraph"))i=r(n.tokens);else{const s=n.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(s.tokens)}],n.tokens.length>1){const o=r(n.tokens.slice(1));i.push(...o)}}else i=r(n.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(n,e,t)=>OQ(n,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var i,s;const o=((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.start)||1;return hF((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.type,o-1+(r.index||0),". ")}return"- "},t,{alignNestedToPrefix:t?.parentType==="orderedList"}),addExtensions(){return[r$(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Xg=(n,e)=>{const{$from:t}=e.selection,r=pt(n,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},l$=(n,e)=>{const t=Xg(n,e);if(!t)return!1;const[,r]=v_(e,n,t.$pos.pos+4);return r},mF=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},Ty=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!zr(n.state,e)&&mF(n.state,e,t)){const{$anchor:s}=n.state.selection,o=n.state.doc.resolve(s.before()-1),a=[];o.node().descendants((d,h)=>{d.type.name===e&&a.push({node:d,pos:h})});const l=a.at(-1);if(!l)return!1;const c=n.state.doc.resolve(o.start()+l.pos+1);return n.chain().cut({from:s.start()-1,to:s.end()+1},c.end()).joinForward().run()}if(!zr(n.state,e)||!P_(n.state))return!1;const{$from:r}=n.state.selection,i=r.depth-1;return r.node(i).type!==n.schema.nodes[e]||r.index(i)!==0?!1:n.chain().liftListItem(e).run()},gF=(n,e)=>{const t=l$(n,e),r=Xg(n,e);return!r||!t?!1:t>r.depth},OF=(n,e)=>{const t=l$(n,e),r=Xg(n,e);return!r||!t?!1:t<r.depth},My=(n,e)=>{if(!zr(n.state,e)||!C_(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:gF(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():OF(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},bF=(n,e,t)=>{const{state:r}=n,{selection:i}=r;if(!i.empty)return!1;const{$from:s}=i;if(s.parentOffset!==0||!s.parent.isTextblock||zr(r,e))return!1;const o=w_(s);if(!o||!t.includes(o.type.name))return!1;const a=o.lastChild;if(!a||a.type.name!==e)return!1;const l=s.parent;if(!a.canReplace(a.childCount,a.childCount,E.from(l)))return!1;const c=s.before(),d=s.after(),h=c-2;return n.commands.command(({tr:f,dispatch:p})=>(p&&(f.delete(c,d).insert(h,E.from(l)),f.setSelection(ee.create(f.doc,h+1)),f.scrollIntoView()),!0))},c$=ot.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&My(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&My(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ty(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ty(n,t,r)&&(e=!0)}),e},Tab:({editor:n})=>{for(const{itemName:e,wrapperNames:t}of this.options.listTypes)if(n.state.schema.nodes[e]!==void 0&&bF(n,e,t))return!0;return!1}}}}),zp=new RegExp(`^(\\s*)(${s$})([.)])\\s+(.*)$`),yF=/^\s/,Cs={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function xF(n){return zp.test(n.trimStart())}function SF(n){const e=n.trimStart();return Cs.bulletItem.test(e)||xF(e)||Cs.heading.test(e)||Cs.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Cs.codeFence.test(e)||Cs.blockMath.test(e)}function kF(n){return Object.values(Cs).some(e=>e.test(n))}function vF(n){const e=[],t=[];let r=!1;return n.forEach(i=>{if(r){t.push(i);return}if(i.trim()===""){r=!0,t.push(i);return}if(e.length>0&&SF(i)){r=!0,t.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:t}}function wF(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(zp);if(!s)break;const[,o,a,l,c]=s,d=o.length,h=parseInt(a,10),f=isNaN(h)?Ed(a):void 0,p=isNaN(h)?Ig(a):h,m=[c];let O=t+1;const b=[i];let y=!1;for(;O<n.length;){const S=n[O];if(S.match(zp))break;if(S.trim()==="")b.push(S),m.push(""),y=!0,O+=1;else if(S.match(yF)){const x=S.length-S.trimStart().length,k=d+a.length+1;b.push(S),m.push(S.slice(Math.min(x,k))),O+=1}else{if(y||kF(S))break;b.push(S),m.push(S),O+=1}}e.push({indent:d,number:p,type:f,content:m.join(`
245
- `).trim(),contentLines:m,raw:b.join(`
246
- `)}),r=O,t=O}return[e,r]}const QF=new RegExp(`^(${s$})([.)])\\s+(.+)$`);function $F(n){const e=n.split(`
247
- `).filter(r=>r.trim().length>0);if(e.length===0)return null;const t=[];for(const r of e){const i=r.trim().match(QF);if(!i)return null;t.push({marker:i[1],content:i[3]})}return cF(t.map(r=>r.marker))?{type:"orderedList",attrs:dF(t[0].marker),content:t.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function u$(n,e,t){const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const{paragraphLines:o,blockLines:a}=vF(s.contentLines),l=o.join(`
248
- `).trim(),c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const d=a.join(`
249
- `).trim();if(d){const p=t.blockTokens(d);c.push(...p)}let h=i+1;const f=[];for(;h<n.length&&n[h].indent>e;)f.push(n[h]),h+=1;if(f.length>0){const p=u$(f,Math.min(...f.map(m=>m.indent)),t);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:p,raw:f.map(m=>m.raw).join(`
250
- `)})}r.push({type:"list_item",raw:s.raw,tokens:c}),i=h}else i+=1}return r}function CF(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}const PF="listItem",Ay="textStyle",Ry=/^(\d+)\.\s$/;function Ey(n){const e=n.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const d$=rn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>{const e=n.getAttribute("type");if(e)return e;const t=n.getAttribute("style");if(t){const i=Ey(t);if(i)return i}const r=n.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const s=Ey(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,type:t,...r}=n,i=He(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),t&&t!=="1"&&(i.type=t),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.typeMarker,i=n.items?CF(n.items,e):[],s={};return t!==1&&(s.start=t),r&&(s.type=r),Object.keys(s).length>0?{type:"orderedList",attrs:s,content:i}:{type:"orderedList",content:i}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
251
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(n,e,t)=>{var r,i;const s=n.split(`
252
- `),[o,a]=wF(s);if(o.length===0)return;const l=u$(o,o[0].indent,t);if(l.length!==0)return{type:"list",ordered:!0,start:((r=o[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(i=o[0])===null||i===void 0?void 0:i.type,items:l,raw:s.slice(0,a).join(`
253
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(PF,this.editor.getAttributes(Ay)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Ze({props:{handlePaste:(n,e)=>{var t,r;const i=(t=e.clipboardData)===null||t===void 0?void 0:t.getData("text/html");if(i?.trim())return!1;const s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s)return!1;const o=$F(s);if(!o)return!1;try{const a=n.state.schema.nodeFromJSON(o),l=n.state.tr.replaceSelectionWith(a);return n.dispatch(l),!0}catch{return!1}}}})]},addInputRules(){const n=(t,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+t[1];let e=ao({find:Ry,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:n});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ao({find:Ry,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Ay)}),joinPredicate:n,editor:this.editor})),[e]}}),TF=/^\s*(\[([( |x])?\])\s$/,MF="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",AF=(n,e,t)=>{var r;return(t==null||(r=t.checkboxLabel)===null||r===void 0?void 0:r.call(t,n,e))||`Task item checkbox for ${n.textContent||"empty task item"}`},RF=rn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:n=>{var e;return(e=n.querySelector("div"))!==null&&e!==void 0?e:n}}]},renderHTML({node:n,HTMLAttributes:e}){return["li",He(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${!((t=n.attrs)===null||t===void 0)&&t.checked?"x":" "}] `;return OQ(n,e,r)},addExtensions(){return this.options.nested?[r$(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");o.style.cssText=MF;const c=h=>{const f=AF(h,h.attrs.checked,this.options.a11y);a.setAttribute("aria-label",f),o.textContent=f};c(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",h=>h.preventDefault()),a.addEventListener("change",h=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=h.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=t();if(typeof m!="number")return!1;const O=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...O?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([h,f])=>{i.setAttribute(h,f)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([h,f])=>{i.setAttribute(h,f)});let d=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:h=>{if(h.type!==this.type)return!1;i.dataset.checked=h.attrs.checked,a.checked=h.attrs.checked,c(h);const f=r.extensionManager.attributes,p=Ua(h,f),m=new Set(Object.keys(p)),O=this.options.HTMLAttributes;return d.forEach(b=>{m.has(b)||(b in O?i.setAttribute(b,O[b]):i.removeAttribute(b))}),Object.entries(p).forEach(([b,y])=>{y==null?b in O?i.setAttribute(b,O[b]):i.removeAttribute(b):i.setAttribute(b,y)}),d=m,!0}}}},addInputRules(){return[ao({find:TF,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),EF=rn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",He(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
254
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=s=>{const o=iy(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},t);if(o){const a={type:"taskList",raw:o.raw,items:o.items},l=s.slice(o.raw.length);return l.trim()?[a,...t.blockTokens(l)]:[a]}return t.blockTokens(s)},i=iy(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ot.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(n$.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(a$.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(c$.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(d$.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(RF.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(EF.configure(this.options.taskList)),n}});const ic="&nbsp;",Jh=" ",NF=rn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",He(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===ic||t[0].text===ic||t[0].raw===Jh||t[0].text===Jh)&&r.length===1&&r[0].type==="text"&&(r[0].text===ic||r[0].text===Jh)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{if(!n)return"";const r=Array.isArray(n.content)?n.content:[];if(r.length===0){var i,s;const o=Array.isArray(t==null||(i=t.previousNode)===null||i===void 0?void 0:i.content)?t.previousNode.content:[];return(t==null||(s=t.previousNode)===null||s===void 0?void 0:s.type)==="paragraph"&&o.length===0?ic:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),DF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,jF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,IF=ds.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",He(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[cs({find:DF,type:this.type})]},addPasteRules(){return[yi({find:jF,type:this.type})]}}),XF=rn.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),LF=ds.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",He(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),_F=ot.create({name:"starterKit",addExtensions(){const n=[];if(this.options.bold!==!1&&n.push(lZ.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(rZ.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(n$.configure(this.options.bulletList)),this.options.code!==!1&&n.push(dZ.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(pZ.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(mZ.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(jz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(Iz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(gZ.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(OZ.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(Kz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(bZ.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(vZ.configure(this.options.italic)),this.options.listItem!==!1&&n.push(a$.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;n.push(c$.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var t;n.push(tF.configure((t=this.options)===null||t===void 0?void 0:t.link))}if(this.options.orderedList!==!1&&n.push(d$.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(NF.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(IF.configure(this.options.strike)),this.options.text!==!1&&n.push(XF.configure(this.options.text)),this.options.underline!==!1){var r;n.push(LF.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var i;n.push(Hz.configure((i=this.options)===null||i===void 0?void 0:i.trailingNode))}return n}});var BF=_F;function WF(n){return n==="dark"?{list:"w-[260px] overflow-hidden rounded-md border border-[#2A3242] bg-[#141925] shadow-lg",itemBase:"flex w-full items-center px-3 py-2 text-left text-sm text-[#F4F7FC]",itemSelected:"bg-[#1E2533]",itemDefault:"bg-[#141925] hover:bg-[#1E2533]",mentionClass:"rounded bg-[#3B6BFF]/20 px-1 py-0.5 font-medium text-[#93B4FF]"}:{list:"w-[260px] overflow-hidden rounded-md border border-gray-200 bg-white shadow-md",itemBase:"flex w-full items-center px-3 py-2 text-left text-sm text-gray-900",itemSelected:"bg-gray-100",itemDefault:"bg-white hover:bg-gray-100",mentionClass:"rounded bg-blue-50 px-1 py-0.5 font-medium text-blue-700"}}function Ny(n){try{return JSON.parse(n)}catch{return""}}function h$({value:n,setValue:e,editable:t=!0,theme:r="default"}){const i=Ju()?.id,s=WF(r),{data:o}=ga(JW,{fetchPolicy:"cache-first",variables:{orgId:i},skip:!i}),a=$.useMemo(()=>hi(o?.members).map(d=>({id:d.email,label:d.email})),[o?.members]),l=UW({editable:t,immediatelyRender:!1,extensions:[BF.configure({heading:!1,blockquote:!1,code:!1,codeBlock:!1,bulletList:!1,orderedList:!1,listItem:!1,horizontalRule:!1}),...t?[Jz.configure({placeholder:"Add a comment..."})]:[],Oz.configure({HTMLAttributes:{class:s.mentionClass},suggestion:{items({query:c}){const d=c.trim().toLowerCase();return d?a.filter(h=>h.label.toLowerCase().includes(d)):a},render(){let c=null,d=0,h=[],f=null,p=null;function m(O){if(!c)return;h=O.items,f=O.command,p=O.clientRect??null;const b=p?.();if(b&&(c.style.left=`${b.left}px`,c.style.top=`${b.bottom+6}px`),c.textContent="",!h.length)return;const y=document.createElement("div");y.className=s.list,d>=h.length&&(d=0);for(let S=0;S<h.length;S++){const x=h[S],k=document.createElement("button");k.type="button",k.className=s.itemBase+" "+(S===d?s.itemSelected:s.itemDefault),k.textContent=x.label,k.onmousedown=v=>{v.preventDefault(),f?.(x)},y.appendChild(k)}c.appendChild(y)}return{onStart:O=>{d=0,c=document.createElement("div"),c.className="fixed z-50",document.body.appendChild(c),m(O)},onUpdate:O=>{m(O)},onKeyDown:O=>{if(O.event.key==="Escape")return c?.remove(),c=null,!0;if(O.event.key==="ArrowDown")return h.length&&(d=(d+1)%h.length,m({items:h,command:f||(()=>{}),clientRect:p})),!0;if(O.event.key==="ArrowUp")return h.length&&(d=(d-1+h.length)%h.length,m({items:h,command:f||(()=>{}),clientRect:p})),!0;if(O.event.key==="Enter"){const b=h[d];return b&&f?.(b),!0}return!1},onExit:()=>{c?.remove(),c=null}}}}})],content:Ny(n),onUpdate:({editor:c})=>{const d=JSON.stringify(c.getJSON(),null,2);e(d)}},[r,a,t]);return $.useEffect(()=>{if(!l)return;const c=l.getJSON(),d=Ny(n);JSON.stringify(c)===JSON.stringify(d)||l.commands.setContent(d)},[n,l]),l}const zF="border-[#2A3242] bg-[#1E2533] text-[#F4F7FC] shadow-none ring-0 focus-within:ring-0 [&_.ProseMirror]:text-[#F4F7FC] [&_.ProseMirror_p.is-editor-empty:first-child::before]:text-[#828DA3] [&_.mention]:bg-[#3B6BFF]/20 [&_.mention]:text-[#93B4FF]";function f$({value:n,setValue:e,className:t,forceFocus:r=!1,theme:i="default"}){const s=h$({value:n,setValue:e,theme:i});return g.jsx("div",{className:V("border-stock rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-all","ring-stock ring-0 focus-within:ring-2",i==="dark"&&zF,t),onMouseDownCapture:o=>{r&&(o.stopPropagation(),o.nativeEvent.stopImmediatePropagation())},onDrop:o=>{r&&(o.stopPropagation(),o.nativeEvent.stopImmediatePropagation())},children:g.jsx(wg,{editor:s,className:"prose max-w-none cursor-text text-sm [&_.ProseMirror]:min-h-[64px] [&_.ProseMirror]:whitespace-pre-wrap [&_.ProseMirror]:outline-none"})})}function p$({value:n,theme:e="default"}){const t=h$({value:n,setValue:()=>{},editable:!1,theme:e});return g.jsx(wg,{editor:t,className:V("prose max-w-none text-sm",e==="dark"&&"text-[#F4F7FC] [&_.ProseMirror]:text-[#F4F7FC] [&_.mention]:bg-[#3B6BFF]/20 [&_.mention]:text-[#93B4FF]")})}function m$(n){const e=new Date,t=new Date(n),r=Math.floor((e.getTime()-t.getTime())/(1e3*60));return r<1?"Just now":r<60?`${r} min ago`:r<1440?`${Math.floor(r/60)} hour${Math.floor(r/60)>1?"s":""} ago`:`${Math.floor(r/1440)} day${Math.floor(r/1440)>1?"s":""} ago`}const ZF=18,FF="#E2E8F0",ef=10,VF=1,tf=4,YF=.3,Dy=.75;function qF({id:n,data:e}){const{updateNodeData:t}=gn(),r=$.useRef(null),i={...ya,rowHeight:e.rowHeight??ya.rowHeight},{rowCount:s}=e,a=Tn(e.componentFields,{componentFieldId:"name"})??e.label??"",l=e.color??FF,c=e.titleFontSize??ZF,d=ef/2,h=e.rowYs,f=e.activations,p=i.rowHeight*YF,m=(f??[]).map(x=>({top:(h?.[x.startRow]??Bd(x.startRow,i))-p,bottom:(h?.[x.endRow]??Bd(x.endRow,i))+p})),O=h?.length??s??1,b=e.lifelineHeight??i.headerHeight+O*i.rowHeight,y=e.lifelineStartRow!==void 0&&h?(h[e.lifelineStartRow]??i.headerHeight)-i.rowHeight/2:i.headerHeight,S=e.lifelineEndRow!==void 0&&h?(h[e.lifelineEndRow]??b)+i.rowHeight/2:b;return g.jsxs("div",{className:"relative overflow-visible",style:{width:ef,height:b},children:[g.jsx("div",{className:"absolute top-0 left-1/2 -ml-0.5 flex items-end",style:{height:i.headerHeight,fontSize:c},onDoubleClick:()=>r.current?.focus(),children:g.jsxs("div",{className:"flex items-end gap-1.5 pb-2",children:[g.jsx("div",{className:"h-[1em] w-1 rounded-full",style:{backgroundColor:l}}),g.jsx("input",{ref:r,value:a,size:1,onKeyDown:x=>x.stopPropagation(),onMouseDown:x=>x.stopPropagation(),className:"text-foreground mb-[-0.25em] block field-sizing-content border-none bg-transparent p-0 text-[1em] leading-[1] font-medium whitespace-nowrap outline-none",style:{color:e.textColor},onChange:x=>{const k=e.componentFields??[];t(n,{componentFields:xi(k,{...qp(k,k),name:x.currentTarget.value})})}})]})}),g.jsxs("svg",{className:"pointer-events-none absolute top-0 left-0 overflow-visible",width:ef,height:b,children:[g.jsx("line",{x1:d,y1:y,x2:d,y2:S,stroke:l,strokeOpacity:Dy,strokeWidth:VF}),m.map(x=>g.jsx("rect",{x:d-tf/2,y:x.top,width:tf,height:x.bottom-x.top,fill:l,fillOpacity:Dy,rx:tf/2},x.top))]}),Array.from({length:O},(x,k)=>{const v=h?.[k]??Bd(k,i),w="!w-1 !h-1 !opacity-0 !border-0 !bg-transparent";return g.jsxs($.Fragment,{children:[g.jsx(cn,{id:xl(k,"left","target"),type:"target",position:ge.Left,className:w,style:{top:v}}),g.jsx(cn,{id:xl(k,"left","source"),type:"source",position:ge.Left,className:w,style:{top:v}}),g.jsx(cn,{id:xl(k,"right","target"),type:"target",position:ge.Right,className:w,style:{top:v}}),g.jsx(cn,{id:xl(k,"right","source"),type:"source",position:ge.Right,className:w,style:{top:v}})]},k)})]})}const UF="text-[#F4F7FC] border border-transparent px-1 text-[12px] leading-[1.5] font-normal",GF="text-[#F4F7FC] border-primary absolute inset-0 size-full border bg-[#1E2533] px-1 text-[12px] leading-[1.5] font-normal opacity-0 transition-all duration-100 outline-none focus:opacity-100";function nf({value:n,onChange:e,className:t,placeholder:r="—"}){return g.jsxs("div",{className:"relative isolate flex h-8 w-full items-center",children:[g.jsx("p",{className:V(UF,t),children:n||g.jsx("span",{className:"text-[#828DA3]",children:r})}),g.jsx("input",{value:n,placeholder:r,onChange:i=>e(i.target.value),onKeyDown:i=>i.stopPropagation(),className:V(GF,t)})]})}const gU=["Task","Owner","Status","Due"],OU=[["Website revamp","Amara","In progress","May 12"],["Marketing sync","Liu","Blocked","May 15"],["QA review","Nia","Ready","May 17"],["Launch prep","Theo","Planned","May 20"]];function HF({id:n,data:e,selected:t}){const{updateNodeData:r}=gn(),i=Tn(e.componentFields,{componentFieldId:"name"}),s=$.useRef(null),[o,a]=ur(i??"Untitled table"),[l,c]=ur(e??{columns:[],rows:[]});function d(y){c(S=>{const x={...S??{},...y};return s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{r(n,x)},200),x})}function h(y,S){const x=l?.columns?.map((k,v)=>v===y?S:k);d({columns:x})}function f(y,S,x){const k=l?.rows?.map((v,w)=>{if(w!==y)return v;const Q=Array.isArray(v)?[...v]:[];return Q[S]=x,Q});d({rows:k})}function p(){const y=l?.columns?.map(()=>"")??[];d({rows:[...l?.rows??[],y]})}function m(){const y=[...l?.columns??[],`Column ${(l?.columns?.length??0)+1}`],S=l?.rows?.map(x=>[...x??[],""])??[];d({columns:y,rows:S})}function O(y){const S=l?.rows?.filter((x,k)=>k!==y);d({rows:S})}function b(y){const S=l?.columns?.filter((k,v)=>v!==y),x=l?.rows?.map(k=>k?.filter((v,w)=>w!==y));d({columns:S,rows:x})}return g.jsx(Si,{selected:t,className:"relative isolate rounded-[0.5rem] bg-[#141925]",style:{borderRadius:e?.borderRadius??8},children:g.jsxs("div",{className:"flex h-full flex-col rounded-[inherit] border border-[#2A3242] bg-[#141925] text-xs text-[#F4F7FC]",children:[g.jsxs("div",{className:"flex items-center gap-2 border-b border-[#2A3242] p-2",children:[g.jsx("div",{className:"pl-2",children:g.jsx(a7,{className:"size-4 text-[#828DA3]"})}),g.jsx("div",{className:"mr-auto",children:g.jsx(nf,{value:o,onChange:y=>{a(y);const S=l?.componentFields??e.componentFields??[],k=S.some(v=>v?.componentFieldId==="name")?S:[...S,{componentFieldId:"name",type:Mr.TextInput,label:"Name",isReadonly:!1,data:[{value:""}]}];d({componentFields:xi(k,{name:y})})},placeholder:"Untitled table",className:V("cursor-grab rounded font-semibold",t&&"cursor-text active:cursor-grabbing")})}),g.jsxs("p",{className:"text-paragraph min-w-fit text-xs",children:[l?.columns?.length," column",l?.columns?.length===1?"":"s"]})]}),g.jsx("div",{className:"relative",children:g.jsxs(hx,{className:"border-stock border-t text-xs [&_tr:hover]:bg-[#1E2533]/60",children:[g.jsx(fx,{children:g.jsxs(qo,{children:[g.jsx($r,{className:"h-9 w-10 p-0 px-2 text-center text-[11px] text-[#828DA3]",children:"#"}),l?.columns?.map((y,S)=>g.jsxs($r,{className:"relative h-auto p-0 pr-7 text-[11px] text-[#828DA3]",children:[g.jsx(nf,{value:String(y),onChange:x=>h(S,x),placeholder:`Column ${S+1}`,className:V("min-w-32 cursor-grab font-medium",t&&"cursor-text active:cursor-grabbing")}),t&&g.jsx(Nt,{variant:"ghost",onClick:()=>b(S),className:"hover:bg-destructive/10 hover:text-destructive absolute top-1.5 right-0.5 size-6 text-[#828DA3] [&_svg]:size-3!",children:g.jsx(zg,{})})]},`col-${S}`)),g.jsx($r,{className:"size-9",children:t&&g.jsx(Nt,{variant:"ghost",onClick:m,className:"absolute top-0.5 right-0.5 z-10 size-8 px-1!",children:g.jsx(Fg,{})})})]})}),g.jsx(px,{children:l?.rows?.length?l?.rows?.map((y,S)=>g.jsxs(qo,{className:"relative isolate last:border-none [&_td]:align-middle",children:[g.jsx(nr,{className:"w-10 px-2 py-1 text-center text-[11px] text-[#828DA3]",children:S+1}),l?.columns?.map((x,k)=>g.jsx(nr,{className:"p-0",children:g.jsx(nf,{value:String(y?.[k]??""),onChange:v=>f(S,k,v),className:V("cursor-grab",t&&"cursor-text active:cursor-grabbing")})},`cell-${S}-${k}`)),g.jsx(nr,{className:"size-9",children:t&&g.jsx(Nt,{variant:"ghost",onClick:()=>O(S),className:"hover:bg-destructive/10 hover:text-destructive absolute top-0.5 right-0.5 z-10 size-8 px-1! text-[#828DA3] [&_svg]:size-3!",children:g.jsx(zg,{})})})]},`row-${S}`)):g.jsx(qo,{children:g.jsx(nr,{colSpan:Math.max((l?.columns?.length??0)+1,1),className:"px-2 py-3 text-center text-[12px] text-[#828DA3]",children:"No rows yet"})})})]})}),g.jsx(uc,{children:t&&g.jsx(Wi.div,{exit:{opacity:0,height:0},initial:{opacity:0,height:0},animate:{opacity:1,height:"48px"},transition:{duration:.2,ease:"easeOut"},className:"border-stock flex w-full items-center justify-center overflow-hidden border-t px-2",children:g.jsxs(Nt,{preset:"outline",className:"h-8 w-full text-xs shadow-none [&_svg]:size-3.5!",onClick:p,children:[g.jsx(Fg,{})," Add Row"]})})})]})})}function KF({data:n,selected:e}){return g.jsxs(Si,{selected:e,className:"size-full overflow-hidden outline-transparent",children:[g.jsx(fr,{minWidth:20,minHeight:20,isVisible:e}),g.jsx("img",{src:n.src,alt:"React Flow Animated Node",className:"size-full rounded-[0.5rem]"})]})}function JF({component:n,category:e,fallbackIcon:t}){const r=jy(n??"");if(r)return r;const i=jy(e??"");return i||(t??g.jsx(sC,{}))}function jy(n){switch(n){case"component_backend-flow-diagram":case"Architecture & Flows":return g.jsx(iC,{});case"component_api-contract":case"API & Contracts":return g.jsx(rC,{});case"component_performance-sla":case"Performance & Reliability":return g.jsx(nC,{});case"component_test-case-suite":case"Quality & Testing":return g.jsx(tC,{});case"component_business-rule-logic":case"Business Logic":return g.jsx(eC,{});case"component_feature-flag-config":case"Release & Feature Management":return g.jsx(J$,{});case"component_support-kb-troubleshooting":case"Support & Operations":return g.jsx(K$,{});case"component_analytics-telemetry-event":case"Analytics & Telemetry":return g.jsx(H$,{});case"component_security-and-pii":case"Security & Compliance":return g.jsx(G$,{});case"component_ownership-on-call":case"Ownership & On-call":return g.jsx(U$,{});case"component_design-spec-link":case"Design & UX":return g.jsx(q$,{});case"component_open-issues-bugs":case"Issue Tracking":return g.jsx(Y$,{})}}function eV(n){return pr({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M6 21.5C4.067 21.5 2.5 19.933 2.5 18C2.5 16.067 4.067 14.5 6 14.5C7.5852 14.5 8.92427 15.5539 9.35481 16.9992L15 16.9994V15L17 14.9994V9.24339L14.757 6.99938H9V9.00003H3V3.00003H9V4.99939H14.757L18 1.75739L22.2426 6.00003L19 9.24139V14.9994L21 15V21H15V18.9994L9.35499 19.0003C8.92464 20.4459 7.58543 21.5 6 21.5ZM6 16.5C5.17157 16.5 4.5 17.1716 4.5 18C4.5 18.8285 5.17157 19.5 6 19.5C6.82843 19.5 7.5 18.8285 7.5 18C7.5 17.1716 6.82843 16.5 6 16.5ZM19 17H17V19H19V17ZM18 4.58581L16.5858 6.00003L18 7.41424L19.4142 6.00003L18 4.58581ZM7 5.00003H5V7.00003H7V5.00003Z"},child:[]}]})(n)}function bU(n){return pr({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.82843 6.99955L8.36396 9.53509L6.94975 10.9493L2 5.99955L6.94975 1.0498L8.36396 2.46402L5.82843 4.99955H13C17.4183 4.99955 21 8.58127 21 12.9996C21 17.4178 17.4183 20.9996 13 20.9996H4V18.9996H13C16.3137 18.9996 19 16.3133 19 12.9996C19 9.68584 16.3137 6.99955 13 6.99955H5.82843Z"},child:[]}]})(n)}const tV=[{tags:["microservice","service"],icon:g.jsx(mT,{})},{tags:["api-endpoint","api"],icon:g.jsx(gT,{})},{tags:["database","db"],icon:g.jsx(OT,{})},{tags:["message-queue","message","Message Queue","flow_diagram_component_message-queue"],icon:g.jsx(bT,{})},{tags:["external-service"],icon:g.jsx(yT,{})},{tags:["function-lambda","function","lambda","Function / Lambda"],icon:g.jsx(xT,{})},{tags:["job-scheduler","job","scheduler","Job / Scheduler"],icon:g.jsx(ST,{})},{tags:["code-block","code","Code Block"],icon:g.jsx(kT,{})},{tags:["label","Label"],icon:g.jsx(vT,{})},{tags:["file-note","file","note","File / Note"],icon:g.jsx(wT,{})}],nV=[Mr.TextInput,Mr.URLInput,Mr.NumberInput,Mr.DropdownSelect,Mr.BooleanToggle];function rV(n,e){return tV.find(r=>r.tags.some(i=>i.toLowerCase().trim()===String(n).toLowerCase().trim()))?.icon??e??g.jsx(eV,{className:"text-gray-400"})}const Iy=3;function g$({fields:n}){const[e,t]=$.useState(!1),r=$.useMemo(()=>!n||n.length===0?[]:n.filter(o=>nV.includes(o.type)&&o.hidden===!1&&o.label!=="Name"&&o.label!=="Label"&&o.label!=="Description").map(o=>{const a=o.data?.[0]?.value,l=a&&typeof a=="object"&&("url"in a||"fileId"in a)?a.url??a.fileId:a;return{name:o.label??"",value:l===!0?"Yes":l===!1?"No":l}}).filter(o=>o.value&&typeof o.value=="string"||typeof o.value=="number"&&!Number.isNaN(o.value)),[n]),i=$.useMemo(()=>r.slice(0,Iy),[r]),s=$.useMemo(()=>r.slice(Iy),[r]);return g.jsx(g.Fragment,{children:i.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"border-t border-[#2A3242] bg-[#1E2533]/50 p-5",children:[g.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:i.map(({name:o,value:a},l)=>g.jsxs($.Fragment,{children:[g.jsx("div",{className:"text-sm font-medium text-[#828DA3] capitalize",children:o}),g.jsx("p",{className:"justify-self-end font-mono text-sm font-medium text-[#F4F7FC]",children:String(a)})]},o+l))}),s.length>0&&g.jsx("div",{className:V("grid overflow-hidden transition-all duration-500 ease-in-out",e?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),children:g.jsx("div",{className:"overflow-hidden",children:g.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3 pt-3",children:s.map(({name:o,value:a},l)=>g.jsxs($.Fragment,{children:[g.jsx("div",{className:"text-sm font-medium text-[#828DA3] capitalize",children:o}),g.jsx("p",{className:"justify-self-end font-mono text-sm font-medium text-[#F4F7FC]",children:String(a)})]},o+l))})})})]}),s.length>0&&g.jsx(g.Fragment,{children:g.jsx("div",{className:"border-t border-[#2A3242] text-center",children:g.jsxs("button",{onClick:()=>t(!e),className:"group/button inline-flex items-center gap-2 px-4 py-3 text-sm font-semibold text-[#828DA3] transition-colors hover:text-[#F4F7FC]",children:[g.jsxs("span",{children:[e?"Hide":"View"," Details"]}),g.jsx(jC,{className:V("h-4 w-4 transition-transform duration-300 group-hover/button:text-[#F4F7FC]",e&&"rotate-180")})]})})})]})})}function iV({icon:n,children:e,name:t,label:r,description:i,fields:s,selected:o,scale:a,contentSize:l,contentRef:c}){const d=a!=null&&l!=null,h=d?{width:l.width*a,height:l.height*a,minWidth:0,maxWidth:"none"}:void 0,f=d?{width:l.width,transform:`scale(${a})`,transformOrigin:"top left"}:void 0;return g.jsx(Si,{selected:o,style:h,className:"min-w-xl overflow-hidden rounded-[0.5rem] border border-[#2A3242] bg-[#141925] text-left",children:g.jsxs("div",{ref:c,style:f,children:[g.jsxs("div",{className:"p-5",children:[g.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-4",children:[g.jsx("div",{className:"size-12 overflow-hidden rounded-xl bg-[#1E2533] text-white [&>*]:size-full [&>*]:max-h-full [&>*]:min-h-full [&>*]:max-w-full [&>*]:min-w-full",children:n?typeof n=="string"?g.jsx("img",{src:n,alt:t,className:"block object-cover"}):n:g.jsx("div",{className:"flex h-full w-full items-center justify-center bg-[#1E2533]",children:g.jsx(VC,{className:"h-6 w-6 text-[#F4F7FC]"})})}),g.jsxs("div",{className:"flex-1 shrink-0 basis-full",children:[g.jsx("p",{className:"text-lg font-bold text-[#F4F7FC]",children:t}),r&&g.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[g.jsx("span",{className:"bg-primary h-2 w-2 rounded-full"}),g.jsx("span",{className:"text-primary text-xs font-semibold",children:r})]})]})]}),i&&g.jsx("div",{className:"mt-4 text-[15px] leading-relaxed text-balance text-[#828DA3]",children:g.jsx("p",{children:i})})]}),e,g.jsx(g$,{fields:s})]})})}const yU=240,xU=1e3,sV=400;function oV({id:n,data:e,selected:t}){const{updateNode:r,updateNodeData:i}=gn(),s=$.useRef(null),[o,a]=$.useState(null);$.useLayoutEffect(()=>{const S=s.current;if(!S)return;function x(){a(v=>v===S.offsetHeight?v:S.offsetHeight)}const k=new ResizeObserver(x);return k.observe(S),x(),()=>k.disconnect()},[]);const l=e.scale??1,c=e.contentWidth??sV,d=$.useRef(void 0);$.useLayoutEffect(()=>{if(!c||o==null)return;const S=Math.round(c*l),x=Math.round(o*l);d.current?.width===S&&d.current?.height===x||(d.current={width:S,height:x},r(n,{width:S,height:x}))},[c,o,l,n,r]);const h=$.useRef(c);h.current=c;const f=$.useCallback((S,x)=>{const k=h.current;k&&i(n,{scale:x.width/k})},[n,i]),p=$.useMemo(()=>{const S=JF({component:e.componentId,fallbackIcon:!1});if(S)return g.jsx("div",{className:"flex items-center justify-center bg-[#1E2533] [&>svg]:size-full",children:S});const x=rV(e.componentName);return g.jsx("div",{className:"bg-stock/60 flex items-center justify-center [&>svg]:text-3xl",children:x})},[e.componentId,e.componentName]),m=Tn(e.componentFields,{label:"Name"}),O=Tn(e.componentFields,{label:"Label"}),b=Tn(e.componentFields,{label:"Description"}),y=o!=null&&c>0?{width:c,height:o}:null;return g.jsxs(g.Fragment,{children:[g.jsx(fr,{isVisible:t,keepAspectRatio:!0,onResize:f}),g.jsx(iV,{name:m??"",label:O??"",description:b??"",fields:e.componentFields,selected:t,icon:p,scale:y?l:void 0,contentSize:y,contentRef:s})]})}const Xy=16,Ly=44,_y=16;function aV(n,e,t){const r=n.find(x=>x.id===e);if(!r)return null;const i=n.filter(x=>x.parentId===e);if(i.length===0)return null;const s=t==="top"?Ly:_y,o=t==="bottom"?Ly:_y;let a=1/0,l=1/0,c=-1/0,d=-1/0;for(const x of i){const k=x.measured?.width??x.width??0,v=x.measured?.height??x.height??0;a=Math.min(a,x.position.x),l=Math.min(l,x.position.y),c=Math.max(c,x.position.x+k),d=Math.max(d,x.position.y+v)}const h=Xy-a,f=s-l,p=c-a+Xy*2,m=d-l+s+o,O=r.width??r.measured?.width??r.style?.width??0,b=r.height??r.measured?.height??r.style?.height??0;if(Math.abs(h)<.5&&Math.abs(f)<.5&&Math.abs(p-O)<.5&&Math.abs(m-b)<.5)return null;const S=new Set(i.map(x=>x.id));return n.map(x=>x.id===e?{...x,position:{x:x.position.x-h,y:x.position.y-f},width:p,height:m,style:{...x.style,width:p,height:m}}:S.has(x.id)?{...x,position:{x:x.position.x+h,y:x.position.y+f}}:x)}function O$(n,e,t){const{getNodes:r,setNodes:i}=gn(),s=Gp(o=>{let a="";return o.nodeLookup.forEach(l=>{if(l.parentId!==n)return;const c=l.measured?.width??l.width??0,d=l.measured?.height??l.height??0;a+=`${l.id},${l.position.x},${l.position.y},${c},${d};`}),a});$.useEffect(()=>{if(!e)return;const o=r();if(o.filter(c=>c.parentId===n).some(c=>c.measured?.width===void 0))return;const l=aV(o,n,t);i((l??o).map(c=>c.id===n?{...c,data:{...c.data,autoLayout:void 0}}:c))},[e,s,n,t,r,i])}const lV=4,cV=2,rf=13,sc=6.5,By=7.8,Zp=2.4,sf=Zp/2+.5;function uV({levels:n,color:e}){const t=Math.min(Math.max(n+1,cV),lV),r=rf*2+sf*2,i=sc*2+By*(t-1)+sf*2,s=r/2;return g.jsx("svg",{viewBox:`0 0 ${r} ${i}`,style:{width:"1.3em",height:"auto",color:e},fill:"none","aria-hidden":!0,children:Array.from({length:t},(o,a)=>{const l=sf+sc+By*a,c=`${s-rf},${l}`,d=`${s+rf},${l}`,h=`${s},${l+sc}`,f=`${s},${l-sc}`;return a===0?g.jsx("polygon",{points:`${f} ${d} ${h} ${c}`,fill:"currentColor",fillOpacity:.35,stroke:"currentColor",strokeWidth:Zp,strokeLinejoin:"round"},a):g.jsx("path",{d:`M ${c} L ${h} L ${d}`,stroke:"currentColor",strokeOpacity:.8,strokeWidth:Zp,strokeLinejoin:"round",strokeLinecap:"round"},a)})})}const dV=[{position:ge.Top,offset:"!-top-2"},{position:ge.Bottom,offset:"!-bottom-2"},{position:ge.Left,offset:"!-left-2"},{position:ge.Right,offset:"!-right-2"}];function b$(){const{isEdgeConnecting:n}=Zr();return dV.flatMap(({position:e,offset:t})=>["target","source"].map(r=>g.jsx(cn,{id:`${r}-${e}`,type:r,position:e,className:V(t,n&&"connection-enabled"),style:{zIndex:10,pointerEvents:"auto"}},`${r}-${e}`)))}const hV={enterprise:"ENTERPRISE",system:"SYSTEM",container:"CONTAINER",generic:"BOUNDARY",node:"NODE"},fV="rgba(130, 141, 163, 0.06)",pV="#828DA3";function mV({id:n,data:e,selected:t}){const{updateNodeData:r,updateNode:i}=gn(),{boundaryDepths:s}=Zr(),o=Tn(e.componentFields,{componentFieldId:"name"}),a=$.useRef(null),[l,c]=ur(o??"");function d(b){c(b),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{r(n,{componentFields:xi(e.componentFields??[],{name:b})})},1e3)}const h=e.autoLayout??!1,f=e.collapsed??!1;O$(n,h&&!f,"bottom");const p=e.borderColor??pV,m=e.boundaryType??hV[e.c4BoundaryKind]??"Boundary";function O(){return f?"solid":e.c4BoundaryKind==="generic"?"dotted":"dashed"}return g.jsxs("div",{className:"c4-boundary-box relative size-full rounded-[0.25rem]",style:{backgroundColor:e.backgroundColor??fV,border:`2px ${O()} ${p}`},children:[g.jsx(fr,{minWidth:200,minHeight:140,isVisible:t&&!h,onResize:(b,y)=>{i(n,{width:y.width,height:y.height})}}),g.jsx(b$,{}),g.jsxs("div",{className:V("c4-boundary-label absolute inset-x-0 bottom-0 flex flex-col items-start gap-0.5 px-3 pb-2",f&&"hidden"),children:[g.jsx(Zs,{value:l,placeholder:"Boundary",onKeyDown:b=>b.stopPropagation(),onMouseDown:b=>b.stopPropagation(),onDoubleClick:b=>b.stopPropagation(),onChange:b=>d(b.currentTarget.value),className:"w-full cursor-text resize-none bg-transparent text-left text-sm font-bold outline-none",style:{color:e.fontColor??p}}),g.jsxs("span",{className:"text-[0.625rem] leading-tight",style:{color:e.fontColor??p},children:["[",m,"]"]}),e.description&&g.jsx("span",{className:"max-w-full text-left text-[0.625rem] leading-tight whitespace-pre-line opacity-80",style:{color:e.fontColor??p},children:e.description})]}),g.jsxs("div",{className:V("c4-boundary-collapsed-label absolute inset-0 flex-col items-center justify-center gap-[0.3em] px-[5%] text-center",f?"flex":"hidden"),style:{color:e.fontColor??p,fontSize:f?"var(--lod-font-size)":void 0},children:[g.jsx("span",{className:"leading-tight font-bold wrap-anywhere",children:l||"Boundary"}),g.jsxs("span",{className:"flex items-center gap-[0.4em] text-[0.6em] leading-tight opacity-80",children:[g.jsx(uV,{levels:s.get(n)??1,color:e.fontColor??p}),"[",m,"]"]}),e.description&&g.jsx("span",{className:"line-clamp-2 text-[0.55em] leading-snug wrap-anywhere opacity-70",children:e.description})]})]})}function Lg({borderColor:n="transparent",borderWidth:e=0,borderRadius:t=0,borderStyle:r="solid",borderAnimationEnabled:i=!1,className:s,...o}){const a=$.useRef(null),[l,c]=$.useState(0),[d,h]=$.useState(0);$.useEffect(()=>{const b=a.current;if(!b)return;function y(){c(b.clientHeight),h(b.clientWidth)}const S=new ResizeObserver(y);return S.observe(b),y(),()=>{S.disconnect()}},[]);const f=e/2,p=Math.max(0,Math.min(t,d/2)-f),m=Math.max(0,Math.min(t,l/2)-f),O=r==="dashed"?`${e*2} ${e*2}`:r==="dotted"?`${e} ${e}`:void 0;return g.jsxs("svg",{...o,ref:a,viewBox:`0 0 ${d} ${l}`,className:V("pointer-events-none",s),children:[g.jsx("rect",{x:f,y:f,width:d-e,height:l-e,rx:p,ry:m,fill:"none",stroke:n,strokeWidth:e,strokeDasharray:O,style:{animation:i&&O?"stroke-fake-animation 8s linear infinite":void 0}}),g.jsx("style",{dangerouslySetInnerHTML:{__html:`
255
- @keyframes stroke-fake-animation {
256
- from { stroke-dashoffset: 0; }
257
- to { stroke-dashoffset: 100%; }
258
- }`}})]})}function gV({data:n,selected:e,width:t}){const r=Tn(n.componentFields,{componentFieldId:"name"});return g.jsxs(Si,{selected:e,className:"relative isolate size-full min-h-fit border border-[#2A3242] bg-[#141925]",style:{borderRadius:n?.borderRadius||8},children:[g.jsx(fr,{minWidth:125,minHeight:125,isVisible:e,keepAspectRatio:!0}),g.jsx(Lg,{className:"pointer-events-none absolute inset-0 size-full",borderColor:n?.stroke,borderStyle:n?.strokeStyle,borderWidth:n?.strokeWidth,borderRadius:n?.borderRadius,borderAnimationEnabled:n?.borderAnimationEnabled}),g.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 overflow-hidden p-4",style:{backgroundColor:n?.fill&&n.fill!=="transparent"?n.fill:"#1E2533",borderRadius:n?.borderRadius},children:[n.iconSrc&&g.jsx("div",{className:"flex min-h-0 w-full flex-1 items-center justify-center",children:g.jsx("img",{alt:r??"",src:n.iconSrc,className:"size-full object-contain",onError:i=>{const s=i.target;s.src="/placeholder.svg"}})}),r&&g.jsx("p",{className:"shrink-0 text-center text-sm leading-tight font-medium break-words text-[#F4F7FC]",style:{fontSize:Math.max(12,(t??0)/10)},children:r})]}),g.jsx(g$,{fields:n.componentFields})]})}const OV=String.raw;function bV({id:n,data:e,selected:t}){const{updateNodeData:r,updateNode:i}=gn(),s=Tn(e.componentFields,{componentFieldId:"code"}),o=$.useRef(null),[a,l]=ur(s??"");function c(d){l(d),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{r(n,{componentFields:xi(e.componentFields??[],{code:d})})},1e3)}return g.jsxs(Si,{className:"relative isolate w-full rounded-[0.5rem] bg-transparent leading-0 outline-transparent",selected:t,onWheel:d=>{d.stopPropagation(),d.nativeEvent.stopImmediatePropagation()},children:[g.jsx(fr,{isVisible:t,handleClassName:"z-10",onResize:(d,h)=>{i(n,{width:h.width,height:h.height})}}),g.jsx(Jm,{id:`code-mirror-${n}`,value:a,onChange:c,fontSize:e?.fontSize||14,lineHeight:e?.lineHeight||2,className:"overflow-hidden rounded-[0.5rem]",style:{fontSize:e?.fontSize||14,lineHeight:e?.lineHeight||2,borderRadius:e?.borderRadius||0}}),g.jsx("style",{dangerouslySetInnerHTML:{__html:OV`
259
- #code-mirror-${n} .cm-editor {
260
- padding: ${e.strokeWidth}px;
261
- }
262
- `}}),g.jsx(Lg,{className:"pointer-events-none absolute inset-0 size-full",borderColor:e?.stroke,borderWidth:e?.strokeWidth,borderStyle:e?.strokeStyle,borderRadius:e?.borderRadius,borderAnimationEnabled:e?.borderAnimationEnabled})]})}const[yV,xV]=Up(({resourceId:n})=>{const e=Ju()?.id,[t,r]=$.useState(null),{data:i,loading:s}=ga(Z1,{fetchPolicy:"cache-first",variables:{orgId:e,resourceId:n},skip:!e}),o=[{query:Z1,variables:{orgId:e,resourceId:n}}],[a]=Yo(f7,{awaitRefetchQueries:!0,refetchQueries:o}),[l]=Yo(p7,{awaitRefetchQueries:!0,refetchQueries:o}),[c]=Yo(m7,{awaitRefetchQueries:!0,refetchQueries:o}),d=$.useMemo(()=>hi(i?.comments).map(m=>({commentId:m.id,resourceId:m.resourceId,parentCommentId:m.parentCommentId,text:m.text,createdBy:m.createdBy,createdAt:m.createdAt,authorName:m.createdByActor?.name,authorAvatarUrl:m.createdByActor?.avatarUrl})).sort((m,O)=>new Date(m.createdAt).getTime()-new Date(O.createdAt).getTime()),[i]),h=$.useCallback(async m=>{e&&await a({variables:{orgId:e,input:{resourceId:n,text:m.text,...m.parentCommentId?{parentCommentId:m.parentCommentId}:{}}}})},[e,n,a]),f=$.useCallback(async(m,O)=>{e&&await l({variables:{orgId:e,id:m,input:{text:O}}})},[e,l]),p=$.useCallback(async m=>{e&&await c({variables:{orgId:e,id:m}})},[e,c]);return{resourceId:n,comments:d,isLoading:s&&!i?.comments,createComment:h,updateComment:f,deleteComment:p,replyToCommentId:t,setReplyToCommentId:r}});function SV({comment:n,allComments:e,editingCommentId:t,editText:r,user:i,updatingCommentId:s,deletingCommentId:o,onEdit:a,onSaveEdit:l,onCancelEdit:c,onDelete:d,onReply:h,onEditTextChange:f}){const p=t===n.commentId,m=i?.userId===n.createdBy,O=n.authorAvatarUrl??"",b=n.authorName||"User",S=e.find(Q=>Q.commentId&&Q.commentId===n.parentCommentId)?.authorName,x=!!n.commentId&&s===n.commentId,k=!!n.commentId&&o===n.commentId,[v,w]=$.useState(!1);return g.jsxs(Wi.div,{className:V("space-y-2"),initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},children:[g.jsxs("div",{className:"flex items-start gap-2",children:[g.jsxs(ox,{className:"size-5 flex-shrink-0",children:[g.jsx(ax,{src:O||""}),g.jsx(lx,{className:"text-[10px]",children:(b.charAt(0)||"U").toUpperCase()})]}),g.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[13px] font-medium text-[#F4F7FC]",children:b}),g.jsx("span",{className:"text-[11px] text-[#828DA3]",children:n.createdAt?m$(n.createdAt):""})]}),p?g.jsxs("div",{className:"space-y-2",children:[g.jsx(f$,{forceFocus:!0,theme:"dark",value:r,setValue:f}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx(Nt,{preset:"primary",className:"h-8 px-3 text-xs",onClick:l,disabled:x,children:x?g.jsx(Hp,{className:"size-4!"}):"Save"}),g.jsx(Nt,{preset:"outline",className:"h-8 px-3 text-xs",onClick:c,disabled:x,children:"Cancel"})]})]}):g.jsxs(g.Fragment,{children:[!!n.parentCommentId&&g.jsxs("div",{className:"text-[11px] text-[#828DA3]",children:["Replying to"," ",g.jsx("span",{className:"font-medium text-[#F4F7FC]",children:S||"a comment"})]}),g.jsx("div",{className:"text-sm leading-snug text-[#F4F7FC]",children:g.jsx(p$,{theme:"dark",value:n.text??""})}),g.jsxs("div",{className:"flex items-center gap-1 text-[#828DA3]",children:[g.jsxs(Nt,{preset:"ghost",className:"-ml-3 h-7 px-2! text-[11px] font-medium text-[#828DA3] hover:text-[#F4F7FC]",onClick:()=>{n.commentId&&h(n.commentId,b)},children:[g.jsx(HC,{className:"mr-1 size-3"}),"Reply"]}),m&&g.jsxs(XC,{children:[g.jsx(LC,{asChild:!0,children:g.jsx(Nt,{preset:"ghost",className:"h-7 px-2! text-[11px] font-medium text-[#828DA3] hover:text-[#F4F7FC]",children:g.jsx(qC,{className:"size-3"})})}),g.jsxs(_C,{align:"start",className:"min-w-40 rounded-lg border-[#2A3242] bg-[#141925] p-1 text-[#F4F7FC] shadow-xl",children:[g.jsxs(Zg,{onClick:()=>{n.commentId&&a(n.commentId,n.text??"")},className:"cursor-pointer gap-2 rounded-md px-2.5 py-2 text-sm text-[#F4F7FC] focus:bg-[#1E2533] focus:text-[#F4F7FC]",children:[g.jsx(tP,{className:"size-4"}),"Edit"]}),g.jsxs(Zg,{onClick:()=>{n.commentId&&w(!0)},className:"text-destructive focus:text-destructive cursor-pointer gap-2 rounded-md px-2.5 py-2 text-sm focus:bg-[#1E2533]",disabled:k,children:[g.jsx(oC,{className:"size-4"}),"Delete"]})]})]})]})]})]})]}),g.jsx(IC,{open:v,onOpenChange:Q=>w(Q),title:"Delete comment?",description:"This action cannot be undone.",onConfirm:async()=>{n.commentId&&await d(n.commentId)}})]})}function kV({comments:n,isResolved:e,user:t,replyText:r,replyToName:i,editingCommentId:s,editText:o,isCreating:a,updatingCommentId:l,deletingCommentId:c,onToggleResolved:d,onClose:h,onReplyTextChange:f,onReply:p,onCancelReply:m,onEdit:O,onSaveEdit:b,onCancelEdit:y,onDelete:S,onReplyToAuthor:x,onEditTextChange:k}){return g.jsxs(Wi.div,{className:"absolute top-8 left-6 z-50 w-72 overflow-hidden rounded-lg border border-[#2A3242] bg-[#141925] shadow-lg",initial:{opacity:0,y:-20,scale:.9},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.9},transition:{type:"spring",stiffness:300,damping:30,duration:.1},children:[g.jsx("div",{className:"border-b border-[#2A3242] px-3 py-2.5",children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{className:"text-sm font-semibold text-[#F4F7FC]",children:"Comment"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsxs(Nt,{preset:"ghost",onClick:d,title:e?"Reopen comment":"Mark as resolved","aria-label":e?"Reopen comment":"Mark as resolved",className:V("h-7 px-2 text-xs font-medium text-[#828DA3] hover:text-[#F4F7FC]",e&&"text-emerald-400 hover:text-emerald-300"),children:[g.jsx(WC,{className:"size-3"}),g.jsx("span",{className:"ml-1",children:e?"Resolved":"Resolve"})]}),g.jsx(Nt,{preset:"ghost",onClick:h,title:"Deselect comment","aria-label":"Deselect comment",className:"size-7 p-0 text-[#828DA3] hover:text-[#F4F7FC]",children:g.jsx(zC,{className:"size-3.5"})})]})]})}),g.jsx("div",{onWheelCapture:v=>v.stopPropagation(),className:"max-h-96 overflow-x-hidden overflow-y-auto",children:g.jsx("div",{className:"divide-y divide-[#2A3242]",children:n.length===0?g.jsx("div",{className:"py-8 text-center text-sm text-[#828DA3]",children:"No comments yet. Start the conversation!"}):n.map(v=>g.jsx("div",{className:"p-3",children:g.jsx(SV,{comment:v,allComments:n,editingCommentId:s,editText:o,user:t,updatingCommentId:l,deletingCommentId:c,onEdit:O,onSaveEdit:b,onCancelEdit:y,onDelete:S,onReply:x,onEditTextChange:k})},v.commentId??v.createdAt??v.text))})}),g.jsx("div",{className:"border-t border-[#2A3242] px-3 py-2.5",children:g.jsxs("div",{className:"space-y-2",children:[!!i&&g.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[#2A3242] bg-[#1E2533] px-2.5 py-2 text-xs text-[#828DA3]",children:[g.jsxs("div",{className:"min-w-0 flex-1 truncate",children:["Replying to"," ",g.jsx("span",{className:"font-medium text-[#F4F7FC]",children:i})]}),g.jsx(Nt,{preset:"outline",disabled:a,onClick:m,className:"h-7 px-2 text-xs",children:"Cancel"})]}),g.jsxs("div",{className:"relative flex min-w-0 flex-1 items-end gap-2",children:[g.jsx("div",{className:"flex-1",children:g.jsx(f$,{forceFocus:!0,theme:"dark",value:r,setValue:f,className:"break-all"})}),g.jsx(Nt,{onClick:p,disabled:!r.trim()||a,preset:"primary",className:"size-9! p-0",children:a?g.jsx(Hp,{className:"size-4"}):g.jsx(JC,{className:"size-4!"})})]})]})})]})}function vV({comments:n,totalComments:e,onMouseEnter:t,onMouseLeave:r}){return g.jsx(Wi.div,{className:"absolute top-8 left-6 z-50 rounded-lg border border-[#2A3242] bg-[#141925] p-3 shadow-lg",onMouseEnter:t,onMouseLeave:r,initial:{opacity:0,y:-10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},transition:{type:"spring",stiffness:400,damping:25,duration:.1},children:n.length>0?g.jsx(wV,{comments:n,totalComments:e}):g.jsx("div",{className:"w-max text-xs text-[#828DA3]",children:"No comments yet"})})}function wV({comments:n,totalComments:e}){const t=n[0]?.authorAvatarUrl??"",r=n[0]?.authorName||"Anonymous";return g.jsxs("div",{className:"w-64 space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs(ox,{className:"size-5",children:[g.jsx(ax,{src:t||""}),g.jsx(lx,{className:"text-xs",children:(r.charAt(0)||"A").toUpperCase()})]}),g.jsx("span",{className:"text-xs font-medium text-[#F4F7FC]",children:r}),g.jsx("span",{className:"text-xs text-[#828DA3]",children:n[0]?.createdAt?m$(n[0].createdAt):""})]}),g.jsx("div",{className:"line-clamp-2 text-xs text-[#F4F7FC]",children:g.jsx(p$,{theme:"dark",value:n[0]?.text||"No comments yet"})}),e>1&&g.jsxs("div",{className:"text-xs text-[#828DA3]",children:["+",e-1," more"]})]})}function QV({...n}){return g.jsx(yV,{resourceId:n.id,children:g.jsx($V,{...n})})}function $V({...n}){const{id:e,data:t,selected:r,dragging:i}=n,{updateNodeData:s,setNodes:o}=gn(),a=X$(xe=>xe.user),l=a?{userId:a.userId,name:a.name,pic:a.avatarUrl??void 0}:null,c=Ju()?.id,{comments:d,createComment:h,updateComment:f,deleteComment:p}=xV(),[m,O]=$.useState(t?.isResolved||!1),[b,y]=$.useState(r),[S,x]=$.useState(!1),[k,v]=$.useState(""),[w,Q]=$.useState(null),[C,T]=$.useState(null),[P,R]=$.useState(null),[M,D]=$.useState(""),[N,I]=$.useState(!1),[Z,ne]=$.useState(null),[le,B]=$.useState(null);function se(xe){s(e,xe)}async function re(xe){const Ee=xe.trim();!Ee||!l?.userId||!c||(await h({text:Ee,parentCommentId:C??void 0}),v(""))}async function me(xe,Ee){const ut=Ee.trim();ut&&(await f(xe,ut),R(null),D(""))}async function $e(xe){await p(xe)}function G(){const xe=!m;O(xe),se({isResolved:xe})}async function fe(){if(!(!k.trim()||N)){I(!0);try{await re(k)}finally{I(!1),Q(null),T(null)}}}function Je(xe,Ee){Q(Ee),T(xe),v(`@${Ee} `)}function St(){Q(null),T(null),v("")}function On(xe,Ee){R(xe),D(Ee)}async function mt(){if(!(!P||!M.trim()||Z)){ne(P);try{await me(P,M)}finally{ne(null)}}}function Rn(){R(null),D("")}function br(xe){D(xe)}async function En(xe){if(!le){B(xe);try{await $e(xe)}finally{B(null)}}}return $.useEffect(()=>{y(r)},[r]),g.jsxs("div",{className:"pointer-events-auto relative isolate",style:{transform:"scale(var(--react-flow-counter-scale))"},children:[g.jsx(Wi.div,{className:V("flex size-8 cursor-pointer items-center justify-center rounded-full",m?"border-2 border-green-500 bg-green-100":"border-2 border-blue-500 bg-blue-100"),onClick:()=>y(!b),onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),whileHover:{scale:1.1},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:17},children:g.jsx(Wi.div,{className:V("size-2.5 rounded-full",m?"bg-green-600":"bg-blue-600"),animate:{scale:r?1.2:1},transition:{type:"spring",stiffness:400,damping:17}})}),g.jsx(uc,{children:d.length>0&&g.jsx(Wi.div,{className:"pointer-events-none absolute -top-1 -right-1 flex size-5 items-center justify-center rounded-full bg-red-500 text-xs text-white",initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:"spring",stiffness:400,damping:17},children:d.length})}),g.jsx(uc,{children:S&&!r&&!i&&g.jsx(vV,{comments:d,totalComments:d.length,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1)})}),g.jsx(uc,{children:r&&!i&&g.jsx(kV,{comments:d,isResolved:m,user:l,replyText:k,replyToName:w,editingCommentId:P,editText:M,isCreating:N,updatingCommentId:Z,deletingCommentId:le,onToggleResolved:G,onClose:()=>{y(!1),o(xe=>xe.map(Ee=>Ee.id===e?{...Ee,selected:!1}:Ee))},onReplyTextChange:v,onReply:fe,onCancelReply:St,onEdit:On,onSaveEdit:mt,onCancelEdit:Rn,onDelete:En,onReplyToAuthor:Je,onEditTextChange:br})})]})}function CV({data:n}){function e(t){const r=t.toLowerCase();return/(char|text|varchar|string)/.test(r)?"bg-violet-50 text-violet-700 border-violet-200":/(int|serial|decimal|numeric|float|double|real|number)/.test(r)?"bg-blue-50 text-blue-700 border-blue-200":/(bool)/.test(r)?"bg-emerald-50 text-emerald-700 border-emerald-200":/(date|time|timestamp)/.test(r)?"bg-amber-50 text-amber-700 border-amber-200":/(uuid)/.test(r)?"bg-accent/40 text-secondary-foreground border-stock":/(json|jsonb)/.test(r)?"bg-teal-50 text-teal-700 border-teal-200":"bg-accent/30 text-secondary-foreground border-stock"}return g.jsxs(g.Fragment,{children:[g.jsx("div",{children:g.jsxs(hx,{children:[g.jsx(fx,{children:g.jsxs(qo,{children:[g.jsx($r,{className:"text-paragraph w-[40%] px-3 py-2 text-xs",children:"Column"}),g.jsx($r,{className:"text-paragraph w-[15%] px-3 py-2 text-xs",children:"Type"}),g.jsx($r,{className:"text-paragraph w-[10%] px-3 py-2 text-xs",children:"Null"}),g.jsx($r,{className:"text-paragraph w-[20%] px-3 py-2 text-xs",children:"Default"}),g.jsx($r,{className:"text-paragraph w-[7.5%] px-3 py-2 text-xs",children:"Key"}),g.jsx($r,{className:"text-paragraph w-[7.5%] px-3 py-2 text-xs",children:"FK to"})]})}),g.jsx(px,{children:n.table.columns.map(t=>{const r=n.table.primaryKeys.includes(t.name),i=n.table.foreignKeys.find(s=>s.columnName===t.name);return g.jsxs(qo,{className:"odd:bg-accent/30/30 hover:bg-accent/30",children:[g.jsx(nr,{className:"px-3 py-2",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"font-medium",children:t.name}),t.description?g.jsx("span",{className:"text-paragraph text-[11px]",children:t.description}):null]})}),g.jsx(nr,{className:"text-secondary-foreground px-3 py-2",children:g.jsx(Yr,{variant:"outline",className:`border px-2 py-0.5 text-xs font-medium ${e(t.type)}`,children:t.type})}),g.jsx(nr,{className:"px-3 py-2",children:t.nullable?g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs text-emerald-700",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),"YES"]}):g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-rose-200 bg-rose-50 px-2 py-0.5 text-xs text-rose-700",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),"NO"]})}),g.jsx(nr,{className:"text-foreground px-3 py-2",children:t.defaultValue?g.jsx("code",{className:"bg-accent/40 text-secondary-foreground rounded px-2 py-0.5 text-xs",children:t.defaultValue}):g.jsx("span",{className:"text-muted-foreground",children:"-"})}),g.jsx(nr,{className:"px-3 py-2",children:g.jsx("div",{className:"flex flex-wrap gap-1.5",children:r?g.jsx(Yr,{variant:"secondary",className:"border border-sky-200 bg-sky-50 px-1.5 py-0 text-[11px] text-sky-700",children:"PK"}):null})}),g.jsx(nr,{className:"px-3 py-2",children:i?g.jsxs(Yr,{variant:"outline",className:"border border-teal-200 bg-teal-50 px-2 py-0.5 text-xs text-teal-700",children:[i.referencedTable,".",i.referencedColumn]}):g.jsx("span",{className:"text-muted-foreground",children:"-"})})]},t.name)})})]})}),g.jsxs("div",{className:"border-stock grid grid-cols-1 gap-2 border-t px-3 py-2",children:[n.table.primaryKeys.length>0?g.jsxs("div",{children:[g.jsx("div",{className:"text-paragraph mb-1 text-xs",children:"Primary keys"}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.table.primaryKeys.map(t=>g.jsx(Yr,{variant:"secondary",className:"rounded-full border border-sky-200 bg-sky-50 px-2 py-0.5 text-xs text-sky-700",children:t},t))})]}):null,n.table.foreignKeys.length>0?g.jsxs("div",{children:[g.jsx("div",{className:"text-paragraph mb-1 text-xs",children:"Foreign keys"}),g.jsx("div",{className:"grid gap-1",children:n.table.foreignKeys.map(t=>g.jsxs("div",{className:"text-foreground text-sm",children:[g.jsx(Yr,{variant:"outline",className:"mr-1 border border-teal-200 bg-teal-50 px-1.5 py-0 text-[11px] text-teal-700",children:t.columnName}),g.jsx("span",{className:"text-muted-foreground mx-1",children:"→"}),g.jsxs(Yr,{variant:"outline",className:"border border-teal-200 bg-teal-50 px-1.5 py-0 text-[11px] text-teal-700",children:[t.referencedTable,".",t.referencedColumn]})]},`${t.columnName}->${t.referencedTable}.${t.referencedColumn}`))})]}):null,n.table.indexes.length>0?g.jsxs("div",{children:[g.jsx("div",{className:"text-paragraph mb-1 text-xs",children:"Indexes"}),g.jsx("div",{className:"grid gap-1",children:n.table.indexes.map(t=>g.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[g.jsx("span",{className:"font-medium",children:t.name}),t.unique?g.jsx(Yr,{variant:"secondary",className:"border border-amber-200 bg-amber-100 px-1.5 py-0 text-[11px] text-amber-700",children:"UNIQUE"}):null,g.jsx("div",{className:"flex flex-wrap gap-1",children:t.columns.map(r=>g.jsx("code",{className:"bg-accent/40 text-secondary-foreground rounded px-1.5 py-0.5 text-xs",children:r},r))})]},t.name))})]}):null]})]})}function PV({data:n}){return g.jsxs("div",{className:"outline-stock [.selected_&]:outline-primary rounded-[0.5rem] bg-[#141925] outline [.selected_&]:shadow-[0_24px_40px_0_rgba(0,0,0,0.2)]",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-[#2A3242] px-3 py-2",children:[g.jsx("div",{className:"font-semibold text-[#F4F7FC]",children:n.table.name}),g.jsxs("div",{className:"rounded-full bg-[#1E2533] px-2 py-0.5 text-xs text-[#828DA3]",children:[n.table.columns.length," cols"]})]}),g.jsx(CV,{data:n})]})}function TV(n,e){const t=$.useRef(null),{dataTablesMap:r,setDataSources:i}=Zr(),s=Ka({databaseName:n,tableName:e,setDataSources:i}),o=$.useMemo(()=>r.get(`${n}@${e}`),[r,n,e]),a=$.useCallback((c,d=250)=>{function h(){const{databaseName:f,tableName:p,setDataSources:m}=s.current;m(O=>O.map(b=>b.name===f?{...b,schemaAst:{...b.schemaAst,tables:b.schemaAst.tables.map(y=>y.name===p?{...y,...c}:y)}}:b))}t.current&&clearTimeout(t.current),d>0?t.current=setTimeout(h,d):h()},[s,t]),l=$.useCallback(c=>{s.current.setDataSources(d=>d.map(h=>h.name===n?{...h,...c}:h))},[s,n]);return{table:o?.table??null,dataSource:o?.source??null,mongoCollectionSource:o?.mongoCollectionSource??null,setTable:a,setDataSource:l}}function MV(n,e){const t=Ju().id,r=ga(ZC,{fetchPolicy:"cache-first",skip:!t||!n,variables:{orgId:t}}),i=$.useMemo(()=>hi(r.data?.services.items).find(a=>a.name===n)?.id??null,[r.data,n]),s=ga(dC,{fetchPolicy:"cache-first",skip:!t||!i,variables:{orgId:t,serviceId:i}});return{serviceDb:$.useMemo(()=>hi(s.data?.serviceDBs).map(hC).find(a=>a.dbName===e)??null,[s.data,e]),loading:r.loading||s.loading}}function y$({dataSource:n,mongoCollectionSource:e}){const t=JSON.stringify(n.dialect==="dynamodb"?n.sourceContent??"{}":e??"{}",null,2);return g.jsxs("div",{className:"skip-wheel relative",children:[g.jsx(Jm,{readOnly:!0,basicSetup:{lineNumbers:!1,foldGutter:!1,foldKeymap:!1,searchKeymap:!1},value:t,editable:!1,maxHeight:"40rem"}),g.jsxs(Nt,{preset:"outline",className:"absolute top-3 right-3 h-9 px-3!",onClick:async()=>{await navigator.clipboard.writeText(t),Ku.success("JSON copied")},children:[g.jsx(Z$,{className:"size-5"}),"Copy"]})]})}function x$({dataSource:n,isForcedOpen:e,mongoCollectionSource:t}){function r(x){return typeof x=="object"&&x!==null&&!Array.isArray(x)}function i(x){return typeof x=="string"?x:null}function s(x){return typeof x=="boolean"?x:null}function o(x){return Array.isArray(x)?x:null}function a(x){return r(x)?x:null}function l(x,k){const v=[];for(let w=0;w<x.length;w++){const Q=x[w],C=a(Q);if(!C)continue;const T=i(C.name),P=i(C.type);if(!T||!P||s(C.required)===null)continue;const R=P==="object"?o(C.fields):null,M=P==="array"?i(C.itemType):null,D=P==="array"&&M==="object"?o(C.itemFields):null,N=P==="object"?R:P==="array"&&M==="object"?D:null;v.push({id:`${k}/${T}`,name:T,type:P==="array"?M?M==="object"?"object[]":`${M}[]`:"array":P,children:N})}return v}const c=n.dialect==="dynamodb"?{sourceRec:a(n.sourceContent)}:null,d=c?.sourceRec?{primaryKey:a(c.sourceRec.primaryKey),globalSecondaryIndexes:o(c.sourceRec.globalSecondaryIndexes)??[]}:null,h=n.dialect==="mongodb"&&t?o(a(t)?.fields):null,f=c?.sourceRec?o(c.sourceRec.attributes):null,p=h?l(h,"collection"):[],m=f?l(f,"dynamodb"):[],[O,b]=$.useState(()=>{const x=d?m:p;return new Set(x.filter(k=>(k.children?.length??0)>0).map(k=>k.id))});function y(x){b(k=>{const v=new Set(k);return v.has(x)?v.delete(x):v.add(x),v})}function S(x,k){return x.map(v=>{const w=v.children?l(v.children,v.id):[],Q=w.length>0,C=e||Q&&O.has(v.id),T=k*12;return g.jsx("div",{children:Q?g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",onClick:()=>y(v.id),className:"border-stock hover:bg-accent/30 block w-full border-b px-4 py-2 text-left transition-colors",children:g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",style:{paddingLeft:T},children:g.jsx("span",{className:"text-foreground truncate font-mono text-sm font-medium",children:v.name})}),g.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[g.jsx("span",{className:"text-paragraph font-mono text-xs",children:v.type}),g.jsx(BC,{className:V("text-muted-foreground h-3.5 w-3.5 transition-transform",C&&"rotate-90")})]})]})}),C?S(w,k+1):null]}):g.jsx("div",{className:"border-stock hover:bg-accent/30 border-b px-4 py-2 transition-colors",children:g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",style:{paddingLeft:T},children:g.jsx("span",{className:"text-foreground truncate font-mono text-sm font-medium",children:v.name})}),g.jsx("span",{className:"text-paragraph flex-shrink-0 font-mono text-xs",children:v.type})]})})},v.id)})}if(d){const x=d.primaryKey?i(d.primaryKey.partitionKey):null,k=d.primaryKey?i(d.primaryKey.partitionKeyType):null,v=d.primaryKey?i(d.primaryKey.sortKey):null,w=d.primaryKey?i(d.primaryKey.sortKeyType):null,Q=d.globalSecondaryIndexes;return g.jsxs("div",{children:[g.jsx("div",{className:"border-stock bg-accent/30 text-secondary-foreground border-b px-4 py-2 text-xs font-semibold",children:"Keys"}),g.jsx("div",{className:"border-stock hover:bg-accent/30 border-b px-4 py-2 transition-colors",children:g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("span",{className:"text-foreground truncate font-mono text-sm font-medium",children:"PK"}),g.jsx("span",{className:"text-paragraph flex-shrink-0 font-mono text-xs",children:x?`${x}${k?` (${k})`:""}`:"—"})]})}),g.jsx("div",{className:"border-stock hover:bg-accent/30 border-b px-4 py-2 transition-colors",children:g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("span",{className:"text-foreground truncate font-mono text-sm font-medium",children:"SK"}),g.jsx("span",{className:"text-paragraph flex-shrink-0 font-mono text-xs",children:v?`${v}${w?` (${w})`:""}`:"—"})]})}),g.jsxs("div",{className:"border-stock bg-accent/30 text-secondary-foreground border-b px-4 py-2 text-xs font-semibold",children:["GSIs (",Q.length,")"]}),Q.length>0?Q.map((C,T)=>{const P=a(C),R=P?i(P.name):null,M=P?i(P.partitionKey):null,D=P?i(P.partitionKeyType):null,N=P?i(P.sortKey):null,I=P?i(P.sortKeyType):null,Z=[M?`${M}${D?` (${D})`:""}`:null,N?`${N}${I?` (${I})`:""}`:null].filter(ne=>ne!==null).join(" / ");return g.jsx("div",{className:"border-stock hover:bg-accent/30 border-b px-4 py-2 transition-colors",children:g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("span",{title:R??`gsi_${T+1}`,className:"text-foreground max-w-[16ch] shrink-0 truncate font-mono text-sm font-medium",children:R??`gsi_${T+1}`}),g.jsx("span",{title:Z,className:"text-paragraph flex-1 flex-shrink-0 truncate font-mono text-xs",children:Z||"—"})]})},`${R??"gsi"}-${T}`)}):g.jsx("div",{className:"border-stock text-paragraph border-b px-4 py-2 text-sm",children:"No GSIs"}),g.jsx("div",{className:"border-stock bg-accent/30 text-secondary-foreground border-b px-4 py-2 text-xs font-semibold",children:"Attributes"}),m.length>0?S(m,0):g.jsx("div",{className:"border-stock text-paragraph border-b px-4 py-2 text-sm",children:"No attributes"})]})}return h?g.jsx("div",{children:p.length>0?S(p,0):g.jsx("div",{className:"border-stock text-paragraph border-b px-4 py-2 text-sm",children:"No fields"})}):g.jsx("div",{className:"h-[200px]",children:g.jsx("div",{className:"border-stock text-paragraph border-b px-4 py-2 text-sm",children:"Unsupported schema"})})}function AV(n){return pr({attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.80307 3.0431C10.0554 3.15525 10.1691 3.45073 10.0569 3.70307L6.05691 12.7031C5.94475 12.9554 5.64927 13.0691 5.39693 12.9569C5.14459 12.8448 5.03094 12.5493 5.14309 12.2969L9.14309 3.29693C9.25525 3.04459 9.55073 2.93094 9.80307 3.0431ZM4.33218 5.3763C4.53857 5.55976 4.55716 5.87579 4.3737 6.08218L2.66898 8L4.3737 9.91782C4.55716 10.1242 4.53857 10.4402 4.33218 10.6237C4.12579 10.8072 3.80975 10.7886 3.6263 10.5822L1.6263 8.33218C1.4579 8.14274 1.4579 7.85726 1.6263 7.66782L3.6263 5.41782C3.80975 5.21143 4.12579 5.19284 4.33218 5.3763ZM11.6678 5.3763C11.8742 5.19284 12.1902 5.21143 12.3737 5.41782L14.3737 7.66782C14.5421 7.85726 14.5421 8.14274 14.3737 8.33218L12.3737 10.5822C12.1902 10.7886 11.8742 10.8072 11.6678 10.6237C11.4614 10.4402 11.4428 10.1242 11.6263 9.91782L13.331 8L11.6263 6.08218C11.4428 5.87579 11.4614 5.55976 11.6678 5.3763Z"},child:[]}]})(n)}function _g({selected:n,tableName:e,baseColor:t,children:r,hasCodeMode:i,codeModeEnabled:s,onCodeModeEnable:o}){return g.jsx(Ja,{selected:n,children:g.jsxs("div",{className:V("border-stock bg-card relative min-w-[360px] overflow-hidden rounded-lg border-2 shadow-lg transition-[border-color]",n&&"border-primary"),children:[g.jsxs("div",{className:"bg-primary flex items-center justify-between gap-2 px-4 py-3",style:{backgroundColor:t},children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(sx,{className:"h-5 w-5 text-white"}),g.jsx("h3",{className:"truncate text-base font-semibold text-white",children:e})]}),i&&g.jsx(Nt,{onClick:()=>o?.(),preset:s?"outline":"primary",className:V("size-9 border-none!",!s&&"hover:bg-background/15"),children:g.jsx(AV,{className:"h-5 w-5"})})]}),g.jsx("div",{className:"bg-card",children:r})]})})}function S$({selected:n,tableName:e,style:t,indexes:r,foreignKeys:i,primaryKeys:s,columns:o,...a}){return g.jsxs(_g,{selected:n,tableName:e,baseColor:t?.baseColor,...a,children:[g.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:o.map((l,c)=>{const d=s.includes(l.name),h=i.some(f=>f.columnName===l.name);return g.jsxs("div",{className:`border-stock hover:bg-accent border-b px-4 py-2 transition-colors ${c===o.length-1?"border-b-0":""}`,children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[d&&g.jsx(Vg,{className:"h-3.5 w-3.5 flex-shrink-0 text-amber-500"}),h&&!d&&g.jsx(Vg,{className:"h-3.5 w-3.5 flex-shrink-0 text-blue-500"}),g.jsx("span",{className:"text-foreground truncate font-mono text-sm font-medium",children:l.name})]}),g.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:g.jsx("span",{className:"text-paragraph font-mono text-xs",children:l.type})})]}),h&&g.jsx("div",{className:"mt-1 ml-6",children:i.filter(f=>f.columnName===l.name).map((f,p)=>g.jsxs("div",{className:"flex items-center gap-1 text-xs text-blue-400",children:[g.jsx("span",{children:"→"}),g.jsxs("span",{className:"font-mono",children:[f.referencedTable,".",f.referencedColumn]})]},p))})]},l.name)})}),r&&r.length>0&&g.jsxs("div",{className:"border-stock bg-shading-gray border-t px-4 py-2",children:[g.jsxs("div",{className:"text-foreground mb-1 text-xs font-semibold",children:["Indexes (",r.length,")"]}),g.jsxs("div",{className:"space-y-1",children:[r.slice(0,3).map((l,c)=>g.jsxs("div",{className:"text-paragraph flex items-center gap-1 text-xs",children:[l.unique&&g.jsx(Yr,{variant:"outline",className:"h-4 px-1 py-0 text-[9px]",children:"UNIQUE"}),g.jsx("span",{className:"truncate font-mono",children:l.name})]},c)),r.length>3&&g.jsxs("div",{className:"text-paragraph text-xs",children:["+",r.length-3," more"]})]})]})]})}function k$({selected:n,tableName:e,isLoading:t,style:r}){return g.jsx(Ja,{selected:n,children:g.jsxs("div",{className:V("border-stock bg-card relative max-w-[350px] min-w-[280px] overflow-hidden rounded-lg border-2 shadow-lg transition-[border-color]",n&&"border-primary"),children:[g.jsxs("div",{className:"bg-primary flex items-center gap-2 px-4 py-3",style:{backgroundColor:r?.baseColor},children:[g.jsx(sx,{className:"h-5 w-5 text-white"}),g.jsx("h3",{className:"truncate text-base font-semibold text-white",children:e})]}),g.jsx("div",{className:"flex h-15 items-center justify-center gap-2",children:t?g.jsxs(g.Fragment,{children:[g.jsx(Hp,{}),"Loading table..."]}):g.jsx("p",{className:"text-paragraph text-sm",children:"Table not found"})})]})})}function RV(n){return n.data.localTable?g.jsx(EV,{...n}):n.data.serviceTable?g.jsx(NV,{...n}):null}function EV({data:n,selected:e}){const[t,r]=$.useState(!1),{table:i,dataSource:s,mongoCollectionSource:o}=TV(n.localTable.databaseName,n.localTable.tableName);if(s?.dialect==="mongodb"||s?.dialect==="dynamodb"||s?.dialect==="json")return g.jsxs(g.Fragment,{children:[e&&t&&g.jsxs(g.Fragment,{children:[g.jsx(wn,{resizeDirection:"horizontal",position:"top-left",minWidth:400}),g.jsx(wn,{resizeDirection:"horizontal",position:"top-right",minWidth:400}),g.jsx(wn,{resizeDirection:"horizontal",position:"bottom-left",minWidth:400}),g.jsx(wn,{resizeDirection:"horizontal",position:"bottom-right",minWidth:400})]}),g.jsx(_g,{hasCodeMode:!0,codeModeEnabled:t,onCodeModeEnable:()=>r(f=>!f),selected:e,baseColor:n.style?.baseColor,tableName:i?.name||"Unknown Table",children:t?g.jsx(y$,{table:i,dataSource:s,mongoCollectionSource:o}):g.jsx(x$,{table:i,dataSource:s,isForcedOpen:n.isForcedOpen??!1,mongoCollectionSource:o})})]});if(!i)return g.jsx(k$,{selected:e,tableName:n.localTable?.tableName??"Unknown Table",isLoading:!1,style:n.style});const l=i.constraints.find(f=>f.type==="primary_key")?.columns||i.columns.filter(f=>f.autoIncrement).map(f=>f.name),d=i.constraints.filter(f=>f.type==="foreign_key").flatMap(f=>f.columns.map((p,m)=>({columnName:p,referencedTable:f.referencedTable,referencedColumn:f.referencedColumns[m]??f.referencedColumns[0]}))),h=i.columns.map(f=>({name:f.name,type:f.dataType.name,isPrimaryKey:l.includes(f.name),isForeignKey:d.some(p=>p.columnName===f.name),nullable:f.nullable}));return g.jsx(S$,{indexes:i.indexes.map(f=>({name:f.name,columns:f.columns.map(p=>p.name),unique:f.unique})),selected:e,tableName:i.name,style:n.style,columns:h,primaryKeys:l,foreignKeys:d})}function NV({data:n,selected:e}){const{serviceName:t,databaseName:r,tableName:i}=n.serviceTable,{serviceDb:s,loading:o}=MV(t,r),[a,l]=$.useState(!1),c=$.useMemo(()=>{if(!s?.noSQLSchema)return null;try{const f=typeof s.noSQLSchema=="string"?JSON.parse(s.noSQLSchema):s.noSQLSchema;return s.dialect==="dynamodb"?f?.dynamo?.table??null:s.dialect==="mongodb"?f?.mongo?.collections??null:null}catch{return null}},[s?.noSQLSchema,s?.dialect]),d=$.useMemo(()=>s?.dialect!=="mongodb"||!c?null:(Array.isArray(c?.collections)?c.collections:Array.isArray(c)?c:null)?.find(p=>p.name===i)??null,[s?.dialect,c,i]),h=$.useMemo(()=>{if(!s?.tables?.length)return null;const f=s.tables.find(p=>p?.name===i);return f?{name:f.name??"",columns:hi(f.columns).map(p=>({name:p?.name??"",type:p?.type??"",isPrimaryKey:p?.isPrimaryKey??!1,isForeignKey:!1,nullable:p?.nullable??!1}))}:null},[s,i]);if(o||!c&&!h)return g.jsx(k$,{selected:e,tableName:i,isLoading:o,style:n.style});if(c){const f={id:s?.serviceDBId??"",name:i,sourceType:"manual",sourceContent:c,dialect:s.dialect,schemaAst:{tables:[],dialect:s.dialect},createdAt:0,modifiedAt:null};return g.jsxs(g.Fragment,{children:[e&&a&&g.jsxs(g.Fragment,{children:[g.jsx(wn,{resizeDirection:"horizontal",position:"top-left",minWidth:400}),g.jsx(wn,{resizeDirection:"horizontal",position:"top-right",minWidth:400}),g.jsx(wn,{resizeDirection:"horizontal",position:"bottom-left",minWidth:400}),g.jsx(wn,{resizeDirection:"horizontal",position:"bottom-right",minWidth:400})]}),g.jsx(_g,{hasCodeMode:!0,codeModeEnabled:a,onCodeModeEnable:()=>l(p=>!p),selected:e,baseColor:n.style?.baseColor,tableName:i,children:a?g.jsx(y$,{table:null,dataSource:f,mongoCollectionSource:d}):g.jsx(x$,{table:null,dataSource:f,isForcedOpen:n.isForcedOpen??!1,mongoCollectionSource:d})})]})}return g.jsx(S$,{indexes:[],selected:e,tableName:n.serviceTable.tableName,style:n.style,columns:h?.columns??[],primaryKeys:[],foreignKeys:[]})}const Wy="rgba(20, 25, 37, 0.35)",zy="#828DA3";function DV(n){const e=n.backgroundColor,t=n.borderColor;return e==="#FFFFFF"&&(!t||t==="#000000")?{backgroundColor:Wy,borderColor:zy}:{backgroundColor:e||Wy,borderColor:t||zy}}function jV({id:n,data:e,selected:t}){const{updateNodeData:r}=gn(),i=Tn(e.componentFields,{componentFieldId:"name"}),s=$.useRef(null),[o,a]=ur(i??"");function l(f){a(f),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{r(n,{componentFields:xi(e.componentFields??[],{name:f})})},250)}const c=e.autoLayout??!1,d=e.collapsed??!1;O$(n,c&&!d,"top");const h=DV(e);return g.jsxs("div",{className:"size-full rounded-[0.5rem]",style:{backgroundColor:h.backgroundColor,border:`2px dashed ${h.borderColor}`},children:[g.jsx(fr,{isVisible:t&&!c,minWidth:200,minHeight:150,keepAspectRatio:!1}),g.jsx(b$,{}),d&&g.jsx("div",{className:"flex size-full items-center justify-center px-[5%] text-center font-medium wrap-anywhere text-[#F4F7FC]",style:{fontSize:"var(--lod-font-size)"},children:o||"Frame"}),g.jsx(Zs,{value:o,placeholder:"",hidden:d,onKeyDown:f=>f.stopPropagation(),onMouseDown:f=>f.stopPropagation(),className:"pointer-events-auto absolute top-2 left-2 h-auto w-auto resize-none overflow-hidden border-none bg-transparent text-sm font-medium break-words text-[#F4F7FC] outline-none placeholder:text-[#828DA3]",onChange:f=>l(f.currentTarget.value)})]})}function IV({data:n,selected:e}){return g.jsxs(Si,{selected:e,className:"size-full overflow-hidden outline-transparent",children:[g.jsx(fr,{minWidth:20,minHeight:20,isVisible:e}),g.jsx("img",{src:n.src,alt:"React Flow Static Node",className:"size-full rounded-[0.5rem]"})]})}function Qe(n,e){const t={paintOrder:"stroke fill"};switch(n){case"dash":return{...t,animation:"stroke-fake-animation 8s linear infinite"};default:return t}}function XV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",cornerRadius:o=12,height:a=140,width:l=200}){const c=(Number(t)||0)/2,d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,h=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${l} ${a}`,preserveAspectRatio:"none",children:g.jsx("rect",{x:c,y:c,width:l-c*2,height:a-c*2,rx:o,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:h})})}function LV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",cornerRadius:o=40,height:a=140,width:l=200}){const c=(Number(t)||0)/2,d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,h=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${l} ${a}`,preserveAspectRatio:"none",children:g.jsx("rect",{x:c,y:c,width:l-c*2,height:a-c*2,rx:o,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:h})})}function _V({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=180,width:a=180}){const l=(Number(t)||0)/2,c=a/2,d=o/2,h=a/2-l,f=o/2-l,p=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,m=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("ellipse",{cx:c,cy:d,rx:h,ry:f,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:p,style:m})})}function BV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=200,width:a=200}){const l=(Number(t)||0)/2,c=a/2,d=o/2,h=`${c} ${l}, ${a-l} ${d}, ${c} ${o-l}, ${l} ${d}`,f=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,p=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("polygon",{points:h,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:f,style:p})})}function WV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=180,width:a=220}){const l=(Number(t)||0)/2,d=`${a/2} ${l}, ${a-l} ${o-l}, ${l} ${o-l}`,h=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,f=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("polygon",{points:d,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:h,style:f})})}function zV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=140,width:a=220}){const l=(Number(t)||0)/2,c=`${30+l} ${l}, ${a-l} ${l}, ${a-30-l} ${o-l}, ${l} ${o-l}`,d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,h=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("polygon",{points:c,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:h})})}function ZV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=140,width:a=220}){const l=(Number(t)||0)/2,c=`${40+l} ${l}, ${a-40-l} ${l}, ${a-l} ${o-l}, ${l} ${o-l}`,d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,h=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("polygon",{points:c,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:h})})}function FV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=140,width:a=220}){const l=(Number(t)||0)/2,c=`${40+l} ${l}, ${a-40-l} ${l}, ${a-l} 70, ${a-40-l} ${o-l}, ${40+l} ${o-l}, ${l} 70`,d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,h=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("polygon",{points:c,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:h})})}function VV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=160,width:a=220}){const l=(Number(t)||0)/2,c=o-l,d=Math.max(0,Math.min(o,a)*.12),h=`M ${l} ${l} H ${a-l} V ${c}
263
- Q ${a*.75} ${c-d}, ${a*.5} ${c}
264
- Q ${a*.25} ${c-d}, ${l} ${c} Z`,f=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,p=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("path",{d:h,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:f,style:p})})}function YV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=160,width:a=220}){const l=(Number(t)||0)/2,c=a/2,d=Math.max(0,a/2-l),h=Math.max(0,o-2*l),f=Math.max(1,Math.min(h*.18,d)),p=l+f,m=o-l-f,O=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,b=Qe(s);return g.jsxs("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:[g.jsx("rect",{x:l,y:p,width:a-l*2,height:m-p,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:O,style:b}),g.jsx("ellipse",{cx:c,cy:p,rx:d,ry:f,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:O,style:b}),g.jsx("ellipse",{cx:c,cy:m,rx:d,ry:f,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:O,style:b})]})}function qV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=140,width:a=220}){const l=(Number(t)||0)/2,c=Math.max(0,Math.min((o-2*l)/2,(a-2*l)/2)),d=`M ${l} ${l} H ${a-c-l} A ${c} ${c} 0 0 1 ${a-c-l} ${o-l} H ${l} Z`,h=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("path",{d,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:h,style:Qe(s)})})}function UV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=180,width:a=180}){const l=(Number(t)||0)/2,c=a/2,d=o/2,h=`${l} ${l}, ${a-l} ${l}, ${a-l} ${d}, ${c} ${o-l}, ${l} ${d}`,f=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("polygon",{points:h,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:f,style:Qe(s)})})}function GV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=60,width:a=160}){const l=(Number(t)||0)/2,c=Math.max(0,Math.min((o-l*2)/2,(a-l*2)/2)),d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("rect",{x:l,y:l,width:a-l*2,height:o-l*2,rx:c,ry:c,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:Qe(s)})})}function HV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",cornerRadius:o=6,height:a=80,width:l=140}){const c=(Number(t)||0)/2,d=Math.min(12,Math.min(l,a)*.08),h=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsxs("svg",{viewBox:`0 0 ${l} ${a}`,preserveAspectRatio:"none",children:[g.jsx("rect",{x:c+d,y:c+d,width:l-c*2-d,height:a-c*2-d,rx:o,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:h,style:Qe(s)}),g.jsx("rect",{x:c+d/2,y:c+d/2,width:l-c*2-d/2,height:a-c*2-d/2,rx:o,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:h,style:Qe(s)}),g.jsx("rect",{x:c,y:c,width:l-c*2,height:a-c*2,rx:o,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:h,style:Qe(s)})]})}function KV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",cornerRadius:o=6,height:a=100,width:l=160}){const c=(Number(t)||0)/2,d=Math.max(2,Math.min(8,t)),h=Math.max(8,l*.06),f=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsxs("svg",{viewBox:`0 0 ${l} ${a}`,preserveAspectRatio:"none",children:[g.jsx("rect",{x:c,y:c,width:l-c*2,height:a-c*2,rx:o,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:f,style:Qe(s)}),g.jsx("rect",{x:c+h,y:c+6,width:d,height:a-c*2-12,fill:e}),g.jsx("rect",{x:l-c-h-d,y:c+6,width:d,height:a-c*2-12,fill:e})]})}function JV({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=100,width:a=160}){const l=(Number(t)||0)/2,c=Math.min(40,a*.12),d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,h=l+c,f=`${l} ${h}, ${a-l} ${l}, ${a-l} ${o-l}, ${l} ${o-l}`,p=Qe(s);return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("polygon",{points:f,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:p})})}function eY({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=100,width:a=100}){const l=(Number(t)||0)/2,c=a/2,d=o/2,h=Math.max(0,Math.min(a,o)/2-l),f=h*.7,p=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,m=Qe(s);return g.jsxs("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:[g.jsx("circle",{cx:c,cy:d,r:h,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:p,style:m}),g.jsx("line",{x1:c-f,y1:d-f,x2:c+f,y2:d+f,stroke:e,strokeWidth:Math.max(1,t/1.5),strokeOpacity:r,strokeLinecap:"round",style:m}),g.jsx("line",{x1:c-f,y1:d+f,x2:c+f,y2:d-f,stroke:e,strokeWidth:Math.max(1,t/1.5),strokeOpacity:r,strokeLinecap:"round",style:m})]})}function tY({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",cornerRadius:o=6,height:a=100,width:l=140}){const c=(Number(t)||0)/2,d=Math.max(2,Math.min(8,t)),h=Math.max(6,l*.04),f=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsxs("svg",{viewBox:`0 0 ${l} ${a}`,preserveAspectRatio:"none",children:[g.jsx("rect",{x:c,y:c,width:l-c*2,height:a-c*2,rx:o,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:f,style:Qe(s)}),g.jsx("rect",{x:c,y:c+6,width:l-c*2,height:Math.max(2,t/1.5),fill:e}),g.jsx("rect",{x:l-h-d,y:c+8,width:d,height:a-c*2-16,fill:e}),g.jsx("rect",{x:l-h*2-d*2,y:c+8,width:d,height:a-c*2-16,fill:e})]})}function nY({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=140,width:a=140}){const l=(Number(t)||0)/2,c=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,d=`${l} ${l}, ${a-l} ${l}, ${a/2} ${o/2}`,h=`${l} ${o-l}, ${a-l} ${o-l}, ${a/2} ${o/2}`;return g.jsxs("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:[g.jsx("polygon",{points:d,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:c,style:Qe(s)}),g.jsx("polygon",{points:h,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:c,style:Qe(s)})]})}function rY({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=140,width:a=140}){const l=(Number(t)||0)/2,c=a/2,d=o/2,h=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0,f=`${c} ${l}, ${a-l} ${d}, ${c} ${o-l}, ${l} ${d}`,p=Math.min(a-2*l,o-2*l)*.22,m=`${c} ${l+p}, ${a-l-p} ${d}, ${c} ${o-l-p}, ${l+p} ${d}`;return g.jsxs("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:[g.jsx("polygon",{points:f,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:h,style:Qe(s)}),g.jsx("polygon",{points:m,fill:"none",stroke:e,strokeWidth:Math.max(1,t/1.5),strokeOpacity:r})]})}function iY({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=100,width:a=100}){const l=(Number(t)||0)/2,c=a/2,d=o/2,h=Math.max(0,Math.min(a,o)/2-l),f=h*.7,p=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsxs("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:[g.jsx("circle",{cx:c,cy:d,r:h,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:p,style:Qe(s)}),g.jsx("line",{x1:c-f,y1:d,x2:c+f,y2:d,stroke:e,strokeWidth:Math.max(1,t/1.5),strokeOpacity:r,strokeLinecap:"round"}),g.jsx("line",{x1:c,y1:d-f,x2:c,y2:d+f,stroke:e,strokeWidth:Math.max(1,t/1.5),strokeOpacity:r,strokeLinecap:"round"})]})}function sY({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=400,width:a=220}){const l=(Number(t)||0)/2,c=a/2,d=Math.max(0,a/2-l),h=Math.max(1,(o-2*l)/2-1),f=Math.max(2,(a-2*l)*.18),p=Math.min(f,h),m=l+p,O=o-l-p,b=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsxs("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:[g.jsx("rect",{x:l,y:m,width:a-l*2,height:O-m,fill:n,stroke:"none"}),g.jsx("line",{x1:l,y1:m,x2:l,y2:O,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:b,style:Qe(s)}),g.jsx("line",{x1:a-l,y1:m,x2:a-l,y2:O,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:b,style:Qe(s)}),g.jsx("ellipse",{cx:c,cy:m,rx:d,ry:p,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:b,style:Qe(s)}),g.jsx("ellipse",{cx:c,cy:O,rx:d,ry:p,fill:"none",stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:b,style:Qe(s)})]})}function oY({fill:n="transparent",stroke:e="#d2d9e6",strokeWidth:t=4,strokeOpacity:r=1,strokeStyle:i="solid",strokeAnimation:s="none",height:o=140,width:a=220}){const l=(Number(t)||0)/2,c=`M ${l} ${l} H ${a-40-l} Q ${a-l} ${o/2} ${a-40-l} ${o-l} H ${l} Z`,d=i==="dashed"?"8,4":i==="dotted"?"2,2":void 0;return g.jsx("svg",{viewBox:`0 0 ${a} ${o}`,preserveAspectRatio:"none",children:g.jsx("path",{d:c,fill:n,stroke:e,strokeWidth:t,strokeOpacity:r,strokeDasharray:d,style:Qe(s)})})}const Fp=[{id:"rectangle",label:"Rectangle",Component:XV,hasCornerRadius:!0,recommendedWidth:200,recommendedHeight:140,getTextInset:({width:n,height:e})=>{const t=Math.max(8,Math.min(n,e)*.06);return{top:t,right:t,bottom:t,left:t}}},{id:"rounded-rect",label:"Rounded Rectangle",Component:LV,hasCornerRadius:!0,recommendedWidth:200,recommendedHeight:140,getTextInset:({width:n,height:e})=>{const t=Math.max(8,Math.min(n,e)*.06),r=Math.min(n,e)*.04,i=t+r;return{top:i,right:i,bottom:i,left:i}}},{id:"ellipse",label:"Ellipse",Component:_V,recommendedWidth:180,recommendedHeight:180,getTextInset:({width:n,height:e})=>{const t=Math.max(8,n*.1465),r=Math.max(8,e*.1465);return{top:r,right:t,bottom:r,left:t}}},{id:"diamond",label:"Diamond",Component:BV,recommendedWidth:200,recommendedHeight:200,getTextInset:({width:n,height:e})=>{const t=Math.max(8,n*.25),r=Math.max(8,e*.25);return{top:r,right:t,bottom:r,left:t}}},{id:"triangle",label:"Triangle",Component:WV,recommendedWidth:220,recommendedHeight:180,getTextInset:({width:n,height:e})=>{const t=Math.max(12,n*.18),r=Math.max(12,e*.22),i=Math.max(12,e*.06);return{top:r,right:t,bottom:i,left:t}}},{id:"parallelogram",label:"Parallelogram",Component:zV,recommendedWidth:220,recommendedHeight:140,getTextInset:()=>({top:12,right:30,bottom:12,left:30})},{id:"trapezoid",label:"Trapezoid",Component:ZV,recommendedWidth:220,recommendedHeight:140,getTextInset:()=>({top:12,right:40,bottom:12,left:40})},{id:"hexagon",label:"Hexagon",Component:FV,recommendedWidth:220,recommendedHeight:140,getTextInset:()=>({top:12,right:40,bottom:12,left:40})},{id:"document",label:"Document",Component:VV,recommendedWidth:220,recommendedHeight:160,getTextInset:({width:n,height:e})=>{const t=Math.min(n,e)*.12,r=12,i=12,s=Math.max(12,t+8);return{top:i,right:r,bottom:s,left:r}}},{id:"cylinder",label:"Cylinder",Component:YV,recommendedWidth:220,recommendedHeight:160,getTextInset:({width:n,height:e})=>{const t=Math.min(e*.18,n*.5),r=12,i=Math.max(12,t+8);return{top:i,right:r,bottom:i,left:r}}},{id:"delay",label:"Delay",Component:qV,recommendedWidth:220,recommendedHeight:140,getTextInset:({width:n,height:e})=>{const t=Math.min(n*.5,e*.5),r=12,i=12,s=Math.max(16,t);return{top:r,right:s,bottom:r,left:i}}},{id:"off-page-connector",label:"Off-page Connector",Component:UV,recommendedWidth:180,recommendedHeight:180,getTextInset:({width:n,height:e})=>{const t=Math.max(12,n*.18),r=12,i=Math.max(12,e*.28);return{top:r,right:t,bottom:i,left:t}}},{id:"display",label:"Display",Component:oY,recommendedWidth:220,recommendedHeight:140,getTextInset:()=>({top:12,right:40,bottom:12,left:12})},{id:"collate",label:"Collate",Component:nY,recommendedWidth:140,recommendedHeight:140,getTextInset:({height:n})=>{const e=Math.max(12,n*.28),t=12;return{top:e,right:t,bottom:e,left:t}}},{id:"sort",label:"Sort",Component:rY,recommendedWidth:140,recommendedHeight:140,getTextInset:({width:n,height:e})=>{const t=Math.max(8,n*.22),r=Math.max(8,e*.22);return{top:r,right:t,bottom:r,left:t}}},{id:"terminator",label:"Terminator",Component:GV,recommendedWidth:160,recommendedHeight:60,getTextInset:({height:n})=>{const e=Math.max(12,n/2),t=12;return{top:t,right:e,bottom:t,left:e}}},{id:"or",label:"Or",Component:iY,recommendedWidth:100,recommendedHeight:100,getTextInset:({width:n,height:e})=>{const t=Math.max(8,n*.1465),r=Math.max(8,e*.1465);return{top:r,right:t,bottom:r,left:t}}},{id:"database",label:"Database",Component:sY,recommendedWidth:220,recommendedHeight:400,getTextInset:({width:n,height:e})=>{const t=Math.min(e*.18,n*.5),r=12,i=Math.max(60,t+8);return{top:i*1.6,right:r,bottom:i,left:r}}},{id:"multiple-documents",label:"Multiple Documents",Component:HV,hasCornerRadius:!0,recommendedWidth:140,recommendedHeight:80,getTextInset:({width:n,height:e})=>{const t=Math.max(10,Math.min(n,e)*.08);return{top:t,right:t,bottom:t,left:t}}},{id:"subroutine",label:"Subroutine",Component:KV,hasCornerRadius:!0,recommendedWidth:160,recommendedHeight:100,getTextInset:({width:n})=>{const e=Math.max(12,n*.1),t=12;return{top:t,right:e,bottom:t,left:e}}},{id:"manual-input",label:"Manual Input",Component:JV,recommendedWidth:160,recommendedHeight:100,getTextInset:({width:n})=>{const e=Math.min(40,n*.12),t=Math.max(12,e),r=12;return{top:t,right:r,bottom:r,left:r}}},{id:"summing-junction",label:"Summing Junction",Component:eY,recommendedWidth:200,recommendedHeight:200,isAspectLocked:!0,getTextInset:({width:n,height:e})=>{const t=Math.max(8,n*.1465),r=Math.max(8,e*.1465);return{top:r,right:t,bottom:r,left:t}}},{id:"internal-storage",label:"Internal Storage",Component:tY,hasCornerRadius:!0,recommendedWidth:140,recommendedHeight:100,getTextInset:({width:n})=>{const e=Math.max(16,n*.14),t=12;return{top:18,right:e,bottom:t,left:t}}}];Object.fromEntries(Fp.map(n=>[n.id,n.Component]));function Zy({id:n,data:e,width:t,height:r,selected:i}){const{updateNodeData:s,updateNode:o}=gn(),a=Tn(e.componentFields,{componentFieldId:"name"}),l=$.useRef(null),c=$.useRef(null),d=$.useRef(null),[h,f]=ur(a??"");function p(w){f(w),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{s(n,{componentFields:xi(e.componentFields??[],{name:w})})},250)}const[m,O]=$.useState(null),b=$.useMemo(()=>Fp.find(w=>w.id===e.shape)??Fp[0],[e.shape]),y=$.useMemo(()=>{if(e?.textColor)return e.textColor;const w=e?.fill;if(typeof w!="string")return;const Q=w.trim().replace("#","");if(Q.length!==6)return;const C=parseInt(Q.slice(0,2),16),T=parseInt(Q.slice(2,4),16),P=parseInt(Q.slice(4,6),16);if((.299*C+.587*T+.114*P)/255>.6)return"#0f172a"},[e?.textColor,e?.fill]),S=$.useMemo(()=>!b?.getTextInset||!t||!r?{top:0,right:0,bottom:0,left:0}:b.getTextInset({width:t,height:r}),[b,t,r]);$.useEffect(()=>{const w=l.current;if(!w)return;function Q(){O({width:w.clientWidth,height:w.clientHeight})}const C=new ResizeObserver(Q);return C.observe(w),Q(),()=>C.disconnect()},[]);const x=m?.width&&t?Math.max(m.width,t):void 0,k=m?.height&&r?Math.max(m.height,r):void 0,v=Ka({width:t,height:r,shapeWidth:x,shapeHeight:k});return g.jsxs(Ja,{ref:l,selected:i,onDoubleClick:()=>c.current?.focus(),className:"relative flex size-full min-h-fit min-w-fit items-center justify-center [&>svg]:size-full!",children:[g.jsx(fr,{isVisible:i,keepAspectRatio:b?.isAspectLocked??!1}),b&&g.jsx("div",{className:"absolute inset-0 -z-10 [&>svg]:size-full",children:g.jsx(b.Component,{...e,strokeStyle:e.strokeAnimation==="dash"?"dashed":e.strokeStyle,width:x,height:k})}),g.jsx("style",{dangerouslySetInnerHTML:{__html:`
265
- @keyframes stroke-fake-animation {
266
- from { stroke-dashoffset: 0; }
267
- to { stroke-dashoffset: 100%; }
268
- }`}}),e.sequenceNumber!==void 0&&g.jsx("div",{className:"bg-muted text-muted-foreground absolute -top-2 -left-2 flex size-5 items-center justify-center rounded-full text-[10px] font-medium",children:e.sequenceNumber}),g.jsx(Zs,{ref:c,value:h,className:"text-foreground w-full resize-none overflow-hidden border-none bg-transparent text-center text-sm break-words outline-none",style:{marginTop:S.top,marginLeft:S.left,marginRight:S.right,marginBottom:S.bottom,fontSize:e?.textFontSize||14,color:y},onChange:w=>{p(w.target.value);const Q=v.current.height,C=w.target.clientHeight;Q&&Q>C||o(n,{height:C})}})]})}function aY({id:n,data:e,selected:t}){const{updateNodeData:r,updateNode:i}=gn(),s=Tn(e.componentFields,{componentFieldId:"text"}),o=$.useRef(null),[a,l]=ur(s??"");function c(d){l(d),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{r(n,{componentFields:xi(e.componentFields??[],{text:d})})},1e3)}return g.jsxs(Si,{className:"relative isolate w-full rounded-[0.5rem] bg-transparent leading-0 outline-transparent",style:{borderRadius:e?.borderRadius||8},selected:t,onWheel:d=>{d.stopPropagation(),d.nativeEvent.stopImmediatePropagation()},children:[g.jsx(fr,{isVisible:t,handleClassName:"z-10",onResize:(d,h)=>{i(n,{width:h.width,height:h.height})}}),g.jsx(Lg,{className:"pointer-events-none absolute inset-0 size-full",borderColor:e?.stroke,borderWidth:e?.strokeWidth,borderStyle:e?.strokeStyle,borderRadius:e?.borderRadius,borderAnimationEnabled:e?.borderAnimationEnabled}),g.jsx(Zs,{value:a,placeholder:"Add text",onKeyDown:d=>d.stopPropagation(),onMouseDown:d=>d.stopPropagation(),onChange:d=>c(d.currentTarget.value),className:V("h-auto w-auto max-w-full cursor-grab resize-none bg-transparent px-3 py-2 outline-none",t&&"cursor-text active:cursor-grabbing"),style:{borderStyle:"solid",borderColor:"transparent",borderWidth:e?.strokeWidth,borderRadius:e?.borderRadius,fontSize:e?.fontSize||14,fontWeight:e?.fontWeight||400,lineHeight:e?.lineHeight||1.5,fontFamily:e?.fontFamily||"inherit",backgroundColor:e?.fill||"transparent",color:e?.color||"var(--foreground)"},onWheel:d=>{d.stopPropagation(),d.nativeEvent.stopImmediatePropagation()}})]})}const lY={default:Zy,builder:oV,comment:QV,gif:KF,group:jV,shape:Zy,cloud:gV,image:IV,sequenceParticipant:qF,table:HF,code:bV,text:aY,databaseTableSQL:RV,dataTableInterface:PV,c4:lT,c4Boundary:mV,subDiagram:fT};function cY(n){return pr({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M217.9 256L345 129c9.4-9.4 9.4-24.6 0-33.9-9.4-9.4-24.6-9.3-34 0L167 239c-9.1 9.1-9.3 23.7-.7 33.1L310.9 417c4.7 4.7 10.9 7 17 7s12.3-2.3 17-7c9.4-9.4 9.4-24.6 0-33.9L217.9 256z"},child:[]}]})(n)}function Fy(n,e){const t=Vy(n),r=Vy(e),i=Math.abs(t.x-r.x),s=Math.abs(t.y-r.y);let o;i>s?o=t.x>r.x?ge.Left:ge.Right:o=t.y>r.y?ge.Top:ge.Bottom;const[a,l]=uY(n,o);return[a,l,o]}function uY(n,e){const t=n.internals.handleBounds?.source?.find(a=>a.position===e);if(!t)return[n.internals.positionAbsolute.x+n.measured.width/2,n.internals.positionAbsolute.y+n.measured.height/2];let r=t.width/2,i=t.height/2;switch(e){case ge.Left:r=0;break;case ge.Right:r=t.width;break;case ge.Top:i=0;break;case ge.Bottom:i=t.height;break}const s=n.internals.positionAbsolute.x+t.x+r,o=n.internals.positionAbsolute.y+t.y+i;return[s,o]}function Vy(n){return{x:n.internals.positionAbsolute.x+n.measured.width/2,y:n.internals.positionAbsolute.y+n.measured.height/2}}function dY(n,e){const[t,r,i]=Fy(n,e),[s,o,a]=Fy(e,n);return{sx:t,sy:r,tx:s,ty:o,sourcePos:i,targetPos:a}}const hY=28,Yy=8;function fY(n){const e=new Map;for(const r of n){if(r.hidden||r.source===r.target)continue;const i=r.source<r.target?`${r.source}|${r.target}`:`${r.target}|${r.source}`,s=e.get(i);s?s.push(r):e.set(i,[r])}const t=new Map;for(const r of e.values())r.length<2||r.forEach((i,s)=>{t.set(i.id,(s-(r.length-1)/2)*hY)});return n.map(r=>{const i=t.get(r.id)??0;return r.data?.parallelOffset===i||r.data?.parallelOffset===void 0&&i===0?r:{...r,data:{...r.data,parallelOffset:i}}})}function oc(n,{x:e,y:t,position:r,width:i,height:s}){if(r===ge.Left||r===ge.Right){const o=Math.max(s/2-Yy,0);return{x:e,y:t+qy(n,o)}}if(r===ge.Top||r===ge.Bottom){const o=Math.max(i/2-Yy,0);return{x:e+qy(n,o),y:t}}throw new Error(`Unknown handle position: ${r}`)}function qy(n,e){return Math.max(-e,Math.min(e,n))}function v$(n,e,t,r){const i=n+(r?.source??0),s=n+(r?.target??0);return{sourceX:i===0?e.x:oc(i,e).x,sourceY:i===0?e.y:oc(i,e).y,targetX:s===0?t.x:oc(s,t).x,targetY:s===0?t.y:oc(s,t).y}}const Uy=5;function w$({sourceX:n,sourceY:e,targetX:t,targetY:r}){return g.jsxs(g.Fragment,{children:[g.jsx("circle",{r:Uy,className:"react-flow__edge-endpoint",style:{transform:`translate(${n}px, ${e}px) scale(var(--react-flow-counter-scale))`}}),g.jsx("circle",{r:Uy,className:"react-flow__edge-endpoint",style:{transform:`translate(${t}px, ${r}px) scale(var(--react-flow-counter-scale))`}})]})}function pY({id:n,data:e,label:t,labelStyle:r,style:i,source:s,target:o,selected:a,markerEnd:l,markerStart:c}){const d=Rc(s),h=Rc(o),f=e?.labelFontSize??12,p=!!e?.reverseAnimation,m=$.useRef(null),[O,b]=$.useState({width:0,height:0});if($.useEffect(()=>{if(m.current){const{width:ne,height:le}=m.current.getBBox();b({width:ne,height:le})}},[t,f]),!d||!h)return null;const{sx:y,sy:S,tx:x,ty:k,sourcePos:v,targetPos:w}=dY(d,h),Q=e?.parallelOffset??0,C=e?.hubOffset,{sourceX:T,sourceY:P,targetX:R,targetY:M}=v$(Q,{x:y,y:S,position:v,...xa(d)},{x,y:k,position:w,...xa(h)},C),[D]=cx({sourceX:T,sourceY:P,sourcePosition:v,targetPosition:w,targetX:R,targetY:M}),N=e?.labelOffset,I=(T+R)/2+(N?.x??0),Z=(P+M)/2+(N?.y??0);return g.jsxs("g",{children:[g.jsx("path",{id:n,d:D,className:"react-flow__edge-path",style:{stroke:"transparent",strokeWidth:20}}),g.jsx("path",{id:n,className:"react-flow__edge-path",d:D,markerEnd:l,markerStart:c,style:p?{...i,animationDirection:"reverse"}:i}),a&&g.jsx(w$,{sourceX:T,sourceY:P,targetX:R,targetY:M}),t&&g.jsxs(g.Fragment,{children:[g.jsx("rect",{x:I-O.width/2-4,y:Z-O.height/2-2,width:O.width+8,height:O.height+4,fill:r?.backgroundColor??"#1e2533",rx:4,ry:4,style:{pointerEvents:"none",userSelect:"none"}}),g.jsx("text",{ref:m,x:I,y:Z,textAnchor:"middle",dominantBaseline:"middle",fill:r?.color??"#f4f7fc",style:{pointerEvents:"none",userSelect:"none",fontSize:f},children:t})]})]})}function Gu(n,e){return Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2)}function mY(n){const e=[];for(const t of n){const r=e[e.length-1];r&&r.x===t.x&&r.y===t.y||e.push(t)}for(let t=e.length-2;t>=1;t--){const r=e[t-1],i=e[t],s=e[t+1];(r.x===i.x&&i.x===s.x||r.y===i.y&&i.y===s.y)&&e.splice(t,1)}return e}function gY(n){const[e]=cf({...n,borderRadius:0}),t=/[ML]\s*(-?[\d.]+)[\s,]+(-?[\d.]+)/g,r=[];let i=t.exec(e);for(;i;)r.push({x:Number(i[1]),y:Number(i[2])}),i=t.exec(e);return mY(r)}function Gy(n){const e=[];for(let t=0;t<n.length-1;t++){const r=n[t],i=n[t+1];if(r.x===i.x)e.push({index:t,axis:"x",from:r,to:i});else if(r.y===i.y)e.push({index:t,axis:"y",from:r,to:i});else throw new Error(`Route segment ${t} is not orthogonal`)}return e}function OY(n){return n.map(e=>e.axis).join("")}function bY(n,e){if(!n||typeof n!="object")return null;const t=n;return t.axes!==e||!Array.isArray(t.offsets)||t.offsets.length!==e.length||t.offsets.some(r=>!Number.isFinite(r))?null:{axes:e,offsets:t.offsets}}function yY(n,e,t){const r=n.map(i=>({...i}));for(let i=1;i<e.length-1;i++){const s=t[i];if(s!==0)if(e[i]==="x")r[i].x+=s,r[i+1].x+=s;else if(e[i]==="y")r[i].y+=s,r[i+1].y+=s;else throw new Error(`Unknown route axis: ${e[i]}`)}return r}function xY(n,e,t,r){const i=Math.min(Gu(n,e)/2,Gu(e,t)/2,r),{x:s,y:o}=e;if(n.x===s&&s===t.x||n.y===o&&o===t.y)return`L${s} ${o}`;if(n.y===o){const c=n.x<t.x?-1:1,d=n.y<t.y?1:-1;return`L ${s+i*c},${o}Q ${s},${o} ${s},${o+i*d}`}const a=n.x<t.x?1:-1,l=n.y<t.y?-1:1;return`L ${s},${o+i*l}Q ${s},${o} ${s+i*a},${o}`}function SY(n,e){const t=n[n.length-1];let r=`M${n[0].x} ${n[0].y}`;for(let i=1;i<n.length-1;i++)r+=xY(n[i-1],n[i],n[i+1],e);return`${r}L${t.x} ${t.y}`}function kY(n){let e=0;for(let i=0;i<n.length-1;i++)e+=Gu(n[i],n[i+1]);let t=e/2;for(let i=0;i<n.length-1;i++){const s=n[i],o=n[i+1],a=Gu(s,o);if(t<=a){const l=a===0?0:t/a;return[s.x+(o.x-s.x)*l,s.y+(o.y-s.y)*l]}t-=a}const r=n[n.length-1];return[r.x,r.y]}const vY=14,wY=6,QY="#0059ea";function $Y({edgeId:n,axes:e,offsets:t,segments:r,draft:i,onDraft:s}){const{screenToFlowPosition:o}=gn(),a=Zr(),[l,c]=$.useState(null);function d(f){a.setEdges(p=>p.map(m=>{if(m.id!==n)return m;if(f===null){const O={...m.data};return delete O.routing,{...m,data:O}}return{...m,data:{...m.data,routing:{axes:e,offsets:f}}}}))}function h(f,p){f.preventDefault();const m=o({x:f.clientX,y:f.clientY}),O=t[p.index],b=document.body.style.cursor,y=document.body.style.userSelect;document.body.style.cursor=p.axis==="x"?"col-resize":"row-resize",document.body.style.userSelect="none";let S=null;function x(v){const w=o({x:v.clientX,y:v.clientY});S=Math.round(O+w[p.axis]-m[p.axis]),s({index:p.index,value:S})}function k(){window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k),document.body.style.cursor=b,document.body.style.userSelect=y;const v=S;if(s(null),v===null||v===O)return;const w=t.map((Q,C)=>C===p.index?v:Q);d(w.every(Q=>Q===0)?null:w)}window.addEventListener("pointermove",x),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k)}return g.jsx(g.Fragment,{children:r.map(f=>{if(f.index===0||f.index===r.length-1)return null;const p=`M ${f.from.x} ${f.from.y} L ${f.to.x} ${f.to.y}`,m=i?.index===f.index||l===f.index;return g.jsxs("g",{children:[m&&g.jsx("path",{d:p,fill:"none",stroke:QY,strokeWidth:wY,strokeOpacity:.35,strokeLinecap:"round",vectorEffect:"non-scaling-stroke",style:{pointerEvents:"none"}}),g.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:vY,vectorEffect:"non-scaling-stroke",style:{cursor:f.axis==="x"?"col-resize":"row-resize"},onPointerEnter:()=>c(f.index),onPointerLeave:()=>c(null),onPointerDown:O=>h(O,f),onDoubleClick:O=>{O.stopPropagation(),d(null)}})]},f.index)})})}const CY=5,PY=1e3;function No(n){return function({id:t,data:r,label:i,labelStyle:s,style:o,selected:a,markerEnd:l,markerStart:c,source:d,sourceX:h,sourceY:f,target:p,targetX:m,targetY:O,sourcePosition:b,targetPosition:y}){const S=Rc(d),x=Rc(p),[k,v]=$.useState(null),w=Gp(fe=>fe.elementsSelectable),Q=r?.parallelOffset??0,C=r?.hubOffset,T=S?xa(S):{width:0,height:0},P=x?xa(x):{width:0,height:0},{sourceX:R,sourceY:M,targetX:D,targetY:N}=v$(Q,{x:h,y:f,position:b,...T},{x:m,y:O,position:y,...P},C);let I=0;S?.parentId&&(I=S.internals.z),x?.parentId&&x.internals.z>I&&(I=x.internals.z),a&&(I+=PY);const Z={sourceX:R,sourceY:M,targetX:D,targetY:N,sourcePosition:b,targetPosition:y};let ne,le,B;if(n==="straight")[ne,le,B]=$C({sourceX:R,sourceY:M,targetX:D,targetY:N});else if(n==="smoothstep")[ne,le,B]=cf(Z);else if(n==="step")[ne,le,B]=cf({...Z,borderRadius:0});else if(n==="simplebezier")[ne,le,B]=fC(Z);else if(n==="bezier")[ne,le,B]=cx(Z);else throw new Error(`Unknown edge path type: ${n}`);const se=r?.routing,re=$.useMemo(()=>{if(n!=="step"&&n!=="smoothstep"||!se&&!w&&!k)return null;const fe=gY({sourceX:R,sourceY:M,targetX:D,targetY:N,sourcePosition:b,targetPosition:y}),Je=OY(Gy(fe)),St=bY(se,Je),On=St?St.offsets:Je.split("").map(()=>0),mt=k?On.map((En,xe)=>xe===k.index?k.value:En):On,Rn=mt.some(En=>En!==0),br=Rn?yY(fe,Je,mt):fe;return{axes:Je,offsets:mt,points:br,isRouted:Rn,segments:Gy(br)}},[se,w,k,R,M,D,N,b,y]);re?.isRouted&&(ne=SY(re.points,n==="step"?0:CY),[le,B]=kY(re.points));const me=r?.labelOffset;me&&(le+=me.x,B+=me.y);const $e=r?.labelFontSize??12,G=!!r?.reverseAnimation;return g.jsxs(g.Fragment,{children:[g.jsx(pC,{id:t,path:ne,style:G?{...o,animationDirection:"reverse"}:o,markerEnd:l,markerStart:c}),a&&g.jsx(w$,{sourceX:R,sourceY:M,targetX:D,targetY:N}),re&&(w||k!==null)&&g.jsx($Y,{edgeId:t,axes:re.axes,offsets:re.offsets,segments:re.segments,draft:k,onDraft:v}),i&&g.jsx(mC,{children:g.jsx("div",{className:r?.lodLabelClass,style:{position:"absolute",zIndex:I,transform:`translate(-50%, -50%) translate(${le}px, ${B}px)`,fontSize:$e,lineHeight:1.2,padding:"2px 6px",borderRadius:4,background:s?.backgroundColor??"#1E293B",color:s?.color??"#E2E8F0",border:s?.backgroundColor?"none":"1px solid #334155",pointerEvents:"none",userSelect:"none",whiteSpace:"nowrap"},children:i})})]})}}const TY={default:No("bezier"),straight:No("straight"),step:No("step"),smoothstep:No("smoothstep"),simplebezier:No("simplebezier"),dynamic:pY},SU=[{id:"default",label:"Auto"},{id:"straight",label:"Straight"},{id:"step",label:"Step"},{id:"smoothstep",label:"Smooth Step"},{id:"simplebezier",label:"Simple Bezier"},{id:"dynamic",label:"Dynamic"}],kU=[{id:Bi.Arrow,label:"Arrow",icon:g.jsx(cY,{})},{id:Bi.ArrowClosed,label:"Arrow Closed",icon:g.jsx(DC,{})},{id:"erdOne",label:"ERD One",icon:g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:g.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"13",stroke:"currentColor",strokeWidth:"2"})})},{id:"erdMany",label:"ERD Many",icon:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:[g.jsx("line",{x1:"4",y1:"8",x2:"12",y2:"4",stroke:"currentColor",strokeWidth:"2"}),g.jsx("line",{x1:"4",y1:"8",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"2"}),g.jsx("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor",strokeWidth:"2"})]})},{id:"erdOnlyOne",label:"ERD Only One",icon:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:[g.jsx("line",{x1:"11",y1:"4",x2:"11",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"13",y1:"4",x2:"13",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]})},{id:"erdZeroOrOne",label:"ERD Zero or One",icon:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:[g.jsx("circle",{cx:"5",cy:"8",r:"2",stroke:"currentColor",strokeWidth:"1.5",fill:"white"}),g.jsx("line",{x1:"10",y1:"4",x2:"10",y2:"12",stroke:"currentColor",strokeWidth:"1.5"})]})},{id:"erdOneToMany",label:"ERD One to Many",icon:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:[g.jsx("line",{x1:"4",y1:"4",x2:"4",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"6",y1:"8",x2:"12",y2:"5",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"6",y1:"8",x2:"12",y2:"11",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"6",y1:"8",x2:"12",y2:"8",stroke:"currentColor",strokeWidth:"1.5"})]})},{id:"erdOneOrMany",label:"ERD One or Many",icon:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:[g.jsx("line",{x1:"7",y1:"4",x2:"7",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"5",y1:"8",x2:"12",y2:"5",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"5",y1:"8",x2:"12",y2:"11",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"5",y1:"8",x2:"12",y2:"8",stroke:"currentColor",strokeWidth:"1.5"})]})},{id:"erdZeroOrMany",label:"ERD Zero or Many",icon:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:[g.jsx("circle",{cx:"4",cy:"8",r:"2",stroke:"currentColor",strokeWidth:"1.5",fill:"white"}),g.jsx("line",{x1:"7",y1:"8",x2:"13",y2:"5",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"7",y1:"8",x2:"13",y2:"11",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("line",{x1:"7",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"1.5"})]})}];function MY(){const[n,e]=$.useState({x:0,y:0}),[t,r]=$.useState(!1);return $.useEffect(()=>{function i(s){const o=s.target;r(!!o?.closest(".react-flow__pane")),e({x:s.clientX,y:s.clientY})}return window.addEventListener("mousemove",i),()=>{window.removeEventListener("mousemove",i)}},[]),t?g.jsx("div",{style:{position:"fixed",top:n.y,left:n.x,pointerEvents:"none",zIndex:9999},children:g.jsx("div",{className:"flex size-7 -translate-y-full items-center justify-center rounded-full rounded-bl-none border-2 border-blue-500 bg-blue-100 text-blue-600 shadow-lg",children:g.jsx(F$,{className:"size-3.5"})})}):null}const of=60;function AY(){const n=gn(),[e,t]=$.useState(null);return $.useEffect(()=>{const r=setInterval(()=>{const i=n.getNodes();if(i.length===0){t(null);return}const s=ac(i),o=s.width+of,a=s.height+of,l=CC(s,o,a,1,1,of);t({nodesBounds:s,visualBounds:DT(i),captureBounds:{x:-l.x/l.zoom,y:-l.y/l.zoom,width:o/l.zoom,height:a/l.zoom}})},1e3);return()=>clearInterval(r)},[n]),e?g.jsxs(gC,{children:[g.jsx("div",{className:"pointer-events-none absolute border-2 border-red-500",style:{left:e.nodesBounds.x,top:e.nodesBounds.y,width:e.nodesBounds.width,height:e.nodesBounds.height},children:g.jsxs("div",{className:"absolute -top-6 left-0 bg-red-500 px-1 text-xs whitespace-nowrap text-white",children:["nodesBounds ",Math.round(e.nodesBounds.x),",",Math.round(e.nodesBounds.y)," ",Math.round(e.nodesBounds.width),"x",Math.round(e.nodesBounds.height)]})}),g.jsx("div",{className:"pointer-events-none absolute border-2 border-dashed border-lime-400",style:{left:e.captureBounds.x,top:e.captureBounds.y,width:e.captureBounds.width,height:e.captureBounds.height},children:g.jsxs("div",{className:"absolute -bottom-6 left-0 bg-lime-400 px-1 text-xs whitespace-nowrap text-black",children:["captureBounds ",Math.round(e.captureBounds.x),",",Math.round(e.captureBounds.y)," ",Math.round(e.captureBounds.width),"x",Math.round(e.captureBounds.height)]})}),g.jsx("div",{className:"pointer-events-none absolute border-2 border-cyan-400",style:{left:e.visualBounds.x,top:e.visualBounds.y,width:e.visualBounds.width,height:e.visualBounds.height},children:g.jsxs("div",{className:"absolute -top-6 right-0 bg-cyan-400 px-1 text-xs whitespace-nowrap text-black",children:["visualBounds ",Math.round(e.visualBounds.x),",",Math.round(e.visualBounds.y)," ",Math.round(e.visualBounds.width),"x",Math.round(e.visualBounds.height)]})})]}):null}function RY({isDrawing:n,onDrawComplete:e}){const[t,r]=$.useState(null),[i,s]=$.useState(null),o=$.useCallback(c=>{if(!n)return;const d=c.currentTarget.getBoundingClientRect(),h=c.clientX-d.left,f=c.clientY-d.top;r({x:h,y:f}),s({x:h,y:f})},[n]),a=$.useCallback(c=>{if(!n||!t)return;const d=c.currentTarget.getBoundingClientRect(),h=c.clientX-d.left,f=c.clientY-d.top;s({x:h,y:f})},[n,t]),l=$.useCallback(()=>{if(!n||!t||!i)return;const c={x:Math.min(t.x,i.x),y:Math.min(t.y,i.y),width:Math.abs(i.x-t.x),height:Math.abs(i.y-t.y)};c.width>50&&c.height>50&&e(c),r(null),s(null)},[n,t,i,e]);return n?g.jsx("div",{className:"absolute inset-0 z-20",style:{cursor:n?"crosshair":"default"},onMouseDown:o,onMouseMove:a,onMouseUp:l,children:t&&i&&g.jsx("div",{className:"bg-opacity-20 absolute border-2 border-dashed border-blue-500 bg-blue-100",style:{left:Math.min(t.x,i.x),top:Math.min(t.y,i.y),width:Math.abs(i.x-t.x),height:Math.abs(i.y-t.y)}})}):null}const tn=6;function EY(n){return g.jsx("marker",{id:"erdOne",viewBox:"0 0 12 12",markerWidth:tn,markerHeight:tn,refX:"12",refY:"6",orient:"auto-start-reverse",...n,children:g.jsx("path",{d:"M10 1 L10 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"})})}function NY(n){return g.jsxs("marker",{id:"erdMany",viewBox:"0 0 12 12",markerWidth:tn,markerHeight:tn,refX:"12",refY:"6",orient:"auto-start-reverse",...n,children:[g.jsx("path",{d:"M4 6 L11 1",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M4 6 L11 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M4 6 L11 6",stroke:"context-stroke",strokeWidth:"2",fill:"none"})]})}function DY(n){return g.jsxs("marker",{id:"erdOnlyOne",viewBox:"0 0 12 12",markerWidth:tn,markerHeight:tn,refX:"12",refY:"6",orient:"auto-start-reverse",...n,children:[g.jsx("path",{d:"M8 1 L8 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M10 1 L10 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"})]})}function jY(n){return g.jsxs("marker",{id:"erdZeroOrOne",viewBox:"0 0 16 12",markerWidth:tn,markerHeight:tn,refX:"16",refY:"6",orient:"auto-start-reverse",...n,children:[g.jsx("circle",{cx:"8",cy:"6",r:"2.5",stroke:"context-stroke",strokeWidth:"2",fill:"white"}),g.jsx("path",{d:"M13 1 L13 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"})]})}function IY(n){return g.jsxs("marker",{id:"erdOneOrMany",viewBox:"0 0 18 12",markerWidth:tn,markerHeight:tn,refX:"18",refY:"6",orient:"auto-start-reverse",...n,children:[g.jsx("path",{d:"M8 1 L8 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M6 6 L17 1",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M6 6 L17 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M6 6 L17 6",stroke:"context-stroke",strokeWidth:"2",fill:"none"})]})}function XY(n){return g.jsxs("marker",{id:"erdZeroOrMany",viewBox:"0 0 20 12",markerWidth:tn,markerHeight:tn,refX:"20",refY:"6",orient:"auto-start-reverse",...n,children:[g.jsx("circle",{cx:"8",cy:"6",r:"2.5",stroke:"context-stroke",strokeWidth:"2",fill:"white"}),g.jsx("path",{d:"M10 6 L19 1",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M10 6 L19 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M10 6 L19 6",stroke:"context-stroke",strokeWidth:"2",fill:"none"})]})}function LY(n){return g.jsxs("marker",{id:"erdOneToMany",viewBox:"0 0 18 12",markerWidth:tn,markerHeight:tn,refX:"18",refY:"6",orient:"auto-start-reverse",...n,children:[g.jsx("path",{d:"M7 1 L7 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M8.5 6 L17 1",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M8.5 6 L17 11",stroke:"context-stroke",strokeWidth:"2",fill:"none"}),g.jsx("path",{d:"M8.5 6 L17 6",stroke:"context-stroke",strokeWidth:"2",fill:"none"})]})}function _Y(){return g.jsx("svg",{children:g.jsxs("defs",{children:[g.jsx(EY,{}),g.jsx(NY,{}),g.jsx(DY,{}),g.jsx(jY,{}),g.jsx(LY,{}),g.jsx(IY,{}),g.jsx(XY,{})]})})}const Hu="lod-hidden",BY="lod-collapsed",WY="lod-boundary-label",Hy=[.3,.5,.7],zY=.03,ZY=32,FY=.08,VY=.16,YY=16,qY=.45;function Q$(n){const e=n.width??n.measured?.width,t=n.height??n.measured?.height;return!e||!t?YY:Math.min(e*FY,t*VY)}function UY(n,e){for(let t=0;t<Hy.length;t++){const r=Hy[t],i=e<=t?r+zY:r;if(n<i)return t}return 1/0}function GY(n,e,t){const r=new Map(n.map(c=>[c.id,c]));function i(c){let d=0,h=c.parentId?r.get(c.parentId):void 0;for(let f=0;f<ZY&&h;f++)h.type==="c4Boundary"&&d++,h=h.parentId?r.get(h.parentId):void 0;return d}const s=new Set,o=new Map,a=n.map(c=>{const d=i(c);if(d>t)return s.add(c.id),{...c,className:Hu};if(c.type==="c4Boundary"&&d===t){const h=Q$(c);return o.set(c.id,h),{...c,className:BY,style:{...c.style,"--lod-font-size":`${h}px`}}}return{...c,className:void 0}}),l=e.map(c=>{const d=r.get(c.source)?.type==="c4Boundary",h=r.get(c.target)?.type==="c4Boundary";if(d&&h){const f=o.get(c.source),p=o.get(c.target);return f===void 0||p===void 0?{...c,className:void 0,hidden:!0}:{...c,className:void 0,hidden:!1,data:{...c.data,labelFontSize:Math.min(f,p)*qY,lodLabelClass:WY}}}return s.has(c.source)||s.has(c.target)?{...c,className:Hu,hidden:!1}:{...c,className:void 0,hidden:!1}});return{nodes:a,edges:l}}const HY=32;function KY(n,e){if(!n.some(l=>Pr(l)))return{nodes:n,edges:e};const t=new Map(n.map(l=>[l.id,l]));function r(l){let c=l.parentId?t.get(l.parentId):void 0;for(let d=0;d<HY&&c;d++){if(Pr(c))return!0;c=c.parentId?t.get(c.parentId):void 0}return!1}const i=new Set(n.filter(r).map(l=>l.id)),s=n.map(l=>i.has(l.id)?{...l,hidden:!0,selected:!1}:Pr(l)?l.className===Hu?l:{...l,className:void 0,style:{...l.style,"--lod-font-size":`${Q$(l)}px`}}:l);function o(l){return!l||l.hidden===!0?!1:l.className!==Hu}const a=e.map(l=>{if(i.has(l.source)||i.has(l.target))return{...l,hidden:!0};const c=t.get(l.source),d=t.get(l.target);return!o(c)||!o(d)?l:Pr(c)||Pr(d)?{...l,hidden:!1}:l});return{nodes:s,edges:a}}function Vp(){if(typeof window>"u")return"Control";const n=window.navigator.platform.toLowerCase();return n.includes("mac")||n.includes("iphone")||n.includes("ipad")?"Meta":"Control"}const JY=[{key:"=",isShift:!1,isCtrlOrCmd:!0,preventDefault:!0,handler({rf:n}){Gg(n,Ug)}},{key:"-",isShift:!1,isCtrlOrCmd:!0,preventDefault:!0,handler({rf:n}){Gg(n,1/Ug)}},{key:"0",isShift:!1,isCtrlOrCmd:!0,preventDefault:!0,handler({rf:n}){PP(n)}},{key:"2",isShift:!1,isCtrlOrCmd:!0,preventDefault:!0,handler({rf:n}){const e=n.getNodes().filter(t=>t.selected).map(t=>t.id);bx(n,e)}},{key:"a",isShift:!1,isCtrlOrCmd:!0,preventDefault:!0,handler({selectAllNodes:n}){n()}},{key:"k",isShift:!1,isCtrlOrCmd:!0,preventDefault:!0,allowInInput:!0,handler({openCommandPalette:n}){n()}}];function eq(n){const t=Vp()==="Meta"?n.metaKey:n.ctrlKey;return JY.find(r=>!(r.key!==n.key||"isShift"in r&&r.isShift!==n.shiftKey||"isCtrlOrCmd"in r&&r.isCtrlOrCmd!==t))??null}const tq=24;function nq(n,e){const t=new Map(n.map(a=>[a.id,a])),r=new Map;function i(a,l,c,d){const h=t.get(c),f=t.get(d);if(!h||!f)return;const p=Fs(h,t),m=Fs(f,t),O=hf(p,m),b={x:m.x+m.width/2,y:m.y+m.height/2},y=`${c}|${O}`,S=r.get(y),x={edgeId:a,role:l,side:O,otherCenter:b};S?S.push(x):r.set(y,[x])}for(const a of e){if(a.hidden||a.source===a.target||a.data?.handlesLocked)continue;const l=t.get(a.source),c=t.get(a.target);!l||!c||Dc(l)||Dc(c)||(i(a.id,"source",a.source,a.target),i(a.id,"target",a.target,a.source))}const s=new Map,o=new Map;for(const a of r.values()){if(a.length<2)continue;const l=a[0].side,c=[...a].sort((d,h)=>l===ge.Left||l===ge.Right?d.otherCenter.y-h.otherCenter.y:d.otherCenter.x-h.otherCenter.x);c.forEach((d,h)=>{const f=(h-(c.length-1)/2)*tq;(d.role==="source"?s:o).set(d.edgeId,f)})}return e.map(a=>{const l=s.has(a.id),c=o.has(a.id),d=a.data?.hubOffset;if(!l&&!c){if(d===void 0)return a;const{hubOffset:p,...m}=a.data??{};return{...a,data:m}}const h=s.get(a.id)??0,f=o.get(a.id)??0;return d&&d.source===h&&d.target===f?a:{...a,data:{...a.data,hubOffset:{source:h,target:f}}}})}const rq=50,iq=22;function sq(n,e){return Math.hypot(n.x-e.x,n.y-e.y)}function Ky(n){const e=Math.hypot(n.x,n.y);return e===0?{x:0,y:1}:{x:n.x/e,y:n.y/e}}function oq(n,e){const t=new Map(n.map(a=>[a.id,a])),r=[];for(const a of e){if(a.hidden||!a.label)continue;const l=t.get(a.source),c=t.get(a.target);if(!l||!c)continue;const d=Fs(l,t),h=Fs(c,t),f={x:d.x+d.width/2,y:d.y+d.height/2},p={x:h.x+h.width/2,y:h.y+h.height/2};r.push({edge:a,point:{x:(f.x+p.x)/2,y:(f.y+p.y)/2},dir:Ky({x:p.x-f.x,y:p.y-f.y})})}const i=[],s=new Set;for(const a of r){if(s.has(a.edge.id))continue;const l=[a];s.add(a.edge.id);for(const c of r)s.has(c.edge.id)||sq(a.point,c.point)<=rq&&(l.push(c),s.add(c.edge.id));i.push(l)}const o=new Map;for(const a of i){if(a.length<2)continue;const l=Ky(a.reduce((d,h)=>({x:d.x+h.dir.x,y:d.y+h.dir.y}),{x:0,y:0})),c={x:-l.y,y:l.x};a.forEach((d,h)=>{const f=(h-(a.length-1)/2)*iq;o.set(d.edge.id,{x:c.x*f,y:c.y*f})})}return e.map(a=>{const l=o.get(a.id),c=a.data?.labelOffset;return!l&&c===void 0||l&&c&&c.x===l.x&&c.y===l.y?a:{...a,data:{...a.data,labelOffset:l}}})}function Mc(n){return Array.isArray(n.data?.childNodes)?n.data.childNodes:[]}function Ac(n,e){return{...n,data:{...n.data,childNodes:e}}}function Nd(n,e){return e.getInternalNode(n.id)?.internals.positionAbsolute??n.position}function Yp(n,e){const t=Nd(n,e),r=n.measured?.width??n.width??0,i=n.measured?.height??n.height??0;return{left:t.x,top:t.y,right:t.x+r,bottom:t.y+i,area:r*i}}function aq(n,e,t){if(!e)return n.position;const r=Nd(e,t);return{x:n.position.x+r.x,y:n.position.y+r.y}}function Jy(n,e,t){const r=t.getNodes(),i=r.find(h=>h.id===e.parentId&&Ar(h)),s=aq(e,i,t),o=e.measured?.width??e.width??0,a=e.measured?.height??e.height??0,l={x:s.x+o/2,y:s.y+a/2};let c,d=1/0;for(const h of r){if(!Ar(h)||h.id===e.id||Pr(h)||gx(r,h.id,e.id))continue;const f=Yp(h,t);l.x>=f.left&&l.x<=f.right&&l.y>=f.top&&l.y<=f.bottom&&(f.area>=d||(c=h,d=f.area))}if(c){if(e.parentId===c.id)return;const h=Nd(c,t);return t.setNodes(f=>f.map(p=>p.id===e.id?{...p,parentId:c.id,position:{x:s.x-h.x,y:s.y-h.y}}:i&&p.id===i.id?Ac(p,Mc(p).filter(m=>m!==e.id)):p.id===c.id?Ac(p,[...Mc(p).filter(m=>m!==e.id),e.id]):p))}i&&t.setNodes(h=>h.map(f=>f.id===e.id?{...f,parentId:void 0,position:s}:f.id===i.id?Ac(f,Mc(f).filter(p=>p!==e.id)):f))}function lq(n,e){if(Pr(n))return;const t=Nd(n,e),r=Yp(n,e);e.setNodes(i=>{const s=i.filter(a=>{if(a.id===n.id||Ar(a)||a.parentId)return!1;const l=Yp(a,e);return l.left>=r.left&&l.right<=r.right&&l.top>=r.top&&l.bottom<=r.bottom}).map(a=>a.id);if(!s.length)return i;const o=new Set(s);return i.map(a=>o.has(a.id)?{...a,parentId:n.id,position:{x:a.position.x-t.x,y:a.position.y-t.y}}:a.id===n.id?Ac(a,[...Mc(a).filter(l=>!o.has(l)),...s]):a)})}function cq(n,e){return{id:Bs(),type:"group",position:{x:n.x,y:n.y},data:{childNodes:e,backgroundColor:"rgba(20, 25, 37, 0.35)",borderColor:"#828DA3",componentFields:[{componentFieldId:"name",type:Mr.TextInput,label:"Name",isReadonly:!0,data:[{value:"Group"}]}]},style:{width:n.width+20,height:n.height+50}}}var af,ex;function uq(){if(ex)return af;ex=1;var n=PC();function e(t,r){return n(t,r)}return af=e,af}var dq=uq();const tx=nx(dq),hq=100,fq=500;function pq({nodes:n,edges:e,setNodes:t,setEdges:r,enabled:i}){const s=$.useRef([]),o=$.useRef(-1),a=$.useRef(null),l=$.useCallback(()=>{const h=a.current;if(!h)return;a.current=null;const f=s.current,p=o.current;tx(h,f[p])||(f.splice(p+1),f.push(h),o.current=f.length-1,f.length>hq&&(f.shift(),o.current=f.length-1))},[]);$.useEffect(()=>{if(!i||n.some(m=>m.dragging))return;const h={nodes:n,edges:e},f=s.current;if(f.length===0){s.current=[h],o.current=0;return}if(tx(h,f[o.current]))return;a.current=h;const p=setTimeout(l,fq);return()=>clearTimeout(p)},[n,e,i,l]);const c=$.useCallback(()=>{if(!i)return;l();const h=o.current;if(h<=0)return;o.current=h-1;const f=s.current[h-1];t(f.nodes),r(f.edges)},[i,t,r,l]),d=$.useCallback(()=>{if(!i)return;l();const h=s.current,f=o.current;if(f>=h.length-1)return;o.current=f+1;const p=h[f+1];t(p.nodes),r(p.edges)},[i,t,r,l]);return{undo:c,redo:d}}function vU({forceAutoFitMinZoom:n,forceNoBackground:e,forceAutoFitView:t,forceReadOnly:r}){const{viewport:i,setViewport:s,showGrid:o,showMinimap:a,drawingMode:l,setDrawingMode:c,edges:d,nodes:h,setEdges:f,setNodes:p,onEdgesChange:m,onNodesChange:O,reactFLowRef:b,reactFlowInstance:y,setReactFlowInstance:S,sidebarActiveTool:x,setSidebarActiveTool:k,cursorMode:v,setIsEdgeConnecting:w,dataSources:Q,isPreviewing:C,tempDiagramState:T,setIsCommandPaletteOpen:P,setSelectedNodeIds:R,setSelectedEdgeIds:M,isC4Diagram:D}=Zr(),N=Ka({reactFlowInstance:y,dataSources:Q,setIsCommandPaletteOpen:P,viewport:i,nodes:h,isPreviewing:C,setSelectedNodeIds:R,setSelectedEdgeIds:M}),I=$.useRef(null),Z=$.useRef(null),ne=$.useCallback(F=>{Z.current=F,I.current===null&&(I.current=requestAnimationFrame(()=>{I.current=null,Z.current&&s(Z.current)}))},[s]);$.useEffect(()=>()=>{I.current!==null&&cancelAnimationFrame(I.current)},[]);const le=T?.versionId??null;$.useEffect(()=>{const{reactFlowInstance:F,viewport:H}=N.current;!F||!H||F.setViewport(H,{duration:Nc})},[le,N]);const B=$.useCallback(F=>f(H=>F.source&&F.target&&F.source===F.target?H:OC({...F,type:jd.Bezier,markerEnd:Th({type:Bi.Arrow})},H)),[f]),se=$.useCallback((F,{isValid:H,fromNode:ce,fromHandle:ke,toHandle:bn})=>{if(w(!1),H||H===!1||!ce||!y)return console.warn("Invalid connection state",{isValid:H,fromNode:ce});const{clientX:et,clientY:Nn}="changedTouches"in F?F.changedTouches[0]:F,yn=document.elementFromPoint(et,Nn)?.closest?.(".react-flow__node");if(yn){const qn=yn.getAttribute("data-id")||void 0;if(qn&&qn!==ce.id){const bl=h.find(Dd=>Dd.id===qn);if(bl&&!Ar(bl)){const Dd=Bs();return f($$=>[...$$,{id:Dd,source:ce.id,target:qn,sourceHandle:ke?.id,type:jd.Bezier,markerEnd:Th({type:Bi.Arrow})}])}}}const sn=Bs();p(qn=>[...qn,{id:sn,type:"default",origin:[.5,0],data:{componentFields:[{componentFieldId:"name",type:Mr.TextInput,label:"Name",data:[{value:""}]}]},position:y.screenToFlowPosition({x:et,y:Nn})}]),f(qn=>[...qn,{id:sn,target:sn,source:ce.id,targetHandle:bn?.id,sourceHandle:ke?.id,type:jd.Bezier,markerEnd:Th({type:Bi.Arrow})}])},[y,f,p,h,w]),re=$.useCallback(()=>{w(!0)},[w]),me=$.useCallback((F,H)=>{f(ce=>ce.map(ke=>{if(ke.id!==F.id)return ke;const bn=H.source??ke.source,et=H.target??ke.target;return bn===et?ke:{...ke,source:bn,target:et,sourceHandle:H.sourceHandle??ke.sourceHandle,targetHandle:H.targetHandle??ke.targetHandle}}))},[f]),$e=$.useCallback(()=>{w(!0)},[w]),G=$.useCallback(()=>{w(!1)},[w]),fe=$.useCallback(F=>{F.preventDefault(),F.dataTransfer.dropEffect="move"},[]),Je=$.useCallback(F=>{if(!y||C)return;F.preventDefault();const H=h7(F.dataTransfer);if(!H)return Ku.error("Invalid node");const ce={...H,position:y.screenToFlowPosition({x:F.clientX-24,y:F.clientY-24})};if(Ar(ce))p(ke=>[ce,...ke]);else if(y.addNodes([ce]),Jy(F,ce,y),ce.type==="databaseTableSQL"&&"localTable"in ce.data){console.log("Mutating database table",ce);const{dataSources:ke}=N.current,bn=y.getNodes(),et=y.getEdges(),Nn=ce.data.localTable?.tableName,dt=ce.data.localTable?.databaseName,yn=ke.find(sn=>sn.name===dt)?.schemaAst;if(Nn&&dt&&yn){const sn=N$.updateReactFlow({edges:et,nodes:[...bn,ce],sourceName:dt,schema:yn,oldDataSources:ke});console.log("Updating edges",sn.edges),f(sn.edges)}}},[N,y,C,p,f]),St=$.useCallback(F=>{if(!y||C||x!=="add-comment")return;const H=Bs(),ce=y.screenToFlowPosition({x:F.clientX,y:F.clientY});p(ke=>[...ke,{id:H,type:"comment",data:{message:""},position:ce}]),k(null)},[y,C,x,p,k]),On=$.useCallback(F=>{if(!y)return;const ce={...y.screenToFlowPosition({x:F.x,y:F.y}),width:F.width/y.getZoom(),height:F.height/y.getZoom()},ke=h.filter(et=>{if(Ar(et)||et.type==="comment"||et.parentId)return!1;const Nn=et.position.x,dt=et.position.y,yn=ce.x+ce.width,sn=ce.y+ce.height;return et.position.x>=ce.x&&et.position.y>=ce.y&&Nn<=yn&&dt<=sn}),bn=ke.map(et=>et.id);if(ke.length>0){const et=cq(ce,bn);p(Nn=>[et,...Nn.map(dt=>bn.includes(dt.id)?{...dt,parentId:et.id,position:{x:dt.position.x-ce.x,y:dt.position.y-ce.y}}:dt)])}c(!1)},[y,h,p,c]),mt=$.useCallback((F,H)=>{if(y)if(Ar(H))lq(H,y);else if(H.id.startsWith("message-")){const{nodes:ce,edges:ke}=AT(y.getNodes(),y.getEdges());p(ce),f(ke)}else Jy(F,H,y)},[y,p,f]),[Rn,br]=$.useState(1/0);$.useEffect(()=>{br(F=>UY(i?.zoom??1,F))},[i?.zoom]);const En=D?Rn:1/0,xe=$.useMemo(()=>{const F=GY(h,d,En),H=KY(F.nodes,F.edges);return{nodes:H.nodes,edges:oq(H.nodes,nq(H.nodes,fY(H.edges)))}},[h,d,En]),Ee=bC("Space"),ut=!l&&!r&&!C,{undo:Vn,redo:Yn}=pq({nodes:h,edges:d,setNodes:p,setEdges:f,enabled:ut});return $.useEffect(()=>{function F(H){const ce=H.target,ke=ce.tagName==="INPUT"||ce.tagName==="TEXTAREA"||ce.isContentEditable,bn=H.ctrlKey||H.metaKey,et=ke&&ce.closest(".react-flow__node")!==null&&ce.closest(".react-flow__node-comment")===null,Nn=!ke||et;if(bn&&!H.shiftKey&&H.key==="z"&&Nn){H.preventDefault(),H.stopPropagation(),Vn();return}if(bn&&(H.key==="y"||H.shiftKey&&H.key==="z")&&Nn){H.preventDefault(),H.stopPropagation(),Yn();return}const dt=eq(H),yn=N.current.reactFlowInstance;function sn(qn){return{rf:qn,openCommandPalette:()=>N.current.setIsCommandPaletteOpen(!0),selectAllNodes:()=>{N.current.isPreviewing||(N.current.setSelectedNodeIds(N.current.nodes.map(bl=>bl.id)),N.current.setSelectedEdgeIds([]))}}}if(ke){dt?.allowInInput&&yn&&(dt.preventDefault&&H.preventDefault(),dt.handler(sn(yn)));return}dt&&yn&&(dt.preventDefault&&H.preventDefault(),dt.handler(sn(yn)))}return window.addEventListener("keydown",F,{capture:!0}),()=>{window.removeEventListener("keydown",F,{capture:!0})}},[N,Vn,Yn]),g.jsxs(g.Fragment,{children:[x==="add-comment"&&g.jsx(MY,{}),C&&g.jsx("style",{children:`
269
- .diagram-preview-locked .react-flow__node,
270
- .diagram-preview-locked .react-flow__node *,
271
- .diagram-preview-locked .react-flow__edge,
272
- .diagram-preview-locked .react-flow__edge * {
273
- pointer-events: none !important;
274
- user-select: none !important;
275
- }
276
- `}),g.jsxs(yC,{ref:b,nodeTypes:lY,edgeTypes:TY,selectionMode:MC.Partial,selectNodesOnDrag:!1,panOnDrag:v==="pan"||Ee?!0:[1,2],selectionOnDrag:v==="select"&&!Ee,panOnScroll:v==="select",noWheelClassName:"skip-wheel",nodes:xe.nodes,edges:xe.edges,onDrop:Je,onConnect:B,onConnectEnd:se,onConnectStart:re,onDragOver:fe,onPaneClick:St,onReconnect:me,onReconnectStart:$e,onReconnectEnd:G,onNodeDragStop:mt,isValidConnection:F=>!F.source||!F.target?!0:F.source!==F.target,selectionKeyCode:Vp(),multiSelectionKeyCode:Vp(),className:V("relative isolate opacity-0 transition-opacity duration-100",y&&"opacity-100",En!==1/0&&"lod-active",Ee&&"space-panning",x==="add-comment"&&"cursor-none! [&_*]:cursor-none!",C&&"diagram-preview-locked"),onNodesChange:O,onEdgesChange:m,connectionMode:TC.Strict,connectionLineStyle:{strokeWidth:3},defaultEdgeOptions:{type:"default",style:{strokeWidth:3}},defaultViewport:i??void 0,onViewportChange:ne,onMoveEnd:(F,H)=>s(H),onNodeDoubleClick:(F,H)=>{if(Pr(H))return p(ke=>dP(ke,H.id));const ce=N.current.reactFlowInstance;H.type!=="c4Boundary"||!ce||bx(ce,[H.id])},onInit:async F=>{!(F.getNodes().length===0&&F.getEdges().length===0)&&t&&await F.fitView(t?{padding:"20px",minZoom:n}:{maxZoom:.8,minZoom:.8}),s(F.getViewport()),S(F)},onPointerDown:()=>{k(F=>F==="add-comment"?F:null)},nodesDraggable:ut&&!Ee,nodesConnectable:ut&&!Ee,elementsSelectable:ut&&!Ee,edgesReconnectable:ut,minZoom:Oa,maxZoom:ba,children:[g.jsx(_Y,{}),a&&g.jsx(xC,{className:"!border !border-[#2A3242] !bg-[#141925] !shadow-sm",maskColor:"rgb(11 14 22 / 0.75)",nodeColor:"#3859FF"}),!e&&o&&g.jsx(SC,{variant:kC.Dots,gap:12,size:1,color:"#2A3242"}),g.jsx(RY,{isDrawing:l&&!C,onDrawComplete:On}),wP.VITE_FEATURE_ENABLE_DEBUG_DIAGRAM_NODE_BOUNDS&&g.jsx(AY,{})]})]})}export{Z1 as $,uc as A,Uq as B,Jm as C,Zq as D,Bd as E,zq as F,Th as G,xl as H,Ka as I,Wq as J,Vq as K,PP as L,uP as M,yl as N,mU as O,f7 as P,m7 as Q,vU as R,m$ as S,f$ as T,p7 as U,p$ as V,HC as W,qC as X,tP as Y,Ug as Z,JC as _,Bq as a,Fq as a0,FF as a1,gU as a2,OU as a3,a7 as a4,Fp as a5,dU as a6,uU as a7,kU as a8,SU as a9,bU as aa,nV as ab,sV as ac,xU as ad,yU as ae,TV as af,MV as ag,ZF as ah,Yq as ai,wP as aj,i7 as ak,fU as b,hU as c,pU as d,aU as e,Mr as f,Bs as g,cU as h,lU as i,Tn as j,JF as k,qq as l,TP as m,Zr as n,bx as o,cT as p,aO as q,yP as r,mr as s,Ar as t,s7 as u,AT as v,Gq as w,DT as x,ya as y,Gg as z};