@mndrk/agx 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/BUILD_ID +1 -1
  2. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/app-path-routes-manifest.json +2 -1
  3. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/build-manifest.json +2 -2
  4. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/prerender-manifest.json +27 -3
  5. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/routes-manifest.json +6 -0
  6. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.html +2 -2
  9. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.rsc +1 -1
  10. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found/page.js.nft.json +1 -1
  16. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.html +2 -2
  18. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.rsc +2 -2
  19. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  20. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  22. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  25. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/file-search/route.js.nft.json +1 -1
  26. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/health/route.js.nft.json +1 -1
  27. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/learnings/route.js.nft.json +1 -1
  28. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/logs/stream/route.js.nft.json +1 -1
  29. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/memories/route.js.nft.json +1 -1
  30. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/cancel/route.js.nft.json +1 -1
  31. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/signal/route.js.nft.json +1 -1
  32. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/start/route.js.nft.json +1 -1
  33. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/orchestrator/tasks/[taskId]/status/route.js.nft.json +1 -1
  34. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v1/route.js.nft.json +1 -1
  35. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/migrate-v2/route.js.nft.json +1 -1
  36. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
  37. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/projects/route.js.nft.json +1 -1
  38. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/complete/route.js.nft.json +1 -1
  39. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/queue/route.js.nft.json +1 -1
  40. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/system/db-status/route.js.nft.json +1 -1
  41. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/[commentId]/route.js.nft.json +1 -1
  42. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/comments/route.js.nft.json +1 -1
  43. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/costs/route.js.nft.json +1 -1
  44. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/dependencies/route.js.nft.json +1 -1
  45. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/events/route.js.nft.json +1 -1
  46. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/history/route.js.nft.json +1 -1
  47. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/metrics/route.js.nft.json +1 -1
  48. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/pause/route.js.nft.json +1 -1
  49. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/replan/route.js.nft.json +1 -1
  50. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/restart/route.js.nft.json +1 -1
  51. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/resume/route.js.nft.json +1 -1
  52. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/rollback/route.js.nft.json +1 -1
  53. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/route.js.nft.json +1 -1
  54. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/start/route.js.nft.json +1 -1
  55. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/graph/stop/route.js.nft.json +1 -1
  56. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/heartbeat/route.js.nft.json +1 -1
  57. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/history/route.js.nft.json +1 -1
  58. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/route.js.nft.json +1 -1
  59. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/logs/stream/route.js.nft.json +1 -1
  60. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/comments/route.js.nft.json +1 -1
  61. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/complete/route.js.nft.json +1 -1
  62. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/fail/route.js.nft.json +1 -1
  63. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/resume/route.js.nft.json +1 -1
  64. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/start/route.js.nft.json +1 -1
  65. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/stop/route.js.nft.json +1 -1
  66. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/nodes/[nodeId]/verify/route.js.nft.json +1 -1
  67. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -1
  68. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/assign-orphans/route.js.nft.json +1 -1
  69. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/route.js.nft.json +1 -1
  70. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/tasks/stream/route.js.nft.json +1 -1
  71. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/api/user-settings/route.js.nft.json +1 -1
  72. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board/page.js.nft.json +1 -1
  73. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board/page_client-reference-manifest.js +1 -1
  74. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.html +2 -2
  75. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.rsc +2 -2
  76. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_full.segment.rsc +2 -2
  77. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_head.segment.rsc +1 -1
  78. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_index.segment.rsc +2 -2
  79. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/_tree.segment.rsc +2 -2
  80. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/board/__PAGE__.segment.rsc +1 -1
  81. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/board.segments/board.segment.rsc +1 -1
  82. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph/page.js.nft.json +1 -1
  83. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph/page_client-reference-manifest.js +1 -1
  84. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.html +2 -2
  85. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.rsc +2 -2
  86. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_full.segment.rsc +2 -2
  87. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_head.segment.rsc +1 -1
  88. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_index.segment.rsc +2 -2
  89. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/_tree.segment.rsc +2 -2
  90. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/execution-graph/__PAGE__.segment.rsc +1 -1
  91. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/execution-graph.segments/execution-graph.segment.rsc +1 -1
  92. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.html +2 -2
  93. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.rsc +3 -3
  94. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  95. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_full.segment.rsc +3 -3
  96. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_head.segment.rsc +1 -1
  97. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_index.segment.rsc +2 -2
  98. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  99. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/page.js.nft.json +1 -1
  100. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/page_client-reference-manifest.js +1 -1
  101. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/graph/[taskId]/page.js.nft.json +1 -1
  102. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/graph/[taskId]/page_client-reference-manifest.js +1 -1
  103. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  104. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  105. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans/page.js.nft.json +1 -1
  106. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans/page_client-reference-manifest.js +1 -1
  107. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.html +1 -1
  108. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.rsc +3 -3
  109. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_full.segment.rsc +3 -3
  110. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_head.segment.rsc +1 -1
  111. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_index.segment.rsc +2 -2
  112. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/_tree.segment.rsc +2 -2
  113. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/projects/orphans/__PAGE__.segment.rsc +2 -2
  114. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/projects/orphans.segment.rsc +1 -1
  115. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/orphans.segments/projects.segment.rsc +1 -1
  116. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/page.js.nft.json +1 -1
  117. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  118. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.html +2 -2
  119. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.rsc +3 -3
  120. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_full.segment.rsc +3 -3
  121. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_head.segment.rsc +1 -1
  122. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_index.segment.rsc +2 -2
  123. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/_tree.segment.rsc +2 -2
  124. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/projects/__PAGE__.segment.rsc +2 -2
  125. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/projects.segments/projects.segment.rsc +1 -1
  126. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings/page.js.nft.json +1 -1
  127. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  128. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.html +2 -2
  129. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.rsc +2 -2
  130. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  131. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  132. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  133. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  134. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
  135. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  136. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status/page.js.nft.json +1 -1
  137. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status/page_client-reference-manifest.js +1 -1
  138. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.html +2 -2
  139. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.rsc +3 -3
  140. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_full.segment.rsc +3 -3
  141. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_head.segment.rsc +1 -1
  142. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_index.segment.rsc +2 -2
  143. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/_tree.segment.rsc +2 -2
  144. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/status/__PAGE__.segment.rsc +2 -2
  145. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/status.segments/status.segment.rsc +1 -1
  146. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page/app-paths-manifest.json +3 -0
  147. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page/build-manifest.json +18 -0
  148. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page/next-font-manifest.json +11 -0
  149. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page/react-loadable-manifest.json +1 -0
  150. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page/server-reference-manifest.json +4 -0
  151. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page.js +15 -0
  152. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page.js.map +5 -0
  153. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page.js.nft.json +1 -0
  154. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome/page_client-reference-manifest.js +2 -0
  155. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.html +9 -0
  156. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.meta +15 -0
  157. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.rsc +23 -0
  158. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_full.segment.rsc +23 -0
  159. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_head.segment.rsc +5 -0
  160. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_index.segment.rsc +9 -0
  161. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/_tree.segment.rsc +5 -0
  162. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/welcome/__PAGE__.segment.rsc +9 -0
  163. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app/welcome.segments/welcome.segment.rsc +4 -0
  164. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/app-paths-manifest.json +2 -1
  165. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/7e210_Agents_agx-cloud__next-internal_server_app_welcome_page_actions_5176f4d4.js +3 -0
  166. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/Projects_Agents_agx-cloud_304dc58c._.js +3 -0
  167. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/Projects_Agents_agx-cloud_aaa774d8._.js +4 -0
  168. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/Projects_Agents_agx-cloud_components_chat-ui_f59beea5._.js +95 -0
  169. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/{Projects_Agents_agx-cloud_e1b68242._.js → Projects_Agents_agx-cloud_d54d1b77._.js} +2 -2
  170. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/Projects_Agents_agx-cloud_ef78b9d7._.js +3 -0
  171. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/{[root-of-the-server]__9d72d782._.js → [root-of-the-server]__00507cd5._.js} +2 -2
  172. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/[root-of-the-server]__24a978df._.js +3 -0
  173. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/[root-of-the-server]__8b322dc4._.js +3 -0
  174. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/{[root-of-the-server]__657b446b._.js → [root-of-the-server]__99fa92e8._.js} +2 -2
  175. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/[root-of-the-server]__a4a5c57b._.js +3 -0
  176. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/{[root-of-the-server]__1e273070._.js → [root-of-the-server]__a73fd1ea._.js} +2 -2
  177. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/ae43b_@dnd-kit_core_dist_core_esm_e4fe20d7.js +3 -0
  178. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/middleware-manifest.json +5 -5
  179. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/next-font-manifest.js +1 -1
  180. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/next-font-manifest.json +4 -0
  181. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/404.html +1 -1
  182. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/pages/500.html +2 -2
  183. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.js +1 -1
  184. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/server-reference-manifest.json +1 -1
  185. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/04612fc0fdf7b4ef.css +1 -0
  186. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/0804e1cf36ac4c40.js +1 -0
  187. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/{1e899e8bb554fde8.js → 122dafa7cd2594e4.js} +1 -1
  188. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/38cf24cf2de25782.js +1 -0
  189. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/55e870d6246760c7.js +93 -0
  190. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/{4256a16941bc22fb.js → 60a9c7b6ddb4f3f5.js} +2 -2
  191. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/7d2c10033c8a8554.js +1 -0
  192. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/870ea0d4e47d21ce.js +1 -0
  193. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/{0a0d449e527ef5e2.js → a56604cde5f45ff6.js} +1 -1
  194. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/ae26536f21ac3989.js +1 -0
  195. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/b3af23a09f4d9204.js +1 -0
  196. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/{4926ceb649af0e91.js → cdd364319efbfb0a.js} +1 -1
  197. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/app/welcome/page.tsx +117 -0
  198. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/components/chat-ui/ChatPreview.tsx +85 -0
  199. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/lib/demo-threads.ts +76 -0
  200. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/scripts/fix-turbopack-externals.mjs +94 -0
  201. package/package.json +1 -1
  202. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/Projects_Agents_agx-cloud_37dc866e._.js +0 -3
  203. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/Projects_Agents_agx-cloud_a7533794._.js +0 -3
  204. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/[root-of-the-server]__13df20fe._.js +0 -95
  205. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/server/chunks/ssr/ae43b_lucide-react_dist_esm_icons_search_04b9412a.js +0 -3
  206. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/09c6c56e4afc8647.js +0 -1
  207. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/0d58db99a936501d.js +0 -1
  208. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/652b21250c785942.css +0 -1
  209. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/dc534541f2bd6342.js +0 -1
  210. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/e4e1f0e19efe31cb.js +0 -1
  211. package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/chunks/fb502daefdaec131.js +0 -93
  212. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{Bhse4ZIyeG-RAxhOSkjdu → NUZvhyZNQzdxfq6-qS6F_}/_buildManifest.js +0 -0
  213. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{Bhse4ZIyeG-RAxhOSkjdu → NUZvhyZNQzdxfq6-qS6F_}/_clientMiddlewareManifest.json +0 -0
  214. /package/cloud-runtime/standalone/Projects/Agents/agx-cloud/.next/static/{Bhse4ZIyeG-RAxhOSkjdu → NUZvhyZNQzdxfq6-qS6F_}/_ssgManifest.js +0 -0
@@ -1,93 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,4904,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,o=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g;function u(e){return e?e.replace(d,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,d=1;function h(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function p(){var e={line:n,column:d};return function(t){return t.position=new f(e),g(o),t}}function f(e){this.start=e,this.end={line:n,column:d},this.source=t.source}function m(r){var i=Error(t.source+":"+n+":"+d+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=d,i.source=e,t.silent);else throw i}function g(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function y(e){var t;for(e=e||[];t=x();)!1!==t&&e.push(t);return e}function x(){var t=p();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return m("End of comment missing");var r=e.slice(2,n-2);return d+=2,h(r),e=e.slice(n),d+=2,t({type:"comment",comment:r})}}f.prototype.content=e,g(o);var b,v=[];for(y(v);b=function(){var e=p(),t=g(s);if(t){if(x(),!g(l))return m("property missing ':'");var n=g(a),i=e({type:"declaration",property:u(t[0].replace(r,"")),value:n?u(n[0].replace(r,"")):""});return g(c),i}}();)!1!==b&&(v.push(b),y(v));return v}},76402,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),o="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;o?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(4904))},32558,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,o=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,a=function(e,t){return t.toUpperCase()},c=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||o.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(l,c):e.replace(s,c)).replace(i,a))}},95736,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(76402)),i=e.r(32558);function o(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}o.default=o,t.exports=o},88353,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},a=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(t in e);return void 0===t||r.call(e,t)},c=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},d=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(s)return s(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,o,s,u=arguments[0],h=1,p=arguments.length,f=!1;for("boolean"==typeof u&&(f=u,u=arguments[1]||{},h=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});h<p;++h)if(t=arguments[h],null!=t)for(n in t)r=d(u,n),u!==(i=d(t,n))&&(f&&i&&(a(i)||(o=l(i)))?(o?(o=!1,s=r&&l(r)?r:[]):s=r&&a(r)?r:{},c(u,{name:n,newValue:e(f,s,i)})):void 0!==i&&c(u,{name:n,newValue:i}));return u}},26410,e=>{e.v({fileMentionFadeIn:"FileMentionPopover-module__NItQTa__fileMentionFadeIn",popover:"FileMentionPopover-module__NItQTa__popover"})},26341,e=>{"use strict";var t=e.i(72218),n=e.i(95459);function r(e){return`threadId=${encodeURIComponent(e)}`}var i=e.i(89934),o=e.i(59853),s=e.i(23362),l=e.i(10971),a=e.i(41157);let c=(0,a.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var d=e.i(66638),u=e.i(22522);let h=(0,a.default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var p=e.i(61606),f=e.i(34285);let m=(0,a.default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),g=(0,a.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),y=(0,a.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),x=(0,a.default)("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]),b=(0,a.default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),v=(0,a.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),k=(0,a.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),w=(0,a.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),S=(0,a.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);var C=e.i(34386),M=e.i(77843),N=e.i(54179);let T=["#D97706","#2563EB","#059669","#DC2626","#7C3AED","#DB2777","#0891B2"];function j(e,t=32,n){let r=`https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${encodeURIComponent(e)}&size=${t}`;if(!n)return r;let i=n.replace("#","");return`${r}&backgroundColor=${i}`}function E({p:e,isActive:n,isFirst:r,onToggleActive:i,onClickEdit:o}){let{attributes:s,listeners:l,setNodeRef:a,transform:c,transition:d,isDragging:u}=(0,M.useSortable)({id:e.id}),h={transform:N.CSS.Transform.toString(c),transition:d,opacity:u?.5:1,zIndex:u?50:void 0};return(0,t.jsx)("div",{ref:a,style:h,className:"relative group",children:(0,t.jsxs)("div",{className:`w-full flex items-center justify-between gap-1 px-1.5 py-1.5 rounded-md transition-colors ${n?"text-slate-700 hover:bg-slate-100":"text-slate-400 hover:bg-slate-50"}`,children:[(0,t.jsx)("button",{type:"button",className:"flex-shrink-0 cursor-grab active:cursor-grabbing p-1 text-slate-300 hover:text-slate-500 transition-colors",...s,...l,children:(0,t.jsx)(S,{size:12})}),(0,t.jsxs)("button",{type:"button",className:"min-w-0 flex-1 flex items-center gap-2 text-left",onClick:o,children:[(0,t.jsx)("img",{src:j(e.id,16,e.color),alt:"",className:"w-4 h-4 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium truncate",children:e.name}),r&&(0,t.jsx)("span",{className:"text-[9px] font-semibold text-amber-600 bg-amber-50 border border-amber-200 rounded px-1 py-0 leading-tight flex-shrink-0",children:"default"})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{i&&i(e.id,!n)},"aria-label":`${n?"Disable":"Enable"} ${e.name}`,"aria-pressed":n,className:`relative w-5 h-3 rounded-full transition-colors flex-shrink-0 ${n?"bg-violet-300":"bg-slate-200"}`,children:(0,t.jsx)("span",{className:`absolute top-[2px] left-[2px] w-2 h-2 bg-white rounded-full shadow-sm transition-transform ${n?"translate-x-2":"translate-x-0"}`})})]})})}function O({title:e,initial:r,submitLabel:i,onSubmit:o,onCancel:s}){let[l,a]=(0,n.useState)(r.name),[c,u]=(0,n.useState)(r.provider),[h,p]=(0,n.useState)(r.model),[f,S]=(0,n.useState)(r.identity),[C,M]=(0,n.useState)(r.identityFile),[N,T]=(0,n.useState)(r.identityFile?(e=>{let t=e.trim();if(!t)return"unknown";let n=t.match(/\/api\/attachments\/([a-zA-Z0-9-]+)/);if(n)return`attachment-${n[1].slice(0,8)}`;let r=t.split("/");return r[r.length-1]||t})(r.identityFile):""),[j,E]=(0,n.useState)(r.identityFile?"file":"text"),[O,A]=(0,n.useState)(r.skills.length>0?r.skills:[]),[I,D]=(0,n.useState)(!1),[R,P]=(0,n.useState)(0),z=(0,n.useRef)(null),L=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=e=>{L.current&&!L.current.contains(e.target)&&s()},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[L,s]);let $=async e=>{let t=e.target.files?.[0];if(t){D(!0),P(0);try{let e,n,r=(await (e=[t],new Promise((t,n)=>{let r=new FormData;for(let t of e)r.append("file",t);let i=new XMLHttpRequest;i.open("POST","/api/upload"),i.upload.onprogress=e=>{e.lengthComputable&&P(Math.round(e.loaded/e.total*100))},i.onerror=()=>n(Error("Upload failed")),i.onload=()=>{if(i.status<200||i.status>=300)return void n(Error(`Upload failed with status ${i.status}`));try{let e=JSON.parse(i.responseText);t(Array.isArray(e.attachments)?e.attachments:[])}catch(e){n(e instanceof Error?e:Error("Invalid upload response"))}},i.send(r)})))[0];if(!r)return;M((n=r.id,`/api/attachments/${n}`)),T(r.filename)}catch(e){console.error("Identity upload failed",e)}finally{D(!1),z.current&&(z.current.value="")}}},F=e.toLowerCase().includes("agent");return(0,t.jsx)("div",{ref:L,className:F?"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-slate-500/20 backdrop-blur-sm":"absolute top-full left-0 mt-3 z-50 bg-white border border-slate-200 rounded-2xl shadow-2xl p-4 w-72 animate-in fade-in slide-in-from-top-2 duration-200",onKeyDown:e=>{"Escape"===e.key&&s()},children:(0,t.jsxs)("div",{className:`${F?"bg-white rounded-[32px] shadow-2xl overflow-hidden w-full max-w-lg animate-in fade-in zoom-in duration-300":"flex flex-col gap-5"}`,children:[(0,t.jsxs)("div",{className:`${F?"px-8 pt-8 pb-4":"mb-2"} flex items-center justify-between`,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-[10px] font-bold tracking-widest text-slate-400 uppercase",children:e}),F&&(0,t.jsx)("h1",{className:"text-2xl font-semibold mt-1",children:l||"Configure Agent"})]}),(0,t.jsx)("button",{onClick:s,className:"p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-100 rounded-full transition-all",children:(0,t.jsx)(m,{size:20})})]}),(0,t.jsxs)("div",{className:`${F?"px-8 pb-8 space-y-6":"flex flex-col gap-5"}`,children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm font-medium text-slate-500",children:[(0,t.jsx)(g,{size:16})," Name"]}),(0,t.jsx)("input",{type:"text",value:l,onChange:e=>a(e.target.value),className:"w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all",placeholder:"Enter agent name...",autoFocus:!0})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm font-medium text-slate-500",children:[(0,t.jsx)(x,{size:16})," Provider"]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("select",{value:c,onChange:e=>u(e.target.value),className:"w-full appearance-none px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all pr-10 cursor-pointer",children:[(0,t.jsx)("option",{value:"claude",children:"Claude"}),(0,t.jsx)("option",{value:"ollama",children:"Ollama"}),(0,t.jsx)("option",{value:"gemini",children:"Gemini"}),(0,t.jsx)("option",{value:"codex",children:"Codex"})]}),(0,t.jsx)(w,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none",size:16})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm font-medium text-slate-500",children:[(0,t.jsx)(y,{size:16})," Model"]}),(0,t.jsx)("input",{type:"text",value:h,onChange:e=>p(e.target.value),className:"w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all font-mono text-sm",placeholder:"e.g. gpt-4o"})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm font-medium text-slate-500",children:[(0,t.jsx)(b,{size:16})," Identity"]}),(0,t.jsxs)("div",{className:"flex p-1 bg-slate-100 rounded-lg border border-slate-200",children:[(0,t.jsx)("button",{type:"button",onClick:()=>E("text"),className:`px-3 py-1 text-xs font-semibold rounded-md transition-all ${"text"===j?"bg-white text-slate-900 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:"Txt"}),(0,t.jsx)("button",{type:"button",onClick:()=>E("file"),className:`px-3 py-1 text-xs font-semibold rounded-md transition-all ${"file"===j?"bg-white text-slate-900 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:"File"})]})]}),"text"===j?(0,t.jsx)("textarea",{value:f,onChange:e=>S(e.target.value),className:"w-full min-h-[120px] px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 transition-all resize-none placeholder:text-slate-400 leading-relaxed",placeholder:"Describe the agent's identity and goals..."}):(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{type:"file",ref:z,onChange:$,className:"hidden",accept:".txt,.md,.json,.yaml,.yml,.toml"}),(0,t.jsxs)("div",{onClick:()=>z.current?.click(),className:"w-full min-h-[120px] border-2 border-dashed border-slate-200 rounded-xl flex flex-col items-center justify-center bg-slate-50 group hover:border-indigo-400 transition-colors cursor-pointer",children:[(0,t.jsx)(k,{className:"text-slate-400 group-hover:text-indigo-500 mb-2 transition-colors",size:24}),(0,t.jsx)("span",{className:"text-sm text-slate-500 font-medium group-hover:text-indigo-600 transition-colors",children:I?`Uploading ${R}%`:N||"Upload identity definition"}),!I&&(0,t.jsx)("span",{className:"text-[10px] text-slate-400 mt-1",children:"Supports .md, .txt, .json, .yaml, .toml"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm font-medium text-slate-500",children:[(0,t.jsx)(v,{size:16})," Skills"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>A(e=>[...e,{file:"",condition:""}]),className:"flex items-center gap-1 text-[11px] font-bold text-indigo-600 hover:text-indigo-700 uppercase tracking-wider",children:[(0,t.jsx)(d.Plus,{size:14})," Add"]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[O.map((e,n)=>(0,t.jsxs)("div",{className:"p-2.5 bg-indigo-50/50 border border-indigo-100 rounded-lg space-y-2 animate-in slide-in-from-left-2 duration-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",placeholder:"/path/to/skill.md",value:e.file,onChange:e=>A(t=>t.map((t,r)=>r===n?{...t,file:e.target.value}:t)),className:"flex-1 bg-white border border-indigo-100 rounded-md px-2.5 py-1.5 text-xs font-mono text-slate-700 placeholder:text-slate-400 focus:outline-none focus:ring-1 focus:ring-indigo-300"}),(0,t.jsx)("button",{type:"button",onClick:()=>A(e=>e.filter((e,t)=>t!==n)),className:"p-1 text-indigo-300 hover:text-indigo-600 transition-colors",children:(0,t.jsx)(m,{size:14})})]}),(0,t.jsx)("input",{type:"text",placeholder:"When to use this skill...",value:e.condition,onChange:e=>A(t=>t.map((t,r)=>r===n?{...t,condition:e.target.value}:t)),className:"w-full bg-white border border-indigo-100 rounded-md px-2.5 py-1.5 text-xs text-slate-700 placeholder:text-slate-400 focus:outline-none focus:ring-1 focus:ring-indigo-300"})]},n)),0===O.length?(0,t.jsx)("div",{className:"text-xs text-slate-400 px-1",children:"No skills added."}):null]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-slate-100",children:[(0,t.jsx)("button",{onClick:s,className:"px-6 py-2.5 text-sm font-semibold text-slate-500 hover:text-slate-800 hover:bg-slate-50 rounded-xl transition-all",children:"Cancel"}),(0,t.jsx)("button",{onClick:()=>{l.trim()&&h.trim()&&o({name:l.trim(),provider:c,model:h.trim(),identity:"text"===j?f.trim():"",identityFile:"file"===j?C.trim():"",skills:O.filter(e=>e.file.trim())})},disabled:I||!l.trim()||!h.trim(),className:"px-8 py-2.5 bg-indigo-600 text-white text-sm font-semibold rounded-xl shadow-[0_4px_12px_rgba(79,70,229,0.3)] hover:bg-indigo-700 active:scale-95 disabled:opacity-50 transition-all font-bold",children:i})]})]})]})})}function A({participants:e,onAdd:r,onUpdate:i,onRemove:o,activeParticipantIds:s,onToggleActive:l,onReorder:a,showInlineAdd:c=!0,openAddNonce:d,variant:u="default"}){let[h,p]=(0,n.useState)(null),f=(0,n.useMemo)(()=>new Set(s??e.map(e=>e.id)),[s,e]),m="add"===h;(0,n.useEffect)(()=>{"number"==typeof d&&p("add")},[d]);let g=(0,C.useSensors)((0,C.useSensor)(C.PointerSensor,{activationConstraint:{distance:5}}),(0,C.useSensor)(C.KeyboardSensor,{coordinateGetter:M.sortableKeyboardCoordinates})),y=(0,n.useMemo)(()=>[...e.filter(e=>f.has(e.id)),...e.filter(e=>!f.has(e.id))],[e,f]);return"sidebar"===u?(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)(C.DndContext,{sensors:g,collisionDetection:C.closestCenter,onDragEnd:t=>{let{active:n,over:r}=t;if(!r||n.id===r.id||!a)return;let i=e.findIndex(e=>e.id===n.id),o=e.findIndex(e=>e.id===r.id);if(-1===i||-1===o)return;let s=[...e],[l]=s.splice(i,1);s.splice(o,0,l),a(s.map(e=>e.id))},children:(0,t.jsx)(M.SortableContext,{items:y.map(e=>e.id),strategy:M.verticalListSortingStrategy,children:y.map((e,r)=>{let o=f.has(e.id),s=r>0?f.has(y[r-1].id):null;return(0,t.jsxs)(n.default.Fragment,{children:[!0===s&&!o&&(0,t.jsx)("div",{className:"mx-2 my-1 border-t border-dashed border-slate-200"}),(0,t.jsx)(E,{p:e,isActive:f.has(e.id),isFirst:0===r,onToggleActive:l,onClickEdit:()=>p(h===e.id?null:e.id)}),h===e.id&&!m&&(0,t.jsx)(O,{title:"Edit agent",initial:{name:e.name,provider:e.provider,model:e.model||"",identity:e.identity||"",identityFile:e.identityFile||"",skills:e.skills||[]},submitLabel:"Save",onSubmit:t=>{i({id:e.id,color:e.color,name:t.name,provider:t.provider,model:t.model,...t.identity?{identity:t.identity}:{},...t.identityFile?{identityFile:t.identityFile}:{},...t.skills.length>0?{skills:t.skills}:{}}),p(null)},onCancel:()=>p(null)})]},e.id)})})}),(0,t.jsxs)("div",{className:"relative",children:[c?(0,t.jsxs)("button",{type:"button",onClick:()=>{p("add"===h?null:"add")},className:"w-full flex items-center justify-center gap-1 px-3 py-2 rounded-md text-sm font-medium text-slate-500 hover:text-slate-800 hover:bg-slate-100 transition-colors",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M5 12h14"}),(0,t.jsx)("path",{d:"M12 5v14"})]}),"Add agent"]}):null,m&&(0,t.jsx)(O,{title:"Add agent",initial:{name:"",provider:"claude",model:"",identity:"",identityFile:"",skills:[]},submitLabel:"Add",onSubmit:t=>{let n=T[e.length%T.length];r({id:t.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),color:n,name:t.name,provider:t.provider,model:t.model,...t.identity?{identity:t.identity}:{},...t.identityFile?{identityFile:t.identityFile}:{},...t.skills.length>0?{skills:t.skills}:{}}),p(null)},onCancel:()=>p(null)})]})]}):(0,t.jsxs)("div",{className:"flex gap-2 items-center flex-wrap justify-center",children:[e.map(e=>(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("span",{className:"text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity border border-transparent hover:border-black/5 px-2.5 py-1 rounded-full flex items-center gap-1.5",style:{backgroundColor:e.color+"15",color:e.color},onClick:()=>p(h===e.id?null:e.id),children:[(0,t.jsx)("img",{src:j(e.id,16,e.color),alt:"",className:"w-4 h-4 rounded-full"}),(0,t.jsx)("span",{children:e.name}),(0,t.jsxs)("span",{className:"opacity-60 font-normal mix-blend-multiply",children:[e.provider,":",e.model]}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),o(e.id)},className:"hover:opacity-100 opacity-60 ml-0.5 leading-none transition-opacity flex items-center justify-center",title:`Remove ${e.name}`,children:(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M18 6 6 18"}),(0,t.jsx)("path",{d:"m6 6 12 12"})]})})]}),h===e.id&&(0,t.jsx)(O,{title:"Edit agent",initial:{name:e.name,provider:e.provider,model:e.model||"",identity:e.identity||"",identityFile:e.identityFile||"",skills:e.skills||[]},submitLabel:"Save",onSubmit:t=>{i({id:e.id,color:e.color,name:t.name,provider:t.provider,model:t.model,...t.identity?{identity:t.identity}:{},...t.identityFile?{identityFile:t.identityFile}:{},...t.skills.length>0?{skills:t.skills}:{}}),p(null)},onCancel:()=>p(null)})]},e.id)),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("button",{onClick:()=>p("add"===h?null:"add"),className:"text-xs border border-slate-200 text-slate-500 hover:text-slate-800 hover:border-slate-300 hover:bg-slate-50 transition-all font-medium flex items-center gap-1 px-2.5 py-1 rounded-full",children:[(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M5 12h14"}),(0,t.jsx)("path",{d:"M12 5v14"})]}),"Add agent"]}),"add"===h&&(0,t.jsx)(O,{title:"Add agent",initial:{name:"",provider:"claude",model:"",identity:"",identityFile:"",skills:[]},submitLabel:"Add",onSubmit:t=>{let n=T[e.length%T.length];r({id:t.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),color:n,name:t.name,provider:t.provider,model:t.model,...t.identity?{identity:t.identity}:{},...t.identityFile?{identityFile:t.identityFile}:{},...t.skills.length>0?{skills:t.skills}:{}}),p(null)},onCancel:()=>p(null)})]})]})}function I({threads:e,participants:r=[],activeThreadId:i,isLoading:a,isCreating:m,onSelectThread:g,onCreateThread:y,onRenameThread:x,onDeleteThread:b,deletingThreadId:v=null,renamingThreadId:k=null,onAddParticipant:w,onUpdateParticipant:S,onRemoveParticipant:C,activeParticipantIds:M=[],onToggleParticipantActive:N,onReorderParticipants:T,visible:j=!1,isRestoringActiveThread:E=!1,onToggle:O,onSearch:I}){let D=(0,n.useRef)(null),[R,P]=(0,n.useState)(null),{projects:z}=(0,f.useProjects)(),L=e.length>0,$=!!j,F=!!(w&&S&&C),B=[...e].sort((e,t)=>(e.title??"").localeCompare(t.title??""));!function({focusTarget:e,shouldFocus:t}){(0,n.useEffect)(()=>{if(!t||"u"<typeof document)return;let n=e.current;if(!n||n instanceof HTMLButtonElement&&n.disabled)return;let r=document.activeElement;if(!(r&&(n===r||n.contains(r))))try{n.focus({preventScroll:!0})}catch{n.focus()}},[e,t])}({focusTarget:D,shouldFocus:$&&!(a&&!L||E&&L)&&!L&&!m});let _=(e,t)=>{let n=window.prompt("Rename workspace",t);if(null===n)return;let r=n.trim();r?x(e,r):window.alert("Workspace title is required.")};return $?(0,t.jsxs)("aside",{id:"thread-sidebar",className:"thread-sidebar","aria-label":"Workspace sidebar","aria-busy":a?"true":void 0,children:[(0,t.jsxs)("div",{className:"thread-sidebar__brand",children:[(0,t.jsx)("div",{className:"flex items-center justify-center mr-2","aria-hidden":"true",children:(0,t.jsxs)("svg",{width:"52",height:"31",viewBox:"0 0 64 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{width:"64",height:"38",rx:"8",fill:"black"}),(0,t.jsxs)("g",{stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M 14 27 C 17 16 19 10 20 8 C 21 12 23 20 25 27"}),(0,t.jsx)("path",{d:"M 16 20 C 19 19 21 21 23 20"}),(0,t.jsx)("path",{d:"M 40 13 C 35 10 30 13 30 19 C 30 25 34 28 38 27 C 40 26 40 22 40 20 L 36 20"}),(0,t.jsx)("path",{d:"M 46 11 C 48 16 51 22 54 27"}),(0,t.jsx)("path",{d:"M 54 11 C 52 16 49 22 46 27"})]})]})}),O&&(0,t.jsx)("button",{type:"button",onClick:O,"aria-label":"Hide workspaces",title:"Hide workspaces",className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-slate-400 transition-all hover:bg-slate-100 hover:text-slate-600",children:(0,t.jsx)(l.PanelLeftClose,{className:"h-4 w-4",strokeWidth:1.75})})]}),(0,t.jsxs)("div",{className:"thread-sidebar__content",children:[I&&(0,t.jsx)("div",{className:"px-3 pt-2 pb-1",children:(0,t.jsxs)("button",{type:"button",onClick:I,className:"flex items-center gap-2 w-full h-8 px-2.5 rounded-lg border border-slate-200 bg-white text-slate-400 text-xs hover:border-slate-300 hover:text-slate-500 transition-all",children:[(0,t.jsx)(u.Search,{className:"h-3.5 w-3.5 shrink-0",strokeWidth:1.75}),(0,t.jsx)("span",{children:"Search…"}),(0,t.jsx)("kbd",{className:"ml-auto text-[10px] font-sans font-medium text-slate-300 bg-slate-50 border border-slate-200 rounded px-1 py-0.5",children:"⌘K"})]})}),(0,t.jsxs)("nav",{className:"thread-sidebar__section",children:[(0,t.jsxs)("div",{className:"thread-sidebar__section-header",children:[(0,t.jsx)("p",{className:"thread-sidebar__section-label",children:"Workspace"}),(0,t.jsx)("div",{className:"thread-sidebar__header-actions",children:(0,t.jsx)("button",{type:"button",className:"thread-sidebar__action",onClick:()=>{let e=window.prompt("Workspace title");if(null===e)return;let t=e.trim();t?y({title:t}):window.alert("Workspace title is required.")},disabled:m,"aria-label":m?"Creating workspace":"Create workspace",title:m?"Creating…":"Create workspace",children:(0,t.jsx)(d.Plus,{size:14})})})]}),B.map(e=>{let n=e.id===i,r=v===e.id,s=k===e.id,l=e.title?.trim()||"Untitled workspace";return(0,t.jsxs)("div",{className:"thread-sidebar__workspace-item group",children:[(0,t.jsxs)("button",{type:"button",className:`thread-sidebar__nav-item thread-sidebar__workspace-nav-item ${n?"thread-sidebar__nav-item--active thread-sidebar__workspace-nav-item--active":""}`,onClick:()=>g(e.id),"aria-current":n?"page":void 0,children:[(0,t.jsx)(o.Hash,{size:18}),(0,t.jsx)("span",{className:"thread-sidebar__workspace-title",children:l})]}),(0,t.jsxs)("div",{className:"thread-sidebar__workspace-actions",children:[(0,t.jsx)("button",{type:"button",className:"thread-sidebar__workspace-action",onClick:()=>_?.(e.id,l),disabled:s||r,"aria-label":`Rename workspace ${l}`,title:`Rename workspace ${l}`,children:(0,t.jsx)(c,{size:12})}),(0,t.jsx)("button",{type:"button",className:"thread-sidebar__workspace-action thread-sidebar__workspace-action--delete",onClick:()=>{b(e.id)},disabled:r||s,"aria-label":`Delete workspace ${l}`,title:`Delete workspace ${l}`,children:(0,t.jsx)(h,{size:12})})]})]},e.id)})]}),(0,t.jsxs)("nav",{className:"thread-sidebar__section",children:[(0,t.jsx)("div",{className:"thread-sidebar__section-header",children:(0,t.jsx)(p.default,{href:"/projects",className:"thread-sidebar__section-label hover:text-slate-700 transition-colors cursor-pointer",children:"Boards"})}),(0,t.jsx)("div",{className:"thread-sidebar__workspace-list",children:z.map(e=>(0,t.jsx)("div",{className:"thread-sidebar__workspace-item group",children:(0,t.jsxs)(p.default,{href:`/projects/${e.slug}`,className:"thread-sidebar__nav-item thread-sidebar__workspace-nav-item flex items-center gap-3",children:[(0,t.jsx)(s.Minus,{size:16,className:"flex-shrink-0 text-slate-400"}),(0,t.jsx)("span",{className:"thread-sidebar__workspace-title",children:e.name})]})},e.slug))})]}),(0,t.jsxs)("section",{className:"thread-sidebar__section",children:[(0,t.jsxs)("div",{className:"thread-sidebar__section-header",children:[(0,t.jsx)("p",{className:"thread-sidebar__section-label",children:"Agents"}),(0,t.jsx)("div",{className:"thread-sidebar__header-actions",children:(0,t.jsx)("button",{type:"button",className:"thread-sidebar__action",onClick:()=>P(e=>(e??0)+1),disabled:!F,"aria-label":"Add agent",title:"Add agent",children:(0,t.jsx)(d.Plus,{size:14})})})]}),F?(0,t.jsx)(A,{participants:r,onAdd:w,onUpdate:S,onRemove:C,activeParticipantIds:M,onToggleActive:N,onReorder:T,showInlineAdd:!1,openAddNonce:R??void 0,variant:"sidebar"}):(0,t.jsx)("p",{className:"thread-sidebar__models-empty",children:"Agent configuration unavailable"})]})]}),(0,t.jsx)("div",{className:"mt-auto px-3 pb-3",children:(0,t.jsxs)("a",{href:"https://discord.gg/y77e9Euz",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 w-full py-2 rounded-lg text-white text-sm font-medium transition-colors",style:{backgroundColor:"#5865F2"},onMouseEnter:e=>e.currentTarget.style.backgroundColor="#4752C4",onMouseLeave:e=>e.currentTarget.style.backgroundColor="#5865F2",children:[(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 71 55",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M60.1 4.9A58.5 58.5 0 0045.4.2a.2.2 0 00-.2.1 40.8 40.8 0 00-1.8 3.7 54 54 0 00-16.2 0A37.4 37.4 0 0025.4.3a.2.2 0 00-.2-.1A58.4 58.4 0 0010.5 4.9a.2.2 0 00-.1.1C1.5 18.7-.9 32.2.3 45.5v.1a58.8 58.8 0 0017.7 9a.2.2 0 00.3-.1 42 42 0 003.6-5.9.2.2 0 00-.1-.3 38.8 38.8 0 01-5.5-2.6.2.2 0 01 0-.4l1.1-.9a.2.2 0 01.2 0 42 42 0 0035.6 0 .2.2 0 01.2 0l1.1.9a.2.2 0 010 .4 36.4 36.4 0 01-5.5 2.6.2.2 0 00-.1.3 47.2 47.2 0 003.6 5.9.2.2 0 00.3.1 58.6 58.6 0 0017.7-9v-.1c1.4-15.2-2.4-28.4-10-40.1a.2.2 0 00-.1-.1zM23.7 37.3c-3.5 0-6.3-3.2-6.3-7s2.8-7 6.3-7 6.4 3.2 6.3 7-2.8 7-6.3 7zm23.3 0c-3.5 0-6.3-3.2-6.3-7s2.8-7 6.3-7 6.4 3.2 6.3 7-2.8 7-6.3 7z"})}),"Join Discord"]})})]}):(0,t.jsxs)("aside",{id:"thread-sidebar",className:"thread-sidebar thread-sidebar--collapsed","aria-label":"Workspace sidebar",children:[(0,t.jsx)("div",{className:"thread-sidebar__brand",children:(0,t.jsx)("button",{type:"button",onClick:O,className:"thread-sidebar__brand-icon p-0 bg-transparent hover:bg-transparent border-none outline-none","aria-label":"Show workspaces",title:"Show workspaces",children:(0,t.jsxs)("svg",{width:"52",height:"31",viewBox:"0 0 64 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"transition-transform hover:scale-105",children:[(0,t.jsx)("rect",{width:"64",height:"38",rx:"8",fill:"black"}),(0,t.jsxs)("g",{stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M 14 27 C 17 16 19 10 20 8 C 21 12 23 20 25 27"}),(0,t.jsx)("path",{d:"M 16 20 C 19 19 21 21 23 20"}),(0,t.jsx)("path",{d:"M 40 13 C 35 10 30 13 30 19 C 30 25 34 28 38 27 C 40 26 40 22 40 20 L 36 20"}),(0,t.jsx)("path",{d:"M 46 11 C 48 16 51 22 54 27"}),(0,t.jsx)("path",{d:"M 54 11 C 52 16 49 22 46 27"})]})]})})}),(0,t.jsx)("div",{className:"mt-auto p-2",children:(0,t.jsx)("a",{href:"https://discord.gg/y77e9Euz",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center w-8 h-8 rounded-lg text-white transition-colors",style:{backgroundColor:"#5865F2"},onMouseEnter:e=>e.currentTarget.style.backgroundColor="#4752C4",onMouseLeave:e=>e.currentTarget.style.backgroundColor="#5865F2",title:"Join Discord",children:(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 71 55",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M60.1 4.9A58.5 58.5 0 0045.4.2a.2.2 0 00-.2.1 40.8 40.8 0 00-1.8 3.7 54 54 0 00-16.2 0A37.4 37.4 0 0025.4.3a.2.2 0 00-.2-.1A58.4 58.4 0 0010.5 4.9a.2.2 0 00-.1.1C1.5 18.7-.9 32.2.3 45.5v.1a58.8 58.8 0 0017.7 9a.2.2 0 00.3-.1 42 42 0 003.6-5.9.2.2 0 00-.1-.3 38.8 38.8 0 01-5.5-2.6.2.2 0 01 0-.4l1.1-.9a.2.2 0 01.2 0 42 42 0 0035.6 0 .2.2 0 01.2 0l1.1.9a.2.2 0 010 .4 36.4 36.4 0 01-5.5 2.6.2.2 0 00-.1.3 47.2 47.2 0 003.6 5.9.2.2 0 00.3.1 58.6 58.6 0 0017.7-9v-.1c1.4-15.2-2.4-28.4-10-40.1a.2.2 0 00-.1-.1zM23.7 37.3c-3.5 0-6.3-3.2-6.3-7s2.8-7 6.3-7 6.4 3.2 6.3 7-2.8 7-6.3 7zm23.3 0c-3.5 0-6.3-3.2-6.3-7s2.8-7 6.3-7 6.4 3.2 6.3 7-2.8 7-6.3 7z"})})})})]})}function D(){}function R(){}let P=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,z=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,L={};function $(e,t){return((t||L).jsx?z:P).test(e)}let F=/[ \t\n\f\r]/g;function B(e){return""===e.replace(F,"")}class _{constructor(e,t){this.attribute=t,this.property=e}}_.prototype.attribute="",_.prototype.booleanish=!1,_.prototype.boolean=!1,_.prototype.commaOrSpaceSeparated=!1,_.prototype.commaSeparated=!1,_.prototype.defined=!1,_.prototype.mustUseProperty=!1,_.prototype.number=!1,_.prototype.overloadedBoolean=!1,_.prototype.property="",_.prototype.spaceSeparated=!1,_.prototype.space=void 0;let V=0,H=Q(),U=Q(),q=Q(),W=Q(),K=Q(),J=Q(),G=Q();function Q(){return 2**++V}e.s(["boolean",0,H,"booleanish",0,U,"commaOrSpaceSeparated",0,G,"commaSeparated",0,J,"number",0,W,"overloadedBoolean",0,q,"spaceSeparated",0,K],42158);var X=e.i(42158);let Y=Object.keys(X);class Z extends _{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<Y.length;){const e=Y[i];!function(e,t,n){n&&(e[t]=n)}(this,Y[i],(n&X[e])===X[e])}}}function ee(e){return e.toLowerCase()}Z.prototype.defined=!0;let et=/[A-Z]/g,en=/-[a-z]/g,er=/^data[-\w.:]+$/i;function ei(e){return"-"+e.toLowerCase()}function eo(e){return e.charAt(1).toUpperCase()}let es={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class el{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function ea(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new el(n,r,t)}function ec(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let o=new Z(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[ee(r)]=r,n[ee(o.attribute)]=r}return new el(t,n,e.space)}el.prototype.normal={},el.prototype.property={},el.prototype.space=void 0;let ed=ec({properties:{ariaActiveDescendant:null,ariaAtomic:U,ariaAutoComplete:null,ariaBusy:U,ariaChecked:U,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:K,ariaCurrent:null,ariaDescribedBy:K,ariaDetails:null,ariaDisabled:U,ariaDropEffect:K,ariaErrorMessage:null,ariaExpanded:U,ariaFlowTo:K,ariaGrabbed:U,ariaHasPopup:null,ariaHidden:U,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:K,ariaLevel:W,ariaLive:null,ariaModal:U,ariaMultiLine:U,ariaMultiSelectable:U,ariaOrientation:null,ariaOwns:K,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:U,ariaReadOnly:U,ariaRelevant:null,ariaRequired:U,ariaRoleDescription:K,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:U,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function eu(e,t){return t in e?e[t]:t}function eh(e,t){return eu(e,t.toLowerCase())}let ep=ec({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:J,acceptCharset:K,accessKey:K,action:null,allow:null,allowFullScreen:H,allowPaymentRequest:H,allowUserMedia:H,alt:null,as:null,async:H,autoCapitalize:null,autoComplete:K,autoFocus:H,autoPlay:H,blocking:K,capture:null,charSet:null,checked:H,cite:null,className:K,cols:W,colSpan:null,content:null,contentEditable:U,controls:H,controlsList:K,coords:W|J,crossOrigin:null,data:null,dateTime:null,decoding:null,default:H,defer:H,dir:null,dirName:null,disabled:H,download:q,draggable:U,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:H,formTarget:null,headers:K,height:W,hidden:q,high:W,href:null,hrefLang:null,htmlFor:K,httpEquiv:K,id:null,imageSizes:null,imageSrcSet:null,inert:H,inputMode:null,integrity:null,is:null,isMap:H,itemId:null,itemProp:K,itemRef:K,itemScope:H,itemType:K,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:H,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:H,muted:H,name:null,nonce:null,noModule:H,noValidate:H,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:H,optimum:W,pattern:null,ping:K,placeholder:null,playsInline:H,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:H,referrerPolicy:null,rel:K,required:H,reversed:H,rows:W,rowSpan:W,sandbox:K,scope:null,scoped:H,seamless:H,selected:H,shadowRootClonable:H,shadowRootDelegatesFocus:H,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:U,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:H,useMap:null,value:U,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:K,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:H,declare:H,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:H,noHref:H,noShade:H,noWrap:H,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:U,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:H,disableRemotePlayback:H,prefix:null,property:null,results:W,security:null,unselectable:null},space:"html",transform:eh}),ef=ec({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:G,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:K,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:H,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:J,g2:J,glyphName:J,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:G,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:K,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:G,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:G,rev:G,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:G,requiredFeatures:G,requiredFonts:G,requiredFormats:G,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:G,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:G,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:G,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:eu}),em=ec({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),eg=ec({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:eh}),ey=ec({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),ex=ea([ed,ep,em,eg,ey],"html"),eb=ea([ed,ef,em,eg,ey],"svg");var ev=e.i(95736);let ek=eS("end"),ew=eS("start");function eS(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function eC(e){return e&&"object"==typeof e?"position"in e||"type"in e?eN(e.position):"start"in e||"end"in e?eN(e):"line"in e||"column"in e?eM(e):"":""}function eM(e){return eT(e&&e.line)+":"+eT(e&&e.column)}function eN(e){return eM(e&&e.start)+"-"+eM(e&&e.end)}function eT(e){return e&&"number"==typeof e?e:1}class ej extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},o=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(o=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=s?s.line:void 0,this.name=eC(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ej.prototype.file="",ej.prototype.name="",ej.prototype.reason="",ej.prototype.message="",ej.prototype.stack="",ej.prototype.column=void 0,ej.prototype.line=void 0,ej.prototype.ancestors=void 0,ej.prototype.cause=void 0,ej.prototype.fatal=void 0,ej.prototype.place=void 0,ej.prototype.ruleId=void 0,ej.prototype.source=void 0;let eE={}.hasOwnProperty,eO=new Map,eA=/[A-Z]/g,eI=new Set(["table","tbody","thead","tfoot","tr"]),eD=new Set(["td","th"]),eR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function eP(e,t,n){var r,i,o,s,l,a,c,d,u;let h,p,f,m,g,y,x,b,v,k,w;return"element"===t.type?(r=e,i=t,o=n,p=h=r.schema,"svg"===i.tagName.toLowerCase()&&"html"===h.space&&(r.schema=eb),r.ancestors.push(i),f=eF(r,i.tagName,!1),m=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&eE.call(t.properties,r)){let o=function(e,t,n){let r=function(e,t){let n=ee(t),r=t,i=_;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&er.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(en,eo);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!en.test(e)){let n=e.replace(et,ei);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=Z}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,ev.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new ej("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=eR+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)eE.call(e,t)&&(n[function(e){let t=e.replace(eA,e_);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?es[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(o){let[r,s]=o;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof s&&eD.has(t.tagName)?n=s:i[r]=s}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(r,i),g=e$(r,i),eI.has(i.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&B(e.value):B(e))})),ez(r,m,f,i),eL(m,g),r.ancestors.pop(),r.schema=h,r.create(i,f,m,o)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return D("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}eB(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(s=e,l=t,a=n,x=y=s.schema,"svg"===l.name&&"html"===y.space&&(s.schema=eb),s.ancestors.push(l),b=null===l.name?s.Fragment:eF(s,l.name,!0),v=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];D("ExpressionStatement"===t.type);let i=t.expression;D("ObjectExpression"===i.type);let o=i.properties[0];D("SpreadElement"===o.type),Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else eB(e,t.position);else{let i,o=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];D("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else eB(e,t.position);else i=null===r.value||r.value;n[o]=i}return n}(s,l),k=e$(s,l),ez(s,v,b,l),eL(v,k),s.ancestors.pop(),s.schema=y,s.create(l,b,v,a)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);eB(e,t.position)}(e,t):"root"===t.type?(c=e,d=t,u=n,eL(w={},e$(c,d)),c.create(d,c.Fragment,w,u)):"text"===t.type?t.value:void 0}function ez(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function eL(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function e$(e,t){let n=[],r=-1,i=e.passKeys?new Map:eO;for(;++r<t.children.length;){let o,s=t.children[r];if(e.passKeys){let e="element"===s.type?s.tagName:"mdxJsxFlowElement"===s.type||"mdxJsxTextElement"===s.type?s.name:void 0;if(e){let t=i.get(e)||0;o=e+"-"+t,i.set(e,t+1)}}let l=eP(e,s,o);void 0!==l&&n.push(l)}return n}function eF(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=$(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}D(e,"always a result"),r=e}else r=$(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return eE.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);eB(e)}function eB(e,t){let n=new ej("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=eR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function e_(e){return"-"+e.toLowerCase()}let eV={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},eH={};function eU(e,t){let n=t||eH;return eq(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function eq(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return eW(e.children,t,n)}return Array.isArray(e)?eW(e,t,n):""}function eW(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=eq(e[i],t,n);return r.join("")}function eK(e,t,n,r){let i,o=e.length,s=0;if(t=t<0?-t>o?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)(i=r.slice(s,s+1e4)).unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function eJ(e,t){return e.length>0?(eK(e,e.length,0,t),e):t}let eG={}.hasOwnProperty;function eQ(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(eG.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];if(o)for(r in o){eG.call(i,r)||(i[r]=[]);let e=o[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);eK(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}let eX=e7(/[A-Za-z]/),eY=e7(/[\dA-Za-z]/),eZ=e7(/[#-'*+\--9=?A-Z^-~]/);function e0(e){return null!==e&&(e<32||127===e)}let e1=e7(/\d/),e2=e7(/[\dA-Fa-f]/),e3=e7(/[!-/:-@[-`{-~]/);function e5(e){return null!==e&&e<-2}function e4(e){return null!==e&&(e<0||32===e)}function e6(e){return -2===e||-1===e||32===e}let e8=e7(/\p{P}|\p{S}/u),e9=e7(/\s/);function e7(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function te(e,t,n,r){let i=r?r-1:1/0,o=0;return function(r){return e6(r)?(e.enter(n),function r(s){return e6(s)&&o++<i?(e.consume(s),r):(e.exit(n),t(s))}(r)):t(r)}}let tt={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),te(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return e5(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},tn={tokenize:function(e){let t,n,r,i=this,o=[],s=0;return l;function l(t){if(s<o.length){let n=o[s];return i.containerState=n[1],e.attempt(n[0].continuation,a,c)(t)}return c(t)}function a(e){if(s++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&y();let r=i.events.length,o=r;for(;o--;)if("exit"===i.events[o][0]&&"chunkFlow"===i.events[o][1].type){n=i.events[o][1].end;break}g(s);let l=r;for(;l<i.events.length;)i.events[l][1].end={...n},l++;return eK(i.events,o+1,0,i.events.slice(r)),i.events.length=l,c(e)}return l(e)}function c(n){if(s===o.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return f(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(tr,d,u)(n)}function d(e){return t&&y(),g(s),h(e)}function u(e){return i.parser.lazy[i.now().line]=s!==o.length,r=i.now().offset,f(e)}function h(t){return i.containerState={},e.attempt(tr,p,f)(t)}function p(e){return s++,o.push([i.currentConstruct,i.containerState]),h(e)}function f(r){if(null===r){t&&y(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return e5(n)?(e.consume(n),m(e.exit("chunkFlow")),s=0,i.interrupt=void 0,l):(e.consume(n),t)}(r)}function m(e,o){let l=i.sliceStream(e);if(o&&l.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(l),i.parser.lazy[e.start.line]){let e,n,o=t.events.length;for(;o--;)if(t.events[o][1].start.offset<r&&(!t.events[o][1].end||t.events[o][1].end.offset>r))return;let l=i.events.length,a=l;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){if(e){n=i.events[a][1].end;break}e=!0}for(g(s),o=l;o<i.events.length;)i.events[o][1].end={...n},o++;eK(i.events,a+1,0,i.events.slice(l)),i.events.length=o}}function g(t){let n=o.length;for(;n-- >t;){let t=o[n];i.containerState=t[1],t[0].exit.call(i,e)}o.length=t}function y(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},tr={tokenize:function(e,t,n){return te(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},ti={partial:!0,tokenize:function(e,t,n){return function(t){return e6(t)?te(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||e5(e)?t(e):n(e)}}};class to{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&ts(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),ts(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ts(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);ts(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);ts(this.left,t.reverse())}}}function ts(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function tl(e){let t,n,r,i,o,s,l,a={},c=-1,d=new to(e);for(;++c<d.length;){for(;c in a;)c=a[c];if(t=d.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===d.get(c-1)[1].type&&((r=0)<(s=t[1]._tokenizer.events).length&&"lineEndingBlank"===s[r][1].type&&(r+=2),r<s.length&&"content"===s[r][1].type))for(;++r<s.length&&"content"!==s[r][1].type;)"chunkText"===s[r][1].type&&(s[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(a,function(e,t){let n,r,i=e.get(t)[1],o=e.get(t)[2],s=t-1,l=[],a=i._tokenizer;!a&&(a=o.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));let c=a.events,d=[],u={},h=-1,p=i,f=0,m=0,g=[0];for(;p;){for(;e.get(++s)[1]!==p;);l.push(s),!p._tokenizer&&(n=o.sliceStream(p),p.next||n.push(null),r&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(n),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),r=p,p=p.next}for(p=i;++h<c.length;)"exit"===c[h][0]&&"enter"===c[h-1][0]&&c[h][1].type===c[h-1][1].type&&c[h][1].start.line!==c[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){let t=c.slice(g[h],g[h+1]),n=l.pop();d.push([n,n+t.length-1]),e.splice(n,2,t)}for(d.reverse(),h=-1;++h<d.length;)u[f+d[h][0]]=f+d[h][1],f+=d[h][1]-d[h][0]-1;return u}(d,c)),c=a[c],l=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=d.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(d.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...d.get(n)[1].start},(o=d.slice(n,c)).unshift(t),d.splice(n,c-n+1,o))}}return eK(e,0,1/0,d.slice(0)),!l}let ta={resolve:function(e){return tl(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):e5(t)?e.check(tc,o,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},tc={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),te(e,i,"linePrefix")};function i(i){if(null===i||e5(i))return n(i);let o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},td={tokenize:function(e){let t=this,n=e.attempt(ti,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,te(e,e.attempt(this.parser.constructs.flow,r,e.attempt(ta,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},tu={resolveAll:tm()},th=tf("string"),tp=tf("text");function tf(e){return{resolveAll:tm("text"===e?tg:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,o,s);return o;function o(e){return a(e)?i(e):s(e)}function s(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),l)}function l(e){return a(e)?(t.exit("data"),i(e)):(t.consume(e),l)}function a(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function tm(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function tg(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],o=t.sliceStream(i),s=o.length,l=-1,a=0;for(;s--;){let e=o[s];if("string"==typeof e){for(l=e.length;32===e.charCodeAt(l-1);)a++,l--;if(l)break;l=-1}else if(-2===e)r=!0,a++;else if(-1===e);else{s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){let o={type:n===e.length||r||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:i.start._bufferIndex+l,_index:i.start._index+s,line:i.end.line,column:i.end.column-a,offset:i.end.offset-a},end:{...i.end}};i.end={...o.start},i.start.offset===i.end.offset?Object.assign(i,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}function ty(e){return null===e||e4(e)||e9(e)?1:e8(e)?2:void 0}function tx(e,t,n){let r=[],i=-1;for(;++i<e.length;){let o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}let tb={name:"attention",resolveAll:function(e,t){let n,r,i,o,s,l,a,c,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close){for(n=d;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[n][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;let u={...e[n][1].end},h={...e[d][1].start};tv(u,-l),tv(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[d][1].start},end:h},i={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[d][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[n][1].end={...o.start},e[d][1].start={...s.end},a=[],e[n][1].end.offset-e[n][1].start.offset&&(a=eJ(a,[["enter",e[n][1],t],["exit",e[n][1],t]])),a=eJ(a,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),a=eJ(a,tx(t.parser.constructs.insideSpan.null,e.slice(n+1,d),t)),a=eJ(a,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[d][1].end.offset-e[d][1].start.offset?(c=2,a=eJ(a,[["enter",e[d][1],t],["exit",e[d][1],t]])):c=0,eK(e,n-1,d-n+3,a),d=n+a.length-c-2;break}}for(d=-1;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,o=ty(i);return function(s){return n=s,e.enter("attentionSequence"),function s(l){if(l===n)return e.consume(l),s;let a=e.exit("attentionSequence"),c=ty(l),d=!c||2===c&&o||r.includes(l),u=!o||2===o&&c||r.includes(i);return a._open=!!(42===n?d:d&&(o||!u)),a._close=!!(42===n?u:u&&(c||!d)),t(l)}(s)}}};function tv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let tk={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return e6(t)?te(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(tk,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return e6(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},tw={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return e3(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},tS=document.createElement("i");function tC(e){let t="&"+e+";";tS.innerHTML=t;let n=tS.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let tM={name:"characterReference",tokenize:function(e,t,n){let r,i,o=this,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),l};function l(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),r=31,i=eY,c(t))}function a(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=e2,c):(e.enter("characterReferenceValue"),r=7,i=e1,c(t))}function c(l){if(59===l&&s){let r=e.exit("characterReferenceValue");return i!==eY||tC(o.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(l)}return i(l)&&s++<r?(e.consume(l),c):n(l)}}},tN={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},tT={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,o={partial:!0,tokenize:function(e,t,n){let o=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),e6(t)?te(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):a(t)}function a(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(o++,e.consume(i),t):o>=l?(e.exit("codeFencedFenceSequence"),e6(i)?te(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||e5(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},s=0,l=0;return function(t){var o;let c;return o=t,s=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=o,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(l++,e.consume(i),t):l<3?n(i):(e.exit("codeFencedFenceSequence"),e6(i)?te(e,a,"whitespace")(i):a(i))}(o)};function a(o){return null===o||e5(o)?(e.exit("codeFencedFence"),i.interrupt?t(o):e.check(tN,d,f)(o)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||e5(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),a(i)):e6(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),te(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(o))}function c(t){return null===t||e5(t)?a(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||e5(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),a(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function d(t){return e.attempt(o,f,u)(t)}function u(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return s>0&&e6(t)?te(e,p,"linePrefix",s+1)(t):p(t)}function p(t){return null===t||e5(t)?e.check(tN,d,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||e5(n)?(e.exit("codeFlowValue"),p(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}}},tj={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),te(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?o(n):e5(n)?e.attempt(tE,t,o)(n):(e.enter("codeFlowValue"),function n(r){return null===r||e5(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function o(n){return e.exit("codeIndented"),t(n)}}},tE={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):e5(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):te(e,o,"linePrefix",5)(t)}function o(e){let o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):e5(e)?i(e):n(e)}}};function tO(e,t,n,r,i,o,s,l,a){let c=a||1/0,d=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),u):null===t||32===t||41===t||e0(t)?n(t):(e.enter(r),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),f(t))};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(l),u(t)):null===t||60===t||e5(t)?n(t):(e.consume(t),92===t?p:h)}function p(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function f(i){return!d&&(null===i||41===i||e4(i))?(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(r),t(i)):d<c&&40===i?(e.consume(i),d++,f):41===i?(e.consume(i),d--,f):null===i||32===i||40===i||e0(i)?n(i):(e.consume(i),92===i?m:f)}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function tA(e,t,n,r,i,o){let s,l=this,a=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(u){return a>999||null===u||91===u||93===u&&!s||94===u&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?n(u):93===u?(e.exit(o),e.enter(i),e.consume(u),e.exit(i),e.exit(r),t):e5(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(u))}function d(t){return null===t||91===t||93===t||e5(t)||a++>999?(e.exit("chunkString"),c(t)):(e.consume(t),s||(s=!e6(t)),92===t?u:d)}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,d):d(t)}}function tI(e,t,n,r,i,o){let s;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,l):n(t)};function l(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),a(n))}function a(t){return t===s?(e.exit(o),l(s)):null===t?n(t):e5(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),te(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||e5(t)?(e.exit("chunkString"),a(t)):(e.consume(t),92===t?d:c)}function d(t){return t===s||92===t?(e.consume(t),c):c(t)}}function tD(e,t){let n;return function r(i){return e5(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):e6(i)?te(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function tR(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let tP={partial:!0,tokenize:function(e,t,n){return function(t){return e4(t)?tD(e,r)(t):n(t)};function r(t){return tI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return e6(t)?te(e,o,"whitespace")(t):o(t)}function o(e){return null===e||e5(e)?t(e):n(e)}}},tz=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],tL=["pre","script","style","textarea"],t$={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(ti,t,n)}}},tF={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e5(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},tB={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&eK(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,o,s=e.length,l=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){l=2;break}}else"labelEnd"===n.type&&(i=s);let a={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[r+l+2][1].end},end:{...e[i-2][1].start}};return o=eJ(o=[["enter",a,t],["enter",c,t]],e.slice(r+1,r+l+3)),o=eJ(o,[["enter",d,t]]),o=eJ(o,tx(t.parser.constructs.insideSpan.null,e.slice(r+l+4,i-3),t)),o=eJ(o,[["exit",d,t],e[i-2],e[i-1],["exit",c,t]]),o=eJ(o,e.slice(i+1)),o=eJ(o,[["exit",a,t]]),eK(e,r,e.length,o),e},tokenize:function(e,t,n){let r,i,o=this,s=o.events.length;for(;s--;)if(("labelImage"===o.events[s][1].type||"labelLink"===o.events[s][1].type)&&!o.events[s][1]._balanced){r=o.events[s][1];break}return function(t){return r?r._inactive?d(t):(i=o.parser.defined.includes(tR(o.sliceSerialize({start:r.end,end:o.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),l):n(t)};function l(t){return 40===t?e.attempt(t_,c,i?c:d)(t):91===t?e.attempt(tV,c,i?a:d)(t):i?c(t):d(t)}function a(t){return e.attempt(tH,c,d)(t)}function c(e){return t(e)}function d(e){return r._balanced=!0,n(e)}}},t_={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return e4(t)?tD(e,i)(t):i(t)}function i(t){return 41===t?c(t):tO(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return e4(t)?tD(e,l)(t):c(t)}function s(e){return n(e)}function l(t){return 34===t||39===t||40===t?tI(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function a(t){return e4(t)?tD(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},tV={tokenize:function(e,t,n){let r=this;return function(t){return tA.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(tR(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},tH={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},tU={name:"labelStartImage",resolveAll:tB.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tq={name:"labelStartLink",resolveAll:tB.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tW={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),te(e,t,"linePrefix")}}},tK={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(o){var s;return e.enter("thematicBreak"),r=s=o,function o(s){return s===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),e6(n)?te(e,o,"whitespace")(n):o(n))}(s)):i>=3&&(null===s||e5(s))?(e.exit("thematicBreak"),t(s)):n(s)}(s)}}},tJ={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ti,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,te(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!e6(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(tQ,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,te(e,e.attempt(tJ,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:e1(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(tK,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return e1(i)&&++s<10?(e.consume(i),t):(!r.interrupt||s<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),l(i)):n(i)}(t)}return n(t)};function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(ti,r.interrupt?n:a,e.attempt(tG,d,c))}function a(e){return r.containerState.initialBlankLine=!0,o++,d(e)}function c(t){return e6(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},tG={partial:!0,tokenize:function(e,t,n){let r=this;return te(e,function(e){let i=r.events[r.events.length-1];return!e6(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},tQ={partial:!0,tokenize:function(e,t,n){let r=this;return te(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},tX={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);let s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=s,e.push(["exit",s,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var s;let l,a=i.events.length;for(;a--;)if("lineEnding"!==i.events[a][1].type&&"linePrefix"!==i.events[a][1].type&&"content"!==i.events[a][1].type){l="paragraph"===i.events[a][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||l)?(e.enter("setextHeadingLine"),r=t,s=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),e6(n)?te(e,o,"lineSuffix")(n):o(n))}(s)):n(t)};function o(r){return null===r||e5(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,tA.call(i,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function o(t){return(r=tR(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return e4(t)?tD(e,l)(t):l(t)}function l(t){return tO(e,a,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function a(t){return e.attempt(tP,c,c)(t)}function c(t){return e6(t)?te(e,d,"whitespace")(t):d(t)}function d(o){return null===o||e5(o)?(e.exit("definition"),i.parser.defined.push(r),t(o)):n(o)}}}},"disable",0,{null:[]},"document",0,{42:tJ,43:tJ,45:tJ,48:tJ,49:tJ,50:tJ,51:tJ,52:tJ,53:tJ,54:tJ,55:tJ,56:tJ,57:tJ,62:tk},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,o=3;return"whitespace"===e[3][1].type&&(o+=2),i-2>o&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4),i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},eK(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var o;return e.enter("atxHeading"),o=i,e.enter("atxHeadingSequence"),function i(o){return 35===o&&r++<6?(e.consume(o),i):null===o||e4(o)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||e5(r)?(e.exit("atxHeading"),t(r)):e6(r)?te(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||e4(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(o)):n(o)}(o)}}},42:tK,45:[tX,tK],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,o,s,l,a=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(s){return 33===s?(e.consume(s),d):47===s?(e.consume(s),i=!0,p):63===s?(e.consume(s),r=3,a.interrupt?t:I):eX(s)?(e.consume(s),o=String.fromCharCode(s),f):n(s)}function d(i){return 45===i?(e.consume(i),r=2,u):91===i?(e.consume(i),r=5,s=0,h):eX(i)?(e.consume(i),r=4,a.interrupt?t:I):n(i)}function u(r){return 45===r?(e.consume(r),a.interrupt?t:I):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(s++)?(e.consume(r),s===i.length)?a.interrupt?t:C:h:n(r)}function p(t){return eX(t)?(e.consume(t),o=String.fromCharCode(t),f):n(t)}function f(s){if(null===s||47===s||62===s||e4(s)){let l=47===s,c=o.toLowerCase();return!l&&!i&&tL.includes(c)?(r=1,a.interrupt?t(s):C(s)):tz.includes(o.toLowerCase())?(r=6,l)?(e.consume(s),m):a.interrupt?t(s):C(s):(r=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(s):i?function t(n){return e6(n)?(e.consume(n),t):w(n)}(s):g(s))}return 45===s||eY(s)?(e.consume(s),o+=String.fromCharCode(s),f):n(s)}function m(r){return 62===r?(e.consume(r),a.interrupt?t:C):n(r)}function g(t){return 47===t?(e.consume(t),w):58===t||95===t||eX(t)?(e.consume(t),y):e6(t)?(e.consume(t),g):w(t)}function y(t){return 45===t||46===t||58===t||95===t||eY(t)?(e.consume(t),y):x(t)}function x(t){return 61===t?(e.consume(t),b):e6(t)?(e.consume(t),x):g(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,v):e6(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||e4(n)?x(n):(e.consume(n),t)}(t)}function v(t){return t===l?(e.consume(t),l=null,k):null===t||e5(t)?n(t):(e.consume(t),v)}function k(e){return 47===e||62===e||e6(e)?g(e):n(e)}function w(t){return 62===t?(e.consume(t),S):n(t)}function S(t){return null===t||e5(t)?C(t):e6(t)?(e.consume(t),S):n(t)}function C(t){return 45===t&&2===r?(e.consume(t),j):60===t&&1===r?(e.consume(t),E):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),I):93===t&&5===r?(e.consume(t),A):e5(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(t$,R,M)(t)):null===t||e5(t)?(e.exit("htmlFlowData"),M(t)):(e.consume(t),C)}function M(t){return e.check(tF,N,R)(t)}function N(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),T}function T(t){return null===t||e5(t)?M(t):(e.enter("htmlFlowData"),C(t))}function j(t){return 45===t?(e.consume(t),I):C(t)}function E(t){return 47===t?(e.consume(t),o="",O):C(t)}function O(t){if(62===t){let n=o.toLowerCase();return tL.includes(n)?(e.consume(t),D):C(t)}return eX(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),O):C(t)}function A(t){return 93===t?(e.consume(t),I):C(t)}function I(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),I):C(t)}function D(t){return null===t||e5(t)?(e.exit("htmlFlowData"),R(t)):(e.consume(t),D)}function R(n){return e.exit("htmlFlow"),t(n)}}},61:tX,95:tK,96:tT,126:tT},"flowInitial",0,{[-2]:tj,[-1]:tj,32:tj},"insideSpan",0,{null:[tb,tu]},"string",0,{38:tM,92:tw},"text",0,{[-5]:tW,[-4]:tW,[-3]:tW,33:tU,38:tM,42:tb,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return eX(t)?(e.consume(t),o):64===t?n(t):l(t)}function o(t){return 43===t||45===t||46===t||eY(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,s):(43===n||45===n||46===n||eY(n))&&r++<32?(e.consume(n),t):(r=0,l(n))}(t)):l(t)}function s(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||e0(r)?n(r):(e.consume(r),s)}function l(t){return 64===t?(e.consume(t),a):eZ(t)?(e.consume(t),l):n(t)}function a(i){return eY(i)?function i(o){return 46===o?(e.consume(o),r=0,a):62===o?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(o),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(o){if((45===o||eY(o))&&r++<63){let n=45===o?t:i;return e.consume(o),n}return n(o)}(o)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,o,s=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),l};function l(t){return 33===t?(e.consume(t),a):47===t?(e.consume(t),v):63===t?(e.consume(t),x):eX(t)?(e.consume(t),w):n(t)}function a(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,p):eX(t)?(e.consume(t),y):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function d(t){return null===t?n(t):45===t?(e.consume(t),u):e5(t)?(o=d,O(t)):(e.consume(t),d)}function u(t){return 45===t?(e.consume(t),h):d(t)}function h(e){return 62===e?E(e):45===e?u(e):d(e)}function p(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):e5(t)?(o=f,O(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?E(t):93===t?(e.consume(t),g):f(t)}function y(t){return null===t||62===t?E(t):e5(t)?(o=y,O(t)):(e.consume(t),y)}function x(t){return null===t?n(t):63===t?(e.consume(t),b):e5(t)?(o=x,O(t)):(e.consume(t),x)}function b(e){return 62===e?E(e):x(e)}function v(t){return eX(t)?(e.consume(t),k):n(t)}function k(t){return 45===t||eY(t)?(e.consume(t),k):function t(n){return e5(n)?(o=t,O(n)):e6(n)?(e.consume(n),t):E(n)}(t)}function w(t){return 45===t||eY(t)?(e.consume(t),w):47===t||62===t||e4(t)?S(t):n(t)}function S(t){return 47===t?(e.consume(t),E):58===t||95===t||eX(t)?(e.consume(t),C):e5(t)?(o=S,O(t)):e6(t)?(e.consume(t),S):E(t)}function C(t){return 45===t||46===t||58===t||95===t||eY(t)?(e.consume(t),C):function t(n){return 61===n?(e.consume(n),M):e5(n)?(o=t,O(n)):e6(n)?(e.consume(n),t):S(n)}(t)}function M(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,N):e5(t)?(o=M,O(t)):e6(t)?(e.consume(t),M):(e.consume(t),T)}function N(t){return t===r?(e.consume(t),r=void 0,j):null===t?n(t):e5(t)?(o=N,O(t)):(e.consume(t),N)}function T(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||e4(t)?S(t):(e.consume(t),T)}function j(e){return 47===e||62===e||e4(e)?S(e):n(e)}function E(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function O(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return e6(t)?te(e,I,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):I(t)}function I(t){return e.enter("htmlTextData"),o(t)}}}],91:tq,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return e5(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},tw],93:tB,95:tb,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),o++,t):(e.exit("codeTextSequence"),s(n))}(t)};function s(a){return null===a?n(a):32===a?(e.enter("space"),e.consume(a),e.exit("space"),s):96===a?(i=e.enter("codeTextSequence"),r=0,function n(s){return 96===s?(e.consume(s),r++,n):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(s)):(i.type="codeTextData",l(s))}(a)):e5(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):(e.enter("codeTextData"),l(a))}function l(t){return null===t||32===t||96===t||e5(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),l)}}}}],55077);var tY=e.i(55077);let tZ=/[\0\t\n\r]/g;function t0(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let t1=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function t2(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return t0(n.slice(t?2:1),t?16:10)}return tC(n)||e}let t3={}.hasOwnProperty;function t5(e){return{line:e.line,column:e.column,offset:e.offset}}function t4(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+eC({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+eC({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+eC({start:t.start,end:t.end})+") is still open")}function t6(e){let t=this;t.parser=function(n){var r,i;let o,s,l,a;return"object"==typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(y),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(f),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(p),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(p,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:c,htmlText:r(g,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(y),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(x,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(x),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(f),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:s(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:s(),autolinkEmail:function(e){d.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){d.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:s(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=t0(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=tC(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=t5(e.end)},codeFenced:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:d,codeIndented:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:d,data:d,definition:s(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tR(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:s(),hardBreakEscape:s(u),hardBreakTrailing:s(u),htmlFlow:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:d,htmlText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:d,image:s(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(t1,t2),n.identifier=tR(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=t5(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),d.call(this,e))},link:s(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tR(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:s(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:s(),thematicBreak:s()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(t3.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},s={stack:[r],tokenStack:[],config:t,enter:o,exit:l,buffer:i,resume:a,data:n},c=[],d=-1;for(;++d<e.length;)("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)&&("enter"===e[d][0]?c.push(d):d=function(e,t,n){let r,i,o,s,l=t-1,a=-1,c=!1;for(;++l<=n;){let t=e[l];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?a++:a--,s=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||s||a||o||(o=l),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}if(!a&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===a&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=l;for(i=void 0;s--;){let t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=s}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||l,0,["exit",r,t[2]]),l++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(l,0,["enter",i,t[2]]),l++,n++,o=void 0,s=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];t3.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},s),e[d][1])}if(s.tokenStack.length>0){let e=s.tokenStack[s.tokenStack.length-1];(e[1]||t4).call(s,void 0,e[0])}for(r.position={start:t5(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:t5(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r};function r(e,t){return function(n){o.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function o(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:t5(t.start),end:void 0}}function s(e){return function(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||t4).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+eC({start:e.start,end:e.end})+"): it’s not open");n.position.end=t5(e.end)}function a(){return eU(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:t5(e.start),end:void 0},t.push(n)),this.stack.push(n)}function d(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=t5(e.end)}function u(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function p(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function y(){return{type:"link",title:null,url:"",children:[]}}function x(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!tl(e););return e}((function(e){let t={constructs:eQ([tY,...(e||{}).extensions||[]]),content:n(tt),defined:[],document:n(tn),flow:n(td),lazy:{},string:n(th),text:n(tp)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},o=[],s=[],l=[],a={attempt:f(function(e,t){m(e,t.from)}),check:f(p),consume:function(e){e5(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,g()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),l.push(n),n},exit:function(e){let t=l.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:f(p,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let o,s=e[r];if("string"==typeof s)o=s;else switch(s){case -5:o="\r";break;case -4:o="\n";break;case -3:o="\r\n";break;case -2:o=t?" ":" ";break;case -1:if(!t&&n)continue;o=" ";break;default:o=String.fromCharCode(s)}n=-2===s,i.push(o)}return i.join("")}(u(e),t)},sliceStream:u,write:function(e){return(s=eJ(s,e),function(){let e;for(;r._index<s.length;){let n=s[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),d=d(t)}else d=d(n)}}(),null!==s[s.length-1])?[]:(m(t,0),c.events=tx(o,c.events,c),c.events)}},d=t.tokenize.call(c,a);return t.resolveAll&&o.push(t),c;function u(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;if(r===o)n=[e[r].slice(i,s)];else{if(n=e.slice(r,o),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[o].slice(0,s))}return n}(s,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:o}}function p(e,t){t.restore()}function f(e,t){return function(n,i,o){var s;let d,u,p,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(s=n,function(e){let t=null!==e&&s[e],n=null!==e&&s.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function m(e){return(d=e,u=0,0===e.length)?o:y(e[u])}function y(e){return function(n){let i,o,s,d,u;return(i=h(),o=c.previous,s=c.currentConstruct,d=c.events.length,u=Array.from(l),f={from:d,restore:function(){r=i,c.previous=o,c.currentConstruct=s,c.events.length=d,l=u,g()}},p=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,a,x,b)(n)}}function x(t){return e(p,f),i}function b(e){return(f.restore(),++u<d.length)?y(d[u]):o}}}function m(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&eK(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function g(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((s=1,l="",a=!0,function(e,t,n){let r,i,c,d,u,h=[];for(e=l+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,l="",a&&(65279===e.charCodeAt(0)&&c++,a=void 0);c<e.length;){if(tZ.lastIndex=c,d=(r=tZ.exec(e))&&void 0!==r.index?r.index:e.length,u=e.charCodeAt(d),!r){l=e.slice(c);break}if(10===u&&c===d&&o)h.push(-3),o=void 0;else switch(o&&(h.push(-5),o=void 0),c<d&&(h.push(e.slice(c,d)),s+=d-c),u){case 0:h.push(65533),s++;break;case 9:for(i=4*Math.ceil(s/4),h.push(-2);s++<i;)h.push(-1);break;case 10:h.push(-4),s=1;break;default:o=!0,s=1}c=d+1}return n&&(o&&h.push(-5),l&&h.push(l),h.push(null)),h})(n,r,!0))))}}let t8="object"==typeof self?self:globalThis,t9=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[o,s]=e[i];switch(o){case 0:case -1:return n(s,i);case 1:{let e=n([],i);for(let t of s)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of s)e[r(t)]=r(n);return e}case 3:return n(new Date(s),i);case 4:{let{source:e,flags:t}=s;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of s)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of s)e.add(r(t));return e}case 7:{let{name:e,message:t}=s;return n(new t8[e](t),i)}case 8:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{let{buffer:e}=new Uint8Array(s);return n(new DataView(e),s)}}return n(new t8[o](s),i)})(0)},{toString:t7}={},{keys:ne}=Object,nt=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=t7.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},nn=([e,t])=>0===e&&("function"===t||"symbol"===t),nr=(e,{json:t,lossy:n}={})=>{var r,i,o;let s,l,a=[];return(r=!(t||n),i=!!t,o=new Map,s=(e,t)=>{let n=a.push(e)-1;return o.set(t,n),n},l=e=>{if(o.has(e))return o.get(e);let[t,n]=nt(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return s([-1],e)}return s([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),s([n,[...t]],e)}let r=[],i=s([t,r],e);for(let t of e)r.push(l(t));return i}case 2:{if(n)switch(n){case"BigInt":return s([n,e.toString()],e);case"Boolean":case"Number":case"String":return s([n,e.valueOf()],e)}if(i&&"toJSON"in e)return l(e.toJSON());let o=[],a=s([t,o],e);for(let t of ne(e))(r||!nn(nt(e[t])))&&o.push([l(t),l(e[t])]);return a}case 3:return s([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return s([t,{source:n,flags:r}],e)}case 5:{let n=[],i=s([t,n],e);for(let[t,i]of e)(r||!(nn(nt(t))||nn(nt(i))))&&n.push([l(t),l(i)]);return i}case 6:{let n=[],i=s([t,n],e);for(let t of e)(r||!nn(nt(t)))&&n.push(l(t));return i}}let{message:a}=e;return s([t,{name:n,message:a}],e)})(e),a},ni="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?t9(nr(e,t)):structuredClone(e):(e,t)=>t9(nr(e,t));function no(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let o=e.charCodeAt(n),s="";if(37===o&&eY(e.charCodeAt(n+1))&&eY(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){let t=e.charCodeAt(n+1);o<56320&&t>56319&&t<57344?(s=String.fromCharCode(o,t),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ns(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function nl(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let na=function(e){var t,n;if(null==e)return nd;if("function"==typeof e)return nc(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=na(e[n]);return nc(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,nc(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,nc(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function nc(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function nd(){return!0}let nu=[];function nh(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let o=na(i),s=r?-1:1;(function e(i,l,a){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(d,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return d;function d(){var c;let d,u,h,p=nu;if((!t||o(i,l,a[a.length-1]||void 0))&&!1===(p=Array.isArray(c=n(i,a))?c:"number"==typeof c?[!0,c]:null==c?nu:[c])[0])return p;if("children"in i&&i.children&&i.children&&"skip"!==p[0])for(u=(r?i.children.length:-1)+s,h=a.concat(i);u>-1&&u<i.children.length;){if(!1===(d=e(i.children[u],u,h)())[0])return d;u="number"==typeof d[1]?d[1]:u+s}return p}})(e,void 0,[])()}function np(e,t,n,r){let i,o,s;"function"==typeof t&&"function"!=typeof n?(o=void 0,s=t,i=n):(o=t,s=n,i=r),nh(e,o,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return s(e,r,n)},i)}function nf(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift({type:"text",value:"["});let s=i[i.length-1];return s&&"text"===s.type?s.value+=r:i.push({type:"text",value:r}),i}function nm(e){let t=e.spread;return null==t?e.children.length>1:t}function ng(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let ny={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o={type:"element",tagName:"pre",properties:{},children:[o=e.applyData(t,o)]},e.patch(t,o),o},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),o=no(i.toLowerCase()),s=e.footnoteOrder.indexOf(i),l=e.footnoteCounts.get(i);void 0===l?(l=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=s+1,l+=1,e.footnoteCounts.set(i,l);let a={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,a);let c={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return nf(e,t);let i={src:no(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){let n={src:no(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return nf(e,t);let i={href:no(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){let n={href:no(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=nm(n[r])}return t}(n):nm(t),o={},s=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<r.length;){let e=r[l];(i||0!==l||"element"!==e.type||"p"!==e.tagName)&&s.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?s.push(e):s.push(...e.children)}let a=r[r.length-1];a&&(i||"element"!==a.type||"p"!==a.tagName)&&s.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=ew(t.children[1]),s=ek(t.children[t.children.length-1]);o&&s&&(r.position={start:o,end:s}),i.push(r)}let o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,s=o?o.length:t.children.length,l=-1,a=[];for(;++l<s;){let n=t.children[l],r={},s=o?o[l]:void 0;s&&(r.align=s);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),a.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,o=[];for(;r;)o.push(ng(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(ng(t.slice(i),i>0,!1)),o.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:nx,yaml:nx,definition:nx,footnoteDefinition:nx};function nx(){}let nb={}.hasOwnProperty,nv={};function nk(e,t){e.position&&(t.position=function(e){let t=ew(e),n=ek(e);if(t&&n)return{start:t,end:n}}(e))}function nw(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,ni(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function nS(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function nC(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function nM(e,t){let n,r,i,o,s=(n=t||nv,r=new Map,i=new Map,o={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=o.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=nC(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=nC(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:nw,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...ny,...n.handlers},one:function(e,t){let n=e.type,r=o.handlers[n];if(nb.call(o.handlers,n)&&r)return r(o,e,t);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=ni(n);return r.children=o.all(e),r}return ni(e)}return(o.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(nb.call(n,"hProperties")||nb.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(o,e,t)},options:n,patch:nk,wrap:nS},np(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o),l=s.one(e,void 0),a=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ns,r=e.options.footnoteBackLabel||nl,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[],a=-1;for(;++a<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[a]);if(!i)continue;let o=e.all(i),s=String(i.identifier).toUpperCase(),c=no(s.toLowerCase()),d=0,u=[],h=e.footnoteCounts.get(s);for(;void 0!==h&&++d<=h;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(a,d);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(a,d),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let p=o[o.length-1];if(p&&"element"===p.type&&"p"===p.tagName){let e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...u)}else o.push(...u);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(o,!0)};e.patch(i,f),l.push(f)}if(0!==l.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ni(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:"\n"}]}}(s),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return a&&(D("children"in c),c.children.push({type:"text",value:"\n"},a)),c}function nN(e,t){return e&&"run"in e?async function(n,r){let i=nM(n,{file:r,...t});await e.run(i,r)}:function(n,r){return nM(n,{file:r,...e||t})}}function nT(e){if(e)throw e}var nj=e.i(88353);function nE(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let nO=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');nR(e);let r=0,i=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let s=-1,l=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else s<0&&(n=!0,s=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(i=o):(l=-1,i=s));return r===i?i=s:i<0&&(i=e.length),e.slice(r,i)},nA=function(e){let t;if(nR(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},nI=function(e){let t;nR(e);let n=e.length,r=-1,i=0,o=-1,s=0;for(;n--;){let l=e.codePointAt(n);if(47===l){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===l?o<0?o=n:1!==s&&(s=1):o>-1&&(s=-1)}return o<0||r<0||0===s||1===s&&o===r-1&&o===i+1?"":e.slice(o,r)},nD=function(...e){var t;let n,r,i,o=-1;for(;++o<e.length;)nR(e[o]),e[o]&&(i=void 0===i?e[o]:i+"/"+e[o]);return void 0===i?".":(nR(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",o=0,s=-1,l=0,a=-1;for(;++a<=e.length;){if(a<e.length)n=e.codePointAt(a);else if(47===n)break;else n=47;if(47===n){if(s===a-1||1===l);else if(s!==a-1&&2===l){if(i.length<2||2!==o||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",o=0):o=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),s=a,l=0;continue}}else if(i.length>0){i="",o=0,s=a,l=0;continue}}t&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(s+1,a):i=e.slice(s+1,a),o=a-s-1;s=a,l=0}else 46===n&&l>-1?l++:l=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function nR(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function nP(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let nz=["history","path","basename","stem","extname","dirname"];class nL{constructor(e){let t,n;t=e?nP(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<nz.length;){const e=nz[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)nz.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?nO(this.path):void 0}set basename(e){nF(e,"basename"),n$(e,"basename"),this.path=nD(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?nA(this.path):void 0}set dirname(e){nB(this.basename,"dirname"),this.path=nD(e||"",this.basename)}get extname(){return"string"==typeof this.path?nI(this.path):void 0}set extname(e){if(n$(e,"extname"),nB(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=nD(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){nP(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!nP(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),nF(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?nO(this.path,this.extname):void 0}set stem(e){nF(e,"stem"),n$(e,"stem"),this.path=nD(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new ej(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function n$(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function nF(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function nB(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let n_=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},nV={}.hasOwnProperty;class nH extends n_{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(o,...s){let l=e[++n],a=-1;if(o)return void r(o);for(;++a<t.length;)(null===s[a]||void 0===s[a])&&(s[a]=t[a]);t=s,l?(function(e,t){let n;return function(...t){let o,s=e.length>t.length;s&&t.push(r);try{o=e.apply(this,t)}catch(e){if(s&&n)throw e;return r(e)}s||(o&&o.then&&"function"==typeof o.then?o.then(i,r):o instanceof Error?r(o):i(o))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(l,i)(...s):r(null,...s)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new nH,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,nj.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(nK("data",this.frozen),this.namespace[e]=t,this):nV.call(this.namespace,e)&&this.namespace[e]||void 0:e?(nK("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=nQ(e),n=this.parser||this.Parser;return nq("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),nq("process",this.parser||this.Parser),nW("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let o=nQ(e),s=n.parse(o);function l(e,n){e||!n?i(e):r?r(n):(D(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(s,o,function(e,t,r){var i,o;if(e||!t||!r)return l(e);let s=n.stringify(t,r);"string"==typeof(i=s)||(o=i)&&"object"==typeof o&&"byteLength"in o&&"byteOffset"in o?r.value=s:r.result=s,l(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),nq("processSync",this.parser||this.Parser),nW("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,nT(e),t=r}),nG("processSync","process",n),D(t,"we either bailed on an error or have a tree"),t}run(e,t,n){nJ(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,o){D("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let s=nQ(t);r.run(e,s,function(t,r,s){let l=r||e;t?o(t):i?i(l):(D(n,"`done` is defined if `resolve` is not"),n(void 0,l,s))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){nT(e),n=t,r=!0}),nG("runSync","run",r),D(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=nQ(t),r=this.compiler||this.Compiler;return nW("stringify",r),nJ(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(nK("use",this.frozen),null==e);else if("function"==typeof e)s(e,t);else if("object"==typeof e)Array.isArray(e)?o(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,nj.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)s(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...o]=t,s=n[i][1];nE(s)&&nE(r)&&(r=(0,nj.default)(!0,s,r)),n[i]=[e,r,...o]}}}}let nU=new nH().freeze();function nq(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function nW(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function nK(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function nJ(e){if(!nE(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function nG(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function nQ(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new nL(e)}let nX=[],nY={allowDangerousHtml:!0},nZ=/^(https?|ircs?|mailto|xmpp)$/i,n0=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function n1(e){var n;let r,i,o,s,l,a=(r=(n=e).rehypePlugins||nX,i=n.remarkPlugins||nX,o=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...nY}:nY,nU().use(t6).use(i).use(nN,o).use(r)),c=(s=e.children||"",l=new nL,"string"==typeof s?l.value=s:R("Unexpected value `"+s+"` for `children` prop, expected `string`"),l);return function(e,n){let r=n.allowedElements,i=n.allowElement,o=n.components,s=n.disallowedElements,l=n.skipHtml,a=n.unwrapDisallowed,c=n.urlTransform||n2;for(let e of n0)Object.hasOwn(n,e.from)&&R("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&s&&R("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),np(e,function(e,t,n){if("raw"===e.type&&n&&"number"==typeof t)return l?n.children.splice(t,1):n.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in eV)if(Object.hasOwn(eV,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=eV[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=c(String(n||""),t,e))}}if("element"===e.type){let o=r?!r.includes(e.tagName):!!s&&s.includes(e.tagName);if(!o&&i&&"number"==typeof t&&(o=!i(e,t,n)),o&&n&&"number"==typeof t)return a&&e.children?n.children.splice(t,1,...e.children):n.children.splice(t,1),t}}),function(e,t){var n,r,i,o;let s;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let l=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=l,r=t.jsxDEV,s=function(e,t,i,o){let s=Array.isArray(i.children),l=ew(e);return r(t,i,o,s,{columnNumber:l?l.column-1:void 0,fileName:n,lineNumber:l?l.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,o=t.jsxs,s=function(e,t,n,r){let s=Array.isArray(n.children)?o:i;return r?s(t,n,r):s(t,n)}}let a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:l,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?eb:ex,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=eP(a,e,void 0);return c&&"string"!=typeof c?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}(e,{Fragment:t.Fragment,components:o,ignoreInvalidStyle:!0,jsx:t.jsx,jsxs:t.jsxs,passKeys:!0,passNode:!0})}(a.runSync(a.parse(c),c),e)}function n2(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||nZ.test(e.slice(0,t))?e:""}function n3(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}let n5="phrasing",n4=["autolink","link","image","label"];function n6(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function n8(e){this.config.enter.autolinkProtocol.call(this,e)}function n9(e){this.config.exit.autolinkProtocol.call(this,e)}function n7(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];D("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function re(e){this.config.exit.autolinkEmail.call(this,e)}function rt(e){this.exit(e)}function rn(e){!function(e,t,n){let r=na((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),o=-1;for(;++o<i.length;)nh(e,"text",s);function s(e,t){let n,s=-1;for(;++s<t.length;){let e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[o][0],s=i[o][1],l=0,a=n.children.indexOf(e),c=!1,d=[];r.lastIndex=0;let u=r.exec(e.value);for(;u;){let n=u.index,i={index:u.index,input:u.input,stack:[...t,e]},o=s(...u,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(l!==n&&d.push({type:"text",value:e.value.slice(l,n)}),Array.isArray(o)?d.push(...o):o&&d.push(o),l=n+u[0].length,c=!0),!r.global)break;u=r.exec(e.value)}return c?(l<e.value.length&&d.push({type:"text",value:e.value.slice(l)}),n.children.splice(a,1,...d)):d=[e],a+d.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,rr],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ri]],{ignore:["link","linkReference"]})}function rr(e,t,n,r,i){let o,s="";if(!ro(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",s="http://"),(o=n.split(".")).length<2||o[o.length-1]&&(/_/.test(o[o.length-1])||!/[a-zA-Z\d]/.test(o[o.length-1]))||o[o.length-2]&&(/_/.test(o[o.length-2])||!/[a-zA-Z\d]/.test(o[o.length-2])))return!1;let l=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=n3(e,"("),o=n3(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),o++;return[e,n]}(n+r);if(!l[0])return!1;let a={type:"link",title:null,url:s+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[a,{type:"text",value:l[1]}]:a}function ri(e,t,n,r){return!(!ro(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function ro(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||e9(n)||e8(n))&&(!t||47!==n)}function rs(){this.buffer()}function rl(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ra(){this.buffer()}function rc(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function rd(e){let t=this.resume(),n=this.stack[this.stack.length-1];D("footnoteReference"===n.type),n.identifier=tR(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ru(e){this.exit(e)}function rh(e){let t=this.resume(),n=this.stack[this.stack.length-1];D("footnoteDefinition"===n.type),n.identifier=tR(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rp(e){this.exit(e)}function rf(e,t,n,r){let i=n.createTracker(r),o=i.move("[^"),s=n.enter("footnoteReference"),l=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),l(),s(),o+=i.move("]")}function rm(e,t,n){return 0===t?e:rg(e,t,n)}function rg(e,t,n){return(n?"":" ")+e}rf.peek=function(){return"["};let ry=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function rx(e){this.enter({type:"delete",children:[]},e)}function rb(e){this.exit(e)}function rv(e,t,n,r){let i=n.createTracker(r),o=n.enter("strikethrough"),s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function rk(e){return e.length}function rw(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}rv.peek=function(){return"~"};function rS(e,t,n){let r=e.value||"",i="`",o=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){let e,t=n.unsafe[o],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}rS.peek=function(){return"`"};na(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let rC=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),o=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));let l=n.createTracker(r);l.move(o+" ".repeat(s-o.length)),l.shift(s);let a=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?o:o+" ".repeat(s-o.length))+e});return a(),c};function rM(e){let t=e._align;D(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function rN(e){this.exit(e),this.data.inTable=void 0}function rT(e){this.enter({type:"tableRow",children:[]},e)}function rj(e){this.exit(e)}function rE(e){this.enter({type:"tableCell",children:[]},e)}function rO(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,rA));let n=this.stack[this.stack.length-1];D("inlineCode"===n.type),n.value=t,this.exit(e)}function rA(e,t){return"|"===t?t:e}function rI(e){let t=this.stack[this.stack.length-2];D("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function rD(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];D("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,o=-1;for(;++o<i.length;){let e=i[o];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function rR(e,t,n,r){let i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);o&&l.move(s);let a=rC(e,t,n,{...r,...l.current()});return o&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+s})),a}let rP={tokenize:function(e,t,n){let r=0;return function t(o){return(87===o||119===o)&&r<3?(r++,e.consume(o),t):46===o&&3===r?(e.consume(o),i):n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},rz={tokenize:function(e,t,n){let r,i,o;return s;function s(t){return 46===t||95===t?e.check(r$,a,l)(t):null===t||e4(t)||e9(t)||45!==t&&e8(t)?a(t):(o=!0,e.consume(t),s)}function l(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),s}function a(e){return i||r||!o?n(e):t(e)}},partial:!0},rL={tokenize:function(e,t){let n=0,r=0;return i;function i(s){return 40===s?(n++,e.consume(s),i):41===s&&r<n?o(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(r$,t,o)(s):null===s||e4(s)||e9(s)?t(s):(e.consume(s),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},r$={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),o):93===s?(e.consume(s),i):60===s||null===s||e4(s)||e9(s)?t(s):n(s)}function i(e){return null===e||40===e||91===e||e4(e)||e9(e)?t(e):r(e)}function o(t){return eX(t)?function t(i){return 59===i?(e.consume(i),r):eX(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},rF={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return eY(e)?n(e):t(e)}},partial:!0},rB={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!rq.call(r,r.previous)||rG(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(rP,e.attempt(rz,e.attempt(rL,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:rq},r_={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",o=!1;return function(t){return(72===t||104===t)&&rW.call(r,r.previous)&&!rG(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),s):n(t)};function s(t){if(eX(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),l}return n(t)}function l(t){return 47===t?(e.consume(t),o)?a:(o=!0,l):n(t)}function a(t){return null===t||e0(t)||e4(t)||e9(t)||e8(t)?n(t):e.attempt(rz,e.attempt(rL,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:rW},rV={name:"emailAutolink",tokenize:function(e,t,n){let r,i,o=this;return function(t){return!rJ(t)||!rK.call(o,o.previous)||rG(o.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return rJ(r)?(e.consume(r),t):64===r?(e.consume(r),s):n(r)}(t))};function s(t){return 46===t?e.check(rF,a,l)(t):45===t||95===t||eY(t)?(i=!0,e.consume(t),s):a(t)}function l(t){return e.consume(t),r=!0,s}function a(s){return i&&r&&eX(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:rK},rH={},rU=48;for(;rU<123;)rH[rU]=rV,58==++rU?rU=65:91===rU&&(rU=97);function rq(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||e4(e)}function rW(e){return!eX(e)}function rK(e){return!(47===e||rJ(e))}function rJ(e){return 43===e||45===e||46===e||95===e||eY(e)}function rG(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}rH[43]=rV,rH[45]=rV,rH[46]=rV,rH[95]=rV,rH[72]=[rV,r_],rH[104]=[rV,r_],rH[87]=[rV,rB],rH[119]=[rV,rB];let rQ={tokenize:function(e,t,n){let r=this;return te(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function rX(e,t,n){let r,i=this,o=i.events.length,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;o--;){let e=i.events[o][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(o){if(!r||!r._balanced)return n(o);let l=tR(i.sliceSerialize({start:r.end,end:i.now()}));return 94===l.codePointAt(0)&&s.includes(l.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o)):n(o)}}function rY(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function rZ(e,t,n){let r,i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),l};function l(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",a)}function a(l){if(s>999||93===l&&!r||null===l||91===l||e4(l))return n(l);if(93===l){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return o.includes(tR(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(l)}return e4(l)||(r=!0),s++,e.consume(l),92===l?c:a}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,a):a(t)}}function r0(e,t,n){let r,i,o=this,s=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),l=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),a};function a(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(l>999||93===t&&!i||null===t||91===t||e4(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=tR(o.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),u}return e4(t)||(i=!0),l++,e.consume(t),92===t?d:c}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}function u(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s.includes(r)||s.push(r),te(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function r1(e,t,n){return e.check(ti,t,e.attempt(rQ,t,n))}function r2(e){e.exit("gfmFootnoteDefinition")}class r3{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function r5(e,t,n){let r,i=this,o=0,s=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,o="tableHead"===r||"tableRow"===r?x:l;return o===x&&i.parser.lazy[i.now().line]?n(e):o(e)};function l(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,s+=1),a(n)}function a(t){return null===t?n(t):e5(t)?s>1?(s=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),u):n(t):e6(t)?te(e,a,"whitespace")(t):(s+=1,r&&(r=!1,o+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,a):(e.enter("data"),c(t))}function c(t){return null===t||124===t||e4(t)?(e.exit("data"),a(t)):(e.consume(t),92===t?d:c)}function d(t){return 92===t||124===t?(e.consume(t),c):c(t)}function u(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,e6(t))?te(e,h,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t)}function h(t){return 45===t||58===t?f(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),p):n(t)}function p(t){return e6(t)?te(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(s+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(s+=1,m(t)):null===t||e5(t)?y(t):n(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(n))}(t)):n(t)}function g(t){return e6(t)?te(e,y,"whitespace")(t):y(t)}function y(i){if(124===i)return h(i);if(null===i||e5(i))return r&&o===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function x(t){return e.enter("tableRow"),b(t)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||e5(n)?(e.exit("tableRow"),t(n)):e6(n)?te(e,b,"whitespace")(n):(e.enter("data"),v(n))}function v(t){return null===t||124===t||e4(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?k:v)}function k(t){return 92===t||124===t?(e.consume(t),v):v(t)}}function r4(e,t){let n,r,i,o=-1,s=!0,l=0,a=[0,0,0,0],c=[0,0,0,0],d=!1,u=0,h=new r3;for(;++o<e.length;){let p=e[o],f=p[1];"enter"===p[0]?"tableHead"===f.type?(d=!1,0!==u&&(r8(h,t,u,n,r),r=void 0,u=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(o,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(s=!0,i=void 0,a=[0,0,0,0],c=[0,o+1,0,0],d&&(d=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(o,0,[["enter",r,t]])),l="tableDelimiterRow"===f.type?2:r?3:1):l&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(s=!1,0===c[2]&&(0!==a[1]&&(c[0]=c[1],i=r6(h,t,a,l,void 0,i),a=[0,0,0,0]),c[2]=o)):"tableCellDivider"===f.type&&(s?s=!1:(0!==a[1]&&(c[0]=c[1],i=r6(h,t,a,l,void 0,i)),c=[(a=c)[1],o,0,0])):"tableHead"===f.type?(d=!0,u=o):"tableRow"===f.type||"tableDelimiterRow"===f.type?(u=o,0!==a[1]?(c[0]=c[1],i=r6(h,t,a,l,o,i)):0!==c[1]&&(i=r6(h,t,c,l,o,i)),l=0):l&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(c[3]=o)}for(0!==u&&r8(h,t,u,n,r),h.consume(t.events),o=-1;++o<t.events.length;){let e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,o))}return e}function r6(e,t,n,r,i,o){0!==n[0]&&(o.end=Object.assign({},r9(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));let s=r9(t.events,n[1]);if(o={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){let i=r9(t.events,n[2]),o=r9(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(o.end=Object.assign({},r9(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function r8(e,t,n,r,i){let o=[],s=r9(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function r9(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let r7={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return e4(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return e5(r)?t(r):e6(r)?e.check({tokenize:ie},t,n)(r):n(r)}}};function ie(e,t,n){return te(e,function(e){return null===e?n(e):t(e)},"whitespace")}let it={};function ir(e){let t,n,r,i=e||it,o=this.data(),s=o.micromarkExtensions||(o.micromarkExtensions=[]),l=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),a=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);s.push(eQ([{text:rH},{document:{91:{name:"gfmFootnoteDefinition",tokenize:r0,continuation:{tokenize:r1},exit:r2}},text:{91:{name:"gfmFootnoteCall",tokenize:rZ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:rX,resolveTo:rY}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,o=this.events,s=0;return function(l){return 126===i&&"characterEscape"!==o[o.length-1][1].type?r(l):(e.enter("strikethroughSequenceTemporary"),function o(l){let a=ty(i);if(126===l)return s>1?r(l):(e.consume(l),s++,o);if(s<2&&!t)return r(l);let c=e.exit("strikethroughSequenceTemporary"),d=ty(l);return c._open=!d||2===d&&!!a,c._close=!a||2===a&&!!d,n(l)}(l))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],l=t.parser.constructs.insideSpan.null;l&&eK(s,s.length,0,tx(l,e.slice(r+1,n),t)),eK(s,s.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),eK(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:r5,resolveAll:r4}}},{text:{91:r7}}])),l.push([{transforms:[rn],enter:{literalAutolink:n6,literalAutolinkEmail:n8,literalAutolinkHttp:n8,literalAutolinkWww:n8},exit:{literalAutolink:rt,literalAutolinkEmail:re,literalAutolinkHttp:n9,literalAutolinkWww:n7}},{enter:{gfmFootnoteCallString:rs,gfmFootnoteCall:rl,gfmFootnoteDefinitionLabelString:ra,gfmFootnoteDefinition:rc},exit:{gfmFootnoteCallString:rd,gfmFootnoteCall:ru,gfmFootnoteDefinitionLabelString:rh,gfmFootnoteDefinition:rp}},{canContainEols:["delete"],enter:{strikethrough:rx},exit:{strikethrough:rb}},{enter:{table:rM,tableData:rE,tableHeader:rE,tableRow:rT},exit:{codeText:rO,table:rN,tableData:rj,tableHeader:rj,tableRow:rj}},{exit:{taskListCheckValueChecked:rI,taskListCheckValueUnchecked:rI,paragraph:rD}}]),a.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:n5,notInConstruct:n4},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:n5,notInConstruct:n4},{character:":",before:"[ps]",after:"\\/",inConstruct:n5,notInConstruct:n4}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let o=n.createTracker(i),s=o.move("[^"),l=n.enter("footnoteDefinition"),a=n.enter("label");return s+=o.move(n.safe(n.associationId(e),{before:s,after:"]"})),a(),s+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),s+=o.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,o.current()),r?rg:rm))),l(),s},footnoteReference:rf},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ry}],handlers:{delete:rv}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=rS(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return l(function(e,t,n){let r=e.children,i=-1,o=[],s=t.enter("table");for(;++i<r.length;)o[i]=a(r[i],t,n);return s(),o}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){let i=l([a(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function s(e,t,n,r){let i=n.enter("tableCell"),s=n.enter("phrasing"),l=n.containerPhrasing(e,{...r,before:o,after:o});return s(),i(),l}function l(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||rk,o=[],s=[],l=[],a=[],c=0,d=-1;for(;++d<e.length;){let t=[],r=[],o=-1;for(e[d].length>c&&(c=e[d].length);++o<e[d].length;){var u;let s=null==(u=e[d][o])?"":String(u);if(!1!==n.alignDelimiters){let e=i(s);r[o]=e,(void 0===a[o]||e>a[o])&&(a[o]=e)}t.push(s)}s[d]=t,l[d]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<c;)o[h]=rw(r[h]);else{let e=rw(r);for(;++h<c;)o[h]=e}h=-1;let p=[],f=[];for(;++h<c;){let e=o[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,a[h]-t.length-r.length),s=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>a[h]&&(a[h]=i),f[h]=i),p[h]=s}s.splice(1,0,p),l.splice(1,0,f),d=-1;let m=[];for(;++d<s.length;){let e=s[d],t=l[d];h=-1;let r=[];for(;++h<c;){let i=e[h]||"",s="",l="";if(!1!==n.alignDelimiters){let e=a[h]-(t[h]||0),n=o[h];114===n?s=" ".repeat(e):99===n?e%2?(s=" ".repeat(e/2+.5),l=" ".repeat(e/2-.5)):l=s=" ".repeat(e/2):l=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(s),r.push(i),!1!==n.alignDelimiters&&r.push(l),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==c-1)&&r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function a(e,t,n){let r=e.children,i=-1,o=[],l=t.enter("tableRow");for(;++i<r.length;)o[i]=s(r[i],e,t,n);return l(),o}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rR}}]})}let ii={p:({children:e})=>(0,t.jsx)("p",{className:"mb-3 last:mb-0 leading-relaxed",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"list-disc pl-5 mb-3 last:mb-0 space-y-1.5",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"list-decimal pl-5 mb-3 last:mb-0 space-y-1.5",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"leading-relaxed pl-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"text-base font-bold mb-2 mt-3 first:mt-0",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"text-sm font-bold mb-2 mt-3 first:mt-0",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"text-sm font-semibold mb-1.5 mt-2.5 first:mt-0",children:e}),code:({children:e,className:n})=>n?.includes("language-")?(0,t.jsx)("pre",{className:"bg-black/[0.06] rounded-lg p-3 my-3 overflow-x-auto border border-black/[0.06]",children:(0,t.jsx)("code",{className:"text-[13px] leading-relaxed font-mono",children:e})}):(0,t.jsx)("code",{className:"bg-black/[0.07] rounded-md px-1.5 py-0.5 text-[13px] font-mono",children:e}),pre:({children:e})=>(0,t.jsx)(t.Fragment,{children:e}),blockquote:({children:e})=>(0,t.jsx)("blockquote",{className:"border-l-[3px] border-zinc-300 pl-3 my-3 text-zinc-600",children:e}),hr:()=>(0,t.jsx)("hr",{className:"my-4 border-zinc-200"}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-600 underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e}),table:({children:e})=>(0,t.jsx)("div",{className:"overflow-x-auto my-3",children:(0,t.jsx)("table",{className:"min-w-full text-sm border-collapse",children:e})}),thead:({children:e})=>(0,t.jsx)("thead",{className:"bg-zinc-100",children:e}),th:({children:e})=>(0,t.jsx)("th",{className:"border border-zinc-200 px-3 py-1.5 text-left text-xs font-semibold text-zinc-600",children:e}),td:({children:e})=>(0,t.jsx)("td",{className:"border border-zinc-200 px-3 py-1.5",children:e})},io={...ii,p:({children:e})=>(0,t.jsx)("p",{className:"mb-3 last:mb-0 leading-relaxed",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"list-disc pl-5 mb-3 last:mb-0 space-y-1.5 marker:text-white/60",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"list-decimal pl-5 mb-3 last:mb-0 space-y-1.5 marker:text-white/60",children:e}),code:({children:e,className:n})=>n?.includes("language-")?(0,t.jsx)("pre",{className:"bg-white/[0.12] rounded-lg p-3 my-3 overflow-x-auto border border-white/[0.08]",children:(0,t.jsx)("code",{className:"text-[13px] leading-relaxed font-mono",children:e})}):(0,t.jsx)("code",{className:"bg-white/[0.15] rounded-md px-1.5 py-0.5 text-[13px] font-mono",children:e}),blockquote:({children:e})=>(0,t.jsx)("blockquote",{className:"border-l-[3px] border-white/30 pl-3 my-3 text-white/80",children:e}),hr:()=>(0,t.jsx)("hr",{className:"my-4 border-white/20"}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-white underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:e}),table:({children:e})=>(0,t.jsx)("div",{className:"overflow-x-auto my-3",children:(0,t.jsx)("table",{className:"min-w-full text-sm border-collapse",children:e})}),thead:({children:e})=>(0,t.jsx)("thead",{className:"bg-white/[0.08]",children:e}),th:({children:e})=>(0,t.jsx)("th",{className:"border border-white/20 px-3 py-1.5 text-left text-xs font-semibold",children:e}),td:({children:e})=>(0,t.jsx)("td",{className:"border border-white/20 px-3 py-1.5",children:e})},is=/\[reaction\s+[^\]]*\]/gi;function il({content:e,isUser:n}){let r=n?io:ii,i=e.replace(is,"").trim(),o=function(e){let t,n=[],r=/(?:^|\n)Thinking\.\.\.[\s\S]*?\.\.\.done thinking\.?\s*/g,i=0;for(;null!==(t=r.exec(e));){t.index>i&&n.push({type:"text",content:e.slice(i,t.index)});let r=t[0].replace(/^[\n]*Thinking\.\.\.\s*/,"").replace(/\s*\.\.\.done thinking\.?\s*$/,"").trim();r&&n.push({type:"thought",content:r}),i=t.index+t[0].length}return i<e.length&&n.push({type:"text",content:e.slice(i)}),n}(i);return 1===o.length&&"text"===o[0].type?(0,t.jsx)(n1,{remarkPlugins:[ir],components:r,children:i}):(0,t.jsx)(t.Fragment,{children:o.map((e,n)=>{if("thought"===e.type)return(0,t.jsxs)("details",{className:"my-2 rounded-lg bg-zinc-500/[0.06] border border-zinc-200/60",children:[(0,t.jsx)("summary",{className:"cursor-pointer select-none px-3 py-1.5 text-[11px] font-medium text-zinc-400 hover:text-zinc-500 transition-colors",children:"Thought process"}),(0,t.jsx)("div",{className:"px-3 pb-2.5 text-[12px] leading-relaxed text-zinc-400",children:(0,t.jsx)(n1,{remarkPlugins:[ir],components:r,children:e.content})})]},n);let i=e.content.trim();return i?(0,t.jsx)(n1,{remarkPlugins:[ir],components:r,children:i},n):null})})}let ia={ack:{symbol:"👍",label:"Acknowledged"},working:{symbol:"🔄",label:"Working"},done:{symbol:"✅",label:"Done"},clarify:{symbol:"❓",label:"Needs clarification"},blocked:{symbol:"⛔",label:"Blocked"}};function ic({type:e,count:n,participantIds:r}){let i=ia[e],o=r.join(", "),s=o?`${i.label}: ${o}`:i.label;return(0,t.jsxs)("span",{title:s,className:"inline-flex items-center gap-1 rounded-full border border-zinc-300 bg-zinc-50 px-2 py-0.5 text-xs text-zinc-700",children:[(0,t.jsx)("span",{"aria-hidden":!0,children:i.symbol}),(0,t.jsx)("span",{className:"tabular-nums",children:n})]})}function id({reactions:e}){if(!e||0===e.length)return null;let n=[...e].sort((e,t)=>t.count!==e.count?t.count-e.count:e.type.localeCompare(t.type));return(0,t.jsx)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:n.map(e=>(0,t.jsx)(ic,{type:e.type,count:e.count,participantIds:e.participantIds},e.type))})}let iu=(0,a.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function ih({attachments:e,compact:n=!1}){if(0===e.length)return null;let r=e.filter(e=>e.mimeType.startsWith("image/")),i=e.filter(e=>!e.mimeType.startsWith("image/")),o=n?"max-w-[120px]":"max-w-[240px]",s=n?"max-h-[90px]":"max-h-[180px]";return(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[r.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:r.map(e=>(0,t.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg overflow-hidden border border-slate-200 hover:border-slate-300 transition-colors",children:(0,t.jsx)("img",{src:e.url,alt:e.filename,className:`${o} ${s} object-cover`,loading:"lazy"})},e.id))}),i.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>{var r;return(0,t.jsxs)("a",{href:e.url,download:e.filename,className:`inline-flex items-center gap-1.5 rounded-md border border-slate-200 bg-slate-50 text-slate-600 hover:bg-slate-100 hover:border-slate-300 transition-colors ${n?"px-2 py-0.5 text-[11px]":"px-2.5 py-1 text-xs"}`,children:[(0,t.jsx)(k,{className:`text-slate-400 shrink-0 ${n?"w-3 h-3":"w-3.5 h-3.5"}`}),(0,t.jsx)("span",{className:`truncate ${n?"max-w-[100px]":"max-w-[150px]"}`,children:e.filename}),(0,t.jsx)("span",{className:"text-slate-400 shrink-0",children:(r=e.size)<1024?`${r}B`:r<1048576?`${(r/1024).toFixed(0)}KB`:`${(r/1048576).toFixed(1)}MB`}),(0,t.jsx)(iu,{className:`text-slate-400 shrink-0 ${n?"w-2.5 h-2.5":"w-3 h-3"}`})]},e.id)})})]})}let ip=(0,a.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),im=(0,a.default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);function ig(e){return e.replace(/\[reaction\s+[^\]]*\]/gi,"").replace(/\[agx:[^\]]*\]/g,"").replace(/\[checkpoint\]/g,"").replace(/\[criteria:\s*[^\]]*\]/g,"").replace(/\[done\]/g,"").replace(/\[blocked[^\]]*\]/g,"").replace(/^\[SKIP\]$/gm,"").trim()}function iy({message:e,participantName:n,participantColor:r,participantId:i,onReply:o,onOpenThread:s,onSummarize:l,summarizing:a,isRoot:c=!1,highlighted:d=!1,hideUserAvatarAndName:u=!1}){let h,p="user"===e.role,f=ig(e.content);return f||e.attachments?.length?(0,t.jsxs)("div",{className:`flex gap-4 group transition-colors ${!c?"py-4":""} ${d?"rounded-lg bg-amber-50/90 px-2 -mx-2 ring-1 ring-amber-200":""}`,children:[!(p&&u)&&(0,t.jsx)("div",{className:`w-9 h-9 rounded-full flex items-center justify-center shrink-0 ${p?"bg-slate-200 text-slate-600":"bg-slate-100 overflow-hidden"}`,children:p?(0,t.jsx)(g,{className:"w-5 h-5"}):i?(0,t.jsx)("img",{src:j(i,36,r),alt:"",className:"w-full h-full object-cover"}):(0,t.jsx)(g,{className:"w-5 h-5 opacity-70"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-baseline gap-2 mb-1",children:[!(p&&u)&&(0,t.jsx)("span",{className:"font-bold text-[15px]",style:!p&&r?{color:r}:{},children:p?"You":n||"Unknown"}),(0,t.jsx)("span",{className:"text-xs text-slate-400 font-medium",children:(h=e.timestamp,new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(h))})]}),(0,t.jsxs)("div",{className:`text-[15px] text-slate-800 leading-relaxed ${p?"cursor-pointer hover:bg-slate-50/50 transition-colors rounded p-1 -mx-1":""}`,onClick:()=>{p&&s&&s(e.id)},children:[(0,t.jsx)(il,{content:f,isUser:p}),e.attachments&&e.attachments.length>0&&(0,t.jsx)(ih,{attachments:e.attachments})]}),c&&(0,t.jsxs)("div",{className:"mt-4 flex gap-2",children:[(0,t.jsx)(id,{reactions:e.reactions}),o&&!p&&(0,t.jsxs)("button",{type:"button",onClick:()=>o(e.id),className:"flex items-center gap-1.5 px-2.5 py-1 text-slate-500 hover:text-slate-800 rounded-full hover:bg-slate-50 transition-colors text-xs font-semibold",children:[(0,t.jsx)(ip,{className:"w-3 h-3"}),"Reply"]}),l&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(e.id),disabled:a,className:"flex items-center gap-1.5 px-2.5 py-1 text-slate-500 hover:text-slate-800 rounded-full hover:bg-slate-50 transition-colors text-xs font-semibold disabled:opacity-50 disabled:cursor-not-allowed",children:[a?(0,t.jsx)(im,{className:"w-3 h-3 animate-spin"}):(0,t.jsx)(k,{className:"w-3 h-3"}),a?"Summarizing…":"Summarize"]})]})]})]}):null}function ix(){return(0,t.jsxs)("span",{className:"inline-flex items-center gap-[3px] ml-1",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-400 animate-[pulse-dot_1.4s_ease-in-out_infinite]"}),(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-400 animate-[pulse-dot_1.4s_ease-in-out_0.2s_infinite]"}),(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-400 animate-[pulse-dot_1.4s_ease-in-out_0.4s_infinite]"})]})}function ib({participantId:e,participantName:n,participantColor:r,content:i}){let o=ig(i),s=o.length>0;return(0,t.jsxs)("div",{className:"flex gap-4 py-4 group transition-colors animate-in fade-in slide-in-from-bottom-2 duration-300",children:[(0,t.jsx)("div",{className:"w-9 h-9 rounded-full bg-slate-100 overflow-hidden shrink-0 shadow-sm border border-slate-100",children:(0,t.jsx)("img",{src:j(e,36,r),alt:"",className:"w-full h-full object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-baseline gap-2 mb-1",children:[(0,t.jsx)("span",{className:"font-bold text-[15px]",style:{color:r},children:n}),(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-slate-400 font-bold opacity-0 group-hover:opacity-100 transition-opacity",children:"Streaming"})]}),(0,t.jsx)("div",{className:"text-[15px] text-slate-800 leading-relaxed min-h-[1.5rem] flex items-center",children:s?(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(il,{content:o}),(0,t.jsx)("span",{className:"inline-flex items-baseline ml-0.5",children:(0,t.jsx)("span",{className:"w-1 h-1 rounded-full bg-indigo-400 animate-[pulse-dot_1.4s_ease-in-out_infinite]"})})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 text-slate-400 italic",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:"thinking"}),(0,t.jsx)(ix,{})]})})]})]})}var iv=e.i(35189);let ik=(0,a.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),iw=(0,a.default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);var iS=e.i(64714);let iC=iS.default.env.NEXT_PUBLIC_AGX_BOARD_URL||"http://localhost:41741";async function iM(){let e=await fetch(`${iC}/api/projects`);if(!e.ok){if(503===e.status)throw Error("SCHEMA_NOT_READY");throw Error(`Failed to list projects: ${e.status}`)}let t=await e.json();return t.projects??t}async function iN(e,t){let n=await fetch(`${iC}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,description:t})});if(!n.ok)throw Error(`Failed to create project: ${n.status}`);return n.json()}async function iT(e,t){let n=await fetch(`${iC}/api/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e,...t})});if(!n.ok)throw Error(`Failed to create task: ${n.status}`);let r=await n.json(),i=r.task??r;return r.id&&!i.id&&(i.id=r.id),i}async function ij(e){let t=await fetch(`${iC}/api/tasks/${e}`);if(!t.ok)return null;let n=await t.json();return n.task??n}async function iE(e,t,n,r){let i=[],o={...r},s=new Map((function(e){let t=new Set(e.map(e=>e.id)),n=new Map;for(let r of e)n.set(r.id,(r.dependsOn||[]).filter(e=>t.has(e)));let r=[],i=new Set,o=new Set;for(let t of e)!function t(s){if(!i.has(s)&&!o.has(s)){for(let e of(o.add(s),n.get(s)||[]))t(e);o.delete(s),i.add(s),r.push(e.find(e=>e.id===s))}}(t.id);return r})(e).map(e=>[e.id,e]));for(;s.size>0;){let e=[];for(let t of s.values())(t.dependsOn||[]).every(e=>!s.has(e)||o[e])&&e.push(t);0===e.length&&e.push(...s.values());let n=await Promise.allSettled(e.map(async e=>{let n=o[e.id];if(n&&await ij(n))return{task:e,remoteId:n};let r=(e.dependsOn||[]).map(e=>o[e]).filter(Boolean),i=await iT(e.description,{title:e.title,project_id:t,depends_on:r.length>0?r:void 0});return{task:e,remoteId:i.id}}));for(let t of n)if("fulfilled"===t.status){let{task:e,remoteId:n}=t.value;o[e.id]=n,i.push({clientTaskId:e.id,remoteTaskId:n,status:"created"}),s.delete(e.id)}else{let r=e[n.indexOf(t)];i.push({clientTaskId:r.id,status:"failed",error:t.reason instanceof Error?t.reason.message:"Unknown error"}),s.delete(r.id)}}return{buildId:n,projectId:t,results:i}}let iO=(0,a.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);var iA=e.i(986);function iI({onSelect:e,onClose:r}){let[i,o]=(0,n.useState)([]),[s,l]=(0,n.useState)(!0),[a,c]=(0,n.useState)(null),[u,h]=(0,n.useState)(!1),[p,f]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{try{let e=await iM();o(e)}catch(e){e instanceof Error&&"SCHEMA_NOT_READY"===e.message?c("agx-cloud database not ready. Run migrations first."):c("Failed to load projects. Is agx-cloud running?")}finally{l(!1)}})()},[]);let x=(0,n.useCallback)(async()=>{let t=p.trim();if(t){h(!0);try{let n=await iN(t);e(n.id,n.name)}catch(e){c("Failed to create project")}finally{h(!1)}}},[p,e]);return(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/20 backdrop-blur-sm",children:(0,t.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl border border-slate-200 w-full max-w-sm mx-4 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(iO,{className:"w-4 h-4 text-slate-500"}),(0,t.jsx)("h3",{className:"text-sm font-bold text-slate-900",children:"Select Project"})]}),(0,t.jsx)("button",{type:"button",onClick:r,className:"p-1 text-slate-400 hover:text-slate-600 rounded-md hover:bg-slate-100",children:(0,t.jsx)(m,{className:"w-4 h-4"})})]}),(0,t.jsxs)("div",{className:"p-4 max-h-64 overflow-y-auto",children:[s&&(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(im,{className:"w-5 h-5 text-slate-400 animate-spin"})}),a&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-amber-50 rounded-lg text-amber-700 text-xs font-medium",children:[(0,t.jsx)(iA.AlertTriangle,{className:"w-4 h-4 shrink-0"}),a]}),!s&&!a&&0===i.length&&(0,t.jsx)("p",{className:"text-xs text-slate-500 text-center py-4",children:"No projects found. Create one below."}),!s&&i.map(n=>(0,t.jsxs)("button",{type:"button",onClick:()=>e(n.id,n.name),className:"w-full text-left px-3 py-2.5 rounded-lg hover:bg-slate-50 transition-colors flex items-center gap-3 group",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-lg bg-slate-100 flex items-center justify-center shrink-0",children:(0,t.jsx)(iO,{className:"w-4 h-4 text-slate-400 group-hover:text-slate-600"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-slate-800 truncate",children:n.name}),n.description&&(0,t.jsx)("div",{className:"text-[11px] text-slate-500 truncate",children:n.description})]})]},n.id))]}),(0,t.jsx)("div",{className:"px-4 pb-4 pt-2 border-t border-slate-100",children:g?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",value:p,onChange:e=>f(e.target.value),onKeyDown:e=>"Enter"===e.key&&x(),placeholder:"Project name",autoFocus:!0,className:"flex-1 h-8 px-3 text-sm border border-slate-200 rounded-lg outline-none focus:ring-1 focus:ring-slate-300"}),(0,t.jsx)("button",{type:"button",onClick:x,disabled:u||!p.trim(),className:"h-8 px-3 text-xs font-bold text-white bg-slate-900 hover:bg-slate-800 rounded-lg disabled:opacity-40",children:u?"…":"Create"}),(0,t.jsx)("button",{type:"button",onClick:()=>y(!1),className:"h-8 px-2 text-slate-400 hover:text-slate-600",children:(0,t.jsx)(m,{className:"w-3.5 h-3.5"})})]}):(0,t.jsxs)("button",{type:"button",onClick:()=>y(!0),className:"flex items-center gap-1.5 text-xs font-bold text-slate-500 hover:text-slate-700",children:[(0,t.jsx)(d.Plus,{className:"w-3.5 h-3.5"}),"Create new project"]})})]})})}function iD({draft:e,onUpdate:r,onBuild:i,building:o}){let[s,l]=(0,n.useState)(null),[a,c]=(0,n.useState)(!1),u=(0,n.useCallback)((t,n)=>{let i=e.tasks.map(e=>e.id===t?{...e,...n}:e);r({...e,tasks:i,revision:e.revision+1})},[e,r]),h=(0,n.useCallback)(t=>{let n=e.tasks.filter(e=>e.id!==t);r({...e,tasks:n,revision:e.revision+1})},[e,r]),p=(0,n.useCallback)(()=>{let t={id:crypto.randomUUID(),title:"New task",description:"Add description..."};r({...e,tasks:[...e.tasks,t],revision:e.revision+1})},[e,r]),f=(0,n.useCallback)(()=>{c(!0)},[]),g=(0,n.useCallback)((t,n)=>{c(!1),i(e,t,n)},[e,i]),y="idle"===e.buildStatus||!e.buildStatus;return(0,t.jsxs)("div",{className:"mt-6 p-4 bg-slate-50/80 rounded-2xl border border-slate-100 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(iv.Zap,{className:"w-3.5 h-3.5 text-amber-500 fill-amber-500"}),(0,t.jsx)("span",{className:"text-[10px] font-extrabold uppercase tracking-widest text-slate-400",children:"Tasks"})]}),(0,t.jsxs)("span",{className:"text-[11px] font-bold text-slate-500",children:[e.tasks.length," task",1!==e.tasks.length?"s":""]})]}),(0,t.jsx)("div",{className:"space-y-1 mb-4",children:e.tasks.map(e=>{let n=s===e.id;return(0,t.jsxs)("div",{className:"group",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-lg hover:bg-white/60 transition-colors",children:[y&&(0,t.jsx)(S,{className:"w-3.5 h-3.5 text-slate-300 opacity-0 group-hover:opacity-100 cursor-grab shrink-0"}),(0,t.jsx)("button",{type:"button",onClick:()=>l(n?null:e.id),className:"shrink-0 text-slate-400 hover:text-slate-600",children:n?(0,t.jsx)(w,{className:"w-3.5 h-3.5"}):(0,t.jsx)(ik,{className:"w-3.5 h-3.5"})}),y?(0,t.jsx)("input",{type:"text",value:e.title,onChange:t=>u(e.id,{title:t.target.value}),className:"flex-1 text-xs font-semibold text-slate-700 bg-transparent border-none outline-none focus:ring-0 p-0"}):(0,t.jsx)("span",{className:"flex-1 text-xs font-semibold text-slate-700",children:e.title}),y&&(0,t.jsx)("button",{type:"button",onClick:()=>h(e.id),className:"shrink-0 text-slate-300 hover:text-rose-500 opacity-0 group-hover:opacity-100 transition-all",children:(0,t.jsx)(m,{className:"w-3.5 h-3.5"})})]}),n&&(0,t.jsx)("div",{className:"ml-9 mr-2 mb-2",children:y?(0,t.jsx)("textarea",{value:e.description,onChange:t=>u(e.id,{description:t.target.value}),rows:4,className:"w-full text-xs text-slate-500 bg-white/80 border border-slate-200 rounded-lg p-2 outline-none focus:ring-1 focus:ring-slate-300 resize-y"}):(0,t.jsx)("p",{className:"text-xs text-slate-500 whitespace-pre-wrap",children:e.description})})]},e.id)})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[y&&(0,t.jsxs)("button",{type:"button",onClick:p,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold text-slate-500 hover:text-slate-700 rounded-full border border-dashed border-slate-300 hover:border-slate-400 transition-all",children:[(0,t.jsx)(d.Plus,{className:"w-3 h-3"}),"Add task"]}),(0,t.jsx)("div",{className:"flex-1"}),y&&(0,t.jsxs)("button",{type:"button",onClick:f,disabled:o||0===e.tasks.length,className:"flex items-center gap-1.5 px-4 py-1.5 text-xs font-bold text-white bg-slate-900 hover:bg-slate-800 rounded-full shadow-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,t.jsx)(iw,{className:"w-3 h-3"}),o?"Pushing…":"Push to agx"]})]}),a&&(0,t.jsx)(iI,{onSelect:g,onClose:()=>c(!1)})]})}let iR=new Set(["completed","done","failed","blocked"]);var iP=e.i(69826),iz=e.i(38783);let iL=(0,a.default)("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]);var i$=e.i(54003);let iF={queued:(0,t.jsx)(iz.Circle,{className:"w-4 h-4 text-slate-300"}),pending:(0,t.jsx)(iz.Circle,{className:"w-4 h-4 text-slate-300"}),in_progress:(0,t.jsx)(im,{className:"w-4 h-4 text-blue-500 animate-spin"}),running:(0,t.jsx)(im,{className:"w-4 h-4 text-blue-500 animate-spin"}),blocked:(0,t.jsx)(iL,{className:"w-4 h-4 text-amber-500"}),completed:(0,t.jsx)(iP.CheckCircle2,{className:"w-4 h-4 text-emerald-500"}),done:(0,t.jsx)(iP.CheckCircle2,{className:"w-4 h-4 text-emerald-500"}),failed:(0,t.jsx)(i$.XCircle,{className:"w-4 h-4 text-rose-500"})};function iB({draft:e,onPush:r,pushing:i}){let[o,s]=(0,n.useState)(!1),{tasks:l,error:a}=function({projectId:e,enabled:t,interval:r=3e4}){let[i,o]=(0,n.useState)([]),[s,l]=(0,n.useState)(null),a=(0,n.useRef)(0),c=(0,n.useRef)([]),d=(0,n.useCallback)(async()=>{if(e&&"undefined"!==e)try{let t=iS.default.env.NEXT_PUBLIC_AGX_BOARD_URL||"http://localhost:41741",n=await fetch(`${t}/api/tasks?project=${e}`);if(!n.ok)throw Error(`Poll failed: ${n.status}`);let r=await n.json(),i=r.tasks??r;c.current=i,o(i),l(null)}catch(e){l(e instanceof Error?e.message:"Poll failed")}},[e]);return(0,n.useEffect)(()=>{if(!t||!e)return;a.current=Date.now(),d();let n=setInterval(()=>{Date.now()-a.current>18e5||c.current.length>0&&c.current.every(e=>iR.has(e.status))?clearInterval(n):d()},r);return()=>clearInterval(n)},[t,e,r,d]),{tasks:i,error:s,refetch:d}}({projectId:e.projectId??null,enabled:!!e.projectId&&"done"===e.buildStatus}),c=new Map;if(e.builtTaskIds)for(let[t,n]of Object.entries(e.builtTaskIds)){let e=l.find(e=>e.id===n);e&&c.set(t,e)}let d=e.tasks.filter(e=>{let t=c.get(e.id);return t&&("completed"===t.status||"done"===t.status)}).length,u=e.tasks.length>0?d/e.tasks.length:0,h=(0,n.useCallback)(()=>{e.projectId&&e.projectName?r?.(e,e.projectId,e.projectName):s(!0)},[e,r]),p=(0,n.useCallback)((t,n)=>{s(!1),r?.(e,t,n)},[e,r]);e.tasks.some(t=>!e.builtTaskIds?.[t.id]);let f=e.tasks.some(e=>{let t=c.get(e.id);return t&&"queued"!==t.status&&"pending"!==t.status});return(0,t.jsxs)("div",{className:"mt-6 p-4 bg-slate-50/80 rounded-2xl border border-slate-100 shadow-sm",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(iv.Zap,{className:"w-3.5 h-3.5 text-amber-500 fill-amber-500"}),(0,t.jsx)("span",{className:"text-[10px] font-extrabold uppercase tracking-widest text-slate-400",children:"Tasks"}),e.projectName&&(0,t.jsxs)("span",{className:"text-[10px] font-semibold text-slate-400",children:["· ",e.projectName]})]}),(0,t.jsxs)("span",{className:"text-[11px] font-bold text-slate-600",children:[d,"/",e.tasks.length," Complete"]})]}),(0,t.jsx)("div",{className:"space-y-3 mb-4",children:e.tasks.map(e=>{let n=c.get(e.id),r=n?.status||"queued",i=iF[r]||iF.queued;return(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[i,(0,t.jsx)("span",{className:`text-xs font-semibold ${"completed"===r||"done"===r?"text-slate-600":"text-slate-500"}`,children:e.title})]},e.id)})}),(0,t.jsx)("div",{className:"h-1.5 w-full bg-slate-200 rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-emerald-500 rounded-full shadow-[0_0_8px_rgba(16,185,129,0.4)] transition-all duration-500",style:{width:`${Math.round(100*u)}%`}})}),r&&!f&&(0,t.jsxs)("div",{className:"mt-3 flex items-center gap-3",children:["partial_failure"===e.buildStatus&&(0,t.jsx)("span",{className:"text-[11px] text-amber-600 font-semibold",children:"Some tasks failed to push."}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("button",{type:"button",onClick:h,disabled:i,className:"flex items-center gap-1.5 px-4 py-1.5 text-xs font-bold text-white bg-slate-900 hover:bg-slate-800 rounded-full shadow-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,t.jsx)(iw,{className:"w-3 h-3"}),i?"Pushing…":"Push to agx"]})]}),a&&(0,t.jsxs)("div",{className:"mt-2 text-[11px] text-amber-600 font-medium",children:["Status polling error: ",a]}),o&&(0,t.jsx)(iI,{onSelect:p,onClose:()=>s(!1)})]})}let i_=(0,a.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var iV=e.i(14670);let iH=(0,a.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),iU=(0,a.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),iq="<!-- thread-summary -->";function iW({messages:e,streaming:r,participants:i,onOpenThread:o,onCopyThread:s,onAddToChat:l,onDeleteThreadRoot:a,onSummarize:c,onCreateTasks:d,onUpdateTaskDraft:u,onBuildTasks:p,summarizingThreads:f,extractingTasks:m,buildingDrafts:y,taskDrafts:x,deletingThreadRootId:b,highlightedMessageId:v}){let k=(0,n.useRef)(null),w=(0,n.useRef)(new Map),S=Object.fromEntries(i.map(e=>[e.id,e])),C=(0,n.useMemo)(()=>e.filter(e=>!e.rootMessageId),[e]),M=(0,n.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=n.rootMessageId;if(!e)continue;let r=t.get(e);r||(r={rootMessageId:e,replyCount:0,participants:[],lastActivityAt:0,previewReplies:[],allReplies:[]},t.set(e,r)),r.replyCount++,r.lastActivityAt=Math.max(r.lastActivityAt,n.timestamp),r.lastReply=n,r.allReplies.push(n),n.participantId&&!r.participants.includes(n.participantId)?r.participants.push(n.participantId):n.participantId||r.participants.includes("user")||r.participants.push("user")}for(let e of t.values())e.allReplies.sort((e,t)=>e.timestamp-t.timestamp),e.previewReplies=[...e.allReplies],e.previewReplies.length>2&&(e.previewReplies=e.previewReplies.slice(-2));return t})(e),[e]),N=(0,n.useCallback)((e,t)=>{t?w.current.set(e,t):w.current.delete(e)},[]);return(0,n.useEffect)(()=>{if(!v)return;let e=w.current.get(v);e&&e.scrollIntoView({behavior:"smooth",block:"center"})},[v,e]),(0,n.useEffect)(()=>{v||k.current?.scrollIntoView({behavior:"smooth"})},[v,C,r]),(0,t.jsx)("div",{className:"chat-scrollbar flex-1 overflow-y-auto p-4",children:(0,t.jsxs)("div",{className:"max-w-3xl mx-auto",children:[0===C.length&&0===Object.keys(r).length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center text-slate-400 mt-32 space-y-3",children:[(0,t.jsx)(ip,{className:"h-6 w-6",strokeWidth:1.5}),(0,t.jsx)("span",{className:"text-sm font-medium tracking-wide",children:"Start a workspace"})]}),C.map(e=>{let n=e.participantId?S[e.participantId]:null,i=M.get(e.id),k=b===e.id,w=i?.allReplies.find(e=>e.content.startsWith(iq)),C=w?w.content.slice(iq.length).trim():null,T=(i?.previewReplies||[]).filter(e=>!e.content.startsWith(iq));return(0,t.jsxs)("div",{className:"max-w-2xl mx-auto bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden mb-6 group transition-all hover:border-slate-300 relative",children:[(s||l||a)&&(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[l&&(0,t.jsx)("button",{type:"button",onClick:()=>l(e.id),className:"p-1.5 text-slate-400 hover:bg-indigo-50 hover:text-indigo-600 rounded-md transition-colors",title:"Add to chat",children:(0,t.jsx)(iU,{className:"w-3.5 h-3.5"})}),s&&(0,t.jsx)("button",{type:"button",onClick:()=>s(e.id),className:"p-1.5 text-slate-400 hover:bg-slate-100 rounded-md transition-colors",title:"Copy thread as markdown",children:(0,t.jsx)(i_,{className:"w-3.5 h-3.5"})}),a&&(0,t.jsx)("button",{type:"button",onClick:()=>a(e.id),disabled:k,className:"p-1.5 text-slate-400 hover:bg-rose-50 hover:text-rose-600 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Delete this thread",children:k?(0,t.jsx)(im,{className:"w-3.5 h-3.5 animate-spin"}):(0,t.jsx)(h,{className:"w-3.5 h-3.5"})})]}),(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"p-5",children:(0,t.jsxs)("div",{ref:t=>N(e.id,t),"data-message-id":e.id,className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"flex gap-3 mb-4",children:["user"!==e.role&&(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-slate-100 overflow-hidden border border-slate-100 shadow-sm flex items-center justify-center shrink-0",children:n?(0,t.jsx)("img",{src:j(n.id,40,n.color),alt:n.name,className:"w-full h-full object-cover"}):(0,t.jsx)("img",{src:j(e.participantId||"assistant",40),alt:e.participantId||"Assistant",className:"w-full h-full object-cover"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 pt-0.5",children:["user"!==e.role&&(0,t.jsx)("div",{className:"flex items-center gap-2 mb-0.5",children:(0,t.jsx)("span",{className:"font-bold text-sm text-slate-900",children:n?.name||e.participantId||"Assistant"})}),(0,t.jsxs)("div",{className:"cursor-pointer group/msg-title mb-1",onClick:()=>o?.(e.id),children:[(0,t.jsx)("h3",{className:"text-lg font-bold text-slate-900 leading-tight group-hover/msg-title:text-indigo-600 transition-colors line-clamp-1",children:ig(e.content.split("\n")[0])}),(0,t.jsx)("div",{className:"mt-1",children:(0,t.jsx)("span",{className:"text-[11px] font-medium text-slate-400",children:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(e.timestamp)})}),(e.content.length>80||e.content.includes("\n"))&&(0,t.jsx)("div",{className:"mt-2 text-[15px] text-slate-600 leading-relaxed",children:(0,t.jsx)(il,{content:ig(e.content),isUser:"user"===e.role})})]})]})]}),e.attachments&&e.attachments.length>0&&(0,t.jsx)("div",{className:`mb-4 ${"user"!==e.role?"ml-[52px]":""}`,children:(0,t.jsx)(ih,{attachments:e.attachments,compact:!0})}),C&&(0,t.jsx)("div",{className:"mb-4 text-sm text-slate-600 leading-relaxed",children:(0,t.jsx)(il,{content:C,isUser:!1})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[c&&i&&i.replyCount>0&&(0,t.jsxs)("button",{type:"button",onClick:()=>c(e.id),disabled:f?.has(e.id),className:"flex items-center gap-1.5 px-3 py-1.5 bg-white border border-slate-200 rounded-full text-xs font-bold text-slate-600 hover:bg-slate-50 transition-colors shadow-sm disabled:opacity-50",children:[f?.has(e.id)?(0,t.jsx)(im,{className:"w-3.5 h-3.5 animate-spin text-slate-400"}):(0,t.jsx)(iV.Clock,{className:"w-3.5 h-3.5 text-slate-400"}),f?.has(e.id)?"Summarizing…":"Summarize"]}),d&&i&&i.replyCount>0&&(0,t.jsxs)("button",{type:"button",onClick:()=>d(e.id),disabled:m?.has(e.id),className:"flex items-center gap-1.5 px-3 py-1.5 bg-white border border-slate-200 rounded-full text-xs font-bold text-slate-600 hover:bg-slate-50 transition-colors shadow-sm disabled:opacity-50",children:[m?.has(e.id)?(0,t.jsx)(im,{className:"w-3.5 h-3.5 animate-spin text-slate-400"}):(0,t.jsx)(iH,{className:"w-3.5 h-3.5 text-slate-400"}),m?.has(e.id)?"Extracting…":x?.[e.id]?"Re-extract tasks":"Create tasks"]}),i&&i.replyCount>0&&o&&(0,t.jsxs)("button",{type:"button",onClick:()=>o(e.id),className:"flex items-center gap-2 px-3 py-1.5 bg-slate-50 border border-slate-100 rounded-full text-xs font-bold text-slate-500 hover:bg-slate-100 transition-colors",children:[(0,t.jsx)("div",{className:"flex -space-x-1.5",children:i.participants.slice(0,3).map(e=>{if("user"===e)return(0,t.jsx)("div",{className:"w-4 h-4 rounded-full bg-slate-200 flex items-center justify-center ring-1 ring-white",children:(0,t.jsx)(g,{className:"w-2.5 h-2.5 text-slate-400"})},"user");let n=S[e];return n?(0,t.jsx)("img",{src:j(e,16,n.color),alt:n.name,className:"w-4 h-4 rounded-full ring-1 ring-white"},e):(0,t.jsx)("div",{className:"w-4 h-4 rounded-full bg-slate-200 ring-1 ring-white"},e)})}),(0,t.jsxs)("span",{children:[i.replyCount," replies"]})]})]}),x?.[e.id]&&(x[e.id].builtTaskIds&&Object.keys(x[e.id].builtTaskIds).length>0?(0,t.jsx)(iB,{draft:x[e.id],onPush:(t,n,r)=>p?.(e.id,t,n,r),pushing:y?.has(x[e.id].draftId)}):(0,t.jsx)(iD,{draft:x[e.id],onUpdate:t=>u?.(e.id,t),onBuild:(t,n,r)=>p?.(e.id,t,n,r),building:y?.has(x[e.id].draftId)})),m?.has(e.id)&&(0,t.jsxs)("div",{className:"mt-4 flex items-center gap-2 text-xs text-slate-400",children:[(0,t.jsx)(im,{className:"w-3.5 h-3.5 animate-spin"}),(0,t.jsx)("span",{children:"Extracting tasks…"})]})]})}),!C&&i&&i.replyCount>0&&(0,t.jsx)("div",{className:"p-6 pt-0 border-t border-slate-100 bg-slate-50/10",children:(0,t.jsxs)("div",{className:"pt-4 max-h-[320px] overflow-hidden relative",children:[i.replyCount>T.length&&(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-slate-100"}),(0,t.jsxs)("button",{onClick:()=>o?.(e.id),className:"flex items-center gap-2 text-[11px] font-bold uppercase tracking-wider text-slate-400 hover:text-indigo-600 transition-colors shrink-0",children:[(0,t.jsx)(ip,{className:"w-3.5 h-3.5"}),(0,t.jsxs)("span",{children:["Show ",i.replyCount-T.length," more ",i.replyCount-T.length==1?"reply":"replies"]})]}),(0,t.jsx)("div",{className:"flex-1 h-px bg-slate-100"})]}),(0,t.jsx)("div",{className:"space-y-1",children:T.map(e=>{let n=e.participantId?S[e.participantId]:null;return(0,t.jsx)("div",{ref:t=>N(e.id,t),"data-message-id":e.id,children:(0,t.jsx)(iy,{isRoot:!1,message:e,participantName:n?.name||e.participantId||"Assistant",participantColor:n?.color,participantId:n?.id||e.participantId||void 0,onOpenThread:o,highlighted:e.id===v})},e.id)})}),(0,t.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-slate-50 via-slate-50/80 to-transparent pointer-events-none z-10"})]})}),Object.entries(r).filter(([,t])=>t.rootMessageId===e.id).map(([e,n])=>{let r=S[e];return(0,t.jsx)("div",{className:"px-6 pb-4",children:(0,t.jsx)(ib,{participantId:e,participantName:r?.name||e,participantColor:r?.color||"#888",content:n.content})},`streaming-${e}`)})]})]},e.id)}),Object.entries(r).filter(([,e])=>!e.rootMessageId).map(([e,n])=>{let r=S[e];return(0,t.jsx)("div",{className:"max-w-2xl mx-auto mb-8 px-4",children:(0,t.jsx)(ib,{participantId:e,participantName:r?.name||e,participantColor:r?.color||"#888",content:n.content})},`streaming-${e}`)}),(0,t.jsx)("div",{ref:k})]})})}let iK=(0,a.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);function iJ({messages:e,streaming:r,participants:i,rootMessageId:o,onClose:s,onCopyThread:l,onAddToChat:a,onDeleteThreadRoot:c,highlightedMessageId:d,renderReplyComposer:u}){let p=(0,n.useRef)(null),f=(0,n.useRef)(new Map),m=Object.fromEntries(i.map(e=>[e.id,e])),y=(0,n.useMemo)(()=>{let t=e.find(e=>e.id===o),n=e.filter(e=>e.rootMessageId===o).sort((e,t)=>e.timestamp-t.timestamp);return t?[t,...n]:n},[e,o]);return(0,n.useEffect)(()=>{if(d){let e=f.current.get(d);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}else p.current?.scrollIntoView({behavior:"smooth"})},[d,y,r]),(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-hidden bg-slate-50",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-4 md:p-8 space-y-6 chat-scrollbar",children:(0,t.jsxs)("div",{className:"max-w-2xl mx-auto space-y-8 pb-4",children:[y.map(e=>{let n,r="user"===e.role,i=e.participantId?m[e.participantId]:null;return(0,t.jsxs)("div",{ref:t=>{var n;return n=e.id,void(t?f.current.set(n,t):f.current.delete(n))},"data-message-id":e.id,className:"group relative flex gap-4 ",children:[(0,t.jsx)("div",{className:"flex-shrink-0 mt-1",children:r?(0,t.jsx)("div",{className:"w-10 h-10 bg-slate-200 rounded-full flex items-center justify-center text-slate-600 shadow-sm",children:(0,t.jsx)(g,{size:20})}):(0,t.jsx)("img",{src:i?j(i.id,40,i.color):j(e.participantId||"assistant",40),alt:i?.name||e.participantId||"Assistant",className:"w-10 h-10 rounded-full shadow-sm border border-slate-100 object-cover bg-slate-100"})}),(0,t.jsxs)("div",{className:"flex-1 space-y-1.5 max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-slate-900",style:!r&&i?.color?{color:i.color}:void 0,children:r?"You":i?.name||e.participantId||"Assistant"}),void 0===e.rootMessageId&&e.id===o&&(0,t.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 bg-slate-100 text-slate-500 rounded font-mono uppercase",children:"ROOT"}),(0,t.jsx)("span",{className:"text-[11px] text-slate-400",children:(n=e.timestamp,new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(n))})]}),(0,t.jsxs)("div",{className:`rounded-2xl p-4 text-[15px] leading-relaxed shadow-sm border ${r?"bg-slate-100 text-slate-700 border-slate-200":"bg-white text-slate-700 border-slate-200"} ${e.id===d?"ring-2 ring-indigo-400":""}`,children:[(0,t.jsx)(il,{content:ig(e.content),isUser:r}),e.attachments&&e.attachments.length>0&&(0,t.jsx)(ih,{attachments:e.attachments}),e.reactions&&e.reactions.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(id,{reactions:e.reactions})})]}),(0,t.jsxs)("div",{className:"absolute top-8 -right-2 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1 bg-white border border-slate-200 rounded-lg shadow-sm p-1 z-10 translate-x-full",children:[e.id===o&&a&&(0,t.jsx)("button",{onClick:()=>a(e.id),className:"p-1.5 text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 rounded",title:"Add to chat",children:(0,t.jsx)(iU,{size:14})}),e.id===o&&l&&(0,t.jsx)("button",{onClick:()=>l(e.id),className:"p-1.5 text-slate-400 hover:text-slate-600 hover:bg-slate-50 rounded",title:"Copy Thread",children:(0,t.jsx)(i_,{size:14})}),(0,t.jsx)("button",{className:"p-1.5 text-slate-400 hover:text-slate-600 hover:bg-slate-50 rounded",title:"Maximize",children:(0,t.jsx)(iK,{size:14})}),e.id===o&&c&&(0,t.jsx)("button",{onClick:()=>c(e.id),className:"p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded",title:"Delete Thread",children:(0,t.jsx)(h,{size:14})})]})]})]},e.id)}),Object.entries(r).filter(([,e])=>e.rootMessageId===o).map(([e,n])=>{let r=m[e],i=n.content.trim().length>0;return(0,t.jsxs)("div",{className:"flex gap-4 group relative",children:[(0,t.jsx)("div",{className:"flex-shrink-0 mt-1",children:(0,t.jsx)("img",{src:r?j(r.id,40,r.color):j(e,40),alt:r?.name||e,className:"w-10 h-10 rounded-full shadow-sm border border-slate-100 object-cover bg-slate-100"})}),(0,t.jsxs)("div",{className:"flex-1 space-y-1.5 max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-slate-900",style:r?.color?{color:r.color}:void 0,children:r?.name||e}),!i&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-[3px]",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-400 animate-[pulse-dot_1.4s_ease-in-out_infinite]"}),(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-400 animate-[pulse-dot_1.4s_ease-in-out_0.2s_infinite]"}),(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-400 animate-[pulse-dot_1.4s_ease-in-out_0.4s_infinite]"})]})]}),i&&(0,t.jsx)("div",{className:"rounded-2xl p-4 text-[15px] leading-relaxed shadow-sm border bg-white text-slate-700 border-slate-200",children:(0,t.jsx)(il,{content:ig(n.content),isUser:!1})})]})]},`streaming-${e}`)}),(0,t.jsx)("div",{ref:p,className:"h-4"})]})}),(0,t.jsx)("div",{className:"z-20",children:u(o)})]})}let iG=(0,a.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),iQ=(0,a.default)("search-x",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);function iX({query:e,results:n,total:r,participants:i,threadTitleById:o,isLoading:s,error:l,onSelectResult:a,headerSlot:c}){let d=Object.fromEntries(i.map(e=>[e.id,e]));return(0,t.jsx)("div",{className:"chat-scrollbar flex-1 overflow-y-auto p-4",children:(0,t.jsxs)("div",{className:"max-w-3xl mx-auto",children:[c?(0,t.jsx)("div",{className:"sticky top-0 z-20 bg-slate-50/70 backdrop-blur-md pt-4 pb-6 px-4 -mx-4 border-b border-transparent transition-colors",children:(0,t.jsx)("div",{className:"max-w-2xl mx-auto",children:c})}):null,(0,t.jsxs)("div",{className:"mb-4 rounded-xl border border-slate-200 bg-white px-4 py-3",children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-slate-700",children:"Search results"}),(0,t.jsx)("div",{className:"mt-1 text-sm text-slate-500",children:s?"Searching…":`${r} result${1===r?"":"s"} for "${e}"`}),l?(0,t.jsx)("div",{className:"mt-2 text-sm text-rose-600",children:l}):null]}),s||l||0!==n.length?null:(0,t.jsxs)("div",{className:"mt-20 flex flex-col items-center justify-center space-y-2 text-slate-400",children:[(0,t.jsx)(iQ,{className:"h-6 w-6",strokeWidth:1.5}),(0,t.jsx)("p",{className:"text-sm font-medium",children:"No matching messages"})]}),(0,t.jsx)("div",{className:"space-y-3 pb-6",children:n.map(e=>{var n;let r=e.participantId?d[e.participantId]:null,i=o[e.threadId]||"Untitled workspace",s="user"===e.role?"You":r?.name||e.participantId||"Assistant";return(0,t.jsxs)("button",{type:"button",onClick:()=>a(e),className:"w-full rounded-xl border border-slate-200 bg-white p-4 text-left transition hover:border-slate-300 hover:shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-400",children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 items-center justify-center overflow-hidden rounded-full bg-slate-100",children:"user"===e.role?(0,t.jsx)(g,{className:"h-4 w-4 text-slate-700"}):r?(0,t.jsx)("img",{src:j(r.id,32,r.color),alt:"",className:"h-full w-full object-cover"}):(0,t.jsx)(iG,{className:"h-4 w-4 text-slate-700"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"truncate text-sm font-semibold text-slate-800",children:s}),(0,t.jsx)("p",{className:"truncate text-xs text-slate-500",children:i})]})]}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-slate-400",children:(n=e.timestamp,new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n))})]}),(0,t.jsx)("p",{className:"text-sm leading-relaxed text-slate-700",children:function(e){let n=e.split(/(<\/?mark>)/g),r=!1,i=[];for(let[e,o]of n.entries()){if("<mark>"===o){r=!0;continue}if("</mark>"===o){r=!1;continue}o&&i.push(r?(0,t.jsx)("mark",{className:"rounded bg-amber-200/80 px-0.5",children:o},`${e}-mark`):(0,t.jsx)("span",{children:o},`${e}-text`))}return i}(e.snippet)})]},`${e.threadId}-${e.messageId}`)})})]})})}var iY=n,iZ=e.i(50333),i0=e.i(32527);function i1(e){this.content=e}i1.prototype={constructor:i1,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return -1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new i1(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new i1(n)},addToStart:function(e,t){return new i1([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new i1(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new i1(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=i1.from(e)).size?new i1(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=i1.from(e)).size?new i1(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=i1.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},i1.from=function(e){if(e instanceof i1)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new i1(t)};class i2{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;if(a>e&&!1!==n(l,r+s,i||null,o)&&l.content.size){let i=s+1;l.nodesBetween(Math.max(0,e-i),Math.min(l.content.size,t-i),n,r+i)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let a=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&a||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new i2(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=l}return new i2(n,r)}cutByIndex(e,t){return e==t?i2.empty:0==e&&t==this.content.length?this:new i2(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i2(r,i)}addToStart(e){return new i2([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new i2(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 RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)r++;return r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let l=t.child(--o),a=n.child(--s),c=l.nodeSize;if(l==a){r-=c,i-=c;continue}if(!l.sameMarkup(a))return{a:r,b:i};if(l.isText&&l.text!=a.text){let e=0,t=Math.min(l.text.length,a.text.length);for(;e<t&&l.text[l.text.length-e-1]==a.text[a.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(l.content.size||a.content.size){let t=e(l.content,a.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return i5(0,e);if(e==this.size)return i5(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return i5(t+1,r);return i5(t,n)}n=r}}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 i2.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return new i2(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return i2.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new i2(t||e,n)}static from(e){if(!e)return i2.empty;if(e instanceof i2)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i2([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}i2.empty=new i2([],0);let i3={index:0,offset:0};function i5(e,t){return i3.index=e,i3.offset=t,i3}function i4(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!i4(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!i4(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class i6{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||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&&i4(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 RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return i6.none;if(e instanceof i6)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}i6.none=[];class i8 extends Error{}class i9{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i){let{index:o,offset:s}=t.findIndex(n),l=t.maybeChild(o);if(s==n||l.isText)return i&&!i.canReplace(o,o,r)?null:t.cut(0,n).append(r).append(t.cut(n));let a=e(l.content,n-s-1,r,l);return a&&t.replaceChild(o,l.copy(a))}(this.content,e+this.openStart,t);return n&&new i9(n,this.openStart,this.openEnd)}removeBetween(e,t){return new i9(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:l,offset:a}=t.findIndex(r);if(o==n||s.isText){if(a!=r&&!t.child(l).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=l)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(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 i9.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new i9(i2.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new i9(e,n,r)}}function i7(e,t){if(!t.type.compatibleContent(e.type))throw new i8("Cannot join "+t.type.name+" onto "+e.type.name)}function oe(e,t,n){let r=e.node(n);return i7(r,t.node(n)),r}function ot(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function on(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(ot(e.nodeAfter,r),o++));for(let e=o;e<s;e++)ot(i.child(e),r);t&&t.depth==n&&t.textOffset&&ot(t.nodeBefore,r)}function or(e,t){return e.type.checkContent(t),e.copy(t)}function oi(e,t,n){let r=[];return on(null,e,n,r),e.depth>n&&ot(or(oe(e,t,n+1),oi(e,t,n+1)),r),on(t,null,n,r),new i2(r)}i9.empty=new i9(i2.empty,0,0);class oo{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return i6.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new od(this,e,n);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 RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new oo(t,n,i)}static resolveCached(e,t){let n=oc.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else oc.set(e,n=new ol);let r=n.elts[n.i]=oo.resolve(e,t);return n.i=(n.i+1)%oa,r}}class ol{constructor(){this.elts=[],this.i=0}}let oa=12,oc=new WeakMap;class od{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}}let ou=Object.create(null);class oh{constructor(e,t,n,r=i6.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||i2.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,n,r=0){this.content.nodesBetween(e,t,n,r,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,n,r){return this.content.textBetween(e,t,n,r)}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,n){return this.type==e&&i4(this.attrs,t||e.defaultAttrs||ou)&&i6.sameSet(this.marks,n||i6.none)}copy(e=null){return e==this.content?this:new oh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new oh(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return i9.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new i9(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),i=this.resolve(t);if(n.openStart>r.depth)throw new i8("Inserted content deeper than insertion position");if(r.depth-n.openStart!=i.depth-n.openEnd)throw new i8("Inconsistent open depths");return function e(t,n,r,i){let o=t.index(i),s=t.node(i);if(o==n.index(i)&&i<t.depth-r.openStart){let l=e(t,n,r,i+1);return s.copy(s.content.replaceChild(o,l))}if(!r.content.size)return or(s,oi(t,n,i));if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){let{start:e,end:o}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(i2.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return or(s,function e(t,n,r,i,o){let s=t.depth>o&&oe(t,n,o+1),l=i.depth>o&&oe(r,i,o+1),a=[];return on(null,t,o,a),s&&l&&n.index(o)==r.index(o)?(i7(s,l),ot(or(s,e(t,n,r,i,o+1)),a)):(s&&ot(or(s,oi(t,n,o+1)),a),on(n,r,o,a),l&&ot(or(l,oi(r,i,o+1)),a)),on(i,null,o,a),new i2(a)}(t,e,o,n,i))}{let e=t.parent,i=e.content;return or(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,i,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return oo.resolveCached(this,e)}resolveNoCache(e){return oo.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+")"),of(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=i2.empty,r=0,i=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,i),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=i6.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!i6.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=i2.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}oh.prototype.text=void 0;class op extends oh{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):of(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 op(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new op(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&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 of(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class om{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new og(e,t);if(null==i.next)return om.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=oy(e),r=n;return e.eat(",")&&(r="}"!=e.next?oy(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);ob(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new om(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(ox);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(ob(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),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,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return i2.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=i(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}om.empty=new om(!0);class og{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 SyntaxError(e+" (in content expression '"+this.string+"')")}}function oy(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function ox(e,t){return t-e}function ob(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(ox)}function ov(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function ok(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function ow(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function oS(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new oM(e,r,t[r]);return n}class oC{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=oS(e,n.attrs),this.defaultAttrs=ov(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==om.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:ok(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new oh(this,this.computeAttrs(e),i2.from(t),i6.setFrom(n))}createChecked(e=null,t,n){return t=i2.from(t),this.checkContent(t),new oh(this,this.computeAttrs(e),t,i6.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=i2.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(i2.empty,!0);return i?new oh(this,e,t.append(i),i6.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ow(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:i6.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new oC(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class oM{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class oN{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=oS(e,r.attrs),this.excluded=null;let i=ov(this.attrs);this.instance=i?new i6(this,i):null}create(e=null){return!e&&this.instance?this.instance:new i6(this,ok(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new oN(e,r++,t,i)),n}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]}checkAttrs(e){ow(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class oT{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=i1.from(e.nodes),t.marks=i1.from(e.marks||{}),this.nodes=oC.compile(this.spec.nodes,this),this.marks=oN.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=om.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?oj(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:oj(this,n.split(" "))}this.nodeFromJSON=e=>oh.fromJSON(this,e),this.markFromJSON=e=>i6.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof oC){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new op(n,n.defaultAttrs,e,i6.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function oj(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class oE{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new oP(this,t,!1);return n.addAll(e,i6.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new oP(this,t,!0);return n.addAll(e,i6.none,t.from,t.to),i9.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=oz(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=oz(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new oE(e,oE.schemaRules(e)))}}let oO={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},oA={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oI={ol:!0,ul:!0};function oD(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class oR{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=i6.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(i2.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=i2.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(i2.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&&!oO.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class oP{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=oD(null,t.preserveWhitespace,0)|4*!!n;i=r?new oR(r.type,r.attrs,i6.none,!0,t.topMatch||r.type.contentMatch,o):n?new oR(null,null,i6.none,!0,null,o):new oR(e.schema.topNodeType,null,i6.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;oI.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&oI.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(l?l.ignore:oA.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 n,r=this.needsBlock;if(oO.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let s=l&&l.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,l,n,!1===l.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],l=s.findWrapping(e);if(l&&(!r||r.length>l.length+o)&&(r=l,i=s,!l.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=i6.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):oL(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=oD(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let l=i6.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!oL(t.type,e))||(l=t.addToSet(l),!1)),this.nodes.push(new oR(e,t,l,r,null,s)),this.open++,n}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;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].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("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;s--}}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 n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function oz(e){let t={};for(let n in e)t[n]=e[n];return t}function oL(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class o${constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=oB(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=oV(oB(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&oV(oB(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return oV(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new o$(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=oF(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return oF(e.marks)}}function oF(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function oB(e){return e.document||window.document}let o_=new WeakMap;function oV(e,t,n,r){let i,o,s;if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let l=t[0],a;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=o_.get(r))&&o_.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),a=o)&&a.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=l.indexOf(" ");c>0&&(n=l.slice(0,c),l=l.slice(c+1));let d=n?e.createElementNS(n,l):e.createElement(l),u=t[1],h=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in h=2,u)if(null!=u[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),u[e]):"style"==e&&d.style?d.style.cssText=u[e]:d.setAttribute(e,u[e])}}for(let o=h;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>h)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}{let{dom:t,contentDOM:o}=oV(e,s,n,r);if(d.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:d,contentDOM:i}}class oH{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class oU{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&oU.empty)return oU.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[s+i],c=this.ranges[s+o],d=l+a;if(e<=d){let i=a?e==l?-1:e==d?1:t:t,o=l+r+(i<0?0:c);if(n)return o;let u=e==(t<0?l:d)?null:s/3+(e-l)*65536,h=e==l?2:e==d?1:4;return(t<0?e!=l:e!=d)&&(h|=8),new oH(o,h,u)}r+=c-a}return n?e+r:new oH(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[t+i];if(e<=s+l&&t==3*r)return!0;n+=this.ranges[t+o]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),l=o+(this.inverted?0:i),a=this.ranges[r+t],c=this.ranges[r+n];e(s,s+a,l,l+c),i+=c-a}}invert(){return new oU(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?oU.empty:new oU(e<0?[0,-e,0]:[0,0,e])}}oU.empty=new oU([]);class oq{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new oq(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),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r: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,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new oq;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new oH(e,r,null)}}let oW=Object.create(null);class oK{getMap(){return oU.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=oW[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in oW)throw RangeError("Duplicate use of step JSON ID "+e);return oW[e]=t,t.prototype.jsonID=e,t}}class oJ{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new oJ(e,null)}static fail(e){return new oJ(null,e)}static fromReplace(e,t,n,r){try{return oJ.ok(e.replace(t,n,r))}catch(e){if(e instanceof i8)return oJ.fail(e.message);throw e}}}function oG(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(oG(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return i2.fromArray(r)}class oQ extends oK{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new i9(oG(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return oJ.fromReplace(e,this.from,this.to,i)}invert(){return new oX(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new oQ(t.pos,n.pos,this.mark)}merge(e){return e instanceof oQ&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new oQ(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("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new oQ(t.from,t.to,e.markFromJSON(t.mark))}}oK.jsonID("addMark",oQ);class oX extends oK{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new i9(oG(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return oJ.fromReplace(e,this.from,this.to,n)}invert(){return new oQ(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new oX(t.pos,n.pos,this.mark)}merge(e){return e instanceof oX&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new oX(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("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new oX(t.from,t.to,e.markFromJSON(t.mark))}}oK.jsonID("removeMark",oX);class oY extends oK{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return oJ.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return oJ.fromReplace(e,this.pos,this.pos+1,new i9(i2.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new oY(this.pos,t.marks[n]);return new oY(this.pos,this.mark)}}return new oZ(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new oY(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new oY(t.pos,e.markFromJSON(t.mark))}}oK.jsonID("addNodeMark",oY);class oZ extends oK{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return oJ.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return oJ.fromReplace(e,this.pos,this.pos+1,new i9(i2.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new oY(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new oZ(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new oZ(t.pos,e.markFromJSON(t.mark))}}oK.jsonID("removeNodeMark",oZ);class o0 extends oK{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&o2(e,this.from,this.to)?oJ.fail("Structure replace would overwrite content"):oJ.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new oU([this.from,this.to-this.from,this.slice.size])}invert(e){return new o0(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new o0(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof o0)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?i9.empty:new i9(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new o0(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?i9.empty:new i9(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new o0(this.from,this.to+(e.to-e.from),t,this.structure)}}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("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new o0(t.from,t.to,i9.fromJSON(e,t.slice),!!t.structure)}}oK.jsonID("replace",o0);class o1 extends oK{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(o2(e,this.from,this.gapFrom)||o2(e,this.gapTo,this.to)))return oJ.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return oJ.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?oJ.fromReplace(e,this.from,this.to,n):oJ.fail("Content does not fit in gap")}getMap(){return new oU([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 o1(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),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new o1(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new o1(t.from,t.to,t.gapFrom,t.gapTo,i9.fromJSON(e,t.slice),t.insert,!!t.structure)}}function o2(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function o3(e,t,n,r=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),s=[],l=t+1;for(let t=0;t<o.childCount;t++){let a=o.child(t),c=l+a.nodeSize,d=r.matchType(a.type);if(d){r=d;for(let t=0;t<a.marks.length;t++)n.allowsMarkType(a.marks[t].type)||e.step(new oX(l,c,a.marks[t]));if(i&&a.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(a.text);)r||(r=new i9(i2.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),s.push(new o0(l+e.index,l+e.index+e[0].length,r))}}else s.push(new o0(l,c,i9.empty));l=c}if(!r.validEnd){let t=r.fillBefore(i2.empty,!0);e.replace(l,l,new i9(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function o5(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,l=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,l,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(l==o.childCount||o.canReplace(0,l))))break;s&&(r=1),l<o.childCount&&(i=1)}return null}function o4(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;l&&e<i;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return o?i.map(o6).concat({type:t,attrs:n}).concat(o.map(o6)):null}function o6(e){return{type:e,attrs:null}}function o8(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function o9(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function o7(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),l=r&&r[t+1];l&&(s=s.replaceChild(0,l.type.create(l.attrs)));let a=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!a.type.validContent(s))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function se(e,t){let n=e.resolve(t),r=n.index();return st(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function st(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function sn(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&st(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function sr(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),l=!1;if(1==e)l=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);l=e&&s.canReplaceWith(o,o,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function si(e,t,n=t,r=i9.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return so(i,o,r)?new o0(t,n,r):new ss(i,o,r).fit()}function so(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}oK.jsonID("replaceAround",o1);class ss{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=i2.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=i2.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let l=new i9(i,o,s);return e>-1?new o1(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new o0(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=sc(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:o,match:s}=this.frontier[i],l,a=null;if(1==t&&(r?s.matchType(r.type)||(a=s.fillBefore(i2.from(r),!1)):e&&o.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:i,parent:e,inject:a};if(2==t&&r&&(l=s.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:i,parent:e,wrap:l};if(e&&s.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=sc(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new i9(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=sc(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new i9(sl(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new i9(sl(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let o=this.unplaced,s=n?n.content:o.content,l=o.openStart-e,a=0,c=[],{match:d,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let h=s.size+e-(o.content.size-o.openEnd);for(;a<s.childCount;){let e=s.child(a),t=d.matchType(e.type);if(!t)break;(++a>1||0==l||e.content.size)&&(d=t,c.push(function e(t,n,r){if(n<=0)return t;let i=t.content;return n>1&&(i=i.replaceChild(0,e(i.firstChild,n-1,1==i.childCount?r-1:0))),n>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(i2.empty,!0)))),t.copy(i)}(e.mark(u.allowedMarks(e.marks)),1==a?l:0,a==s.childCount?h:-1)))}let p=a==s.childCount;p||(h=-1),this.placed=sa(this.placed,t,i2.from(c)),this.frontier[t].match=d,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<h;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?i9.empty:new i9(sl(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new i9(sl(o.content,e,a),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!sd(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:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=sd(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=sd(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=sa(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=sa(this.placed,this.depth,i2.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(i2.empty,!0);e.childCount&&(this.placed=sa(this.placed,this.frontier.length,e))}}function sl(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(sl(e.firstChild.content,t-1,n)))}function sa(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(sa(e.lastChild.content,t-1,n)))}function sc(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function sd(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?l:null}function su(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class sh extends oK{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return oJ.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return oJ.fromReplace(e,this.pos,this.pos+1,new i9(i2.from(r),0,+!t.isLeaf))}getMap(){return oU.empty}invert(e){return new sh(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 sh(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new sh(t.pos,t.attr,t.value)}}oK.jsonID("attr",sh);class sp extends oK{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return oJ.ok(n)}getMap(){return oU.empty}invert(e){return new sp(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("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new sp(t.attr,t.value)}}oK.jsonID("docAttr",sp);let sf=class extends Error{};(sf=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),sf.prototype.constructor=sf,sf.prototype.name="TransformError";class sm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new oq}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new sf(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 n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?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,n=i9.empty){let r=si(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new i9(i2.from(n),0,0))}delete(e,t){return this.replace(e,t,i9.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(so(i,o,r))return e.step(new o0(t,n,r));let s=su(i,o);0==s[s.length-1]&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?l=e:i.before(e)==t&&s.splice(1,0,-e)}let a=s.indexOf(l),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){var u;let t=c[e],n=(u=t.type).spec.defining||u.spec.definingForContent;if(n&&!t.sameMarkup(i.node(Math.abs(l)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let l=(t+d+1)%(r.openStart+1),u=c[l];if(u)for(let t=0;t<s.length;t++){let c=s[(t+a)%s.length],d=!0;c<0&&(d=!1,c=-c);let h=i.node(c-1),p=i.index(c-1);if(h.canReplaceWith(p,p,u.type,u.marks))return e.replace(i.before(c),d?o.after(c):n,new i9(function e(t,n,r,i,o){if(n<r){let o=t.firstChild;t=t.replaceChild(0,o.copy(e(o.content,n+1,r,i,o)))}if(n>i){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(i2.empty,!0))}return t}(r.content,0,r.openStart,l),l,r.openEnd))}}let h=e.steps.length;for(let l=s.length-1;l>=0&&(e.replace(t,n,r),!(e.steps.length>h));l--){let e=s[l];e<0||(t=i.before(e),n=o.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,i=t;if(!n.isInline&&r==i&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=i=e)}return this.replaceRange(r,i,new i9(i2.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),o=su(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=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 e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:i,depth:o}=t,s=r.before(o+1),l=i.after(o+1),a=s,c=l,d=i2.empty,u=0;for(let e=o,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=i2.from(r.node(e).copy(d)),u++):a--;let h=i2.empty,p=0;for(let e=o,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,h=i2.from(i.node(e).copy(h)),p++):c++;e.step(new o1(a,c,s,l,new i9(d.append(h),u,p),d.size-u,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let l=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);o9(e,r.node(),r.before(),l)}s.inlineContent&&o3(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let a=e.mapping.slice(l),c=a.map(t-n);if(e.step(new o0(c,a.map(t+n,-1),i9.empty,!0)),!0===r){let t=e.doc.resolve(c);o8(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=i2.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=i2.from(n[e].type.create(n[e].attrs,r))}let i=t.start,o=t.end;e.step(new o1(i,o,i,o,new i9(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var i=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var s,l,a;let c,d,u="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,u)&&(s=i.doc,l=i.mapping.slice(o).map(t),a=n,d=(c=s.resolve(l)).index(),c.parent.canReplaceWith(d,d+1,a))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&o9(i,e,t,o),o3(i,i.mapping.slice(o).map(t,1),n,void 0,null===r);let s=i.mapping.slice(o),l=s.map(t,1),a=s.map(t+e.nodeSize,1);return i.step(new o1(l,a,l+1,a-1,new i9(i2.from(n.create(u,null,e.marks)),0,0),1,!0)),!0===r&&o8(i,e,t,o),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw RangeError("Invalid content for node type "+n.name);e.step(new o1(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new i9(i2.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new sh(e,t,n)),this}setDocAttribute(e,t){return this.step(new sp(e,t)),this}addNodeMark(e,t){return this.step(new oY(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof i6)t.isInSet(n.marks)&&this.step(new oZ(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new oZ(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let i=e.doc.resolve(t),o=i2.empty,s=i2.empty;for(let e=i.depth,t=i.depth-n,l=n-1;e>t;e--,l--){o=i2.from(i.node(e).copy(o));let t=r&&r[l];s=i2.from(t?t.type.create(t.attrs,s):i.node(e).copy(s))}e.step(new o0(t,t,new i9(o.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,l;return r=this,s=[],l=[],r.doc.nodesBetween(e,t,(r,a,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(a,e),u=Math.min(a+r.nodeSize,t),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:s.push(i=new oX(c,u,d[e])));o&&o.to==c?o.to=u:l.push(o=new oQ(c,u,n))}}),s.forEach(e=>r.step(e)),l.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let l=null;if(n instanceof oN){let e=r.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<l.length;t++){let r=l[t],a;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(a=t)}a?(a.to=n,a.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}),i.forEach(e=>r.step(new oX(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return o3(this,e,t,n),this}}let sg=Object.create(null);class sy{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new sx(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=i9.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(l.pos),c.map(a.pos),s?i9.empty:t),0==s&&sj(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=e.mapping.slice(n),a=l.map(o.pos),c=l.map(s.pos);i?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),sj(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new sk(e):sT(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?sT(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):sT(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new sM(e.node(0))}static atStart(e){return sT(e,e,0,0,1)||new sM(e)}static atEnd(e){return sT(e,e,e.content.size,e.childCount,-1)||new sM(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=sg[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sg)throw RangeError("Duplicate use of selection JSON ID "+e);return sg[e]=t,t.prototype.jsonID=e,t}getBookmark(){return sk.between(this.$anchor,this.$head).getBookmark()}}sy.prototype.visible=!0;class sx{constructor(e,t){this.$from=e,this.$to=t}}let sb=!1;function sv(e){sb||e.parent.inlineContent||(sb=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class sk extends sy{constructor(e,t=e){sv(e),sv(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return sy.near(n);let r=e.resolve(t.map(this.anchor));return new sk(r.parent.inlineContent?r:n,n)}replace(e,t=i9.empty){if(super.replace(e,t),t==i9.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof sk&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new sw(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new sk(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=sy.findFrom(t,n,!0)||sy.findFrom(t,-n,!0);if(!e)return sy.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(sy.findFrom(e,-n,!0)||sy.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new sk(e,t)}}sy.jsonID("text",sk);class sw{constructor(e,t){this.anchor=e,this.head=t}map(e){return new sw(e.map(this.anchor),e.map(this.head))}resolve(e){return sk.between(e.resolve(this.anchor),e.resolve(this.head))}}class sS extends sy{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?sy.near(i):new sS(i)}content(){return new i9(i2.from(this.node),0,0)}eq(e){return e instanceof sS&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new sC(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new sS(e.resolve(t.anchor))}static create(e,t){return new sS(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}sS.prototype.visible=!1,sy.jsonID("node",sS);class sC{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new sw(n,n):new sC(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&sS.isSelectable(n)?new sS(t):sy.near(t)}}class sM extends sy{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=i9.empty){if(t==i9.empty){e.delete(0,e.doc.content.size);let t=sy.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new sM(e)}map(e){return new sM(e)}eq(e){return e instanceof sM}getBookmark(){return sN}}sy.jsonID("all",sM);let sN={map(){return this},resolve:e=>new sM(e)};function sT(e,t,n,r,i,o=!1){if(t.inlineContent)return sk.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&sS.isSelectable(r))return sS.create(e,n-(i<0?r.nodeSize:0))}else{let t=sT(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function sj(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof o0||o instanceof o1)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(sy.near(e.doc.resolve(r),n)))}class sE extends sm{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 RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return i6.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||i6.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(sy.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function sO(e,t){return t&&e?e.bind(t):e}class sA{constructor(e,t,n){this.name=e,this.init=sO(t.init,n),this.apply=sO(t.apply,n)}}let sI=[new sA("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new sA("selection",{init:(e,t)=>e.selection||sy.atStart(t.doc),apply:e=>e.selection}),new sA("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new sA("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class sD{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=sI.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new sA(e.key,e.spec.state,e))})}}class sR{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 n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let l=r?r[o].n:0,a=r?r[o].state:this,c=l<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new sR(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new sE(this)}static create(e){let t=new sD(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new sR(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new sD(this.schema,e.plugins),n=t.fields,r=new sR(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new sD(e.schema,e.plugins),i=new sR(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=oh.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=sy.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],l=s.spec.state;if(s.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=l.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class sP{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:sL("plugin")}getState(e){return e[this.key]}}let sz=Object.create(null);function sL(e){return e in sz?e+"$"+ ++sz[e]:(sz[e]=0,e+"$")}class s${constructor(e="key"){this.key=sL(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let sF=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function sB(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let s_=(e,t,n)=>{let r=sB(e,n);if(!r)return!1;let i=sq(r);if(!i){let n=r.blockRange(),i=n&&o5(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(s1(e,i,t,-1))return!0;if(0==r.parent.content.size&&(sH(o,"end")||sS.isSelectable(o)))for(let n=r.depth;;n--){let s=si(e.doc,r.before(n),r.after(n),i9.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(sH(o,"end")?sy.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):sS.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)};function sV(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=t.nodeAfter,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let l=si(e.doc,i,s,i9.empty);if(!l||l.from!=i||l instanceof o0&&l.slice.size>=s-i)return!1;if(n){let t=e.tr.step(l);t.setSelection(sk.create(t.doc,i)),n(t.scrollIntoView())}return!0}function sH(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let sU=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=sq(r)}let s=o&&o.nodeBefore;return!!s&&!!sS.isSelectable(s)&&(t&&t(e.tr.setSelection(sS.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function sq(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function sW(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let sK=(e,t,n)=>{let r=sW(e,n);if(!r)return!1;let i=sG(r);if(!i)return!1;let o=i.nodeAfter;if(s1(e,i,t,1))return!0;if(0==r.parent.content.size&&(sH(o,"start")||sS.isSelectable(o))){let n=si(e.doc,r.before(),r.after(),i9.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(sH(o,"start")?sy.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):sS.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},sJ=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=sG(r)}let s=o&&o.nodeAfter;return!!s&&!!sS.isSelectable(s)&&(t&&t(e.tr.setSelection(sS.create(e.doc,o.pos)).scrollIntoView()),!0)};function sG(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}let sQ=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function sX(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let sY=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=sX(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(sy.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},sZ=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof sM||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=sX(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(sk.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},s0=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(o7(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&o5(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function s1(e,t,n,r){let i,o,s,l=t.nodeBefore,a=t.nodeAfter,c,d,u=l.type.spec.isolating||a.type.spec.isolating;if(!u&&(i=t.nodeBefore,o=t.nodeAfter,s=t.index(),i&&o&&i.type.compatibleContent(o.type)&&(!i.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(s,s+1)&&!!(o.isTextblock||se(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let h=!u&&t.parent.canReplace(t.index(),t.index()+1);if(h&&(c=(d=l.contentMatchAt(l.childCount)).findWrapping(a.type))&&d.matchType(c[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=i2.empty;for(let e=c.length-1;e>=0;e--)i=i2.from(c[e].create(null,i));i=i2.from(l.copy(i));let o=e.tr.step(new o1(t.pos-1,r,t.pos,r,new i9(i,1,0),c.length,!0)),s=o.doc.resolve(r+2*c.length);s.nodeAfter&&s.nodeAfter.type==l.type&&se(o.doc,s.pos)&&o.join(s.pos),n(o.scrollIntoView())}return!0}let p=a.type.spec.isolating||r>0&&u?null:sy.findFrom(t,1),f=p&&p.$from.blockRange(p.$to),m=f&&o5(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(h&&sH(a,"start",!0)&&sH(l,"end")){let r=l,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=a,s=1;for(;!o.isTextblock;o=o.firstChild)s++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=i2.empty;for(let e=i.length-1;e>=0;e--)r=i2.from(i[e].copy(r));n(e.tr.step(new o1(t.pos-i.length,t.pos+a.nodeSize,t.pos+s,t.pos+a.nodeSize-s,new i9(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function s2(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(sk.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let s3=s2(-1),s5=s2(1);function s4(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function s6(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let s8=s6(sF,s_,sU),s9=s6(sF,sK,sJ),s7={Enter:s6(sQ,sZ,s0,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof sS&&e.selection.node.isBlock)return!!n.parentOffset&&!!o7(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,s,l=!1,a=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;l=n.end(e)==n.pos+(n.depth-e),a=n.start(e)==n.pos-(n.depth-e),s=sX(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(l&&s?{type:s}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof sk||e.selection instanceof sM)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=o7(c.doc,d,i.length,i);if(u||(i[0]=s?{type:s}:null,u=o7(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!l&&a&&n.node(o).type!=s){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);s&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&c.setNodeMarkup(c.mapping.map(n.before(o)),s)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":sY,Backspace:s8,"Mod-Backspace":s8,"Shift-Backspace":s8,Delete:s9,"Mod-Delete":s9,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new sM(e.doc))),!0)},le={"Ctrl-h":s7.Backspace,"Alt-Backspace":s7["Mod-Backspace"],"Ctrl-d":s7.Delete,"Ctrl-Alt-Backspace":s7["Mod-Delete"],"Alt-Delete":s7["Mod-Delete"],"Alt-d":s7["Mod-Delete"],"Ctrl-a":s3,"Ctrl-e":s5};for(let e in s7)le[e]=s7[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();let lt=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},ln=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},lr=null,li=function(e,t,n){let r=lr||(lr=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},lo=function(){lr=null},ls=function(e,t,n,r){return n&&(la(e,t,n,r,-1)||la(e,t,n,r,1))},ll=/^(img|br|input|textarea|hr)$/i;function la(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:lc(e))){let n=e.parentNode;if(!n||1!=n.nodeType||ld(e)||ll.test(e.nodeName)||"false"==e.contentEditable)return!1;t=lt(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?lc(e):0}}}function lc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ld(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let lu=function(e){return e.focusNode&&ls(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function lh(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let lp="u">typeof navigator?navigator:null,lf="u">typeof document?document:null,lm=lp&&lp.userAgent||"",lg=/Edge\/(\d+)/.exec(lm),ly=/MSIE \d/.exec(lm),lx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(lm),lb=!!(ly||lx||lg),lv=ly?document.documentMode:lx?+lx[1]:lg?+lg[1]:0,lk=!lb&&/gecko\/(\d+)/i.test(lm);lk&&(/Firefox\/(\d+)/.exec(lm)||[0,0])[1];let lw=!lb&&/Chrome\/(\d+)/.exec(lm),lS=!!lw,lC=lw?+lw[1]:0,lM=!lb&&!!lp&&/Apple Computer/.test(lp.vendor),lN=lM&&(/Mobile\/\w+/.test(lm)||!!lp&&lp.maxTouchPoints>2),lT=lN||!!lp&&/Mac/.test(lp.platform),lj=!!lp&&/Win/.test(lp.platform),lE=/Android \d/.test(lm),lO=!!lf&&"webkitFontSmoothing"in lf.documentElement.style,lA=lO?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function lI(e,t){return"number"==typeof e?e:e[t]}function lD(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=ln(s);continue}let e=s,n=e==o.body,l=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(o):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),a=0,c=0;if(t.top<l.top+lI(r,"top")?c=-(l.top-t.top+lI(i,"top")):t.bottom>l.bottom-lI(r,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+lI(i,"top")-l.top:t.bottom-l.bottom+lI(i,"bottom")),t.left<l.left+lI(r,"left")?a=-(l.left-t.left+lI(i,"left")):t.right>l.right-lI(r,"right")&&(a=t.right-l.right+lI(i,"right")),a||c)if(n)o.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:ln(s)}}function lR(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=ln(r));return t}function lP(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let lz=null;function lL(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function l$(e){return e.top<e.bottom||e.left<e.right}function lF(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(l$(e))return e}return Array.prototype.find.call(n,l$)||e.getBoundingClientRect()}let lB=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function l_(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=lO||lk;if(3==r.nodeType)if(s&&(lB.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=lF(li(r,i,i),n);if(lk&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=lF(li(r,i-1,i-1),-1);if(t.top==e.top){let n=lF(li(r,i,i+1),-1);if(n.top!=e.top)return lV(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,lV(lF(li(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==lc(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return lH(e.getBoundingClientRect(),!1)}if(null==o&&i<lc(r)){let e=r.childNodes[i];if(1==e.nodeType)return lH(e.getBoundingClientRect(),!0)}return lH(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==lc(r))){let e=r.childNodes[i-1],t=3==e.nodeType?li(e,lc(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return lV(lF(t,1),!1)}if(null==o&&i<lc(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?li(e,0,+!s):1==e.nodeType?e:null:null;if(t)return lV(lF(t,-1),!0)}return lV(lF(3==r.nodeType?li(r):r,-n),n>=0)}function lV(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function lH(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function lU(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let lq=/[\u0590-\u08ac]/,lW=null,lK=null,lJ=!1;class lG{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>lt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof l2){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof lQ&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?lt(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?lt(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],l=o+n.size;if(-1==r&&e<=l){let i=o+n.border;if(e>=i&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=lt(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||s==this.children.length-1)){t=l;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=lt(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,l=0;s<this.children.length;s++){let a=this.children[s],c=l+a.size;if(i>l&&o<c)return a.setSelection(e-l-a.border,t-l-a.border,n,r);l=c}let s=this.domFromPos(e,e?-1:1),l=t==e?s:this.domFromPos(t,t?-1:1),a=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((lk||lM)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=l={node:n.parentNode,offset:lt(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(lk&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&lM)&&ls(s.node,s.offset,c.anchorNode,c.anchorOffset)&&ls(l.node,l.offset,c.focusNode,c.focusOffset))return;let u=!1;if((a.extend||e==t)&&!(d&&lk)){a.collapse(s.node,s.offset);try{e!=t&&a.extend(l.node,l.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class lQ extends lG{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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 lX extends lG{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}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"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class lY extends lG{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=o$.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new lY(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=lY.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=ar(i,t,o,n)),e>0&&(i=ar(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lZ extends lG{constructor(e,t,n,r,i,o,s,l,a){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],l,a=s&&s(t,i,()=>l?l.parent?l.parent.posBeforeChild(l):void 0:o,n,r),c=a&&a.dom,d=a&&a.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=o$.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return(c=l9(c,n,t),a)?l=new l3(e,t,n,r,c,d||null,u,a,i,o+1):t.isText?new l1(e,t,n,r,c,u,i):new lZ(e,t,n,r,c,d||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>i2.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&l7(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new at(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,u,h,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(an);for(let e=0;e<u.length;e++)n(u[e],c,!!a)}else n(d,c,!!a);if(a)p=-1,h=a,a=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let e=0;e<l.length;e++)l[e].to<=o&&l.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(a=h.cut(e-o),h=h.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?l.filter(e=>!e.inline):l.slice();r(h,m,t.forChild(o,h),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&l.syncToMarks(i==this.node.childCount?i6.none:this.node.child(i).marks,n,e,i),l.placeWidget(t,e,r)},(t,o,a,c)=>{let d;l.syncToMarks(t.marks,n,e,c),l.findNodeMatch(t,o,a,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,o,a,d,e)||l.updateNextNode(t,o,a,e,c,r)||l.addNode(t,o,a,e,r),r+=t.nodeSize}),l.syncToMarks([],n,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let l=n[s],a=l.dom;if(a.parentNode==t){for(;a!=i;)i=ae(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(a,i);if(l instanceof lY){let n=i?i.previousSibling:t.lastChild;e(l.contentDOM,l.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=ae(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),lN&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof sk)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;a+=t.text}if(o>=n){if(o>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new lX(this,i,t,r);e.input.compositionNodes.push(o),this.children=ar(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(l7(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=l8(this.dom,this.nodeDOM,l6(this.outerDeco,this.node,t),l6(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function l0(e,t,n,r,i){l9(r,t,e);let o=new lZ(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class l1 extends lZ{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!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,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new l1(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class l2 extends lG{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class l3 extends lZ{constructor(e,t,n,r,i,o,s,l,a,c){super(e,t,n,r,i,o,s,a,c),this.spec=l}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let l5=function(e){e&&(this.nodeName=e)};l5.prototype=Object.create(null);let l4=[new l5];function l6(e,t,n){if(0==e.length)return l4;let r=n?l4[0]:new l5,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new l5(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new l5(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function l8(e,t,n,r){if(n==l4&&r==l4)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=l4[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,s||l4[0],o)}return i}function l9(e,t,n){return l8(e,e,l4,l6(t,n,1!=e.nodeType))}function l7(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ae(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class at{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];n:for(;i>0;){let l;for(;;)if(r){let e=n.children[r-1];if(e instanceof lY)n=e,r=e.children.length;else{l=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let a=l.node;if(a){if(a!=e.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=lY.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof lZ){let a=this.preMatch.matched.get(l);if(null!=a&&a!=i)return!1;let c=l.dom,d,u=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&l7(t,l.outerDeco));if(!u&&l.update(e,t,n,r))return this.destroyBetween(this.index,s),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(l,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,o+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!l7(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=lZ.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=lZ.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new lQ(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof lY;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof l1)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((lM||lS)&&e&&"false"==e.dom.contentEditable&&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 n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new l2(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function an(e,t){return e.type.side-t.type.side}function ar(e,t,n,r,i){let o=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],c=l,d=l+=a.size;c>=n||d<=t?o.push(a):(c<t&&o.push(a.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(a.slice(n-c,a.size,r)))}return o}function ai(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(lu(n)){for(a=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&sS.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==lc(e);r||i;){if(e==n)return!0;let t=lt(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==lc(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new sS(s==e?l:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[a,s]=i==e.state.selection.anchor?[i,t]:[t,i],l=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let n="pointer"==t||e.state.selection.head<l.pos&&!o?1:-1;c=ap(e,d,l,n)}return c}function ao(e){return e.editable?e.hasFocus():am(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function as(e,t=!1){let n=e.state.selection;if(au(e,n),ao(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&lS){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&ls(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,lt(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&lb&&lv<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,o,s,l,{anchor:a,head:c}=n,d,u;al&&!(n instanceof sk)&&(n.$from.parent.inlineContent||(d=aa(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=aa(e,n.to))),e.docView.setSelection(a,c,e,t),al&&(d&&ad(d),u&&ad(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),s=(o=r.domSelectionRange()).anchorNode,l=o.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=l)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!ao(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let al=lM||lS&&lC<63;function aa(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(lM&&i&&"false"==i.contentEditable)return ac(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return ac(i);else if(o)return ac(o)}}function ac(e){return e.contentEditable="true",lM&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ad(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function au(e,t){if(t instanceof sS){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(ah(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else ah(e)}function ah(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ap(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||sk.between(t,n,r)}function af(e){return(!e.editable||!!e.hasFocus())&&am(e)}function am(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function ag(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&sy.findFrom(o,t)}function ay(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function ax(e,t,n){let r=e.state.selection;if(r instanceof sk){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return ay(e,new sk(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=ag(e.state,t);return!!n&&n instanceof sS&&ay(e,n)}else if(!(lT&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(sS.isSelectable(i)?ay(e,new sS(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!lO&&ay(e,new sk(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof sS&&r.node.isInline)return ay(e,new sk(t>0?r.$to:r.$from));let n=ag(e.state,t);return!!n&&ay(e,n)}}function ab(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function av(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function ak(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(lk&&1==n.nodeType&&r<ab(n)&&av(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(av(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(aw(n))break;else{let t=n.previousSibling;for(;t&&av(t,-1);)i=n.parentNode,o=lt(t),t=t.previousSibling;if(t)r=ab(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?aS(e,n,r):i&&aS(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=ab(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(av(i.childNodes[o],1))t=i,n=++o;else break}else if(aw(i))break;else{let r=i.nextSibling;for(;r&&av(r,1);)t=r.parentNode,n=lt(r)+1,r=r.nextSibling;if(r)o=0,s=ab(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&aS(e,t,n)}(e)}function aw(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function aS(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!ld(e);)t=lt(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!ld(e);)t=lt(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(lu(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&as(e)},50)}function aC(e,t){let n=e.state.doc.resolve(t);if(!(lS||lj)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function aM(e,t,n){let r=e.state.selection;if(r instanceof sk&&!r.empty||n.indexOf("s")>-1||lT&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=ag(e.state,t);if(n&&n instanceof sS)return ay(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof sM?sy.near(n,t):sy.findFrom(n,t);return!!s&&ay(e,s)}return!1}function aN(e,t){if(!(e.state.selection instanceof sk))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function aT(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function aj(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||o$.fromSchema(e.state.schema),l=az(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,d,u=0;for(;c&&1==c.nodeType&&(d=aR[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=l.createElement(d[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),u++}c=a.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:a,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function aE(e,t,n,r,i){let o,s,l=i.parent.type.spec.code;if(!n&&!t)return null;let a=!!t&&(r||l||!n);if(a){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return s=new i9(i2.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,s=o$.fromSchema(r);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),o=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=az().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&aR[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(aL||(aL=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),aL.createHTML(t)):t),s)for(let e=0;e<s.length;e++)i=i.querySelector(s[e])||i;return i}(n),lO&&function(e){let t=e.querySelectorAll(lS?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(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 e=+d[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||oE.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||aO.test(e.parentNode.nodeName)?null:{ignore:!0}})),d)s=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:s}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=i2.from(t.create(r[e+1],i)),o++,s++}return new i9(i,o,s)}(aD(s,+d[1],+d[2]),d[4]);else if((s=i9.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,o=[];if(e.forEach(e=>{if(!o)return;let t=r.findWrapping(e.type),n;if(!t)return o=null;if(n=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){let s=e(t,n,r,i.lastChild,o+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(i2.from(aA(r,t,o+1))))}}(t,i,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(i2.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));let n=aA(e,t);o.push(n),r=r.matchType(n.type),i=t}}),o)return i2.from(o)}return e}(s.content,i),!0)).openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=aD(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,a)}),s}let aO=/^(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 aA(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,i2.from(e));return e}function aI(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(o=0),i<r-1&&(l=aI(l,t,n,r,i+1,o)),i>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(i2.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function aD(e,t,n){return t<e.openStart&&(e=new i9(aI(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new i9(aI(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let aR={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},aP=null;function az(){return aP||(aP=document.implementation.createHTMLDocument("title"))}let aL=null,a$={},aF={},aB={touchstart:!0,touchmove:!0};class a_{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 aV(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function aH(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>aU(e,t))})}function aU(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function aq(e){return{left:e.clientX,top:e.clientY}}function aW(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function aK(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}aF.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!aQ(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!lE||!lS||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!lN||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||lT&&72==r&&"c"==i)return aN(e,-1)||ak(e,-1);if(46==r&&!t.shiftKey||lT&&68==r&&"c"==i)return aN(e,1)||ak(e,1);if(13==r||27==r)return!0;if(37==r||lT&&66==r&&"c"==i){let t=37==r?"ltr"==aC(e,e.state.selection.from)?-1:1:-1;return ax(e,t,i)||ak(e,t)}if(39==r||lT&&70==r&&"c"==i){let t=39==r?"ltr"==aC(e,e.state.selection.from)?1:-1:1;return ax(e,t,i)||ak(e,t)}else if(38==r||lT&&80==r&&"c"==i)return aM(e,-1,i)||ak(e,-1);else if(40==r||lT&&78==r&&"c"==i)return function(e){if(!lM||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;aT(e,n,"true"),setTimeout(()=>aT(e,n,"false"),20)}return!1}(e)||aM(e,1,i)||ak(e,1);else if(i==(lT?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():aV(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,lh(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},aF.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},aF.keypress=(e,t)=>{if(aQ(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||lT&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof sk)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let aJ=lT?"metaKey":"ctrlKey";a$.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=a0(e),s=Date.now(),l="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[aJ]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?l="doubleClick":"doubleClick"==e.input.lastClick.type&&(l="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:l,button:t.button};let a=e.posAtCoords(aq(t));a&&("singleClick"==l?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new aG(e,a,t,!!o)):("doubleClick"==l?function(e,t,n,r){return aW(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return aW(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(aK(e,sk.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)aK(e,sk.create(r,o+1,o+1+n.content.size),"pointer");else{if(!sS.isSelectable(n))continue;aK(e,sS.create(r,o),"pointer")}return!0}}(e,n,r)})(e,a.pos,a.inside,t)?t.preventDefault():aV(e,"pointer"))};class aG{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[aJ],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:a}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||a instanceof sS&&a.from<=o&&a.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&lk&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),aV(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>as(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(aq(e))),this.updateAllowDefault(e),this.allowDefault||!t)aV(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,aW(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof sS&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(sS.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(aK(e,sS.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&sS.isSelectable(r))&&(aK(e,new sS(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||lM&&this.mightDrag&&!this.mightDrag.node.isAtom||lS&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(aK(this.view,sy.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):aV(this.view,"pointer")}}move(e){this.updateAllowDefault(e),aV(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function aQ(e,t){return!!e.composing||!!(lM&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}a$.touchstart=e=>{e.input.lastTouch=Date.now(),a0(e),aV(e,"pointer")},a$.touchmove=e=>{e.input.lastTouch=Date.now(),aV(e,"pointer")},a$.contextmenu=e=>a0(e);let aX=lE?5e3:-1;function aY(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>a0(e),t))}function aZ(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function a0(e,t=!1){if(!lE||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),aZ(e),t||e.docView&&e.docView.dirty){let n=ai(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}aF.compositionstart=aF.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof sk&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||lS&&lj&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),a0(e,!0),e.markCursor=null;else if(a0(e,!t.selection.empty),lk&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}aY(e,aX)},aF.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,aY(e,20))};let a1=lb&&lv<15||lN&&lA<604;function a2(e,t,n,r,i){let o=aE(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||i9.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,l=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function a3(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}a$.copy=aF.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=a1?null:t.clipboardData,{dom:o,text:s}=aj(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},aF.paste=(e,t)=>{if(e.composing&&!lE)return;let n=a1?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&a2(e,a3(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?a2(e,r.value,null,i,t):a2(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class a5{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let a4=lT?"altKey":"ctrlKey";function a6(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[a4]}for(let e in a$.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(aq(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof sS?i.to-1:i.to));else if(r&&r.mightDrag)n=sS.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=sS.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:l,text:a,slice:c}=aj(e,s);t.dataTransfer.files.length&&lS&&!(lC>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(a1?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",a1||t.dataTransfer.setData("text/plain",a),e.dragging=new a5(c,a6(e,t),n)},a$.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},aF.dragover=aF.dragenter=(e,t)=>t.preventDefault(),aF.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(aq(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=aE(e,a3(t.dataTransfer),a1?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&a6(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||i9.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let l=o?sr(e.state.doc,i.pos,o):i.pos;null==l&&(l=i.pos);let a=e.state.tr;if(s){let{node:e}=n;e?e.replace(a):a.deleteSelection()}let c=a.mapping.map(l),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=a.doc;if(d?a.replaceRangeWith(c,c,o.content.firstChild):a.replaceRange(c,c,o),a.doc.eq(u))return;let h=a.doc.resolve(c);if(d&&sS.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new sS(h));else{let t=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection(ap(e,h,a.doc.resolve(t)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},a$.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&as(e)},20))},a$.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},a$.beforeinput=(e,t)=>{if(lS&&lE&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,lh(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},aF)a$[e]=aF[e];function a8(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class a9{constructor(e,t){this.toDOM=e,this.spec=t||cr,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new ct(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof a9&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&a8(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class a7{constructor(e,t){this.attrs=e,this.spec=t||cr}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new ct(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof a7&&a8(this.attrs,e.attrs)&&a8(this.spec,e.spec)}static is(e){return e.type instanceof a7}destroy(){}}class ce{constructor(e,t){this.attrs=e,this.spec=t||cr}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new ct(i.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof ce&&a8(this.attrs,e.attrs)&&a8(this.spec,e.spec)}destroy(){}}class ct{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new ct(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,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new ct(e,e,new a9(t,n))}static inline(e,t,n,r){return new ct(e,t,new a7(n,r))}static node(e,t,n,r){return new ct(e,t,new ce(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof a7}get widget(){return this.type instanceof a9}}let cn=[],cr={};class ci{constructor(e,t){this.local=e.length?e:cn,this.children=t.length?t:cn}static create(e,t){return t.length?cd(t,e,0,cr):co}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==co||0==e.maps.length?this:this.mapInner(e,t,0,0,n||cr)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,r);l&&l.type.valid(t,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let l=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<l.length;i+=3){let o=l[i+1];if(o<0||e>o+t-r)continue;let a=l[i]+t-r;n>=a?l[i+1]=e<=a?-2:-1:e>=t&&s&&(l[i]+=s,l[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){a=!0,l[t+1]=-1;continue}let c=n.map(e[t]+o),d=c-i;if(d<0||d>=r.content.size){a=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:h,offset:p}=r.content.findIndex(d),f=r.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let r=l[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=co?(l[t]=d,l[t+1]=u,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=cd(function(e,t,n,r,i,o,s){for(let l=0;l<e.length;l+=3)-1==e[l+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let l=t.local[e].map(r,i,o);l?n.push(l):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[l+2],t[l]+o+1);return n}(l,e,t,n,i,o,s),r,0,s);t=a.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<a.children.length;e+=3){let n=a.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,a.children[e],a.children[e+1],a.children[e+2])}}return new ci(t.sort(cu),l)}(this.children,o||[],e,t,n,r,i):o?new ci(o.sort(cu),cn):co}add(e,t){return t.length?this==co?ci.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,l;if(l=ca(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,l,s+1):r.splice(i,0,o,o+e.nodeSize,cd(l,e,s+1,cr)),i+=3}});let o=cl(i?cc(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new ci(o.length?this.local.concat(o).sort(cu):this.local,r||this.children)}remove(e){return 0==e.length||this==co?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(i,o+1);l!=co?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new ci(r,n):co}forChild(e,t){let n,r;if(this==co)return this;if(t.isLeaf)return ci.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof a7){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new ci(r.sort(cu),cn);return n?new cs([e,n]):e}return n||co}eq(e){if(this==e)return!0;if(!(e instanceof ci)||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 ch(this.localsInner(e))}localsInner(e){if(this==co)return cn;if(e.inlineContent||!this.local.some(a7.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof a7||t.push(this.local[e]);return t}forEachSet(e){e(this)}}ci.empty=new ci([],[]),ci.removeOverlap=ch;let co=ci.empty;class cs{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,cr));return cs.from(n)}forChild(e,t){if(t.isLeaf)return ci.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=co&&(i instanceof cs?n=n.concat(i.members):n.push(i))}return cs.from(n)}eq(e){if(!(e instanceof cs)||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,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?ch(n?t:t.sort(cu)):cn}static from(e){switch(e.length){case 0:return co;case 1:return e[0];default:return new cs(e.every(e=>e instanceof ci)?e:e.reduce((e,t)=>e.concat(t instanceof ci?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function cl(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new ct(i.from+t,i.to+t,i.type))}return n}function ca(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function cc(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function cd(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let l=ca(e,t,s+n);if(l){o=!0;let e=cd(l,t,n+s+1,r);e!=co&&i.push(s,s+t.nodeSize,e)}});let s=cl(o?cc(e):e,-n).sort(cu);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new ci(s,i):co}function cu(e,t){return e.from-t.from||e.to-t.to}function ch(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),cp(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),cp(t,i,r.copy(o.from,r.to)));break}}return t}function cp(e,t,n){for(;t<e.length&&cu(n,e[t])>0;)t++;e.splice(t,0,n)}function cf(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=co&&t.push(r)}),e.cursorWrapper&&t.push(ci.create(e.state.doc,[e.cursorWrapper.deco])),cs.from(t)}let cm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},cg=lb&&lv<=11;class cy{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 cx{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cy,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);lb&&lv<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():lM&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),cg&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,cm)),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(af(this.view)){if(this.suppressingSelectionUpdates)return as(this.view);if(lb&&lv<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ls(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,n;for(let n=e.focusNode;n;n=ln(n))t.add(n);for(let r=e.anchorNode;r;r=ln(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&af(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],a);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(l=!0))}if(lk&&a.length){let e=a.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}else if((lS||lM)&&a.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;t&&1==t.nodeType&&"false"==t.contentEditable&&e.parentNode.removeChild(e)}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&lu(r)&&(c=ai(t))&&c.eq(sy.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,as(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!cb.has(e)&&(cb.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=lk,cv||(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."),cv=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,a)),this.handleDOMChange(o,s,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||as(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(lb&&lv<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?lt(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?lt(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let cb=new WeakMap,cv=!1;function ck(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return ls(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function cw(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(lM&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||lM&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let cS=/^(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 cC(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:ap(e,t.resolve(n.anchor),t.resolve(n.head))}function cM(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function cN(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class cT{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 a_,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(cI),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=cO(this),cE(this),this.nodeViews=cA(this),this.docView=l0(this.state.doc,cj(this),cf(this),this.dom,this),this.domObserver=new cx(this,(e,t,n,r)=>(function(e,t,n,r,i){let o,s,l,a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=ai(e,t);if(n&&!e.state.selection.eq(n)){if(lS&&lE&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,lh(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),a&&r.setMeta("composition",a),e.dispatch(r)}return}let c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);let u=e.state.selection,h=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:l,to:a}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],lu(c)||r.push({node:c.focusNode,offset:c.focusOffset})),lS&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,h=e.someProp("domParser")||oE.fromSchema(e.state.schema),p=u.resolve(l),f=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:cw,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+l,head:t+l}}return{doc:m,sel:f,from:l,to:a}}(e,t,n),p=e.state.doc,f=p.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(o=e.state.selection.to,s="end"):(o=e.state.selection.from,s="start"),e.input.lastKeyCode=null;let m=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,o-Math.min(s,l));r-=s+e-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;(o-=e)&&o<t.size&&cN(t.textBetween(o-1,o+1))&&(o+=e?1:-1),l=o+(l-s),s=o}else if(l<o){let t=r<=o&&r>=l?o-r:0;(o-=t)&&o<e.size&&cN(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}(f.content,h.doc.content,h.from,o,s);if(m&&e.input.domChangeCount++,(lN&&e.input.lastIOSEnter>Date.now()-225||lE)&&i.some(e=>1==e.nodeType&&!cS.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,lh(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&u instanceof sk&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))m={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let t=cC(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta("composition",a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof sk&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),lb&&lv<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>h.from&&"  "==h.doc.textBetween(m.start-h.from-1,m.start-h.from+1)&&(m.start--,m.endA--,m.endB--);let g=h.doc.resolveNoCache(m.start-h.from),y=h.doc.resolveNoCache(m.endB-h.from),x=p.resolve(m.start),b=g.sameParent(y)&&g.parent.inlineContent&&x.end()>=m.endA;if((lN&&e.input.lastIOSEnter>Date.now()-225&&(!b||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&g.pos<h.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(h.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,lh(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||cM(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(cM(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||cM(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",t=>t(e,lh(8,"Backspace")))){lE&&lS&&e.domObserver.suppressSelectionUpdates();return}lS&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),lE&&!b&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==m.endA&&(m.endB-=2,y=h.doc.resolveNoCache(m.endB-h.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,lh(13,"Enter"))})},20));let v=m.start,k=m.endA,w=t=>{let n=t||e.state.tr.replace(v,k,h.doc.slice(m.start-h.from,m.endB-h.from));if(h.sel){let t=cC(e,n.doc,h.sel);t&&!(lS&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==v||t.head==n.mapping.map(k)-1)||lb&&t.empty&&t.head==v)&&n.setSelection(t)}return a&&n.setMeta("composition",a),n.scrollIntoView()};if(b)if(g.pos==y.pos){lb&&lv<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>as(e),20));let t=w(e.state.tr.delete(v,k)),n=p.resolve(m.start).marksAcross(p.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(l=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,s,l,a;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(1==i.length&&0==o.length)l=i[0],s="add",a=e=>e.mark(l.addToSet(e.marks));else{if(0!=i.length||1!=o.length)return null;l=o[0],s="remove",a=e=>e.mark(l.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(a(t.child(e)));if(i2.from(c).eq(e))return{mark:l,type:s}}(g.parent.content.cut(g.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let t=w(e.state.tr);"add"==l.type?t.addMark(v,k,l.mark):t.removeMark(v,k,l.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-!y.textOffset){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),n=()=>w(e.state.tr.insertText(t,v,k));e.someProp("handleTextInput",r=>r(e,v,k,t,n))||e.dispatch(n())}else e.dispatch(w());else e.dispatch(w())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in a$){let n=a$[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||aU(e,t)||!e.editable&&t.type in aF||n(e,t)},aB[t]?{passive:!0}:void 0)}lM&&e.dom.addEventListener("input",()=>null),aH(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&aH(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cI),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(aZ(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=cA(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&aH(this),this.editable=cO(this),cE(this);let c=cf(this),d=cj(this),u=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=s||!this.docView.matchesNode(e.doc,d,c);(h||!e.selection.eq(o.selection))&&(l=!0);let p="preserve"==u&&l&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=i-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:lR(e.dom)}}(this);if(l){let t,n,l;this.domObserver.stop();let a=h&&(lb||lS)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,l=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(l)!=i.$anchor.start(l));if(h){let t=lS?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=lc(e=e.childNodes[t-1])}else{if(!e.parentNode||ld(e))return null;t=lt(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||ld(e))return null;t=lt(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=l0(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(a=!0)}a||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),ls(t.node,t.offset,n.anchorNode,n.anchorOffset)))?as(this,a):(au(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;lP(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof sS){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&lD(this,t.getBoundingClientRect(),e)}else lD(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)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new a5(e.slice,e.move,r<0?void 0:sS.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(lb){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("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(lz)return e.focus(lz);let t=lR(e);e.focus(null==lz?{get preventScroll(){return lz={preventScroll:!0},!0}}:void 0),lz||(lz=!1,lP(t,0))}(this.dom),as(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,l=0,a=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(lc(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(lc(r.startContainer),r.startOffset)}}}(o,t.left,t.top);a&&({node:s,offset:l}=a);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!lL(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(lL(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(lM)for(let e=c;s&&e;e=ln(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(lk&&1==s.nodeType&&(l=Math.min(l,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[l],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&l++}lO&&l&&1==s.nodeType&&1==(n=s.childNodes[l-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&l--,s==e.dom&&l==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==l||1!=s.nodeType||"BR"!=s.childNodes[l-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,l,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,l,a=0,c=n.top,d=n.top;for(let e=t.firstChild,u=0;e;e=e.nextSibling,u++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=li(e).getClientRects()}for(let h=0;h<t.length;h++){let p=t[h];if(p.top<=c&&p.bottom>=d){c=Math.max(p.bottom,c),d=Math.min(p.top,d);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,l=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(a=u+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(a=u+1)}}return(!o&&r&&(o=r,l=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=lF(r,1);if(n.top!=n.bottom&&lL(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,l):!o||s&&1==o.nodeType?{node:t,offset:a}:e(o,l)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return l_(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,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return lW==t&&lK==n?lJ:(lW=t,lK=n,lJ="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,lU(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=l_(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=li(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?lq.test(r.parent.textContent)&&s.modify?lU(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:l}=e.domSelectionRange(),a=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==u;try{s.collapse(o,l),t&&(t!=o||i!=l)&&s.extend&&s.extend(t,i)}catch(e){}return null!=a&&(s.caretBidiLevel=a),h}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return a2(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return a2(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return aj(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],cf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,lo()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!aU(this,e)&&a$[e.type]&&(this.editable||!(e.type in aF))&&a$[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?lM&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return ck(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?ck(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function cj(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[ct.node(0,e.state.doc.content.size,t)]}function cE(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:ct.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function cO(e){return!e.someProp("editable",t=>!1===t(e.state))}function cA(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function cI(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}cT.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var cD={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:"'"},cR={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cP="u">typeof navigator&&/Mac/.test(navigator.platform),cz="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),cL=0;cL<10;cL++)cD[48+cL]=cD[96+cL]=String(cL);for(var cL=1;cL<=24;cL++)cD[cL+111]="F"+cL;for(var cL=65;cL<=90;cL++)cD[cL]=String.fromCharCode(cL+32),cR[cL]=String.fromCharCode(cL);for(var c$ in cD)cR.hasOwnProperty(c$)||(cR[c$]=cD[c$]);let cF="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),cB="u">typeof navigator&&/Win/.test(navigator.platform);function c_(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function cV(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))cF?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(cP&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||cz&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?cR:cD)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[c_(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[c_(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(cB&&n.ctrlKey&&n.altKey)&&(o=cD[n.keyCode])&&o!=i){let r=t[c_(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var cH=Object.defineProperty,cU=(e,t)=>{for(var n in t)cH(e,n,{get:t[n],enumerable:!0})};function cq(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var cW=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],l=!!e,a=e||i.tr,c=()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(a),s.every(e=>!0===e)),d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(a,t),i=n(...e)(r);return s.push(i),d}])),run:c};return d}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:cq({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},cK={};cU(cK,{blur:()=>cJ,clearContent:()=>cG,clearNodes:()=>cQ,command:()=>cX,createParagraphNear:()=>cY,cut:()=>cZ,deleteCurrentNode:()=>c0,deleteNode:()=>c2,deleteRange:()=>c3,deleteSelection:()=>c5,enter:()=>c4,exitCode:()=>c6,extendMarkRange:()=>dr,first:()=>di,focus:()=>du,forEach:()=>dh,insertContent:()=>dp,insertContentAt:()=>dy,joinBackward:()=>dv,joinDown:()=>db,joinForward:()=>dk,joinItemBackward:()=>dw,joinItemForward:()=>dS,joinTextblockBackward:()=>dC,joinTextblockForward:()=>dM,joinUp:()=>dx,keyboardShortcut:()=>dT,lift:()=>dE,liftEmptyBlock:()=>dO,liftListItem:()=>dA,newlineInCode:()=>dI,resetAttributes:()=>dP,scrollIntoView:()=>dz,selectAll:()=>dL,selectNodeBackward:()=>d$,selectNodeForward:()=>dF,selectParentNode:()=>dB,selectTextblockEnd:()=>d_,selectTextblockStart:()=>dV,setContent:()=>dU,setMark:()=>up,setMeta:()=>uf,setNode:()=>um,setNodeSelection:()=>ug,setTextDirection:()=>uy,setTextSelection:()=>ux,sinkListItem:()=>ub,splitBlock:()=>uk,splitListItem:()=>uw,toggleList:()=>uM,toggleMark:()=>uN,toggleNode:()=>uT,toggleWrap:()=>uj,undoInputRule:()=>uE,unsetAllMarks:()=>uO,unsetMark:()=>uA,unsetTextDirection:()=>uI,updateAttributes:()=>uD,wrapIn:()=>uR,wrapInList:()=>uP});var cJ=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),cG=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),cQ=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),l=o.blockRange(s);if(!l)return;let a=o5(l);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(l.start,e)}(a||0===a)&&t.lift(l,a)})}),!0)},cX=e=>t=>e(t),cY=()=>({state:e,dispatch:t})=>sZ(e,t),cZ=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new sk(r.doc.resolve(Math.max(s-1,0)))),!0},c0=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function c1(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var c2=e=>({tr:t,state:n,dispatch:r})=>{let i=c1(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},c3=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},c5=()=>({state:e,dispatch:t})=>sF(e,t),c4=()=>({commands:e})=>e.keyboardShortcut("Enter"),c6=()=>({state:e,dispatch:t})=>sY(e,t);function c8(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function c9(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:c8(t[r])?t[r].test(e[r]):t[r]===e[r])}function c7(e,t,n={}){return e.find(e=>e.type===t&&c9(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function de(e,t,n={}){return!!c7(e,t,n)}function dt(e,t,n){var r;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some(e=>e.type===t)||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(e=>e.type===t)||(n=n||(null==(r=i.node.marks[0])?void 0:r.attrs),!c7([...i.node.marks],t,n)))return;let o=i.index,s=e.start()+i.offset,l=o+1,a=s+i.node.nodeSize;for(;o>0&&de([...e.parent.child(o-1).marks],t,n);)o-=1,s-=e.parent.child(o).nodeSize;for(;l<e.parent.childCount&&de([...e.parent.child(l).marks],t,n);)a+=e.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function dn(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var dr=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=dn(e,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:d}=l;if(i){let e=dt(a,o,t);if(e&&e.from<=c&&e.to>=d){let t=sk.create(s,e.from,e.to);n.setSelection(t)}}return!0},di=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function ds(e){return e instanceof sk}function dl(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function da(e,t=null){if(!t)return null;let n=sy.atStart(e),r=sy.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?sk.create(e,dl(0,i,o),dl(e.content.size,i,o)):sk.create(e,dl(t,i,o),dl(t,i,o))}function dc(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function dd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var du=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(dd()||dc())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!dd()&&!dc()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!ds(n.state.selection))return s(),!0;let l=da(i.doc,e)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},dh=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),dp=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),df=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&df(r)}return e};function dm(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return df(new window.DOMParser().parseFromString(t,"text/html").body)}function dg(e,t,n){if(e instanceof oh||e instanceof i2)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,i="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return i2.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),dg("",t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i="",o=new oT({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?oE.fromSchema(o).parseSlice(dm(e),n.parseOptions):oE.fromSchema(o).parse(dm(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=oE.fromSchema(t);return n.slice?r.parseSlice(dm(e),n.parseOptions).content:r.parse(dm(e),n.parseOptions)}return dg("",t,n)}var dy=(e,t,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){let i,l;n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a=e=>{o.emit("contentError",{editor:o,error:e,disableCollaboration:()=>{"collaboration"in o.storage&&"object"==typeof o.storage.collaboration&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{dg(t,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){a(e)}try{i=dg(t,o.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:o.options.enableContentCheck})}catch(e){return a(e),!1}let{from:d,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},h=!0,p=!0;if((!("type"in i)?i:[i]).forEach(e=>{e.check(),h=!!h&&e.isText&&0===e.marks.length,p=!!p&&e.isBlock}),d===u&&p){let{parent:e}=r.doc.resolve(d);!e.isTextblock||e.type.spec.code||e.childCount||(d-=1,u+=1)}if(h){if(Array.isArray(t))l=t.map(e=>e.text||"").join("");else if(t instanceof i2){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),l=e}else l="object"==typeof t&&t&&t.text?t.text:t;r.insertText(l,d,u)}else{l=i;let e=r.doc.resolve(d),t=e.node(),n=0===e.parentOffset,o=t.isText||t.isTextblock,s=t.content.size>0;n&&o&&s&&(d=Math.max(0,d-1)),r.replaceWith(d,u,l)}n.updateSelection&&function(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof o0||i instanceof o1))return;let o=e.mapping.maps[r],s=0;o.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(sy.near(e.doc.resolve(s),-1))}(r,r.steps.length-1,0),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:l})}return!0},dx=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof sS,i;if(r){if(n.node.isTextblock||!se(e.doc,n.from))return!1;i=n.from}else if(null==(i=sn(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(sS.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),db=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof sS){if(n.node.isTextblock||!se(e.doc,n.to))return!1;r=n.to}else if(null==(r=sn(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),dv=()=>({state:e,dispatch:t})=>s_(e,t),dk=()=>({state:e,dispatch:t})=>sK(e,t),dw=()=>({state:e,dispatch:t,tr:n})=>{try{let r=sn(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},dS=()=>({state:e,dispatch:t,tr:n})=>{try{let r=sn(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},dC=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=sB(e,n);if(!r)return!1;let i=sq(r);return!!i&&sV(e,i,t)})(e,t),dM=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=sW(e,n);if(!r)return!1;let i=sG(r);return!!i&&sV(e,i,t)})(e,t);function dN(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var dT=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))dd()||dN()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});return null==a||a.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function dj(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?c1(t,e.schema):null,l=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);l.push({node:e,from:n,to:o})});let a=i-r,c=l.filter(e=>!s||s.name===e.node.type.name).filter(e=>c9(e.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=a}var dE=(e,t={})=>({state:n,dispatch:r})=>{let i=c1(e,n.schema);return!!dj(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&o5(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r)},dO=()=>({state:e,dispatch:t})=>s0(e,t),dA=e=>({state:t,dispatch:n})=>{var r;return(r=c1(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);return!!o&&(!t||(n.node(o.depth-1).type==r?function(e,t,n,r){let i=e.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new o1(o-1,s,o,s,new i9(i2.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new od(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let l=o5(r);if(null==l)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return se(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),t(i.scrollIntoView()),!0}(e,t,r,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,a=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+ +!l,d+1,s.content.append(a?i2.empty:i2.from(i))))return!1;let u=o.pos,h=u+s.nodeSize;return r.step(new o1(u-!!l,h+ +!!a,u+1,h-1,new i9((l?i2.empty:i2.from(i.copy(i2.empty))).append(a?i2.empty:i2.from(i.copy(i2.empty))),+!l,+!a),+!l)),t(r.scrollIntoView()),!0}(e,t,o)))})(t,n)},dI=()=>({state:e,dispatch:t})=>sQ(e,t);function dD(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function dR(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var dP=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=dD("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=c1(e,r.schema)),"mark"===l&&(s=dn(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,dR(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(a=!0,i&&n.addMark(r,r+e.nodeSize,s.create(dR(o.attrs,t))))})})}),a},dz=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),dL=()=>({tr:e,dispatch:t})=>{if(t){let t=new sM(e.doc);e.setSelection(t)}return!0},d$=()=>({state:e,dispatch:t})=>sU(e,t),dF=()=>({state:e,dispatch:t})=>sJ(e,t),dB=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(sS.create(e.doc,i))),!0)})(e,t),d_=()=>({state:e,dispatch:t})=>s5(e,t),dV=()=>({state:e,dispatch:t})=>s3(e,t);function dH(e,t,n={},r={}){return dg(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var dU=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{let{doc:a}=o;if("full"!==r.preserveWhitespace){let l=dH(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,a.content.size,l).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function dq(e,t){let n=dn(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let l=s.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function dW(e,t){let n=new sm(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function dK(e){return t=>(function(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}})(t.$from,e)}function dJ(e,t,n){return void 0===e.config[t]&&e.parent?dJ(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?dJ(e.parent,t,n):null}):e.config[t]}function dG(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=dJ(e,"addExtensions",t);return n?[e,...dG(n())]:e}).flat(10)}function dQ(e,t){let n=o$.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function dX(e){return"function"==typeof e}function dY(e,t,...n){return dX(e)?t?e.bind(t)(...n):e(...n):e}function dZ(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function d0(e){let t=[],{nodeExtensions:n,markExtensions:r}=dZ(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=dJ(e,"addGlobalAttributes",n);r&&r().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=dJ(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function d1(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=t?t.split(";").map(e=>e.trim()).filter(Boolean):[],i=n[e]?n[e].split(";").map(e=>e.trim()).filter(Boolean):[],o=new Map;i.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());o.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());o.set(t,n)}),n[e]=Array.from(o.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function d2(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>d1(e,t),{})}function d3(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function d5(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function d4(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function d6(e){return e.sort((e,t)=>{let n=dJ(e,"priority")||100,r=dJ(t,"priority")||100;return n>r?-1:+(n<r)})}function d8(e){var t;let n=d6(dG(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function d9(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},l="";return e.nodesBetween(r,i,(e,n,a,c)=>{var d;e.isBlock&&n>r&&(l+=o);let u=null==s?void 0:s[e.type.name];if(u)return a&&(l+=u({node:e,pos:n,parent:a,index:c,range:t})),!1;e.isText&&(l+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,i-n))}),l}function d7(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function ue(e,t){let n=dD("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=c1(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?dq(e,t):{}}function ut(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),l=n.invert().map(o,-1),a=n.invert().map(s);i.push({oldRange:{from:l,to:a},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function un(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=dt(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function ur(e,t){return t.nodes[e]||t.marks[e]||null}function ui(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function uo(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?dn(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>c9(e.attrs,n,{strict:!1}));let s=0,l=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);s+=o-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:o})))})}),0===s)return!1;let a=l.filter(e=>!o||o.name===e.mark.type.name).filter(e=>c9(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=l.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+c:a)>=s}function us(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function ul(e,t){let{nodeExtensions:n}=dZ(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=dY(dJ(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function ua(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(ua(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function uc(e){return e instanceof sS}var ud=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function uu(e,t){let n=t.mapping.mapResult(e.position);return{position:new ud(n.pos),mapResult:n}}function uh(e){return new ud(e)}var up=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,a=dn(e,r.schema);if(i)if(s){let e=dq(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),l=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))}):n.addMark(s,l,a.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;if(ds(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,a)},uf=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),um=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=c1(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!s4(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>s4(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ug=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=dl(e,0,n.content.size),i=sS.create(n,r);t.setSelection(i)}return!0},uy=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:l}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=l.from,s=l.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},ux=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=sk.atStart(n).from,s=sk.atEnd(n).to,l=dl(r,o,s),a=dl(i,o,s),c=sk.create(n,l,a);t.setSelection(c)}return!0},ub=e=>({state:t,dispatch:n})=>{var r;return(r=c1(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=r)return!1;if(t){let n=a.lastChild&&a.lastChild.type==l.type,i=i2.from(n?r.create():null),s=new i9(i2.from(r.create(null,i2.from(l.type.create(null,i)))),n?3:1,0),c=o.start,d=o.end;t(e.tr.step(new o1(c-(n?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0})(t,n)};function uv(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var uk=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:l,$to:a}=o,c=ui(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(o instanceof sS&&o.node.isBlock)return!!l.parentOffset&&!!o7(s,l.pos)&&(r&&(e&&uv(n,i.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,u=0===l.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=d&&u?[{type:u,attrs:c}]:void 0,p=o7(t.doc,t.mapping.map(l.pos),1,h);if(!h&&!p&&o7(t.doc,t.mapping.map(l.pos),1,u?[{type:u}]:void 0)&&(p=!0,h=u?[{type:u,attrs:c}]:void 0),r){if(p&&(o instanceof sk&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,h),u&&!d&&!l.parentOffset&&l.parent.type!==u)){let e=t.mapping.map(l.before()),n=t.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&t.setNodeMarkup(t.mapping.map(l.before()),u)}e&&uv(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},uw=(e,t={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let l=c1(e,r.schema),{$from:a,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;let u=a.node(-1);if(u.type!==l)return!1;let h=o.extensionManager.attributes;if(0===a.parent.content.size&&a.node(-1).childCount===a.indexAfter(-1)){if(2===a.depth||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let e=i2.empty,r=a.index(-1)?1:a.index(-2)?2:3;for(let t=a.depth-r;t>=a.depth-3;t-=1)e=i2.from(a.node(t).copy(e));let i=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,o={...ui(h,a.node().type.name,a.node().attrs),...t},c=(null==(s=l.contentMatch.defaultType)?void 0:s.createAndFill(o))||void 0;e=e.append(i2.from(l.createAndFill(null,c)||void 0));let d=a.before(a.depth-(r-1));n.replace(d,a.after(-i),new i9(e,4-r,0));let u=-1;n.doc.nodesBetween(d,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=t+1)}),u>-1&&n.setSelection(sk.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let p=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,f={...ui(h,u.type.name,u.attrs),...t},m={...ui(h,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,c.pos);let g=p?[{type:l,attrs:f},{type:p,attrs:m}]:[{type:l,attrs:f}];if(!o7(n.doc,a.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:s}=o.extensionManager,l=t||e.$to.parentOffset&&e.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!l||!i)return!0;let c=l.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0},uS=(e,t)=>{let n=dK(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&se(e.doc,n.pos))||(e.join(n.pos),!0)},uC=(e,t)=>{let n=dK(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&se(e.doc,r))||(e.join(r),!0)},uM=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:d})=>{let{extensions:u,splittableMarks:h}=i.extensionManager,p=c1(e,s.schema),f=c1(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:x}=m,b=y.blockRange(x),v=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;let k=dK(e=>ul(e.type.name,u))(m);if(b.depth>=1&&k&&b.depth-k.depth<=1){if(k.node.type===p)return c.liftListItem(f);if(ul(k.node.type.name,u)&&p.validContent(k.node.content)&&l)return a().command(()=>(o.setNodeMarkup(k.pos,p),!0)).command(()=>uS(o,p)).command(()=>uC(o,p)).run()}return n&&v&&l?a().command(()=>{let e=d().wrapInList(p,r),t=v.filter(e=>h.includes(e.type.name));return o.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>uS(o,p)).command(()=>uC(o,p)).run():a().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>uS(o,p)).command(()=>uC(o,p)).run()},uN=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=dn(e,r.schema);return uo(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},uT=(e,t,n={})=>({state:r,commands:i})=>{let o,s=c1(e,r.schema),l=c1(t,r.schema),a=dj(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),a)?i.setNode(l,o):i.setNode(s,{...o,...n})},uj=(e,t={})=>({state:n,commands:r})=>{let i=c1(e,n.schema);return dj(n,i,t)?r.lift(i):r.wrapIn(i,t)},uE=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},uO=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},uA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=dn(e,r.schema),{$from:c,empty:d,ranges:u}=l;if(!i)return!0;if(d&&s){let{from:e,to:t}=l,r=null==(o=c.marks().find(e=>e.type===a))?void 0:o.attrs,i=dt(c,a,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,a)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,a)});return n.removeStoredMark(a),!0},uI=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},uD=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=dD("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=c1(e,r.schema)),"mark"===l&&(s=dn(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{let l,c,d,u,h=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(h,p,(e,t)=>{o&&o===e.type&&(a=!0,d=Math.max(t,h),u=Math.min(t+e.nodeSize,p),l=t,c=e)}):r.doc.nodesBetween(h,p,(e,r)=>{r<h&&o&&o===e.type&&(a=!0,d=Math.max(r,h),u=Math.min(r+e.nodeSize,p),l=r,c=e),r>=h&&r<=p&&(o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(a=!0,i)){let i=Math.max(r,h),l=Math.min(r+e.nodeSize,p);n.addMark(i,l,s.create({...o.attrs,...t}))}}))}),c&&(void 0!==l&&i&&n.setNodeMarkup(l,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach(e=>{s===e.type&&i&&n.addMark(d,u,s.create({...e.attrs,...t}))}))}),a},uR=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&o4(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}})(c1(e,n.schema),t)(n,r),uP=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let i=!1,o=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);o=new od(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new od(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let l=o4(o,n,r,t);return!!l&&(e&&function(e,t,n,r,i){let o=i2.empty;for(let e=n.length-1;e>=0;e--)o=i2.from(n[e].type.create(n[e].attrs,o));e.step(new o1(t.start-2*!!r,t.end,t.start,t.end,new i9(o,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==i&&(s=e+1);let l=n.length-s,a=t.start+n.length-2*!!r,c=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&o7(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=c.child(n).nodeSize}(e,t,l,i,n),!0)}(l,s,e,t)&&(r&&r(l.scrollIntoView()),!0)}})(c1(e,n.schema),t)(n,r),uz=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},uL=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function u$(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1,u=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,l;let a=(null==(l=(s=e.type.spec).toText)?void 0:l.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,r-t))}),n})(c)+o;return s.forEach(e=>{if(d)return;let t=((e,t)=>{if(c8(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!t)return;let s=a.state.tr,c=cq({state:a.state,transaction:s}),h={from:r-(t[0].length-o.length),to:i},{commands:p,chain:f,can:m}=new cW({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(l,{transform:s,from:r,to:i,text:o}),a.dispatch(s),d=!0)}),d}function uF(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var uB=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...dY(dJ(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...dY(dJ(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return uF(t)&&uF(n)&&Object.keys(n).forEach(i=>{uF(n[i])&&uF(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},u_=class e extends uB{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},uV=class{constructor(e){this.find=e.find,this.handler=e.handler}},uH=null,uU=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=d8(e),this.schema=function(e,t){var n;let r=d0(e),{nodeExtensions:i,markExtensions:o}=dZ(e),s=null==(n=i.find(e=>dJ(e,"topNode")))?void 0:n.name;return new oT({topNode:s,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=d5({...e.reduce((e,t)=>{let r=dJ(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:dY(dJ(n,"content",o)),marks:dY(dJ(n,"marks",o)),group:dY(dJ(n,"group",o)),inline:dY(dJ(n,"inline",o)),atom:dY(dJ(n,"atom",o)),selectable:dY(dJ(n,"selectable",o)),draggable:dY(dJ(n,"draggable",o)),code:dY(dJ(n,"code",o)),whitespace:dY(dJ(n,"whitespace",o)),linebreakReplacement:dY(dJ(n,"linebreakReplacement",o)),defining:dY(dJ(n,"defining",o)),isolating:dY(dJ(n,"isolating",o)),attrs:Object.fromEntries(i.map(d4))}),l=dY(dJ(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>d3(e,i)));let a=dJ(n,"renderHTML",o);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:d2(e,i)}));let c=dJ(n,"renderText",o);return c&&(s.toText=c),[n.name,s]})),marks:Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=d5({...e.reduce((e,t)=>{let r=dJ(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:dY(dJ(n,"inclusive",o)),excludes:dY(dJ(n,"excludes",o)),group:dY(dJ(n,"group",o)),spanning:dY(dJ(n,"spanning",o)),code:dY(dJ(n,"code",o)),attrs:Object.fromEntries(i.map(d4))}),l=dY(dJ(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>d3(e,i)));let a=dJ(n,"renderHTML",o);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:d2(e,i)})),[n.name,s]}))})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:ur(t.name,this.schema)},r=dJ(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return d6([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ur(t.name,this.schema)},r=[],i=dJ(t,"addKeyboardShortcuts",n),o={};if("mark"===t.type&&dJ(t,"exitable",n)&&(o.ArrowRight=()=>u_.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));o={...o,...t}}let s=new sP({props:{handleKeyDown:cV(o)}});r.push(s);let l=dJ(t,"addInputRules",n);if(us(t,e.options.enableInputRules)&&l){let t=l();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new sP({state:{init:()=>null,apply(e,i,o){let s=e.getMeta(r);if(s)return s;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=dQ(i2.from(e),o.schema));let{from:i}=l,s=i+e.length;u$({editor:t,from:i,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,o,s)=>u$({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&u$({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&u$({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let a=dJ(t,"addPasteRules",n);if(us(t,e.options.enablePasteRules)&&a){let t=a();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,i=null,o=!1,s=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let a=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:c,can:d}=new cW({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,i,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,x=Math.max(r,t),b=Math.min(i,t+y);x>=b||((e,t,n)=>{if(c8(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(x-t,b-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=x+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=o.handler({state:n,range:i,match:e,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});u.push(h)})}),u.every(e=>null!==e)}({editor:n,state:cq({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new sP({view(e){let t=t=>{var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(uH=n)},r=()=>{uH&&(uH=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(s=i===e.dom.parentElement,t=n,!s){let e=uH;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],c="paste"===i.getMeta("uiEvent")&&!o,d="drop"===i.getMeta("uiEvent")&&!s,u=i.getMeta("applyPasteRules"),h=!!u;if(!c&&!d&&!h)return;if(h){var p,f;let t,{text:n}=u;"string"==typeof n||(n=dQ(i2.from(n),r.schema));let{from:i}=u,o=i+n.length;return a({rule:e,state:r,from:i,to:{b:o},pasteEvt:(p=n,null==(f=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||f.setData("text/html",p),t)})}let m=n.doc.content.findDiffStart(r.doc.content),g=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof m&&g&&m!==g.b)return a({rule:e,state:r,from:m,to:g,pasteEvt:l})}}))}({editor:e,rules:t});r.push(...n)}}let c=dJ(t,"addProseMirrorPlugins",n);if(c){let e=c();r.push(...e)}return r})}get attributes(){return d0(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=dZ(this.extensions);return Object.fromEntries(t.filter(e=>!!dJ(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:c1(t.name,this.schema)},i=dJ(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,l,a)=>{let c=d2(r,n);return o({node:r,view:i,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return d6([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ur(n.name,this.schema)},i=dJ(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}get markViews(){let{editor:e}=this,{markExtensions:t}=dZ(this.extensions);return Object.fromEntries(t.filter(e=>!!dJ(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:dn(t.name,this.schema)},i=dJ(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let l=d2(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:l,updateAttributes:t=>{!function(e,t,n={}){let{state:r}=t,{doc:i,tr:o}=r;i.descendants((t,r)=>{let i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,l=null;if(t.marks.forEach(t=>{if(t!==e)return!1;l=t}),!l)return;let a=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(a=!0)}),a){let t=e.type.create({...e.attrs,...n});o.removeMark(i,s,e.type),o.addMark(i,s,t)}}),o.docChanged&&t.view.dispatch(o)}(r,e,t)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ur(e.name,this.schema)};"mark"===e.type&&(null==(t=dY(dJ(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=dJ(e,"onBeforeCreate",n),i=dJ(e,"onCreate",n),o=dJ(e,"onUpdate",n),s=dJ(e,"onSelectionUpdate",n),l=dJ(e,"onTransaction",n),a=dJ(e,"onFocus",n),c=dJ(e,"onBlur",n),d=dJ(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),l&&this.editor.on("transaction",l),a&&this.editor.on("focus",a),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};uU.resolve=d8,uU.sort=d6,uU.flatten=dG,cU({},{ClipboardTextSerializer:()=>uW,Commands:()=>uK,Delete:()=>uJ,Drop:()=>uG,Editable:()=>uQ,FocusEvents:()=>uY,Keymap:()=>uZ,Paste:()=>u0,Tabindex:()=>u1,TextDirection:()=>u2,focusEventsPluginKey:()=>uX});var uq=class e extends uB{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},uW=uq.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new sP({key:new s$("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),l=Math.max(...o.map(e=>e.$to.pos)),a=d7(n);return d9(r,{from:s,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),uK=uq.create({name:"commands",addCommands:()=>({...cK})}),uJ=uq.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let o=()=>{var n,r,i,o;if(null!=(o=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,e))?o:e.getMeta("y-sync$"))return;let s=dW(e.before,[e,...t]);ut(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:s.mapping.map(r),newTo:s.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:s})})});let l=s.mapping;s.steps.forEach((t,n)=>{var r,i;if(t instanceof oX){let o=l.slice(n).map(t.from,-1),a=l.slice(n).map(t.to),c=l.invert().map(o,-1),d=l.invert().map(a),u=null==(r=s.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(t.mark)),h=null==(i=s.doc.nodeAt(a))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:o,to:a},partial:!!(h||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(o,0):o()}}),uG=uq.create({name:"drop",addProseMirrorPlugins(){return[new sP({key:new s$("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),uQ=uq.create({name:"editable",addProseMirrorPlugins(){return[new sP({key:new s$("editable"),props:{editable:()=>this.editor.options.editable}})]}}),uX=new s$("focusEvents"),uY=uq.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new sP({key:uX,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),uZ=uq.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:o}=n,{pos:s,parent:l}=o,a=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,c=a.parent.type.spec.isolating,d=o.pos-o.parentOffset,u=c&&1===a.parent.childCount?d===o.pos:sy.atStart(r).from===s;return!!i&&!!l.type.isTextblock&&!l.textContent.length&&!!u&&(!u||"paragraph"!==o.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return dd()||dN()?i:r},addProseMirrorPlugins(){return[new sP({key:new s$("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:l}=t.selection,a=sy.atStart(t.doc).from,c=sy.atEnd(t.doc).to;if(o||s!==a||l!==c||!ua(n.doc))return;let d=n.tr,u=cq({state:n,transaction:d}),{commands:h}=new cW({editor:this.editor,state:u});if(h.clearNodes(),d.steps.length)return d}})]}}),u0=uq.create({name:"paste",addProseMirrorPlugins(){return[new sP({key:new s$("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),u1=uq.create({name:"tabindex",addProseMirrorPlugins(){return[new sP({key:new s$("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),u2=uq.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=dZ(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new sP({key:new s$("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),u3=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},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}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+ +!o;if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!i&&!s&&a.depth<=this.depth)return;let c=new e(a,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},u5=`.ProseMirror {
2
- position: relative;
3
- }
4
-
5
- .ProseMirror {
6
- word-wrap: break-word;
7
- white-space: pre-wrap;
8
- white-space: break-spaces;
9
- -webkit-font-variant-ligatures: none;
10
- font-variant-ligatures: none;
11
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
12
- }
13
-
14
- .ProseMirror [contenteditable="false"] {
15
- white-space: normal;
16
- }
17
-
18
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
19
- white-space: pre-wrap;
20
- }
21
-
22
- .ProseMirror pre {
23
- white-space: pre-wrap;
24
- }
25
-
26
- img.ProseMirror-separator {
27
- display: inline !important;
28
- border: none !important;
29
- margin: 0 !important;
30
- width: 0 !important;
31
- height: 0 !important;
32
- }
33
-
34
- .ProseMirror-gapcursor {
35
- display: none;
36
- pointer-events: none;
37
- position: absolute;
38
- margin: 0;
39
- }
40
-
41
- .ProseMirror-gapcursor:after {
42
- content: "";
43
- display: block;
44
- position: absolute;
45
- top: -2px;
46
- width: 20px;
47
- border-top: 1px solid black;
48
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
49
- }
50
-
51
- @keyframes ProseMirror-cursor-blink {
52
- to {
53
- visibility: hidden;
54
- }
55
- }
56
-
57
- .ProseMirror-hideselection *::selection {
58
- background: transparent;
59
- }
60
-
61
- .ProseMirror-hideselection *::-moz-selection {
62
- background: transparent;
63
- }
64
-
65
- .ProseMirror-hideselection * {
66
- caret-color: transparent;
67
- }
68
-
69
- .ProseMirror-focused .ProseMirror-gapcursor {
70
- display: block;
71
- }`,u4=class extends uz{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?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:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:uu,createMappablePosition:uh},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=da(t,this.options.autofocus);this.editorState=sR.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t,n){let r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;let i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style",""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}(u5,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=dX(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[uQ,uW.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),uK,uY,uZ,u1,uG,u0,uJ,u2.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new uU(n,this)}createCommandManager(){this.commandManager=new cW({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=dH(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=dH(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new cT(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),l=null==s?void 0:s.getMeta("focus"),a=null==s?void 0:s.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||o.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return ue(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return dj(e,null,n)||uo(e,null,n);let r=dD(t,e.schema);return"node"===r?dj(e,t,n):"mark"===r&&uo(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return dQ(this.state.doc.content,this.schema)}getText(e){var t,n;let r,{blockSeparator:i="\n\n",textSerializers:o={}}=e||{};return t=this.state.doc,n={blockSeparator:i,textSerializers:{...d7(this.schema),...o}},r={from:0,to:t.content.size},d9(t,r,n)}get isEmpty(){return ua(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){return new u3(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function u6(e){return new uL({find:e.find,handler:({state:t,range:n,match:r})=>{let i=dY(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],l=r[0];if(s){let r=l.search(/\S/),a=n.from+l.indexOf(s),c=a+s.length;if(un(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>a).length)return null;c<n.to&&o.delete(c,n.to),a>n.from&&o.delete(n.from+r,a);let d=n.from+r+s.length;o.addMark(n.from+r,d,e.type.create(i||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function u8(e){return new uL({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=dY(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function u9(e){return new uL({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let o=dY(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&o4(l,e.type,o);if(!a)return null;if(s.wrap(l,a),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>i.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,o).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&se(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function u7(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(t.id=o[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var i;let o=n[parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];o&&(t[e]=o.slice(1,-1))});let s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function he(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function ht(e){let{nodeName:t,name:n,parseAttributes:r=u7,serializeAttributes:i=he,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:l}=e,a=n||t;return{parseMarkdown:(e,n)=>{let r={...o,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${a}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,i){let o=RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),l=e.match(o);if(!l)return;let c=r(l[1]||"");if(!s.find(e=>!(e in c)))return{type:t,raw:l[0],attributes:c}}},renderMarkdown:e=>{let t=i((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${a}${n} :::`}}}function hn(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=u7,serializeAttributes:o=he,defaultAttributes:s={},content:l="block",allowedAttributes:a}=e,c=n||t;return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===l?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let o={...s,...e.attributes};return n.createNode(t,o,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var o;let s=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),a=e.match(s);if(!a)return;let[d,u=""]=a,h=i(u),p=1,f=d.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){let n=g.exec(y);if(null===n)break;let i=n.index,s=n[1];if(null==(o=n[2])||!o.endsWith(":::")){if(s)p+=1;else if(0==(p-=1)){let o=y.slice(0,i);m=o.trim();let s=e.slice(0,f+i+n[0].length),a=[];if(m)if("block"===l)for((a=r.blockTokens(o)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});a.length>0;){let e=a[a.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;a.pop()}else a=r.inlineTokens(m);return{type:t,raw:s,attributes:h,content:m,tokens:a}}}}}},renderMarkdown:(e,t)=>{let n=o((e=>{if(!a)return e;let t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${c}${r}
72
-
73
- ${i}
74
-
75
- :::`}}}function hr(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,o,s]=r;t[i]=o||s,r=n.exec(e)}return t}function hi(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function ho(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=hr,serializeAttributes:o=hi,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=e,c=n||t,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let i={...s,...e.attributes};if(l)return n.createNode(t,i);let o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=l?RegExp(`\\[${d}\\s*[^\\]]*\\]`):RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let o=l?RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),s=e.match(o);if(!s)return;let a="",c="";if(l){let[,e]=s;c=e}else{let[,e,t]=s;c=e,a=t||""}let u=i(c.trim());return{type:t,raw:s[0],content:a.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=o((e=>{if(!a)return e;let t={};return a.forEach(n=>{let r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==i&&n===i)return;t[r]=n}}),t})(e.attrs||{})),i=n?` ${n}`:"";return l?`[${c}${i}]`:`[${c}${i}]${t}[/${c}]`}}}function hs(e,t,n){var r,i,o,s;let l=e.split("\n"),a=[],c="",d=0,u=t.baseIndentSize||2;for(;d<l.length;){let e,h=l[d],p=h.match(t.itemPattern);if(!p)if(a.length>0)break;else{if(""!==h.trim())return;d+=1,c=`${c}${h}
76
- `;continue}let f=t.extractItemData(p),{indentLevel:m,mainContent:g}=f;c=`${c}${h}
77
- `;let y=[g];for(d+=1;d<l.length;){let e=l[d];if(""===e.trim()){let t=l.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(i=null==(r=l[d+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>m){y.push(e),c=`${c}${e}
78
- `,d+=1;continue}break}if(((null==(s=null==(o=e.match(/^(\s*)/))?void 0:o[1])?void 0:s.length)||0)>m)y.push(e),c=`${c}${e}
79
- `,d+=1;else break}let x=y.slice(1);if(x.length>0){let r=x.map(e=>e.slice(m+u)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let b=t.createToken(f,e);a.push(b)}if(0!==a.length)return{items:a,raw:c}}function hl(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[o,...s]=e.content,l=t.renderChildren([o]),a=[`${i}${l}`];return s&&s.length>0&&s.forEach(e=>{let n=t.renderChildren([e]);if(n){let e=n.split("\n").map(e=>e?t.indent(e):"").join("\n");a.push(e)}}),a.join("\n")}cU({},{createAtomBlockMarkdownSpec:()=>ht,createBlockMarkdownSpec:()=>hn,createInlineMarkdownSpec:()=>ho,parseAttributes:()=>u7,parseIndentedBlocks:()=>hs,renderNestedMarkdownContent:()=>hl,serializeAttributes:()=>he});var ha=class e extends uB{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}};function hc(e){return new uV({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=dY(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,l=r[r.length-1],a=r[0],c=n.to;if(l){let r=a.search(/\S/),i=n.from+a.indexOf(l),d=i+l.length;if(un(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>i).length)return null;d<n.to&&s.delete(d,n.to),i>n.from&&s.delete(n.from+r,i),c=n.from+r+l.length,s.addMark(n.from+r,c,e.type.create(o||{})),s.removeStoredMark(e.type)}}})}let{getOwnPropertyNames:hd,getOwnPropertySymbols:hu}=Object,{hasOwnProperty:hh}=Object.prototype;function hp(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function hf(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);let{cache:i}=r,o=i.get(t),s=i.get(n);if(o&&s)return o===n&&s===t;i.set(t,n),i.set(n,t);let l=e(t,n,r);return i.delete(t),i.delete(n),l}}function hm(e){return hd(e).concat(hu(e))}let hg=Object.hasOwn||((e,t)=>hh.call(e,t));function hy(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:hx,keys:hb}=Object;function hv(e,t){return e.byteLength===t.byteLength&&hI(new Uint8Array(e),new Uint8Array(t))}function hk(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function hw(e,t){return e.byteLength===t.byteLength&&hI(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function hS(e,t){return hy(e.getTime(),t.getTime())}function hC(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function hM(e,t){return e===t}function hN(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),l=e.entries(),a=0;for(;(r=l.next())&&!r.done;){let o=t.entries(),l=!1,c=0;for(;(i=o.next())&&!i.done;){if(s[c]){c++;continue}let o=r.value,d=i.value;if(n.equals(o[0],d[0],a,c,e,t,n)&&n.equals(o[1],d[1],o[0],d[0],e,t,n)){l=s[c]=!0;break}c++}if(!l)return!1;a++}return!0}function hT(e,t,n){let r=hb(e),i=r.length;if(hb(t).length!==i)return!1;for(;i-- >0;)if(!hR(e,t,n,r[i]))return!1;return!0}function hj(e,t,n){let r,i,o,s=hm(e),l=s.length;if(hm(t).length!==l)return!1;for(;l-- >0;)if(!hR(e,t,n,r=s[l])||(i=hx(e,r),o=hx(t,r),(i||o)&&(!i||!o||i.configurable!==o.configurable||i.enumerable!==o.enumerable||i.writable!==o.writable)))return!1;return!0}function hE(e,t){return hy(e.valueOf(),t.valueOf())}function hO(e,t){return e.source===t.source&&e.flags===t.flags}function hA(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),l=e.values();for(;(r=l.next())&&!r.done;){let o=t.values(),l=!1,a=0;for(;(i=o.next())&&!i.done;){if(!s[a]&&n.equals(r.value,i.value,r.value,i.value,e,t,n)){l=s[a]=!0;break}a++}if(!l)return!1}return!0}function hI(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function hD(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function hR(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||hg(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let hP={"[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},hz=Object.prototype.toString,hL=h$();function h$(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:u,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let x=typeof m;if(x!==typeof g)return!1;if("object"!==x)return"number"===x?l(m,g,y):"function"===x&&o(m,g,y);let b=m.constructor;if(b!==g.constructor)return!1;if(b===Object)return a(m,g,y);if(Array.isArray(m))return t(m,g,y);if(b===Date)return r(m,g,y);if(b===RegExp)return d(m,g,y);if(b===Map)return s(m,g,y);if(b===Set)return u(m,g,y);let v=hz.call(m);if("[object Date]"===v)return r(m,g,y);if("[object RegExp]"===v)return d(m,g,y);if("[object Map]"===v)return s(m,g,y);if("[object Set]"===v)return u(m,g,y);if("[object Object]"===v)return"function"!=typeof m.then&&"function"!=typeof g.then&&a(m,g,y);if("[object URL]"===v)return p(m,g,y);if("[object Error]"===v)return i(m,g,y);if("[object Arguments]"===v)return a(m,g,y);if(hP[v])return h(m,g,y);if("[object ArrayBuffer]"===v)return e(m,g,y);if("[object DataView]"===v)return n(m,g,y);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return c(m,g,y);if(f){let e=f[v];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}return!1}}(function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:hv,areArraysEqual:n?hj:hk,areDataViewsEqual:hw,areDatesEqual:hS,areErrorsEqual:hC,areFunctionsEqual:hM,areMapsEqual:n?hp(hN,hj):hN,areNumbersEqual:hy,areObjectsEqual:n?hj:hT,arePrimitiveWrappersEqual:hE,areRegExpsEqual:hO,areSetsEqual:n?hp(hA,hj):hA,areTypedArraysEqual:n?hp(hI,hj):hI,areUrlsEqual:hD,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=hf(r.areArraysEqual),t=hf(r.areMapsEqual),n=hf(r.areObjectsEqual),i=hf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}(e)),s=n?n(o):function(e,t,n,r,i,s,l){return o(e,t,l)};return function({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(o,s){let{cache:l=e?new WeakMap:void 0,meta:a}=n();return t(o,s,{cache:l,equals:r,meta:a,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let o={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,o)}}({circular:t,comparator:o,createState:r,equals:s,strict:i})}h$({strict:!0}),h$({circular:!0}),h$({circular:!0,strict:!0}),h$({createInternalComparator:()=>hy}),h$({strict:!0,createInternalComparator:()=>hy}),h$({circular:!0,createInternalComparator:()=>hy}),h$({circular:!0,createInternalComparator:()=>hy,strict:!0});var hF=e.i(29796),hB=({contentComponent:e})=>{let n=(0,i0.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,t.jsx)(t.Fragment,{children:Object.values(n)})},h_=class extends iY.default.Component{constructor(e){var t;super(e),this.editorContentRef=iY.default.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(null==(t=e.editor)?void 0:t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,n;if(t.contentComponent)return;let r=this.editorContentRef.current;r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r}),e=new Set,n={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(t,r){n={...n,[t]:iZ.default.createPortal(r.reactElement,r.element,t)},e.forEach(e=>e())},removeRenderer(t){let r={...n};delete r[t],n=r,e.forEach(e=>e())}},this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;let t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:n,...r}=this.props;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(n,this.editorContentRef),...r}),(null==e?void 0:e.contentComponent)&&(0,t.jsx)(hB,{contentComponent:e.contentComponent})]})}},hV=(0,iY.forwardRef)((e,t)=>{let n=iY.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return iY.default.createElement(h_,{key:n,innerRef:t,...e})}),hH=iY.default.memo(hV),hU="u">typeof window?iY.useLayoutEffect:iY.useEffect,hq=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}},hW="u"<typeof window,hK=hW||!!("u">typeof window&&window.next),hJ=class e{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(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?hW||hK?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender)?this.createEditor():null}createEditor(){return new u4({...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...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(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let 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)}},hG=(0,iY.createContext)({editor:null});hG.Consumer;var hQ=(0,iY.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});iY.default.forwardRef((e,n)=>{let{onDragStart:r}=(0,iY.useContext)(hQ),i=e.as||"div";return(0,t.jsx)(i,{...e,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...e.style}})}),iY.default.createContext({markViewContentRef:()=>{}});var hX=(0,iY.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function hY({editor:e,instance:n,children:r}){let i=null!=e?e:n;if(!i)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let o=(0,iY.useMemo)(()=>({editor:i}),[i]),s=(0,iY.useMemo)(()=>({editor:i}),[i]);return(0,t.jsx)(hG.Provider,{value:s,children:(0,t.jsx)(hX.Provider,{value:o,children:r})})}function hZ({...e}){let{editor:n}=(0,iY.useContext)(hX);return(0,t.jsx)(hH,{editor:n,...e})}hX.displayName="TiptapContext",hY.displayName="Tiptap",hZ.displayName="Tiptap.Content",Object.assign(hY,{Content:hZ});var h0=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},h1=/^\s*>\s$/,h2=ha.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return h0("blockquote",{...d1(this.options.HTMLAttributes,e),children:h0("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach(e=>{let r=t.renderChildren([e]).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(r.join("\n"))}),n.join(`
80
- >
81
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[u9({find:h1,type:this.type})]}}),h3=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,h5=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,h4=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,h6=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,h8=u_.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return h0("strong",{...d1(this.options.HTMLAttributes,e),children:h0("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[u6({find:h3,type:this.type}),u6({find:h4,type:this.type})]},addPasteRules(){return[hc({find:h5,type:this.type}),hc({find:h6,type:this.type})]}}),h9=/(^|[^`])`([^`]+)`(?!`)$/,h7=/(^|[^`])`([^`]+)`(?!`)/g,pe=u_.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[u6({find:h9,type:this.type})]},addPasteRules(){return[hc({find:h7,type:this.type})]}}),pt=/^```([a-z]+)?[\s\n]$/,pn=/^~~~([a-z]+)?[\s\n]$/,pr=ha.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",d1(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r}
82
-
83
- \`\`\``},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;let l=" ".repeat(n);return s?e.commands.insertContent(l):e.commands.command(({tr:e})=>{let{from:t,to:n}=i,o=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>l+e).join("\n");return e.replaceWith(t,n,r.schema.text(o)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;let{pos:i}=o,s=o.start(),l=o.end(),a=r.doc.textBetween(s,l,"\n","\n").split("\n"),c=0,d=0,u=i-s;for(let e=0;e<a.length;e+=1){if(d+a[e].length>=u){c=e;break}d+=a[e].length+1}let h=Math.min(((null==(t=a[c].match(/^ */))?void 0:t[0])||"").length,n);if(0===h)return!0;let p=s;for(let e=0;e<c;e+=1)p+=a[e].length+1;return e.delete(p,p+h),i-p<=h&&e.setSelection(sk.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:o}=i,s=r.doc.textBetween(t,o,"\n","\n").split("\n").map(e=>{var t;let r=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(t,o,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!!o&&!!s&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let s=i.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(sy.near(r.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[u8({find:pt,type:this.type,getAttributes:e=>({language:e[1]})}),u8({find:pn,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new sP({key:new s$("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=null==i?void 0:i.mode;if(!n||!o)return!1;let{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(sk.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),pi=ha.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),po=ha.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",d1(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>`
84
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,l=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&o){let t=l.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ps=ha.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){let n=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${n}`,d1(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,...{[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}}),{})},addInputRules(){return this.options.levels.map(e=>u8({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),pl=ha.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",d1(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof sS){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return uc(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(sk.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(sS.create(t.doc,n.pos)):t.setSelection(sk.create(t.doc,n.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,o=null==i?void 0:i.create();o&&(t.insert(r,o),t.setSelection(sk.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){var e;return[new uL({find:(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type}).find,handler:({state:t,range:n,match:r})=>{let i=dY(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,l=n.to,a=e.type.create(i);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;let t=r[0][r[0].length-1];o.insertText(t,s+r[0].length-1),o.replaceWith(e,l,a)}else if(r[0]){let t=e.type.isInline?s:s-1;o.insert(t,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()},undoable:e.undoable})]}}),pa=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,pc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,pd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,pu=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ph=u_.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",d1(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[u6({find:pa,type:this.type}),u6({find:pd,type:this.type})]},addPasteRules(){return[hc({find:pc,type:this.type}),hc({find:pu,type:this.type})]}});let pp="numeric",pf="ascii",pm="alpha",pg="asciinumeric",py="alphanumeric",px="domain",pb="emoji",pv="whitespace";function pk(e,t,n){for(let r in t[pp]&&(t[pg]=!0,t[py]=!0),t[pf]&&(t[pg]=!0,t[pm]=!0),t[pg]&&(t[py]=!0),t[pm]&&(t[py]=!0),t[py]&&(t[px]=!0),t[pb]&&(t[px]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function pw(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}pw.groups={},pw.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let n=this.jr[t][0],r=this.jr[t][1];if(r&&n.test(e))return r}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){let i;return r=r||pw.groups,t&&t.j?i=t:(i=new pw(t),n&&r&&pk(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,o=e.length;if(!o)return i;for(let t=0;t<o-1;t++)i=i.tt(e[t]);return i.tt(e[o-1],t,n,r)},tt(e,t,n,r){if(r=r||pw.groups,t&&t.j)return this.j[e]=t,t;let i,o=this.go(e);return o?(Object.assign((i=new pw).j,o.j),i.jr.push.apply(i.jr,o.jr),i.jd=o.jd,i.t=o.t):i=new pw,t&&(r&&(i.t&&"string"==typeof i.t?pk(t,Object.assign(function(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&pk(t,n,r)),i.t=t),this.j[e]=i,i}};let pS=(e,t,n,r,i)=>e.ta(t,n,r,i),pC=(e,t,n,r,i)=>e.tr(t,n,r,i),pM=(e,t,n,r,i)=>e.ts(t,n,r,i),pN=(e,t,n,r,i)=>e.tt(t,n,r,i),pT="WORD",pj="UWORD",pE="ASCIINUMERICAL",pO="ALPHANUMERICAL",pA="LOCALHOST",pI="UTLD",pD="SCHEME",pR="SLASH_SCHEME",pP="OPENBRACE",pz="CLOSEBRACE",pL="OPENBRACKET",p$="CLOSEBRACKET",pF="OPENPAREN",pB="CLOSEPAREN",p_="OPENANGLEBRACKET",pV="CLOSEANGLEBRACKET",pH="FULLWIDTHLEFTPAREN",pU="FULLWIDTHRIGHTPAREN",pq="LEFTCORNERBRACKET",pW="RIGHTCORNERBRACKET",pK="LEFTWHITECORNERBRACKET",pJ="RIGHTWHITECORNERBRACKET",pG="FULLWIDTHLESSTHAN",pQ="FULLWIDTHGREATERTHAN",pX="AMPERSAND",pY="APOSTROPHE",pZ="ASTERISK",p0="BACKSLASH",p1="BACKTICK",p2="CARET",p3="COLON",p5="COMMA",p4="DOLLAR",p6="EQUALS",p8="EXCLAMATION",p9="HYPHEN",p7="PERCENT",fe="PIPE",ft="PLUS",fn="POUND",fr="QUERY",fi="QUOTE",fo="FULLWIDTHMIDDLEDOT",fs="SEMI",fl="SLASH",fa="TILDE",fc="UNDERSCORE",fd="EMOJI";var fu=Object.freeze({__proto__:null,ALPHANUMERICAL:pO,AMPERSAND:pX,APOSTROPHE:pY,ASCIINUMERICAL:pE,ASTERISK:pZ,AT:"AT",BACKSLASH:p0,BACKTICK:p1,CARET:p2,CLOSEANGLEBRACKET:pV,CLOSEBRACE:pz,CLOSEBRACKET:p$,CLOSEPAREN:pB,COLON:p3,COMMA:p5,DOLLAR:p4,DOT:"DOT",EMOJI:fd,EQUALS:p6,EXCLAMATION:p8,FULLWIDTHGREATERTHAN:pQ,FULLWIDTHLEFTPAREN:pH,FULLWIDTHLESSTHAN:pG,FULLWIDTHMIDDLEDOT:fo,FULLWIDTHRIGHTPAREN:pU,HYPHEN:p9,LEFTCORNERBRACKET:pq,LEFTWHITECORNERBRACKET:pK,LOCALHOST:pA,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:p_,OPENBRACE:pP,OPENBRACKET:pL,OPENPAREN:pF,PERCENT:p7,PIPE:fe,PLUS:ft,POUND:fn,QUERY:fr,QUOTE:fi,RIGHTCORNERBRACKET:pW,RIGHTWHITECORNERBRACKET:pJ,SCHEME:pD,SEMI:fs,SLASH:fl,SLASH_SCHEME:pR,SYM:"SYM",TILDE:fa,TLD:"TLD",UNDERSCORE:fc,UTLD:pI,UWORD:pj,WORD:pT,WS:"WS"});let fh=/[a-z]/,fp=/\p{L}/u,ff=/\p{Emoji}/u,fm=/\d/,fg=/\s/,fy=null,fx=null;function fb(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i,o=e.charCodeAt(r),s=o<55296||o>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s<r;){let l=e,a=null,c=0,d=null,u=-1,h=-1;for(;s<r&&(a=l.go(n[s]));)(l=a).accepts()?(u=0,h=0,d=l):u>=0&&(u+=n[s].length,h++),c+=n[s].length,o+=n[s].length,s++;o-=u,s-=h,c-=u,i.push({t:d.t,v:t.slice(o-c,o),s:o-c,e:o})}return i}function fv(e,t,n,r,i){let o,s=t.length;for(let n=0;n<s-1;n++){let s=t[n];e.j[s]?o=e.j[s]:((o=new pw(r)).jr=i.slice(),e.j[s]=o),e=o}return(o=new pw(n)).jr=i.slice(),e.j[t[s-1]]=o,o}function fk(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;"0123456789".indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}let fw={defaultProtocol:"http",events:null,format:fC,formatHref:fC,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function fS(e,t=null){let n=Object.assign({},fw);e&&(n=Object.assign(n,e instanceof fS?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function fC(e){return e}function fM(e,t){this.t="token",this.v=e,this.tk=t}function fN(e,t){class n extends fM{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}fS.prototype={o:fw,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:fw[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},fM.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=fw.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),o={},s=e.get("className",t,this),l=e.get("target",t,this),a=e.get("rel",t,this),c=e.getObj("attributes",t,this),d=e.getObj("events",t,this);return o.href=n,s&&(o.class=s),l&&(o.target=l),a&&(o.rel=a),c&&Object.assign(o,c),{tagName:r,attributes:o,content:i,eventListeners:d}}};let fT=fN("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fj=fN("text"),fE=fN("nl"),fO=fN("url",{isLink:!0,toHref(e=fw.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==pA&&e[1].t===p3}}),fA=e=>new pw(e);function fI(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let fD="u">typeof console&&console&&console.warn||(()=>{}),fR={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function fP(e,t=!1){if(fR.initialized&&fD(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
85
- 1. Must only contain digits, lowercase ASCII letters or "-"
86
- 2. Cannot start or end with "-"
87
- 3. "-" cannot repeat`);fR.customSchemes.push([e,t])}function fz(e){return fR.initialized||function(){fR.scanner=function(e=[]){let t={};pw.groups=t;let n=new pw;null==fy&&(fy=fk("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==fx&&(fx=fk("ελ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")),pN(n,"'",pY),pN(n,"{",pP),pN(n,"}",pz),pN(n,"[",pL),pN(n,"]",p$),pN(n,"(",pF),pN(n,")",pB),pN(n,"<",p_),pN(n,">",pV),pN(n,"(",pH),pN(n,")",pU),pN(n,"「",pq),pN(n,"」",pW),pN(n,"『",pK),pN(n,"』",pJ),pN(n,"<",pG),pN(n,">",pQ),pN(n,"&",pX),pN(n,"*",pZ),pN(n,"@","AT"),pN(n,"`",p1),pN(n,"^",p2),pN(n,":",p3),pN(n,",",p5),pN(n,"$",p4),pN(n,".","DOT"),pN(n,"=",p6),pN(n,"!",p8),pN(n,"-",p9),pN(n,"%",p7),pN(n,"|",fe),pN(n,"+",ft),pN(n,"#",fn),pN(n,"?",fr),pN(n,'"',fi),pN(n,"/",fl),pN(n,";",fs),pN(n,"~",fa),pN(n,"_",fc),pN(n,"\\",p0),pN(n,"・",fo);let r=pC(n,fm,"NUM",{[pp]:!0});pC(r,fm,r);let i=pC(r,fh,pE,{[pg]:!0}),o=pC(r,fp,pO,{[py]:!0}),s=pC(n,fh,pT,{[pf]:!0});pC(s,fm,i),pC(s,fh,s),pC(i,fm,i),pC(i,fh,i);let l=pC(n,fp,pj,{[pm]:!0});pC(l,fh),pC(l,fm,o),pC(l,fp,l),pC(o,fm,o),pC(o,fh),pC(o,fp,o);let a=pN(n,"\n","NL",{[pv]:!0}),c=pN(n,"\r","WS",{[pv]:!0}),d=pC(n,fg,"WS",{[pv]:!0});pN(n,"",d),pN(c,"\n",a),pN(c,"",d),pC(c,fg,d),pN(d,"\r"),pN(d,"\n"),pC(d,fg,d),pN(d,"",d);let u=pC(n,ff,fd,{[pb]:!0});pN(u,"#"),pC(u,ff,u),pN(u,"️",u);let h=pN(u,"‍");pN(h,"#"),pC(h,ff,u);let p=[[fh,s],[fm,i]],f=[[fh,null],[fp,l],[fm,o]];for(let e=0;e<fy.length;e++)fv(n,fy[e],"TLD",pT,p);for(let e=0;e<fx.length;e++)fv(n,fx[e],pI,pj,f);pk("TLD",{tld:!0,ascii:!0},t),pk(pI,{utld:!0,alpha:!0},t),fv(n,"file",pD,pT,p),fv(n,"mailto",pD,pT,p),fv(n,"http",pR,pT,p),fv(n,"https",pR,pT,p),fv(n,"ftp",pR,pT,p),fv(n,"ftps",pR,pT,p),pk(pD,{scheme:!0,ascii:!0},t),pk(pR,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?i[px]=!0:fh.test(r)?fm.test(r)?i[pg]=!0:i[pf]=!0:i[pp]=!0,pM(n,r,r,i)}return pM(n,"localhost",pA,{ascii:!0}),n.jd=new pw("SYM"),{start:n,tokens:Object.assign({groups:t},fu)}}(fR.customSchemes);for(let e=0;e<fR.tokenQueue.length;e++)fR.tokenQueue[e][1]({scanner:fR.scanner});fR.parser=function({groups:e}){let t=e.domain.concat([pX,pZ,"AT",p0,p1,p2,p4,p6,p9,"NUM",p7,fe,ft,fn,fl,"SYM",fa,fc]),n=[pY,p3,p5,"DOT",p8,p7,fr,fi,fs,p_,pV,pP,pz,p$,pL,pF,pB,pH,pU,pq,pW,pK,pJ,pG,pQ],r=[pX,pY,pZ,p0,p1,p2,p4,p6,p9,pP,pz,p7,fe,ft,fn,fr,fl,"SYM",fa,fc],i=fA(),o=pN(i,fa);pS(o,r,o),pS(o,e.domain,o);let s=fA(),l=fA(),a=fA();pS(i,e.domain,s),pS(i,e.scheme,l),pS(i,e.slashscheme,a),pS(s,r,o),pS(s,e.domain,s);let c=pN(s,"AT");pN(o,"AT",c),pN(l,"AT",c),pN(a,"AT",c);let d=pN(o,"DOT");pS(d,r,o),pS(d,e.domain,o);let u=fA();pS(c,e.domain,u),pS(u,e.domain,u);let h=pN(u,"DOT");pS(h,e.domain,u);let p=fA(fT);pS(h,e.tld,p),pS(h,e.utld,p),pN(c,pA,p);let f=pN(u,p9);pN(f,p9,f),pS(f,e.domain,u),pS(p,e.domain,u),pN(p,"DOT",h),pN(p,p9,f),pS(pN(p,p3),e.numeric,fT);let m=pN(s,p9),g=pN(s,"DOT");pN(m,p9,m),pS(m,e.domain,s),pS(g,r,o),pS(g,e.domain,s);let y=fA(fO);pS(g,e.tld,y),pS(g,e.utld,y),pS(y,e.domain,s),pS(y,r,o),pN(y,"DOT",g),pN(y,p9,m),pN(y,"AT",c);let x=pN(y,p3),b=fA(fO);pS(x,e.numeric,b);let v=fA(fO),k=fA();pS(v,t,v),pS(v,n,k),pS(k,t,v),pS(k,n,k),pN(y,fl,v),pN(b,fl,v);let w=pN(l,p3),S=pN(a,p3),C=pN(S,fl),M=pN(C,fl);pS(l,e.domain,s),pN(l,"DOT",g),pN(l,p9,m),pS(a,e.domain,s),pN(a,"DOT",g),pN(a,p9,m),pS(w,e.domain,v),pN(w,fl,v),pN(w,fr,v),pS(M,e.domain,v),pS(M,t,v),pN(M,fl,v);let N=[[pP,pz],[pL,p$],[pF,pB],[p_,pV],[pH,pU],[pq,pW],[pK,pJ],[pG,pQ]];for(let e=0;e<N.length;e++){let[r,i]=N[e],o=pN(v,r);pN(k,r,o),pN(o,i,v);let s=fA(fO);pS(o,t,s);let l=fA();pS(o,n),pS(s,t,s),pS(s,n,l),pS(l,t,s),pS(l,n,l),pN(s,i,v),pN(l,i,v)}return pN(i,pA,y),pN(i,"NL",fE),{start:i,tokens:fu}}(fR.scanner.tokens);for(let e=0;e<fR.pluginQueue.length;e++)fR.pluginQueue[e][1]({scanner:fR.scanner,parser:fR.parser});fR.initialized=!0}(),function(e,t,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let l=e,a=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(a=l.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,(l=c).accepts()?(h=0,u=l):h>=0&&h++,i++,d++;if(h<0)(i-=d)<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(fI(fj,t,s)),s=[]),i-=h,d-=h;let e=u.t,r=n.slice(i-d,i);o.push(fI(e,t,r))}}return s.length>0&&o.push(fI(fj,t,s)),o}(fR.parser.start,e,fb(fR.scanner.start,e))}function fL(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new fS(n),i=fz(e),o=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&o.push(n.toFormattedObject(r))}return o}fz.scan=fb;var f$="[\0-   ᠎ -\u2029  ]",fF=new RegExp(f$),fB=RegExp(`${f$}$`),f_=RegExp(f$,"g");function fV(e,t){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(f_,"").match(RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fH=u_.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(e=>{"string"==typeof e?fP(e):fP(e.scheme,e.optionalSlashes)})},onDestroy(){pw.groups={},fR.scanner=null,fR.parser=null,fR.tokenQueue=[],fR.pluginQueue=[],fR.customSchemes=[],fR.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!fV(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!fV(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!fV(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",d1(this.options.HTMLAttributes,e),0]:["a",d1(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,o;let s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",l=null!=(o=null==(i=e.attrs)?void 0:i.title)?o:"",a=t.renderChildren(e);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!fV(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!fV(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[hc({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=fL(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!fV(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,n;let r=[],{protocols:i,defaultProtocol:o}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!fV(e,i),protocols:i,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink},new sP({key:new s$("autolink"),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),o=t.some(e=>e.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r;if(ut(dW(n.doc,[...t])).forEach(({newRange:t})=>{var n,i;let o,l,a,c=(n=r.doc,i=e=>e.isTextblock,a=[],n.nodesBetween(t.from,t.to,(e,t)=>{i(e)&&a.push({node:e,pos:t})}),a);if(c.length>1)o=c[0],l=r.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(c.length){let e=r.doc.textBetween(t.from,t.to," "," ");if(!fB.test(e))return;o=c[0],l=r.doc.textBetween(o.pos,t.to,void 0," ")}if(o&&l){let t=l.split(fF).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],i=o.pos+l.lastIndexOf(n);if(!n)return!1;let a=fz(n).map(t=>t.toObject(e.defaultProtocol));if(!(1===a.length?a[0].isLink:3===a.length&&!!a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;a.filter(e=>e.isLink).map(e=>({...e,from:i+e.start+1,to:i+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{un(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||s.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),s.steps.length)return s}}))),r.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new sP({key:new s$("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(0!==r.button||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let e=r.target;if(!e)return!1;let n=t.editor.view.dom;(s=e.closest("a"))&&!n.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let n=ue(e.state,t.type.name),r=null!=(i=s.href)?i:n.href,a=null!=(o=s.target)?o:n.target;r&&(window.open(r,a),l=!0)}return l}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new sP({key:new s$("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(e=>{a+=e.textContent});let c=fL(a,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===a);return!!a&&!!c&&(void 0===i||!!i(c.value))&&n.editor.commands.setMark(n.type,{href:c.href})}}}))),r}}),fU=Object.defineProperty,fq="textStyle",fW=/^\s*([-+*])\s$/,fK=ha.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(fq)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=u9({find:fW,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=u9({find:fW,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(fq),editor:this.editor})),[e]}}),fJ=ha.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if("list_item"!==e.type)return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>"paragraph"===e.type))n=t.parseChildren(e.tokens);else{let r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){let r=e.tokens.slice(1),i=t.parseChildren(r);n.push(...i)}}else n=t.parseChildren(e.tokens)}return 0===n.length&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>hl(e,t,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let r=(null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1;return`${r+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),fG={},fQ={findListItemPos:()=>fY,getNextListDepth:()=>fZ,handleBackspace:()=>f3,handleDelete:()=>f6,hasListBefore:()=>f0,hasListItemAfter:()=>f8,hasListItemBefore:()=>f1,listItemHasSubList:()=>f2,nextListIsDeeper:()=>f5,nextListIsHigher:()=>f4};for(var fX in fQ)fU(fG,fX,{get:fQ[fX],enumerable:!0});var fY=(e,t)=>{let{$from:n}=t.selection,r=c1(e,t.schema),i=n.depth,o=n.pos,s=null;for(;i>0&&null===s;)n.node(i).type===r?s=i:(i-=1,o-=1);return null===s?null:{$pos:t.doc.resolve(o),depth:s}},fZ=(e,t)=>{let n=fY(e,t);if(!n)return!1;let[,r]=((e,t,n,r=20)=>{let i=e.doc.resolve(n),o=r,s=null;for(;o>0&&null===s;){let e=i.node(o);(null==e?void 0:e.type.name)===t?s=e:o-=1}return[s,o]})(t,e,n.$pos.pos+4);return r},f0=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),o=e.doc.resolve(i).node();return!!o&&!!n.includes(o.type.name)},f1=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return 0!==i.index()&&(null==(n=i.nodeBefore)?void 0:n.type.name)===e},f2=(e,t,n)=>{if(!n)return!1;let r=c1(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},f3=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!dj(e.state,t)&&f0(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let o=i.at(-1);if(!o)return!1;let s=e.state.doc.resolve(r.start()+o.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!dj(e.state,t)||!(e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos})(e.state))return!1;let r=fY(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=f2(t,e.state,i);return f1(t,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},f5=(e,t)=>{let n=fZ(e,t),r=fY(e,t);return!!r&&!!n&&n>r.depth},f4=(e,t)=>{let n=fZ(e,t),r=fY(e,t);return!!r&&!!n&&n<r.depth},f6=(e,t)=>{if(!dj(e.state,t)||!((e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=dK(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos})(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!(!n.empty&&r.sameParent(i))&&(f5(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():f4(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},f8=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(n=i.nodeAfter)?void 0:n.type.name)===e},f9=uq.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&f6(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&f6(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&f3(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&f3(e,n,r)&&(t=!0)}),t}}}}),f7=/^(\s*)(\d+)\.\s+(.*)$/,me=/^\s/,mt="textStyle",mn=/^(\d+)\.\s$/,mr=ha.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return 1===t?["ol",d1(this.options.HTMLAttributes,n),0]:["ol",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,i=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})):[];return 1!==r?{type:"orderedList",attrs:{start:r},content:i}:{type:"orderedList",content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;let i=e.split("\n"),[o,s]=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],o=i.match(f7);if(!o)break;let[,s,l,a]=o,c=s.length,d=a,u=n+1,h=[i];for(;u<e.length;){let t=e[u];if(t.match(f7))break;if(""===t.trim())h.push(t),d+="\n",u+=1;else if(t.match(me))h.push(t),d+=`
88
- ${t.slice(c+2)}`,u+=1;else break}t.push({indent:c,number:parseInt(l,10),content:d.trim(),raw:h.join("\n")}),r=u,n=u}return[t,r]}(i);if(0===o.length)return;let l=function e(t,n,r){var i;let o=[],s=0;for(;s<t.length;){let l=t[s];if(l.indent===n){let a=l.content.split("\n"),c=(null==(i=a[0])?void 0:i.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:r.inlineTokens(c)});let u=a.slice(1).join("\n").trim();if(u){let e=r.blockTokens(u);d.push(...e)}let h=s+1,p=[];for(;h<t.length&&t[h].indent>n;)p.push(t[h]),h+=1;if(p.length>0){let t=Math.min(...p.map(e=>e.indent)),n=e(p,t,r);d.push({type:"list",ordered:!0,start:p[0].number,items:n,raw:p.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:l.raw,tokens:d}),s=h}else s+=1}return o}(o,0,n);if(0!==l.length)return{type:"list",ordered:!0,start:(null==(r=o[0])?void 0:r.number)||1,items:l,raw:i.slice(0,s).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(mt)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=u9({find:mn,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=u9({find:mn,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(mt)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),mi=/^\s*(\[([( |x])?\])\s$/,mo=ha.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",d1(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.checked)?"x":" ";return hl(e,t,`- [${r}] `)},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=e=>{var t,n;l.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,l.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",e=>e.preventDefault()),l.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:i}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if("number"!=typeof t)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:i}),!0}).run(),r.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(l.checked=!l.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:i,contentDOM:a,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,c(e);let t=d2(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),o=this.options.HTMLAttributes;return d.forEach(e=>{n.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),d=n,!0}}}},addInputRules(){return[u9({find:mi,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),ms=ha.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",d1(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){let r=e=>{let t=hs(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},i=hs(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});uq.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(fK.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(fJ.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(f9.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(mr.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(mo.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(ms.configure(this.options.taskList)),e}});var ml="&nbsp;",ma=ha.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",d1(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===r.length&&"text"===r[0].type&&(r[0].text===ml||" "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t)=>{if(!e)return"";let n=Array.isArray(e.content)?e.content:[];return 0===n.length?ml:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),mc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,md=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,mu=u_.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",d1(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[u6({find:mc,type:this.type})]},addPasteRules(){return[hc({find:md,type:this.type})]}}),mh=ha.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),mp=u_.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",d1(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});class mf{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&t&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*a;i={left:r.left,right:r.right,top:o-s,bottom:o+s}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*l;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let c=this.editorView.dom.offsetParent;if(!this.element&&(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),c&&(c!=document.body||"static"!=getComputedStyle(c).position)){let n=c.getBoundingClientRect(),r=n.width/c.offsetWidth,i=n.height/c.offsetHeight;e=n.left-c.scrollLeft*r,t=n.top-c.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/l+"px",this.element.style.top=(i.top-t)/a+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=sr(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class mm extends sy{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return mm.valid(n)?new mm(n):sy.near(n)}content(){return i9.empty}eq(e){return e instanceof mm&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new mm(e.resolve(t.pos))}getBookmark(){return new mg(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||my(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||my(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&mm.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(mm.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!sS.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=o,r+=t;let s=e.doc.resolve(r);if(mm.valid(s))return s}return null}}}mm.prototype.visible=!1,mm.findFrom=mm.findGapCursorFrom,sy.jsonID("gapcursor",mm);class mg{constructor(e){this.pos=e}map(e){return new mg(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return mm.valid(t)?new mm(t):sy.near(t)}}function my(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let mx=cV({ArrowLeft:mb("horiz",-1),ArrowRight:mb("horiz",1),ArrowUp:mb("vert",-1),ArrowDown:mb("vert",1)});function mb(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,l=o.empty;if(o instanceof sk){if(!i.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=e.doc.resolve(t>0?s.after():s.before())}let a=mm.findGapCursorFrom(s,t,l);return!!a&&(r&&r(e.tr.setSelection(new mm(a))),!0)}}function mv(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!mm.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&sS.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new mm(r))),!0)}function mk(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof mm))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=i2.empty;for(let e=r.length-1;e>=0;e--)i=i2.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new i9(i,0,0));return o.setSelection(sk.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function mw(e){if(!(e.selection instanceof mm))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ci.create(e.doc,[ct.widget(e.selection.head,t,{key:"gapcursor"})])}var mS=function(){};mS.prototype.append=function(e){return e.length?(e=mS.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},mS.prototype.prepend=function(e){return e.length?mS.from(e).append(this):this},mS.prototype.appendInner=function(e){return new mM(this,e)},mS.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?mS.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},mS.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},mS.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},mS.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},mS.from=function(e){return e instanceof mS?e:e&&e.length?new mC(e):mS.empty};var mC=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(mS);mS.empty=new mC([]);var mM=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(mS);class mN{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(r=(n=this.remapping(s,this.items.length)).maps.length);let l=e.tr,a=[],c=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(s,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new mT(e.map));let t=e.step.map(n.slice(r)),i;t&&l.maybeStep(t).doc&&(i=l.mapping.maps[l.mapping.maps.length-1],a.push(new mT(i,void 0,void 0,a.length+c.length))),r--,i&&n.appendMap(i,r)}else l.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new mN(this.items.slice(0,s).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:l,selection:i}}addTransform(e,t,n,r){var i,o;let s,l=[],a=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new mT(e.mapping.maps[n],i,t),s;(s=d&&d.merge(o))&&(o=s,n?l.pop():c=c.slice(0,c.length-1)),l.push(o),t&&(a++,t=void 0),r||(d=o)}let u=a-n.depth;return u>mE&&(i=c,o=u,i.forEach((e,t)=>{if(e.selection&&0==o--)return s=t,!1}),c=i.slice(s),a-=u),new mN(c.append(l),a)}remapping(e,t){let n=new oq;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new mN(this.items.append(e.map(e=>new mT(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let l=t;this.items.forEach(t=>{let r=i.getMirror(--l);if(null==r)return;o=Math.min(o,r);let a=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(l+1,r));c&&s++,n.push(new mT(a,o,c))}else n.push(new mT(a))},r);let a=[];for(let e=t;e<o;e++)a.push(new mT(i.maps[e]));let c=new mN(this.items.slice(0,r).append(a).append(n),s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=o.selection&&o.selection.map(t.slice(n));l&&i++;let a=new mT(s.invert(),e,l),c,d=r.length-1;(c=r.length&&r[d].merge(a))?r[d]=c:r.push(a)}}else o.map&&n--},this.items.length,0),new mN(mS.from(r.reverse()),i)}}mN.empty=new mN(mS.empty,0);class mT{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new mT(t.getMap().invert(),t,this.selection)}}}class mj{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let mE=20;function mO(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function mA(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let mI=!1,mD=null;function mR(e){let t=e.plugins;if(mD!=t){mI=!1,mD=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){mI=!0;break}}return mI}let mP=new s$("history"),mz=new s$("closeHistory");function mL(e,t){return(n,r)=>{let i=mP.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=mR(t),i=mP.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),a=new mj(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(mP,{redo:n,historyState:a})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let m$=mL(!1,!0),mF=mL(!0,!0);mL(!1,!1),mL(!0,!1),uq.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new sP({key:new s$("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(null==i||0===i){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,o-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos;return e.deleteRange(o-(i-n),o),!(this.storage.characters({node:e.doc})>n)}})]}});var mB=uq.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new sP({view:t=>new mf(t,e)})}(this.options)]}});uq.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new sP({key:new s$("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,o=[];if(!n||!r)return ci.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;s+=1}});let l=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((l+=1,"deepest"===this.options.mode&&s-l>0||"shallowest"===this.options.mode&&l>1)?"deepest"===this.options.mode:void o.push(ct.node(t,t+e.nodeSize,{class:this.options.className})))),ci.create(e,o)}}})]}});var m_=uq.create({name:"gapCursor",addProseMirrorPlugins:()=>[new sP({props:{decorations:mw,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&mm.valid(n)?new mm(n):null,handleClick:mv,handleKeyDown:mx,handleDOMEvents:{beforeinput:mk}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=dY(dJ(e,"allowGapCursor",n)))?t:null}}}),mV="placeholder",mH=uq.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:mV,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${this.options.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${mV}`;return[new sP({key:new s$("placeholder"),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,o=[];if(!r)return null;let s=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,l=!t.isLeaf&&ua(t);if((r||!this.options.showOnlyCurrent)&&l){let i=[this.options.emptyNodeClass];s&&i.push(this.options.emptyEditorClass);let l=ct.node(n,n+t.nodeSize,{class:i.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});o.push(l)}return this.options.includeChildren}),ci.create(t,o)}}})]}});function mU({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}uq.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new sP({key:new s$("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||uc(n.selection)||e.view.dragging?null:ci.create(n.doc,[ct.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var mq=uq.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new s$(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new sP({key:t,appendTransaction:(e,r,i)=>{let{doc:o,tr:s,schema:l}=i,a=t.getState(i),c=o.content.size,d=l.nodes[n];if(a)return s.insert(c,d.create())},state:{init:(e,t)=>!mU({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!mU({node:e.doc.lastChild,types:r})}})]}}),mW=uq.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>m$(e,t),redo:()=>({state:e,dispatch:t})=>mF(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new sP({key:mP,state:{init:()=>new mj(mN.empty,mN.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(mP),o;if(i)return i.historyState;n.getMeta(mz)&&(e=new mj(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(mP))if(s.getMeta(mP).redo)return new mj(e.done.addTransform(n,void 0,r,mR(t)),e.undone,mO(n.mapping.maps),e.prevTime,e.prevComposition);else return new mj(e.done,e.undone.addTransform(n,void 0,r,mR(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new mj(e.done.rebased(n,o),e.undone.rebased(n,o),mA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new mj(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),mA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=s?mA(e.prevRanges,n.mapping):mO(n.mapping.maps);return new mj(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,mR(t)),mN.empty,l,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?m$:"historyRedo"==n?mF:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(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()}}}),mK=uq.create({name:"starterKit",addExtensions(){var e,t,n,r;let i=[];return!1!==this.options.bold&&i.push(h8.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(h2.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(fK.configure(this.options.bulletList)),!1!==this.options.code&&i.push(pe.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(pr.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(pi.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(mB.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(m_.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(po.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(ps.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(mW.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(pl.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(ph.configure(this.options.italic)),!1!==this.options.listItem&&i.push(fJ.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(f9.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(fH.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(mr.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(ma.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(mu.configure(this.options.strike)),!1!==this.options.text&&i.push(mh.configure(this.options.text)),!1!==this.options.underline&&i.push(mp.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&i.push(mq.configure(null==(r=this.options)?void 0:r.trailingNode)),i}});let mJ=/^[A-Za-z0-9_\-:]*$/,mG={id:"all",name:"All",provider:"claude",model:null,color:"#6B7280"},mQ=/^[a-zA-Z0-9_-]*$/,mX=new Set(["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","application/pdf","text/plain","text/csv","text/markdown","application/json","application/zip","application/gzip","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"]),mY=new Set([".exe",".bat",".cmd",".com",".msi",".scr",".pif",".vbs",".vbe",".js",".jse",".ws",".wsf",".wsc",".wsh",".ps1",".ps2",".psc1",".psc2",".reg",".inf",".lnk",".dll",".sys",".drv"]),mZ=[{path:`${iS.default.env.HOME??"~"}/Code`,relativePath:"~/Code",type:"folder"},{path:`${iS.default.env.HOME??"~"}/Projects`,relativePath:"~/Projects",type:"folder"},{path:`${iS.default.env.HOME??"~"}/Desktop`,relativePath:"~/Desktop",type:"folder"},{path:`${iS.default.env.HOME??"~"}/Documents`,relativePath:"~/Documents",type:"folder"},{path:`${iS.default.env.HOME??"~"}/Downloads`,relativePath:"~/Downloads",type:"folder"}];function m0(e,t){let n=function(e,t){let n=e.trim().replace(/\/+$/,"");if("~"===n)return"~";if(n.startsWith("~/")||n.startsWith("/"))return n;let r=n.replace(/^\/+/,"");return"@~"===t?`~/${r}`:`/${r}`}(e,t.trigger);if(n.startsWith("~/")||n.startsWith("/")){let r=e.trim().startsWith("~/")||e.trim().startsWith("/")||"~"===e.trim()?null:function(e){if(!e.query.endsWith("/"))return null;let t=e.query.replace(/^\/+/,"").replace(/\/+$/,"");return"@~"===e.trigger?t?`~/${t}`:"~":t?`/${t}`:"/"}(t);if(r){let e=n.replace(/^~\/|^\//,"");return"~"===r?`~/${e}`:"/"===r?`/${e}`:`${r}/${e}`}}return n}async function m1(e){let t;if(0===e.length)return[];let n=e.map(e=>e.path);try{let r=await fetch("/api/file-read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:n})});if(!r.ok){let t=(await r.json().catch(()=>({}))).error??`HTTP ${r.status}`;return e.map(e=>({type:"file",path:e.path,label:e.label,content:null,error:t}))}t=(await r.json()).results}catch(n){let t=n instanceof Error?n.message:"Failed to fetch file contents";return e.map(e=>({type:"file",path:e.path,label:e.label,content:null,error:t}))}let r=new Map(t.map(e=>[e.path,e]));return e.map(e=>{let t=r.get(e.path);return{type:"file",path:e.path,label:e.label,content:t?.content??null,error:t?.error}})}async function m2(e){let t=await m1(e),n=0===t.length?"":t.map(e=>e.error||null===e.content?`<file path="${e.path}" error="${e.error??"unreadable"}" />`:`<file path="${e.path}">
89
- ${e.content}
90
- </file>`).join("\n\n")+"\n\n";return{fileContextBlocks:t,contextPrefix:n}}let m3=ha.create({name:"participantMention",group:"inline",inline:!0,atom:!0,addAttributes:()=>({id:{default:null},name:{default:""},mode:{default:"sequential"}}),parseHTML:()=>[{tag:"span[data-participant-mention]"}],renderHTML({node:e,HTMLAttributes:t}){let n="parallel"===e.attrs.mode;return["span",d1(t,{"data-participant-mention":"","data-id":e.attrs.id,"data-mode":e.attrs.mode,class:n?"composer-pill composer-pill--participant-parallel":"composer-pill composer-pill--participant",contenteditable:"false"}),`${n?"@@":"@"}${e.attrs.name}`]}}),m5=ha.create({name:"fileMention",group:"inline",inline:!0,atom:!0,addAttributes:()=>({path:{default:""},relativePath:{default:""},trigger:{default:"@/"},attachMode:{default:void 0}}),parseHTML:()=>[{tag:"span[data-file-mention]"}],renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.relativePath||e.attrs.path;return["span",d1(t,{"data-file-mention":"","data-path":e.attrs.path,class:"composer-pill composer-pill--file",contenteditable:"false"}),`@${n}`]}}),m4=ha.create({name:"threadMention",group:"inline",inline:!0,atom:!0,addAttributes:()=>({threadId:{default:""},title:{default:""}}),parseHTML:()=>[{tag:"span[data-thread-mention]"}],renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.title.length>40?e.attrs.title.slice(0,37)+"...":e.attrs.title;return["span",d1(t,{"data-thread-mention":"","data-thread-id":e.attrs.threadId,class:"composer-pill composer-pill--thread",contenteditable:"false"}),`#${n}`]}});function m6(e){let{state:t}=e,{$from:n}=t.selection,r=n.depth,i=-1;for(let e=r;e>=0;e--)if("paragraph"===n.node(e).type.name){i=e;break}if(-1===i)return null;let o=n.node(i),s=n.start(i),l=n.pos-s,a="",c=0,d=!1;return o.forEach((e,t)=>{let n=t+e.nodeSize;if(e.isText){let r=e.text??"";!d&&l>=t&&l<=n&&(c=a.length+(l-t),d=!0),a+=r}else if(e.isAtom){let r=m8(e);!d&&l>=t&&l<=n&&(c=a.length+r.length,d=!0),a+=r}}),d||(c=a.length),{text:a,cursorPos:c,blockStart:s}}function m8(e){switch(e.type.name){case"participantMention":{let t="parallel"===e.attrs.mode?"@@":"@";return`${t}${e.attrs.name}`}case"fileMention":{let t=e.attrs.relativePath||e.attrs.path;return`@${t}`}case"threadMention":{let t=(e.attrs.threadId??"").slice(0,8);return`@#${t}`}default:return""}}function m9(e,t,n,r){let{state:i}=e,o=i.doc.resolve(t),s=o.depth,l=null,a=t;for(let e=s;e>=0;e--){let t=o.node(e);if("paragraph"===t.type.name){l=t,a=o.start(e);break}}l||(l=i.doc.resolve(t).parent,a=t);let c=0,d=null,u=null;return(l.forEach((e,t)=>{let i=a+t,o=e.nodeSize;if(e.isText){let t=e.text??"",o=c+t.length;null===d&&n>=c&&n<=o&&(d=i+(n-c)),null===u&&r>=c&&r<=o&&(u=i+(r-c)),c=o}else if(e.isAtom){let t=m8(e),s=c+t.length;null===d&&n>=c&&n<=s&&(d=i),null===u&&r>=c&&r<=s&&(u=i+o),c=s}}),null===d&&n>=c&&(d=a+l.content.size),null===u&&r>=c&&(u=a+l.content.size),null===d||null===u)?null:{from:d,to:u}}function m7({isOpen:e,suggestions:r,activeIndex:i,listboxId:o,optionIdPrefix:s,onSelect:l}){let a=(0,n.useRef)([]);return((0,n.useEffect)(()=>{e&&a.current[i]?.scrollIntoView({block:"nearest"})},[i,e]),e&&0!==r.length)?(0,t.jsx)("div",{className:"absolute left-0 right-0 bottom-full mb-3 z-20",children:(0,t.jsx)("div",{role:"listbox",id:o,"aria-label":"Mention suggestions",className:"max-h-56 overflow-y-auto rounded-xl border border-zinc-200 bg-white shadow-lg",children:r.map((e,n)=>{let r=n===i;return(0,t.jsx)("button",{type:"button",role:"option",id:`${s}-${e.id}`,"aria-selected":r,ref:e=>{a.current[n]=e},className:`w-full px-3 py-2 text-left text-sm transition-colors ${r?"bg-blue-50 text-zinc-900":"text-zinc-700 hover:bg-zinc-50"}`,onMouseDown:e=>{e.preventDefault()},onClick:()=>l(e),children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:e.color},"aria-hidden":!0}),(0,t.jsx)("span",{className:"font-medium",children:e.name}),"all"===e.id?(0,t.jsx)("span",{className:"text-xs text-zinc-400",children:"All participants"}):e.model&&(0,t.jsx)("span",{className:"text-xs text-zinc-400",children:e.model})]})},e.id)})})}):null}function ge({isOpen:e,commands:r,activeIndex:i,listboxId:o,optionIdPrefix:s,onSelect:l}){let a=(0,n.useRef)([]);return((0,n.useEffect)(()=>{e&&a.current[i]?.scrollIntoView({block:"nearest"})},[i,e]),e&&0!==r.length)?(0,t.jsx)("div",{className:"absolute left-0 right-0 bottom-full mb-3 z-20",children:(0,t.jsx)("div",{role:"listbox",id:o,"aria-label":"Command suggestions",className:"max-h-56 overflow-y-auto rounded-xl border border-zinc-200 bg-white shadow-lg",children:r.map((e,n)=>{let r=n===i;return(0,t.jsx)("button",{type:"button",role:"option",id:`${s}-${e.name.slice(1)}`,"aria-selected":r,ref:e=>{a.current[n]=e},className:`w-full px-3 py-2 text-left text-sm transition-colors ${r?"bg-blue-50 text-zinc-900":"text-zinc-700 hover:bg-zinc-50"}`,onMouseDown:e=>e.preventDefault(),onClick:()=>l(e),children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium font-mono",children:e.name}),e.aliases&&e.aliases.length>0&&(0,t.jsxs)("span",{className:"text-xs text-zinc-300 font-mono",children:["(",e.aliases.join(", "),")"]}),(0,t.jsx)("span",{className:"text-xs text-zinc-400",children:e.description})]})},e.name)})})}):null}var gt=e.i(32857);let gn=(0,a.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),gr=(0,a.default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);function gi({suggestion:e,isActive:n,optionId:r,onSelect:i,onAttachContents:o,itemRef:s}){let l="folder"===e.type,a="contents"===e.attachMode,c=function(e){if(!e)return null;let t=Math.floor((Date.now()-e)/864e5);return 0===t?"Today":1===t?"Yesterday":t<7?`${t}d ago`:t<30?`${Math.floor(t/7)}w ago`:t<365?`${Math.floor(t/30)}mo ago`:`${Math.floor(t/365)}y ago`}(e.modifiedAt),d=e.relativePath??e.path;return(0,t.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors ${n?"bg-blue-50":"hover:bg-zinc-50"}`,children:[(0,t.jsx)("span",{className:"shrink-0 text-zinc-400","aria-hidden":!0,children:l?n?(0,t.jsx)(iO,{className:"h-4 w-4 text-amber-500"}):(0,t.jsx)(gr,{className:"h-4 w-4 text-amber-400"}):(0,t.jsx)(gn,{className:"h-4 w-4"})}),(0,t.jsxs)("button",{type:"button",role:"option",id:r,"aria-selected":n,ref:s,className:"min-w-0 flex-1 text-left",onMouseDown:e=>e.preventDefault(),onClick:()=>i(e),tabIndex:-1,children:[(0,t.jsxs)("span",{className:"flex items-baseline gap-2",children:[(0,t.jsx)("span",{className:`block truncate font-mono text-xs ${n?"text-zinc-900":"text-zinc-700"}`,children:d}),c&&(0,t.jsx)("span",{className:"shrink-0 text-xs text-zinc-400",children:c})]}),l&&e.manifest&&(0,t.jsxs)("span",{className:"block text-xs text-zinc-400",children:[e.manifest.childCount," items ·"," ",e.manifest.sizeSummary,a?(0,t.jsx)("span",{className:"ml-1 font-medium text-blue-500",children:"full tree"}):(0,t.jsx)("span",{className:"ml-1 text-zinc-400",children:"manifest"})]})]}),l&&!a&&(0,t.jsx)("button",{type:"button",className:"shrink-0 rounded px-1.5 py-0.5 text-xs text-zinc-400 hover:bg-zinc-100 hover:text-zinc-700 transition-colors",title:"Attach full directory contents instead of manifest","aria-label":`Attach full contents of ${d}`,onMouseDown:e=>e.preventDefault(),onClick:()=>o(e),tabIndex:-1,children:"Attach contents"}),l&&a&&(0,t.jsx)("span",{className:"shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-xs font-medium text-blue-600",children:"full tree"})]})}var go=e.i(26410);function gs({isOpen:e,suggestions:r,activeIndex:i,isLoading:o,error:s,listboxId:l,optionIdPrefix:a,onSelect:c,onAttachContents:d}){let u=(0,n.useRef)([]),h=(0,n.useRef)(null),[p,f]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{e&&u.current[i]?.scrollIntoView({block:"nearest"})},[i,e]),(0,n.useEffect)(()=>{e&&h.current&&f(h.current.getBoundingClientRect().top<280)},[e]),!e)return null;let m=r.length>0?`${a}-${i}`:void 0;return(0,t.jsx)("div",{ref:h,className:`${p?"absolute left-0 right-0 top-full mt-2 z-20":"absolute left-0 right-0 bottom-full mb-3 z-20"} ${go.default.popover}`,children:(0,t.jsxs)("div",{role:"listbox",id:l,"aria-label":"File suggestions","aria-activedescendant":m,className:"max-h-64 overflow-y-auto rounded-xl border border-zinc-200 bg-white shadow-lg",children:[s&&!o&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-red-500",role:"alert",children:[(0,t.jsx)(gt.AlertCircle,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,t.jsx)("span",{children:s})]}),!s&&o&&0===r.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-zinc-400","aria-live":"polite","aria-label":"Searching for files",children:[(0,t.jsx)(im,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,t.jsx)("span",{children:"Searching…"})]}),!s&&!o&&0===r.length&&(0,t.jsx)("div",{className:"px-3 py-3 text-sm text-zinc-400","aria-live":"polite",children:"No results"}),!s&&o&&r.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1 text-xs text-zinc-400 border-b border-zinc-100",children:[(0,t.jsx)(im,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),(0,t.jsx)("span",{"aria-live":"polite","aria-label":"Updating results",children:"Updating…"})]}),r.length>0&&r.map((e,n)=>(0,t.jsx)(gi,{suggestion:e,isActive:n===i,optionId:`${a}-${n}`,onSelect:c,onAttachContents:d,itemRef:e=>{u.current[n]=e}},e.path))]})})}function gl({isOpen:e,suggestions:n,activeIndex:r,listboxId:i,optionIdPrefix:o,onSelect:s}){return e&&0!==n.length?(0,t.jsxs)("div",{className:"absolute bottom-full left-0 mb-2 w-80 bg-white rounded-xl shadow-xl border border-slate-200 overflow-hidden z-50 animate-in fade-in zoom-in-95 duration-100",role:"listbox",id:i,children:[(0,t.jsx)("div",{className:"px-3 py-2 bg-slate-50 border-b border-slate-100 text-[11px] font-bold text-slate-500 uppercase tracking-wider",children:"Reference Discussion"}),(0,t.jsx)("div",{className:"max-h-64 overflow-y-auto p-1",children:n.map((e,n)=>{let i=n===r;return(0,t.jsxs)("button",{role:"option",id:`${o}-${n}`,"aria-selected":i,onClick:()=>s(e),className:`w-full text-left px-3 py-2.5 rounded-lg flex items-start gap-3 transition-colors ${i?"bg-indigo-50":"hover:bg-slate-50"}`,children:[(0,t.jsx)("div",{className:`mt-0.5 p-1.5 rounded-md ${i?"bg-indigo-100 text-indigo-600":"bg-slate-100 text-slate-500"}`,children:(0,t.jsx)(ip,{size:14,strokeWidth:2.5})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:`text-sm font-semibold truncate ${i?"text-indigo-900":"text-slate-900"}`,children:e.title}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,t.jsxs)("span",{className:`text-xs ${i?"text-indigo-600":"text-slate-500"}`,children:[e.replies.length," replies"]}),(0,t.jsx)("span",{className:"text-slate-300",children:"•"}),(0,t.jsxs)("span",{className:"text-[10px] text-slate-400 flex items-center gap-1",children:[(0,t.jsx)(iV.Clock,{size:10}),function(e){if(!e)return"";let t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h`:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e)}(e.lastActivityAt)]})]})]})]},e.rootMessageId)})})]}):null}var ga=e.i(24429);let gc=(0,a.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);function gd({attachments:e,onRemove:n,onRetry:r}){return 0===e.length?null:(0,t.jsx)("div",{className:"flex flex-wrap gap-2 px-1 pb-2",children:e.map(e=>{var i;let o=e.mimeType.startsWith("image/"),s="failed"===e.status,l="uploading"===e.status;return(0,t.jsxs)("div",{className:`relative group flex items-center gap-2 rounded-lg border px-2.5 py-1.5 text-xs transition-all ${s?"border-red-200 bg-red-50 text-red-700":"border-slate-200 bg-slate-50 text-slate-600"}`,children:[o&&e.previewUrl?(0,t.jsx)("img",{src:e.previewUrl,alt:e.filename,className:"w-8 h-8 rounded object-cover shrink-0"}):(0,t.jsx)("div",{className:"w-8 h-8 rounded bg-slate-100 flex items-center justify-center shrink-0",children:o?(0,t.jsx)(gc,{className:"w-4 h-4 text-slate-400"}):(0,t.jsx)(k,{className:"w-4 h-4 text-slate-400"})}),(0,t.jsxs)("div",{className:"min-w-0 max-w-[120px]",children:[(0,t.jsx)("div",{className:"truncate font-medium",children:e.filename}),s&&e.error?(0,t.jsx)("div",{className:"truncate text-[10px] text-red-500",children:e.error}):(0,t.jsx)("div",{className:"text-[10px] text-slate-400",children:(i=e.size)<1024?`${i}B`:i<1048576?`${(i/1024).toFixed(0)}KB`:`${(i/1048576).toFixed(1)}MB`})]}),l&&(0,t.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-slate-200 rounded-b-lg overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${e.progress}%`}})}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[s&&(0,t.jsx)("button",{type:"button",onClick:()=>r(e.id),className:"p-0.5 rounded hover:bg-red-100 transition-colors",title:"Retry upload",children:(0,t.jsx)(ga.RefreshCw,{className:"w-3 h-3"})}),(0,t.jsx)("button",{type:"button",onClick:()=>n(e.id),className:"p-0.5 rounded hover:bg-slate-200 transition-colors",title:"Remove",children:(0,t.jsx)(m,{className:"w-3 h-3"})})]})]},e.id)})})}function gu({onDrop:e,children:r}){let[i,o]=(0,n.useState)(!1),s={current:0},l=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),s.current++,e.dataTransfer.types.includes("Files")&&o(!0)},[]),a=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),c=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),s.current--,0===s.current&&o(!1)},[]),d=(0,n.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),s.current=0,o(!1),t.dataTransfer.files.length>0&&e(t.dataTransfer.files)},[e]);return(0,t.jsxs)("div",{className:"relative",onDragEnter:l,onDragOver:a,onDragLeave:c,onDrop:d,children:[r,i&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg border-2 border-dashed border-blue-400 bg-blue-50/80 pointer-events-none",children:(0,t.jsx)("span",{className:"text-sm font-medium text-blue-600",children:"Drop files to attach"})})]})}let gh=(0,a.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);function gp(e,t,n,r,i){if(!e)return;let o=m9(e,t,n,r);o&&e.chain().focus().deleteRange(o).insertContent(i).insertContent(" ").run()}function gf({onSend:e,onStop:r,loading:i,participants:o,messages:s=[],commands:l,placeholder:a="Message — @name to mention, /search, /summarize",workspaceRoots:c=[],onConfigureRoots:d,pendingThreadInsert:u,onClearPendingThread:h}){let[p,f]=(0,n.useState)(10),m=(0,n.useRef)(null),g=(0,n.useRef)(!1),y=(0,n.useCallback)(()=>{m.current?.click()},[]),[x,b]=(0,n.useState)([]),v=function({participants:e,maxSuggestions:t=6}){let[r,i]=(0,n.useState)(null),[o,s]=(0,n.useState)(0),[l,a]=(0,n.useState)(!1),c=null!==r&&!l,d=r?.query??"",u=(0,n.useMemo)(()=>{let n;return n=d.toLowerCase(),[mG,...e].map(e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return n?t.startsWith(n)?{item:e,score:3,name:t}:r.startsWith(n)?{item:e,score:2,name:t}:t.includes(n)?{item:e,score:1,name:t}:null:{item:e,score:0,name:t}}).filter(e=>null!==e).sort((e,t)=>e.score!==t.score?t.score-e.score:e.name.localeCompare(t.name)).slice(0,t).map(e=>e.item)},[e,d,t]),h=(0,n.useCallback)((e,t)=>{let n=function(e,t){if(t<0||t>e.length)return null;let n=t;for(;n>0&&!/\s/.test(e[n-1]);)n--;let r=e.slice(n,t);if(!r.startsWith("@")||r.startsWith("@@@")||r.startsWith("@#"))return null;let i=r.startsWith("@@"),o=r.slice(i?2:1);return mJ.test(o)?{startIndex:n,endIndex:t,query:o.toLowerCase(),mode:i?"parallel":"sequential",isParallel:i}:null}(e,t);i(e=>((e?.startIndex!==n?.startIndex||e?.isParallel!==n?.isParallel||e?.query!==n?.query)&&s(0),n))},[]),p=(0,n.useCallback)((e,t)=>{l||h(e,t)},[l,h]),f=(0,n.useCallback)(e=>{if(!c||0===u.length)return!1;switch(e.key){case"ArrowDown":return e.preventDefault(),s(e=>e<u.length-1?e+1:0),!0;case"ArrowUp":return e.preventDefault(),s(e=>e>0?e-1:u.length-1),!0;case"Enter":case"Tab":return e.preventDefault(),!0;case"Escape":return e.preventDefault(),i(null),!0;default:return!1}},[c,u.length]),m=(0,n.useCallback)(e=>{if(!r)return null;let t=r.isParallel?"@@":"@";return{text:`${t}${e.name} `,startIndex:r.startIndex,endIndex:r.endIndex}},[r]),g=(0,n.useCallback)(()=>{i(null),s(0)},[]);return{isOpen:c,query:d,filteredSuggestions:u,activeIndex:o,token:r,isComposing:l,handleInput:p,handleKeyDown:f,selectSuggestion:m,close:g,startComposition:(0,n.useCallback)(()=>{a(!0)},[]),endComposition:(0,n.useCallback)((e,t)=>{a(!1),h(e,t)},[h])}}({participants:o,maxSuggestions:6}),k=function({commands:e,maxSuggestions:t=6}){let[r,i]=(0,n.useState)(null),[o,s]=(0,n.useState)(0),l=null!==r,a=r?.query??"",c=(0,n.useMemo)(()=>{let n;return(n=a.toLowerCase())?e.filter(e=>!!e.name.slice(1).toLowerCase().startsWith(n)||(e.aliases?.some(e=>e.toLowerCase().startsWith(n))??!1)).slice(0,t):e.slice(0,t)},[e,a,t]),d=(0,n.useCallback)((e,t)=>{let n=function(e,t){if(t<0||t>e.length||!e.startsWith("/"))return null;let n=e.slice(0,t);if(/\s/.test(n))return null;let r=n.slice(1);return mQ.test(r)?{startIndex:0,endIndex:t,query:r.toLowerCase()}:null}(e,t);i(e=>(e?.query!==n?.query&&s(0),n))},[]),u=(0,n.useCallback)(e=>{if(!l||0===c.length)return!1;switch(e.key){case"ArrowDown":return e.preventDefault(),s(e=>e<c.length-1?e+1:0),!0;case"ArrowUp":return e.preventDefault(),s(e=>e>0?e-1:c.length-1),!0;case"Enter":case"Tab":return e.preventDefault(),!0;case"Escape":return e.preventDefault(),i(null),!0;default:return!1}},[l,c.length]),h=(0,n.useCallback)(e=>!!r&&(e.execute(),i(null),s(0),!0),[r]);return{isOpen:l,query:a,filteredCommands:c,activeIndex:o,token:r,handleInput:d,handleKeyDown:u,selectCommand:h,close:(0,n.useCallback)(()=>{i(null),s(0)},[])}}({commands:l,maxSuggestions:6}),w=function({maxSuggestions:e=8,debounceMs:t=150}={}){let[r,i]=(0,n.useState)(null),[o,s]=(0,n.useState)([]),[l,a]=(0,n.useState)(0),[c,d]=(0,n.useState)(!1),[u,h]=(0,n.useState)(null),p=(0,n.useRef)(null),f=(0,n.useRef)(null),m=(0,n.useRef)(null),g=null!==r,y=(0,n.useCallback)(async(t,n)=>{p.current&&p.current.abort();let r=new AbortController;p.current=r,d(!0),h(null);try{let i=t.endsWith("/"),o=i?"*":t,l=new URLSearchParams({q:o,limit:String(e),includeFolders:"1"});if(i){let e="@~"===n?`${iS.default.env.HOME??"~"}/${t.slice(0,-1)}`:`/${t.slice(0,-1)}`;l.set("root",e)}else"@~"===n&&l.set("root",iS.default.env.HOME??"~");let c=await fetch(`/api/file-search?${l.toString()}`,{signal:r.signal});if(!c.ok){let e=await c.json().catch(()=>({}));throw Error(e.error??`HTTP ${c.status}`)}let d=await c.json();s(d.files.map(e=>({...e,attachMode:"folder"===e.type?"manifest":void 0}))),a(0)}catch(e){if("AbortError"===e.name)return;h(e.message??"Search failed"),s([])}finally{d(!1)}},[e]),x=(0,n.useCallback)((n,r)=>{if(null!==f.current&&clearTimeout(f.current),n!==m.current){if(n.length<3){p.current&&(p.current.abort(),p.current=null),m.current=n,d(!1),h(null),s(mZ.slice(0,e).map(e=>({...e,attachMode:"manifest"}))),a(0);return}f.current=setTimeout(()=>{m.current=n,y(n,r)},t)}},[t,y,e]);(0,n.useEffect)(()=>()=>{null!==f.current&&clearTimeout(f.current),p.current&&p.current.abort()},[]);let b=(0,n.useCallback)((e,t)=>{let n=function(e,t){if(t<2||t>e.length)return null;let n=t;for(;n>0&&!/\s/.test(e[n-1]);)n--;let r=e.slice(n,t);if(!r.startsWith("@/")&&!r.startsWith("@~"))return null;let i=r.slice(0,2);return{startIndex:n,endIndex:t,query:r.slice(2),trigger:i}}(e,t);i(e=>((e?.startIndex!==n?.startIndex||e?.query!==n?.query||e?.trigger!==n?.trigger)&&null===n&&(null!==f.current&&clearTimeout(f.current),p.current&&(p.current.abort(),p.current=null),m.current=null,s([]),d(!1),h(null)),n)),n&&x(n.query,n.trigger)},[x]),v=(0,n.useCallback)(e=>{if(!g||0===o.length)return!1;switch(e.key){case"ArrowDown":return e.preventDefault(),a(e=>e<o.length-1?e+1:0),!0;case"ArrowUp":return e.preventDefault(),a(e=>e>0?e-1:o.length-1),!0;case"Enter":return e.preventDefault(),!0;case"Tab":return!0;case"Escape":return e.preventDefault(),i(null),s([]),!0;default:return!1}},[g,o.length]),k=(0,n.useCallback)(e=>{if(!r)return null;let t=m0(e.relativePath??e.path,r),n="folder"===e.type?"/":"",o=`@${t}${n} `;return i(null),s([]),{text:o,startIndex:r.startIndex,endIndex:r.endIndex}},[r]),w=(0,n.useCallback)(e=>{if(!r||"folder"!==e.type)return null;let t=m0(e.relativePath??e.path,r),n=t.startsWith("~/")?"@~":"@/",o=t.slice(1),s=`@${t}/`,l=r.startIndex+s.length,a=`${o}/`;return i({startIndex:r.startIndex,endIndex:l,query:a,trigger:n}),m.current=null,x(a,n),{text:s,startIndex:r.startIndex,endIndex:r.endIndex}},[r,x]),S=(0,n.useCallback)(e=>{s(t=>t.map(t=>t.path===e.path?{...t,attachMode:"contents"}:t))},[]);return{isOpen:g,token:r,suggestions:o,activeIndex:l,isLoading:c,error:u,handleInput:b,handleKeyDown:v,selectSuggestion:k,drillDown:w,close:(0,n.useCallback)(()=>{i(null),s([]),a(0)},[]),onAttachContents:S}}({maxSuggestions:8}),S=function({messages:e,maxSuggestions:t=5}){let[r,i]=(0,n.useState)(!1),[o,s]=(0,n.useState)(""),[l,a]=(0,n.useState)(0),[c,d]=(0,n.useState)([]),[u,h]=(0,n.useState)(null),p=(0,n.useRef)([]);(0,n.useEffect)(()=>{let t=e.filter(e=>!e.rootMessageId),n=new Map;e.forEach(e=>{if(e.rootMessageId){let t=n.get(e.rootMessageId)||[];t.push(e),n.set(e.rootMessageId,t)}}),p.current=t.map(e=>{let t=n.get(e.id)||[],r=[e,...t],i=Math.max(...r.map(e=>e.timestamp)),o=e.content.slice(0,60).replace(/\n/g," ").trim()||"Untitled",s=[...new Set(r.map(e=>e.participantId||"user"))];return{rootMessageId:e.id,title:o,rootMessage:e,replies:t,participantIds:s,lastActivityAt:i}}).sort((e,t)=>t.lastActivityAt-e.lastActivityAt)},[e]);let f=(0,n.useCallback)((e,n)=>{let r=e.slice(0,n).match(/@#([^@#\s]*)$/);if(r){i(!0);let e=r[1].toLowerCase();s(e),h(r.index),a(0),d(p.current.filter(t=>t.title.toLowerCase().includes(e)).slice(0,t))}else i(!1),h(null)},[t]),m=(0,n.useCallback)(e=>!!r&&0!==c.length&&("ArrowDown"===e.key?(e.preventDefault(),a(e=>(e+1)%c.length),!0):"ArrowUp"===e.key?(e.preventDefault(),a(e=>(e-1+c.length)%c.length),!0):"Escape"===e.key&&(e.preventDefault(),i(!1),!0)),[r,c.length]),g=(0,n.useCallback)(e=>null===u?null:{startIndex:u,endIndex:u+2+o.length,text:""},[u,o]);return{isOpen:r,suggestions:c,activeIndex:l,handleInput:f,handleKeyDown:m,selectSuggestion:g,close:(0,n.useCallback)(()=>{i(!1),h(null)},[]),exportDiscussion:(0,n.useCallback)(async e=>{let t=[];try{let e=await fetch("/api/participants");e.ok&&(t=await e.json())}catch(e){console.warn("Failed to fetch participants for export",e)}let n=await fetch("/api/thread-export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rootMessageId:e.rootMessageId,title:e.title,messages:[e.rootMessage,...e.replies],participants:t})});if(!n.ok)throw Error(`Export failed: ${await n.text()}`);return await n.json()},[])}}({messages:s,maxSuggestions:8}),C=function(){let[e,t]=(0,n.useState)([]),r=(0,n.useRef)(new Map),i=(0,n.useCallback)(e=>{let n=new XMLHttpRequest;r.current.set(e.id,n);let i=new FormData;i.append("file",e.file),n.upload.onprogress=n=>{if(n.lengthComputable){let r=Math.round(n.loaded/n.total*100);t(t=>t.map(t=>t.id===e.id?{...t,progress:r}:t))}},n.onload=()=>{if(r.current.delete(e.id),n.status>=200&&n.status<300)try{let r=JSON.parse(n.responseText),i=r.attachments?.[0];if(i)return void t(t=>t.map(t=>t.id===e.id?{...t,status:"uploaded",progress:100,serverId:i.id}:t))}catch{}let i=(()=>{try{return JSON.parse(n.responseText)?.error||"Upload failed"}catch{return"Upload failed"}})();t(t=>t.map(t=>t.id===e.id?{...t,status:"failed",error:i}:t))},n.onerror=()=>{r.current.delete(e.id),t(t=>t.map(t=>t.id===e.id?{...t,status:"failed",error:"Network error"}:t))},n.open("POST","/api/upload"),n.send(i)},[]),o=(0,n.useCallback)(n=>{let r=Array.from(n),o=function(e){let t=e.reduce((e,t)=>e+t.size,0);if(t>0x3200000){let e=(t/1048576).toFixed(1);return{file:"(total)",reason:`Total attachment size (${e}MB) exceeds 50MB limit`}}return null}([...e.map(e=>({name:e.filename,size:e.size,type:e.mimeType})),...r.map(e=>({name:e.name,size:e.size,type:e.type}))]);if(o)return void alert(o.reason);let s=[];for(let e of r){let t=function(e){let t=e.name.includes(".")?"."+e.name.split(".").pop().toLowerCase():"";if(mY.has(t))return{file:e.name,reason:`File type "${t}" is not allowed`};if(e.type&&!mX.has(e.type))return{file:e.name,reason:`File type "${e.type}" is not supported`};if(!e.type&&!mX.has("application/octet-stream"),e.size>0xa00000){let t=(e.size/1048576).toFixed(1);return{file:e.name,reason:`File is too large (${t}MB). Maximum is 10MB`}}return 0===e.size?{file:e.name,reason:"File is empty"}:null}({name:e.name,size:e.size,type:e.type});if(t){s.push({id:crypto.randomUUID(),file:e,filename:e.name,mimeType:e.type,size:e.size,previewUrl:null,progress:0,status:"failed",error:t.reason});continue}let n=e.type.startsWith("image/")?URL.createObjectURL(e):null,r={id:crypto.randomUUID(),file:e,filename:e.name,mimeType:e.type||"application/octet-stream",size:e.size,previewUrl:n,progress:0,status:"uploading"};s.push(r)}for(let e of(t(e=>[...e,...s]),s))"uploading"===e.status&&i(e)},[e,i]),s=(0,n.useCallback)(e=>{t(t=>{let n=t.find(t=>t.id===e);n?.previewUrl&&URL.revokeObjectURL(n.previewUrl);let i=r.current.get(e);return i&&(i.abort(),r.current.delete(e)),n?.serverId&&fetch(`/api/upload/${n.serverId}`,{method:"DELETE"}).catch(()=>{}),t.filter(t=>t.id!==e)})},[]),l=(0,n.useCallback)(e=>{t(t=>{let n=t.find(t=>t.id===e);if(!n||"failed"!==n.status)return t;let r=t.map(t=>t.id===e?{...t,status:"uploading",error:void 0,progress:0}:t),o=r.find(t=>t.id===e);return setTimeout(()=>i(o),0),r})},[i]),a=(0,n.useCallback)(()=>{t(e=>{for(let t of e){t.previewUrl&&URL.revokeObjectURL(t.previewUrl);let e=r.current.get(t.id);e&&e.abort()}return r.current.clear(),[]})},[]),c=0===e.length||e.every(e=>"uploaded"===e.status||"failed"===e.status),d=e.some(e=>"uploaded"===e.status),u=e.filter(e=>"uploaded"===e.status&&e.serverId);return{staged:e,stageFiles:o,remove:s,retry:l,clear:a,canSend:c,hasUploaded:d,attachmentIds:u.map(e=>e.serverId),getAttachmentMetas:(0,n.useCallback)(()=>u.map(e=>({id:e.serverId,filename:e.filename,mimeType:e.mimeType,size:e.size,status:"uploaded",url:`/api/attachments/${e.serverId}`})),[u])}}(),M=function(){let[e,t]=(0,n.useState)([]),r=(0,n.useCallback)((e,n,r)=>{t(t=>t.find(t=>t.path===e)?t.map(t=>t.path===e?{...t,label:n,attachMode:r??t.attachMode}:t):[...t,{kind:"file-path",id:crypto.randomUUID(),path:e,label:n,attachMode:r}])},[]);return{filePaths:e,addFilePath:r,removeFilePath:(0,n.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clearFilePaths:(0,n.useCallback)(()=>{t([])},[]),hasFilePaths:e.length>0}}(),N=function(e={},t=[]){let n=(0,iY.useRef)(e);n.current=e;let[r]=(0,iY.useState)(()=>new hJ(n)),i=(0,i0.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,iY.useDebugValue)(i),(0,iY.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,iY.useState)(()=>new hq(e.editor)),r=(0,hF.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:hL);hU(()=>n.watch(e.editor),[e.editor,n]),(0,iY.useDebugValue)(r)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}({immediatelyRender:!1,extensions:[mK.configure({heading:!1,bulletList:!1,orderedList:!1,listItem:!1,blockquote:!1,codeBlock:!1,code:!1,horizontalRule:!1,hardBreak:{keepMarks:!1}}),mH.configure({placeholder:a}),m3,m5,m4],editorProps:{attributes:{class:"composer-editor",role:"combobox","aria-autocomplete":"list"},handlePaste:(e,t)=>{let n=t.clipboardData?.files;return!!n&&n.length>0&&(t.preventDefault(),C.stageFiles(n),!0)},handleDOMEvents:{compositionstart:()=>(g.current=!0,v.startComposition(),!1),compositionend:(e,t)=>(g.current=!1,setTimeout(()=>{if(!N)return;let e=m6(N);e&&v.endComposition(e.text,e.cursorPos)},0),!1)},handleKeyDown:(e,t)=>{if("Tab"===t.key||"Enter"===t.key&&!t.shiftKey){if(k.isOpen&&k.filteredCommands.length>0){t.preventDefault();let e=k.filteredCommands[k.activeIndex];return e&&I(e),!0}if(w.isOpen&&w.suggestions.length>0){t.preventDefault();let e=w.suggestions[w.activeIndex];return e&&("folder"===e.type?O(e):E(e)),!0}if(S.isOpen&&S.suggestions.length>0){t.preventDefault();let e=S.suggestions[S.activeIndex];return e&&A(e),!0}if(v.isOpen&&v.filteredSuggestions.length>0){t.preventDefault();let e=v.filteredSuggestions[v.activeIndex];return e&&j(e),!0}}let n={key:t.key,preventDefault:()=>t.preventDefault()};return!!(k.isOpen&&k.handleKeyDown(n)||w.isOpen&&w.handleKeyDown(n)||S.isOpen&&S.handleKeyDown(n)||v.handleKeyDown(n))||"Enter"===t.key&&!t.shiftKey&&(t.preventDefault(),D(),!0)}},onUpdate:({editor:e})=>{if(g.current)return;let t=m6(e);t&&(v.handleInput(t.text,t.cursorPos),k.handleInput(t.text,t.cursorPos),w.handleInput(t.text,t.cursorPos),S.handleInput(t.text,t.cursorPos))},onBlur:()=>{v.close(),k.close(),w.close(),S.close()}});(0,n.useEffect)(()=>{if(!u||!N)return;let{title:e,threadId:t,messages:n}=u;N.chain().focus().insertContent({type:"threadMention",attrs:{threadId:t,title:e}}).insertContent(" ").run();let r=n[0];if(r){let i={rootMessageId:t,title:e,rootMessage:r,replies:n.slice(1),participantIds:[...new Set(n.map(e=>e.participantId||"user"))],lastActivityAt:Math.max(...n.map(e=>e.timestamp))};S.exportDiscussion(i).then(e=>b(t=>[...t,e])).catch(e=>console.error("Failed to export discussion for Add to chat:",e))}h?.()},[u]);let T=(0,n.useCallback)(()=>{if(!N)return;let e=m6(N);e&&v.handleInput(e.text,e.cursorPos)},[N,v]),j=(0,n.useCallback)(e=>{if(!N)return;let t=v.selectSuggestion(e);if(!t)return;let n=m6(N);if(!n)return;let r=t.text.startsWith("@@"),i={type:"participantMention",attrs:{id:e.id,name:e.name,mode:r?"parallel":"sequential"}};gp(N,n.blockStart,t.startIndex,t.endIndex,i),v.close()},[N,v]),E=(0,n.useCallback)(e=>{if(!N)return;let t=w.selectSuggestion(e);if(!t)return;let n=m6(N);if(!n)return;let r={type:"fileMention",attrs:{path:e.path,relativePath:e.relativePath??e.path,trigger:w.token?.trigger??"@/",attachMode:e.attachMode}};gp(N,n.blockStart,t.startIndex,t.endIndex,r),M.addFilePath(e.path,e.relativePath??e.path,e.attachMode)},[N,w,M]),O=(0,n.useCallback)(e=>{if(!N)return;let t=m6(N);if(!t)return;let n=w.drillDown(e);if(!n)return;let r=m9(N,t.blockStart,n.startIndex,n.endIndex);r&&N.chain().focus().deleteRange(r).insertContent(n.text).run()},[N,w]),A=(0,n.useCallback)(async e=>{if(!N)return;let t=S.selectSuggestion(e);if(!t)return;let n=m6(N);if(!n)return;let r={type:"threadMention",attrs:{threadId:e.rootMessageId,title:e.title}};gp(N,n.blockStart,t.startIndex,t.endIndex,r);try{let t=await S.exportDiscussion(e);b(e=>[...e,t])}catch(e){console.error("Failed to export discussion:",e)}},[N,S]),I=(0,n.useCallback)(e=>{k.selectCommand(e),N&&N.commands.clearContent()},[k,N]),D=(0,n.useCallback)(async()=>{if(!N)return;let t=(function(e){if(!e.content)return"";let t=[];for(let n of e.content)n.type,t.push(function(e){if(!e.content)return"";let t="";for(let n of e.content)switch(n.type){case"text":t+=n.text??"";break;case"participantMention":{let e=n.attrs??{},r="parallel"===e.mode?"@@":"@";t+=`${r}${e.name}`;break}case"fileMention":{let e=n.attrs??{},r=e.relativePath||e.path;t+=`@${r}`;break}case"threadMention":{let e=((n.attrs??{}).threadId??"").slice(0,8);t+=`@#${e}`;break}default:"hardBreak"===n.type&&(t+="\n")}return t}(n));return t.join("\n")})(N.getJSON()).trim();if(!t&&!C.hasUploaded&&!M.hasFilePaths||!C.canSend)return;if(t){let e=l.find(e=>e.name===t||e.aliases?.some(e=>`/${e}`===t));if(e){e.execute(),N.commands.clearContent(),k.close(),v.close();return}}let n=t||"(attached files)";if(x.length>0){let e=x.map(e=>`- "${e.title}" — ${e.summary} (full transcript: ${e.filePath})`).join("\n");n=`Referenced threads:
91
- ${e}
92
-
93
- ${n}`}if(M.hasFilePaths){let e=await m2(M.filePaths);e.contextPrefix&&(n=e.contextPrefix+n)}let r=C.attachmentIds.length>0?C.attachmentIds:void 0,i=r?C.getAttachmentMetas():void 0;e(n,p,r,i),N.commands.clearContent(),b([]),C.clear(),M.clearFilePaths(),v.close(),k.close(),S.close()},[N,p,v,k,l,e,C,M,x,S]),R=v.isOpen&&v.filteredSuggestions.length>0;k.isOpen&&k.filteredCommands.length,w.isOpen&&w.suggestions.length,S.isOpen&&S.suggestions.length,R&&v.filteredSuggestions[v.activeIndex];let P=C.staged.some(e=>"uploading"===e.status),z=!N||N.isEmpty;return(0,t.jsx)("div",{className:"pb-6",children:(0,t.jsx)("div",{className:"max-w-3xl mx-auto",children:(0,t.jsx)(gu,{onDrop:C.stageFiles,children:(0,t.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-200 shadow-lg p-1.5 focus-within:ring-4 focus-within:ring-slate-900/5 transition-all",children:[C.staged.length>0&&(0,t.jsx)("div",{className:"mx-2 mt-2 mb-1",children:(0,t.jsx)(gd,{attachments:C.staged,onRemove:C.remove,onRetry:C.retry})}),(0,t.jsxs)("div",{className:"flex items-end gap-2 p-2 relative",children:[(0,t.jsx)("button",{type:"button",onClick:y,className:"p-2.5 text-slate-400 hover:bg-slate-50 hover:text-slate-600 rounded-xl transition-all shrink-0","aria-label":"Attach file",title:"Attach file",children:(0,t.jsx)(gh,{className:"h-5 w-5",strokeWidth:1.75})}),(0,t.jsx)("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&e.target.files.length>0&&(C.stageFiles(e.target.files),e.target.value="")}}),(0,t.jsxs)("div",{className:"flex-1 relative",onClick:T,children:[(0,t.jsx)(hH,{editor:N,className:"composer-editor"}),(0,t.jsx)(m7,{isOpen:v.isOpen&&!k.isOpen,suggestions:v.filteredSuggestions,activeIndex:v.activeIndex,listboxId:"composer-mention-listbox",optionIdPrefix:"composer-mention-option",onSelect:j}),(0,t.jsx)(ge,{isOpen:k.isOpen,commands:k.filteredCommands,activeIndex:k.activeIndex,listboxId:"composer-command-listbox",optionIdPrefix:"composer-command-option",onSelect:I}),(0,t.jsx)(gs,{isOpen:w.isOpen,suggestions:w.suggestions,activeIndex:w.activeIndex,isLoading:w.isLoading,error:w.error,listboxId:"composer-file-mention-listbox",optionIdPrefix:"composer-file-mention-option",onSelect:e=>{"folder"===e.type?O(e):E(e)},onAttachContents:w.onAttachContents}),(0,t.jsx)(gl,{isOpen:S.isOpen&&!k.isOpen&&!w.isOpen,suggestions:S.suggestions,activeIndex:S.activeIndex,listboxId:"composer-thread-mention-listbox",optionIdPrefix:"composer-thread-mention-option",onSelect:A})]}),i?(0,t.jsx)("button",{type:"button",onClick:r,className:"h-10 px-4 bg-red-50 text-red-600 border border-red-200 rounded-xl font-bold text-sm hover:bg-red-100 shadow-sm flex items-center gap-2 transition-all shrink-0",children:"Stop"}):(0,t.jsxs)("button",{type:"button",onClick:D,disabled:z&&!C.hasUploaded&&!M.hasFilePaths||P,className:"h-10 px-4 bg-slate-900 text-white rounded-xl font-bold text-sm hover:bg-slate-800 disabled:opacity-50 disabled:hover:bg-slate-900 disabled:cursor-not-allowed shadow-md flex items-center gap-2 transition-all shrink-0",children:["Send",(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,t.jsx)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})]})]}),(0,t.jsxs)("div",{className:"px-4 pb-2 flex items-center gap-3 mt-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-tighter",children:"Turn Limit"}),(0,t.jsx)("select",{value:p,onChange:e=>f(Number(e.target.value)),className:"bg-transparent border-none outline-none text-[11px] font-bold text-slate-900 cursor-pointer appearance-none hover:text-indigo-600 transition-colors",children:[1,3,5,10,20,50].map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]}),(0,t.jsx)("div",{className:"w-px h-3 bg-slate-200"}),(0,t.jsx)("div",{className:"flex gap-1 items-center overflow-x-auto no-scrollbar",children:0===o.length?(0,t.jsx)("span",{className:"text-[10px] font-medium text-slate-400",children:"No agents active"}):o.map(e=>(0,t.jsx)("div",{className:"w-4 h-4 rounded-full bg-slate-100 shadow-sm flex items-center justify-center overflow-hidden shrink-0",title:e.name,children:(0,t.jsx)("img",{src:`https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${e.id}&backgroundColor=${e.color?e.color.replace("#",""):"e2e8f0"}`,alt:e.name,className:"w-full h-full rounded-full ring-1 ring-slate-200 object-cover"})},e.id))})]})]})})})})}function gm({logs:e,participants:r,onClear:i,open:o,onToggle:s}){let[l,a]=(0,n.useState)(420),[c,d]=(0,n.useState)(null),u=(0,n.useRef)(null),h=(0,n.useRef)(!1),p=(0,n.useRef)(0),f=(0,n.useRef)(0),m=Object.fromEntries(r.map(e=>[e.id,e]));(0,n.useEffect)(()=>{o&&u.current?.scrollIntoView({behavior:"smooth"})},[e.length,o]);let g=(0,n.useCallback)(e=>{e.preventDefault(),h.current=!0,p.current=e.clientX,f.current=l,e.target.setPointerCapture(e.pointerId)},[l]),y=(0,n.useCallback)(e=>{if(!h.current)return;let t=p.current-e.clientX;a(Math.max(280,Math.min(f.current+t,.6*window.innerWidth)))},[]),x=(0,n.useCallback)(()=>{h.current=!1},[]);if(!o)return null;let b=c?e.filter(e=>e.participantId===c):e;return(0,t.jsxs)("div",{className:"flex h-full shrink-0",children:[(0,t.jsx)("div",{onPointerDown:g,onPointerMove:y,onPointerUp:x,className:"w-1.5 cursor-col-resize bg-zinc-800 hover:bg-zinc-600 transition-colors flex items-center justify-center shrink-0",children:(0,t.jsx)("div",{className:"h-8 w-0.5 rounded-full bg-zinc-500"})}),(0,t.jsxs)("div",{className:"flex flex-col bg-zinc-950 h-full",style:{width:l},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-zinc-800 shrink-0",children:[(0,t.jsx)("span",{className:"text-[11px] text-zinc-400 font-mono",children:"Logs"}),(0,t.jsxs)("select",{value:c||"",onChange:e=>d(e.target.value||null),className:"bg-zinc-800 text-zinc-300 text-[11px] rounded px-1.5 py-0.5 outline-none",children:[(0,t.jsx)("option",{value:"",children:"All"}),r.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,t.jsx)("button",{onClick:i,className:"text-[11px] text-zinc-500 hover:text-zinc-300",children:"Clear"}),(0,t.jsx)("button",{onClick:s,className:"text-[11px] text-zinc-500 hover:text-zinc-300",children:"✕"})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto font-mono text-[11px] leading-4 px-3 py-2",children:[b.map((e,n)=>{let r=m[e.participantId]?.name||e.participantId,i=m[e.participantId]?.color||"#888",o="stderr"===e.stream;return(0,t.jsxs)("div",{className:"flex gap-2 whitespace-pre-wrap break-all",children:[(0,t.jsx)("span",{className:"text-zinc-600 shrink-0 select-none",children:new Date(e.timestamp).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}),(0,t.jsx)("span",{className:"shrink-0",style:{color:i},children:r}),(0,t.jsx)("span",{className:o?"text-red-400":"text-zinc-400",children:e.line})]},n)}),(0,t.jsx)("div",{ref:u})]})]})]})}let gg="agx-chat:uiSettings",gy={threadSidebarVisible:!1};function gx(){return void 0!==window.localStorage}function gb(){if(!gx())return{...gy};let e=window.localStorage.getItem(gg);if(!e)return{...gy};try{let t=JSON.parse(e);return{...gy,threadSidebarVisible:"boolean"==typeof t.threadSidebarVisible&&t.threadSidebarVisible}}catch{return{...gy}}}function gv(e){var t={...gb(),threadSidebarVisible:e};if(gx())try{window.localStorage.setItem(gg,JSON.stringify(t))}catch{}}let gk="agx-chat:project-agent-config",gw={activeParticipantIdsByThread:{}};function gS(){return void 0!==window.localStorage}function gC(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e){if("string"!=typeof r)continue;let e=r.trim();!e||t.has(e)||(t.add(e),n.push(e))}return n}function gM(){if(!gS())return{...gw};let e=window.localStorage.getItem(gk);if(!e)return{...gw};try{let t=JSON.parse(e).activeParticipantIdsByThread;if(!t||"object"!=typeof t)return{...gw};return{activeParticipantIdsByThread:Object.fromEntries(Object.entries(t).map(([e,t])=>[e,gC(t)]))}}catch{return{...gw}}}function gN(e,t){let n=e.trim();if(!n)return;let r=gM();r.activeParticipantIdsByThread[n]=gC(t);if(gS())try{window.localStorage.setItem(gk,JSON.stringify(r))}catch{}}let gT={threadSidebarVisible:!1,workspaceRoots:[],homeSearchConsent:!1,hasCompletedFirstRun:!1,fileIgnorePatterns:[]};function gj(e){return e&&"object"==typeof e?{threadSidebarVisible:"boolean"==typeof e.threadSidebarVisible?e.threadSidebarVisible:gT.threadSidebarVisible,workspaceRoots:Array.isArray(e.workspaceRoots)?e.workspaceRoots.filter(e=>"string"==typeof e):gT.workspaceRoots,homeSearchConsent:"boolean"==typeof e.homeSearchConsent?e.homeSearchConsent:gT.homeSearchConsent,hasCompletedFirstRun:"boolean"==typeof e.hasCompletedFirstRun?e.hasCompletedFirstRun:gT.hasCompletedFirstRun,fileIgnorePatterns:Array.isArray(e.fileIgnorePatterns)?e.fileIgnorePatterns.filter(e=>"string"==typeof e):gT.fileIgnorePatterns}:gT}let gE="/api/userPreferences";function gO(e){return e.json().then(e=>e&&"object"==typeof e?gj(e.preferences??e):gj(e)).catch(()=>gj(null))}function gA(e){return e.statusText||`Failed to reach ${gE} (${e.status})`}async function gI(){let e=await fetch(gE,{cache:"no-store"});if(!e.ok)throw Error(gA(e));return gO(e)}async function gD(e){let t=await fetch(gE,{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store",body:JSON.stringify({preferences:e})});if(!t.ok)throw Error(gA(t));return gO(t)}let gR=(0,a.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var gP=e.i(48071);function gz(){let[e,r]=(0,n.useState)("unknown"),[i,o]=(0,n.useState)([]),[s,l]=(0,n.useState)(""),[a,c]=(0,n.useState)(!1),d=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/status");if(!e.ok)return void r("unknown");let t=await e.json();r("ok"===t.status?"ok":"degraded");let n=t.services.filter(e=>"agx-chat"===e.name||"agx-cloud"===e.name);o(n),l(new Date().toLocaleTimeString())}catch{r("unknown"),o([])}},[]);return(0,n.useEffect)(()=>{d();let e=setInterval(d,3e4);return()=>clearInterval(e)},[d]),(0,t.jsxs)("div",{className:"relative",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,t.jsx)(p.default,{href:"/status",className:"inline-flex h-8 w-8 items-center justify-center rounded-md border border-slate-200 bg-white hover:bg-slate-50 transition-all focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-400",title:"System status",children:(0,t.jsx)("span",{className:`h-2.5 w-2.5 rounded-full ${"ok"===e?"bg-emerald-400":"degraded"===e?"bg-amber-400":"bg-slate-300"} ${"degraded"===e?"animate-pulse":""}`})}),a&&(0,t.jsxs)("div",{className:"absolute top-full right-0 mt-1.5 w-52 rounded-lg border border-slate-200 bg-white p-3 shadow-lg z-50 text-xs",children:[i.length>0?(0,t.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,t.jsxs)("li",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-slate-700 font-medium",children:e.name}),(0,t.jsx)("span",{className:"ok"===e.status?"text-emerald-600":"error"===e.status?"text-red-500":"text-slate-400",children:"ok"===e.status?"Healthy":"error"===e.status?e.detail||"Error":"Unavailable"})]},e.name))}):(0,t.jsx)("p",{className:"text-slate-400",children:"Checking..."}),s&&(0,t.jsxs)("p",{className:"text-slate-400 mt-2 pt-1.5 border-t border-slate-100",children:["Last check: ",s]})]})]})}function gL(e,t=!1){return(t?e.replace(/(?:^|\n)Thinking\.\.\.[\s\S]*?\.\.\.done thinking\.?\s*/g,"\n").trim():e).replaceAll("<!-- thread-summary -->","").replaceAll("<!-- task-draft -->","").trim().replace(/\r\n/g,"\n").replace(/\n{3,}/g,"\n\n").trim()}function g$(e,t,n){let r=Object.fromEntries(t.map(e=>[e.id,e])),i=[];for(let t of e){let e="user"===t.role?"You":t.participantId?r[t.participantId]?.name||t.participantId:"Assistant",n=gL(t.content,"user"!==t.role);n&&(i.push(`**${e}:**`),i.push(""),i.push(n),i.push(""))}if(n){let e=function(e){if(0===e.tasks.length)return"";let t=new Map(e.tasks.map(e=>[e.id,e.title.trim()])),n=["## Draft Tasks",""];return e.projectName&&n.push(`Project: ${e.projectName}`),e.buildStatus&&n.push(`Build status: ${e.buildStatus.replaceAll("_"," ")}`),(e.projectName||e.buildStatus)&&n.push(""),e.tasks.forEach((r,i)=>{let o=gL(r.title)||`Task ${i+1}`,s=gL(r.description),l=(r.dependsOn||[]).map(e=>t.get(e)?.trim()).filter(e=>!!e),a=e.builtTaskIds?.[r.id];n.push(`${i+1}. [ ] **${o}**`),s&&n.push(s),l.length>0&&n.push(`Depends on: ${l.join(", ")}`),a&&n.push(`agx task id: \`${a}\``),n.push("")}),n.join("\n").trim()}(n);e&&i.push(e)}return i.join("\n").trim()}function gF(){let{threads:e,activeThreadId:o,selectThread:s,createThread:l,deleteThread:a,updateThreadMessages:c,isCreating:d,deletingThreadId:h,renamingThreadId:p,isLoading:f,isRestoringActiveThread:m,renameThread:g}=(0,i.useThreadState)(),{messages:y,streaming:x,loading:b,logs:v,sendMessage:k,loadHistory:w,clearLogs:S,stop:C,stopThread:M}=function(e){let[t,i]=(0,n.useState)([]),[o,s]=(0,n.useState)({}),[l,a]=(0,n.useState)(0),[c,d]=(0,n.useState)([]),u=(0,n.useRef)(new Set),h=(0,n.useRef)(new Map),p=(0,n.useRef)(e),f=(0,n.useRef)(e);p.current=e,f.current!==e&&(f.current=e,i([]),d([]),s({}));let m=(0,n.useCallback)(async e=>{let t=e?.trim()||p.current?.trim();if(!t){i([]),d([]);return}let n=r(t);try{let[e,r]=await Promise.all([fetch(`/api/history?${n}`),fetch(`/api/logs?${n}`)]);if(p.current!==t)return;e.ok&&i(await e.json()),r.ok&&d(await r.json())}catch{}},[]),g=(0,n.useCallback)(async e=>{let t=e?.trim()||p.current?.trim();if(!t){i([]),d([]);return}let n=r(t);await Promise.all([fetch(`/api/history?${n}`,{method:"DELETE"}),fetch(`/api/logs?${n}`,{method:"DELETE"})]),p.current===t&&(i([]),d([]))},[]),y=(0,n.useCallback)(async(e,t=10,n,r,o,l,c)=>{let f=n?.trim()||p.current?.trim();if(!f)return;let m=Date.now(),g=`user-${m}`,y={id:g,role:"user",participantId:null,content:e,timestamp:m,rootMessageId:r||null,parentMessageId:r||null,depth:+!!r,...l&&l.length>0?{attachments:l}:{}};i(e=>[...e,y]),a(e=>e+1);let x=new AbortController;u.current.add(x);let b=new Set,v=r||g;h.current.has(v)||h.current.set(v,new Set),h.current.get(v).add(x);try{let n=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:f,prompt:e,maxRounds:t,userMessageId:g,rootMessageId:r||void 0,attachmentIds:o?.length?o:void 0,activeParticipantIds:Array.isArray(c)?c:void 0}),signal:x.signal});if(!n.ok||!n.body)return;let l=n.body.getReader(),a=new TextDecoder,u="";for(;;){let{done:e,value:t}=await l.read();if(e)break;let n=(u+=a.decode(t,{stream:!0})).split("\n");for(let e of(u=n.pop()||"",n)){if(!e.startsWith("data: "))continue;let t=e.slice(6).trim();if(t)try{let e=JSON.parse(t);if(p.current!==f)continue;if("participant-thinking"===e.type)b.add(e.participantId),s(t=>({...t,[e.participantId]:{content:"",rootMessageId:v}}));else if("participant-error"===e.type)s(t=>({...t,[e.participantId]:{content:`[Error: ${e.error}]`,rootMessageId:v}}));else if("log"===e.type)d(t=>[...t,{timestamp:Date.now(),participantId:e.participantId,stream:e.stream,line:e.line}]);else if("message-reactions"===e.type)i(t=>t.map(t=>t.id===e.messageId?{...t,reactions:e.reactions}:t));else if("participant-end"===e.type){let t=e.content||"";if(t.trim()){let n={id:e.messageId||`${e.participantId}-${Date.now()}`,role:"assistant",participantId:e.participantId,content:t,timestamp:Date.now(),rootMessageId:v,parentMessageId:v,depth:1};i(e=>[...e,n])}s(t=>{let n={...t};return delete n[e.participantId],n})}}catch{}}}}catch{}finally{if(u.current.delete(x),h.current.get(v)?.delete(x),h.current.get(v)?.size===0&&h.current.delete(v),a(e=>Math.max(0,e-1)),p.current===f){let e=[...b];s(t=>{let n={...t};for(let t of e)delete n[t];return n})}}},[]),x=(0,n.useCallback)(()=>{for(let e of u.current)e.abort();u.current.clear(),h.current.clear(),s({}),a(0)},[]),b=(0,n.useCallback)(e=>{let t=h.current.get(e);if(t&&0!==t.size){for(let e of t)e.abort(),u.current.delete(e);h.current.delete(e),s(t=>{let n={...t};for(let[t,r]of Object.entries(n))r.rootMessageId===e&&delete n[t];return n}),a(e=>Math.max(0,e-t.size))}},[]);return{messages:t,streaming:o,loading:l>0,logs:c,sendMessage:y,loadHistory:m,clearHistory:g,clearLogs:(0,n.useCallback)(async e=>{let t=e?.trim()||p.current?.trim();t?(await fetch(`/api/logs?${r(t)}`,{method:"DELETE"}).catch(()=>{}),p.current===t&&d([])):d([])},[]),stop:x,stopThread:b}}(o),[N,T]=(0,n.useState)([]),[j,E]=(0,n.useState)(!1),[O,A]=(0,n.useState)([]),[D,R]=(0,n.useState)(!1),[P,z]=(0,n.useState)(!1),[L,$]=(0,n.useState)(!1);(0,n.useEffect)(()=>{$(gb().threadSidebarVisible)},[]);let[F,B]=(0,n.useState)(null),[_,V]=(0,n.useState)(""),[H,U]=(0,n.useState)([]),[q,W]=(0,n.useState)(0),[K,J]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(null),[X,Y]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(new Set),[et,en]=(0,n.useState)(null),[er,ei]=(0,n.useState)({}),eo=(0,n.useCallback)(e=>{ei(t=>{let n="function"==typeof e?e(t):e;if(o)for(let[e,r]of Object.entries(n))t[e]!==r&&fetch("/api/task-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:o,messageId:e,draft:r})}).catch(()=>{});return n})},[o]),[es,el]=(0,n.useState)(new Set),[ea,ec]=(0,n.useState)(new Set),ed=(0,n.useRef)(null),eu=(0,n.useRef)(null),eh=(0,n.useRef)(null),ep=(0,n.useRef)(""),ef=(0,n.useCallback)(async(e=!1)=>{try{let e=await fetch("/api/participants");if(!e.ok)return;let t=await e.json();if(!Array.isArray(t))return;T(t)}finally{e&&E(!0)}},[]),em=(0,n.useCallback)(async e=>{try{await gD({threadSidebarVisible:e})}catch(e){console.error("Unable to persist thread sidebar preference",e)}},[gD]),eg=(0,n.useCallback)(e=>{gv(e),em(e)},[em]),ey=_.trim(),ex=ey.length>0,eb=(0,n.useMemo)(()=>Object.fromEntries(e.map(e=>[e.id,e.title?.trim()||"Untitled workspace"])),[e]),ev=(0,n.useMemo)(()=>{if(!F)return[];let e=new Set([y.find(e=>e.id===F),...y.filter(e=>e.rootMessageId===F)].filter(Boolean).map(e=>e.participantId).filter(Boolean));return Object.keys(x).forEach(t=>{x[t].rootMessageId===F&&e.add(t)}),N.filter(t=>e.has(t.id))},[F,y,x,N]),ek=(0,n.useMemo)(()=>{let e=new Set(O);return N.filter(t=>e.has(t.id))},[N,O]),ew=(0,n.useMemo)(()=>{if(!F)return 0;let e=[y.find(e=>e.id===F),...y.filter(e=>e.rootMessageId===F)].filter(Boolean);return 0===e.length?0:Math.max(...e.map(e=>e.timestamp))},[F,y]),eS=(0,n.useMemo)(()=>{if(!F)return"";let e=y.find(e=>e.id===F);if(!e)return"Workspace";let t=e.content.trim();return t.length>60?t.slice(0,60)+"...":t},[F,y]),eC=(0,n.useCallback)(()=>{V(""),U([]),W(0),Q(null),J(!1)},[]);(0,n.useCallback)(()=>{let e=g$(y,N);navigator.clipboard.writeText(e).then(()=>{R(!0),setTimeout(()=>R(!1),2e3)})},[y,N]);let[eM,eN]=(0,n.useState)(null),eT=(0,n.useCallback)(e=>{let t=y.find(t=>t.id===e);if(!t)return;let n=[t,...y.filter(t=>t.rootMessageId===e).sort((e,t)=>e.timestamp-t.timestamp)];eN({title:t.content.slice(0,60).replace(/\n/g," ").trim()||"Untitled",threadId:e,messages:n})},[y]),ej=(0,n.useCallback)(e=>{let t=g$([y.find(t=>t.id===e),...y.filter(t=>t.rootMessageId===e).sort((e,t)=>e.timestamp-t.timestamp)].filter(Boolean),N,er[e]);navigator.clipboard.writeText(t).catch(e=>console.error("Failed to copy thread",e))},[y,N,er]);(0,n.useEffect)(()=>{ef(!0)},[ef]);let eE=(0,n.useMemo)(()=>{if(!j)return[];let e=new Set(N.map(e=>e.id)),t=new Set;for(let n of y)"assistant"===n.role&&n.participantId&&(e.has(n.participantId)||t.add(n.participantId));for(let n of Object.keys(x))e.has(n)||t.add(n);return Array.from(t).sort()},[y,N,j,x]);(0,n.useEffect)(()=>{if(!j)return;let e=eE.join("|");if(!e){ep.current="";return}ep.current!==e&&(ep.current=e,ef(!1))},[j,ef,eE]),(0,n.useEffect)(()=>{if(!j)return;let e=N.map(e=>e.id),t=new Set(e);if(!o)return void A(e);let n=function(e){let t=e.trim();if(!t)return null;let n=gM();return t in n.activeParticipantIdsByThread?[...n.activeParticipantIdsByThread[t]]:null}(o);if(null===n)return void A(e);let r=n.filter(e=>t.has(e));r.length!==n.length&&gN(o,r),A(r)},[o,N,j]),(0,n.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await gI();if(e)return;$(e=>e===t.threadSidebarVisible?e:(gv(t.threadSidebarVisible),t.threadSidebarVisible))}catch(e){console.error("Failed to load user preferences",e)}})(),()=>{e=!0}},[gI,gv]),(0,n.useEffect)(()=>{f||d||0!==e.length||l({id:"global",title:"General"})},[f,d,e.length,l]),(0,n.useEffect)(()=>()=>{eh.current&&window.clearTimeout(eh.current)},[]),(0,n.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()){e.preventDefault(),ed.current?.focus(),ed.current?.select();return}"Escape"===e.key&&ey&&eC()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eC,ey]),(0,n.useEffect)(()=>{if(!ey){U([]),W(0),Q(null),J(!1);return}let e=!1;J(!0);let t=window.setTimeout(()=>{(async()=>{try{let t=new URLSearchParams({q:ey,limit:"20",offset:"0"}),n=await fetch(`/api/search?${t.toString()}`),r=await n.json().catch(()=>null);if(e)return;if(!n.ok){let e=r&&"object"==typeof r&&"error"in r?String(r.error):"Search failed";U([]),W(0),Q(e);return}U(Array.isArray(r.results)?r.results:[]),W("number"==typeof r.total?r.total:0),Q(null)}catch(t){if(e)return;console.error("Search request failed",t),U([]),W(0),Q("Search failed")}finally{e||J(!1)}})()},300);return()=>{e=!0,window.clearTimeout(t)}},[ey]);let eO=(0,n.useRef)(null);(0,n.useEffect)(()=>{null!==eO.current&&eO.current!==o&&(C(),eu.current?(B(eu.current),eu.current=null):B(null)),eO.current=o,o&&(w(o),fetch(`/api/task-drafts?threadId=${encodeURIComponent(o)}`).then(e=>e.json()).then(e=>{e.drafts&&Object.keys(e.drafts).length>0?ei(e.drafts):ei({})}).catch(()=>ei({})))},[o,w,C]),(0,n.useEffect)(()=>{o&&c(o,y)},[o,y,c]);let eA=(0,n.useCallback)((e,t,n=10)=>{o&&0!==ek.length&&k(t,n,o,e,void 0,void 0,ek.map(e=>e.id))},[o,k,ek]),eI=(0,n.useCallback)(async e=>{if(o){if(0===ek.length)return void window.alert("Enable at least one agent in this workspace.");ee(t=>new Set(t).add(e));try{let t=await fetch("/api/summarize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:o,rootMessageId:e,activeParticipantIds:ek.map(e=>e.id)})});t.ok?await w(o):console.error("Summarize failed:",await t.text())}catch(e){console.error("Summarize error:",e)}finally{ee(t=>{let n=new Set(t);return n.delete(e),n})}}},[o,w,ek]),eD=(0,n.useCallback)(async e=>{if(o){if(0===ek.length)return void window.alert("Enable at least one agent in this workspace.");el(t=>new Set(t).add(e));try{let t=await fetch("/api/tasks/extract",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:o,rootMessageId:e,activeParticipantIds:ek.map(e=>e.id)})});if(t.ok){let n=await t.json(),r={draftId:crypto.randomUUID(),revision:0,tasks:n.tasks,buildStatus:"idle"};eo(t=>({...t,[e]:r}))}else console.error("Task extraction failed:",await t.text())}catch(e){console.error("Task extraction error:",e)}finally{el(t=>{let n=new Set(t);return n.delete(e),n})}}},[o,ek]),eR=(0,n.useCallback)((e,t)=>{eo(n=>({...n,[e]:t}))},[]),eP=(0,n.useCallback)(async(e,t,n,r)=>{if(o){ec(e=>new Set(e).add(t.draftId)),eo(i=>({...i,[e]:{...t,buildStatus:"building",projectId:n,projectName:r}}));try{let r=crypto.randomUUID(),i=await iE(t.tasks,n,r,t.builtTaskIds),o={...t.builtTaskIds},s=!1;for(let e of i.results)"created"===e.status&&e.remoteTaskId?o[e.clientTaskId]=e.remoteTaskId:s=!0;eo(t=>({...t,[e]:{...t[e],buildId:r,buildStatus:s?"partial_failure":"done",builtTaskIds:o}}))}catch(t){console.error("Build error:",t),eo(t=>({...t,[e]:{...t[e],buildStatus:"partial_failure"}}))}finally{ec(e=>{let n=new Set(e);return n.delete(t.draftId),n})}}},[o]),ez=(0,n.useCallback)(()=>{if(!o)return;let e=(()=>{if(F)return F;let e=new Set(y.map(e=>e.rootMessageId).filter(e=>!!e));for(let t=y.length-1;t>=0;t-=1){let n=y[t];if(!n.rootMessageId&&e.has(n.id))return n.id}return null})();e?eD(e):console.warn("No thread with replies available to extract tasks from")},[o,eD,y,F]);(0,n.useCallback)(e=>{B(e)},[]);let eL=(0,n.useCallback)(e=>{B(e)},[]),e$=(0,n.useCallback)(e=>{let t=e?.trim()??"";t&&V(t),requestAnimationFrame(()=>{ed.current?.focus(),t||ed.current?.select()})},[]),eF=(0,n.useCallback)(()=>{if(!o)return;let e=(()=>{if(F)return F;let e=new Set(y.map(e=>e.rootMessageId).filter(e=>!!e));for(let t=y.length-1;t>=0;t-=1){let n=y[t];if(!n.rootMessageId&&e.has(n.id))return n.id}return null})();e?eI(e):console.warn("No thread with replies available to summarize")},[o,eI,y,F]),eB=(0,n.useCallback)(async(e,t,n,r)=>{let i=e.match(/^\/search(?:\s+([\s\S]+))?$/i);if(i)return void e$(i[1]);if(/^\/summarize(?:\s+[\s\S]+)?$/i.test(e))return void eF();if(/^\/tasks(?:\s+[\s\S]+)?$/i.test(e)||/^\/create(?:\s+[\s\S]+)?$/i.test(e))return void ez();let s=o;s||(s=(await l()).id);let a=ek.map(e=>e.id);0===a.length?window.alert("Enable at least one agent in this workspace."):F?await k(e,t,s,F,n,r,a):await k(e,t,s,null,n,r,a)},[o,l,e$,eF,F,ek,k]),e_=(0,n.useCallback)(e=>{let t=e.rootMessageId||e.messageId;e.threadId!==o?(eu.current=t,s(e.threadId)):B(t),Y(null),window.requestAnimationFrame(()=>{Y(e.messageId),eh.current&&window.clearTimeout(eh.current),eh.current=window.setTimeout(()=>{Y(t=>t===e.messageId?null:t)},2e3)}),eC()},[o,eC,s]),eV=(0,n.useCallback)(async e=>{C(),await a(e)},[a,C]),eH=(0,n.useCallback)(async e=>{if(o&&e&&window.confirm("Delete this thread and all of its replies?")){en(e),M(e);try{let t=new URLSearchParams({threadId:o,rootMessageId:e}),n=await fetch(`/api/history?${t.toString()}`,{method:"DELETE"});if(!n.ok)return void console.error("Failed to delete message thread",await n.text());B(t=>t===e?null:t),Y(null);let r=y.filter(t=>t.id!==e&&t.rootMessageId!==e);c(o,r),await w(o)}catch(e){console.error("Failed to delete message thread",e)}finally{en(t=>t===e?null:t)}}},[o,w,y,M,c]),eU=(0,n.useMemo)(()=>[{name:"/search",description:"Search messages (usage: /search <query>)",aliases:["find"],execute:()=>e$()},{name:"/summarize",description:"Summarize current thread or latest thread with replies",aliases:["sum"],execute:()=>eF()},{name:"/tasks",description:"Extract tasks from current thread discussion",aliases:["create"],execute:()=>ez()}],[e$,eF,ez]),eq=(0,n.useCallback)(e=>(0,t.jsx)(gf,{onSend:(t,n)=>eA(e,t,n),onStop:()=>M(e),loading:Object.values(x).some(t=>t.rootMessageId===e),participants:ek,messages:y,commands:eU,placeholder:"Reply — @name to mention, /search, /summarize"}),[eA,M,x,ek,eU,y]),eW=(0,n.useCallback)(()=>{$(e=>{let t=!e;return eg(t),t})},[eg]),eK=async e=>{let t=await fetch("/api/participants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok){let e=await t.json();T(t=>[...t,e])}},eJ=async e=>{let t=await fetch("/api/participants",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok){let e=await t.json();T(t=>t.map(t=>t.id===e.id?e:t))}},eG=async e=>{(await fetch(`/api/participants?id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&(T(t=>t.filter(t=>t.id!==e)),o&&A(t=>{let n=t.filter(t=>t!==e);return gN(o,n),n}))},eQ=async e=>{T(t=>{let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>n.get(e)).filter(e=>!!e)}),await fetch("/api/participants",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:e})})},eX=(0,n.useCallback)((e,t)=>{A(n=>{if(!new Set(N.map(e=>e.id)).has(e))return n;let r=new Set(n);t?r.add(e):r.delete(e);let i=N.map(e=>e.id).filter(e=>r.has(e));return o&&gN(o,i),i})},[o,N]),eY=(0,t.jsx)("div",{className:"border-b border-slate-200/60 bg-white px-6 py-2.5",children:(0,t.jsxs)("div",{className:"max-w-2xl mx-auto relative group/search",children:[(0,t.jsx)(u.Search,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400 group-focus-within/search:text-indigo-500 transition-colors",strokeWidth:2}),(0,t.jsx)("input",{ref:ed,type:"text",value:_,onChange:e=>V(e.target.value),onKeyDown:e=>{"Escape"===e.key&&eC()},placeholder:"Search messages…",className:"h-9 w-full rounded-lg border border-slate-200 bg-slate-50/80 pl-9 pr-16 text-sm font-medium outline-none placeholder:text-slate-400 transition-all focus:bg-white focus:border-indigo-300 focus:ring-2 focus:ring-indigo-500/10 hover:border-slate-300"}),ey?(0,t.jsxs)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-bold text-slate-400",children:K?"…":q}),(0,t.jsx)("button",{type:"button",onClick:eC,className:"text-[10px] font-bold text-slate-400 hover:text-slate-600 transition-colors",children:"✕"})]}):(0,t.jsx)("kbd",{className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 px-1.5 py-0.5 text-[10px] font-sans font-bold text-slate-400 bg-slate-100 border border-slate-200 rounded-md",children:"⌘K"})]})});return(0,t.jsxs)("div",{className:"flex h-screen bg-white text-zinc-900",children:[(0,t.jsx)(I,{threads:e,participants:N,activeThreadId:o,isLoading:f,isRestoringActiveThread:m,isCreating:d,deletingThreadId:h,renamingThreadId:p,onSelectThread:s,onCreateThread:l,onRenameThread:g,onDeleteThread:eV,onAddParticipant:eK,onUpdateParticipant:eJ,onRemoveParticipant:eG,activeParticipantIds:O,onToggleParticipantActive:eX,onReorderParticipants:eQ,visible:L,onToggle:eW}),(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-w-0 relative",children:[(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-30 flex items-center gap-2",children:[(0,t.jsx)("a",{href:"/projects",className:"inline-flex items-center gap-1.5 h-8 px-3 text-xs font-medium text-slate-600 bg-white border border-slate-200 rounded-md hover:bg-slate-50 hover:text-slate-800 transition-colors",children:"View Boards"}),(0,t.jsx)(gz,{}),(0,t.jsx)("button",{type:"button",onClick:()=>z(!P),"aria-label":P?"Hide logs":`Show logs${v.length>0?` (${v.length})`:""}`,"aria-pressed":P,title:P?"Hide logs":`Show logs${v.length>0?` (${v.length})`:""}`,className:`inline-flex h-8 w-8 items-center justify-center rounded-md border transition-all focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-400 ${P?"border-slate-300 bg-slate-50 text-slate-800":"border-slate-200 bg-white text-slate-500 hover:bg-slate-50 hover:text-slate-800"}`,children:(0,t.jsx)(gR,{className:"h-4 w-4",strokeWidth:1.75})})]}),F&&(0,t.jsx)("header",{className:"border-b border-slate-200 px-6 py-4 flex items-center h-16 pr-14",children:(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,t.jsx)("button",{onClick:()=>B(null),className:"p-1.5 text-slate-400 hover:text-indigo-600 hover:bg-zinc-100 rounded-lg transition-all active:scale-95 flex-shrink-0",title:"Back to main feed",children:(0,t.jsx)(gP.ChevronLeft,{size:22,strokeWidth:2.5})}),(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("h2",{className:"text-[15px] font-bold text-slate-900 tracking-tight leading-tight truncate max-w-[240px]",children:eS}),(0,t.jsx)("div",{className:"flex -space-x-1.5 ml-1 flex-shrink-0",children:ev.map(e=>(0,t.jsx)("img",{src:`https://api.dicebear.com/9.x/bottts-neutral/svg?seed=${e.id}&backgroundColor=${e.color?e.color.replace("#",""):"e2e8f0"}`,alt:e.name,className:"w-5 h-5 rounded-full border-2 border-white shadow-sm ring-1 ring-slate-200 object-cover",title:e.name},e.id))})]}),(0,t.jsxs)("div",{className:"text-[11px] text-slate-500 font-medium flex items-center gap-1.5",children:[(0,t.jsxs)("span",{className:"opacity-80",children:[ev.length," agents"]}),(0,t.jsx)("span",{className:"w-0.5 h-0.5 rounded-full bg-slate-300"}),(0,t.jsxs)("span",{className:"opacity-80",children:["Updated ",function(e){if(!e)return"recently";let t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e)}(ew)]})]})]})]})}),m?(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center px-4 text-sm text-zinc-500",children:"Loading your last workspace…"}):(0,t.jsx)("div",{className:"flex flex-1 min-h-0 bg-slate-50 relative",children:(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-w-0",children:[!F&&eY,ex?(0,t.jsx)(iX,{query:ey,results:H,total:q,participants:N,threadTitleById:eb,isLoading:K,error:G,onSelectResult:e_}):F?(0,t.jsx)(iJ,{messages:y,streaming:x,participants:N,rootMessageId:F,onClose:()=>B(null),onCopyThread:ej,onAddToChat:eT,onDeleteThreadRoot:eH,highlightedMessageId:X||void 0,renderReplyComposer:eq}):(0,t.jsx)(iW,{messages:y,streaming:x,participants:N,onOpenThread:eL,onCopyThread:ej,onAddToChat:eT,onDeleteThreadRoot:eH,onSummarize:eI,onCreateTasks:eD,onUpdateTaskDraft:eR,onBuildTasks:eP,summarizingThreads:Z,extractingTasks:es,buildingDrafts:ea,taskDrafts:er,deletingThreadRootId:et,highlightedMessageId:X}),!ex&&!F&&(0,t.jsx)(gf,{onSend:eB,onStop:C,loading:b,participants:ek,messages:y,commands:eU,pendingThreadInsert:eM,onClearPendingThread:()=>eN(null)})]})})]}),(0,t.jsx)(gm,{logs:v,participants:N,onClear:()=>void S(o),open:P,onToggle:()=>z(!1)})]})}e.s(["ChatContainer",()=>gF],26341)}]);