ocean-brain 0.8.0 → 0.8.1

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 (244) hide show
  1. package/package.json +3 -2
  2. package/server/client/dist/assets/{ArrowRight.es-C4zlc54Z.js → ArrowRight.es-CbA8ey6a.js} +1 -1
  3. package/server/client/dist/assets/{Calendar-COrN6Hjv.js → Calendar-CgWgr1BV.js} +1 -1
  4. package/server/client/dist/assets/{Callout-BK0K9E74.js → Callout-DKruIT0f.js} +1 -1
  5. package/server/client/dist/assets/{Copy.es-zm8f_XXX.js → Copy.es-DFbgpaNJ.js} +1 -1
  6. package/server/client/dist/assets/{Graph-BH1fzhue.js → Graph-kCltGRlY.js} +1 -1
  7. package/server/client/dist/assets/{Image-KXuHOG4b.js → Image-7W0DZwMo.js} +1 -1
  8. package/server/client/dist/assets/{Image.es-BKahRbIm.js → Image.es-5pXLx9TU.js} +1 -1
  9. package/server/client/dist/assets/Note-BW6Np_5g.js +20 -0
  10. package/server/client/dist/assets/{Plus.es-BqeC8T8h.js → Plus.es-B0sg64VJ.js} +1 -1
  11. package/server/client/dist/assets/{Reminders-BYG5rz1M.js → Reminders-C10fHQcl.js} +1 -1
  12. package/server/client/dist/assets/{Search-DBWsIMDP.js → Search-tf2nV4v0.js} +1 -1
  13. package/server/client/dist/assets/{SurfaceCard-CNSQfYfM.js → SurfaceCard-pydtvHfu.js} +1 -1
  14. package/server/client/dist/assets/{Tag-5aCfSO8Y.js → Tag-uCoYbISy.js} +1 -1
  15. package/server/client/dist/assets/{TagNotes-BPZjN-6l.js → TagNotes-CqOcQiRw.js} +1 -1
  16. package/server/client/dist/assets/{Trash.es-CRQkTnXZ.js → Trash.es-w32Goxfa.js} +1 -1
  17. package/server/client/dist/assets/{ViewNotes-DGLNF96x.js → ViewNotes-slPXXoOY.js} +1 -1
  18. package/server/client/dist/assets/{ViewSectionDialog-CzskgmMF.js → ViewSectionDialog-brTrsF6G.js} +1 -1
  19. package/server/client/dist/assets/{Views-DR5jT23G.js → Views-B_wsb-XJ.js} +1 -1
  20. package/server/client/dist/assets/{graph-vendor-UTvF2NS_.js → graph-vendor-BAF95C0g.js} +1 -1
  21. package/server/client/dist/assets/{image.api-8dlMwzMd.js → image.api-CYsjXiMr.js} +1 -1
  22. package/server/client/dist/assets/{index-VHp17GQX.js → index-BR05aSXr.js} +4 -4
  23. package/server/client/dist/assets/{index-DGIAh3ZY.js → index-D83QbOcw.js} +1 -1
  24. package/server/client/dist/assets/{index-BEUqDuAZ.css → index-DPI6YoDt.css} +1 -1
  25. package/server/client/dist/assets/{manage-image-RqtWKas2.js → manage-image-BYIhWu56.js} +1 -1
  26. package/server/client/dist/assets/{manage-image-detail-BTSIbLlQ.js → manage-image-detail-6KgmQvbN.js} +1 -1
  27. package/server/client/dist/assets/{mcp-EDurbggR.js → mcp-Dd98N9Hq.js} +2 -2
  28. package/server/client/dist/assets/{mcp-admin-adapter-DmGUo5G8.js → mcp-admin-adapter-DOgBsYpl.js} +1 -1
  29. package/server/client/dist/assets/note-core-CMGUaW1v.js +176 -0
  30. package/server/client/dist/assets/note-vendor-Hoz9Q4-4.js +54 -0
  31. package/server/client/dist/assets/{placeholder-DeKgSBnC.js → placeholder-siHGg9aK.js} +4 -4
  32. package/server/client/dist/assets/{properties-BjrZvOYn.js → properties-CyVRKgcT.js} +1 -1
  33. package/server/client/dist/assets/{tag.api-Dl8DQd0m.js → tag.api-CwmC8crB.js} +1 -1
  34. package/server/client/dist/assets/{trash-C5ntddLu.js → trash-wojQBK9Z.js} +1 -1
  35. package/server/client/dist/assets/{useReminderMutate-CoXXqJY2.js → useReminderMutate-DuVKxpBh.js} +1 -1
  36. package/server/client/dist/index.html +5 -5
  37. package/server/dist/app.js +0 -1
  38. package/server/dist/features/auth/http/api.js +0 -1
  39. package/server/dist/features/auth/http/login-page.js +272 -5
  40. package/server/dist/features/auth/http/pages.js +20 -3
  41. package/server/dist/features/auth/service.js +3 -2
  42. package/server/dist/features/cache/graphql/cache.field.resolver.js +0 -1
  43. package/server/dist/features/cache/graphql/cache.mutation.resolver.js +0 -1
  44. package/server/dist/features/cache/graphql/cache.query.resolver.js +0 -1
  45. package/server/dist/features/cache/graphql/cache.resolver.js +0 -1
  46. package/server/dist/features/cache/graphql/cache.type-defs.js +0 -1
  47. package/server/dist/features/cache/graphql/index.js +0 -1
  48. package/server/dist/features/image/graphql/image.field.resolver.js +0 -1
  49. package/server/dist/features/image/graphql/image.mutation.resolver.js +0 -1
  50. package/server/dist/features/image/graphql/image.query.resolver.js +0 -1
  51. package/server/dist/features/image/graphql/image.resolver.js +0 -1
  52. package/server/dist/features/image/graphql/image.type-defs.js +0 -1
  53. package/server/dist/features/image/graphql/index.js +0 -1
  54. package/server/dist/features/image/http/upload.js +0 -1
  55. package/server/dist/features/image/services/delete.js +0 -1
  56. package/server/dist/features/image/services/upload.js +0 -1
  57. package/server/dist/features/image/services/validation.js +0 -1
  58. package/server/dist/features/mcp-admin/http/handlers.js +0 -1
  59. package/server/dist/features/mcp-admin/service.js +0 -1
  60. package/server/dist/features/note/graphql/index.js +0 -1
  61. package/server/dist/features/note/graphql/note.field.resolver.js +0 -1
  62. package/server/dist/features/note/graphql/note.mutation.resolver.js +0 -1
  63. package/server/dist/features/note/graphql/note.query.resolver.js +0 -1
  64. package/server/dist/features/note/graphql/note.resolver.js +0 -1
  65. package/server/dist/features/note/graphql/note.type-defs.js +0 -1
  66. package/server/dist/features/note/http/mcp.js +0 -1
  67. package/server/dist/features/note/services/authoring.js +0 -1
  68. package/server/dist/features/note/services/cleanup.js +0 -1
  69. package/server/dist/features/note/services/content-blocks.js +0 -1
  70. package/server/dist/features/note/services/markdown-intent-write.js +0 -1
  71. package/server/dist/features/note/services/markdown-patch.js +0 -1
  72. package/server/dist/features/note/services/properties.js +0 -1
  73. package/server/dist/features/note/services/search-backfill.js +0 -1
  74. package/server/dist/features/note/services/search.js +0 -1
  75. package/server/dist/features/note/services/snapshot.js +0 -1
  76. package/server/dist/features/note/services/tag-filter.js +0 -1
  77. package/server/dist/features/note/services/trash.js +0 -1
  78. package/server/dist/features/note/services/write-conflict.js +0 -1
  79. package/server/dist/features/note/services/write.js +0 -1
  80. package/server/dist/features/placeholder/graphql/index.js +0 -1
  81. package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js +0 -1
  82. package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js +0 -1
  83. package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js +0 -1
  84. package/server/dist/features/placeholder/graphql/placeholder.resolver.js +0 -1
  85. package/server/dist/features/placeholder/graphql/placeholder.type-defs.js +0 -1
  86. package/server/dist/features/reminder/graphql/index.js +0 -1
  87. package/server/dist/features/reminder/graphql/reminder.field.resolver.js +0 -1
  88. package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js +0 -1
  89. package/server/dist/features/reminder/graphql/reminder.query.resolver.js +0 -1
  90. package/server/dist/features/reminder/graphql/reminder.resolver.js +0 -1
  91. package/server/dist/features/reminder/graphql/reminder.type-defs.js +0 -1
  92. package/server/dist/features/tag/graphql/index.js +0 -1
  93. package/server/dist/features/tag/graphql/tag.field.resolver.js +0 -1
  94. package/server/dist/features/tag/graphql/tag.mutation.resolver.js +0 -1
  95. package/server/dist/features/tag/graphql/tag.query.resolver.js +0 -1
  96. package/server/dist/features/tag/graphql/tag.resolver.js +0 -1
  97. package/server/dist/features/tag/graphql/tag.type-defs.js +0 -1
  98. package/server/dist/features/tag/http/mcp.js +0 -1
  99. package/server/dist/features/tag/services/organization.js +0 -1
  100. package/server/dist/features/view/graphql/index.js +0 -1
  101. package/server/dist/features/view/graphql/view.mutation.resolver.js +0 -1
  102. package/server/dist/features/view/graphql/view.query.resolver.js +0 -1
  103. package/server/dist/features/view/graphql/view.resolver.js +0 -1
  104. package/server/dist/features/view/graphql/view.type-defs.js +0 -1
  105. package/server/dist/features/view/services/workspace.js +0 -1
  106. package/server/dist/main.js +0 -1
  107. package/server/dist/models.js +0 -1
  108. package/server/dist/modules/app-version.js +0 -1
  109. package/server/dist/modules/auth-guard.js +0 -1
  110. package/server/dist/modules/auth-mode.js +0 -1
  111. package/server/dist/modules/auth-redirect.js +0 -1
  112. package/server/dist/modules/blocknote-markdown-editor.js +53 -0
  113. package/server/dist/modules/blocknote-tree.js +0 -1
  114. package/server/dist/modules/blocknote.js +10 -4
  115. package/server/dist/modules/data-maintenance.js +0 -1
  116. package/server/dist/modules/error-handler.js +0 -1
  117. package/server/dist/modules/graphql.js +0 -1
  118. package/server/dist/modules/logger.js +0 -1
  119. package/server/dist/modules/mcp-auth.js +0 -1
  120. package/server/dist/modules/mcp-token.js +0 -1
  121. package/server/dist/modules/prisma-runtime.js +0 -1
  122. package/server/dist/modules/rate-limit.js +0 -1
  123. package/server/dist/modules/recovery-retention.js +0 -1
  124. package/server/dist/modules/server-events-handler.js +0 -1
  125. package/server/dist/modules/server-events.js +0 -1
  126. package/server/dist/modules/session-store.js +0 -1
  127. package/server/dist/modules/use-async.js +0 -1
  128. package/server/dist/paths.js +0 -1
  129. package/server/dist/routes/api.js +0 -1
  130. package/server/dist/routes/auth-pages.js +0 -1
  131. package/server/dist/routes/client.js +0 -1
  132. package/server/dist/routes/graphql.js +0 -1
  133. package/server/dist/routes/index.js +0 -1
  134. package/server/dist/routes/mcp.js +0 -1
  135. package/server/dist/schema/index.js +0 -1
  136. package/server/dist/start.js +0 -1
  137. package/server/dist/types/index.js +0 -1
  138. package/server/dist/types/input.js +0 -1
  139. package/server/client/dist/assets/Note-C143cKKw.js +0 -12
  140. package/server/client/dist/assets/note-core-BklwyZHk.js +0 -180
  141. package/server/client/dist/assets/note-vendor-DkYKUmLo.js +0 -54
  142. package/server/client/dist/fonts/Pretendard-Bold.woff +0 -0
  143. package/server/client/dist/fonts/Pretendard-Regular.woff +0 -0
  144. package/server/dist/app.js.map +0 -1
  145. package/server/dist/features/auth/http/api.js.map +0 -1
  146. package/server/dist/features/auth/http/login-page.js.map +0 -1
  147. package/server/dist/features/auth/http/pages.js.map +0 -1
  148. package/server/dist/features/auth/service.js.map +0 -1
  149. package/server/dist/features/cache/graphql/cache.field.resolver.js.map +0 -1
  150. package/server/dist/features/cache/graphql/cache.mutation.resolver.js.map +0 -1
  151. package/server/dist/features/cache/graphql/cache.query.resolver.js.map +0 -1
  152. package/server/dist/features/cache/graphql/cache.resolver.js.map +0 -1
  153. package/server/dist/features/cache/graphql/cache.type-defs.js.map +0 -1
  154. package/server/dist/features/cache/graphql/index.js.map +0 -1
  155. package/server/dist/features/image/graphql/image.field.resolver.js.map +0 -1
  156. package/server/dist/features/image/graphql/image.mutation.resolver.js.map +0 -1
  157. package/server/dist/features/image/graphql/image.query.resolver.js.map +0 -1
  158. package/server/dist/features/image/graphql/image.resolver.js.map +0 -1
  159. package/server/dist/features/image/graphql/image.type-defs.js.map +0 -1
  160. package/server/dist/features/image/graphql/index.js.map +0 -1
  161. package/server/dist/features/image/http/upload.js.map +0 -1
  162. package/server/dist/features/image/services/delete.js.map +0 -1
  163. package/server/dist/features/image/services/upload.js.map +0 -1
  164. package/server/dist/features/image/services/validation.js.map +0 -1
  165. package/server/dist/features/mcp-admin/http/handlers.js.map +0 -1
  166. package/server/dist/features/mcp-admin/service.js.map +0 -1
  167. package/server/dist/features/note/graphql/index.js.map +0 -1
  168. package/server/dist/features/note/graphql/note.field.resolver.js.map +0 -1
  169. package/server/dist/features/note/graphql/note.mutation.resolver.js.map +0 -1
  170. package/server/dist/features/note/graphql/note.query.resolver.js.map +0 -1
  171. package/server/dist/features/note/graphql/note.resolver.js.map +0 -1
  172. package/server/dist/features/note/graphql/note.type-defs.js.map +0 -1
  173. package/server/dist/features/note/http/mcp.js.map +0 -1
  174. package/server/dist/features/note/services/authoring.js.map +0 -1
  175. package/server/dist/features/note/services/cleanup.js.map +0 -1
  176. package/server/dist/features/note/services/content-blocks.js.map +0 -1
  177. package/server/dist/features/note/services/markdown-intent-write.js.map +0 -1
  178. package/server/dist/features/note/services/markdown-patch.js.map +0 -1
  179. package/server/dist/features/note/services/properties.js.map +0 -1
  180. package/server/dist/features/note/services/search-backfill.js.map +0 -1
  181. package/server/dist/features/note/services/search.js.map +0 -1
  182. package/server/dist/features/note/services/snapshot.js.map +0 -1
  183. package/server/dist/features/note/services/tag-filter.js.map +0 -1
  184. package/server/dist/features/note/services/trash.js.map +0 -1
  185. package/server/dist/features/note/services/write-conflict.js.map +0 -1
  186. package/server/dist/features/note/services/write.js.map +0 -1
  187. package/server/dist/features/placeholder/graphql/index.js.map +0 -1
  188. package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js.map +0 -1
  189. package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js.map +0 -1
  190. package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js.map +0 -1
  191. package/server/dist/features/placeholder/graphql/placeholder.resolver.js.map +0 -1
  192. package/server/dist/features/placeholder/graphql/placeholder.type-defs.js.map +0 -1
  193. package/server/dist/features/reminder/graphql/index.js.map +0 -1
  194. package/server/dist/features/reminder/graphql/reminder.field.resolver.js.map +0 -1
  195. package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js.map +0 -1
  196. package/server/dist/features/reminder/graphql/reminder.query.resolver.js.map +0 -1
  197. package/server/dist/features/reminder/graphql/reminder.resolver.js.map +0 -1
  198. package/server/dist/features/reminder/graphql/reminder.type-defs.js.map +0 -1
  199. package/server/dist/features/tag/graphql/index.js.map +0 -1
  200. package/server/dist/features/tag/graphql/tag.field.resolver.js.map +0 -1
  201. package/server/dist/features/tag/graphql/tag.mutation.resolver.js.map +0 -1
  202. package/server/dist/features/tag/graphql/tag.query.resolver.js.map +0 -1
  203. package/server/dist/features/tag/graphql/tag.resolver.js.map +0 -1
  204. package/server/dist/features/tag/graphql/tag.type-defs.js.map +0 -1
  205. package/server/dist/features/tag/http/mcp.js.map +0 -1
  206. package/server/dist/features/tag/services/organization.js.map +0 -1
  207. package/server/dist/features/view/graphql/index.js.map +0 -1
  208. package/server/dist/features/view/graphql/view.mutation.resolver.js.map +0 -1
  209. package/server/dist/features/view/graphql/view.query.resolver.js.map +0 -1
  210. package/server/dist/features/view/graphql/view.resolver.js.map +0 -1
  211. package/server/dist/features/view/graphql/view.type-defs.js.map +0 -1
  212. package/server/dist/features/view/services/workspace.js.map +0 -1
  213. package/server/dist/main.js.map +0 -1
  214. package/server/dist/models.js.map +0 -1
  215. package/server/dist/modules/app-version.js.map +0 -1
  216. package/server/dist/modules/auth-guard.js.map +0 -1
  217. package/server/dist/modules/auth-mode.js.map +0 -1
  218. package/server/dist/modules/auth-redirect.js.map +0 -1
  219. package/server/dist/modules/blocknote-tree.js.map +0 -1
  220. package/server/dist/modules/blocknote.js.map +0 -1
  221. package/server/dist/modules/data-maintenance.js.map +0 -1
  222. package/server/dist/modules/error-handler.js.map +0 -1
  223. package/server/dist/modules/graphql.js.map +0 -1
  224. package/server/dist/modules/logger.js.map +0 -1
  225. package/server/dist/modules/mcp-auth.js.map +0 -1
  226. package/server/dist/modules/mcp-token.js.map +0 -1
  227. package/server/dist/modules/prisma-runtime.js.map +0 -1
  228. package/server/dist/modules/rate-limit.js.map +0 -1
  229. package/server/dist/modules/recovery-retention.js.map +0 -1
  230. package/server/dist/modules/server-events-handler.js.map +0 -1
  231. package/server/dist/modules/server-events.js.map +0 -1
  232. package/server/dist/modules/session-store.js.map +0 -1
  233. package/server/dist/modules/use-async.js.map +0 -1
  234. package/server/dist/paths.js.map +0 -1
  235. package/server/dist/routes/api.js.map +0 -1
  236. package/server/dist/routes/auth-pages.js.map +0 -1
  237. package/server/dist/routes/client.js.map +0 -1
  238. package/server/dist/routes/graphql.js.map +0 -1
  239. package/server/dist/routes/index.js.map +0 -1
  240. package/server/dist/routes/mcp.js.map +0 -1
  241. package/server/dist/schema/index.js.map +0 -1
  242. package/server/dist/start.js.map +0 -1
  243. package/server/dist/types/index.js.map +0 -1
  244. package/server/dist/types/input.js.map +0 -1
@@ -0,0 +1,176 @@
1
+ import{g as sb}from"./graph-vendor-BAF95C0g.js";const SS="modulepreload",xS=function(t){return"/"+t},rp={},ip=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=s?.nonce||s?.getAttribute("nonce");i=l(n.map(u=>{if(u=xS(u),u in rp)return;rp[u]=!0;const c=u.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":SS,c||(h.as="script"),h.crossOrigin="",h.href=u,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})},Mi=new WeakMap,Aa=new WeakMap,Ya={current:[]};let xu=!1;const Qs=new Set,op=new Map;function ab(t){const e=Array.from(t).sort((n,r)=>n instanceof Oi&&n.options.deps.includes(r)?1:r instanceof Oi&&r.options.deps.includes(n)?-1:0);for(const n of e){if(Ya.current.includes(n))continue;Ya.current.push(n),n.recompute();const r=Aa.get(n);if(r)for(const i of r){const o=Mi.get(i);o&&ab(o)}}}function wS(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function AS(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function _S(t){if(Qs.add(t),!xu)try{for(xu=!0;Qs.size>0;){const e=Array.from(Qs);Qs.clear();for(const n of e){const r=op.get(n)??n.prevState;n.prevState=r,wS(n)}for(const n of e){const r=Mi.get(n);r&&(Ya.current.push(n),ab(r))}for(const n of e){const r=Mi.get(n);if(r)for(const i of r)AS(i)}}}finally{xu=!1,Ya.current=[],op.clear()}}function NS(t){return typeof t=="function"}class Lc{constructor(e,n){this.listeners=new Set,this.subscribe=r=>{var i,o;this.listeners.add(r);const s=(o=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:o.call(i,r,this);return()=>{this.listeners.delete(r),s?.()}},this.prevState=e,this.state=e,this.options=n}setState(e){var n,r,i;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(e):NS(e)?this.state=e(this.prevState):this.state=e,(i=(r=this.options)==null?void 0:r.onUpdate)==null||i.call(r),_S(this)}}class Oi{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),i=new Array(n);for(let o=0;o<n;o++){const s=this.options.deps[o];r[o]=s.prevState,i[o]=s.state}return this.lastSeenDepValues=i,{prevDepVals:r,currDepVals:i,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const i=this.getDepVals();this.state=this.options.fn(i),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const o of this.options.deps)o instanceof Oi&&o.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let o=0;o<i.length;o++)if(i[o]!==r[o]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,i;this.listeners.add(n);const o=(i=(r=this.options).onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),o?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(const n of e)if(n instanceof Oi)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof Lc){let r=Mi.get(n);r||(r=new Set,Mi.set(n,r)),r.add(this);let i=Aa.get(this);i||(i=new Set,Aa.set(this,i)),i.add(n)}}unregisterFromGraph(e=this.options.deps){for(const n of e)if(n instanceof Oi)this.unregisterFromGraph(n.options.deps);else if(n instanceof Lc){const r=Mi.get(n);r&&r.delete(this);const i=Aa.get(this);i&&i.delete(n)}}}var Rc=Symbol("originalFactory");function de(t){if(typeof t=="object"&&"key"in t)return function e(){return t[Rc]=e,t};if(typeof t!="function")throw Error("factory must be a function");return function e(n){return r=>{let i=t({editor:r.editor,options:n});return i[Rc]=e,i}}}function ai(t,e){return new Lc(t,e)}function Qe(t){this.content=t}Qe.prototype={constructor:Qe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new Qe(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Qe(n)},addToStart:function(t,e){return new Qe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Qe(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new Qe(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Qe.from(t),t.size?new Qe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Qe.from(t),t.size?new Qe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Qe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Qe.from=function(t){if(t instanceof Qe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Qe(e)};function lb(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=lb(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function ub(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let u=ub(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new M(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new M(r,i)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new M(i,o)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return lb(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ub(this,e,n,r)}findIndex(e){if(e==0)return Xs(0,e);if(e==this.size)return Xs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?Xs(n+1,o):Xs(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return M.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const wu={index:0,offset:0};function Xs(t,e){return wu.index=t,wu.offset=e,wu}function Ga(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ga(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ga(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ee=class Pc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ga(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Pc.none;if(e instanceof Pc)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Ee.none=[];class Ka extends Error{}class B{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=db(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,n){return new B(cb(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return B.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(M.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new B(e,r,i)}}B.empty=new B(M.empty,0,0);function cb(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(cb(o.content,e-i-1,n-i-1)))}function db(t,e,n,r,i,o){let{index:s,offset:a}=t.findIndex(e),l=t.maybeChild(s);if(a==e||l.isText)return o&&r<=0&&i<=0&&!o.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=db(l.content,e-a-1,n,s==0?r-1:0,s==t.childCount-1?i-1:0,l);return u&&t.replaceChild(s,l.copy(u))}function IS(t,e,n){if(n.openStart>t.depth)throw new Ka("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ka("Inconsistent open depths");return hb(t,e,n,0)}function hb(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=hb(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Hr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=MS(n,t);return Hr(o,pb(t,s,a,e,r))}else return Hr(o,Qa(t,e,r))}function fb(t,e){if(!e.type.compatibleContent(t.type))throw new Ka("Cannot join "+e.type.name+" onto "+t.type.name)}function Bc(t,e,n){let r=t.node(n);return fb(r,e.node(n)),r}function Fr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Bo(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Fr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Fr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Fr(e.nodeBefore,r)}function Hr(t,e){return t.type.checkContent(e),t.copy(e)}function pb(t,e,n,r,i){let o=t.depth>i&&Bc(t,e,i+1),s=r.depth>i&&Bc(n,r,i+1),a=[];return Bo(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(fb(o,s),Fr(Hr(o,pb(t,e,n,r,i+1)),a)):(o&&Fr(Hr(o,Qa(t,e,i+1)),a),Bo(e,n,i,a),s&&Fr(Hr(s,Qa(n,r,i+1)),a)),Bo(r,null,i,a),new M(a)}function Qa(t,e,n){let r=[];if(Bo(null,t,n,r),t.depth>n){let i=Bc(t,e,n+1);Fr(Hr(i,Qa(t,e,n+1)),r)}return Bo(e,null,n,r),new M(r)}function MS(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(M.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Zo{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ee.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new es(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),u=o-l;if(r.push(s,a,i+l),!u||(s=s.child(a),s.isText))break;o=u-1,i+=l+1}return new Zo(n,r,o)}static resolveCached(e,n){let r=sp.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else sp.set(e,r=new OS);let i=r.elts[r.i]=Zo.resolve(e,n);return r.i=(r.i+1)%DS,i}}class OS{constructor(){this.elts=[],this.i=0}}const DS=12,sp=new WeakMap;class es{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const vS=Object.create(null);let Un=class Fc{constructor(e,n,r,i=Ee.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ga(this.attrs,n||e.defaultAttrs||vS)&&Ee.sameSet(this.marks,r||Ee.none)}copy(e=null){return e==this.content?this:new Fc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return B.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),u=i.node(s).content.cut(i.pos-a,o.pos-a);return new B(u,i.depth-s,o.depth-s)}replace(e,n,r){return IS(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Zo.resolveCached(this,e)}resolveNoCache(e){return Zo.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),mb(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ee.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ee.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=M.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Un.prototype.text=void 0;class Xa extends Un{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):mb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Xa(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xa(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function mb(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new LS(e,n);if(r.next==null)return Wr.empty;let i=gb(r);r.next&&r.err("Unexpected trailing text");let o=$S(US(i));return zS(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return M.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(c));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
2
+ `)}}Wr.empty=new Wr(!0);class LS{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function gb(t){let e=[];do e.push(RS(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function RS(t){let e=[];do e.push(PS(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function PS(t){let e=HS(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=BS(t,e);else break;return e}function ap(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function BS(t,e){let n=ap(t),r=n;return t.eat(",")&&(t.next!="}"?r=ap(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function FS(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function HS(t){if(t.eat("(")){let e=gb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=FS(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function US(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(o(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=o(s.exprs[l],a);if(l==s.exprs.length-1)return u;i(u,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u<s.min;u++){let c=n();i(o(s.expr,l),c),l=c}if(s.max==-1)i(o(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),i(o(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function bb(t,e){return e-t}function lp(t,e){let n=[];return r(e),n.sort(bb);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l)}}}function $S(t){let e=Object.create(null);return n(lp(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);lp(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new Wr(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(bb);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function zS(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(u)==-1&&r.push(u)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function yb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Eb(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function kb(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function Tb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new qS(t,r,e[r]);return n}let up=class Cb{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Tb(e,r.attrs),this.defaultAttrs=yb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Wr.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:Eb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Un(this,this.computeAttrs(e),M.from(n),Ee.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new Un(this,this.computeAttrs(e),n,Ee.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(M.empty,!0);return o?new Un(this,e,n.append(o),Ee.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){kb(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ee.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Cb(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function VS(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class qS{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?VS(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ol{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Tb(e,i.attrs),this.excluded=null;let o=yb(this.attrs);this.instance=o?new Ee(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ee(this,Eb(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Ol(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){kb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Sb=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Qe.from(e.nodes),n.marks=Qe.from(e.marks||{}),this.nodes=up.compile(this.spec.nodes,this),this.marks=Ol.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Wr.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?cp(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:cp(this,s.split(" "))}this.nodeFromJSON=i=>Un.fromJSON(this,i),this.markFromJSON=i=>Ee.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof up){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Xa(r,r.defaultAttrs,e,Ee.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function cp(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function jS(t){return t.tag!=null}function WS(t){return t.style!=null}let Vt=class Hc{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(jS(i))this.tags.push(i);else if(WS(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new hp(this,n,!1);return r.addAll(e,Ee.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new hp(this,n,!0);return r.addAll(e,Ee.none,n.from,n.to),B.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(KS(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=fp(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=fp(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Hc(e,Hc.schemaRules(e)))}};const xb={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},YS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},wb={ol:!0,ul:!0},ts=1,Uc=2,Fo=4;function dp(t,e,n){return e!=null?(e?ts:0)|(e==="full"?Uc:0):t&&t.whitespace=="pre"?ts|Uc:n&~Fo}class Js{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Ee.none,this.match=o||(s&Fo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ts)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!xb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class hp{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=dp(null,n.preserveWhitespace,0)|(r?Fo:0);i?o=new Js(i.type,i.attrs,Ee.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Js(null,null,Ee.none,!0,null,s):o=new Js(e.schema.topNodeType,null,Ee.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&Uc?"full":this.localPreserveWS||(i.options&ts)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;wb.hasOwnProperty(s)&&this.parser.normalizeLists&&GS(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:YS.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(xb.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),u=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(o),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,o=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=Ee.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):pp(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=dp(e,o,s.options);s.options&Fo&&s.content.length==0&&(a|=Fo);let l=Ee.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):pp(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Js(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ts)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function GS(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&wb.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function KS(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function fp(t){let e={};for(let n in t)e[n]=t[n];return e}function pp(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||o.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class Lt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Zs(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(o[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(o.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return Zs(n).createTextNode(e.text);let{dom:r,contentDOM:i}=_a(Zs(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&_a(Zs(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:_a(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Lt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=mp(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return mp(e.marks)}}function mp(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Zs(t){return t.document||window.document}const gp=new WeakMap;function QS(t){let e=gp.get(t);return e===void 0&&gp.set(t,e=XS(t)),e}function XS(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function _a(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=QS(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof h=="string")l.appendChild(t.createTextNode(h));else{let{dom:f,contentDOM:p}=_a(t,h,n,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Ab=65535,_b=Math.pow(2,16);function JS(t,e){return t+e*_b}function bp(t){return t&Ab}function ZS(t){return(t-(t&Ab))/_b}const Nb=1,Ib=2,Na=4,Mb=8;class $c{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Mb)>0}get deletedBefore(){return(this.delInfo&(Nb|Na))>0}get deletedAfter(){return(this.delInfo&(Ib|Na))>0}get deletedAcross(){return(this.delInfo&Na)>0}}class Mt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Mt.empty)return Mt.empty}recover(e){let n=0,r=bp(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+ZS(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:n:n,f=l+i+(h<0?0:c);if(r)return f;let p=e==(n<0?l:d)?null:JS(a/3,e-l),g=e==l?Ib:e==d?Nb:Na;return(n<0?e!=l:e!=d)&&(g|=Mb),new $c(f,g,p)}i+=c-u}return r?e+i:new $c(e+i,0,null)}touches(e,n){let r=0,i=bp(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+o],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+n],c=this.ranges[i+r];e(a,a+u,l,l+c),o+=c-u}}invert(){return new Mt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Mt.empty:new Mt(e<0?[0,-e,0]:[0,0,e])}}Mt.empty=new Mt([]);class zi{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new zi(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new zi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new $c(e,i,null)}}const Au=Object.create(null);class ut{getMap(){return Mt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Au[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Au)throw new RangeError("Duplicate use of step JSON ID "+e);return Au[e]=n,n.prototype.jsonID=e,n}}class Re{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Re(e,null)}static fail(e){return new Re(null,e)}static fromReplace(e,n,r,i){try{return Re.ok(e.replace(n,r,i))}catch(o){if(o instanceof Ka)return Re.fail(o.message);throw o}}}function nh(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(nh(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return M.fromArray(r)}class sr extends ut{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new B(nh(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Re.fromReplace(e,this.from,this.to,o)}invert(){return new nn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sr(n.pos,r.pos,this.mark)}merge(e){return e instanceof sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new sr(n.from,n.to,e.markFromJSON(n.mark))}}ut.jsonID("addMark",sr);class nn extends ut{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new B(nh(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Re.fromReplace(e,this.from,this.to,r)}invert(){return new sr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new nn(n.pos,r.pos,this.mark)}merge(e){return e instanceof nn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nn(n.from,n.to,e.markFromJSON(n.mark))}}ut.jsonID("removeMark",nn);class ar extends ut{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Re.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Re.fromReplace(e,this.pos,this.pos+1,new B(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new ar(this.pos,n.marks[i]);return new ar(this.pos,this.mark)}}return new Yr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ar(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ar(n.pos,e.markFromJSON(n.mark))}}ut.jsonID("addNodeMark",ar);class Yr extends ut{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Re.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Re.fromReplace(e,this.pos,this.pos+1,new B(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ar(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Yr(n.pos,e.markFromJSON(n.mark))}}ut.jsonID("removeNodeMark",Yr);class Ne extends ut{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&zc(e,this.from,this.to)?Re.fail("Structure replace would overwrite content"):Re.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Mt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ne(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Ne.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Ne(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ne)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ne(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ne(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ne(n.from,n.to,B.fromJSON(e,n.slice),!!n.structure)}}Ne.MAP_BIAS=1;ut.jsonID("replace",Ne);class Me extends ut{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(zc(e,this.from,this.gapFrom)||zc(e,this.gapTo,this.to)))return Re.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Re.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Re.fromReplace(e,this.from,this.to,r):Re.fail("Content does not fit in gap")}getMap(){return new Mt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Me(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Me(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Me(n.from,n.to,n.gapFrom,n.gapTo,B.fromJSON(e,n.slice),n.insert,!!n.structure)}}ut.jsonID("replaceAround",Me);function zc(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function ex(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,e),f=Math.min(u+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==h&&s.mark.eq(d[g])?s.to=f:i.push(s=new nn(h,f,d[g])));a&&a.to==h?a.to=f:o.push(a=new sr(h,f,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function tx(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof Ol){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==o-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=u,h.step=o):i.push({style:d,from:Math.max(a,e),to:u,step:o})}}}),i.forEach(s=>t.step(new nn(s.from,s.to,s.style)))}function rh(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let u=o.child(l),c=a+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new Ne(a,c,B.empty));else{r=d;for(let h=0;h<u.marks.length;h++)n.allowsMarkType(u.marks[h].type)||t.step(new nn(a,c,u.marks[h]));if(i&&u.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(u.text);)p||(p=new B(M.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new Ne(a+h.index,a+h.index+h[0].length,p))}}a=c}if(!r.validEnd){let l=r.fillBefore(M.empty,!0);t.replace(a,a,new B(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function nx(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function li(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-o;if(r<t.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!nx(s,a,l))break;a&&(i=1),l<s.childCount&&(o=1)}return null}function rx(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,u=a,c=M.empty,d=0;for(let p=o,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,c=M.from(r.node(p).copy(c)),d++):l--;let h=M.empty,f=0;for(let p=o,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,h=M.from(i.node(p).copy(h)),f++):u++;t.step(new Me(l,u,s,a,new B(c.append(h),d,f),c.size-d,!0))}function Ob(t,e,n=null,r=t){let i=ix(t,e),o=i&&ox(r,e);return o?i.map(yp).concat({type:e,attrs:n}).concat(o.map(yp)):null}function yp(t){return{type:t,attrs:null}}function ix(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function ox(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:s}function sx(t,e,n){let r=M.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Me(i,o,i,o,new B(r,0,0),n.length,!0))}function ax(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&lx(t.doc,t.mapping.slice(o).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?u=!1:!f&&p&&(u=!0)}u===!1&&vb(t,s,a,o),rh(t,t.mapping.slice(o).map(a,1),r,void 0,u===null);let c=t.mapping.slice(o),d=c.map(a,1),h=c.map(a+s.nodeSize,1);return t.step(new Me(d,h,d+1,h-1,new B(M.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Db(t,s,a,o),!1}})}function Db(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function vb(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
5
+ `))}})}function lx(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function ux(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Me(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(M.from(s),0,0),1,!0))}function $n(t,e,n=1,r){let i=t.resolve(e),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 u=i.depth-1,c=n-2;u>o;u--,c--){let d=i.node(u),h=i.index(u);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[c+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(f))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function cx(t,e,n=1,r){let i=t.doc.resolve(e),o=M.empty,s=M.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){o=M.from(i.node(a).copy(o));let c=r&&r[u];s=M.from(c?c.type.create(c.attrs,s):i.node(a).copy(s))}t.step(new Ne(e,e,new B(o.append(s),n,n),!0))}function xr(t,e){let n=t.resolve(e),r=n.index();return Lb(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dx(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function Lb(t,e){return!!(t&&e&&!t.isLeaf&&dx(t,e))}function Dl(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Lb(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function hx(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let c=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);vb(t,c.node(),c.before(),a)}s.inlineContent&&rh(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),u=l.map(e-n);if(t.step(new Ne(u,l.map(e+n,-1),B.empty,!0)),r===!0){let c=t.doc.resolve(u);Db(t,c.node(),c.before(),t.steps.length)}return t}function fx(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Rb(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),u=r.node(s),c=!1;if(o==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function vl(t,e,n=e,r=B.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Pb(i,o,r)?new Ne(e,n,r):new px(i,o,r).fit()}function Pb(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class px{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=M.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new B(o,s,a);return e>-1?new Me(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ne(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=_u(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(n==1&&(s?u.matchType(s.type)||(d=u.fillBefore(M.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:c};if(o&&u.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=_u(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new B(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=_u(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new B(Mo(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new B(Mo(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,u=0,c=[],{match:d,type:h}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)c.push(i.child(g));d=d.matchFragment(i)}let f=a.size+e-(s.content.size-s.openEnd);for(;u<a.childCount;){let g=a.child(u),y=d.matchType(g.type);if(!y)break;u++,(u>1||l==0||g.content.size)&&(d=y,c.push(Bb(g.mark(h.allowedMarks(g.marks)),u==1?l:0,u==a.childCount?f:-1)))}let p=u==a.childCount;p||(f=-1),this.placed=Oo(this.placed,n,M.from(c)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<f;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=p?e==0?B.empty:new B(Mo(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new B(Mo(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Nu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Nu(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=Nu(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Oo(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Oo(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=Oo(this.placed,this.frontier.length,n))}}function Mo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Mo(t.firstChild.content,e-1,n)))}function Oo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Oo(t.lastChild.content,e-1,n)))}function _u(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Bb(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Bb(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),t.copy(r)}function Nu(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!mx(n,o.content,s)?a:null}function mx(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function gx(t){return t.spec.defining||t.spec.definingForContent}function bx(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Pb(i,o,r))return t.step(new Ne(e,n,r));let s=Hb(i,o);s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(h)>-1?a=h:i.before(h)==f&&s.splice(1,0,-h)}let l=s.indexOf(a),u=[],c=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(u.push(p),f==r.openStart)break;h=p.content}for(let h=c-1;h>=0;h--){let f=u[h],p=gx(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),p=u[f];if(p)for(let g=0;g<s.length;g++){let y=s[(g+l)%s.length],b=!0;y<0&&(b=!1,y=-y);let C=i.node(y-1),w=i.index(y-1);if(C.canReplaceWith(w,w,p.type,p.marks))return t.replace(i.before(y),b?o.after(y):n,new B(Fb(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=s.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=s[h];f<0||(e=i.before(f),n=o.after(f))}}function Fb(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Fb(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(M.empty,!0))}return t}function yx(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=fx(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new B(M.from(r),0,0))}function Ex(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let s=r.sharedDepth(n),a=!1;for(let l=r.depth;l>s;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>s;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let o=Hb(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Hb(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class Di extends ut{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Re.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Re.fromReplace(e,this.pos,this.pos+1,new B(M.from(i),0,n.isLeaf?0:1))}getMap(){return Mt.empty}invert(e){return new Di(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Di(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Di(n.pos,n.attr,n.value)}}ut.jsonID("attr",Di);class ns extends ut{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Re.ok(r)}getMap(){return Mt.empty}invert(e){return new ns(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ns(n.attr,n.value)}}ut.jsonID("docAttr",ns);let Vi=class extends Error{};Vi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Vi.prototype=Object.create(Error.prototype);Vi.prototype.constructor=Vi;Vi.prototype.name="TransformError";class ih{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Vi(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((o,s,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=B.empty){let i=vl(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new B(M.from(r),0,0))}delete(e,n){return this.replace(e,n,B.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return bx(this,e,n,r),this}replaceRangeWith(e,n,r){return yx(this,e,n,r),this}deleteRange(e,n){return Ex(this,e,n),this}lift(e,n){return rx(this,e,n),this}join(e,n=1){return hx(this,e,n),this}wrap(e,n){return sx(this,e,n),this}setBlockType(e,n=e,r,i=null){return ax(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return ux(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Di(e,n,r)),this}setDocAttribute(e,n){return this.step(new ns(e,n)),this}addNodeMark(e,n){return this.step(new ar(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Ee)n.isInSet(r.marks)&&this.step(new Yr(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new Yr(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return cx(this,e,n,r),this}addMark(e,n,r){return ex(this,e,n,r),this}removeMark(e,n,r){return tx(this,e,n,r),this}clearIncompatible(e,n,r){return rh(this,e,n,r),this}}const Iu=Object.create(null);class G{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Ub(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=B.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:u}=s[a],c=e.mapping.slice(o);e.replaceRange(c.map(l.pos),c.map(u.pos),a?B.empty:n),a==0&&Tp(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),u=l.map(s.pos),c=l.map(a.pos);o?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),Tp(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new $(e):Si(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Si(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Si(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ct(e.node(0))}static atStart(e){return Si(e,e,0,0,1)||new Ct(e)}static atEnd(e){return Si(e,e,e.content.size,e.childCount,-1)||new Ct(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Iu[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Iu)throw new RangeError("Duplicate use of selection JSON ID "+e);return Iu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return $.between(this.$anchor,this.$head).getBookmark()}}G.prototype.visible=!0;class Ub{constructor(e,n){this.$from=e,this.$to=n}}let Ep=!1;function kp(t){!Ep&&!t.parent.inlineContent&&(Ep=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class $ extends G{constructor(e,n=e){kp(e),kp(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return G.near(r);let i=e.resolve(n.map(this.anchor));return new $(i.parent.inlineContent?i:r,r)}replace(e,n=B.empty){if(super.replace(e,n),n==B.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof $&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ll(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new $(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=G.findFrom(n,r,!0)||G.findFrom(n,-r,!0);if(o)n=o.$head;else return G.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(G.findFrom(e,-r,!0)||G.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new $(e,n)}}G.jsonID("text",$);class Ll{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ll(e.map(this.anchor),e.map(this.head))}resolve(e){return $.between(e.resolve(this.anchor),e.resolve(this.head))}}class q extends G{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?G.near(o):new q(o)}content(){return new B(M.from(this.node),0,0)}eq(e){return e instanceof q&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new oh(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new q(e.resolve(n.anchor))}static create(e,n){return new q(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}q.prototype.visible=!1;G.jsonID("node",q);class oh{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ll(r,r):new oh(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&q.isSelectable(r)?new q(n):G.near(n)}}class Ct extends G{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=B.empty){if(n==B.empty){e.delete(0,e.doc.content.size);let r=G.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ct(e)}map(e){return new Ct(e)}eq(e){return e instanceof Ct}getBookmark(){return kx}}G.jsonID("all",Ct);const kx={map(){return this},resolve(t){return new Ct(t)}};function Si(t,e,n,r,i,o=!1){if(e.inlineContent)return $.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&q.isSelectable(a))return q.create(t,n-(i<0?a.nodeSize:0))}else{let l=Si(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function Tp(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Ne||i instanceof Me))return;let o=t.mapping.maps[r],s;o.forEach((a,l,u,c)=>{s==null&&(s=c)}),t.setSelection(G.near(t.doc.resolve(s),n))}const Cp=1,ea=2,Sp=4;let Tx=class extends ih{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Cp)&~ea,this.storedMarks=null,this}get selectionSet(){return(this.updated&Cp)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ea,this}ensureMarks(e){return Ee.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ea)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ea,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ee.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(G.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Sp,this}get scrolledIntoView(){return(this.updated&Sp)>0}};function xp(t,e){return!e||!t?t:t.bind(e)}class Do{constructor(e,n,r){this.name=e,this.init=xp(n.init,r),this.apply=xp(n.apply,r)}}const Cx=[new Do("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Do("selection",{init(t,e){return t.selection||G.atStart(e.doc)},apply(t){return t.selection}}),new Do("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Do("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Mu{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Cx.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Do(r.key,r.spec.state,r))})}}class _i{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,u=i?i[s].state:this,c=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,u,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new _i(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new Tx(this)}static create(e){let n=new Mu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new _i(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Mu(this.schema,e.plugins),r=n.fields,i=new _i(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Mu(e.schema,e.plugins),o=new _i(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Un.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=G.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=u.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function $b(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=$b(i,e,{})),n[r]=i}return n}class re{constructor(e){this.spec=e,this.props={},e.props&&$b(e.props,this,this.props),this.key=e.key?e.key.key:zb("plugin")}getState(e){return e[this.key]}}const Ou=Object.create(null);function zb(t){return t in Ou?t+"$"+ ++Ou[t]:(Ou[t]=0,t+"$")}class he{constructor(e="key"){this.key=zb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const sh=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Vb(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const qb=(t,e,n)=>{let r=Vb(t,n);if(!r)return!1;let i=ah(r);if(!i){let s=r.blockRange(),a=s&&li(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(Zb(t,i,e,-1))return!0;if(r.parent.content.size==0&&(qi(o,"end")||q.isSelectable(o)))for(let s=r.depth;;s--){let a=vl(t.doc,r.before(s),r.after(s),B.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(qi(o,"end")?G.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):q.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Sx=(t,e,n)=>{let r=Vb(t,n);if(!r)return!1;let i=ah(r);return i?jb(t,i,e):!1},xx=(t,e,n)=>{let r=Yb(t,n);if(!r)return!1;let i=lh(r);return i?jb(t,i,e):!1};function jb(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=vl(t.doc,o,l,B.empty);if(!u||u.from!=o||u instanceof Ne&&u.slice.size>=l-o)return!1;if(n){let c=t.tr.step(u);c.setSelection($.create(c.doc,o)),n(c.scrollIntoView())}return!0}function qi(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Wb=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=ah(r)}let s=o&&o.nodeBefore;return!s||!q.isSelectable(s)?!1:(e&&e(t.tr.setSelection(q.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function ah(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Yb(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Gb=(t,e,n)=>{let r=Yb(t,n);if(!r)return!1;let i=lh(r);if(!i)return!1;let o=i.nodeAfter;if(Zb(t,i,e,1))return!0;if(r.parent.content.size==0&&(qi(o,"start")||q.isSelectable(o))){let s=vl(t.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(qi(o,"start")?G.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):q.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Kb=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=lh(r)}let s=o&&o.nodeAfter;return!s||!q.isSelectable(s)?!1:(e&&e(t.tr.setSelection(q.create(t.doc,o.pos)).scrollIntoView()),!0)};function lh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const wx=(t,e)=>{let n=t.selection,r=n instanceof q,i;if(r){if(n.node.isTextblock||!xr(t.doc,n.from))return!1;i=n.from}else if(i=Dl(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(q.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Ax=(t,e)=>{let n=t.selection,r;if(n instanceof q){if(n.node.isTextblock||!xr(t.doc,n.to))return!1;r=n.to}else if(r=Dl(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},_x=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&li(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},Qb=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function uh(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Nx=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=uh(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(G.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Xb=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ct||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=uh(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection($.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},Jb=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if($n(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&li(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Ix(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof q&&e.selection.node.isBlock)return!r.parentOffset||!$n(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,u=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),u=r.start(f)==r.pos-(r.depth-f),a=uh(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),o.unshift(l&&a?{type:a}:null),s=f;break}else{if(f==1)return!1;o.unshift(null)}let c=e.tr;(e.selection instanceof $||e.selection instanceof Ct)&&c.deleteSelection();let d=c.mapping.map(r.pos),h=$n(c.doc,d,o.length,o);if(h||(o[0]=a?{type:a}:null,h=$n(c.doc,d,o.length,o)),!h)return!1;if(c.split(d,o.length,o),!l&&u&&r.node(s).type!=a){let f=c.mapping.map(r.before(s)),p=c.doc.resolve(f);a&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,a)&&c.setNodeMarkup(c.mapping.map(r.before(s)),a)}return n&&n(c.scrollIntoView()),!0}}const Mx=Ix(),Ox=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(q.create(t.doc,i))),!0)};function Dx(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||xr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Zb(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&Dx(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let f=e.pos+o.nodeSize,p=M.empty;for(let b=s.length-1;b>=0;b--)p=M.from(s[b].create(null,p));p=M.from(i.copy(p));let g=t.tr.step(new Me(e.pos-1,f,e.pos,f,new B(p,1,0),s.length,!0)),y=g.doc.resolve(f+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&xr(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let c=o.type.spec.isolating||r>0&&l?null:G.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&li(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(u&&qi(o,"start",!0)&&qi(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let g=o,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(n){let b=M.empty;for(let w=p.length-1;w>=0;w--)b=M.from(p[w].copy(b));let C=t.tr.step(new Me(e.pos-p.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new B(b,p.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function e1(t){return function(e,n){let r=e.selection,i=t<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(e.tr.setSelection($.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const vx=e1(-1),Lx=e1(1);function Rx(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&Ob(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function wp(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];o.setBlockType(a,l,t,e)}r(o.scrollIntoView())}return!0}}function ch(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}ch(sh,qb,Wb);ch(sh,Gb,Kb);ch(Qb,Xb,Jb,Mx);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Px(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let a=r?n.tr:null;return Bx(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Bx(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new es(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new es(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Ob(o,n,r,e);return a?(t&&Fx(t,e,a,i,n),!0):!1}function Fx(t,e,n,r,i){let o=M.empty;for(let c=n.length-1;c>=0;c--)o=M.from(n[c].type.create(n[c].attrs,o));t.step(new Me(e.start-(r?2:0),e.end,e.start,e.end,new B(o,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==i&&(s=c+1);let a=n.length-s,l=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,h=!0;c<d;c++,h=!1)!h&&$n(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function Hx(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?Ux(e,n,t,o):$x(e,n,o):!0:!1}}function Ux(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new Me(o-1,s,o,s,new B(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new es(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=li(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return xr(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function $x(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+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 a=n.startIndex==0,l=n.endIndex==i.childCount,u=o.node(-1),c=o.index(-1);if(!u.canReplace(c+(a?0:1),c+1,s.content.append(l?M.empty:M.from(i))))return!1;let d=o.pos,h=d+s.nodeSize;return r.step(new Me(d-(a?1:0),h+(l?1:0),d+1,h-1,new B((a?M.empty:M.from(i.copy(M.empty))).append(l?M.empty:M.from(i.copy(M.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function zx(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=M.from(u?t.create():null),d=new B(M.from(t.create(null,M.from(a.type.create(null,c)))),u?3:1,0),h=o.start,f=o.end;n(e.tr.step(new Me(h-(u?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const Xe=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ji=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Vc=null;const Pn=function(t,e,n){let r=Vc||(Vc=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Vx=function(){Vc=null},Gr=function(t,e,n,r){return n&&(Ap(t,e,n,r,-1)||Ap(t,e,n,r,1))},qx=/^(img|br|input|textarea|hr)$/i;function Ap(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ut(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Ms(t)||qx.test(t.nodeName)||t.contentEditable=="false")return!1;e=Xe(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?Ut(t):0}else return!1}}function Ut(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function jx(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ut(t)}else if(t.parentNode&&!Ms(t))e=Xe(t),t=t.parentNode;else return null}}function Wx(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ms(t))e=Xe(t)+1,t=t.parentNode;else return null}}function Yx(t,e,n){for(let r=e==0,i=e==Ut(t);r||i;){if(t==n)return!0;let o=Xe(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Ut(t)}}function Ms(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Rl=function(t){return t.focusNode&&Gr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function vr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Gx(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Kx(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ut(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ut(r.startContainer),r.startOffset)}}}const Tn=typeof navigator<"u"?navigator:null,_p=typeof document<"u"?document:null,wr=Tn&&Tn.userAgent||"",qc=/Edge\/(\d+)/.exec(wr),t1=/MSIE \d/.exec(wr),jc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wr),St=!!(t1||jc||qc),fr=t1?document.documentMode:jc?+jc[1]:qc?+qc[1]:0,qt=!St&&/gecko\/(\d+)/i.test(wr);qt&&+(/Firefox\/(\d+)/.exec(wr)||[0,0])[1];const Wc=!St&&/Chrome\/(\d+)/.exec(wr),Ze=!!Wc,n1=Wc?+Wc[1]:0,at=!St&&!!Tn&&/Apple Computer/.test(Tn.vendor),Wi=at&&(/Mobile\/\w+/.test(wr)||!!Tn&&Tn.maxTouchPoints>2),Bt=Wi||(Tn?/Mac/.test(Tn.platform):!1),r1=Tn?/Win/.test(Tn.platform):!1,Fn=/Android \d/.test(wr),Os=!!_p&&"webkitFontSmoothing"in _p.documentElement.style,Qx=Os?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Xx(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function vn(t,e){return typeof t=="number"?t:t[e]}function Jx(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Np(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=ji(s);continue}let a=s,l=a==o.body,u=l?Xx(o):Jx(a),c=0,d=0;if(e.top<u.top+vn(r,"top")?d=-(u.top-e.top+vn(i,"top")):e.bottom>u.bottom-vn(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+vn(i,"top")-u.top:e.bottom-u.bottom+vn(i,"bottom")),e.left<u.left+vn(r,"left")?c=-(u.left-e.left+vn(i,"left")):e.right>u.right-vn(r,"right")&&(c=e.right-u.right+vn(i,"right")),c||d)if(l)o.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let g=a.scrollLeft-f,y=a.scrollTop-p;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:ji(s)}}function Zx(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:i1(t.dom)}}function i1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ji(r));return e}function ew({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;o1(n,r==0?0:r-e)}function o1(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let yi=null;function tw(t){if(t.setActive)return t.setActive();if(yi)return t.focus(yi);let e=i1(t);t.focus(yi==null?{get preventScroll(){return yi={preventScroll:!0},!0}}:void 0),yi||(yi=!1,o1(e,0))}function s1(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,l,u;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=Pn(c).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=c,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&g&&(o=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(o=d+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?nw(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:s1(n,i)}function nw(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=Jn(r,1);if(s.top!=s.bottom&&dh(e,s)){i={node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function dh(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function rw(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function iw(t,e,n){let{node:r,offset:i}=s1(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function ow(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function a1(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(dh(e,u))return a1(s,e,u)}}if((o=(o+1)%r)==i)break}return t}function sw(t,e){let n=t.dom.ownerDocument,r,i=0,o=Kx(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=t.dom.getBoundingClientRect();if(!dh(e,u)||(s=a1(t.dom,e,u),!s))return null}if(at)for(let u=s;r&&u;u=ji(u))u.draggable&&(r=void 0);if(s=rw(s,e),r){if(qt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;Os&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=ow(t,r,i,e))}a==null&&(a=iw(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Ip(t){return t.top<t.bottom||t.left<t.right}function Jn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ip(r))return r}return Array.prototype.find.call(n,Ip)||t.getBoundingClientRect()}const aw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function l1(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Os||qt;if(r.nodeType==3)if(s&&(aw.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=Jn(Pn(r,i,i),n);if(qt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=Jn(Pn(r,i-1,i-1),-1);if(u.top==l.top){let c=Jn(Pn(r,i,i+1),-1);if(c.top!=l.top)return ko(c,c.left<u.left)}}return l}else{let l=i,u=i,c=n<0?1:-1;return n<0&&!i?(u++,c=-1):n>=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:u++,ko(Jn(Pn(r,l,u),c),c<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Ut(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Du(l.getBoundingClientRect(),!1)}if(o==null&&i<Ut(r)){let l=r.childNodes[i];if(l.nodeType==1)return Du(l.getBoundingClientRect(),!0)}return Du(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Ut(r))){let l=r.childNodes[i-1],u=l.nodeType==3?Pn(l,Ut(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return ko(Jn(u,1),!1)}if(o==null&&i<Ut(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?Pn(l,0,s?0:1):l.nodeType==1?l:null:null;if(u)return ko(Jn(u,-1),!0)}return ko(Jn(r.nodeType==3?Pn(r):r,-n),n>=0)}function ko(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Du(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function u1(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function lw(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return u1(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=l1(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Pn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const uw=/[\u0590-\u08ac]/;function cw(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!uw.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:u1(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),y=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&u==g;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return h!=null&&(a.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Mp=null,Op=null,Dp=!1;function dw(t,e,n){return Mp==e&&Op==n?Dp:(Mp=e,Op=n,Dp=n=="up"||n=="down"?lw(t,e,n):cw(t,e,n))}const jt=0,vp=1,Rr=2,Cn=3;class Ds{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=jt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Xe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof d1){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof c1&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Xe(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?Xe(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],u=s+l.size;if(i==-1&&e<=u){let c=s+l.border;if(e>=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Xe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=Xe(d.dom);break}n+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let g=this.children[f],y=p+g.size;if(o>p&&s<y)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((qt||at)&&e==n){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
7
+ `),d&&p==f.nodeValue.length)for(let g=f,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:Xe(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=f.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(qt&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&at)&&Gr(a.node,a.offset,c.anchorNode,c.anchorOffset)&&Gr(l.node,l.offset,c.focusNode,c.focusOffset))return;let h=!1;if((u.extend||e==n)&&!(d&&qt)){u.collapse(a.node,a.offset);try{e!=n&&u.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>n){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?Rr:vp,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Cn:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Rr:Cn}r=s}this.dirty=Rr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Rr:vp;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class c1 extends Ds{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==jt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class hw extends Ds{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Kr extends Ds{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=Lt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Kr(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Cn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Cn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=jt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=jt}}slice(e,n,r){let i=Kr.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Gc(o,n,s,r)),e>0&&(o=Gc(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class pr extends Ds{constructor(e,n,r,i,o,s,a,l,u){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],l,u=a&&a(n,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=Lt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let h=c;return c=p1(c,r,n),u?l=new fw(e,n,r,i,c,d||null,h,u,o,s+1):n.isText?new Pl(e,n,r,i,c,h,o):new pr(e,n,r,i,c,d||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,n,r){return this.dirty==jt&&e.eq(this.node)&&Ja(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new mw(this,s&&s.node,e);yw(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e,c):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?Ee.none:this.node.child(c).marks,r,e,c),l.placeWidget(u,e,i)},(u,c,d,h)=>{l.syncToMarks(u.marks,r,e,h);let f;l.findNodeMatch(u,c,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(f=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(u,c,d,f,e)||l.updateNextNode(u,c,d,e,h,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Rr)&&(s&&this.protectLocalComposition(e,s),h1(this.contentDOM,this.children,e),Wi&&Ew(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof $)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=kw(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new hw(this,o,n,i);e.input.compositionNodes.push(s),this.children=Gc(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Cn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=jt}updateOuterDeco(e){if(Ja(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=f1(this.dom,this.nodeDOM,Yc(this.outerDeco,this.node,n),Yc(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Lp(t,e,n,r,i){p1(r,e,t);let o=new pr(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Pl extends pr{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Cn||this.dirty!=jt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=jt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=jt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Pl(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Cn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class d1 extends Ds{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==jt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class fw extends pr{constructor(e,n,r,i,o,s,a,l,u,c){super(e,n,r,i,o,s,a,u,c),this.spec=l}update(e,n,r,i){if(this.dirty==Cn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function h1(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=Rp(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof Kr){let l=r?r.previousSibling:t.lastChild;h1(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Rp(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Ho=function(t){t&&(this.nodeName=t)};Ho.prototype=Object.create(null);const Pr=[new Ho];function Yc(t,e,n){if(t.length==0)return Pr;let r=n?Pr[0]:new Ho,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Ho(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new Ho(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function f1(t,e,n,r){if(n==Pr&&r==Pr)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Pr[0]),i=l}pw(i,a||Pr[0],s)}return i}function pw(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function p1(t,e,n){return f1(t,t,Pr,Yc(e,n,t.nodeType!=1))}function Ja(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Rp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class mw{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=gw(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let o=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;o<a&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=jt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let c=this.index;c<u;c++){let d=this.top.children[c];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=Kr.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==Cn&&s.dom==s.contentDOM&&(s.dirty=Rr),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof pr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=o)return!1;let c=l.dom,d,h=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Cn&&Ja(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Rr,d.updateChildren(i,s+1),d.dirty=jt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Ja(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=pr.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,o){let s=pr.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new c1(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Kr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Pl)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((at||Ze)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new d1(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function gw(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof Kr)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function bw(t,e){return t.type.side-e.type.side}function yw(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,i,e.forChild(o,c),u),o+=c.nodeSize}return}let s=0,a=[],l=null;for(let u=0;;){let c,d;for(;s<i.length&&i[s].to==o;){let y=i[s++];y.widget&&(c?(d||(d=[c])).push(y):c=y)}if(c)if(d){d.sort(bw);for(let y=0;y<d.length;y++)n(d[y],u,!!l)}else n(c,u,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(u<t.childCount)f=u,h=t.child(u++);else break;for(let y=0;y<a.length;y++)a[y].to<=o&&a.splice(y--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let p=o+h.nodeSize;if(h.isText){let y=p;s<i.length&&i[s].from<y&&(y=i[s].from);for(let b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<p&&(l=h.cut(y-o),h=h.cut(0,y-o),p=y,f=-1)}else for(;s<i.length&&i[s].to<p;)s++;let g=h.isInline&&!h.isLeaf?a.filter(y=>!y.inline):a.slice();r(h,g,e.forChild(o,h),f),o=p}}function Ew(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function kw(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<t.childCount;){let u=t.child(i++);if(o+=u.nodeSize,!u.isText)break;l+=u.text}if(o>=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?l.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Gc(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],u=a,c=a+=l.size;u>=n||c<=e?o.push(l):(u<e&&o.push(l.slice(0,e-u,r)),i&&(o.push(i),i=void 0),c>n&&o.push(l.slice(n-u,l.size,r)))}return o}function hh(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,u;if(Rl(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&q.isSelectable(d)&&i.parent&&!(d.isInline&&Yx(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;u=new q(s==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,h=s;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,s]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!u){let d=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;u=fh(t,c,a,d)}return u}function m1(t){return t.editable?t.hasFocus():b1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function zn(t,e=!1){let n=t.state.selection;if(g1(t,n),!!m1(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ze){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Gr(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Cw(t);else{let{anchor:r,head:i}=n,o,s;Pp&&!(n instanceof $)&&(n.$from.parent.inlineContent||(o=Bp(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Bp(t,n.to))),t.docView.setSelection(r,i,t,e),Pp&&(o&&Fp(o),s&&Fp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Tw(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Pp=at||Ze&&n1<63;function Bp(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(at&&i&&i.contentEditable=="false")return vu(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return vu(i);if(o)return vu(o)}}function vu(t){return t.contentEditable="true",at&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Fp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Tw(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!m1(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Cw(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Xe(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&St&&fr<=11&&(n.disabled=!0,n.disabled=!1)}function g1(t,e){if(e instanceof q){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Hp(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Hp(t)}function Hp(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function fh(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||$.between(e,n,r)}function Up(t){return t.editable&&!t.hasFocus()?!1:b1(t)}function b1(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Sw(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Gr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Kc(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&G.findFrom(o,e)}function tr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $p(t,e,n){let r=t.state.selection;if(r instanceof $)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return tr(t,new $(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Kc(t.state,e);return i&&i instanceof q?tr(t,i):!1}else if(!(Bt&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?q.isSelectable(o)?tr(t,new q(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Os?tr(t,new $(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof q&&r.node.isInline)return tr(t,new $(e>0?r.$to:r.$from));{let i=Kc(t.state,e);return i?tr(t,i):!1}}}function Za(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Uo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ei(t,e){return e<0?xw(t):ww(t)}function xw(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(qt&&n.nodeType==1&&r<Za(n)&&Uo(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Uo(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(y1(n))break;{let a=n.previousSibling;for(;a&&Uo(a,-1);)i=n.parentNode,o=Xe(a),a=a.previousSibling;if(a)n=a,r=Za(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Qc(t,n,r):i&&Qc(t,i,o)}function ww(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Za(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Uo(a,1))o=n,s=++r;else break}else{if(y1(n))break;{let a=n.nextSibling;for(;a&&Uo(a,1);)o=a.parentNode,s=Xe(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Za(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Qc(t,o,s)}function y1(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Aw(t,e){for(;t&&e==t.childNodes.length&&!Ms(t);)e=Xe(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function _w(t,e){for(;t&&!e&&!Ms(t);)e=Xe(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Qc(t,e,n){if(e.nodeType!=3){let o,s;(s=Aw(e,n))?(e=s,n=0):(o=_w(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Rl(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&zn(t)},50)}function zp(t,e){let n=t.state.doc.resolve(e);if(!(Ze||r1)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Vp(t,e,n){let r=t.state.selection;if(r instanceof $&&!r.empty||n.indexOf("s")>-1||Bt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Kc(t.state,e);if(s&&s instanceof q)return tr(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof Ct?G.near(s,e):G.findFrom(s,e);return a?tr(t,a):!1}return!1}function qp(t,e){if(!(t.state.selection instanceof $))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function jp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Nw(t){if(!at||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;jp(t,r,"true"),setTimeout(()=>jp(t,r,"false"),20)}return!1}function Iw(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Mw(t,e){let n=e.keyCode,r=Iw(e);if(n==8||Bt&&n==72&&r=="c")return qp(t,-1)||Ei(t,-1);if(n==46&&!e.shiftKey||Bt&&n==68&&r=="c")return qp(t,1)||Ei(t,1);if(n==13||n==27)return!0;if(n==37||Bt&&n==66&&r=="c"){let i=n==37?zp(t,t.state.selection.from)=="ltr"?-1:1:-1;return $p(t,i,r)||Ei(t,i)}else if(n==39||Bt&&n==70&&r=="c"){let i=n==39?zp(t,t.state.selection.from)=="ltr"?1:-1:1;return $p(t,i,r)||Ei(t,i)}else{if(n==38||Bt&&n==80&&r=="c")return Vp(t,-1,r)||Ei(t,-1);if(n==40||Bt&&n==78&&r=="c")return Nw(t)||Vp(t,1,r)||Ei(t,1);if(r==(Bt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ph(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=t.someProp("clipboardSerializer")||Lt.fromSchema(t.state.schema),a=x1(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=S1[u.nodeName.toLowerCase()]);){for(let f=c.length-1;f>=0;f--){let p=a.createElement(c[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:l,text:h,slice:e}}function E1(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=!!e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,o||r,t)}),o)return a=new B(M.from(t.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:f}=t.state,p=Lt.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(p.serializeNode(f.text(g,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=Lw(n),Os&&Rw(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Vt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Ow.test(h.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Pw(Wp(a,+c[1],+c[2]),c[4]);else if(a=B.maxOpen(Dw(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Wp(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const Ow=/^(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 Dw(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),u;if(!l)return s=null;if(u=s.length&&o.length&&T1(l,o,a,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=C1(s[s.length-1],o.length));let c=k1(a,l);s.push(c),i=i.matchType(c.type),o=l}}),s)return M.from(s)}return t}function k1(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function T1(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=T1(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(M.from(k1(n,t,i+1))))}}function C1(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,C1(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}function Xc(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=Xc(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Wp(t,e,n){return e<t.openStart&&(t=new B(Xc(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new B(Xc(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const S1={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Yp=null;function x1(){return Yp||(Yp=document.implementation.createHTMLDocument("title"))}let Lu=null;function vw(t){let e=window.trustedTypes;return e?(Lu||(Lu=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Lu.createHTML(t)):t}function Lw(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=x1().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&S1[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=vw(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function Rw(t){let e=t.querySelectorAll(Ze?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Pw(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=M.from(l.create(r[a+1],i)),o++,s++}return new B(i,o,s)}const ft={},pt={},Bw={touchstart:!0,touchmove:!0};class Fw{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 Hw(t){for(let e in ft){let n=ft[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{$w(t,r)&&!mh(t,r)&&(t.editable||!(r.type in pt))&&n(t,r)},Bw[e]?{passive:!0}:void 0)}at&&t.dom.addEventListener("input",()=>null),Jc(t)}function lr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Uw(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Jc(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>mh(t,r))})}function mh(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function $w(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function zw(t,e){!mh(t,e)&&ft[e.type]&&(t.editable||!(e.type in pt))&&ft[e.type](t,e)}pt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!A1(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Fn&&Ze&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Wi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,vr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Mw(t,n)?n.preventDefault():lr(t,"key")};pt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};pt.keypress=(t,e)=>{let n=e;if(A1(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Bt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof $)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Bl(t){return{left:t.clientX,top:t.clientY}}function Vw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function gh(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function vi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function qw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&q.isSelectable(r)?(vi(t,new q(n)),!0):!1}function jw(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof q&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(q.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(vi(t,q.create(t.state.doc,i)),!0):!1}function Ww(t,e,n,r,i){return gh(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?jw(t,n):qw(t,n))}function Yw(t,e,n,r){return gh(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Gw(t,e,n,r){return gh(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Kw(t,n,r)}function Kw(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(vi(t,$.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)vi(t,$.create(r,a+1,a+1+s.content.size));else if(q.isSelectable(s))vi(t,q.create(r,a));else continue;return!0}}function bh(t){return el(t)}const w1=Bt?"metaKey":"ctrlKey";ft.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=bh(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&Vw(n,t.input.lastClick)&&!n[w1]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=t.posAtCoords(Bl(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Qw(t,s,n,!!r)):(o=="doubleClick"?Yw:Gw)(t,s.pos,s.inside,n)?n.preventDefault():lr(t,"pointer"))};class Qw{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[w1],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof q&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qt&&!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)),lr(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(()=>zn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Bl(e))),this.updateAllowDefault(e),this.allowDefault||!n?lr(this.view,"pointer"):Ww(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||at&&this.mightDrag&&!this.mightDrag.node.isAtom||Ze&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(vi(this.view,G.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):lr(this.view,"pointer")}move(e){this.updateAllowDefault(e),lr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ft.touchstart=t=>{t.input.lastTouch=Date.now(),bh(t),lr(t,"pointer")};ft.touchmove=t=>{t.input.lastTouch=Date.now(),lr(t,"pointer")};ft.contextmenu=t=>bh(t);function A1(t,e){return t.composing?!0:at&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Xw=Fn?5e3:-1;pt.compositionstart=pt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof $&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ze&&r1&&Jw(t)))t.markCursor=t.state.storedMarks||n.marks(),el(t,!0),t.markCursor=null;else if(el(t,!e.selection.empty),qt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}_1(t,Xw)};function Jw(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}pt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,_1(t,20))};function _1(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>el(t),e))}function N1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=eA());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Zw(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=jx(e.focusNode,e.focusOffset),r=Wx(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function eA(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function el(t,e=!1){if(!(Fn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),N1(t),e||t.docView&&t.docView.dirty){let n=hh(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function tA(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const rs=St&&fr<15||Wi&&Qx<604;ft.copy=pt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=rs?null:n.clipboardData,s=r.content(),{dom:a,text:l}=ph(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):tA(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function nA(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function rA(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?is(t,r.value,null,i,e):is(t,r.textContent,r.innerHTML,i,e)},50)}function is(t,e,n,r,i){let o=E1(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||B.empty)))return!0;if(!o)return!1;let s=nA(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function I1(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}pt.paste=(t,e)=>{let n=e;if(t.composing&&!Fn)return;let r=rs?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&is(t,I1(r),r.getData("text/html"),i,n)?n.preventDefault():rA(t,n)};class M1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const iA=Bt?"altKey":"ctrlKey";function O1(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[iA]}ft.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Bl(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof q?i.to-1:i.to))){if(r&&r.mightDrag)s=q.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=q.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=ph(t,a);(!n.dataTransfer.files.length||!Ze||n1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(rs?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",rs||n.dataTransfer.setData("text/plain",u),t.dragging=new M1(c,O1(t,n),s)};ft.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};pt.dragover=pt.dragenter=(t,e)=>e.preventDefault();pt.drop=(t,e)=>{try{oA(t,e,t.dragging)}finally{t.dragging=null}};function oA(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Bl(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",f=>{o=f(o,t,!1)}):o=E1(t,I1(e.dataTransfer),rs?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&O1(t,e));if(t.someProp("handleDrop",f=>f(t,e,o||B.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?Rb(t.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(s){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let u=l.mapping.map(a),c=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(u,u,o.content.firstChild):l.replaceRange(u,u,o),l.doc.eq(d))return;let h=l.doc.resolve(u);if(c&&q.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new q(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,y,b)=>f=b),l.setSelection(fh(t,h,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}ft.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&zn(t)},20))};ft.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ft.beforeinput=(t,e)=>{if(Ze&&Fn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,vr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in pt)ft[t]=pt[t];function ss(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class tl{constructor(e,n){this.toDOM=e,this.spec=n||Ur,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new me(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof tl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ss(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class mr{constructor(e,n){this.attrs=e,this.spec=n||Ur}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new me(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof mr&&ss(this.attrs,e.attrs)&&ss(this.spec,e.spec)}static is(e){return e.type instanceof mr}destroy(){}}class yh{constructor(e,n){this.attrs=e,this.spec=n||Ur}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new me(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof yh&&ss(this.attrs,e.attrs)&&ss(this.spec,e.spec)}destroy(){}}class me{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new me(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new me(e,e,new tl(n,r))}static inline(e,n,r,i){return new me(e,n,new mr(r,i))}static node(e,n,r,i){return new me(e,n,new yh(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof mr}get widget(){return this.type instanceof tl}}const xi=[],Ur={};class le{constructor(e,n){this.local=e.length?e:xi,this.children=n.length?n:xi}static create(e,n){return n.length?nl(n,e,0,Ur):it}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==it||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ur)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?sA(this.children,s||[],e,n,r,i,o):s?new le(s.sort($r),xi):it}add(e,n){return n.length?this==it?le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let u=l+r,c;if(c=v1(n,a,u)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,c,u+1):i.splice(o,0,l,l+a.nodeSize,nl(c,a,u+1,Ur)),o+=3}});let s=D1(o?L1(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new le(s.length?this.local.concat(s).sort($r):this.local,i||this.children)}remove(e){return e.length==0||this==it?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[o+2].removeInner(s,a+1);u!=it?r[o+2]=u:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new le(i,r):it}forChild(e,n){if(this==it)return this;if(n.isLeaf)return le.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof mr){let u=Math.max(o,l.from)-o,c=Math.min(s,l.to)-o;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new le(i.sort($r),xi);return r?new rr([a,r]):a}return r||it}eq(e){if(this==e)return!0;if(!(e instanceof le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Eh(this.localsInner(e))}localsInner(e){if(this==it)return xi;if(e.inlineContent||!this.local.some(mr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof mr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}le.empty=new le([],[]);le.removeOverlap=Eh;const it=le.empty;class rr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Ur));return rr.from(r)}forChild(e,n){if(n.isLeaf)return le.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=it&&(o instanceof rr?r=r.concat(o.members):r.push(o))}return rr.from(r)}eq(e){if(!(e instanceof rr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?Eh(r?n:n.sort($r)):xi}static from(e){switch(e.length){case 0:return it;case 1:return e[0];default:return new rr(e.every(n=>n instanceof le)?e:e.reduce((n,r)=>n.concat(r instanceof le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function sA(t,e,n,r,i,o,s){let a=t.slice();for(let u=0,c=o;u<n.maps.length;u++){let d=0;n.maps[u].forEach((h,f,p,g)=>{let y=g-p-(f-h);for(let b=0;b<a.length;b+=3){let C=a[b+1];if(C<0||h>C+c-d)continue;let w=a[b]+c-d;f>=w?a[b+1]=h<=w?-2:-1:h>=c&&y&&(a[b]+=y,a[b+1]+=y)}d+=y}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=n.map(t[u]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[u+1]+o,-1),f=h-i,{index:p,offset:g}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&g==d&&g+y.nodeSize==f){let b=a[u+2].mapInner(n,y,c+1,t[u]+o+1,s);b!=it?(a[u]=d,a[u+1]=f,a[u+2]=b):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=aA(a,t,e,n,i,o,s),c=nl(u,r,0,s);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let f=c.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new le(e.sort($r),a)}function D1(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new me(i.from+e,i.to+e,i.type))}return n}function aA(t,e,n,r,i,o,s){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,u);d?n.push(d):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function v1(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function L1(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function nl(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let u=v1(t,a,l+n);if(u){o=!0;let c=nl(u,a,n+l+1,r);c!=it&&i.push(l,l+a.nodeSize,c)}});let s=D1(o?L1(t):t,-n).sort($r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new le(s,i):it}function $r(t,e){return t.from-e.from||t.to-e.to}function Eh(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),Gp(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Gp(e,i,r.copy(o.from,r.to)));break}}}return e}function Gp(t,e,n){for(;e<t.length&&$r(n,t[e])>0;)e++;t.splice(e,0,n)}function Ru(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=it&&e.push(r)}),t.cursorWrapper&&e.push(le.create(t.state.doc,[t.cursorWrapper.deco])),rr.from(e)}const lA={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},uA=St&&fr<=11;class cA{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 dA{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cA,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);St&&fr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():at&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),uA&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,lA)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Up(this.view)){if(this.suppressingSelectionUpdates)return zn(this.view);if(St&&fr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=ji(o))n.add(o);for(let o=e.anchorNode;o;o=ji(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Up(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){c.parentNode.removeChild(c);break}d=d.firstChild}}}else if(qt&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||pA(e,d)!=f)&&h.remove()}}}let u=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Rl(r)&&(u=hh(e))&&u.eq(G.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,zn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),hA(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,mA(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||zn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(St&&fr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?Xe(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?Xe(o):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Kp=new WeakMap,Qp=!1;function hA(t){if(!Kp.has(t)&&(Kp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=qt,Qp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Qp=!0}}function Xp(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Gr(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function fA(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Xp(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Xp(t,n):null}function pA(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function mA(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let o of e)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(o,a.firstChild),r==o&&t.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function gA(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),u,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],Rl(l)||u.push({node:l.focusNode,offset:l.focusOffset})),Ze&&t.input.lastKeyCode===8)for(let y=o;y>i;y--){let b=r.childNodes[y-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){o=y;break}if(!C||C.size)break}let d=t.state.doc,h=t.someProp("domParser")||Vt.fromSchema(t.state.schema),f=d.resolve(s),p=null,g=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:o,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:bA,context:f});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),p={anchor:y+s,head:b+s}}return{doc:g,sel:p,from:s,to:a}}function bA(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(at&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||at&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const yA=/^(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 EA(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let R=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,U=hh(t,R);if(U&&!t.state.selection.eq(U)){if(Ze&&Fn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,vr(13,"Enter"))))return;let z=t.state.tr.setSelection(U);R=="pointer"?z.setMeta("pointer",!0):R=="key"&&z.scrollIntoView(),o&&z.setMeta("composition",o),t.dispatch(z)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=gA(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=CA(d.content,u.doc.content,u.from,h,f);if(p&&t.input.domChangeCount++,(Wi&&t.input.lastIOSEnter>Date.now()-225||Fn)&&i.some(R=>R.nodeType==1&&!yA.test(R.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",R=>R(t,vr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof $&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let R=Jp(t,t.state.doc,u.sel);if(R&&!R.eq(t.state.selection)){let U=t.state.tr.setSelection(R);o&&U.setMeta("composition",o),t.dispatch(U)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof $&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),St&&fr<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=u.doc.resolveNoCache(p.start-u.from),y=u.doc.resolveNoCache(p.endB-u.from),b=c.resolve(p.start),C=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=p.endA;if((Wi&&t.input.lastIOSEnter>Date.now()-225&&(!C||i.some(R=>R.nodeName=="DIV"||R.nodeName=="P"))||!C&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&t.someProp("handleKeyDown",R=>R(t,vr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&TA(c,p.start,p.endA,g,y)&&t.someProp("handleKeyDown",R=>R(t,vr(8,"Backspace")))){Fn&&Ze&&t.domObserver.suppressSelectionUpdates();return}Ze&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Fn&&!C&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,y=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(R){return R(t,vr(13,"Enter"))})},20));let w=p.start,v=p.endA,O=R=>{let U=R||t.state.tr.replace(w,v,u.doc.slice(p.start-u.from,p.endB-u.from));if(u.sel){let z=Jp(t,U.doc,u.sel);z&&!(Ze&&t.composing&&z.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(z.head==w||z.head==U.mapping.map(v)-1)||St&&z.empty&&z.head==w)&&U.setSelection(z)}return o&&U.setMeta("composition",o),U.scrollIntoView()},_;if(C)if(g.pos==y.pos){St&&fr<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>zn(t),20));let R=O(t.state.tr.delete(w,v)),U=c.resolve(p.start).marksAcross(c.resolve(p.endA));U&&R.ensureMarks(U),t.dispatch(R)}else if(p.endA==p.endB&&(_=kA(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let R=O(t.state.tr);_.type=="add"?R.addMark(w,v,_.mark):R.removeMark(w,v,_.mark),t.dispatch(R)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let R=g.parent.textBetween(g.parentOffset,y.parentOffset),U=()=>O(t.state.tr.insertText(R,w,v));t.someProp("handleTextInput",z=>z(t,w,v,R,U))||t.dispatch(U())}else t.dispatch(O());else t.dispatch(O())}function Jp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:fh(t,e.resolve(n.anchor),e.resolve(n.head))}function kA(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)o=n[c].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(M.from(u).eq(t))return{mark:a,type:s}}function TA(t,e,n,r,i){if(n-e<=i.pos-r.pos||Pu(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(Pu(o,!0,!0));return!s.parent.isTextblock||s.pos>n||Pu(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Pu(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function CA(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&t.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&Zp(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<t.size&&Zp(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function Zp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class R1{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Fw,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(im),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=nm(this),tm(this),this.nodeViews=rm(this),this.docView=Lp(this.state.doc,em(this),Ru(this),this.dom,this),this.domObserver=new dA(this,(r,i,o,s)=>EA(this,r,i,o,s)),this.domObserver.start(),Hw(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Jc(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(im),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(N1(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=rm(this);xA(f,this.nodeViews)&&(this.nodeViews=f,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Jc(this),this.editable=nm(this),tm(this);let l=Ru(this),u=em(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(s=!0);let h=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Zx(this);if(s){this.domObserver.stop();let f=d&&(St||Ze)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&SA(i.selection,e.selection);if(d){let p=Ze?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Zw(this)),(o||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Lp(e.doc,u,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Sw(this))?zn(this,f):(g1(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&ew(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof q){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Np(this,n.getBoundingClientRect(),e)}else Np(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new M1(e.slice,e.move,i<0?void 0:q.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(St){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&tw(this.dom),zn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return sw(this,e)}coordsAtPos(e,n=1){return l1(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return dw(this,n||this.state,e)}pasteHTML(e,n){return is(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return is(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ph(this,e)}destroy(){this.docView&&(Uw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ru(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Vx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return zw(this,e)}domSelectionRange(){let e=this.domSelection();return e?at&&this.root.nodeType===11&&Gx(this.dom.ownerDocument)==this.dom&&fA(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}R1.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function em(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[me.node(0,t.state.doc.content.size,e)]}function tm(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:me.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function nm(t){return!t.someProp("editable",e=>e(t.state)===!1)}function SA(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function rm(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function xA(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function im(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var gr={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:"'"},rl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wA=typeof navigator<"u"&&/Mac/.test(navigator.platform),AA=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Je=0;Je<10;Je++)gr[48+Je]=gr[96+Je]=String(Je);for(var Je=1;Je<=24;Je++)gr[Je+111]="F"+Je;for(var Je=65;Je<=90;Je++)gr[Je]=String.fromCharCode(Je+32),rl[Je]=String.fromCharCode(Je);for(var Bu in gr)rl.hasOwnProperty(Bu)||(rl[Bu]=gr[Bu]);function _A(t){var e=wA&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||AA&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?rl:gr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const NA=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),IA=typeof navigator<"u"&&/Win/.test(navigator.platform);function MA(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))NA?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function OA(t){let e=Object.create(null);for(let n in t)e[MA(n)]=t[n];return e}function Fu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function P1(t){return new re({props:{handleKeyDown:kh(t)}})}function kh(t){let e=OA(t);return function(n,r){let i=_A(r),o,s=e[Fu(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Fu(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(IA&&r.ctrlKey&&r.altKey)&&(o=gr[r.keyCode])&&o!=i){let a=e[Fu(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var DA=Object.defineProperty,Th=(t,e)=>{for(var n in e)DA(t,n,{get:e[n],enumerable:!0})};function Fl(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var Hl=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...u)=>{const c=a(...u)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!t,l=t||i.tr,u=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),s.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,h])=>[d,(...p)=>{const g=this.buildProps(l,e),y=h(...p)(g);return s.push(y),c}])),run:u};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>l(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:t,editor:r,view:o,state:Fl({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...u)=>l(...u)(s)]))}};return s}},B1={};Th(B1,{blur:()=>vA,clearContent:()=>LA,clearNodes:()=>RA,command:()=>PA,createParagraphNear:()=>BA,cut:()=>FA,deleteCurrentNode:()=>HA,deleteNode:()=>UA,deleteRange:()=>$A,deleteSelection:()=>zA,enter:()=>VA,exitCode:()=>qA,extendMarkRange:()=>jA,first:()=>WA,focus:()=>GA,forEach:()=>KA,insertContent:()=>QA,insertContentAt:()=>JA,joinBackward:()=>t2,joinDown:()=>e2,joinForward:()=>n2,joinItemBackward:()=>r2,joinItemForward:()=>i2,joinTextblockBackward:()=>o2,joinTextblockForward:()=>s2,joinUp:()=>ZA,keyboardShortcut:()=>l2,lift:()=>u2,liftEmptyBlock:()=>c2,liftListItem:()=>d2,newlineInCode:()=>h2,resetAttributes:()=>f2,scrollIntoView:()=>p2,selectAll:()=>m2,selectNodeBackward:()=>g2,selectNodeForward:()=>b2,selectParentNode:()=>y2,selectTextblockEnd:()=>E2,selectTextblockStart:()=>k2,setContent:()=>T2,setMark:()=>F2,setMeta:()=>H2,setNode:()=>U2,setNodeSelection:()=>$2,setTextDirection:()=>z2,setTextSelection:()=>V2,sinkListItem:()=>q2,splitBlock:()=>j2,splitListItem:()=>W2,toggleList:()=>G2,toggleMark:()=>K2,toggleNode:()=>Q2,toggleWrap:()=>X2,undoInputRule:()=>J2,unsetAllMarks:()=>Z2,unsetMark:()=>e_,unsetTextDirection:()=>t_,updateAttributes:()=>n_,wrapIn:()=>r_,wrapInList:()=>i_});var vA=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),LA=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),RA=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),h=u.resolve(c.map(l+a.nodeSize)),f=d.blockRange(h);if(!f)return;const p=li(f);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,g)}(p||p===0)&&e.lift(f,p)})}),!0},PA=t=>e=>t(e),BA=()=>({state:t,dispatch:e})=>Xb(t,e),FA=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new $(r.doc.resolve(Math.max(s-1,0)))),!0},HA=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const a=i.before(o),l=i.after(o);t.delete(a,l).scrollIntoView()}return!0}return!1};function We(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var UA=t=>({tr:e,state:n,dispatch:r})=>{const i=We(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const l=o.before(s),u=o.after(s);e.delete(l,u).scrollIntoView()}return!0}return!1},$A=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},zA=()=>({state:t,dispatch:e})=>sh(t,e),VA=()=>({commands:t})=>t.keyboardShortcut("Enter"),qA=()=>({state:t,dispatch:e})=>Nx(t,e);function Ch(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function il(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Ch(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function F1(t,e,n={}){return t.find(r=>r.type===e&&il(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function om(t,e,n={}){return!!F1(t,e,n)}function Ul(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e))return;if(!n){const u=r.node.marks.find(c=>c.type===e);u&&(n=u.attrs)}if(!F1([...r.node.marks],e,n))return;let o=r.index,s=t.start()+r.offset,a=o+1,l=s+r.node.nodeSize;for(;o>0&&om([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&om([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Wn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var jA=(t,e)=>({tr:n,state:r,dispatch:i})=>{const o=Wn(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=Ul(l,o,e);if(d&&d.from<=u&&d.to>=c){const h=$.create(s,d.from,d.to);n.setSelection(h)}}return!0},WA=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Sh(t){return t instanceof $}function Hn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function H1(t,e=null){if(!e)return null;const n=G.atStart(t),r=G.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?$.create(t,Hn(0,i,o),Hn(t.content.size,i,o)):$.create(t,Hn(e,i,o),Hn(e,i,o))}function Zc(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function as(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function YA(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var GA=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(as()||Zc())&&r.dom.focus(),YA()&&!as()&&!Zc()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(o&&t===null&&!Sh(n.state.selection))return s(),!0;const a=H1(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},KA=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),QA=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),U1=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&U1(r)}return t};function ta(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return U1(n)}function ls(t,e,n){if(t instanceof Un||t instanceof M)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),ls("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new Sb({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?Vt.fromSchema(l).parseSlice(ta(t),n.parseOptions):Vt.fromSchema(l).parse(ta(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=Vt.fromSchema(e);return n.slice?o.parseSlice(ta(t),n.parseOptions).content:o.parse(ta(t),n.parseOptions)}return ls("",e,n)}function $1(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Ne||i instanceof Me))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,l,u,c)=>{s===0&&(s=c)}),t.setSelection(G.near(t.doc.resolve(s),n))}var XA=t=>!("type"in t),JA=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=y=>{o.emit("contentError",{editor:o,error:y,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{ls(e,o.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=ls(e,o.schema,{parseOptions:u,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:o.options.enableContentCheck})}catch(y){return l(y),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((XA(a)?a:[a]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,f=f?y.isBlock:!1}),c===d&&f){const{parent:y}=r.doc.resolve(c);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(c-=1,d+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof M){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,c,d)}else{g=a;const y=r.doc.resolve(c),b=y.node(),C=y.parentOffset===0,w=b.isText||b.isTextblock,v=b.content.size>0;C&&w&&v&&f&&(c=Math.max(0,c-1)),r.replaceWith(c,d,g)}n.updateSelection&&$1(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:g})}return!0},ZA=()=>({state:t,dispatch:e})=>wx(t,e),e2=()=>({state:t,dispatch:e})=>Ax(t,e),t2=()=>({state:t,dispatch:e})=>qb(t,e),n2=()=>({state:t,dispatch:e})=>Gb(t,e),r2=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Dl(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},i2=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Dl(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},o2=()=>({state:t,dispatch:e})=>Sx(t,e),s2=()=>({state:t,dispatch:e})=>xx(t,e);function z1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function a2(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))as()||z1()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}var l2=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=a2(t).split(/-(?!$)/),s=o.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l?.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function us(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?We(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const l=i-r,u=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>il(d.node.attrs,n,{strict:!1}));return o?!!u.length:u.reduce((d,h)=>d+h.to-h.from,0)>=l}var u2=(t,e={})=>({state:n,dispatch:r})=>{const i=We(t,n.schema);return us(n,i,e)?_x(n,r):!1},c2=()=>({state:t,dispatch:e})=>Jb(t,e),d2=t=>({state:e,dispatch:n})=>{const r=We(t,e.schema);return Hx(r)(e,n)},h2=()=>({state:t,dispatch:e})=>Qb(t,e);function $l(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function sm(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var f2=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=$l(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(o=We(t,r.schema)),a==="mark"&&(s=Wn(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{o&&o===c.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,sm(c.attrs,e))),s&&c.marks.length&&c.marks.forEach(h=>{s===h.type&&(l=!0,i&&n.addMark(d,d+c.nodeSize,s.create(sm(h.attrs,e))))})})}),l},p2=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),m2=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ct(t.doc);t.setSelection(n)}return!0},g2=()=>({state:t,dispatch:e})=>Wb(t,e),b2=()=>({state:t,dispatch:e})=>Kb(t,e),y2=()=>({state:t,dispatch:e})=>Ox(t,e),E2=()=>({state:t,dispatch:e})=>Lx(t,e),k2=()=>({state:t,dispatch:e})=>vx(t,e);function ol(t,e,n={},r={}){return ls(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var T2=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{const{doc:l}=o;if(r.preserveWhitespace!=="full"){const u=ol(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function V1(t,e){const n=Wn(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function zl(t,e){const n=new ih(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function C2(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function sl(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function q1(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Vl(t){return e=>q1(e.$from,t)}function W(t,e,n){return t.config[e]===void 0&&t.parent?W(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?W(t.parent,e,n):null}):t.config[e]}function xh(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=W(e,"addExtensions",n);return r?[e,...xh(r())]:e}).flat(10)}function wh(t,e){const n=Lt.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function j1(t){return typeof t=="function"}function be(t,e=void 0,...n){return j1(t)?e?t.bind(e)(...n):t(...n):t}function S2(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Yi(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function W1(t){const e=[],{nodeExtensions:n,markExtensions:r}=Yi(t),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),l=[...s,...a];return t.forEach(u=>{const c={name:u.name,options:u.options,storage:u.storage,extensions:i},d=W(u,"addGlobalAttributes",c);if(!d)return;d().forEach(f=>{let p;Array.isArray(f.types)?p=f.types:f.types==="*"?p=l:f.types==="nodes"?p=s:f.types==="marks"?p=a:p=[],p.forEach(g=>{Object.entries(f.attributes).forEach(([y,b])=>{e.push({type:g,name:y,attribute:{...o,...b}})})})})}),i.forEach(u=>{const c={name:u.name,options:u.options,storage:u.storage},d=W(u,"addAttributes",c);if(!d)return;const h=d();Object.entries(h).forEach(([f,p])=>{const g={...o,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:u.name,name:f,attribute:g})})}),e}function x2(t){const e=[];let n="",r=!1,i=!1,o=0;const s=t.length;for(let a=0;a<s;a+=1){const l=t[a];if(l==="'"&&!i){r=!r,n+=l;continue}if(l==='"'&&!r){i=!i,n+=l;continue}if(!r&&!i){if(l==="("){o+=1,n+=l;continue}if(l===")"&&o>0){o-=1,n+=l;continue}if(l===";"&&o===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function am(t){const e=[],n=x2(t||""),r=n.length;for(let i=0;i<r;i+=1){const o=n[i],s=o.indexOf(":");if(s===-1)continue;const a=o.slice(0,s).trim(),l=o.slice(s+1).trim();a&&l&&e.push([a,l])}return e}function Gt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],u=a.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){const a=new Map([...am(r[i]),...am(o)]);r[i]=Array.from(a.entries()).map(([l,u])=>`${l}: ${u}`).join("; ")}else r[i]=o}),r},{})}function al(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Gt(n,r),{})}function w2(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function lm(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):w2(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function um(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&S2(n)?!1:n!=null))}function cm(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function Y1(t,e){var n;const r=W1(t),{nodeExtensions:i,markExtensions:o}=Yi(t),s=(n=i.find(u=>W(u,"topNode")))==null?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(b=>b.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((b,C)=>{const w=W(C,"extendNodeSchema",d);return{...b,...w?w(u):{}}},{}),f=um({...h,content:be(W(u,"content",d)),marks:be(W(u,"marks",d)),group:be(W(u,"group",d)),inline:be(W(u,"inline",d)),atom:be(W(u,"atom",d)),selectable:be(W(u,"selectable",d)),draggable:be(W(u,"draggable",d)),code:be(W(u,"code",d)),whitespace:be(W(u,"whitespace",d)),linebreakReplacement:be(W(u,"linebreakReplacement",d)),defining:be(W(u,"defining",d)),isolating:be(W(u,"isolating",d)),attrs:Object.fromEntries(c.map(cm))}),p=be(W(u,"parseHTML",d));p&&(f.parseDOM=p.map(b=>lm(b,c)));const g=W(u,"renderHTML",d);g&&(f.toDOM=b=>g({node:b,HTMLAttributes:al(b,c)}));const y=W(u,"renderText",d);return y&&(f.toText=y),[u.name,f]})),l=Object.fromEntries(o.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},h=t.reduce((y,b)=>{const C=W(b,"extendMarkSchema",d);return{...y,...C?C(u):{}}},{}),f=um({...h,inclusive:be(W(u,"inclusive",d)),excludes:be(W(u,"excludes",d)),group:be(W(u,"group",d)),spanning:be(W(u,"spanning",d)),code:be(W(u,"code",d)),attrs:Object.fromEntries(c.map(cm))}),p=be(W(u,"parseHTML",d));p&&(f.parseDOM=p.map(y=>lm(y,c)));const g=W(u,"renderHTML",d);return g&&(f.toDOM=y=>g({mark:y,HTMLAttributes:al(y,c)})),[u.name,f]}));return new Sb({topNode:s,nodes:a,marks:l})}function A2(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function $o(t){return t.sort((n,r)=>{const i=W(n,"priority")||100,o=W(r,"priority")||100;return i>o?-1:i<o?1:0})}function Ah(t){const e=$o(xh(t)),n=A2(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function _2(t,e){const n=Ah(t);return Y1(n,e)}function G1(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
11
+
12
+ `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(l,u,c,d)=>{var h;l.isBlock&&u>r&&(a+=o);const f=s?.[l.type.name];if(f)return c&&(a+=f({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,u)-u,i-u))}),a}function N2(t,e){const n={from:0,to:t.content.size};return G1(t,n,e)}function K1(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function I2(t,e){const n=We(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function Q1(t,e){const n=$l(typeof e=="string"?e:e.name,t.schema);return n==="node"?I2(t,e):n==="mark"?V1(t,e):{}}function M2(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function O2(t){const e=M2(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,s)=>s!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function _h(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const u=e.slice(o).map(a,-1),c=e.slice(o).map(l),d=e.invert().map(u,-1),h=e.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:u,to:c}})})}),O2(r)}function Nh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=Ul(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function To(t,e){return e.nodes[t]||e.marks[t]||null}function Ia(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var D2=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-o))}),n};function ed(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?Wn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>il(d.attrs,n,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(g,y)=>{if(o&&g.inlineContent&&!g.type.allowsMarkType(o))return!1;if(!g.isText&&!g.marks.length)return;const b=Math.max(f,y),C=Math.min(p,y+g.nodeSize),w=C-b;s+=w,a.push(...g.marks.map(v=>({mark:v,from:b,to:C})))})}),s===0)return!1;const l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>il(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),u=a.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+u:l)>=s}function v2(t,e,n={}){if(!e)return us(t,null,n)||ed(t,null,n);const r=$l(e,t.schema);return r==="node"?us(t,e,n):r==="mark"?ed(t,e,n):!1}function dm(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Hu(t,e){const{nodeExtensions:n}=Yi(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=be(W(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Ih(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Ih(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function L2(t){return t instanceof q}function Lz({selection:t,pos:e,nodeSize:n,selectedOnTextSelection:r=!1}){const{from:i,to:o}=t;return!!(i<=e&&o>=e+n||r&&Sh(t)&&i>e&&o<e+n)}var X1=class J1{constructor(e){this.position=e}static fromJSON(e){return new J1(e.position)}toJSON(){return{position:this.position}}};function R2(t,e){const n=e.mapping.mapResult(t.position);return{position:new X1(n.pos),mapResult:n}}function P2(t){return new X1(t)}function Z1(t,e,n){const i=t.state.doc.content.size,o=Hn(e,0,i),s=Hn(n,0,i),a=t.coordsAtPos(o),l=t.coordsAtPos(s,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,p=c-u,b={top:u,bottom:c,left:d,right:h,width:f,height:p,x:d,y:u};return{...b,toJSON:()=>b}}function B2(t,e,n){var r;const{selection:i}=e;let o=null;if(Sh(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(u=>u.type.excludes(n)))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,d,h)=>{if(u)return!1;if(c.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=f&&p}return!u}),u})}var F2=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=Wn(t,r.schema);if(i)if(s){const u=V1(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(h,f)=>{const p=Math.max(f,c),g=Math.min(f+h.nodeSize,d);h.marks.find(b=>b.type===l)?h.marks.forEach(b=>{l===b.type&&n.addMark(p,g,l.create({...b.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return B2(r,n,l)},H2=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),U2=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=We(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>wp(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>wp(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},$2=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Hn(t,0,r.content.size),o=q.create(r,i);e.setSelection(o)}return!0},z2=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=r;let s,a;return typeof e=="number"?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=o.from,a=o.to),i&&n.doc.nodesBetween(s,a,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},V2=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=$.atStart(r).from,a=$.atEnd(r).to,l=Hn(i,s,a),u=Hn(o,s,a),c=$.create(r,l,u);e.setSelection(c)}return!0},q2=t=>({state:e,dispatch:n})=>{const r=We(t,e.schema);return zx(r)(e,n)};function hm(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var j2=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,u=i.extensionManager.attributes,c=Ia(u,a.node().type.name,a.node().attrs);if(o instanceof q&&o.node.isBlock)return!a.parentOffset||!$n(s,a.pos)?!1:(r&&(t&&hm(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:C2(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:c}]:void 0,p=$n(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&$n(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:c}]:void 0),r){if(p&&(o instanceof $&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&hm(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},W2=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const a=We(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=M.empty;const C=l.index(-1)?1:l.index(-2)?2:3;for(let U=l.depth-C;U>=l.depth-3;U-=1)b=M.from(l.node(U).copy(b));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,v={...Ia(h,l.node().type.name,l.node().attrs),...e},O=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(v))||void 0;b=b.append(M.from(a.createAndFill(null,O)||void 0));const _=l.before(l.depth-(C-1));n.replace(_,l.after(-w),new B(b,4-C,0));let R=-1;n.doc.nodesBetween(_,n.doc.content.size,(U,z)=>{if(R>-1)return!1;U.isTextblock&&U.content.size===0&&(R=z+1)}),R>-1&&n.setSelection($.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const f=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Ia(h,d.type.name,d.attrs),...e},g={...Ia(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const y=f?[{type:a,attrs:p},{type:f,attrs:g}]:[{type:a,attrs:p}];if(!$n(n.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:C}=r,{splittableMarks:w}=o.extensionManager,v=C||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,y).scrollIntoView(),!v||!i)return!0;const O=v.filter(_=>w.includes(_.type.name));n.ensureMarks(O)}return!0},Uu=(t,e)=>{const n=Vl(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&xr(t.doc,n.pos)&&t.join(n.pos),!0},$u=(t,e)=>{const n=Vl(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&xr(t.doc,r)&&t.join(r),!0};function Y2(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return $.between(r,i)}var G2=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=We(t,s.schema),p=We(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:C}=g,w=b.blockRange(C),v=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const O=Vl(Z=>Hu(Z.type.name,d))(g),_=g.from===0&&g.to===s.doc.content.size,R=s.doc.content.content,U=R.length===1?R[0]:null,z=_&&U&&Hu(U.type.name,d)?{node:U,pos:0}:null,N=O??z,j=!!O&&w.depth>=1&&w.depth-O.depth<=1,V=!!z;if((j||V)&&N){if(N.node.type===f)return _&&V?l().command(({tr:Z,dispatch:ie})=>{const K=Y2(Z);return K?(Z.setSelection(K),ie&&ie(Z),!0):!1}).liftListItem(p).run():u.liftListItem(p);if(Hu(N.node.type.name,d)&&f.validContent(N.node.content))return l().command(()=>(o.setNodeMarkup(N.pos,f),!0)).command(()=>Uu(o,f)).command(()=>$u(o,f)).run()}return!n||!v||!a?l().command(()=>c().wrapInList(f,r)?!0:u.clearNodes()).wrapInList(f,r).command(()=>Uu(o,f)).command(()=>$u(o,f)).run():l().command(()=>{const Z=c().wrapInList(f,r),ie=v.filter(K=>h.includes(K.type.name));return o.ensureMarks(ie),Z?!0:u.clearNodes()}).wrapInList(f,r).command(()=>Uu(o,f)).command(()=>$u(o,f)).run()},K2=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=Wn(t,r.schema);return ed(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},Q2=(t,e,n={})=>({state:r,commands:i})=>{const o=We(t,r.schema),s=We(e,r.schema),a=us(r,o,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},X2=(t,e={})=>({state:n,commands:r})=>{const i=We(t,n.schema);return us(n,i,e)?r.lift(i):r.wrapIn(i,e)},J2=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},Z2=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},e_=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Wn(t,r.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&s){let{from:h,to:f}=a;const p=(o=u.marks().find(y=>y.type===l))==null?void 0:o.attrs,g=Ul(u,l,p);g&&(h=g.from,f=g.to),n.removeMark(h,f,l)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},t_=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let o,s;return typeof t=="number"?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(a,l)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},n_=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=$l(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(o=We(t,r.schema)),a==="mark"&&(s=Wn(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let h,f,p,g;n.selection.empty?r.doc.nodesBetween(c,d,(y,b)=>{o&&o===y.type&&(l=!0,p=Math.max(b,c),g=Math.min(b+y.nodeSize,d),h=b,f=y)}):r.doc.nodesBetween(c,d,(y,b)=>{b<c&&o&&o===y.type&&(l=!0,p=Math.max(b,c),g=Math.min(b+y.nodeSize,d),h=b,f=y),b>=c&&b<=d&&(o&&o===y.type&&(l=!0,i&&n.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(C=>{if(s===C.type&&(l=!0,i)){const w=Math.max(b,c),v=Math.min(b+y.nodeSize,d);n.addMark(w,v,s.create({...C.attrs,...e}))}}))}),f&&(h!==void 0&&i&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(y=>{s===y.type&&i&&n.addMark(p,g,s.create({...y.attrs,...e}))}))}),l},r_=(t,e={})=>({state:n,dispatch:r})=>{const i=We(t,n.schema);return Rx(i,e)(n,r)},i_=(t,e={})=>({state:n,dispatch:r})=>{const i=We(t,n.schema);return Px(i,e)(n,r)},o_=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},s_=class{constructor(e){var n;this.find=e.find,this.handler=e.handler,this.undoable=(n=e.undoable)!=null?n:!0}},a_=(t,e)=>{if(Ch(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function na(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=D2(u)+o;return s.forEach(h=>{if(c)return;const f=a_(d,h.find);if(!f)return;const p=l.state.tr,g=Fl({state:l.state,transaction:p}),y={from:r-(f[0].length-o.length),to:i},{commands:b,chain:C,can:w}=new Hl({editor:n,state:g});h.handler({state:g,range:y,match:f,commands:b,chain:C,can:w})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:o}),l.dispatch(p),c=!0)}),c}function l_(t){const{editor:e,rules:n}=t,r=new re({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=wh(M.from(c),s.schema);const{from:d}=l,h=d+c.length;na({editor:e,from:d,to:h,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return na({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&na({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?na({editor:e,from:s.pos,to:s.pos,text:`
13
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function u_(t){return Object.prototype.toString.call(t).slice(8,-1)}function ra(t){return u_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ey(t,e){const n={...t};return ra(t)&&ra(e)&&Object.keys(e).forEach(r=>{ra(e[r])&&ra(t[r])?n[r]=ey(t[r],e[r]):n[r]=e[r]}),n}var Mh=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...be(W(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...be(W(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>ey(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},cn=class ty extends Mh{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new ty(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(u=>u?.type.name===n.name))return!1;const l=s.find(u=>u?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function c_(t){return typeof t=="number"}var d_=class{constructor(t){this.find=t.find,this.handler=t.handler}},h_=(t,e,n)=>{if(Ch(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function f_(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Hl({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,p)=>{var g,y,b,C,w;if((y=(g=f.type)==null?void 0:g.spec)!=null&&y.code||!(f.isText||f.isTextblock||f.isInline))return;const v=(w=(C=(b=f.content)==null?void 0:b.size)!=null?C:f.nodeSize)!=null?w:0,O=Math.max(r,p),_=Math.min(i,p+v);if(O>=_)return;const R=f.isText?f.text||"":f.textBetween(O-p,_-p,void 0,"");h_(R,o.find,s).forEach(z=>{if(z.index===void 0)return;const N=O+z.index+1,j=N+z[0].length,V={from:n.tr.mapping.map(N),to:n.tr.mapping.map(j)},Z=o.handler({state:n,range:V,match:z,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});d.push(Z)})}),d.every(f=>f!==null)}var ia=null,p_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function m_(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:c,from:d,to:h,rule:f,pasteEvt:p})=>{const g=c.tr,y=Fl({state:c,transaction:g});if(!(!f_({editor:e,state:y,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(c=>new re({view(d){const h=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(ia=e)},f=()=>{ia&&(ia=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(o=r===d.dom.parentElement,a=h,!o){const f=ia;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return s=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!i,y=p.getMeta("uiEvent")==="drop"&&!o,b=p.getMeta("applyPasteRules"),C=!!b;if(!g&&!y&&!C)return;if(C){let{text:O}=b;typeof O=="string"?O=O:O=wh(M.from(O),f.schema);const{from:_}=b,R=_+O.length,U=p_(O);return l({rule:c,state:f,from:_,to:{b:R},pasteEvt:U})}const w=h.doc.content.findDiffStart(f.doc.content),v=h.doc.content.findDiffEnd(f.doc.content);if(!(!c_(w)||!v||w===v.b))return l({rule:c,state:f,from:w,to:v,pasteEvt:s})}}))}var ql=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Ah(t),this.schema=Y1(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:To(e.name,this.schema)},r=W(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return $o([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:To(r.name,this.schema)},o=[],s=W(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&W(r,"exitable",i)&&(a.ArrowRight=()=>cn.handleExit({editor:t,mark:r})),s){const h=Object.fromEntries(Object.entries(s()).map(([f,p])=>[f,()=>p({editor:t})]));a={...a,...h}}const l=P1(a);o.push(l);const u=W(r,"addInputRules",i);if(dm(r,t.options.enableInputRules)&&u){const h=u();if(h&&h.length){const f=l_({editor:t,rules:h}),p=Array.isArray(f)?f:[f];o.push(...p)}}const c=W(r,"addPasteRules",i);if(dm(r,t.options.enablePasteRules)&&c){const h=c();if(h&&h.length){const f=m_({editor:t,rules:h});o.push(...f)}}const d=W(r,"addProseMirrorPlugins",i);if(d){const h=d();o.push(...h)}return o})}get attributes(){return W1(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Yi(this.extensions);return Object.fromEntries(e.filter(n=>!!W(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:We(n.name,this.schema)},o=W(n,"addNodeView",i);if(!o)return[];const s=o();if(!s)return[];const a=(l,u,c,d,h)=>{const f=al(l,r);return s({node:l,view:u,getPos:c,decorations:d,innerDecorations:h,editor:t,extension:n,HTMLAttributes:f})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return $o([...this.extensions].reverse()).reduceRight((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:To(i.name,this.schema)},s=W(i,"dispatchTransaction",o);return s?a=>{s.call(o,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return $o([...this.extensions]).reduce((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:To(i.name,this.schema)},s=W(i,"transformPastedHTML",o);return s?(a,l)=>{const u=r(a,l);return s.call(o,u)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Yi(this.extensions);return Object.fromEntries(e.filter(n=>!!W(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Wn(n.name,this.schema)},o=W(n,"addMarkView",i);if(!o)return[];const s=(a,l,u)=>{const c=al(a,r);return o()({mark:a,view:l,inline:u,editor:t,extension:n,HTMLAttributes:c,updateAttributes:d=>{N_(a,t,d)}})};return[n.name,s]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:To(e.name,this.schema)};e.type==="mark"&&((n=be(W(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=W(e,"onBeforeCreate",r),o=W(e,"onCreate",r),s=W(e,"onUpdate",r),a=W(e,"onSelectionUpdate",r),l=W(e,"onTransaction",r),u=W(e,"onFocus",r),c=W(e,"onBlur",r),d=W(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};ql.resolve=Ah;ql.sort=$o;ql.flatten=xh;var wi={};Th(wi,{ClipboardTextSerializer:()=>ry,Commands:()=>iy,Delete:()=>oy,Drop:()=>sy,Editable:()=>ay,FocusEvents:()=>uy,Keymap:()=>cy,Paste:()=>dy,Tabindex:()=>hy,TextDirection:()=>fy,focusEventsPluginKey:()=>ly});var _e=class ny extends Mh{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new ny(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},ry=_e.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new re({key:new he("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(c=>c.$from.pos)),a=Math.max(...o.map(c=>c.$to.pos)),l=K1(n);return G1(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),iy=_e.create({name:"commands",addCommands(){return{...B1}}}),oy=_e.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const o=()=>{var s,a,l,u;if((u=(l=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?u:t.getMeta("y-sync$"))return;const c=zl(t.before,[t,...e]);_h(c).forEach(f=>{c.mapping.mapResult(f.oldRange.from).deletedAfter&&c.mapping.mapResult(f.oldRange.to).deletedBefore&&c.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,g)=>{const y=g+p.nodeSize-2,b=f.oldRange.from<=g&&y<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:y,newFrom:c.mapping.map(g),newTo:c.mapping.map(y),deletedRange:f.oldRange,newRange:f.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:c})})});const h=c.mapping;c.steps.forEach((f,p)=>{var g,y;if(f instanceof nn){const b=h.slice(p).map(f.from,-1),C=h.slice(p).map(f.to),w=h.invert().map(b,-1),v=h.invert().map(C),O=b>0?(g=c.doc.nodeAt(b-1))==null?void 0:g.marks.some(R=>R.eq(f.mark)):!1,_=(y=c.doc.nodeAt(C))==null?void 0:y.marks.some(R=>R.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:w,to:v},newRange:{from:b,to:C},partial:!!(_||O),editor:this.editor,transaction:t,combinedTransform:c})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),sy=_e.create({name:"drop",addProseMirrorPlugins(){return[new re({key:new he("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),ay=_e.create({name:"editable",addProseMirrorPlugins(){return[new re({key:new he("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ly=new he("focusEvents"),uy=_e.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new re({key:ly,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),cy=_e.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:d}=l,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,g=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,b=g&&p.parent.childCount===1?y===d.pos:G.atStart(u).from===h;return!c||!f.type.isTextblock||f.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return as()||z1()?o:i},addProseMirrorPlugins(){return[new re({key:new he("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=G.atStart(e.doc).from,u=G.atEnd(e.doc).to;if(o||!(s===l&&a===u)||!Ih(n.doc))return;const h=n.tr,f=Fl({state:n,transaction:h}),{commands:p}=new Hl({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),dy=_e.create({name:"paste",addProseMirrorPlugins(){return[new re({key:new he("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),hy=_e.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new re({key:new he("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),fy=_e.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Yi(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new re({key:new he("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),g_=class vo{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new vo(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new vo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new vo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(o?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!s&&l.depth<=this.depth)return;const u=new vo(l,this.editor,i,i||s?n:null);i&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>n[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},b_=`.ProseMirror {
14
+ position: relative;
15
+ }
16
+
17
+ .ProseMirror {
18
+ word-wrap: break-word;
19
+ white-space: pre-wrap;
20
+ white-space: break-spaces;
21
+ -webkit-font-variant-ligatures: none;
22
+ font-variant-ligatures: none;
23
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
+ }
25
+
26
+ .ProseMirror [contenteditable="false"] {
27
+ white-space: normal;
28
+ }
29
+
30
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
+ white-space: pre-wrap;
32
+ }
33
+
34
+ .ProseMirror pre {
35
+ white-space: pre-wrap;
36
+ }
37
+
38
+ img.ProseMirror-separator {
39
+ display: inline !important;
40
+ border: none !important;
41
+ margin: 0 !important;
42
+ width: 0 !important;
43
+ height: 0 !important;
44
+ }
45
+
46
+ .ProseMirror-gapcursor {
47
+ display: none;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ margin: 0;
51
+ }
52
+
53
+ .ProseMirror-gapcursor:after {
54
+ content: "";
55
+ display: block;
56
+ position: absolute;
57
+ top: -2px;
58
+ width: 20px;
59
+ border-top: 1px solid black;
60
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
+ }
62
+
63
+ @keyframes ProseMirror-cursor-blink {
64
+ to {
65
+ visibility: hidden;
66
+ }
67
+ }
68
+
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+
73
+ .ProseMirror-hideselection *::-moz-selection {
74
+ background: transparent;
75
+ }
76
+
77
+ .ProseMirror-hideselection * {
78
+ caret-color: transparent;
79
+ }
80
+
81
+ .ProseMirror-focused .ProseMirror-gapcursor {
82
+ display: block;
83
+ }`;function y_(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var E_=class extends o_{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:R2,createMappablePosition:P2},this.setOptions(t),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:r,slice:i,moved:o})=>this.options.onDrop(r,i,o)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=H1(e,this.options.autofocus);this.editorState=_i.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}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&&typeof document<"u"&&(this.css=y_(b_,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=j1(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;n=n.filter(s=>!s.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const o=[...this.options.enableCoreExtensions?[ay,ry.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),iy,uy,cy,hy.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),sy,dy,oy,fy.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new ql(o,this)}createCommandManager(){this.commandManager=new Hl({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=ol(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=ol(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new R1(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=s?.getMeta("focus"),l=s?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Q1(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return v2(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return wh(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
84
+
85
+ `,textSerializers:n={}}=t||{};return N2(this.state.doc,{blockSeparator:e,textSerializers:{...K1(this.schema),...n}})}get isEmpty(){return Ih(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new g_(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Gi(t){return new s_({find:t.find,handler:({state:e,range:n,match:r})=>{const i=be(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),u=n.from+a.indexOf(s),c=u+s.length;if(Nh(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(g=>g===t.type&&g!==f.mark.type)).filter(f=>f.to>u).length)return null;c<n.to&&o.delete(c,n.to),u>n.from&&o.delete(n.from+l,u);const h=n.from+l+s.length;o.addMark(n.from+l,h,t.type.create(i||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}var k_={};Th(k_,{createAtomBlockMarkdownSpec:()=>T_,createBlockMarkdownSpec:()=>C_,createInlineMarkdownSpec:()=>w_,parseAttributes:()=>Oh,parseIndentedBlocks:()=>A_,renderNestedMarkdownContent:()=>__,serializeAttributes:()=>Dh});function Oh(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(c=>c.trim().slice(1));e.class=u.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,u,c])=>{var d;const h=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=n[h];f&&(e[u]=f.slice(1,-1))});const l=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 l&&l.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(e[c]=!0)}),e}function Dh(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function T_(t){const{nodeName:e,name:n,parseAttributes:r=Oh,serializeAttributes:i=Dh,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:a}=t,l=n||e,u=c=>{if(!a)return c;const d={};return a.forEach(h=>{h in c&&(d[h]=c[h])}),d};return{parseMarkdown:(c,d)=>{const h={...o,...c.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(c){var d;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(d=c.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(c,d,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=c.match(f);if(!p)return;const g=p[1]||"",y=r(g);if(!s.find(C=>!(C in y)))return{type:e,raw:p[0],attributes:y}}},renderMarkdown:c=>{const d=u(c.attrs||{}),h=i(d),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function C_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Oh,serializeAttributes:o=Dh,defaultAttributes:s={},content:a="block",allowedAttributes:l}=t,u=n||e,c=d=>{if(!l)return d;const h={};return l.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(r){const g=r(d);f=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const p={...s,...d.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${u}`,"m"),p=(h=d.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(d,h,f){var p;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(g);if(!y)return;const[b,C=""]=y,w=i(C);let v=1;const O=b.length;let _="";const R=/^:::([\w-]*)(\s.*)?/gm,U=d.slice(O);for(R.lastIndex=0;;){const z=R.exec(U);if(z===null)break;const N=z.index,j=z[1];if(!((p=z[2])!=null&&p.endsWith(":::"))){if(j)v+=1;else if(v-=1,v===0){const V=U.slice(0,N);_=V.trim();const Z=d.slice(0,O+N+z[0].length);let ie=[];if(_)if(a==="block")for(ie=f.blockTokens(V),ie.forEach(K=>{K.text&&(!K.tokens||K.tokens.length===0)&&(K.tokens=f.inlineTokens(K.text))});ie.length>0;){const K=ie[ie.length-1];if(K.type==="paragraph"&&(!K.text||K.text.trim()===""))ie.pop();else break}else ie=f.inlineTokens(_);return{type:e,raw:Z,attributes:w,content:_,tokens:ie}}}}}},renderMarkdown:(d,h)=>{const f=c(d.attrs||{}),p=o(f),g=p?` {${p}}`:"",y=h.renderChildren(d.content||[],`
86
+
87
+ `);return`:::${u}${g}
88
+
89
+ ${y}
90
+
91
+ :::`}}}function S_(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,o,s]=r;e[i]=o||s,r=n.exec(t)}return e}function x_(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function w_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=S_,serializeAttributes:o=x_,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=t,u=n||e,c=h=>{if(!l)return h;const f={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,y=typeof p=="string"?void 0:p.skipIfDefault;if(g in h){const b=h[g];if(y!==void 0&&b===y)return;f[g]=b}}),f},d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...s,...h.attributes};if(a)return f.createNode(e,p);const g=r?r(h):h.content||"";return g?f.createNode(e,p,[f.createTextNode(g)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=h.match(f),g=p?.index;return g!==void 0?g:-1},tokenize(h,f,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=h.match(g);if(!y)return;let b="",C="";if(a){const[,v]=y;C=v}else{const[,v,O]=y;C=v,b=O||""}const w=i(C.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=c(h.attrs||{}),g=o(p),y=g?` ${g}`:"";return a?`[${u}${y}]`:`[${u}${y}]${f}[/${u}]`}}}function A_(t,e,n){var r,i,o,s;const a=t.split(`
92
+ `),l=[];let u="",c=0;const d=e.baseIndentSize||2;for(;c<a.length;){const h=a[c],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){c+=1,u=`${u}${h}
93
+ `;continue}else return}const p=e.extractItemData(f),{indentLevel:g,mainContent:y}=p;u=`${u}${h}
94
+ `;const b=[y];for(c+=1;c<a.length;){const O=a[c];if(O.trim()===""){const R=a.slice(c+1).findIndex(N=>N.trim()!=="");if(R===-1)break;if((((i=(r=a[c+1+R].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){b.push(O),u=`${u}${O}
95
+ `,c+=1;continue}else break}if((((s=(o=O.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:s.length)||0)>g)b.push(O),u=`${u}${O}
96
+ `,c+=1;else break}let C;const w=b.slice(1);if(w.length>0){const O=w.map(_=>_.slice(g+d)).join(`
97
+ `);O.trim()&&(e.customNestedParser?C=e.customNestedParser(O):C=n.blockTokens(O))}const v=e.createToken(p,C);l.push(v)}if(l.length!==0)return{items:l,raw:u}}function __(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[o,...s]=t.content,a=e.renderChildren([o]);let l=`${i}${a}`;return s&&s.length>0&&s.forEach((u,c)=>{var d,h;const f=(h=(d=e.renderChild)==null?void 0:d.call(e,u,c+1))!=null?h:e.renderChildren([u]);if(f!=null){const p=f.split(`
98
+ `).map(g=>g?e.indent(g):e.indent("")).join(`
99
+ `);l+=u.type==="paragraph"?`
100
+
101
+ ${p}`:`
102
+ ${p}`}}),l}function N_(t,e,n={}){const{state:r}=e,{doc:i,tr:o}=r,s=t;i.descendants((a,l)=>{const u=o.mapping.map(l),c=o.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==s)return!1;d=f}),!d)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});o.removeMark(u,c,t.type),o.addMark(u,c,f)}}),o.docChanged&&e.view.dispatch(o)}var dn=class py extends Mh{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new py(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Pz=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,o,s,a;const{view:l}=this.editor,u=t.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(u)||!c)return;let d=0,h=0;if(this.dom!==c){const C=this.dom.getBoundingClientRect(),w=c.getBoundingClientRect(),v=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,O=(s=t.offsetY)!=null?s:(o=t.nativeEvent)==null?void 0:o.offsetY;d=w.x-C.x+v,h=w.y-C.y+O}const f=this.dom.cloneNode(!0);try{const C=this.dom.getBoundingClientRect();f.style.width=`${Math.round(C.width)}px`,f.style.height=`${Math.round(C.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(a=t.dataTransfer)==null||a.setDragImage(f,d,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=q.create(l.state.doc,g),b=l.state.tr.setSelection(y);l.dispatch(b)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),o=t.type==="dragover"||t.type==="dragenter",s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!i)return!0;const{isEditable:l}=this.editor,{isDragging:u}=this,c=!!this.node.type.spec.draggable,d=q.isSelectable(this.node),h=t.type==="copy",f=t.type==="paste",p=t.type==="cut",g=t.type==="mousedown";if(!c&&d&&i&&t.target===this.dom&&t.preventDefault(),c&&i&&!u&&t.target===this.dom)return t.preventDefault(),!1;if(c&&l&&!u&&g){const y=n.closest("[data-drag-handle]");y&&(this.dom===y||this.dom.contains(y))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(u||o||s||h||f||p||g&&d)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(as()||Zc())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function Qr(t){return new d_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=be(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let u=n.to;if(a){const c=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(Nh(n.from,n.to,e.doc).filter(g=>g.mark.type.excluded.find(b=>b===t.type&&b!==g.mark.type)).filter(g=>g.to>d).length)return null;h<n.to&&s.delete(h,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+a.length,s.addMark(n.from+c,u,t.type.create(o||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||s.removeStoredMark(t.type)}}})}const sn=Math.floor,Ma=Math.abs,Vn=(t,e)=>t<e?t:e,an=(t,e)=>t>e?t:e,my=t=>t!==0?t<0:1/t<0,fm=1,pm=2,zu=4,Vu=8,cs=32,qn=64,ht=128,I_=1<<29,jl=31,td=63,zr=127,M_=2147483647,O_=crypto.getRandomValues.bind(crypto),D_=Math.random,gy=()=>O_(new Uint32Array(1))[0],v_=t=>t[sn(D_()*t.length)],L_="10000000-1000-4000-8000"+-1e11,vh=()=>L_.replace(/[018]/g,t=>(t^gy()&15>>t/4).toString(16));let nd,rd;if(typeof WeakMap<"u"){let t=new WeakMap;nd=e=>t.get(e),rd=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;nd=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},rd=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ce=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[e+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:a,top:l,bottom:u}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,u)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o}}static get(t){return nd(t)||rd(t,R_(t))}};function R_(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=P_(t),n=t.childCount,r=[];let i=0,o=null;const s=[];for(let u=0,c=e*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){const d=t.child(u);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:y,rowspan:b,colwidth:C}=g.attrs;for(let w=0;w<b;w++){if(w+u>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:c,n:b-w});break}const v=i+w*e;for(let O=0;O<y;O++){r[v+O]==0?r[v+O]=c:(o||(o=[])).push({type:"collision",row:u,pos:c,n:y-O});const _=C&&C[O];if(_){const R=(v+O)%e*2,U=s[R];U==null||U!=_&&s[R+1]==1?(s[R]=_,s[R+1]=1):U==_&&s[R+1]++}}}i+=y,c+=g.nodeSize}const h=(u+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(o||(o=[])).push({type:"missing",row:u,n:f}),c++}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const a=new Ce(e,n,r,o);let l=!1;for(let u=0;!l&&u<s.length;u+=2)s[u]!=null&&s[u+1]<n&&(l=!0);return l&&B_(a,s,t),a}function P_(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let o=0;if(n)for(let s=0;s<r;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const u=a.child(l);s+u.attrs.rowspan>r&&(o+=u.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function B_(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const o=t.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let u=0;u<l.colspan;u++){const c=e[(i+u)%t.width*2];c!=null&&(!l.colwidth||l.colwidth[u]!=c)&&((a||(a=F_(l)))[u]=c)}a&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}function F_(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function lt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const ir=new he("selectingCells");function Xr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function H_(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function wn(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Lh(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Xr(e.$head)||U_(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function U_(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function id(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function $_(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Rh(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function by(t,e,n){const r=t.node(-1),i=Ce.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function Jr(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function yy(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function z_(t,e,n){const r=lt(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var fe=class Rn extends G{constructor(e,n=e){const r=e.node(-1),i=Ce.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),a=e.node(0),l=i.cellsInRect(s).filter(c=>c!=n.pos-o);l.unshift(n.pos-o);const u=l.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const h=o+c+1;return new Ub(a.resolve(h),a.resolve(h+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(id(r)&&id(i)&&Rh(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Rn.rowSelection(r,i):o&&this.isColSelection()?Rn.colSelection(r,i):new Rn(r,i)}return $.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ce.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){const u=[];for(let c=l*n.width+i.left,d=i.left;d<i.right;d++,c++){const h=n.map[c];if(o[h])continue;o[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const g=i.left-f.left,y=f.right-i.right;if(g>0||y>0){let b=p.attrs;if(g>0&&(b=Jr(b,0,g)),y>0&&(b=Jr(b,b.colspan-y,y)),f.left<i.left){if(p=p.type.createAndFill(b),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(f.top<i.top||f.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}u.push(p)}s.push(e.child(l).copy(M.from(u)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new B(M.from(a),1,1)}replace(e,n=B.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:a,$to:l}=i[s],u=e.mapping.slice(r);e.replace(u.map(a.pos),u.map(l.pos),s?B.empty:n)}const o=G.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new B(M.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ce.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Ce.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(e=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Rn(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ce.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Rn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ce.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(e=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Rn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Rn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Rn(e.resolve(n),e.resolve(r))}getBookmark(){return new V_(this.$anchorCell.pos,this.$headCell.pos)}};fe.prototype.visible=!1;G.jsonID("cell",fe);var V_=class Ey{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ey(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Rh(n,r)?new fe(n,r):G.near(r,1)}};function q_(t){if(!(t.selection instanceof fe))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(me.node(r,r+n.nodeSize,{class:"selectedCell"}))}),le.create(t.doc,e)}function j_({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function W_({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function Y_(t,e,n){const r=(e||t).selection,i=(e||t).doc;let o,s;if(r instanceof q&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=fe.create(i,r.from);else if(s=="row"){const a=i.resolve(r.from+1);o=fe.rowSelection(a,a)}else if(!n){const a=Ce.get(r.node),l=r.from+1,u=l+a.map[a.width*a.height-1];o=fe.create(i,l+1,u)}}else r instanceof $&&j_(r)?o=$.create(i,r.from):r instanceof $&&W_(r)&&(o=$.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}const G_=new he("fix-tables");function ky(t,e,n,r){const i=t.childCount,o=e.childCount;e:for(let s=0,a=0;s<o;s++){const l=e.child(s);for(let u=a,c=Math.min(i,s+3);u<c;u++)if(t.child(u)==l){a=u+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?ky(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function K_(t,e){let n;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=Q_(t,i,o,n))};return e?e.doc!=t.doc&&ky(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Q_(t,e,n,r){const i=Ce.get(e);if(!i.problems)return r;r||(r=t.tr);const o=[];for(let l=0;l<i.height;l++)o.push(0);for(let l=0;l<i.problems.length;l++){const u=i.problems[l];if(u.type=="collision"){const c=e.nodeAt(u.pos);if(!c)continue;const d=c.attrs;for(let h=0;h<d.rowspan;h++)o[u.row+h]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,Jr(d,d.colspan-u.n,u.n))}else if(u.type=="missing")o[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let s,a;for(let l=0;l<o.length;l++)o[l]&&(s==null&&(s=l),a=l);for(let l=0,u=n+1;l<i.height;l++){const c=e.child(l),d=u+c.nodeSize,h=o[l];if(h>0){let f="cell";c.firstChild&&(f=c.firstChild.type.spec.tableRole);const p=[];for(let y=0;y<h;y++){const b=lt(t.schema)[f].createAndFill();b&&p.push(b)}const g=(l==0||s==l-1)&&a==l?u+1:d-1;r.insert(r.mapping.map(g),p)}u=d}return r.setMeta(G_,{fixTables:!0})}function An(t){const e=t.selection,n=Lh(t),r=n.node(-1),i=n.start(-1),o=Ce.get(r);return{...e instanceof fe?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function Ty(t,{map:e,tableStart:n,table:r},i){let o=i>0?-1:0;z_(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const a=s*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],u=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,yy(u.attrs,i-e.colCount(l))),s+=u.attrs.rowspan-1}else{const l=o==null?lt(r.type.schema).cell:r.nodeAt(e.map[a+o]).type,u=e.positionAt(s,i,r);t.insert(t.mapping.map(n+u),l.createAndFill())}}return t}function X_(t,e){if(!wn(t))return!1;if(e){const n=An(t);e(Ty(t.tr,n,n.left))}return!0}function J_(t,e){if(!wn(t))return!1;if(e){const n=An(t);e(Ty(t.tr,n,n.right))}return!0}function Z_(t,{map:e,table:n,tableStart:r},i){const o=t.mapping.maps.length;for(let s=0;s<e.height;){const a=s*e.width+i,l=e.map[a],u=n.nodeAt(l),c=u.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(o).map(r+l),null,Jr(c,i-e.colCount(l)));else{const d=t.mapping.slice(o).map(r+l);t.delete(d,d+u.nodeSize)}s+=c.rowspan}}function eN(t,e){if(!wn(t))return!1;if(e){const n=An(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;Z_(r,n,i),i!=n.left;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=Ce.get(o)}e(r)}return!0}function tN(t,e,n){var r;const i=lt(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if(((r=e.nodeAt(t.map[o+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function Cy(t,{map:e,tableStart:n,table:r},i){let o=n;for(let u=0;u<i;u++)o+=r.child(u).nodeSize;const s=[];let a=i>0?-1:0;tN(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let u=0,c=e.width*i;u<e.width;u++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],h=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),u+=h.colspan-1}else{var l;const d=a==null?lt(r.type.schema).cell:(l=r.nodeAt(e.map[c+a*e.width]))===null||l===void 0?void 0:l.type,h=d?.createAndFill();h&&s.push(h)}return t.insert(o,lt(r.type.schema).row.create(null,s)),t}function nN(t,e){if(!wn(t))return!1;if(e){const n=An(t);e(Cy(t.tr,n,n.top))}return!0}function rN(t,e){if(!wn(t))return!1;if(e){const n=An(t);e(Cy(t.tr,n,n.bottom))}return!0}function iN(t,{map:e,table:n,tableStart:r},i){let o=0;for(let u=0;u<i;u++)o+=n.child(u).nodeSize;const s=o+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(o+r,s+r);const l=new Set;for(let u=0,c=i*e.width;u<e.width;u++,c++){const d=e.map[c];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[c-e.width]){const h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),u+=h.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=e.positionAt(i+1,u,n);t.insert(t.mapping.slice(a).map(r+g),p),u+=f.colspan-1}}}}function oN(t,e){if(!wn(t))return!1;if(e){const n=An(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;iN(r,n,i),i!=n.top;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=Ce.get(n.table)}e(r)}return!0}function mm(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function sN({width:t,height:e,map:n},r){let i=r.top*t+r.left,o=i,s=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[o]==n[o-1]||r.right<t&&n[a]==n[a+1])return!0;o+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[s]==n[s+t])return!0;i++,s++}return!1}function aN(t,e){const n=t.selection;if(!(n instanceof fe)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=An(t),{map:i}=r;if(sN(i,r))return!1;if(e){const o=t.tr,s={};let a=M.empty,l,u;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const h=i.map[c*i.width+d],f=r.table.nodeAt(h);if(!(s[h]||!f))if(s[h]=!0,l==null)l=h,u=f;else{mm(f)||(a=a.append(f.content));const p=o.mapping.map(h+r.tableStart);o.delete(p,p+f.nodeSize)}}if(l==null||u==null)return!0;if(o.setNodeMarkup(l+r.tableStart,null,{...yy(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const c=l+1+u.content.size,d=mm(u)?l+1:c;o.replaceWith(d+r.tableStart,c+r.tableStart,a)}o.setSelection(new fe(o.doc.resolve(l+r.tableStart))),e(o)}return!0}function lN(t,e){const n=lt(t.schema);return uN(({node:r})=>n[r.type.spec.tableRole])(t,e)}function uN(t){return(e,n)=>{const r=e.selection;let i,o;if(r instanceof fe){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,o=r.$anchorCell.pos}else{var s;if(i=H_(r.$from),!i)return!1;o=(s=Xr(r.$from))===null||s===void 0?void 0:s.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const l=[],u=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const c=An(e),d=e.tr;for(let f=0;f<c.right-c.left;f++)l.push(u?{...a,colwidth:u&&u[f]?[u[f]]:null}:a);let h;for(let f=c.top;f<c.bottom;f++){let p=c.map.positionAt(f,c.left,c.table);f==c.top&&(p+=i.nodeSize);for(let g=c.left,y=0;g<c.right;g++,y++)g==c.left&&f==c.top||d.insert(h=d.mapping.map(p+c.tableStart,1),t({node:i,row:f,col:g}).createAndFill(l[y]))}d.setNodeMarkup(o,t({node:i,row:c.top,col:c.left}),l[0]),r instanceof fe&&d.setSelection(new fe(d.doc.resolve(r.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function cN(t){return function(e,n){if(!wn(e))return!1;if(n){const r=lt(e.schema),i=An(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length===0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o)}return!0}}function gm(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function Ph(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?cN(t):function(n,r){if(!wn(n))return!1;if(r){const i=lt(n.schema),o=An(n),s=n.tr,a=gm("row",o,i),l=gm("column",o,i),u=(t==="column"?a:t==="row"&&l)?1:0,c=t=="column"?{left:0,top:u,right:1,bottom:o.map.height}:t=="row"?{left:u,top:0,right:o.map.width,bottom:1}:o,d=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(c).forEach(h=>{const f=h+o.tableStart,p=s.doc.nodeAt(f);p&&s.setNodeMarkup(f,d,p.attrs)}),r(s)}return!0}}Ph("row",{useDeprecatedLogic:!0});Ph("column",{useDeprecatedLogic:!0});Ph("cell",{useDeprecatedLogic:!0});function dN(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function bm(t){return function(e,n){if(!wn(e))return!1;const r=dN(Lh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection($.between(i,$_(i))).scrollIntoView())}return!0}}function oa(t,e){const n=t.selection;if(!(n instanceof fe))return!1;if(e){const r=t.tr,i=lt(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new B(i,0,0))}),r.docChanged&&e(r)}return!0}function hN(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let l=0;l<e.childCount;l++){let u=e.child(l).content;const c=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(u=od(lt(s).row,new B(u,c,d)).content),a.push(u)}else if(o=="cell"||o=="header_cell")a.push(n||r?od(lt(s).row,new B(e,n,r)).content:e);else return null;return fN(s,a)}function fN(t,e){const n=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=o.child(s).attrs;for(let u=i;u<i+a;u++)n[u]=(n[u]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(M.empty),n[i]<r){const o=lt(t).cell.createAndFill(),s=[];for(let a=n[i];a<r;a++)s.push(o);e[i]=e[i].append(M.from(s))}return{height:e.length,width:r,rows:e}}function od(t,e){const n=t.createAndFill();return new ih(n).replace(0,n.content.size,e).doc}function pN({width:t,height:e,rows:n},r,i){if(t!=r){const o=[],s=[];for(let a=0;a<n.length;a++){const l=n[a],u=[];for(let c=o[a]||0,d=0;c<r;d++){let h=l.child(d%l.childCount);c+h.attrs.colspan>r&&(h=h.type.createChecked(Jr(h.attrs,h.attrs.colspan,c+h.attrs.colspan-r),h.content)),u.push(h),c+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)o[a+f]=(o[a+f]||0)+h.attrs.colspan}s.push(M.from(u))}n=s,t=r}if(e!=i){const o=[];for(let s=0,a=0;s<i;s++,a++){const l=[],u=n[a%e];for(let c=0;c<u.childCount;c++){let d=u.child(c);s+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}o.push(M.from(l))}n=o,e=i}return{width:t,height:e,rows:n}}function mN(t,e,n,r,i,o,s){const a=t.doc.type.schema,l=lt(a);let u,c;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==l.cell?g=u||(u=l.cell.createAndFill()):g=c||(c=l.header_cell.createAndFill());for(let y=e.width;y<i;y++)p.push(g);t.insert(t.mapping.slice(s).map(h-1+r),p)}if(o>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const y=p>=e.width?!1:n.nodeAt(e.map[g+p]).type==l.header_cell;d.push(y?c||(c=l.header_cell.createAndFill()):u||(u=l.cell.createAndFill()))}const h=l.row.create(null,M.from(d)),f=[];for(let p=e.height;p<o;p++)f.push(h);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),f)}return!!(u||c)}function ym(t,e,n,r,i,o,s,a){if(s==0||s==e.height)return!1;let l=!1;for(let u=i;u<o;u++){const c=s*e.width+u,d=e.map[c];if(e.map[c-e.width]==d){l=!0;const h=n.nodeAt(d),{top:f,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:s-f}),t.insert(t.mapping.slice(a).map(e.positionAt(s,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-s})),u+=h.attrs.colspan-1}}return l}function Em(t,e,n,r,i,o,s,a){if(s==0||s==e.width)return!1;let l=!1;for(let u=i;u<o;u++){const c=u*e.width+s,d=e.map[c];if(e.map[c-1]==d){l=!0;const h=n.nodeAt(d),f=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,Jr(h.attrs,s-f,h.attrs.colspan-(s-f))),t.insert(p+h.nodeSize,h.type.createAndFill(Jr(h.attrs,0,s-f))),u+=h.attrs.rowspan-1}}return l}function km(t,e,n,r,i){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let s=Ce.get(o);const{top:a,left:l}=r,u=l+i.width,c=a+i.height,d=t.tr;let h=0;function f(){if(o=n?d.doc.nodeAt(n-1):d.doc,!o)throw new Error("No table found");s=Ce.get(o),h=d.mapping.maps.length}mN(d,s,o,n,u,c,h)&&f(),ym(d,s,o,n,l,u,a,h)&&f(),ym(d,s,o,n,l,u,c,h)&&f(),Em(d,s,o,n,a,c,l,h)&&f(),Em(d,s,o,n,a,c,u,h)&&f();for(let p=a;p<c;p++){const g=s.positionAt(p,l,o),y=s.positionAt(p,u,o);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(y+n),new B(i.rows[p-a],0,0))}f(),d.setSelection(new fe(d.doc.resolve(n+s.positionAt(a,l,o)),d.doc.resolve(n+s.positionAt(c-1,u-1,o)))),e(d)}const gN=kh({ArrowLeft:sa("horiz",-1),ArrowRight:sa("horiz",1),ArrowUp:sa("vert",-1),ArrowDown:sa("vert",1),"Shift-ArrowLeft":aa("horiz",-1),"Shift-ArrowRight":aa("horiz",1),"Shift-ArrowUp":aa("vert",-1),"Shift-ArrowDown":aa("vert",1),Backspace:oa,"Mod-Backspace":oa,Delete:oa,"Mod-Delete":oa});function Oa(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function sa(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof fe)return Oa(n,r,G.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const s=Sy(i,t,e);if(s==null)return!1;if(t=="horiz")return Oa(n,r,G.near(n.doc.resolve(o.head+e),e));{const a=n.doc.resolve(s),l=by(a,t,e);let u;return l?u=G.near(l,1):e<0?u=G.near(n.doc.resolve(a.before(-1)),-1):u=G.near(n.doc.resolve(a.after(-1)),1),Oa(n,r,u)}}}function aa(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof fe)s=o;else{const l=Sy(i,t,e);if(l==null)return!1;s=new fe(n.doc.resolve(l))}const a=by(s.$headCell,t,e);return a?Oa(n,r,new fe(s.$anchorCell,a)):!1}}function bN(t,e){const n=t.state.doc,r=Xr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new fe(r))),!0):!1}function yN(t,e,n){if(!wn(t.state))return!1;let r=hN(n);const i=t.state.selection;if(i instanceof fe){r||(r={width:1,height:1,rows:[M.from(od(lt(t.state.schema).cell,n))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=Ce.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=pN(r,a.right-a.left,a.bottom-a.top),km(t.state,t.dispatch,s,a,r),!0}else if(r){const o=Lh(t.state),s=o.start(-1);return km(t.state,t.dispatch,s,Ce.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function EN(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Tm(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof fe)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Xr(t.state.selection.$anchor))!=null&&((n=qu(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(l,u){let c=qu(t,u);const d=ir.getState(t.state)==null;if(!c||!Rh(l,c))if(d)c=l;else return;const h=new fe(l,c);if(d||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);d&&f.setMeta(ir,l.pos),t.dispatch(f)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),ir.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ir,-1))}function a(l){const u=l,c=ir.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(Tm(t,u.target)!=r&&(d=qu(t,e),!d))return s();d&&o(d,u)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function Sy(t,e,n){if(!(t.state.selection instanceof $))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const s=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function Tm(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function qu(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Xr(t.state.doc.resolve(r))||Xr(t.state.doc.resolve(i))}var xy=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),sd(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,sd(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function sd(t,e,n,r,i,o){let s=0,a=!0,l=e.firstChild;const u=t.firstChild;if(u){for(let d=0,h=0;d<u.childCount;d++){const{colspan:f,colwidth:p}=u.child(d).attrs;for(let g=0;g<f;g++,h++){const y=i==h?o:p&&p[g],b=y?y+"px":"";if(s+=y||r,y||(a=!1),l)l.style.width!=b&&(l.style.width=b),l=l.nextSibling;else{const C=document.createElement("col");C.style.width=b,e.appendChild(C)}}}for(;l;){var c;const d=l.nextSibling;(c=l.parentNode)===null||c===void 0||c.removeChild(l),l=d}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const Ot=new he("tableColumnResizing");function kN({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=xy,lastColumnResizable:i=!0}={}){const o=new re({key:Ot,state:{init(s,a){var l;const u=(l=o.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,c=lt(a.schema).table.name;return r&&u&&(u[c]=(d,h)=>new r(d,n,h)),new TN(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Ot.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{CN(s,a,t,i)},mouseleave:s=>{SN(s)},mousedown:(s,a)=>{xN(s,a,e,n)}},decorations:s=>{const a=Ot.getState(s);if(a&&a.activeHandle>-1)return IN(s,a.activeHandle)},nodeViews:{}}});return o}var TN=class Da{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Ot);if(r&&r.setHandle!=null)return new Da(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Da(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return id(e.doc.resolve(i))||(i=-1),new Da(i,n.dragging)}return n}};function CN(t,e,n,r){if(!t.editable)return;const i=Ot.getState(t.state);if(i&&!i.dragging){const o=AN(e.target);let s=-1;if(o){const{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=Cm(t,e,"left",n):l-e.clientX<=n&&(s=Cm(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){const a=t.state.doc.resolve(s),l=a.node(-1),u=Ce.get(l),c=a.start(-1);if(u.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==u.width-1)return}wy(t,s)}}}function SN(t){if(!t.editable)return;const e=Ot.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&wy(t,-1)}function xN(t,e,n,r){var i;if(!t.editable)return!1;const o=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=Ot.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),l=wN(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Ot,{setDragging:{startX:e.clientX,startWidth:l}}));function u(d){o.removeEventListener("mouseup",u),o.removeEventListener("mousemove",c);const h=Ot.getState(t.state);h?.dragging&&(_N(t,h.activeHandle,Sm(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Ot,{setDragging:null})))}function c(d){if(!d.which)return u(d);const h=Ot.getState(t.state);if(h&&h.dragging){const f=Sm(h.dragging,d,n);xm(t,h.activeHandle,f,r)}}return xm(t,s.activeHandle,l,r),o.addEventListener("mouseup",u),o.addEventListener("mousemove",c),e.preventDefault(),!0}function wN(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=t.domAtPos(e);let s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let l=0;l<n;l++)r[l]&&(s-=r[l],a--);return s/a}function AN(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Cm(t,e,n,r){const i=n=="right"?-r:r,o=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,a=Xr(t.state.doc.resolve(s));if(!a)return-1;if(n=="right")return a.pos;const l=Ce.get(a.node(-1)),u=a.start(-1),c=l.map.indexOf(a.pos-u);return c%l.width==0?-1:u+l.map[c-1]}function Sm(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function wy(t,e){t.dispatch(t.state.tr.setMeta(Ot,{setHandle:e}))}function _N(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),o=Ce.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let u=0;u<o.height;u++){const c=u*o.width+a;if(u&&o.map[c]==o.map[c-o.width])continue;const d=o.map[c],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-o.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():NN(h.colspan);p[f]=n,l.setNodeMarkup(s+d,null,{...h,colwidth:p})}l.docChanged&&t.dispatch(l)}function xm(t,e,n,r){const i=t.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),a=Ce.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&sd(o,l.firstChild,l,r,a,n)}function NN(t){return Array(t).fill(0)}function IN(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return le.empty;const o=Ce.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let u=0;u<o.height;u++){const c=a+u*o.width;if((a==o.width-1||o.map[c]!=o.map[c+1])&&(u==0||o.map[c]!=o.map[c-o.width])){var l;const d=o.map[c],h=s+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((l=Ot.getState(t))===null||l===void 0)&&l.dragging&&n.push(me.node(s+d,s+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(me.widget(h,f))}}return le.create(t.doc,n)}function MN({allowTableNodeSelection:t=!1}={}){return new re({key:ir,state:{init(){return null},apply(e,n){const r=e.getMeta(ir);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:o}=e.mapping.mapResult(n);return i?null:o}},props:{decorations:q_,handleDOMEvents:{mousedown:EN},createSelectionBetween(e){return ir.getState(e.state)!=null?e.state.selection:null},handleTripleClick:bN,handleKeyDown:gN,handlePaste:yN},appendTransaction(e,n,r){return Y_(r,K_(r,n),t)}})}var ON=class Ay{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,n,r){e<0||this.cache.set(e,[n,r])}replace(e,n,r,i){this.remove(e),this.set(n,r,i)}remove(e){this.cache.delete(e)}invalidate(e){const n=new Ay(this.cache),r=e.mapping;return this.cache.forEach(([i,o],s)=>{if(s<0)return;const a=r.mapResult(s),l=e.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(i))n.remove(s);else if(s!==a.pos){const u=o.map(c=>c.map(r,0,0)).filter(c=>c!=null);n.replace(s,a.pos,l,u)}}),n}};function DN({parser:t,nodeTypes:e=["code_block","codeBlock"],languageExtractor:n=r=>r.attrs.language}){const r=new he("prosemirror-highlight");return new re({key:r,state:{init(i,o){const s=new ON,[a,l]=wm(o.doc,t,e,n,s);return{cache:s,decorations:a,promises:l}},apply:(i,o)=>{const s=o.cache.invalidate(i),a=!!i.getMeta("prosemirror-highlight-refresh");if(!i.docChanged&&!a)return{cache:s,decorations:o.decorations?.map(i.mapping,i.doc),promises:o.promises};const[l,u]=wm(i.doc,t,e,n,s);return{cache:s,decorations:l,promises:u}}},view:i=>{const o=new Set,s=()=>{if(o.size>0||i.isDestroyed)return;const l=i.state.tr.setMeta("prosemirror-highlight-refresh",!0);i.dispatch(l)},a=()=>{const l=r.getState(i.state);for(const u of l?.promises??[])o.add(u),u.then(()=>{o.delete(u),s()}).catch(c=>{console.error("[prosemirror-highlight] Error resolving parser:",c),o.delete(u)})};return a(),{update:()=>{a()}}},props:{decorations(i){return this.getState(i)?.decorations}}})}function wm(t,e,n,r,i){const o=[],s=[],a=vN(t,n);try{for(const[l,u]of a){const c=r(l),d=i.get(u);if(d){const[h,f]=d;f.length>0&&o.push(f)}else{const h=e({content:l.textContent,language:c||void 0,pos:u,size:l.nodeSize});h&&Array.isArray(h)?(i.set(u,l,h),h.length>0&&o.push(h)):h instanceof Promise?(i.remove(u),s.push(h)):console.error("[prosemirror-highlight] Invalid parser result:",h)}}}catch(l){console.error("[prosemirror-highlight] Error parsing code blocks:",l)}return[o.length>0?le.create(t,o.flat()):void 0,s]}function vN(t,e){const n=[];return t.descendants((r,i)=>{if(r.type.inlineContent&&e.includes(r.type.name))return n.push([r,i]),!1}),n}function LN(t,e){return function({content:r,language:i,pos:o,size:s}){const a=[],{tokens:l,fg:u,bg:c,rootStyle:d}=t.codeToTokens(r,{lang:i,theme:t.getLoadedThemes()[0]}),h=d||(u&&c?`--prosemirror-highlight:${u};--prosemirror-highlight-bg:${c}`:"");if(h){const p=me.node(o,o+s,{style:h});a.push(p)}let f=o+1;for(const p of l){for(const g of p){const y=f+g.content.length,b=me.inline(f,y,{style:RN(g.htmlStyle??`color: ${g.color}`),class:"shiki"});a.push(b),f=y}f+=1}return a}}function RN(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const Wt=()=>new Map,ad=t=>{const e=Wt();return t.forEach((n,r)=>{e.set(r,n)}),e},_n=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},PN=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},BN=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Zr=()=>new Set,ju=t=>t[t.length-1],FN=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},br=Array.from,Bh=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Fh=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},HN=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ki=Array.isArray;class _y{constructor(){this._observers=Wt()}on(e,n){return _n(this._observers,e,Zr).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return br((this._observers.get(e)||Wt()).values()).forEach(r=>r(...n))}destroy(){this._observers=Wt()}}const ll=Number.MAX_SAFE_INTEGER,Am=Number.MIN_SAFE_INTEGER,UN=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&sn(t)===t),Ny=String.fromCharCode,$N=t=>t.toLowerCase(),zN=/^\s*/g,VN=t=>t.replace(zN,""),qN=/([A-Z])/g,_m=(t,e)=>VN(t.replace(qN,n=>`${e}${$N(n)}`)),jN=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},ds=typeof TextEncoder<"u"?new TextEncoder:null,WN=t=>ds.encode(t),YN=ds?WN:jN;let zo=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});zo&&zo.decode(new Uint8Array).length===1&&(zo=null);const GN=(t,e)=>HN(e,()=>t).join("");class vs{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Ls=()=>new vs,KN=t=>{const e=Ls();return t(e),rn(e)},QN=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},rn=t=>{const e=new Uint8Array(QN(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},XN=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(an(n,e)*2),t.cpos=0)},ze=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},ld=ze,se=(t,e)=>{for(;e>zr;)ze(t,ht|zr&e),e=sn(e/128);ze(t,zr&e)},Hh=(t,e)=>{const n=my(e);for(n&&(e=-e),ze(t,(e>td?ht:0)|(n?qn:0)|td&e),e=sn(e/64);e>0;)ze(t,(e>zr?ht:0)|zr&e),e=sn(e/128)},ud=new Uint8Array(3e4),JN=ud.length/3,ZN=(t,e)=>{if(e.length<JN){const n=ds.encodeInto(e,ud).written||0;se(t,n);for(let r=0;r<n;r++)ze(t,ud[r])}else _t(t,YN(e))},eI=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;se(t,r);for(let i=0;i<r;i++)ze(t,n.codePointAt(i))},Li=ds&&ds.encodeInto?ZN:eI,Wl=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=Vn(n-r,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(an(n*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},_t=(t,e)=>{se(t,e.byteLength),Wl(t,e)},Uh=(t,e)=>{XN(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},tI=(t,e)=>Uh(t,4).setFloat32(0,e,!1),nI=(t,e)=>Uh(t,8).setFloat64(0,e,!1),rI=(t,e)=>Uh(t,8).setBigInt64(0,e,!1),Nm=new DataView(new ArrayBuffer(4)),iI=t=>(Nm.setFloat32(0,t),Nm.getFloat32(0)===t),Qi=(t,e)=>{switch(typeof e){case"string":ze(t,119),Li(t,e);break;case"number":UN(e)&&Ma(e)<=M_?(ze(t,125),Hh(t,e)):iI(e)?(ze(t,124),tI(t,e)):(ze(t,123),nI(t,e));break;case"bigint":ze(t,122),rI(t,e);break;case"object":if(e===null)ze(t,126);else if(Ki(e)){ze(t,117),se(t,e.length);for(let n=0;n<e.length;n++)Qi(t,e[n])}else if(e instanceof Uint8Array)ze(t,116),_t(t,e);else{ze(t,118);const n=Object.keys(e);se(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];Li(t,i),Qi(t,e[i])}}break;case"boolean":ze(t,e?120:121);break;default:ze(t,127)}};class Im extends vs{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&se(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Mm=t=>{t.count>0&&(Hh(t.encoder,t.count===1?t.s:-t.s),t.count>1&&se(t.encoder,t.count-2))};class va{constructor(){this.encoder=new vs,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Mm(this),this.count=1,this.s=e)}toUint8Array(){return Mm(this),rn(this.encoder)}}const Om=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);Hh(t.encoder,e),t.count>1&&se(t.encoder,t.count-2)}};class Wu{constructor(){this.encoder=new vs,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Om(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Om(this),rn(this.encoder)}}class oI{constructor(){this.sarr=[],this.s="",this.lensE=new va}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new vs;return this.sarr.push(this.s),this.s="",Li(e,this.sarr.join("")),Wl(e,this.lensE.toUint8Array()),rn(e)}}const Sn=t=>new Error(t),Yt=()=>{throw Sn("Method unimplemented")},mt=()=>{throw Sn("Unexpected case")},Iy=Sn("Unexpected end of array"),My=Sn("Integer out of Range");class Yl{constructor(e){this.arr=e,this.pos=0}}const oo=t=>new Yl(t),sI=t=>t.pos!==t.arr.length,aI=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Nt=t=>aI(t,ne(t)),Xi=t=>t.arr[t.pos++],ne=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&zr)*n,n*=128,i<ht)return e;if(e>ll)throw My}throw Iy},$h=t=>{let e=t.arr[t.pos++],n=e&td,r=64;const i=(e&qn)>0?-1:1;if((e&ht)===0)return i*n;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],n=n+(e&zr)*r,r*=128,e<ht)return i*n;if(n>ll)throw My}throw Iy},lI=t=>{let e=ne(t);if(e===0)return"";{let n=String.fromCodePoint(Xi(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Xi(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},uI=t=>zo.decode(Nt(t)),Ri=zo?uI:lI,zh=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},cI=t=>zh(t,4).getFloat32(0,!1),dI=t=>zh(t,8).getFloat64(0,!1),hI=t=>zh(t,8).getBigInt64(0,!1),fI=[t=>{},t=>null,$h,cI,dI,hI,t=>!1,t=>!0,Ri,t=>{const e=ne(t),n={};for(let r=0;r<e;r++){const i=Ri(t);n[i]=hs(t)}return n},t=>{const e=ne(t),n=[];for(let r=0;r<e;r++)n.push(hs(t));return n},Nt],hs=t=>fI[127-Xi(t)](t);class Dm extends Yl{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),sI(this)?this.count=ne(this)+1:this.count=-1),this.count--,this.s}}class La extends Yl{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=$h(this);const e=my(this.s);this.count=1,e&&(this.s=-this.s,this.count=ne(this)+2)}return this.count--,this.s}}class Yu extends Yl{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=$h(this),n=e&1;this.diff=sn(e/2),this.count=1,n&&(this.count=ne(this)+2)}return this.s+=this.diff,this.count--,this.s}}class pI{constructor(e){this.decoder=new La(e),this.str=Ri(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const mI=Date.now,vm=t=>new Promise(t);Promise.all.bind(Promise);const Lm=t=>t===void 0?null:t;class gI{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let Oy=new gI,bI=!0;try{typeof localStorage<"u"&&localStorage&&(Oy=localStorage,bI=!1)}catch{}const yI=Oy,fs=Symbol("Equality"),Dy=(t,e)=>t===e||!!t?.[fs]?.(e)||!1,EI=t=>typeof t=="object",kI=Object.assign,vy=Object.keys,TI=(t,e)=>{for(const n in t)e(t[n],n)},ul=t=>vy(t).length,CI=t=>{for(const e in t)return!1;return!0},so=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},Vh=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),SI=(t,e)=>t===e||ul(t)===ul(e)&&so(t,(n,r)=>(n!==void 0||Vh(e,r))&&Dy(e[r],n)),xI=Object.freeze,Ly=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&Ly(t[e])}return xI(t)},qh=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&qh(t,e,n+1)}},wI=t=>t,Ra=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[fs]!=null)return t[fs](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Ra(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(ul(t)!==ul(e))return!1;for(const n in t)if(!Vh(t,n)||!Ra(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Ra(t[n],e[n]))return!1;break;default:return!1}return!0},AI=(t,e)=>e.includes(t);var Ry={};const Ji=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",Py=typeof window<"u"&&typeof document<"u"&&!Ji;let mn;const _I=()=>{if(mn===void 0)if(Ji){mn=Wt();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&mn.set(e,""),e=r):e!==null&&(mn.set(e,r),e=null)}e!==null&&mn.set(e,"")}else typeof location=="object"?(mn=Wt(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");mn.set(`--${_m(e,"-")}`,n),mn.set(`-${_m(e,"-")}`,n)}})):mn=Wt();return mn},cd=t=>_I().has(t),cl=t=>Lm(Ji?Ry[t.toUpperCase().replaceAll("-","_")]:yI.getItem(t)),By=t=>cd("--"+t)||cl(t)!==null,NI=By("production"),II=Ji&&AI(Ry.FORCE_COLOR,["true","1","2"]),MI=II||!cd("--no-colors")&&!By("no-color")&&(!Ji||process.stdout.isTTY)&&(!Ji||cd("--color")||cl("COLORTERM")!==null||(cl("TERM")||"").includes("color")),OI=t=>new Uint8Array(t),DI=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=Ny(t[n]);return btoa(e)},vI=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),LI=Py?DI:vI,RI=t=>{const e=OI(t.byteLength);return e.set(t),e},PI=t=>KN(e=>Qi(e,t));class BI{constructor(e,n){this.left=e,this.right=n}}const Ln=(t,e)=>new BI(t,e),Rm=t=>t.next()>=.5,Gu=(t,e,n)=>sn(t.next()*(n+1-e)+e),Fy=(t,e,n)=>sn(t.next()*(n+1-e)+e),jh=(t,e,n)=>Fy(t,e,n),FI=t=>Ny(jh(t,97,122)),HI=(t,e=0,n=20)=>{const r=jh(t,e,n);let i="";for(let o=0;o<r;o++)i+=FI(t);return i},Ku=(t,e)=>e[jh(t,0,e.length-1)],UI=Symbol("0schema");class $I{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(GN(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
103
+ `)}}const dd=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[fs]?Dy(t,e):Ki(t)?Bh(t,n=>Fh(e,r=>dd(n,r))):EI(t)?so(t,(n,r)=>dd(n,e[r])):!1;let gt=class{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),dd(n,r)}equals(e){return this.constructor===e.constructor&&Ra(this.shape,e.shape)}[UI](){return!0}[fs](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Yt()}get nullable(){return ao(this,Jl)}get optional(){return new $y(this)}cast(e){return Pm(e,this),e}expect(e){return Pm(e,this),e}};class Wh extends gt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const Be=(t,e=null)=>new Wh(t,e);Be(Wh);class Yh extends gt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const Ye=t=>new Yh(t);Be(Yh);class Gl extends gt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const Kl=(...t)=>new Gl(t),Hy=Be(Gl),zI=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),Uy=t=>{if(Zi.check(t))return[zI(t)];if(Hy.check(t))return t.shape.map(e=>e+"");if(Qy.check(t))return["[+-]?\\d+.?\\d*"];if(Xy.check(t))return[".*"];if(dl.check(t))return t.shape.map(Uy).flat(1);mt()};class VI extends gt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(Uy).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}Be(VI);const qI=Symbol("optional");class $y extends gt{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[qI](){return!0}}const jI=Be($y);class WI extends gt{check(e,n){return n?.extend(null,"never",typeof e),!1}}Be(WI);class Ql extends gt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new Ql(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):so(this.shape,(r,i)=>{const o=this._isPartial&&!Vh(e,i)||r.check(e[i],n);return!o&&n?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),o})}}const YI=t=>new Ql(t),GI=Be(Ql),KI=Ye(t=>t!=null&&(t.constructor===Object||t.constructor==null));class zy extends gt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&so(e,(r,i)=>{const o=this.shape.keys.check(i,n);return!o&&n?.extend(i+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(r,n)})}}const Vy=(t,e)=>new zy(t,e),QI=Be(zy);class qy extends gt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&so(this.shape,(r,i)=>{const o=r.check(e[i],n);return!o&&n?.extend(i.toString(),"Tuple",typeof r),o})}}const XI=(...t)=>new qy(t);Be(qy);class jy extends gt{constructor(e){super(),this.shape=e.length===1?e[0]:new Gh(e)}check(e,n){const r=Ki(e)&&Bh(e,i=>this.shape.check(i));return!r&&n?.extend(null,"Array",""),r}}const Wy=(...t)=>new jy(t),JI=Be(jy),ZI=Ye(t=>Ki(t));class Yy extends gt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}}const eM=(t,e=null)=>new Yy(t,e);Be(Yy);const tM=eM(gt);class nM extends gt{constructor(e){super(),this.len=e.length-1,this.args=XI(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}}const rM=Be(nM),iM=Ye(t=>typeof t=="function");class oM extends gt{constructor(e){super(),this.shape=e}check(e,n){const r=Bh(this.shape,i=>i.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}Be(oM,t=>t.shape.length>0);class Gh extends gt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=Fh(this.shape,i=>i.check(e,n));return n?.extend(null,"Union",typeof e),r}}const ao=(...t)=>t.findIndex(e=>dl.check(e))>=0?ao(...t.map(e=>ps(e)).map(e=>dl.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Gh(t),dl=Be(Gh),Gy=()=>!0,hl=Ye(Gy),sM=Be(Yh,t=>t.shape===Gy),Kh=Ye(t=>typeof t=="bigint"),aM=Ye(t=>t===Kh),Ky=Ye(t=>typeof t=="symbol");Ye(t=>t===Ky);const Pi=Ye(t=>typeof t=="number"),Qy=Ye(t=>t===Pi),Zi=Ye(t=>typeof t=="string"),Xy=Ye(t=>t===Zi),Xl=Ye(t=>typeof t=="boolean"),lM=Ye(t=>t===Xl),Jy=Kl(void 0);Be(Gl,t=>t.shape.length===1&&t.shape[0]===void 0);Kl(void 0);const Jl=Kl(null),uM=Be(Gl,t=>t.shape.length===1&&t.shape[0]===null);Be(Uint8Array);Be(Wh,t=>t.shape===Uint8Array);const cM=ao(Pi,Zi,Jl,Jy,Kh,Xl,Ky);(()=>{const t=Wy(hl),e=Vy(Zi,hl),n=ao(Pi,Zi,Jl,Xl,t,e);return t.shape=n,e.shape.values=n,n})();const ps=t=>{if(tM.check(t))return t;if(KI.check(t)){const e={};for(const n in t)e[n]=ps(t[n]);return YI(e)}else{if(ZI.check(t))return ao(...t.map(ps));if(cM.check(t))return Kl(t);if(iM.check(t))return Be(t)}mt()},Pm=NI?()=>{}:(t,e)=>{const n=new $I;if(!e.check(t,n))throw Sn(`Expected value to be of type ${e.constructor.name}.
104
+ ${n.toString()}`)};class dM{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:ps(e),h:n}),this}else(e){return this.if(hl,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw Sn("Unhandled pattern")}}}const hM=t=>new dM(t),Zy=hM(hl).if(Qy,(t,e)=>Gu(e,Am,ll)).if(Xy,(t,e)=>HI(e)).if(lM,(t,e)=>Rm(e)).if(aM,(t,e)=>BigInt(Gu(e,Am,ll))).if(dl,(t,e)=>ki(e,Ku(e,t.shape))).if(GI,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(jI.check(i)){if(Rm(e))continue;i=i.shape}n[r]=Zy(i,e)}return n}).if(JI,(t,e)=>{const n=[],r=Fy(e,0,42);for(let i=0;i<r;i++)n.push(ki(e,t.shape));return n}).if(Hy,(t,e)=>Ku(e,t.shape)).if(uM,(t,e)=>null).if(rM,(t,e)=>{const n=ki(e,t.res);return()=>n}).if(sM,(t,e)=>ki(e,Ku(e,[Pi,Zi,Jl,Jy,Kh,Xl,Wy(Pi),Vy(ao("a","b","c"),Pi)]))).if(QI,(t,e)=>{const n={},r=Gu(e,0,3);for(let i=0;i<r;i++){const o=ki(e,t.shape.keys),s=ki(e,t.shape.values);n[o]=s}return n}).done(),ki=(t,e)=>Zy(ps(e),t),Rs=typeof document<"u"?document:{};Ye(t=>t.nodeType===bM);typeof DOMParser<"u"&&new DOMParser;Ye(t=>t.nodeType===pM);Ye(t=>t.nodeType===mM);const fM=t=>PN(t,(e,n)=>`${n}:${e};`).join(""),pM=Rs.ELEMENT_NODE,mM=Rs.TEXT_NODE,gM=Rs.DOCUMENT_NODE,bM=Rs.DOCUMENT_FRAGMENT_NODE;Ye(t=>t.nodeType===gM);const yM=t=>class{constructor(n){this._=n}destroy(){t(this._)}},EM=yM(clearTimeout),Qh=(t,e)=>new EM(setTimeout(e,t)),Yn=Symbol,eE=Yn(),tE=Yn(),kM=Yn(),TM=Yn(),CM=Yn(),nE=Yn(),SM=Yn(),Xh=Yn(),xM=Yn(),wM=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const i=t[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const i=t[r];i instanceof Symbol||n.push(i)}return n},AM={[eE]:Ln("font-weight","bold"),[tE]:Ln("font-weight","normal"),[kM]:Ln("color","blue"),[CM]:Ln("color","green"),[TM]:Ln("color","grey"),[nE]:Ln("color","red"),[SM]:Ln("color","purple"),[Xh]:Ln("color","orange"),[xM]:Ln("color","black")},_M=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=Wt();let i=[],o=0;for(;o<t.length;o++){const s=t[o],a=AM[s];if(a!==void 0)r.set(a.left,a.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){const l=fM(r);o>0||l.length>0?(e.push("%c"+s),n.push(l)):e.push(s)}else break}}for(o>0&&(i=n,i.unshift(e.join("")));o<t.length;o++){const s=t[o];s instanceof Symbol||i.push(s)}return i},rE=MI?_M:wM,NM=(...t)=>{console.log(...rE(t)),oE.forEach(e=>e.print(t))},iE=(...t)=>{console.warn(...rE(t)),t.unshift(Xh),oE.forEach(e=>e.print(t))},oE=Zr(),sE=t=>({[Symbol.iterator](){return this},next:t}),IM=(t,e)=>sE(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Qu=(t,e)=>sE(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Zl{constructor(e,n){this.clock=e,this.len=n}}class lo{constructor(){this.clients=new Map}}const yr=(t,e,n)=>e.clients.forEach((r,i)=>{const o=t.doc.store.clients.get(i);if(o!=null){const s=o[o.length-1],a=s.id.clock+s.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])kE(t,o,u.clock,u.len,n)}}),MM=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=sn((n+r)/2),o=t[i],s=o.clock;if(s<=e){if(e<s+o.len)return i;n=i+1}else r=i-1}return null},uo=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&MM(n,e.clock)!==null},Jh=t=>{t.clients.forEach(e=>{e.sort((i,o)=>i.clock-o.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],o=e[n];i.clock+i.len>=o.clock?e[r-1]=new Zl(i.clock,an(i.len,o.clock+o.len-i.clock)):(r<n&&(e[r]=o),r++)}e.length=r})},hd=t=>{const e=new lo;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const o=r.slice();for(let s=n+1;s<t.length;s++)FN(o,t[s].clients.get(i)||[]);e.clients.set(i,o)}});return Jh(e),e},ms=(t,e,n,r)=>{_n(t.clients,e,()=>[]).push(new Zl(n,r))},aE=()=>new lo,lE=t=>{const e=aE();return t.clients.forEach((n,r)=>{const i=[];for(let o=0;o<n.length;o++){const s=n[o];if(s.deleted){const a=s.id.clock;let l=s.length;if(o+1<n.length)for(let u=n[o+1];o+1<n.length&&u.deleted;u=n[++o+1])l+=u.length;i.push(new Zl(a,l))}}i.length>0&&e.clients.set(r,i)}),e},co=(t,e)=>{se(t.restEncoder,e.clients.size),br(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),se(t.restEncoder,n);const i=r.length;se(t.restEncoder,i);for(let o=0;o<i;o++){const s=r[o];t.writeDsClock(s.clock),t.writeDsLen(s.len)}})},Zh=t=>{const e=new lo,n=ne(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=ne(t.restDecoder),o=ne(t.restDecoder);if(o>0){const s=_n(e.clients,i,()=>[]);for(let a=0;a<o;a++)s.push(new Zl(t.readDsClock(),t.readDsLen()))}}return e},Bm=(t,e,n)=>{const r=new lo,i=ne(t.restDecoder);for(let o=0;o<i;o++){t.resetDsCurVal();const s=ne(t.restDecoder),a=ne(t.restDecoder),l=n.clients.get(s)||[],u=De(n,s);for(let c=0;c<a;c++){const d=t.readDsClock(),h=d+t.readDsLen();if(d<u){u<h&&ms(r,s,u,h-u);let f=Kt(l,d),p=l[f];for(!p.deleted&&p.id.clock<d&&(l.splice(f+1,0,El(e,p,d-p.id.clock)),f++);f<l.length&&(p=l[f++],p.id.clock<h);)p.deleted||(h<p.id.clock+p.length&&l.splice(f,0,El(e,p,h-p.id.clock)),p.delete(e))}else ms(r,s,d,h-d)}}if(r.clients.size>0){const o=new ei;return se(o.restEncoder,0),co(o,r),o.toUint8Array()}return null},uE=gy;class Ar extends _y{constructor({guid:e=vh(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:o=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=uE(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new yE,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=vm(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>vm(u=>{const c=d=>{(d===void 0||d===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&ye(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(br(this.subdocs).map(e=>e.guid))}transact(e,n=null){return ye(this,e,n)}get(e,n=qe){const r=_n(this.share,e,()=>{const o=new n;return o._integrate(this,null),o}),i=r.constructor;if(n!==qe&&i!==n)if(i===qe){const o=new n;o._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=o}),o._start=r._start;for(let s=o._start;s!==null;s=s.right)s.parent=o;return o._length=r._length,this.share.set(e,o),o._integrate(this,null),o}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Hi)}getText(e=""){return this.get(e,Er)}getMap(e=""){return this.get(e,to)}getXmlElement(e=""){return this.get(e,et)}getXmlFragment(e=""){return this.get(e,ti)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,br(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Ar({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,ye(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class cE{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return ne(this.restDecoder)}readDsLen(){return ne(this.restDecoder)}}class dE extends cE{readLeftID(){return X(ne(this.restDecoder),ne(this.restDecoder))}readRightID(){return X(ne(this.restDecoder),ne(this.restDecoder))}readClient(){return ne(this.restDecoder)}readInfo(){return Xi(this.restDecoder)}readString(){return Ri(this.restDecoder)}readParentInfo(){return ne(this.restDecoder)===1}readTypeRef(){return ne(this.restDecoder)}readLen(){return ne(this.restDecoder)}readAny(){return hs(this.restDecoder)}readBuf(){return RI(Nt(this.restDecoder))}readJSON(){return JSON.parse(Ri(this.restDecoder))}readKey(){return Ri(this.restDecoder)}}class OM{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=ne(this.restDecoder),this.dsCurrVal}readDsLen(){const e=ne(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class eo extends OM{constructor(e){super(e),this.keys=[],ne(e),this.keyClockDecoder=new Yu(Nt(e)),this.clientDecoder=new La(Nt(e)),this.leftClockDecoder=new Yu(Nt(e)),this.rightClockDecoder=new Yu(Nt(e)),this.infoDecoder=new Dm(Nt(e),Xi),this.stringDecoder=new pI(Nt(e)),this.parentInfoDecoder=new Dm(Nt(e),Xi),this.typeRefDecoder=new La(Nt(e)),this.lenDecoder=new La(Nt(e))}readLeftID(){return new Bi(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Bi(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return hs(this.restDecoder)}readBuf(){return Nt(this.restDecoder)}readJSON(){return hs(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class hE{constructor(){this.restEncoder=Ls()}toUint8Array(){return rn(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){se(this.restEncoder,e)}writeDsLen(e){se(this.restEncoder,e)}}class Ps extends hE{writeLeftID(e){se(this.restEncoder,e.client),se(this.restEncoder,e.clock)}writeRightID(e){se(this.restEncoder,e.client),se(this.restEncoder,e.clock)}writeClient(e){se(this.restEncoder,e)}writeInfo(e){ld(this.restEncoder,e)}writeString(e){Li(this.restEncoder,e)}writeParentInfo(e){se(this.restEncoder,e?1:0)}writeTypeRef(e){se(this.restEncoder,e)}writeLen(e){se(this.restEncoder,e)}writeAny(e){Qi(this.restEncoder,e)}writeBuf(e){_t(this.restEncoder,e)}writeJSON(e){Li(this.restEncoder,JSON.stringify(e))}writeKey(e){Li(this.restEncoder,e)}}class fE{constructor(){this.restEncoder=Ls(),this.dsCurrVal=0}toUint8Array(){return rn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,se(this.restEncoder,n)}writeDsLen(e){e===0&&mt(),se(this.restEncoder,e-1),this.dsCurrVal+=e}}class ei extends fE{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Wu,this.clientEncoder=new va,this.leftClockEncoder=new Wu,this.rightClockEncoder=new Wu,this.infoEncoder=new Im(ld),this.stringEncoder=new oI,this.parentInfoEncoder=new Im(ld),this.typeRefEncoder=new va,this.lenEncoder=new va}toUint8Array(){const e=Ls();return se(e,0),_t(e,this.keyClockEncoder.toUint8Array()),_t(e,this.clientEncoder.toUint8Array()),_t(e,this.leftClockEncoder.toUint8Array()),_t(e,this.rightClockEncoder.toUint8Array()),_t(e,rn(this.infoEncoder)),_t(e,this.stringEncoder.toUint8Array()),_t(e,rn(this.parentInfoEncoder)),_t(e,this.typeRefEncoder.toUint8Array()),_t(e,this.lenEncoder.toUint8Array()),Wl(e,rn(this.restEncoder)),rn(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Qi(this.restEncoder,e)}writeBuf(e){_t(this.restEncoder,e)}writeJSON(e){Qi(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const DM=(t,e,n,r)=>{r=an(r,e[0].id.clock);const i=Kt(e,r);se(t.restEncoder,e.length-i),t.writeClient(n),se(t.restEncoder,r);const o=e[i];o.write(t,r-o.id.clock);for(let s=i+1;s<e.length;s++)e[s].write(t,0)},ef=(t,e,n)=>{const r=new Map;n.forEach((i,o)=>{De(e,o)>i&&r.set(o,i)}),Bs(e).forEach((i,o)=>{n.has(o)||r.set(o,0)}),se(t.restEncoder,r.size),br(r.entries()).sort((i,o)=>o[0]-i[0]).forEach(([i,o])=>{DM(t,e.clients.get(i),i,o)})},vM=(t,e)=>{const n=Wt(),r=ne(t.restDecoder);for(let i=0;i<r;i++){const o=ne(t.restDecoder),s=new Array(o),a=t.readClient();let l=ne(t.restDecoder);n.set(a,{i:0,refs:s});for(let u=0;u<o;u++){const c=t.readInfo();switch(jl&c){case 0:{const d=t.readLen();s[u]=new $t(X(a,l),d),l+=d;break}case 10:{const d=ne(t.restDecoder);s[u]=new zt(X(a,l),d),l+=d;break}default:{const d=(c&(qn|ht))===0,h=new Se(X(a,l),null,(c&ht)===ht?t.readLeftID():null,null,(c&qn)===qn?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(c&cs)===cs?t.readString():null,zE(t,c));s[u]=h,l+=h.length}}}}return n},LM=(t,e,n)=>{const r=[];let i=br(n.keys()).sort((f,p)=>f-p);if(i.length===0)return null;const o=()=>{if(i.length===0)return null;let f=n.get(i[i.length-1]);for(;f.refs.length===f.i;)if(i.pop(),i.length>0)f=n.get(i[i.length-1]);else return null;return f};let s=o();if(s===null)return null;const a=new yE,l=new Map,u=(f,p)=>{const g=l.get(f);(g==null||g>p)&&l.set(f,p)};let c=s.refs[s.i++];const d=new Map,h=()=>{for(const f of r){const p=f.id.client,g=n.get(p);g?(g.i--,a.clients.set(p,g.refs.slice(g.i)),n.delete(p),g.i=0,g.refs=[]):a.clients.set(p,[f]),i=i.filter(y=>y!==p)}r.length=0};for(;;){if(c.constructor!==zt){const p=_n(d,c.id.client,()=>De(e,c.id.client))-c.id.clock;if(p<0)r.push(c),u(c.id.client,c.id.clock-1),h();else{const g=c.getMissing(t,e);if(g!==null){r.push(c);const y=n.get(g)||{refs:[],i:0};if(y.refs.length===y.i)u(g,De(e,g)),h();else{c=y.refs[y.i++];continue}}else(p===0||p<c.length)&&(c.integrate(t,p),d.set(c.id.client,c.id.clock+c.length))}}if(r.length>0)c=r.pop();else if(s!==null&&s.i<s.refs.length)c=s.refs[s.i++];else{if(s=o(),s===null)break;c=s.refs[s.i++]}}if(a.clients.size>0){const f=new ei;return ef(f,a,new Map),se(f.restEncoder,0),{missing:l,update:f.toUint8Array()}}return null},RM=(t,e)=>ef(t,e.doc.store,e.beforeState),PM=(t,e,n,r=new eo(t))=>ye(e,i=>{i.local=!1;let o=!1;const s=i.doc,a=s.store,l=vM(r,s),u=LM(i,a,l),c=a.pendingStructs;if(c){for(const[h,f]of c.missing)if(f<De(a,h)){o=!0;break}if(u){for(const[h,f]of u.missing){const p=c.missing.get(h);(p==null||p>f)&&c.missing.set(h,f)}c.update=pl([c.update,u.update])}}else a.pendingStructs=u;const d=Bm(r,i,a);if(a.pendingDs){const h=new eo(oo(a.pendingDs));ne(h.restDecoder);const f=Bm(h,i,a);d&&f?a.pendingDs=pl([d,f]):a.pendingDs=d||f}else a.pendingDs=d;if(o){const h=a.pendingStructs.update;a.pendingStructs=null,fl(i.doc,h)}},n,!1),fl=(t,e,n,r=eo)=>{const i=oo(e);PM(i,t,n,new r(i))},Fm=(t,e,n)=>fl(t,e,n,dE),BM=(t,e,n=new Map)=>{ef(t,e.store,n),co(t,lE(e.store))},FM=(t,e=new Uint8Array([0]),n=new ei)=>{const r=pE(e);BM(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(rO(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===Ps)return tO(i.map((o,s)=>s===0?o:oO(o)));if(n.constructor===ei)return pl(i)}return i[0]},Hm=(t,e)=>FM(t,e,new Ps),HM=t=>{const e=new Map,n=ne(t.restDecoder);for(let r=0;r<n;r++){const i=ne(t.restDecoder),o=ne(t.restDecoder);e.set(i,o)}return e},pE=t=>HM(new cE(oo(t))),mE=(t,e)=>(se(t.restEncoder,e.size),br(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{se(t.restEncoder,n),se(t.restEncoder,r)}),t),UM=(t,e)=>mE(t,Bs(e.store)),$M=(t,e=new fE)=>(t instanceof Map?mE(e,t):UM(e,t),e.toUint8Array()),zM=t=>$M(t,new hE);class VM{constructor(){this.l=[]}}const Um=()=>new VM,$m=(t,e)=>t.l.push(e),zm=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},gE=(t,e,n)=>qh(t.l,[e,n]);class Bi{constructor(e,n){this.client=e,this.clock=n}}const Ni=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,X=(t,e)=>new Bi(t,e),gs=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw mt()},bs=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class ys{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const Vo=t=>new ys(t.type==null?null:X(t.type.client,t.type.clock),t.tname??null,t.item==null?null:X(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class qM{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const jM=(t,e,n=0)=>new qM(t,e,n),la=(t,e,n)=>{let r=null,i=null;return t._item===null?i=gs(t):r=X(t._item.id.client,t._item.id.clock),new ys(r,i,e,n)},Xu=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return la(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return la(t,X(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return la(t,r.lastId,n);r=r.right}return la(t,null,n)},WM=(t,e)=>{const n=Fi(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},YM=(t,e,n=!0)=>{const r=e.store,i=t.item,o=t.type,s=t.tname,a=t.assoc;let l=null,u=0;if(i!==null){if(De(r,i.client)<=i.clock)return null;const c=n?gd(r,i):WM(r,i),d=c.item;if(!(d instanceof Se))return null;if(l=d.parent,l._item===null||!l._item.deleted){u=d.deleted||!d.countable?0:c.diff+(a>=0?0:1);let h=d.left;for(;h!==null;)!h.deleted&&h.countable&&(u+=h.length),h=h.left}}else{if(s!==null)l=e.get(s);else if(o!==null){if(De(r,o.client)<=o.clock)return null;const{item:c}=n?gd(r,o):{item:Fi(r,o)};if(c instanceof Se&&c.content instanceof hn)l=c.content.type;else return null}else throw mt();a>=0?u=l._length:u=0}return jM(l,u,t.assoc)},Vm=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&Ni(t.item,e.item)&&Ni(t.type,e.type)&&t.assoc===e.assoc;class tf{constructor(e,n){this.ds=e,this.sv=n}}const bE=(t,e)=>new tf(t,e),Ju=t=>bE(lE(t.store),Bs(t.store)),Lr=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!uo(e.ds,t.id),fd=(t,e)=>{const n=_n(t.meta,fd,Zr),r=t.doc.store;n.has(e)||(e.sv.forEach((i,o)=>{i<De(r,o)&&kt(t,X(o,i))}),yr(t,e.ds,i=>{}),n.add(e))};class yE{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Bs=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},De=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},EE=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw mt()}n.push(e)},Kt=(t,e)=>{let n=0,r=t.length-1,i=t[r],o=i.id.clock;if(o===e)return r;let s=sn(e/(o+i.length-1)*r);for(;n<=r;){if(i=t[s],o=i.id.clock,o<=e){if(e<o+i.length)return s;n=s+1}else r=s-1;s=sn((n+r)/2)}throw mt()},GM=(t,e)=>{const n=t.clients.get(e.client);return n[Kt(n,e.clock)]},Fi=GM,pd=(t,e,n)=>{const r=Kt(e,n),i=e[r];return i.id.clock<n&&i instanceof Se?(e.splice(r+1,0,El(t,i,n-i.id.clock)),r+1):r},kt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[pd(t,n,e.clock)]},qm=(t,e,n)=>{const r=e.clients.get(n.client),i=Kt(r,n.clock),o=r[i];return n.clock!==o.id.clock+o.length-1&&o.constructor!==$t&&r.splice(i+1,0,El(t,o,n.clock-o.id.clock+1)),o},KM=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Kt(r,e.id.clock)]=n},kE=(t,e,n,r,i)=>{if(r===0)return;const o=n+r;let s=pd(t,e,n),a;do a=e[s++],o<a.id.clock+a.length&&pd(t,e,o),i(a);while(s<e.length&&e[s].id.clock<o)};class QM{constructor(e,n,r){this.doc=e,this.deleteSet=new lo,this.beforeState=Bs(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const jm=(t,e)=>e.deleteSet.clients.size===0&&!BN(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(Jh(e.deleteSet),RM(t,e),co(t,e.deleteSet),!0),Wm=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&_n(t.changed,e,Zr).add(n)},Pa=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Se&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const o=e-i;return o&&t.splice(e+1-o,o),o},XM=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const o=e.clients.get(r);for(let s=i.length-1;s>=0;s--){const a=i[s],l=a.clock+a.len;for(let u=Kt(o,a.clock),c=o[u];u<o.length&&c.id.clock<l;c=o[++u]){const d=o[u];if(a.clock+a.len<=d.id.clock)break;d instanceof Se&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},JM=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let o=n.length-1;o>=0;o--){const s=n[o],a=Vn(i.length-1,1+Kt(i,s.clock+s.len-1));for(let l=a,u=i[l];l>0&&u.id.clock>=s.clock;u=i[l])l-=1+Pa(i,l)}})},TE=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,o=n.deleteSet,s=n._mergeStructs;try{Jh(o),n.afterState=Bs(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(c=>c.target._item===null||!c.target._item.deleted),l.forEach(c=>{c.currentTarget=u,c._path=null}),l.sort((c,d)=>c.path.length-d.path.length),a.push(()=>{gE(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&EO(n)})}),qh(a,[])}finally{r.gc&&XM(o,i,r.gcFilter),JM(o,i),n.afterState.forEach((c,d)=>{const h=n.beforeState.get(d)||0;if(h!==c){const f=i.clients.get(d),p=an(Kt(f,h),1);for(let g=f.length-1;g>=p;)g-=1+Pa(f,g)}});for(let c=s.length-1;c>=0;c--){const{client:d,clock:h}=s[c].id,f=i.clients.get(d),p=Kt(f,h);p+1<f.length&&Pa(f,p+1)>1||p>0&&Pa(f,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(NM(Xh,eE,"[yjs] ",tE,nE,"Changed the client-id because another client seems to be using it."),r.clientID=uE()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new Ps;jm(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new ei;jm(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(c=>c.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):TE(t,e+1)}}},ye=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let o=!1,s=null;t._transaction===null&&(o=!0,t._transaction=new QM(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(o){const a=t._transaction===i[0];t._transaction=null,a&&TE(i,0)}}return s};class ZM{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const Ym=(t,e,n)=>{yr(t,n.deletions,r=>{r instanceof Se&&e.scope.some(i=>i===t.doc||bs(i,r))&&cf(r,!1)})},Gm=(t,e,n)=>{let r=null;const i=t.doc,o=t.scope;ye(i,a=>{for(;e.length>0&&t.currStackItem===null;){const l=i.store,u=e.pop(),c=new Set,d=[];let h=!1;yr(a,u.insertions,f=>{if(f instanceof Se){if(f.redone!==null){let{item:p,diff:g}=gd(l,f.id);g>0&&(p=kt(a,X(p.id.client,p.id.clock+g))),f=p}!f.deleted&&o.some(p=>p===a.doc||bs(p,f))&&d.push(f)}}),yr(a,u.deletions,f=>{f instanceof Se&&o.some(p=>p===a.doc||bs(p,f))&&!uo(u.insertions,f.id)&&c.add(f)}),c.forEach(f=>{h=$E(a,f,c,u.insertions,t.ignoreRemoteMapChanges,t)!==null||h});for(let f=d.length-1;f>=0;f--){const p=d[f];t.deleteFilter(p)&&(p.delete(a),h=!0)}t.currStackItem=h?u:null}a.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=a},t);const s=t.currStackItem;if(s!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:s,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return s};class CE extends _y{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:o=new Set([null]),ignoreRemoteMapChanges:s=!1,doc:a=Ki(e)?e[0].doc:e instanceof Ar?e:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=i,o.add(this),this.trackedOrigins=o,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=s,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(y=>l.changedParentTypes.has(y)||y===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,c=this.redoing,d=u?this.redoStack:this.undoStack;u?this.stopCapturing():c||this.clear(!1,!0);const h=new lo;l.afterState.forEach((y,b)=>{const C=l.beforeState.get(b)||0,w=y-C;w>0&&ms(h,b,C,w)});const f=mI();let p=!1;if(this.lastChange>0&&f-this.lastChange<this.captureTimeout&&d.length>0&&!u&&!c){const y=d[d.length-1];y.deletions=hd([y.deletions,l.deleteSet]),y.insertions=hd([y.insertions,h])}else d.push(new ZM(l.deleteSet,h)),p=!0;!u&&!c&&(this.lastChange=f),yr(l,l.deleteSet,y=>{y instanceof Se&&this.scope.some(b=>b===l.doc||bs(b,y))&&cf(y,!0)});const g=[{stackItem:d[d.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",g):this.emit("stack-item-updated",g)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ki(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof qe?r.doc!==this.doc:r!==this.doc)&&iE("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>Ym(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>Ym(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Gm(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Gm(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*eO(t){const e=ne(t.restDecoder);for(let n=0;n<e;n++){const r=ne(t.restDecoder),i=t.readClient();let o=ne(t.restDecoder);for(let s=0;s<r;s++){const a=t.readInfo();if(a===10){const l=ne(t.restDecoder);yield new zt(X(i,o),l),o+=l}else if((jl&a)!==0){const l=(a&(qn|ht))===0,u=new Se(X(i,o),null,(a&ht)===ht?t.readLeftID():null,null,(a&qn)===qn?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&cs)===cs?t.readString():null,zE(t,a));yield u,o+=u.length}else{const l=t.readLen();yield new $t(X(i,o),l),o+=l}}}}class nf{constructor(e,n){this.gen=eO(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===zt);return this.curr}}class rf{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const tO=t=>pl(t,dE,Ps),nO=(t,e)=>{if(t.constructor===$t){const{client:n,clock:r}=t.id;return new $t(X(n,r+e),t.length-e)}else if(t.constructor===zt){const{client:n,clock:r}=t.id;return new zt(X(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new Se(X(r,i+e),null,X(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},pl=(t,e=eo,n=ei)=>{if(t.length===1)return t[0];const r=t.map(c=>new e(oo(c)));let i=r.map(c=>new nf(c,!0)),o=null;const s=new n,a=new rf(s);for(;i=i.filter(h=>h.curr!==null),i.sort((h,f)=>{if(h.curr.id.client===f.curr.id.client){const p=h.curr.id.clock-f.curr.id.clock;return p===0?h.curr.constructor===f.curr.constructor?0:h.curr.constructor===zt?1:-1:p}else return f.curr.id.client-h.curr.id.client}),i.length!==0;){const c=i[0],d=c.curr.id.client;if(o!==null){let h=c.curr,f=!1;for(;h!==null&&h.id.clock+h.length<=o.struct.id.clock+o.struct.length&&h.id.client>=o.struct.id.client;)h=c.next(),f=!0;if(h===null||h.id.client!==d||f&&h.id.clock>o.struct.id.clock+o.struct.length)continue;if(d!==o.struct.id.client)or(a,o.struct,o.offset),o={struct:h,offset:0},c.next();else if(o.struct.id.clock+o.struct.length<h.id.clock)if(o.struct.constructor===zt)o.struct.length=h.id.clock+h.length-o.struct.id.clock;else{or(a,o.struct,o.offset);const p=h.id.clock-o.struct.id.clock-o.struct.length;o={struct:new zt(X(d,o.struct.id.clock+o.struct.length),p),offset:0}}else{const p=o.struct.id.clock+o.struct.length-h.id.clock;p>0&&(o.struct.constructor===zt?o.struct.length-=p:h=nO(h,p)),o.struct.mergeWith(h)||(or(a,o.struct,o.offset),o={struct:h,offset:0},c.next())}}else o={struct:c.curr,offset:0},c.next();for(let h=c.curr;h!==null&&h.id.client===d&&h.id.clock===o.struct.id.clock+o.struct.length&&h.constructor!==zt;h=c.next())or(a,o.struct,o.offset),o={struct:h,offset:0}}o!==null&&(or(a,o.struct,o.offset),o=null),of(a);const l=r.map(c=>Zh(c)),u=hd(l);return co(s,u),s.toUint8Array()},rO=(t,e,n=eo,r=ei)=>{const i=pE(e),o=new r,s=new rf(o),a=new n(oo(t)),l=new nf(a,!1);for(;l.curr;){const c=l.curr,d=c.id.client,h=i.get(d)||0;if(l.curr.constructor===zt){l.next();continue}if(c.id.clock+c.length>h)for(or(s,c,an(h-c.id.clock,0)),l.next();l.curr&&l.curr.id.client===d;)or(s,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===d&&l.curr.id.clock+l.curr.length<=h;)l.next()}of(s);const u=Zh(a);return co(o,u),o.toUint8Array()},SE=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:rn(t.encoder.restEncoder)}),t.encoder.restEncoder=Ls(),t.written=0)},or=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&SE(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),se(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},of=t=>{SE(t);const e=t.encoder.restEncoder;se(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];se(e,r.written),Wl(e,r.restEncoder)}},iO=(t,e,n,r)=>{const i=new n(oo(t)),o=new nf(i,!1),s=new r,a=new rf(s);for(let u=o.curr;u!==null;u=o.next())or(a,e(u),0);of(a);const l=Zh(i);return co(s,l),s.toUint8Array()},oO=t=>iO(t,wI,eo,Ps),Km="You must not compute changes after the event-handler fired.";class eu{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=sO(this.currentTarget,this.target))}deletes(e){return uo(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Sn(Km);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const o=n._map.get(i);let s,a;if(this.adds(o)){let l=o.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(o))if(l!==null&&this.deletes(l))s="delete",a=ju(l.content.getContent());else return;else l!==null&&this.deletes(l)?(s="update",a=ju(l.content.getContent())):(s="add",a=void 0)}else if(this.deletes(o))s="delete",a=ju(o.content.getContent());else return;e.set(i,{action:s,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Sn(Km);const n=this.target,r=Zr(),i=Zr(),o=[];if(e={added:r,deleted:i,delta:o,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&o.push(a)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=u.length,i.add(u)):this.adds(u)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(u.content.getContent()),r.add(u)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=u.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const sO=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},st=()=>{iE("Invalid access: Add Yjs type to a document before reading data.")},xE=80;let sf=0;class aO{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=sf++}}const lO=t=>{t.timestamp=sf++},wE=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=sf++},uO=(t,e,n)=>{if(t.length>=xE){const r=t.reduce((i,o)=>i.timestamp<o.timestamp?i:o);return wE(r,e,n),r}else{const r=new aO(e,n);return t.push(r),r}},tu=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((o,s)=>Ma(e-o.index)<Ma(e-s.index)?o:s);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,lO(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&Ma(n.index-i)<r.parent.length/xE?(wE(n,r,i),n):uO(t._searchMarker,r,i)},Es=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let o=i.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(i.index-=o.length);if(o===null||o.marker===!0){t.splice(r,1);continue}i.p=o,o.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=an(e,i.index+n))}},nu=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;_n(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;gE(r._eH,n,e)};class qe{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Um(),this._dEH=Um(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Yt()}clone(){throw Yt()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){$m(this._eH,e)}observeDeep(e){$m(this._dEH,e)}unobserve(e){zm(this._eH,e)}unobserveDeep(e){zm(this._dEH,e)}toJSON(){}}const AE=(t,e,n)=>{t.doc??st(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let o=t._start;for(;o!==null&&r>0;){if(o.countable&&!o.deleted){const s=o.content.getContent();if(s.length<=e)e-=s.length;else{for(let a=e;a<s.length&&r>0;a++)i.push(s[a]),r--;e=0}}o=o.right}return i},_E=t=>{t.doc??st();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},NE=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Lr(r,e)){const i=r.content.getContent();for(let o=0;o<i.length;o++)n.push(i[o])}r=r.right}return n},ks=(t,e)=>{let n=0,r=t._start;for(t.doc??st();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let o=0;o<i.length;o++)e(i[o],n++,t)}r=r.right}},IE=(t,e)=>{const n=[];return ks(t,(r,i)=>{n.push(e(r,i,t))}),n},cO=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},ME=(t,e)=>{t.doc??st();const n=tu(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},ml=(t,e,n,r)=>{let i=n;const o=t.doc,s=o.clientID,a=o.store,l=n===null?e._start:n.right;let u=[];const c=()=>{u.length>0&&(i=new Se(X(s,De(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new ni(u)),i.integrate(t,0),u=[])};r.forEach(d=>{if(d===null)u.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(d);break;default:switch(c(),d.constructor){case Uint8Array:case ArrayBuffer:i=new Se(X(s,De(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new Fs(new Uint8Array(d))),i.integrate(t,0);break;case Ar:i=new Se(X(s,De(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new Hs(d)),i.integrate(t,0);break;default:if(d instanceof qe)i=new Se(X(s,De(a,s)),i,i&&i.lastId,l,l&&l.id,e,null,new hn(d)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},OE=()=>Sn("Length exceeded!"),DE=(t,e,n,r)=>{if(n>e._length)throw OE();if(n===0)return e._searchMarker&&Es(e._searchMarker,n,r.length),ml(t,e,null,r);const i=n,o=tu(e,n);let s=e._start;for(o!==null&&(s=o.p,n-=o.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&kt(t,X(s.id.client,s.id.clock+n));break}n-=s.length}return e._searchMarker&&Es(e._searchMarker,i,r.length),ml(t,e,s,r)},dO=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((o,s)=>s.index>o.index?s:o,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return ml(t,e,i,n)},vE=(t,e,n,r)=>{if(r===0)return;const i=n,o=r,s=tu(e,n);let a=e._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&kt(t,X(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&kt(t,X(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw OE();e._searchMarker&&Es(e._searchMarker,i,-o+r)},gl=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},af=(t,e,n,r)=>{const i=e._map.get(n)||null,o=t.doc,s=o.clientID;let a;if(r==null)a=new ni([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new ni([r]);break;case Uint8Array:a=new Fs(r);break;case Ar:a=new Hs(r);break;default:if(r instanceof qe)a=new hn(r);else throw new Error("Unexpected content type")}new Se(X(s,De(o.store,s)),i,i&&i.lastId,null,null,e,n,a).integrate(t,0)},lf=(t,e)=>{t.doc??st();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},LE=t=>{const e={};return t.doc??st(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},RE=(t,e)=>{t.doc??st();const n=t._map.get(e);return n!==void 0&&!n.deleted},hO=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let o=r;for(;o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0));)o=o.left;o!==null&&Lr(o,e)&&(n[i]=o.content.getContent()[o.length-1])}),n},ua=t=>(t.doc??st(),IM(t._map.entries(),e=>!e[1].deleted));class fO extends eu{}class Hi extends qe{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Hi;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Hi}clone(){const e=new Hi;return e.insert(0,this.toArray().map(n=>n instanceof qe?n.clone():n)),e}get length(){return this.doc??st(),this._length}_callObserver(e,n){super._callObserver(e,n),nu(this,e,new fO(this,e))}insert(e,n){this.doc!==null?ye(this.doc,r=>{DE(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?ye(this.doc,n=>{dO(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?ye(this.doc,r=>{vE(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return ME(this,e)}toArray(){return _E(this)}slice(e=0,n=this.length){return AE(this,e,n)}toJSON(){return this.map(e=>e instanceof qe?e.toJSON():e)}map(e){return IE(this,e)}forEach(e){ks(this,e)}[Symbol.iterator](){return cO(this)}_write(e){e.writeTypeRef(FO)}}const pO=t=>new Hi;class mO extends eu{constructor(e,n,r){super(e,n),this.keysChanged=r}}class to extends qe{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new to}clone(){const e=new to;return this.forEach((n,r)=>{e.set(r,n instanceof qe?n.clone():n)}),e}_callObserver(e,n){nu(this,e,new mO(this,e,n))}toJSON(){this.doc??st();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof qe?i.toJSON():i}}),e}get size(){return[...ua(this)].length}keys(){return Qu(ua(this),e=>e[0])}values(){return Qu(ua(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Qu(ua(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??st(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?ye(this.doc,n=>{gl(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?ye(this.doc,r=>{af(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return lf(this,e)}has(e){return RE(this,e)}clear(){this.doc!==null?ye(this.doc,e=>{this.forEach(function(n,r,i){gl(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(HO)}}const gO=t=>new to,ur=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&SI(t,e);class md{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){this.right===null&&mt(),this.right.content.constructor===Pe?this.right.deleted||ho(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const Qm=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===Pe?e.right.deleted||ho(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&kt(t,X(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},ca=(t,e,n,r)=>{const i=new Map,o=r?tu(e,n):null;if(o){const s=new md(o.p.left,o.p,o.index,i);return Qm(t,s,n-o.index)}else{const s=new md(null,e._start,0,i);return Qm(t,s,n)}},PE=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Pe&&ur(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,o=i.clientID;r.forEach((s,a)=>{const l=n.left,u=n.right,c=new Se(X(o,De(i.store,o)),l,l&&l.lastId,u,u&&u.id,e,null,new Pe(a,s));c.integrate(t,0),n.right=c,n.forward()})},ho=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},BE=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Pe&&ur(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},FE=(t,e,n,r)=>{const i=t.doc,o=i.clientID,s=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!ur(u,l)){s.set(a,u);const{left:c,right:d}=n;n.right=new Se(X(o,De(i.store,o)),c,c&&c.lastId,d,d&&d.id,e,null,new Pe(a,l)),n.right.integrate(t,0),n.forward()}}return s},Zu=(t,e,n,r,i)=>{n.currentAttributes.forEach((h,f)=>{i[f]===void 0&&(i[f]=null)});const o=t.doc,s=o.clientID;BE(n,i);const a=FE(t,e,n,i),l=r.constructor===String?new ln(r):r instanceof qe?new hn(r):new ui(r);let{left:u,right:c,index:d}=n;e._searchMarker&&Es(e._searchMarker,n.index,l.getLength()),c=new Se(X(s,De(o.store,s)),u,u&&u.lastId,c,c&&c.id,e,null,l),c.integrate(t,0),n.right=c,n.index=d,n.forward(),PE(t,e,n,a)},Xm=(t,e,n,r,i)=>{const o=t.doc,s=o.clientID;BE(n,i);const a=FE(t,e,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Pe));){if(!n.right.deleted)switch(n.right.content.constructor){case Pe:{const{key:l,value:u}=n.right.content,c=i[l];if(c!==void 0){if(ur(c,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(t)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&kt(t,X(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
105
+ `;n.right=new Se(X(s,De(o.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ln(l)),n.right.integrate(t,0),n.forward()}PE(t,e,n,a)},HE=(t,e,n,r,i)=>{let o=e;const s=Wt();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===Pe){const u=o.content;s.set(u.key,u)}o=o.right}let a=0,l=!1;for(;e!==o;){if(n===e&&(l=!0),!e.deleted){const u=e.content;if(u.constructor===Pe){const{key:c,value:d}=u,h=r.get(c)??null;(s.get(c)!==u||h===d)&&(e.delete(t),a++,!l&&(i.get(c)??null)===d&&h!==d&&(h===null?i.delete(c):i.set(c,h))),!l&&!e.deleted&&ho(i,u)}}e=e.right}return a},bO=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Pe){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},yO=t=>{let e=0;return ye(t.doc,n=>{let r=t._start,i=t._start,o=Wt();const s=ad(o);for(;i;)i.deleted===!1&&(i.content.constructor===Pe?ho(s,i.content):(e+=HE(n,r,i,o,s),o=ad(s),r=i)),i=i.right}),e},EO=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const o=t.beforeState.get(r)||0;i!==o&&kE(t,n.store.clients.get(r),o,i,s=>{!s.deleted&&s.content.constructor===Pe&&s.constructor!==$t&&e.add(s.parent)})}ye(n,r=>{yr(t,t.deleteSet,i=>{if(i instanceof $t||!i.parent._hasFormatting||e.has(i.parent))return;const o=i.parent;i.content.constructor===Pe?e.add(o):bO(r,i)});for(const i of e)yO(i)})},Jm=(t,e,n)=>{const r=n,i=ad(e.currentAttributes),o=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case hn:case ui:case ln:n<e.right.length&&kt(t,X(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}o&&HE(t,o,e.right,i,e.currentAttributes);const s=(e.left||e.right).parent;return s._searchMarker&&Es(s._searchMarker,e.index,-r+n),e};class kO extends eu{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];ye(e,r=>{const i=new Map,o=new Map;let s=this.target._start,a=null;const l={};let u="",c=0,d=0;const h=()=>{if(a!==null){let f=null;switch(a){case"delete":d>0&&(f={delete:d}),d=0;break;case"insert":(typeof u=="object"||u.length>0)&&(f={insert:u},i.size>0&&(f.attributes={},i.forEach((p,g)=>{p!==null&&(f.attributes[g]=p)}))),u="";break;case"retain":c>0&&(f={retain:c},CI(l)||(f.attributes=kI({},l))),c=0;break}f&&n.push(f),a=null}};for(;s!==null;){switch(s.content.constructor){case hn:case ui:this.adds(s)?this.deletes(s)||(h(),a="insert",u=s.content.getContent()[0],h()):this.deletes(s)?(a!=="delete"&&(h(),a="delete"),d+=1):s.deleted||(a!=="retain"&&(h(),a="retain"),c+=1);break;case ln:this.adds(s)?this.deletes(s)||(a!=="insert"&&(h(),a="insert"),u+=s.content.str):this.deletes(s)?(a!=="delete"&&(h(),a="delete"),d+=s.length):s.deleted||(a!=="retain"&&(h(),a="retain"),c+=s.length);break;case Pe:{const{key:f,value:p}=s.content;if(this.adds(s)){if(!this.deletes(s)){const g=i.get(f)??null;ur(g,p)?p!==null&&s.delete(r):(a==="retain"&&h(),ur(p,o.get(f)??null)?delete l[f]:l[f]=p)}}else if(this.deletes(s)){o.set(f,p);const g=i.get(f)??null;ur(g,p)||(a==="retain"&&h(),l[f]=g)}else if(!s.deleted){o.set(f,p);const g=l[f];g!==void 0&&(ur(g,p)?g!==null&&s.delete(r):(a==="retain"&&h(),p===null?delete l[f]:l[f]=p))}s.deleted||(a==="insert"&&h(),ho(i,s.content));break}}s=s.right}for(h();n.length>0;){const f=n[n.length-1];if(f.retain!==void 0&&f.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Er extends qe{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??st(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Er}clone(){const e=new Er;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new kO(this,e,n);nu(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??st();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ln&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?ye(this.doc,r=>{const i=new md(null,this._start,0,new Map);for(let o=0;o<e.length;o++){const s=e[o];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&o===e.length-1&&i.right===null&&s.insert.slice(-1)===`
106
+ `?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&Zu(r,this,i,a,s.attributes||{})}else s.retain!==void 0?Xm(r,this,i,s.retain,s.attributes||{}):s.delete!==void 0&&Jm(r,i,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??st();const i=[],o=new Map,s=this.doc;let a="",l=this._start;function u(){if(a.length>0){const d={};let h=!1;o.forEach((p,g)=>{h=!0,d[g]=p});const f={insert:a};h&&(f.attributes=d),i.push(f),a=""}}const c=()=>{for(;l!==null;){if(Lr(l,e)||n!==void 0&&Lr(l,n))switch(l.content.constructor){case ln:{const d=o.get("ychange");e!==void 0&&!Lr(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(u(),o.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Lr(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(u(),o.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(u(),o.delete("ychange")),a+=l.content.str;break}case hn:case ui:{u();const d={insert:l.content.getContent()[0]};if(o.size>0){const h={};d.attributes=h,o.forEach((f,p)=>{h[p]=f})}i.push(d);break}case Pe:Lr(l,e)&&(u(),ho(o,l.content));break}l=l.right}u()};return e||n?ye(s,d=>{e&&fd(d,e),n&&fd(d,n),c()},"cleanup"):c(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?ye(i,o=>{const s=ca(o,this,e,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),Zu(o,this,s,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?ye(i,o=>{const s=ca(o,this,e,!r);Zu(o,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?ye(r,i=>{Jm(i,ca(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?ye(i,o=>{const s=ca(o,this,e,!1);s.right!==null&&Xm(o,this,s,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?ye(this.doc,n=>{gl(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?ye(this.doc,r=>{af(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return lf(this,e)}getAttributes(){return LE(this)}_write(e){e.writeTypeRef(UO)}}const TO=t=>new Er;class ec{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??st()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===et||n.constructor===ti)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class ti extends qe{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ti}clone(){const e=new ti;return e.insert(0,this.toArray().map(n=>n instanceof qe?n.clone():n)),e}get length(){return this.doc??st(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new ec(this,e)}querySelector(e){e=e.toUpperCase();const r=new ec(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),br(new ec(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){nu(this,e,new xO(this,n,e))}toString(){return IE(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),ks(this,o=>{i.insertBefore(o.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?ye(this.doc,r=>{DE(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)ye(this.doc,r=>{const i=e&&e instanceof qe?e._item:e;ml(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(o=>o===e)+1;if(i===0&&e!==null)throw Sn("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?ye(this.doc,r=>{vE(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return _E(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return ME(this,e)}slice(e=0,n=this.length){return AE(this,e,n)}forEach(e){ks(this,e)}_write(e){e.writeTypeRef(zO)}}const CO=t=>new ti;class et extends ti{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new et(this.nodeName)}clone(){const e=new et(this.nodeName),n=this.getAttributes();return TI(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof qe?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const o=this.nodeName.toLocaleLowerCase(),s=n.length>0?" "+n.join(" "):"";return`<${o}${s}>${super.toString()}</${o}>`}removeAttribute(e){this.doc!==null?ye(this.doc,n=>{gl(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?ye(this.doc,r=>{af(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return lf(this,e)}hasAttribute(e){return RE(this,e)}getAttributes(e){return e?hO(this,e):LE(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),o=this.getAttributes();for(const s in o){const a=o[s];typeof a=="string"&&i.setAttribute(s,a)}return ks(this,s=>{i.appendChild(s.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef($O),e.writeKey(this.nodeName)}}const SO=t=>new et(t.readKey());class xO extends eu{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class bl extends to{constructor(e){super(),this.hookName=e}_copy(){return new bl(this.hookName)}clone(){const e=new bl(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let o;return i!==void 0?o=i.createDom(this):o=document.createElement(this.hookName),o.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(o,this),o}_write(e){e.writeTypeRef(VO),e.writeKey(this.hookName)}}const wO=t=>new bl(t.readKey());class Dt extends Er{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Dt}clone(){const e=new Dt;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const o=[];for(const s in e.attributes[i])o.push({key:s,value:e.attributes[i][s]});o.sort((s,a)=>s.key<a.key?-1:1),n.push({nodeName:i,attrs:o})}n.sort((i,o)=>i.nodeName<o.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const o=n[i];r+=`<${o.nodeName}`;for(let s=0;s<o.attrs.length;s++){const a=o.attrs[s];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(qO)}}const AO=t=>new Dt;class uf{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Yt()}mergeWith(e){return!1}write(e,n,r){throw Yt()}integrate(e,n){throw Yt()}}const _O=0;class $t extends uf{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),EE(e.doc.store,this)}write(e,n){e.writeInfo(_O),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Fs{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Fs(this.content)}splice(e){throw Yt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const NO=t=>new Fs(t.readBuf());class Ts{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ts(this.len)}splice(e){const n=new Ts(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){ms(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const IO=t=>new Ts(t.readLen()),UE=(t,e)=>new Ar({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Hs{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Hs(UE(this.doc.guid,this.opts))}splice(e){throw Yt()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const MO=t=>new Hs(UE(t.readString(),t.readAny()));class ui{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ui(this.embed)}splice(e){throw Yt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const OO=t=>new ui(t.readJSON());class Pe{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Pe(this.key,this.value)}splice(e){throw Yt()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const DO=t=>new Pe(t.readKey(),t.readJSON());class yl{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new yl(this.arr)}splice(e){const n=new yl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const o=this.arr[i];e.writeString(o===void 0?"undefined":JSON.stringify(o))}}getRef(){return 2}}const vO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new yl(n)},LO=cl("node_env")==="development";class ni{constructor(e){this.arr=e,LO&&Ly(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ni(this.arr)}splice(e){const n=new ni(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const o=this.arr[i];e.writeAny(o)}}getRef(){return 8}}const RO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new ni(n)};class ln{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ln(this.str)}splice(e){const n=new ln(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const PO=t=>new ln(t.readString()),BO=[pO,gO,TO,SO,CO,wO,AO],FO=0,HO=1,UO=2,$O=3,zO=4,VO=5,qO=6;class hn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new hn(this.type._copy())}splice(e){throw Yt()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const jO=t=>new hn(BO[t.readTypeRef()](t)),gd=(t,e)=>{let n=e,r=0,i;do r>0&&(n=X(n.client,n.clock+r)),i=Fi(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Se);return{item:i,diff:r}},cf=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},El=(t,e,n)=>{const{client:r,clock:i}=e.id,o=new Se(X(r,i+n),e,X(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&o.markDeleted(),e.keep&&(o.keep=!0),e.redone!==null&&(o.redone=X(e.redone.client,e.redone.clock+n)),e.right=o,o.right!==null&&(o.right.left=o),t._mergeStructs.push(o),o.parentSub!==null&&o.right===null&&o.parent._map.set(o.parentSub,o),e.length=n,o},Zm=(t,e)=>Fh(t,n=>uo(n.deletions,e)),$E=(t,e,n,r,i,o)=>{const s=t.doc,a=s.store,l=s.clientID,u=e.redone;if(u!==null)return kt(t,u);let c=e.parent._item,d=null,h;if(c!==null&&c.deleted===!0){if(c.redone===null&&(!n.has(c)||$E(t,c,n,r,i,o)===null))return null;for(;c.redone!==null;)c=kt(t,c.redone)}const f=c===null?e.parent:c.content.type;if(e.parentSub===null){for(d=e.left,h=e;d!==null;){let b=d;for(;b!==null&&b.parent._item!==c;)b=b.redone===null?null:kt(t,b.redone);if(b!==null&&b.parent._item===c){d=b;break}d=d.left}for(;h!==null;){let b=h;for(;b!==null&&b.parent._item!==c;)b=b.redone===null?null:kt(t,b.redone);if(b!==null&&b.parent._item===c){h=b;break}h=h.right}}else if(h=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||uo(r,d.right.id)||Zm(o.undoStack,d.right.id)||Zm(o.redoStack,d.right.id));)for(d=d.right;d.redone;)d=kt(t,d.redone);if(d&&d.right!==null)return null}else d=f._map.get(e.parentSub)||null;const p=De(a,l),g=X(l,p),y=new Se(g,d,d&&d.lastId,h,h&&h.id,f,e.parentSub,e.content.copy());return e.redone=g,cf(y,!0),y.integrate(t,0),y};let Se=class bd extends uf{constructor(e,n,r,i,o,s,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=o,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?pm:0}set marker(e){(this.info&Vu)>0!==e&&(this.info^=Vu)}get marker(){return(this.info&Vu)>0}get keep(){return(this.info&fm)>0}set keep(e){this.keep!==e&&(this.info^=fm)}get countable(){return(this.info&pm)>0}get deleted(){return(this.info&zu)>0}set deleted(e){this.deleted!==e&&(this.info^=zu)}markDeleted(){this.info|=zu}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=De(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=De(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Bi&&this.id.client!==this.parent.client&&this.parent.clock>=De(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=qm(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=kt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===$t||this.right&&this.right.constructor===$t)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===bd?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===bd&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Bi){const r=Fi(n,this.parent);r.constructor===$t?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=qm(e,e.doc.store,X(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const o=new Set,s=new Set;for(;i!==null&&i!==this.right;){if(s.add(i),o.add(i),Ni(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,o.clear();else if(Ni(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&s.has(Fi(e.doc.store,i.origin)))o.has(Fi(e.doc.store,i.origin))||(r=i,o.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),EE(e.doc.store,this),this.content.integrate(e,this),Wm(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new $t(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:X(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Ni(e.origin,this.lastId)&&this.right===e&&Ni(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),ms(e.deleteSet,this.id.client,this.id.clock,this.length),Wm(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw mt();this.content.gc(e),n?KM(e,this,new $t(this.id,this.length)):this.content=new Ts(this.length)}write(e,n){const r=n>0?X(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,o=this.parentSub,s=this.content.getRef()&jl|(r===null?0:ht)|(i===null?0:qn)|(o===null?0:cs);if(e.writeInfo(s),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=gs(a);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===Bi?(e.writeParentInfo(!1),e.writeLeftID(a)):mt();o!==null&&e.writeString(o)}this.content.write(e,n)}};const zE=(t,e)=>WO[e&jl](t),WO=[()=>{mt()},IO,vO,NO,PO,OO,DO,jO,RO,MO,()=>{mt()}],YO=10;class zt extends uf{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){mt()}write(e,n){e.writeInfo(YO),se(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const VE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},qE="__ $YJS$ __";VE[qE]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");VE[qE]=!0;const GO=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},KO=/[\uD800-\uDBFF]/,QO=/[\uDC00-\uDFFF]/,XO=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&KO.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&QO.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},JO=XO,xe=new he("y-sync"),En=new he("y-undo"),da=new he("yjs-cursor"),kn=(t,e)=>t>>>e|t<<32-e,ZO=t=>kn(t,2)^kn(t,13)^kn(t,22),eD=t=>kn(t,6)^kn(t,11)^kn(t,25),tD=t=>kn(t,7)^kn(t,18)^t>>>3,nD=t=>kn(t,17)^kn(t,19)^t>>>10,rD=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),iD=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class oD{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(iD),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=nD(n[d-2])+n[d-7]+tD(n[d-15])+n[d-16];let r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],l=e[5],u=e[6],c=e[7];for(let d=0,h,f;d<64;d++)h=c+eD(a)+(a&l^~a&u)+rD[d]+n[d]>>>0,f=ZO(r)+(r&i^r&o^i&o)>>>0,c=u,u=l,l=a,a=s+h>>>0,s=o,o=i,i=r,r=h+f>>>0;e[0]+=r,e[1]+=i,e[2]+=o,e[3]+=s,e[4]+=a,e[5]+=l,e[6]+=u,e[7]+=c}digest(e){let n=0;for(;n+56<=e.length;){let s=0;for(;s<16&&n+3<e.length;s++)this._W[s]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<e.length;)this._W[s]|=e[n]<<(3-n%4)*8,n++;this._W[s]|=ht<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let s=3;s>=0&&n<e.length;s--)this._W[i]|=e[n++]<<s*8;r||(this._W[i-(n%4===0?0:1)]|=ht<<(3-n%4)*8),this._W[14]=e.byteLength/I_,this._W[15]=e.byteLength*8,this._updateHash();const o=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let a=0;a<4;a++)o[s*4+a]=this._H[s]>>>(3-a)*8;return o}}const sD=t=>new oD().digest(t),aD=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},lD=t=>LI(aD(sD(PI(t)))),kl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!uo(e.ds,t.id),uD=[{light:"#ecd44433",dark:"#ecd444"}],cD=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Zr();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,v_(e))}return t.get(n)},dD=(t,{colors:e=uD,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:o}={})=>{let s=!1;const a=new fD(t,o),l=new re({props:{editable:u=>{const c=xe.getState(u);return c.snapshot==null&&c.prevSnapshot==null}},key:xe,state:{init:(u,c)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(u,c)=>{const d=u.getMeta(xe);if(d!==void 0){c=Object.assign({},c);for(const h in d)c[h]=d[h]}return c.addToHistory=u.getMeta("addToHistory")!==!1,c.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,c.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&Qh(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,c):(a._renderSnapshot(d.snapshot,d.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),c}},view:u=>(a.initView(u),o==null&&a._forceRerender(),i(),{update:()=>{const c=l.getState(u.state);if(c.snapshot==null&&c.prevSnapshot==null&&(s||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(s=!0,c.addToHistory===!1&&!c.isChangeOrigin){const d=En.getState(u.state),h=d&&d.undoManager;h&&h.stopCapturing()}a.mux(()=>{c.doc.transact(d=>{d.meta.set("addToHistory",c.addToHistory),a._prosemirrorChanged(u.state.doc)},xe)})}},destroy:()=>{a.destroy()}})});return l},hD=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new Ct(t.doc));else if(e.type==="node"){const r=Vr(n.doc,n.type,e.anchor,n.mapping);t.setSelection(q.create(t.doc,r))}else{const r=Vr(n.doc,n.type,e.anchor,n.mapping),i=Vr(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const o=$.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(o)}}},yd=(t,e)=>({type:e.selection.jsonID,anchor:Ss(e.selection.anchor,t.type,t.mapping),head:Ss(e.selection.head,t.type,t.mapping)});class fD{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=GO(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=yd(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(Py&&this._domSelectionInView===null&&(Qh(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),o=Rs.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||o.clientWidth||0)&&i.top<=(window.innerHeight||o.clientHeight||0)}renderSnapshot(e,n){n||(n=bE(aE(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(xe,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Ba(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new B(M.from(e),0,0));n.setMeta(xe,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>Ba(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new B(M.from(n),0,0));if(e){const i=Vn(an(e.anchor,0),r.doc.content.size),o=Vn(an(e.head,0),r.doc.content.size);r.setSelection($.create(r.doc,i,o))}this.prosemirrorView.dispatch(r.setMeta(xe,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,o=this.type;if(e||(e=Ju(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&mt(),i=new Ar({gc:!1}),fl(i,n),n=Ju(i),fl(i,e),e=Ju(i),o._item===null){const s=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);o=i.getXmlFragment(s)}else{const s=i.store.clients.get(o._item.id.client)??[],a=Kt(s,o._item.id.clock);o=s[a].content.type}this.mapping.clear(),this.mux(()=>{i.transact(s=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{yr(s,d,h=>{})});const l=(d,h)=>{const f=d==="added"?a.getUserByClientId(h.client):a.getUserByDeletedId(h);return{user:f,type:d,color:cD(r.colorMapping,r.colors,f)}},u=NE(o,new tf(n.ds,e.sv)).map(d=>!d._item.deleted||kl(d._item,e)||kl(d._item,n)?Ba(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new B(M.from(u),0,0));this.prosemirrorView.dispatch(c.setMeta(xe,{isChangeOrigin:!0}))},xe)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=xe.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,l)=>this.mapping.delete(l);yr(n,n.deleteSet,a=>{if(a.constructor===Se){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const o=this.type.toArray().map(a=>jE(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new B(M.from(o),0,0));hD(s,this.beforeTransactionSelection,this),s=s.setMeta(xe,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof CE}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{kd(this.doc,this.type,e,this),this.beforeTransactionSelection=yd(this,this.prosemirrorView.state)},xe)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const jE=(t,e,n,r,i,o)=>{const s=n.mapping.get(t);if(s===void 0){if(t instanceof et)return Ba(t,e,n,r,i,o);throw Yt()}return s},Ba=(t,e,n,r,i,o)=>{const s=[],a=l=>{if(l instanceof et){const u=jE(l,e,n,r,i,o);u!==null&&s.push(u)}else{const u=l._item.right?.content?.type;u instanceof Er&&!u._item.deleted&&u._item.id.client===u.doc.clientID&&(l.applyDelta([{retain:l.length},...u.toDelta()]),u.doc.transact(d=>{u._item.delete(d)}));const c=pD(l,e,n,r,i,o);c!==null&&c.forEach(d=>{d!==null&&s.push(d)})}};r===void 0||i===void 0?t.toArray().forEach(a):NE(t,new tf(i.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(kl(t._item,r)?kl(t._item,i)||(l.ychange=o?o("added",t._item.id):{type:"added"}):l.ychange=o?o("removed",t._item.id):{type:"removed"});const u=e.node(t.nodeName,l,s);return n.mapping.set(t,u),u}catch{return t.doc.transact(u=>{t._item.delete(u)},xe),n.mapping.delete(t),null}},pD=(t,e,n,r,i,o)=>{const s=[],a=t.toDelta(r,i,o);try{for(let l=0;l<a.length;l++){const u=a[l];s.push(e.text(u.insert,kD(u.attributes,e)))}}catch{return t.doc.transact(u=>{t._item.delete(u)},xe),null}return s},mD=(t,e)=>{const n=new Dt,r=t.map(i=>({insert:i.text,attributes:GE(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},gD=(t,e)=>{const n=new et(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,ru(t).map(r=>Ed(r,e))),e.mapping.set(n,t),n},Ed=(t,e)=>t instanceof Array?mD(t,e):gD(t,e),eg=t=>typeof t=="object"&&t!==null,df=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const o=n[i],s=t[o],a=e[o];r=o==="ychange"||s===a||eg(s)&&eg(a)&&df(s,a)}return r},ru=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const o=[];for(let s=e[r];r<e.length&&s.isText;s=e[++r])o.push(s);r--,n.push(o)}else n.push(i)}return n},WE=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&vy(r.attributes||{}).length===e[i].marks.length&&so(r.attributes,(o,s)=>{const a=YE(s),l=e[i].marks;return df(o,l.find(u=>u.type.name===a)?.attrs)}))},Cs=(t,e)=>{if(t instanceof et&&!(e instanceof Array)&&Td(t,e)){const n=ru(e);return t._length===n.length&&df(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Cs(r,n[i]))}return t instanceof Dt&&e instanceof Array&&WE(t,e)},Tl=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),tg=(t,e,n)=>{const r=t.toArray(),i=ru(e),o=i.length,s=r.length,a=Vn(s,o);let l=0,u=0,c=!1;for(;l<a;l++){const d=r[l],h=i[l];if(Tl(n.mapping.get(d),h))c=!0;else if(!Cs(d,h))break}for(;l+u<a;u++){const d=r[s-u-1],h=i[o-u-1];if(Tl(n.mapping.get(d),h))c=!0;else if(!Cs(d,h))break}return{equalityFactor:l+u,foundMappedChild:c}},bD=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof ln?e+=n.content.str:n.content instanceof Pe&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},yD=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=bD(t),o=e.map(u=>({insert:u.text,attributes:Object.assign({},r,GE(u.marks,n))})),{insert:s,remove:a,index:l}=JO(i,o.map(u=>u.insert).join(""));t.delete(l,a),t.insert(l,s),t.applyDelta(o.map(u=>({retain:u.insert.length,attributes:u.attributes})))},ED=/(.*)(--[a-zA-Z0-9+/=]{8})$/,YE=t=>ED.exec(t)?.[1]??t,kD=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(YE(r),t[r]));return n},GE=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=_n(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${lD(r.toJSON())}`:r.type.name]=r.attrs}}),n},kd=(t,e,n,r)=>{if(e instanceof et&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof et){const d=e.getAttributes(),h=n.attrs;for(const f in h)h[f]!==null?d[f]!==h[f]&&f!=="ychange"&&e.setAttribute(f,h[f]):e.removeAttribute(f);for(const f in d)h[f]===void 0&&e.removeAttribute(f)}const i=ru(n),o=i.length,s=e.toArray(),a=s.length,l=Vn(o,a);let u=0,c=0;for(;u<l;u++){const d=s[u],h=i[u];if(!Tl(r.mapping.get(d),h))if(Cs(d,h))r.mapping.set(d,h);else break}for(;c+u<l;c++){const d=s[a-c-1],h=i[o-c-1];if(!Tl(r.mapping.get(d),h))if(Cs(d,h))r.mapping.set(d,h);else break}t.transact(()=>{for(;a-u-c>0&&o-u-c>0;){const h=s[u],f=i[u],p=s[a-c-1],g=i[o-c-1];if(h instanceof Dt&&f instanceof Array)WE(h,f)||yD(h,f,r),u+=1;else{let y=h instanceof et&&Td(h,f),b=p instanceof et&&Td(p,g);if(y&&b){const C=tg(h,f,r),w=tg(p,g,r);C.foundMappedChild&&!w.foundMappedChild?b=!1:!C.foundMappedChild&&w.foundMappedChild||C.equalityFactor<w.equalityFactor?y=!1:b=!1}y?(kd(t,h,f,r),u+=1):b?(kd(t,p,g,r),c+=1):(r.mapping.delete(e.get(u)),e.delete(u,1),e.insert(u,[Ed(f,r)]),u+=1)}}const d=a-u-c;if(a===1&&o===0&&s[0]instanceof Dt?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):d>0&&(e.slice(u,u+d).forEach(h=>r.mapping.delete(h)),e.delete(u,d)),u+c<o){const h=[];for(let f=u;f<o-c;f++)h.push(Ed(i[f],r));e.insert(u,h)}},xe)},Td=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let qo=null;const TD=()=>{const t=qo;qo=null,t.forEach((e,n)=>{const r=n.state.tr,i=xe.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((o,s)=>{r.setMeta(s,o)}),n.dispatch(r))})},CD=(t,e,n)=>{qo||(qo=new Map,Qh(0,TD)),_n(qo,t,Wt).set(e,n)},Ss=(t,e,n)=>{if(t===0)return Xu(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Dt){if(r._length>=t)return Xu(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new ys(r._item===null?null:r._item.id,r._item===null?gs(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new ys(r._item===null?null:r._item.id,r._item===null?gs(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw mt();if(t===0&&r.constructor!==Dt&&r!==e)return SD(r._item.parent,r._item)}return Xu(e,e._length,e.length===0?-1:0)},SD=(t,e)=>{let n=null,r=null;return t._item===null?r=gs(t):n=X(t._item.id.client,t._item.id.clock),new ys(n,r,e.id)},Vr=(t,e,n,r)=>{const i=YM(n,t);if(i===null||i.type!==e&&!bs(e,i.type._item))return null;let o=i.type,s=0;if(o.constructor===Dt)s=i.index;else if(o._item===null||!o._item.deleted){let a=o._first,l=0;for(;l<o._length&&l<i.index&&a!==null;){if(!a.deleted){const u=a.content.type;l++,u instanceof Dt?s+=u._length:s+=r.get(u).nodeSize}a=a.right}s+=1}for(;o!==e&&o._item!==null;){const a=o._item.parent;if(a._item===null||!a._item.deleted){s+=1;let l=a._first;for(;l!==null;){const u=l.content.type;if(u===o)break;l.deleted||(u instanceof Dt?s+=u._length:s+=r.get(u).nodeSize),l=l.right}}o=a}return s-1},xD=(t,e,n)=>t!==e,wD=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),i=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},KE=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),AD=/^#[0-9a-fA-F]{6}$/,ng=(t,e,n,r,i)=>{const o=xe.getState(t),s=o.doc,a=[];return o.snapshot!=null||o.prevSnapshot!=null||o.binding.mapping.size===0?le.create(t.doc,[]):(e.getStates().forEach((l,u)=>{if(n(s.clientID,u,l)&&l.cursor!=null){const c=l.user||{};c.color==null?c.color="#ffa500":AD.test(c.color)||console.warn("A user uses an unsupported color format",c),c.name==null&&(c.name=`User: ${u}`);let d=Vr(s,o.type,Vo(l.cursor.anchor),o.binding.mapping),h=Vr(s,o.type,Vo(l.cursor.head),o.binding.mapping);if(d!==null&&h!==null){const f=an(t.doc.content.size-1,0);d=Vn(d,f),h=Vn(h,f),a.push(me.widget(h,()=>r(c,u),{key:u+"",side:10}));const p=Vn(d,h),g=an(d,h);a.push(me.inline(p,g,i(c,u),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),le.create(t.doc,a))},_D=(t,{awarenessStateFilter:e=xD,cursorBuilder:n=wD,selectionBuilder:r=KE,getSelection:i=s=>s.selection}={},o="cursor")=>new re({key:da,state:{init(s,a){return ng(a,t,e,n,r)},apply(s,a,l,u){const c=xe.getState(u),d=s.getMeta(da);return c&&c.isChangeOrigin||d&&d.awarenessUpdated?ng(u,t,e,n,r):a.map(s.mapping,s.doc)}},props:{decorations:s=>da.getState(s)},view:s=>{const a=()=>{s.docView&&CD(s,da,{awarenessUpdated:!0})},l=()=>{const u=xe.getState(s.state),c=t.getLocalState()||{};if(s.hasFocus()){const d=i(s.state),h=Ss(d.anchor,u.type,u.binding.mapping),f=Ss(d.head,u.type,u.binding.mapping);(c.cursor==null||!Vm(Vo(c.cursor.anchor),h)||!Vm(Vo(c.cursor.head),f))&&t.setLocalStateField(o,{anchor:h,head:f})}else c.cursor!=null&&Vr(u.doc,u.type,Vo(c.cursor.anchor),u.binding.mapping)!==null&&t.setLocalStateField(o,null)};return t.on("change",a),s.dom.addEventListener("focusin",l),s.dom.addEventListener("focusout",l),{update:l,destroy:()=>{s.dom.removeEventListener("focusin",l),s.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(o,null)}}}}),ND=t=>En.getState(t)?.undoManager?.undo()!=null,ID=t=>En.getState(t)?.undoManager?.redo()!=null,MD=(t,e)=>e==null?En.getState(t)?.undoManager?.canUndo():ND(t),OD=(t,e)=>e==null?En.getState(t)?.undoManager?.canRedo():ID(t),DD=new Set(["paragraph"]),vD=(t,e)=>!(t instanceof Se)||!(t.content instanceof hn)||!(t.content.type instanceof Er||t.content.type instanceof et&&e.has(t.content.type.nodeName))||t.content.type._length===0,LD=({protectedNodes:t=DD,trackedOrigins:e=[],undoManager:n=null}={})=>new re({key:En,state:{init:(r,i)=>{const o=xe.getState(i),s=n||new CE(o.type,{trackedOrigins:new Set([xe].concat(e)),deleteFilter:a=>vD(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(r,i,o,s)=>{const a=xe.getState(s).binding,l=i.undoManager,u=l.undoStack.length>0,c=l.redoStack.length>0;return a?{undoManager:l,prevSel:yd(a,o),hasUndoOps:u,hasRedoOps:c}:u!==i.hasUndoOps||c!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):i}},view:r=>{const i=xe.getState(r.state),o=En.getState(r.state).undoManager;return o.on("stack-item-added",({stackItem:s})=>{const a=i.binding;a&&s.meta.set(a,En.getState(r.state).prevSel)}),o.on("stack-item-popped",({stackItem:s})=>{const a=i.binding;a&&(a.beforeTransactionSelection=s.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{o.destroy()}}}});var rg=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},RD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,PD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,BD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,FD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,HD=cn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return rg("strong",{...Gt(this.options.HTMLAttributes,t),children:rg("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Gi({find:RD,type:this.type}),Gi({find:BD,type:this.type})]},addPasteRules(){return[Qr({find:PD,type:this.type}),Qr({find:FD,type:this.type})]}}),UD=HD,$D=/(^|[^`])`([^`]+)`(?!`)$/,zD=/(^|[^`])`([^`]+)`(?!`)/g,VD=cn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Gt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Gi({find:$D,type:this.type})]},addPasteRules(){return[Qr({find:zD,type:this.type})]}}),qD=VD,jD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,WD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,YD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,KD=cn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Gi({find:jD,type:this.type}),Gi({find:YD,type:this.type})]},addPasteRules(){return[Qr({find:WD,type:this.type}),Qr({find:GD,type:this.type})]}}),QD=KD,XD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,JD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,ZD=cn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Gt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Gi({find:XD,type:this.type})]},addPasteRules(){return[Qr({find:JD,type:this.type})]}}),ev=ZD,tv=cn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Gt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),nv=tv;function rv(t,e=JSON.stringify){let n={};return t.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function iv(t){return rv(t.filter((e,n)=>t.indexOf(e)!==n))}var iu=_e.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],setIdAttribute:!1,isWithinEditor:void 0,generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){let t=window.__TEST_OPTIONS;return t.mockID===void 0?t.mockID=0:t.mockID++,t.mockID.toString()}return vh()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>{let e={[`data-${this.options.attributeName}`]:t[this.options.attributeName]};return this.options.setIdAttribute?{...e,id:t[this.options.attributeName]}:e}}}}]},addProseMirrorPlugins(){let{isWithinEditor:t}=this.options,e=null,n=!1;return[new re({key:new he("uniqueID"),appendTransaction:(r,i,o)=>{let s=r.some(p=>p.docChanged)&&!i.doc.eq(o.doc),a=this.options.filterTransaction&&r.some(p=>!this.options.filterTransaction?.(p));if(!s||a)return;let{tr:l}=o,{types:u,attributeName:c,generateID:d}=this.options,h=zl(i.doc,r),{mapping:f}=h;if(_h(h).forEach(({newRange:p})=>{let g=sl(o.doc,p,b=>u.includes(b.type.name)),y=iv(g.map(({node:b})=>b.attrs[c]).filter(b=>b!==null));g.forEach(({node:b,pos:C})=>{let w=l.doc.nodeAt(C)?.attrs[c];if(w===null){let O=i.doc.type.createAndFill().content;if(i.doc.content.findDiffStart(O)===null){let _=JSON.parse(JSON.stringify(o.doc.toJSON()));if(_.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(_.content)===JSON.stringify(O.toJSON())){l.setNodeMarkup(C,void 0,{...b.attrs,[c]:"initialBlockId"});return}}l.setNodeMarkup(C,void 0,{...b.attrs,[c]:d()});return}let{deleted:v}=f.invert().mapResult(C);v&&y.includes(w)&&l.setNodeMarkup(C,void 0,{...b.attrs,[c]:d()})})}),l.steps.length)return l.setMeta("uniqueID",!0),l},view(r){let i=o=>{let s=r.dom.parentElement;e=s?.contains(o.target)||t?.(o.target)?s:null};return window.addEventListener("dragstart",i),{destroy(){window.removeEventListener("dragstart",i)}}},props:{handleDOMEvents:{drop:(r,i)=>(n=e!==r.dom.parentElement||i.dataTransfer?.effectAllowed==="copy",e=null,!1),paste:()=>(n=!0,!1)},transformPasted:r=>{if(!n)return r;let{types:i,attributeName:o}=this.options,s=a=>{let l=[];return a.forEach(u=>{if(u.isText){l.push(u);return}if(!i.includes(u.type.name)){l.push(u.copy(s(u.content)));return}let c=u.type.create({...u.attrs,[o]:null},s(u.content),u.marks);l.push(c)}),M.from(l)};return n=!1,new B(s(r.content),r.openStart,r.openEnd)}}})]}});function ig(t){return t.type==="link"}function QE(t){return typeof t!="string"&&t.type==="link"}function ri(t){return typeof t!="string"&&t.type==="text"}function Cd(t){return hf(t)?{...t}:xs(t)?{type:"tableCell",content:[].concat(t.content),props:{backgroundColor:t.props?.backgroundColor??"default",textColor:t.props?.textColor??"default",textAlignment:t.props?.textAlignment??"left",colspan:t.props?.colspan??1,rowspan:t.props?.rowspan??1}}:{type:"tableCell",content:[].concat(t),props:{backgroundColor:"default",textColor:"default",textAlignment:"left",colspan:1,rowspan:1}}}function xs(t){return t!=null&&typeof t!="string"&&!Array.isArray(t)&&t.type==="tableCell"}function hf(t){return xs(t)&&t.props!==void 0&&t.content!==void 0}function ws(t){return hf(t)?t.props.colspan??1:1}function Sd(t){return hf(t)?t.props.rowspan??1:1}var xn=class extends Error{constructor(t){super(`Unreachable case: ${t}`)}};function Hz(t,e=!0){let{"data-test":n,...r}=t;if(Object.keys(r).length>0&&e)throw Error("Object must be empty "+JSON.stringify(t))}var ov=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function Qn(t,e="Ctrl"){return ov()?t.replace("Mod","⌘"):t.replace("Mod",e)}function kr(...t){return[...new Set(t.filter(e=>e).join(" ").split(" "))].join(" ")}var Uz=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function sv(t,e,n,r){let i=document.createElement("div");i.className=kr("bn-block-content",n.class),i.setAttribute("data-content-type",t);for(let[s,a]of Object.entries(n))s!=="class"&&i.setAttribute(s,a);let o=document.createElement(e);o.className=kr("bn-inline-content",r.class);for(let[s,a]of Object.entries(r))s!=="class"&&o.setAttribute(s,a);return i.appendChild(o),{dom:i,contentDOM:o}}var og=(t,e)=>{let n=ci(t,e.pmSchema);n.type.name==="blockContainer"&&(n=n.firstChild);let r=e.pmSchema.nodes[n.type.name].spec.toDOM;if(r===void 0)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let i=r(n);if(typeof i!="object"||!("dom"in i))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return i};function XE(t,e="<br>"){let n=t.querySelectorAll("p");if(n.length>1){let r=n[0];for(let i=1;i<n.length;i++){let o=n[i];r.innerHTML+=e+o.innerHTML,o.remove()}}}function As(t){return"data-"+t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function $z(t){let e=t.split("/");return!e.length||e[e.length-1]===""?t:e[e.length-1]}function av(t){let e=["mp4","webm","ogg","mov","mkv","flv","avi","wmv","m4v"];try{let n=new URL(t).pathname.split(".").pop()?.toLowerCase()||"";return e.includes(n)}catch{return!1}}function lv(t){let e={};return Object.entries(t).forEach(([n,r])=>{e[n]={default:r.default,keepOnSplit:!0,parseHTML:i=>{let o=i.getAttribute(As(n));if(o===null)return null;if(r.default===void 0&&r.type==="boolean"||r.default!==void 0&&typeof r.default=="boolean")return o==="true"?!0:o==="false"?!1:null;if(r.default===void 0&&r.type==="number"||r.default!==void 0&&typeof r.default=="number"){let s=parseFloat(o);return!Number.isNaN(s)&&Number.isFinite(s)?s:null}return o},renderHTML:i=>i[n]===r.default?{}:{[As(n)]:i[n]}}}),e}function uv(t,e,n,r){let i=t();if(i===void 0)throw Error("Cannot find node position");let o=n.state.doc.resolve(i).node().attrs.id;if(!o)throw Error("Block doesn't have id");let s=e.getBlock(o);if(s.type!==r)throw Error("Block type does not match");return s}function xd(t,e,n,r,i=!1,o){let s=document.createElement("div");if(o!==void 0)for(let[a,l]of Object.entries(o))a!=="class"&&s.setAttribute(a,l);s.className=kr("bn-block-content",o?.class||""),s.setAttribute("data-content-type",e);for(let[a,l]of Object.entries(n))l!==r[a].default&&s.setAttribute(As(a),l);return i&&s.setAttribute("data-file-block",""),s.appendChild(t.dom),t.contentDOM&&(t.contentDOM.className=kr("bn-inline-content",t.contentDOM.className)),{...t,dom:s}}function cv(t,e,n){return{config:{type:t.type,content:t.content,propSchema:e},implementation:{node:t.node,render:og,toExternalHTML:og},extensions:n}}function dv(t,e){t.stopEvent=n=>(n.type==="mousedown"&&setTimeout(()=>{e.view.dom.blur()},10),!0)}function hv(t,e){let n=[{tag:"[data-content-type="+t.type+"]",contentElement:".bn-inline-content"}];return e.parse&&n.push({tag:"*",getAttrs(r){if(typeof r=="string")return!1;let i=e.parse?.(r);return i===void 0?!1:i},preserveWhitespace:!0,getContent:t.content==="inline"||t.content==="none"?(r,i)=>{if(e.parseContent){let o=e.parseContent({el:r,schema:i});if(o!==void 0)return o}if(t.content==="inline"){let o=r.cloneNode(!0);return XE(o,e.meta?.code?`
107
+ `:"<br>"),Vt.fromSchema(i).parse(o,{topNode:i.nodes.paragraph.create(),preserveWhitespace:!0}).content}return M.empty}:void 0}),n}function fv(t,e,n,r){let i=e.node||dn.create({name:t.type,content:t.content==="inline"?"inline*":t.content==="none"?"":t.content,group:"blockContent",selectable:e.meta?.selectable??!0,isolating:e.meta?.isolating??!0,code:e.meta?.code??!1,defining:e.meta?.defining??!0,priority:r,addAttributes(){return lv(t.propSchema)},parseHTML(){return hv(t,e)},renderHTML({HTMLAttributes:o}){let s=document.createElement("div");return xd({dom:s,contentDOM:t.content==="inline"?s:void 0},t.type,{},t.propSchema,e.meta?.fileBlockAccept!==void 0,o)},addNodeView(){return o=>{let s=this.options.editor,a=uv(o.getPos,s,this.editor,t.type),l=this.options.domAttributes?.blockContent||{},u=e.render.call({blockContentDOMAttributes:l,props:o,renderType:"nodeView"},a,s);return e.meta?.selectable===!1&&dv(u,this.editor),u}}});if(i.name!==t.type)throw Error("Node name does not match block type. This is a bug in BlockNote.");return{config:t,implementation:{...e,node:i,render(o,s){let a=i.options.domAttributes?.blockContent||{};return e.render.call({blockContentDOMAttributes:a,props:void 0,renderType:"dom"},o,s)},toExternalHTML:(o,s,a)=>{let l=i.options.domAttributes?.blockContent||{};return e.toExternalHTML?.call({blockContentDOMAttributes:l},o,s,a)??e.render.call({blockContentDOMAttributes:l,renderType:"dom",props:void 0},o,s)}},extensions:n}}function Pt(t,e,n){return(r={})=>{let i=typeof t=="function"?t(r):t,o=typeof e=="function"?e(r):e,s=n?typeof n=="function"?n(r):n:void 0;return{config:i,implementation:{...o,toExternalHTML(a,l,u){let c=o.toExternalHTML?.call({blockContentDOMAttributes:this.blockContentDOMAttributes},a,l,u);if(c!==void 0)return xd(c,a.type,a.props,i.propSchema,o.meta?.fileBlockAccept!==void 0)},render(a,l){return xd(o.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},a,l),a.type,a.props,i.propSchema,o.meta?.fileBlockAccept!==void 0,this.blockContentDOMAttributes)}},extensions:s}}}function Tr(t,e){let n=t.resolve(e);if(n.nodeAfter&&n.nodeAfter.type.isInGroup("bnBlock"))return{posBeforeNode:n.pos,node:n.nodeAfter};let r=n.depth,i=n.node(r);for(;r>0;){if(i.type.isInGroup("bnBlock"))return{posBeforeNode:n.before(r),node:i};r--,i=n.node(r)}let o=[];t.descendants((a,l)=>{a.type.isInGroup("bnBlock")&&o.push(l)}),console.warn(`Position ${e} is not within a blockContainer node.`);let s=t.resolve(o.find(a=>a>=e)||o[o.length-1]);return{posBeforeNode:s.pos,node:s.nodeAfter}}function ff(t,e){if(!t.type.isInGroup("bnBlock"))throw Error(`Attempted to get bnBlock node at position but found node of different type ${t.type.name}`);let n=t,r=e,i={node:n,beforePos:r,afterPos:r+n.nodeSize};if(n.type.name==="blockContainer"){let o,s;if(n.forEach((a,l)=>{if(a.type.spec.group==="blockContent"){let u=a,c=r+l+1;o={node:u,beforePos:c,afterPos:c+a.nodeSize}}else if(a.type.name==="blockGroup"){let u=a,c=r+l+1;s={node:u,beforePos:c,afterPos:c+a.nodeSize}}}),!o)throw Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);return{isBlockContainer:!0,bnBlock:i,blockContent:o,childContainer:s,blockNoteType:o.node.type.name}}else{if(!i.node.type.isInGroup("childContainer"))throw Error(`bnBlock node is not in the childContainer group: ${i.node}`);return{isBlockContainer:!1,bnBlock:i,childContainer:i,blockNoteType:i.node.type.name}}}function jn(t){return ff(t.node,t.posBeforeNode)}function Cr(t){if(!t.nodeAfter)throw Error(`Attempted to get blockContainer node at position ${t.pos} but a node at this position does not exist`);return ff(t.nodeAfter,t.pos)}function Oe(t){return jn(Tr(t.doc,t.selection.anchor))}function Us(t){return jn(Tr(t.doc,t.selection.anchor))}function Fe(t){return"doc"in t?t.doc.type.schema:t.type.schema}function JE(t){return t.cached.blockNoteEditor}function $s(t){return JE(t).schema}function pf(t){return $s(t).blockSchema}function mf(t){return $s(t).inlineContentSchema}function fo(t){return $s(t).styleSchema}function gf(t){return JE(t).blockCache}function ZE(t,e,n){let r={type:"tableContent",columnWidths:[],headerRows:void 0,headerCols:void 0,rows:[]},i=[];t.content.forEach((o,s,a)=>{let l={cells:[]};a===0&&o.content.forEach(u=>{let c=u.attrs.colwidth;c??=Array(u.attrs.colspan??1).fill(void 0),r.columnWidths.push(...c)}),l.cells=o.content.content.map((u,c)=>(i[a]||(i[a]=[]),i[a][c]=u.type.name==="tableHeader",{type:"tableCell",content:u.content.content.map(d=>ou(d,e,n)).reduce((d,h)=>{if(!d.length)return h;let f=d[d.length-1],p=h[0];return p&&ri(f)&&ri(p)&&JSON.stringify(f.styles)===JSON.stringify(p.styles)?(f.text+=`
108
+ `+p.text,d.push(...h.slice(1)),d):(d.push(...h),d)},[]),props:{colspan:u.attrs.colspan,rowspan:u.attrs.rowspan,backgroundColor:u.attrs.backgroundColor,textColor:u.attrs.textColor,textAlignment:u.attrs.textAlignment}})),r.rows.push(l)});for(let o=0;o<i.length;o++)i[o]?.every(s=>s)&&(r.headerRows=(r.headerRows??0)+1);for(let o=0;o<i[0]?.length;o++)i?.every(s=>s[o])&&(r.headerCols=(r.headerCols??0)+1);return r}function ou(t,e,n){let r=[],i;return t.content.forEach(o=>{if(o.type.name==="hardBreak"){if(i)if(ri(i))i.text+=`
109
+ `;else if(ig(i))i.content[i.content.length-1].text+=`
110
+ `;else throw Error("unexpected");else i={type:"text",text:`
111
+ `,styles:{}};return}if(o.type.name!=="link"&&o.type.name!=="text"){if(!e[o.type.name]){console.warn("unrecognized inline content type",o.type.name);return}i&&=(r.push(i),void 0),r.push(bf(o,e,n));return}let s={},a;for(let l of o.marks)if(l.type.name==="link")a=l;else{let u=n[l.type.name];if(!u){if(l.type.spec.blocknoteIgnore)continue;throw Error(`style ${l.type.name} not found in styleSchema`)}if(u.propSchema==="boolean")s[u.type]=!0;else if(u.propSchema==="string")s[u.type]=l.attrs.stringValue;else throw new xn(u.propSchema)}i?ri(i)?a?(r.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:o.textContent,styles:s}]}):JSON.stringify(i.styles)===JSON.stringify(s)?i.text+=o.textContent:(r.push(i),i={type:"text",text:o.textContent,styles:s}):ig(i)&&(a?i.href===a.attrs.href?JSON.stringify(i.content[i.content.length-1].styles)===JSON.stringify(s)?i.content[i.content.length-1].text+=o.textContent:i.content.push({type:"text",text:o.textContent,styles:s}):(r.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:o.textContent,styles:s}]}):(r.push(i),i={type:"text",text:o.textContent,styles:s})):i=a?{type:"link",href:a.attrs.href,content:[{type:"text",text:o.textContent,styles:s}]}:{type:"text",text:o.textContent,styles:s}}),i&&r.push(i),r}function bf(t,e,n){if(t.type.name==="text"||t.type.name==="link")throw Error("unexpected");let r={},i=e[t.type.name];for(let[s,a]of Object.entries(t.attrs)){if(!i)throw Error("ic node is of an unrecognized type: "+t.type.name);s in i.propSchema&&(r[s]=a)}let o;return o=i.content==="styled"?ou(t,e,n):void 0,{type:t.type.name,props:r,content:o}}function Ae(t,e,n=pf(e),r=mf(e),i=fo(e),o=gf(e)){if(!t.type.isInGroup("bnBlock"))throw Error("Node should be a bnBlock, but is instead: "+t.type.name);let s=o?.get(t);if(s)return s;let a=ff(t,0),l=a.bnBlock.node.attrs.id;l===null&&(l=iu.options.generateID());let u=n[a.blockNoteType];if(!u)throw Error("Block is of an unrecognized type: "+a.blockNoteType);let c={};for(let[g,y]of Object.entries({...t.attrs,...a.isBlockContainer?a.blockContent.node.attrs:{}})){let b=u.propSchema;g in b&&!(b[g].default===void 0&&y===void 0)&&(c[g]=y)}let d=n[a.blockNoteType],h=[];a.childContainer?.node.forEach(g=>{h.push(Ae(g,e,n,r,i,o))});let f;if(d.content==="inline"){if(!a.isBlockContainer)throw Error("impossible");f=ou(a.blockContent.node,r,i)}else if(d.content==="table"){if(!a.isBlockContainer)throw Error("impossible");f=ZE(a.blockContent.node,r,i)}else if(d.content==="none")f=void 0;else throw new xn(d.content);let p={id:l,type:d.type,props:c,content:f,children:h};return o?.set(t,p),p}function pv(t,e=Fe(t),n=pf(e),r=mf(e),i=fo(e),o=gf(e)){let s=[];return t.firstChild&&t.firstChild.descendants(a=>(s.push(Ae(a,e,n,r,i,o)),!1)),s}function mv(t,e,n=pf(e),r=mf(e),i=fo(e),o=gf(e)){function s(a,l,u){if(a.type.name!=="blockGroup")throw Error("unexpected");let c=[],d,h;return a.forEach((f,p,g)=>{if(f.type.name!=="blockContainer")throw Error("unexpected");if(f.childCount===0)return;if(f.childCount===0||f.childCount>2)throw Error("unexpected, blockContainer.childCount: "+f.childCount);let y=g===0,b=g===a.childCount-1;if(f.firstChild.type.name==="blockGroup"){if(!y)throw Error("unexpected");let O=s(f.firstChild,Math.max(0,l-1),b?Math.max(0,u-1):0);d=O.blockCutAtStart,b&&(h=O.blockCutAtEnd),c.push(...O.blocks);return}let C=Ae(f,e,n,r,i,o),w=f.childCount>1?f.child(1):void 0,v=[];if(w){let O=s(w,0,b?Math.max(0,u-1):0);v=O.blocks,b&&(h=O.blockCutAtEnd)}b&&!w&&u>1&&(h=C.id),y&&l>1&&(d=C.id),c.push({...C,children:v})}),{blocks:c,blockCutAtStart:d,blockCutAtEnd:h}}if(t.content.childCount===0)return{blocks:[],blockCutAtStart:void 0,blockCutAtEnd:void 0};if(t.content.childCount!==1)throw Error("slice must be a single block, did you forget includeParents=true?");return s(t.content.firstChild,Math.max(t.openStart-1,0),Math.max(t.openEnd-1,0))}function zz(t,e,n,r){return t.dom.setAttribute("data-inline-content-type",e),Object.entries(n).filter(([i,o])=>o!==r[i].default).map(([i,o])=>[As(i),o]).forEach(([i,o])=>t.dom.setAttribute(i,o)),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function Vz(t){return{Backspace:({editor:e})=>{let n=e.state.selection.$from;return e.state.selection.empty&&n.node().type.name===t.type&&n.parentOffset===0}}}function qz(t,e){return{config:t,implementation:e}}function ek(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function gv(t){return t==="boolean"?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>e.stringValue===void 0?{}:{"data-value":e.stringValue}}}}function ha(t,e,n,r){return t.dom.setAttribute("data-style-type",e),r==="string"&&t.dom.setAttribute("data-value",n),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function tk(t,e){return{config:t,implementation:e}}function Co(t,e){return tk({type:t.name,propSchema:e},{mark:t,render(n,r){let i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=r.pmSchema.mark(t.name,{stringValue:n}),s=Lt.renderSpec(document,i(o,!0));if(typeof s!="object"||!("dom"in s))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return s},toExternalHTML(n,r){let i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=r.pmSchema.mark(t.name,{stringValue:n}),s=Lt.renderSpec(document,i(o,!0));if(typeof s!="object"||!("dom"in s))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return s}})}function nk(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function bv(t,e){let n=[{tag:`[data-style-type="${t.type}"]`,contentElement:r=>{let i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",consuming:!1,getAttrs(r){if(typeof r=="string")return!1;let i=e?.(r);return i===void 0?!1:{stringValue:i}}}),n}function rk(t,e){let n=cn.create({name:t.type,addAttributes(){return gv(t.propSchema)},parseHTML(){return bv(t,e.parse)},renderHTML({mark:r}){return ha((e.toExternalHTML||e.render)(r.attrs.stringValue),t.type,r.attrs.stringValue,t.propSchema)},addMarkView(){return({mark:r})=>ha(e.render(r.attrs.stringValue),t.type,r.attrs.stringValue,t.propSchema)}});return tk(t,{...e,mark:n,render:r=>ha(e.render(r),t.type,r,t.propSchema),toExternalHTML:r=>ha((e.toExternalHTML||e.render)(r),t.type,r,t.propSchema)})}function yv(t){let e=kv(t),{roots:n,nonRoots:r}=sg(e),i=[];for(;n.size;){i.push(n);let o=new Set;for(let s of n){let a=t.get(s);if(a)for(let l of a){let u=e.get(l);if(u===void 0)continue;let c=u-1;e.set(l,c),c===0&&o.add(l)}}n=o}if(r=sg(e).nonRoots,r.size)throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);return i}function Ev(t){return yv(Tv(t))}function kv(t){let e=new Map;for(let[n,r]of t.entries()){e.has(n)||e.set(n,0);for(let i of r){let o=e.get(i)??0;e.set(i,o+1)}}return e}function sg(t){let e=new Set,n=new Set;for(let[r,i]of t.entries())i===0?e.add(r):n.add(r);return{roots:e,nonRoots:n}}function Tv(t){let e=new Map;for(let[n,r]of t.entries()){e.has(n)||e.set(n,new Set);for(let i of r)e.has(i)||e.set(i,new Set),e.get(i).add(n)}return e}function Cv(){return new Map}function ag(t,e,n){return t.has(e)||t.set(e,new Set),t.get(e).add(n),t}function ik(t){let e=Cv();for(let i of t)Array.isArray(i.runsBefore)&&i.runsBefore.length>0?i.runsBefore.forEach(o=>{ag(e,i.key,o)}):ag(e,"default",i.key);let n=Ev(e),r=n.findIndex(i=>i.has("default"));return i=>91+(n.findIndex(o=>o.has(i))+r)*10}function lg(t){return t&&Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}var Sv=class{BlockNoteEditor="only for types";Block="only for types";PartialBlock="only for types";inlineContentSpecs;styleSpecs;blockSpecs;blockSchema;inlineContentSchema;styleSchema;constructor(e){this.opts=e;let{blockSpecs:n,inlineContentSpecs:r,styleSpecs:i,blockSchema:o,inlineContentSchema:s,styleSchema:a}=this.init();this.blockSpecs=n,this.styleSpecs=i,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=o,this.inlineContentSchema=s}init(){let e=ik(Object.entries({...this.opts.blockSpecs,...this.opts.inlineContentSpecs,...this.opts.styleSpecs}).map(([o,s])=>({key:o,runsBefore:s.implementation?.runsBefore??[]}))),n=Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([o,s])=>[o,fv(s.config,s.implementation,s.extensions,e(o))])),r=Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([o,s])=>typeof s.config=="object"?[o,{...s,implementation:{...s.implementation,node:s.implementation?.node.extend({priority:e(o)})}}]:[o,s])),i=Object.fromEntries(Object.entries(this.opts.styleSpecs).map(([o,s])=>[o,{...s,implementation:{...s.implementation,mark:s.implementation?.mark.extend({priority:e(o)})}}]));return{blockSpecs:n,blockSchema:Object.fromEntries(Object.entries(n).map(([o,s])=>[o,s.config])),inlineContentSpecs:lg(r),styleSpecs:lg(i),inlineContentSchema:ek(r),styleSchema:nk(i)}}extend(e){Object.assign(this.opts.blockSpecs,e.blockSpecs),Object.assign(this.opts.inlineContentSpecs,e.inlineContentSpecs),Object.assign(this.opts.styleSpecs,e.styleSpecs);let{blockSpecs:n,inlineContentSpecs:r,styleSpecs:i,blockSchema:o,inlineContentSchema:s,styleSchema:a}=this.init();return this.blockSpecs=n,this.styleSpecs=i,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=o,this.inlineContentSchema=s,this}};function _r(t){let{height:e,width:n}=yf(t),r=Array(e).fill(!1).map(()=>Array(n).fill(null)),i=(o,s)=>{for(let a=o;a<e;a++)for(let l=s;l<n;l++)if(!r[a][l])return{row:a,col:l};throw Error("Unable to create occupancy grid for table, no more available cells")};for(let o=0;o<t.content.rows.length;o++)for(let s=0;s<t.content.rows[o].cells.length;s++){let a=Cd(t.content.rows[o].cells[s]),l=Sd(a),u=ws(a),{row:c,col:d}=i(o,s);for(let h=c;h<c+l;h++)for(let f=d;f<d+u;f++){if(r[h][f])throw Error(`Unable to create occupancy grid for table, cell at ${h},${f} is already occupied`);r[h][f]={row:o,col:s,rowspan:l,colspan:u,cell:a}}}return r}function _s(t){let e=new Set;return t.map(n=>({cells:n.map(r=>e.has(r.row+":"+r.col)?!1:(e.add(r.row+":"+r.col),r.cell)).filter(r=>r!==!1)}))}function ii(t,e,n=_r(e)){for(let r=0;r<n.length;r++)for(let i=0;i<n[r].length;i++){let o=n[r][i];if(o&&o.row===t.row&&o.col===t.col)return{row:r,col:i,cell:o.cell}}throw Error(`Unable to resolve relative table cell indices for table, cell at ${t.row},${t.col} is not occupied`)}function yf(t){let e=t.content.rows.length,n=0;return t.content.rows.forEach(r=>{let i=0;r.cells.forEach(o=>{i+=ws(o)}),n=Math.max(n,i)}),{height:e,width:n}}function ok(t,e,n=_r(e)){let r=n[t.row]?.[t.col];if(r)return{row:r.row,col:r.col,cell:r.cell}}function wd(t,e){let n=_r(t);if(e<0||e>=n.length)return[];let r=0;for(let o=0;o<e;o++){let s=n[r]?.[0];if(!s)return[];r+=s.rowspan}let i=Array(n[0].length).fill(!1).map((o,s)=>ok({row:r,col:s},t,n)).filter(o=>o!==void 0);return i.filter((o,s)=>i.findIndex(a=>a.row===o.row&&a.col===o.col)===s)}function Ad(t,e){let n=_r(t);if(e<0||e>=n[0].length)return[];let r=0;for(let o=0;o<e;o++){let s=n[0]?.[r];if(!s)return[];r+=s.colspan}let i=Array(n.length).fill(!1).map((o,s)=>ok({row:s,col:r},t,n)).filter(o=>o!==void 0);return i.filter((o,s)=>i.findIndex(a=>a.row===o.row&&a.col===o.col)===s)}function xv(t,e,n,r=_r(t)){let{col:i}=ii({row:0,col:e},t,r),{col:o}=ii({row:0,col:n},t,r);return r.forEach(s=>{let[a]=s.splice(i,1);s.splice(o,0,a)}),_s(r)}function wv(t,e,n,r=_r(t)){let{row:i}=ii({row:e,col:0},t,r),{row:o}=ii({row:n,col:0},t,r),[s]=r.splice(i,1);return r.splice(o,0,s),_s(r)}function _d(t){return t?xs(t)?_d(t.content):typeof t=="string"?t.length===0:Array.isArray(t)?t.every(e=>typeof e=="string"?e.length===0:ri(e)?e.text.length===0:QE(e)?typeof e.content=="string"?e.content.length===0:e.content.every(n=>n.text.length===0):!1):!1:!0}function Av(t,e,n=_r(t)){if(e==="columns"){let o=0;for(let s=n[0].length-1;s>=0&&n.every(a=>_d(a[s].cell)&&a[s].colspan===1);s--)o++;for(let s=n.length-1;s>=0;s--){let a=Math.max(n[s].length-o,1);n[s]=n[s].slice(0,a)}return _s(n)}let r=0;for(let o=n.length-1;o>=0&&n[o].every(s=>_d(s.cell)&&s.rowspan===1);o--)r++;let i=Math.min(r,n.length-1);return n.splice(n.length-i,i),_s(n)}function _v(t,e,n,r=_r(t)){let{width:i,height:o}=yf(t);if(e==="columns")r.forEach((s,a)=>{if(n>=0)for(let l=0;l<n;l++)s.push({row:a,col:Math.max(...s.map(u=>u.col))+1,rowspan:1,colspan:1,cell:Cd("")});else s.splice(i+n,-1*n)});else if(n>0)for(let s=0;s<n;s++){let a=Array(i).fill(null).map((l,u)=>({row:o+s,col:u,rowspan:1,colspan:1,cell:Cd("")}));r.push(a)}else n<0&&r.splice(o+n,-1*n);return _s(r)}function sk(t,e,n){let r=wd(t,n);if(!r.some(s=>Sd(s.cell)>1))return!0;let i=n,o=n;return r.forEach(s=>{let a=Sd(s.cell);i=Math.max(i,s.row+a-1),o=Math.min(o,s.row)}),e<n?n===i:n===o}function ak(t,e,n){let r=Ad(t,n);if(!r.some(s=>ws(s.cell)>1))return!0;let i=n,o=n;return r.forEach(s=>{let a=ws(s.cell);i=Math.max(i,s.col+a-1),o=Math.min(o,s.col)}),e<n?n===i:n===o}function Nv(t,e,n){let r=ii(t,n),i=ii(e,n);return r.col===i.col}function ug(t,e,n,r){let i=[];for(let[o,s]of Object.entries(t.styles||{})){let a=n[o];if(!a)throw Error(`style ${o} not found in styleSchema`);if(a.propSchema==="boolean")s&&i.push(e.mark(o));else if(a.propSchema==="string")s&&i.push(e.mark(o,{stringValue:s}));else throw new xn(a.propSchema)}return!r||!e.nodes[r].spec.code?t.text.split(/(\n)/g).filter(o=>o.length>0).map(o=>o===`
112
+ `?e.nodes.hardBreak.createChecked():e.text(o,i)):t.text.length>0?[e.text(t.text,i)]:[]}function Iv(t,e,n){let r=e.marks.link.create({href:t.href});return Nd(t.content,e,n).map(i=>{if(i.type.name==="text")return i.mark([...i.marks,r]);if(i.type.name==="hardBreak")return i;throw Error("unexpected node type")})}function Nd(t,e,n,r){let i=[];if(typeof t=="string")return i.push(...ug({text:t,styles:{}},e,n,r)),i;for(let o of t)i.push(...ug(o,e,n,r));return i}function un(t,e,n,r=fo(e)){let i=[];for(let o of t)typeof o=="string"?i.push(...Nd(o,e,r,n)):QE(o)?i.push(...Iv(o,e,r)):ri(o)?i.push(...Nd([o],e,r,n)):i.push(lk(o,e,r));return i}function su(t,e,n=fo(e)){let r=[],i=Array(t.headerRows??0).fill(!0),o=Array(t.headerCols??0).fill(!0),s=t.columnWidths??[];for(let a=0;a<t.rows.length;a++){let l=t.rows[a],u=[],c=i[a];for(let h=0;h<l.cells.length;h++){let f=l.cells[h],p=o[h],g=null,y=ii({row:a,col:h},{content:t}),b=s[y.col]?[s[y.col]]:null;if(f)if(typeof f=="string")g=e.text(f);else if(xs(f)){f.content&&(g=un(f.content,e,"tableParagraph",n));let w=ws(f);w>1&&(b=Array(w).fill(!1).map((v,O)=>s[y.col+O]??void 0))}else g=un(f,e,"tableParagraph",n);let C=e.nodes[p||c?"tableHeader":"tableCell"].createChecked({...xs(f)?f.props:{},colwidth:b},e.nodes.tableParagraph.createChecked(void 0,g));u.push(C)}let d=e.nodes.tableRow.createChecked({},u);r.push(d)}return r}function lk(t,e,n){let r,i=t.type;if(i===void 0&&(i="paragraph"),!e.nodes[i])throw Error(`node type ${i} not found in schema`);if(!t.content)r=e.nodes[i].createChecked(t.props);else if(typeof t.content=="string"){let o=un([t.content],e,i,n);r=e.nodes[i].createChecked(t.props,o)}else if(Array.isArray(t.content)){let o=un(t.content,e,i,n);r=e.nodes[i].createChecked(t.props,o)}else if(t.content.type==="tableContent"){let o=su(t.content,e,n);r=e.nodes[i].createChecked(t.props,o)}else throw new xn(t.content.type);return r}function ci(t,e,n=fo(e)){let r=t.id;r===void 0&&(r=iu.options.generateID());let i=[];if(t.children)for(let o of t.children)i.push(ci(o,e,n));if(!t.type||e.nodes[t.type].isInGroup("blockContent")){let o=lk(t,e,n),s=i.length>0?e.nodes.blockGroup.createChecked({},i):void 0;return e.nodes.blockContainer.createChecked({id:r,...t.props},s?[o,s]:o)}else{if(e.nodes[t.type].isInGroup("bnBlock"))return e.nodes[t.type].createChecked({id:r,...t.props},i);throw Error(`block type ${t.type} doesn't match blockContent or bnBlock group`)}}function Rt(t,e){let n,r;if(e.firstChild.descendants((i,o)=>n?!1:!Ef(i)||i.attrs.id!==t?!0:(n=i,r=o+1,!1)),!(n===void 0||r===void 0))return{node:n,posBeforeNode:r}}function Ef(t){return t.type.isInGroup("bnBlock")}var Mv=(t,e)=>({tr:n,dispatch:r})=>(r&&au(n,t,e),!0);function au(t,e,n,r,i){let o=Cr(t.doc.resolve(e)),s=null;o.blockNoteType==="table"&&(s=vv(t));let a=Fe(t),l=a.nodes[o.blockNoteType],u=a.nodes[n.type||o.blockNoteType],c=u.isInGroup("bnBlock")?u:a.nodes.blockContainer;if(o.isBlockContainer&&u.isInGroup("blockContent"))cg(n,t,o),Ov(n,t,l,u,o);else if(!o.isBlockContainer&&u.isInGroup("bnBlock"))cg(n,t,o);else{let d=Ae(o.bnBlock.node,a);t.replaceWith(o.bnBlock.beforePos,o.bnBlock.afterPos,ci({children:d.children,...n},a));return}t.setNodeMarkup(o.bnBlock.beforePos,c,{...o.bnBlock.node.attrs,...n.props}),s&&Lv(t,o,s)}function Ov(t,e,n,r,i,o,s){let a=Fe(e),l="keep";if(t.content)if(typeof t.content=="string")l=un([t.content],a,r.name);else if(Array.isArray(t.content))l=un(t.content,a,r.name);else if(t.content.type==="tableContent")l=su(t.content,a);else throw new xn(t.content.type);else n.spec.content===""||r.spec.content!==n.spec.content&&(l=[]);l==="keep"?e.setNodeMarkup(i.blockContent.beforePos,r,{...i.blockContent.node.attrs,...t.props}):e.replaceWith(i.blockContent.beforePos,i.blockContent.afterPos,r.createChecked({...i.blockContent.node.attrs,...t.props},l))}function cg(t,e,n){let r=Fe(e);if(t.children!==void 0&&t.children.length>0){let i=t.children.map(o=>ci(o,r));if(n.childContainer)e.step(new Ne(n.childContainer.beforePos+1,n.childContainer.afterPos-1,new B(M.from(i),0,0)));else{if(!n.isBlockContainer)throw Error("impossible");e.insert(n.blockContent.afterPos,r.nodes.blockGroup.createChecked({},i))}}}function Dv(t,e,n,r,i){let o=typeof e=="string"?e:e.id,s=Rt(o,t.doc);if(!s)throw Error(`Block with ID ${o} not found`);return au(t,s.posBeforeNode,n),Ae(t.doc.resolve(s.posBeforeNode+1).node(),Fe(t))}function vv(t){let e="selection"in t?t.selection:null;if(!(e instanceof $))return null;let n=t.doc.resolve(e.head),r=-1,i=-1;for(let p=n.depth;p>=0;p--){let g=n.node(p).type.name;if(r<0&&(g==="tableCell"||g==="tableHeader")&&(r=p),g==="table"){i=p;break}}if(r<0||i<0)return null;let o=n.before(r),s=n.before(i),a=t.doc.nodeAt(s);if(!a||a.type.name!=="table")return null;let l=Ce.get(a),u=o-(s+1),c=l.map.indexOf(u);if(c<0)return null;let d=Math.floor(c/l.width),h=c%l.width,f=o+1+1;return{row:d,col:h,offset:Math.max(0,e.head-f)}}function Lv(t,e,n){if(e.blockNoteType!=="table")return!1;let r=-1;if(e.isBlockContainer)r=t.mapping.map(e.blockContent.beforePos);else{let g=t.mapping.map(e.bnBlock.beforePos),y=g+(t.doc.nodeAt(g)?.nodeSize||0);t.doc.nodesBetween(g,y,(b,C)=>b.type.name==="table"?(r=C,!1):!0)}let i=r>=0?t.doc.nodeAt(r):null;if(!i||i.type.name!=="table")return!1;let o=Ce.get(i),s=Math.max(0,Math.min(n.row,o.height-1)),a=Math.max(0,Math.min(n.col,o.width-1)),l=s*o.width+a,u=o.map[l];if(u==null)return!1;let c=r+1+u+1,d=t.doc.nodeAt(c),h=c+1,f=d?d.content.size:0,p=h+Math.max(0,Math.min(n.offset,f));return"selection"in t&&t.setSelection($.create(t.doc,p)),!0}var cr={gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}},pe={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},tt=t=>{let e={};return t.hasAttribute("data-background-color")?e.backgroundColor=t.getAttribute("data-background-color"):t.style.backgroundColor&&(e.backgroundColor=t.style.backgroundColor),t.hasAttribute("data-text-color")?e.textColor=t.getAttribute("data-text-color"):t.style.color&&(e.textColor=t.style.color),e.textAlignment=pe.textAlignment.values.includes(t.style.textAlign)?t.style.textAlign:void 0,e},di=(t,e)=>{t.backgroundColor&&t.backgroundColor!==pe.backgroundColor.default&&(e.style.backgroundColor=t.backgroundColor in cr?cr[t.backgroundColor].background:t.backgroundColor),t.textColor&&t.textColor!==pe.textColor.default&&(e.style.color=t.textColor in cr?cr[t.textColor].text:t.textColor),t.textAlignment&&t.textAlignment!==pe.textAlignment.default&&(e.style.textAlign=t.textAlignment)},Rv=(t="backgroundColor")=>({default:pe.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):e.style.backgroundColor?e.style.backgroundColor:pe.backgroundColor.default,renderHTML:e=>e[t]===pe.backgroundColor.default?{}:{"data-background-color":e[t]}}),Pv=(t="textColor")=>({default:pe.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):e.style.color?e.style.color:pe.textColor.default,renderHTML:e=>e[t]===pe.textColor.default?{}:{"data-text-color":e[t]}}),lu=(t,e)=>{let n=t.querySelector(e);if(n)return{targetElement:n,caption:t.querySelector("figcaption")?.textContent??void 0}},dr=de(({editor:t})=>{let e=ai(void 0);function n(){e.setState(void 0)}return{key:"filePanel",store:e,mount({signal:r}){let i=t.onChange(n,!1),o=t.onSelectionChange(n,!1);r.addEventListener("abort",()=>{i(),o()})},closeMenu:n,showMenu(r){e.setState(r)}}}),Bv=(t,e,n)=>{let r=document.createElement("div");r.className="bn-add-file-button";let i=document.createElement("div");i.className="bn-add-file-button-icon",n?i.appendChild(n):i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',r.appendChild(i);let o=document.createElement("p");o.className="bn-add-file-button-text",o.innerHTML=t.type in e.dictionary.file_blocks.add_button_text?e.dictionary.file_blocks.add_button_text[t.type]:e.dictionary.file_blocks.add_button_text.file,r.appendChild(o);let s=l=>{l.preventDefault(),l.stopPropagation()},a=()=>{e.isEditable&&e.getExtension(dr)?.showMenu(t.id)};return r.addEventListener("mousedown",s,!0),r.addEventListener("click",a,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",s,!0),r.removeEventListener("click",a,!0)}}},Fv='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',Hv=t=>{let e=document.createElement("div");e.className="bn-file-name-with-icon";let n=document.createElement("div");n.className="bn-file-icon",n.innerHTML=Fv,e.appendChild(n);let r=document.createElement("p");return r.className="bn-file-name",r.textContent=t.props.name,e.appendChild(r),{dom:e}},kf=(t,e,n,r)=>{let i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){let s=Bv(t,e,r);i.appendChild(s.dom);let a=e.onUploadStart(l=>{if(l===t.id){i.removeChild(s.dom);let u=document.createElement("div");u.className="bn-file-loading-preview",u.textContent="Loading...",i.appendChild(u)}});return{dom:i,destroy:()=>{a(),s.destroy()}}}let o={dom:i};if(t.props.showPreview===!1||!n){let s=Hv(t);i.appendChild(s.dom),o.destroy=()=>{s.destroy?.()}}else i.appendChild(n.dom);if(t.props.caption){let s=document.createElement("p");s.className="bn-file-caption",s.textContent=t.props.caption,i.appendChild(s)}return o},Tf=(t,e)=>{let n=document.createElement("figure"),r=document.createElement("figcaption");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},uu=(t,e)=>{let n=document.createElement("div"),r=document.createElement("p");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},dg=t=>({url:t.src||void 0}),Uv=t=>({type:"audio",propSchema:{backgroundColor:pe.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),$v=(t={})=>e=>{if(e.tagName==="AUDIO"){if(e.closest("figure"))return;let{backgroundColor:n}=tt(e);return{...dg(e),backgroundColor:n}}if(e.tagName==="FIGURE"){let n=lu(e,"audio");if(!n)return;let{targetElement:r,caption:i}=n,{backgroundColor:o}=tt(e);return{...dg(r),backgroundColor:o,caption:i}}},zv=(t={})=>(e,n)=>{let r=document.createElement("div");r.innerHTML=t.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';let i=document.createElement("audio");return i.className="bn-audio",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(o=>{i.src=o}):i.src=e.props.url,i.controls=!0,i.contentEditable="false",i.draggable=!1,kf(e,n,{dom:i},r.firstElementChild)},Vv=(t={})=>(e,n)=>{if(!e.props.url){let i=document.createElement("p");return i.textContent="Add audio",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("audio"),r.src=e.props.url):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Tf(r,e.props.caption):uu(r,e.props.caption):{dom:r}},qv=Pt(Uv,t=>({meta:{fileBlockAccept:["audio/*"]},parse:$v(t),render:zv(t),toExternalHTML:Vv(t),runsBefore:["file"]})),hg=Symbol.for("blocknote.shikiParser"),tc=Symbol.for("blocknote.shikiHighlighterPromise");function jv(t){let e=globalThis,n,r;return DN({parser:i=>{if(!t.createHighlighter)return[];if(!n)return e[tc]=e[tc]||t.createHighlighter(),e[tc].then(s=>{n=s});let o=uk(t,i.language);return!o||o==="text"||o==="none"||o==="plaintext"||o==="txt"?[]:n.getLoadedLanguages().includes(o)?(r||(r=e[hg]||LN(n),e[hg]=r),r(i)):n.loadLanguage(o)},languageExtractor:i=>i.attrs.language,nodeTypes:["codeBlock"]})}var Wv=({defaultLanguage:t="text"})=>({type:"codeBlock",propSchema:{language:{default:t}},content:"inline"}),Yv=Pt(Wv,t=>({meta:{code:!0,defining:!0,isolating:!1},parse:e=>{if(e.tagName!=="PRE"||e.childElementCount!==1||e.firstElementChild?.tagName!=="CODE")return;let n=e.firstElementChild;return{language:n.getAttribute("data-language")||n.className.split(" ").find(r=>r.includes("language-"))?.replace("language-","")}},parseContent:({el:e,schema:n})=>{let r=Vt.fromSchema(n),i=e.firstElementChild;return r.parse(i,{preserveWhitespace:"full",topNode:n.nodes.codeBlock.create()}).content},render(e,n){let r=document.createDocumentFragment(),i=document.createElement("pre"),o=document.createElement("code");i.appendChild(o);let s;if(t.supportedLanguages){let a=document.createElement("select");if(Object.entries(t.supportedLanguages??{}).forEach(([u,{name:c}])=>{let d=document.createElement("option");d.value=u,d.text=c,a.appendChild(d)}),a.value=e.props.language||t.defaultLanguage||"text",n.isEditable){let u=c=>{let d=c.target.value;n.updateBlock(e.id,{props:{language:d}})};a.addEventListener("change",u),s=()=>a.removeEventListener("change",u)}else a.disabled=!0;let l=document.createElement("div");l.contentEditable="false",l.appendChild(a),r.appendChild(l)}return r.appendChild(i),{dom:r,contentDOM:o,destroy:()=>{s?.()}}},toExternalHTML(e){let n=document.createElement("pre"),r=document.createElement("code");return r.className=`language-${e.props.language}`,r.dataset.language=e.props.language,n.appendChild(r),{dom:n,contentDOM:r}}}),t=>[de({key:"code-block-highlighter",prosemirrorPlugins:[jv(t)]}),de({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:e})=>e.transact(n=>{let{block:r}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;let{$from:i}=n.selection;return i.parent.textContent?!1:(e.removeBlocks([r]),!0)}),Tab:({editor:e})=>t.indentLineWithTab===!1?!1:e.transact(n=>{let{block:r}=e.getTextCursorPosition();return r.type==="codeBlock"?(n.insertText(" "),!0):!1}),Enter:({editor:e})=>e.transact(n=>{let{block:r,nextBlock:i}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;let{$from:o}=n.selection,s=o.parentOffset===o.parent.nodeSize-2,a=o.parent.textContent.endsWith(`
113
+
114
+ `);if(s&&a){if(n.delete(o.pos-2,o.pos),i)return e.setTextCursorPosition(i,"start"),!0;let[l]=e.insertBlocks([{type:"paragraph"}],r,"after");return e.setTextCursorPosition(l,"start"),!0}return n.insertText(`
115
+ `),!0}),"Shift-Enter":({editor:e})=>e.transact(()=>{let{block:n}=e.getTextCursorPosition();if(n.type!=="codeBlock")return!1;let[r]=e.insertBlocks([{type:"paragraph"}],n,"after");return e.setTextCursorPosition(r,"start"),!0})},inputRules:[{find:/^```(.*?)\s$/,replace:({match:e})=>{let n=e[1].trim();return{type:"codeBlock",props:{language:{language:uk(t,n)??n}.language},content:[]}}}]})]);function uk(t,e){return Object.entries(t.supportedLanguages??{}).find(([n,{aliases:r}])=>r?.includes(e)||n===e)?.[0]}var Gv=()=>({type:"divider",propSchema:{},content:"none"}),Kv=Pt(Gv,{meta:{isolating:!1},parse(t){if(t.tagName==="HR")return{}},render(){return{dom:document.createElement("hr")}}},[de({key:"divider-block-shortcuts",inputRules:[{find:RegExp("^---$"),replace(){return{type:"divider",props:{},content:[]}}}]})]),fg=t=>({url:t.src||void 0}),Qv=()=>({type:"file",propSchema:{backgroundColor:pe.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),Xv=()=>t=>{if(t.tagName==="EMBED"){if(t.closest("figure"))return;let{backgroundColor:e}=tt(t);return{...fg(t),backgroundColor:e}}if(t.tagName==="FIGURE"){let e=lu(t,"embed");if(!e)return;let{targetElement:n,caption:r}=e,{backgroundColor:i}=tt(t);return{...fg(n),backgroundColor:i,caption:r}}},Jv=Pt(Qv,{meta:{fileBlockAccept:["*/*"]},parse:Xv(),render(t,e){return kf(t,e)},toExternalHTML(t){if(!t.props.url){let n=document.createElement("p");return n.textContent="Add file",{dom:n}}let e=document.createElement("a");return e.href=t.props.url,e.textContent=t.props.name||t.props.url,t.props.caption?uu(e,t.props.caption):{dom:e}}});function ck(t,e,n){let r=Vt.fromSchema(e),i=t.querySelector(":scope > summary"),o;if(i){let c=i.cloneNode(!0);XE(c),o=r.parse(c,{topNode:e.nodes.paragraph.create(),preserveWhitespace:!0}).content}else o=M.empty;let s=document.createElement("div");s.setAttribute("data-node-type","blockGroup");let a=!1;for(let c of Array.from(t.childNodes))c.tagName!=="SUMMARY"&&(c.nodeType===3&&!c.textContent?.trim()||(a=!0,s.appendChild(c.cloneNode(!0))));let l=e.nodes[n].create({},o);if(!a)return l.content;let u=r.parse(s,{topNode:e.nodes.blockGroup.create()});return u.content.size>0?l.content.addToEnd(u):l.content}var Zv={set:(t,e)=>window.localStorage.setItem(`toggle-${t.id}`,e?"true":"false"),get:t=>window.localStorage.getItem(`toggle-${t.id}`)==="true"},dk=(t,e,n,r=Zv)=>{if("isToggleable"in t.props&&!t.props.isToggleable)return{dom:n};let i=document.createElement("div"),o=document.createElement("div");o.className="bn-toggle-wrapper";let s=document.createElement("button");s.className="bn-toggle-button",s.type="button",s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';let a=p=>p.preventDefault();s.addEventListener("mousedown",a);let l=()=>{o.getAttribute("data-show-children")==="true"?(o.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1),i.contains(u)&&i.removeChild(u)):(o.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0),e.isEditable&&e.getBlock(t)?.children.length===0&&!i.contains(u)&&i.appendChild(u))};s.addEventListener("click",l),o.appendChild(s),o.appendChild(n);let u=document.createElement("button");u.className="bn-toggle-add-block-button",u.type="button",u.textContent=e.dictionary.toggle_blocks.add_block_button;let c=p=>p.preventDefault();u.addEventListener("mousedown",c);let d=()=>{e.transact(()=>{let p=e.updateBlock(t,{children:[{}]});e.setTextCursorPosition(p.children[0].id,"end"),e.focus()})};u.addEventListener("click",d),i.appendChild(o);let h=t.children.length,f=e.onChange(()=>{let p=e.getBlock(t)?.children.length??0;p>h?(o.getAttribute("data-show-children")==="false"&&(o.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0)),i.contains(u)&&i.removeChild(u)):p===0&&p<h&&(o.getAttribute("data-show-children")==="true"&&(o.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1)),i.contains(u)&&i.removeChild(u)),h=p});return r.get(t)?(o.setAttribute("data-show-children","true"),e.isEditable&&t.children.length===0&&i.appendChild(u)):o.setAttribute("data-show-children","false"),{dom:i,ignoreMutation:p=>p instanceof MutationRecord&&(p.type==="attributes"&&p.target===o&&p.attributeName==="data-show-children"||p.type==="childList"&&(p.addedNodes[0]===u||p.removedNodes[0]===u)),destroy:()=>{s.removeEventListener("mousedown",a),s.removeEventListener("click",l),u.removeEventListener("mousedown",c),u.removeEventListener("click",d),f?.()}}},hk=[1,2,3,4,5,6],eL=t=>({editor:e})=>{let n=e.getTextCursorPosition();return e.schema.blockSchema[n.block.type].content==="inline"?(e.updateBlock(n.block,{type:"heading",props:{level:t}}),!0):!1},tL=({defaultLevel:t=1,levels:e=hk,allowToggleHeadings:n=!0}={})=>({type:"heading",propSchema:{...pe,level:{default:t,values:e},...n?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),nL=Pt(tL,({allowToggleHeadings:t=!0}={})=>({meta:{isolating:!1},parse(e){if(t&&e.tagName==="DETAILS"){let r=e.querySelector(":scope > summary");if(!r)return;let i=r.querySelector("h1, h2, h3, h4, h5, h6");return i?{...tt(i),level:parseInt(i.tagName[1]),isToggleable:!0}:void 0}let n;switch(e.tagName){case"H1":n=1;break;case"H2":n=2;break;case"H3":n=3;break;case"H4":n=4;break;case"H5":n=5;break;case"H6":n=6;break;default:return}return{...tt(e),level:n}},...t?{parseContent:({el:e,schema:n})=>{if(e.tagName==="DETAILS")return ck(e,n,"heading")}}:{},runsBefore:["toggleListItem"],render(e,n){let r=document.createElement(`h${e.props.level}`);return t?{...dk(e,n,r),contentDOM:r}:{dom:r,contentDOM:r}},toExternalHTML(e){let n=document.createElement(`h${e.props.level}`);if(di(e.props,n),t&&e.props.isToggleable){let r=document.createElement("details");r.setAttribute("open","");let i=document.createElement("summary");return i.appendChild(n),r.appendChild(i),{dom:r,contentDOM:n,childrenDOM:r}}return{dom:n,contentDOM:n}}}),({levels:t=hk}={})=>[de({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(t.map(e=>[`Mod-Alt-${e}`,eL(e)])??[]),inputRules:t.map(e=>({find:RegExp(`^(#{${e}})\\s$`),replace({match:n}){return{type:"heading",props:{level:n[1].length}}}}))})]),fk=(t,e,n,r,i)=>{let{dom:o,destroy:s}=kf(t,e,n,i),a=o;a.style.position="relative",t.props.url&&t.props.showPreview&&(t.props.previewWidth?a.style.width=`${t.props.previewWidth}px`:a.style.width="fit-content");let l=document.createElement("div");l.className="bn-resize-handle",l.style.left="4px",l.style.display="none",r.appendChild(l);let u=document.createElement("div");u.className="bn-resize-handle",u.style.right="4px",u.style.display="none",r.appendChild(u);let c=document.createElement("div");c.style.position="absolute",c.style.height="100%",c.style.width="100%";let d,h=t.props.previewWidth,f=w=>{if(!d){e.isEditable||(l.style.display="none",u.style.display="none");return}let v,O="touches"in w?w.touches[0].clientX:w.clientX;v=t.props.textAlignment==="center"?d.handleUsed==="left"?d.initialWidth+(d.initialClientX-O)*2:d.initialWidth+(O-d.initialClientX)*2:d.handleUsed==="left"?d.initialWidth+d.initialClientX-O:d.initialWidth+O-d.initialClientX,h=Math.min(Math.max(v,64),e.domElement?.firstElementChild?.clientWidth||Number.MAX_VALUE),a.style.width=`${h}px`},p=w=>{(!w.target||!a.contains(w.target)||!e.isEditable)&&(l.style.display="none",u.style.display="none"),d&&(d=void 0,a.contains(c)&&a.removeChild(c),e.updateBlock(t,{props:{previewWidth:h}}))},g=()=>{e.isEditable&&(l.style.display="",u.style.display="")},y=w=>{w.relatedTarget===l||w.relatedTarget===u||d||e.isEditable&&(l.style.display="none",u.style.display="none")},b=w=>{w.preventDefault(),a.contains(c)||a.appendChild(c);let v="touches"in w?w.touches[0].clientX:w.clientX;d={handleUsed:"left",initialWidth:a.clientWidth,initialClientX:v}},C=w=>{w.preventDefault(),a.contains(c)||a.appendChild(c);let v="touches"in w?w.touches[0].clientX:w.clientX;d={handleUsed:"right",initialWidth:a.clientWidth,initialClientX:v}};return window.addEventListener("mousemove",f),window.addEventListener("touchmove",f),window.addEventListener("mouseup",p),window.addEventListener("touchend",p),a.addEventListener("mouseenter",g),a.addEventListener("mouseleave",y),l.addEventListener("mousedown",b),l.addEventListener("touchstart",b),u.addEventListener("mousedown",C),u.addEventListener("touchstart",C),{dom:a,destroy:()=>{s?.(),window.removeEventListener("mousemove",f),window.removeEventListener("touchmove",f),window.removeEventListener("mouseup",p),window.removeEventListener("touchend",p),a.removeEventListener("mouseenter",g),a.removeEventListener("mouseleave",y),l.removeEventListener("mousedown",b),l.removeEventListener("touchstart",b),u.removeEventListener("mousedown",C),u.removeEventListener("touchstart",C)}}},pg=t=>({url:t.src||void 0,previewWidth:t.width||void 0,name:t.alt||void 0}),rL=(t={})=>({type:"image",propSchema:{textAlignment:pe.textAlignment,backgroundColor:pe.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),iL=(t={})=>e=>{if(e.tagName==="IMG"){if(e.closest("figure"))return;let{backgroundColor:n}=tt(e);return{...pg(e),backgroundColor:n}}if(e.tagName==="FIGURE"){let n=lu(e,"img");if(!n)return;let{targetElement:r,caption:i}=n,{backgroundColor:o}=tt(e);return{...pg(r),backgroundColor:o,caption:i}}},oL=(t={})=>(e,n)=>{let r=document.createElement("div");r.innerHTML=t.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>';let i=document.createElement("div");i.className="bn-visual-media-wrapper";let o=document.createElement("img");return o.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(s=>{o.src=s}):o.src=e.props.url,o.alt=e.props.name||e.props.caption||"BlockNote image",o.contentEditable="false",o.draggable=!1,i.appendChild(o),fk(e,n,{dom:i},i,r.firstElementChild)},sL=(t={})=>(e,n)=>{if(!e.props.url){let i=document.createElement("p");return i.textContent="Add image",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("img"),r.src=e.props.url,r.alt=e.props.name||e.props.caption||"BlockNote image",e.props.previewWidth&&(r.width=e.props.previewWidth)):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Tf(r,e.props.caption):uu(r,e.props.caption):{dom:r}},aL=Pt(rL,t=>({meta:{fileBlockAccept:["image/*"]},parse:iL(t),render:oL(t),toExternalHTML:sL(t),runsBefore:["file"]})),lL=(t,e,n)=>({state:r,dispatch:i})=>i?pk(r.tr,t,e,n):!0,pk=(t,e,n,r)=>{let i=jn(Tr(t.doc,e));if(!i.isBlockContainer)return!1;let o=Fe(t),s=[{type:i.bnBlock.node.type,attrs:r?{...i.bnBlock.node.attrs,id:void 0}:{}},{type:n?i.blockContent.node.type:o.nodes.paragraph,attrs:r?{...i.blockContent.node.attrs}:{}}];return t.split(e,2,s),!0},cu=(t,e)=>{let{blockInfo:n,selectionEmpty:r}=t.transact(s=>({blockInfo:Us(s),selectionEmpty:s.selection.anchor===s.selection.head}));if(!n.isBlockContainer)return!1;let{bnBlock:i,blockContent:o}=n;return o.node.type.name!==e||!r?!1:o.node.childCount===0?(t.transact(s=>{au(s,i.beforePos,{type:"paragraph",props:{}})}),!0):o.node.childCount>0?t.transact(s=>(s.deleteSelection(),pk(s,s.selection.from,!0))):!1};function Cf(t,e,n){let r=Vt.fromSchema(e),i=t,o=document.createElement("div");o.setAttribute("data-node-type","blockGroup");for(let c of Array.from(i.childNodes))o.appendChild(c.cloneNode(!0));let s=r.parse(o,{topNode:e.nodes.blockGroup.create()});s.firstChild?.firstChild?.type.name==="checkListItem"&&(s=s.copy(s.content.cut(s.firstChild.firstChild.nodeSize+2)));let a=s.firstChild?.firstChild;if(!a?.isTextblock)return M.from(s);let l=e.nodes[n].create({},a.content),u=s.content.cut(a.nodeSize+2);if(u.size>0){let c=s.copy(u);return l.content.addToEnd(c)}return l.content}var uL=()=>({type:"bulletListItem",propSchema:{...pe},content:"inline"}),cL=Pt(uL,{meta:{isolating:!1},parse(t){if(t.tagName!=="LI")return;let e=t.parentElement;if(e!==null&&(e.tagName==="UL"||e.tagName==="DIV"&&e.parentElement?.tagName==="UL"))return tt(t)},parseContent:({el:t,schema:e})=>Cf(t,e,"bulletListItem"),render(){let t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){let e=document.createElement("li"),n=document.createElement("p");return di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[de({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>cu(t,"bulletListItem"),"Mod-Shift-8":({editor:t})=>{let e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content==="inline"?(t.updateBlock(e.block,{type:"bulletListItem",props:{}}),!0):!1}},inputRules:[{find:/^\s?[-+*]\s$/,replace({editor:t}){if(Oe(t.prosemirrorState).blockNoteType!=="heading")return{type:"bulletListItem",props:{}}}}]})]),dL=()=>({type:"checkListItem",propSchema:{...pe,checked:{default:!1,type:"boolean"}},content:"inline"}),hL=Pt(dL,{meta:{isolating:!1},parse(t){if(t.tagName==="input")return t.closest("[data-content-type]")||t.closest("li")?void 0:t.type==="checkbox"?{checked:t.checked}:void 0;if(t.tagName!=="LI")return;let e=t.parentElement;if(e!==null&&(e.tagName==="UL"||e.tagName==="DIV"&&e.parentElement?.tagName==="UL")){let n=t.querySelector("input[type=checkbox]")||null;return n===null?void 0:{...tt(t),checked:n.checked}}},parseContent:({el:t,schema:e})=>Cf(t,e,"checkListItem"),render(t,e){let n=document.createDocumentFragment(),r=document.createElement("input");r.type="checkbox",r.checked=t.props.checked,t.props.checked&&r.setAttribute("checked",""),r.disabled=!e.isEditable,r.addEventListener("change",()=>{e.isEditable&&e.updateBlock(t,{props:{checked:!t.props.checked}})});let i=document.createElement("p"),o=document.createElement("div");return o.contentEditable="false",o.appendChild(r),n.appendChild(o),n.appendChild(i),{dom:n,contentDOM:i}},toExternalHTML(t){let e=document.createElement("li"),n=document.createElement("input");n.type="checkbox",n.checked=t.props.checked,t.props.checked&&n.setAttribute("checked","");let r=document.createElement("p");return di(t.props,e),e.appendChild(n),e.appendChild(r),{dom:e,contentDOM:r}},runsBefore:["bulletListItem"]},[de({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>cu(t,"checkListItem"),"Mod-Shift-9":({editor:t})=>{let e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content==="inline"?(t.updateBlock(e.block,{type:"checkListItem",props:{}}),!0):!1}},inputRules:[{find:/^\s?\[\s*\]\s$/,replace(){return{type:"checkListItem",props:{checked:!1}}}},{find:/^\s?\[[Xx]\]\s$/,replace(){return{type:"checkListItem",props:{checked:!0}}}}]})]);function fL(t,e,n,r){let i=!!t.firstChild.attrs.start,o=jn({posBeforeNode:e,node:t});if(!o.isBlockContainer)throw Error("impossible");let s=n.doc.resolve(o.bnBlock.beforePos).nodeBefore,a=s?r.get(s):void 0;if(a!==void 0){let b=a+1;return r.set(t,b),{index:b,isFirst:!1,hasStart:i}}let l=[{node:t,pos:e}],u=s,c=o.bnBlock.beforePos;for(;u&&r.get(u)===void 0;){let b=jn({posBeforeNode:c-u.nodeSize,node:u});if(b.blockNoteType!=="numberedListItem")break;l.push({node:u,pos:c-u.nodeSize});let C=n.doc.resolve(b.bnBlock.beforePos).nodeBefore;c=b.bnBlock.beforePos,u=C}let d,h,f=l[l.length-1],p=jn({posBeforeNode:f.pos,node:f.node});if(!p.isBlockContainer)throw Error("impossible");let g=n.doc.resolve(p.bnBlock.beforePos).nodeBefore,y=g?r.get(g):void 0;y===void 0?(d=(f.node.firstChild.attrs.start||1)-1,h=!0):(d=y,h=!1);for(let b=l.length-1;b>=0;b--){let C=l[b];h&&b<l.length-1&&(h=!1),d++,r.set(C.node,d)}return{index:d,isFirst:l.length===1?h||y===void 0:!1,hasStart:i}}function mg(t,e){let n=new Map,r=e.decorations.map(t.mapping,t.doc),i=t.changedRange();if(!i)return{decorations:r};let o=[],s=new Set;t.doc.nodesBetween(i.from,t.doc.nodeSize-2,(l,u,c)=>{if(c&&s.has(c))return!1;if(l.type.name==="blockContainer"&&l.firstChild.type.name==="numberedListItem"){let{index:d,isFirst:h,hasStart:f}=fL(l,u,t,n),p=t.doc.nodeAt(u+1);if(r.find(u+1,u+1+p.nodeSize,g=>g.index===d&&g.isFirst===h&&g.hasStart===f).length===0)o.push(me.node(u+1,u+1+p.nodeSize,{"data-index":d.toString()},{index:d,isFirst:h,hasStart:f}));else if(u>=i.to&&c)return s.add(c),!1}});let a=o.flatMap(l=>r.find(l.from,l.to));return{decorations:r.remove(a).add(t.doc,o)}}var pL=()=>new re({key:new he("numbered-list-indexing-decorations"),state:{init(t,e){return mg(e.tr,{decorations:le.empty})},apply(t,e){return!t.docChanged&&e.decorations?e:mg(t,e)}},props:{decorations(t){return this.getState(t)?.decorations??le.empty}}}),mL=()=>({type:"numberedListItem",propSchema:{...pe,start:{default:void 0,type:"number"}},content:"inline"}),gL=Pt(mL,{meta:{isolating:!1},parse(t){if(t.tagName!=="LI")return;let e=t.parentElement;if(e!==null&&(e.tagName==="OL"||e.tagName==="DIV"&&e.parentElement?.tagName==="OL")){let n=parseInt(e.getAttribute("start")||"1"),r=tt(t);return t.previousElementSibling||n===1?r:{...r,start:n}}},parseContent:({el:t,schema:e})=>Cf(t,e,"numberedListItem"),render(){let t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){let e=document.createElement("li"),n=document.createElement("p");return di(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[de({key:"numbered-list-item-shortcuts",inputRules:[{find:/^\s?(\d+)\.\s$/,replace({match:t,editor:e}){if(Oe(e.prosemirrorState).blockNoteType==="heading")return;let n=parseInt(t[1]);return{type:"numberedListItem",props:{start:n===1?void 0:n}}}}],keyboardShortcuts:{Enter:({editor:t})=>cu(t,"numberedListItem"),"Mod-Shift-7":({editor:t})=>{let e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content==="inline"?(t.updateBlock(e.block,{type:"numberedListItem",props:{}}),!0):!1}},prosemirrorPlugins:[pL()]})]),bL=()=>({type:"toggleListItem",propSchema:{...pe},content:"inline"}),yL=Pt(bL,{meta:{isolating:!1},parse(t){if(t.tagName==="DETAILS")return tt(t);if(t.tagName==="LI"){let e=t.parentElement;if(e&&(e.tagName==="UL"||e.tagName==="DIV"&&e.parentElement?.tagName==="UL")&&t.querySelector(":scope > details"))return tt(t)}},parseContent:({el:t,schema:e})=>{let n=t.tagName==="DETAILS"?t:t.querySelector(":scope > details");if(!n)throw Error("No details found in toggleListItem parseContent");return ck(n,e,"toggleListItem")},runsBefore:["bulletListItem"],render(t,e){let n=document.createElement("p");return{...dk(t,e,n),contentDOM:n}},toExternalHTML(t){let e=document.createElement("li"),n=document.createElement("details");n.setAttribute("open","");let r=document.createElement("summary"),i=document.createElement("p");return r.appendChild(i),n.appendChild(r),di(t.props,e),e.appendChild(n),{dom:e,contentDOM:i,childrenDOM:n}}},[de({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>cu(t,"toggleListItem"),"Mod-Shift-6":({editor:t})=>{let e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content==="inline"?(t.updateBlock(e.block,{type:"toggleListItem",props:{}}),!0):!1}}})]),EL=()=>({type:"paragraph",propSchema:pe,content:"inline"}),kL=Pt(EL,{meta:{isolating:!1},parse:t=>{if(t.tagName==="P"&&t.textContent?.trim())return tt(t)},render:()=>{let t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML:t=>{let e=document.createElement("p");return di(t.props,e),{dom:e,contentDOM:e}},runsBefore:["default","heading"]},[de({key:"paragraph-shortcuts",keyboardShortcuts:{"Mod-Alt-0":({editor:t})=>{let e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content==="inline"?(t.updateBlock(e.block,{type:"paragraph",props:{}}),!0):!1}}})]),TL=()=>({type:"quote",propSchema:{backgroundColor:pe.backgroundColor,textColor:pe.textColor},content:"inline"}),CL=Pt(TL,{meta:{isolating:!1},parse(t){if(t.tagName==="BLOCKQUOTE"){let{backgroundColor:e,textColor:n}=tt(t);return{backgroundColor:e,textColor:n}}},render(){let t=document.createElement("blockquote");return{dom:t,contentDOM:t}},toExternalHTML(t){let e=document.createElement("blockquote");return di(t.props,e),{dom:e,contentDOM:e}}},[de({key:"quote-block-shortcuts",keyboardShortcuts:{"Mod-Alt-q":({editor:t})=>{let e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content==="inline"?(t.updateBlock(e.block,{type:"quote",props:{}}),!0):!1}},inputRules:[{find:RegExp("^>\\s$"),replace(){return{type:"quote",props:{}}}},{find:RegExp("^\\p{Quotation_Mark}\\s$","u"),replace(){return{type:"quote",props:{}}}}]})]),Wz=120,Yz=31,SL=_e.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[kN({cellMinWidth:35,defaultCellMinWidth:120,View:null}),MN()],addKeyboardShortcuts(){return{Enter:()=>this.editor.state.selection.empty&&this.editor.state.selection.$head.parent.type.name==="tableParagraph"?(this.editor.commands.insertContent({type:"hardBreak"}),!0):!1,Backspace:()=>{let t=this.editor.state.selection,e=t.empty,n=t.$head.parentOffset===0,r=t.$head.node().type.name==="tableParagraph";return e&&n&&r},Tab:()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>bm(1)(t,e,n)),"Shift-Tab":()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>bm(-1)(t,e,n))}},extendNodeSchema(t){return{tableRole:be(W(t,"tableRole",{name:t.name,options:t.options,storage:t.storage}))}}}),mk={textColor:pe.textColor},xL=dn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getContent:(t,e)=>gk(t,e)}]},renderHTML({HTMLAttributes:t}){return["th",Gt(this.options.HTMLAttributes,t),0]}}),wL=dn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getContent:(t,e)=>gk(t,e)}]},renderHTML({HTMLAttributes:t}){return["td",Gt(this.options.HTMLAttributes,t),0]}}),AL=dn.create({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",marks:"deletion insertion modification",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let n=sv(this.name,"table",{...this.options.domAttributes?.blockContent||{},...e},this.options.domAttributes?.inlineContent||{}),r=document.createElement("colgroup");for(let i of t.children[0].children)if(i.attrs.colwidth)for(let o of i.attrs.colwidth){let s=document.createElement("col");o&&(s.style=`width: ${o}px`),r.appendChild(s)}else r.appendChild(document.createElement("col"));return n.dom.firstChild?.appendChild(r),n},addNodeView(){return({node:t,HTMLAttributes:e})=>{class n extends xy{constructor(i,o,s){super(i,o),this.node=i,this.cellMinWidth=o,this.blockContentHTMLAttributes=s;let a=document.createElement("div");a.className=kr("bn-block-content",s.class),a.setAttribute("data-content-type","table");for(let[d,h]of Object.entries(s))d!=="class"&&a.setAttribute(d,h);let l=this.dom,u=document.createElement("div");u.className="tableWrapper-inner",u.appendChild(l.firstChild),l.appendChild(u),a.appendChild(l);let c=document.createElement("div");c.className="table-widgets-container",c.style.position="relative",l.appendChild(c),this.dom=a}ignoreMutation(i){return!i.target.closest(".tableWrapper-inner")||super.ignoreMutation(i)}update(i){if(!super.update(i))return!1;for(let[o,s]of Object.entries(mk)){let a=As(o),l=i.attrs[o];l===s.default?this.dom.removeAttribute(a):this.dom.setAttribute(a,String(l))}return!0}}return new n(t,120,{...this.options.domAttributes?.blockContent||{},...e})}}}),_L=dn.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML(){return[{tag:"p",getAttrs:t=>{if(typeof t=="string"||!t.textContent||!t.closest("[data-content-type]"))return!1;let e=t.parentElement;return e===null?!1:e.tagName==="TD"||e.tagName==="TH"?{}:!1},node:"tableParagraph"}]},renderHTML({HTMLAttributes:t}){return["p",t,0]}}),NL=dn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Gt(this.options.HTMLAttributes,t),0]}});function gk(t,e){let n=Vt.fromSchema(e).parse(t,{topNode:e.nodes.blockGroup.create()}),r=[];return n.content.descendants(i=>{if(i.isInline)return r.push(i),!1}),M.fromArray(r)}var IL=()=>cv({node:AL,type:"table",content:"table"},mk,[de({key:"table-extensions",tiptapExtensions:[SL,_L,xL,wL,NL]}),de({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:t})=>{if(!(t.prosemirrorState.selection instanceof fe))return!1;let e=t.getTextCursorPosition().block,n=e.content,r=0;for(let o of n.rows)for(let s of o.cells){if("type"in s&&s.content.length>0||!("type"in s)&&s.length>0)return!1;r++}let i=0;return t.prosemirrorState.selection.forEachCell(()=>{i++}),i<r?!1:(t.transact(()=>{(t.getPrevBlock(e)||t.getNextBlock(e))&&t.setTextCursorPosition(e),t.removeBlocks([e])}),!0)}}})]),gg=t=>({url:t.src||void 0,previewWidth:t.width||void 0}),ML=t=>({type:"video",propSchema:{textAlignment:pe.textAlignment,backgroundColor:pe.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),OL=t=>e=>{if(e.tagName==="VIDEO"){if(e.closest("figure"))return;let{backgroundColor:n}=tt(e);return{...gg(e),backgroundColor:n}}if(e.tagName==="FIGURE"){let n=lu(e,"video");if(!n)return;let{targetElement:r,caption:i}=n,{backgroundColor:o}=tt(e);return{...gg(r),backgroundColor:o,caption:i}}},DL=Pt(ML,t=>({meta:{fileBlockAccept:["video/*"]},parse:OL(),render(e,n){let r=document.createElement("div");r.innerHTML=t.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>';let i=document.createElement("div");i.className="bn-visual-media-wrapper";let o=document.createElement("video");return o.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(s=>{o.src=s}):o.src=e.props.url,o.controls=!0,o.contentEditable="false",o.draggable=!1,o.width=e.props.previewWidth,i.appendChild(o),fk(e,n,{dom:i},i,r.firstElementChild)},toExternalHTML(e){if(!e.props.url){let r=document.createElement("p");return r.textContent="Add video",{dom:r}}let n;return e.props.showPreview?(n=document.createElement("video"),n.src=e.props.url,e.props.previewWidth&&(n.width=e.props.previewWidth)):(n=document.createElement("a"),n.href=e.props.url,n.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Tf(n,e.props.caption):uu(n,e.props.caption):{dom:n}},runsBefore:["file"]}));function Ue(t,e,n){if(!(e in t.schema.blockSpecs))return!1;if(!n)return!0;for(let[r,i]of Object.entries(n)){if(!(r in t.schema.blockSpecs[e].config.propSchema))return!1;if(typeof i=="string"){if(t.schema.blockSpecs[e].config.propSchema[r].default!==void 0&&typeof t.schema.blockSpecs[e].config.propSchema[r].default!==i||t.schema.blockSpecs[e].config.propSchema[r].type!==void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i)return!1}else{if(t.schema.blockSpecs[e].config.propSchema[r].default!==i.default||t.schema.blockSpecs[e].config.propSchema[r].default===void 0&&i.default===void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i.type||typeof t.schema.blockSpecs[e].config.propSchema[r].values!=typeof i.values)return!1;if(typeof t.schema.blockSpecs[e].config.propSchema[r].values=="object"&&typeof i.values=="object"){for(let o of i.values)if(!t.schema.blockSpecs[e].config.propSchema[r].values.includes(o))return!1}}}return!0}function Gz(t,e,n,r){return Ue(e,n,r)&&t.type===n}function bg(t){return t instanceof fe}var fa=new Map;function vL(t){if(fa.has(t))return fa.get(t);let e=new zi;return t._tiptapEditor.on("transaction",({transaction:n})=>{e.appendMapping(n.mapping)}),t._tiptapEditor.on("destroy",()=>{fa.delete(t)}),fa.set(t,e),e}function LL(t,e,n="left"){let r=xe.getState(t.prosemirrorState);if(!r){let o=vL(t),s=o.maps.length;return()=>o.slice(s).map(e,n==="left"?-1:1)}let i=Ss(e+(n==="right"?1:-1),r.binding.type,r.binding.mapping);return()=>{let o=xe.getState(t.prosemirrorState),s=Vr(o.doc,o.binding.type,i,o.binding.mapping);if(s===null)throw Error("Position not found, cannot track positions");return s+(n==="right"?-1:1)}}var RL=Vl(t=>t.type.name==="blockContainer"),PL=class{state;emitUpdate;rootEl;pluginState;constructor(e,n,r){this.editor=e,this.pluginState=void 0,this.emitUpdate=i=>{if(!this.state)throw Error("Attempting to update uninitialized suggestions menu");n(i,{...this.state,ignoreQueryLength:this.pluginState?.ignoreQueryLength})},this.rootEl=r.root,this.rootEl?.addEventListener("scroll",this.handleScroll,!0)}handleScroll=()=>{if(this.state?.show){let e=this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!e)return;this.state.referencePos=e.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}};update(e,n){let r=Br.getState(n),i=Br.getState(e.state),o=r===void 0&&i!==void 0,s=r!==void 0&&i===void 0;if(!o&&!(r!==void 0&&i!==void 0)&&!s)return;if(this.pluginState=s?r:i,s||!this.editor.isEditable){this.state&&(this.state.show=!1),this.emitUpdate(this.pluginState.triggerCharacter);return}let a=this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&a&&(this.state={show:!0,referencePos:a.getBoundingClientRect().toJSON(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){this.rootEl?.removeEventListener("scroll",this.handleScroll,!0)}closeMenu=()=>{this.editor.transact(e=>e.setMeta(Br,null))};clearQuery=()=>{this.pluginState!==void 0&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos()-(this.pluginState.deleteTriggerCharacter?this.pluginState.triggerCharacter.length:0),to:this.editor.transact(e=>e.selection.from)}).run()}},Br=new he("SuggestionMenuPlugin"),Sf=de(({editor:t})=>{let e=new Map,n,r=ai(void 0);return{key:"suggestionMenu",store:r,addSuggestionMenu:i=>{e.set(i.triggerCharacter,i)},removeSuggestionMenu:i=>{e.delete(i)},closeMenu:()=>{n?.closeMenu()},clearQuery:()=>{n?.clearQuery()},shown:()=>n?.state?.show||!1,openSuggestionMenu:(i,o)=>{t.headless||(t.focus(),t.transact(s=>{o?.deleteTriggerCharacter&&s.insertText(i),s.scrollIntoView().setMeta(Br,{triggerCharacter:i,deleteTriggerCharacter:o?.deleteTriggerCharacter||!1,ignoreQueryLength:o?.ignoreQueryLength||!1})}))},prosemirrorPlugins:[new re({key:Br,view:i=>(n=new PL(t,(o,s)=>{r.setState({...s,triggerCharacter:o})},i),n),state:{init(){},apply:(i,o,s,a)=>{if(i.selection.$from.parent.type.spec.code)return o;let l=i.getMeta(Br);if(typeof l=="object"&&l){o&&n?.closeMenu();let c=LL(t,a.selection.from-l.triggerCharacter.length);return{triggerCharacter:l.triggerCharacter,deleteTriggerCharacter:l.deleteTriggerCharacter!==!1,queryStartPos:()=>c()+l.triggerCharacter.length,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`,ignoreQueryLength:l?.ignoreQueryLength}}if(o===void 0)return o;if(a.selection.from!==a.selection.to||l===null||i.getMeta("focus")||i.getMeta("blur")||i.getMeta("pointer")||o.triggerCharacter!==void 0&&a.selection.from<o.queryStartPos()||!a.selection.$from.sameParent(a.doc.resolve(o.queryStartPos())))return;let u={...o};return u.query=a.doc.textBetween(o.queryStartPos(),a.selection.from),u}},props:{handleTextInput(i,o,s,a){if(o===s){let l=i.state.doc;for(let[u,c]of e){let d=u.length>1?l.textBetween(o-u.length,o)+a:a;if(u===d){if(c.shouldOpen&&!c.shouldOpen(i.state.tr))continue;return i.dispatch(i.state.tr.insertText(a)),i.dispatch(i.state.tr.setMeta(Br,{triggerCharacter:d}).scrollIntoView()),!0}}}return!1},decorations(i){let o=this.getState(i);if(o===void 0)return null;if(!o.deleteTriggerCharacter){let s=RL(i.selection);if(s)return le.create(i.doc,[me.node(s.pos,s.pos+s.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":o.decorationId})])}return le.create(i.doc,[me.inline(o.queryStartPos()-o.triggerCharacter.length,o.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":o.decorationId})])}}})]}});function BL(t){let e=t.getTextCursorPosition().block,n=t.schema.blockSchema[e.type].content;for(;n==="none";){if(e=t.getTextCursorPosition().nextBlock,e===void 0)return;n=t.schema.blockSchema[e.type].content,t.setTextCursorPosition(e,"end")}}function rt(t,e){let n=t.getTextCursorPosition().block;if(n.content===void 0)throw Error("Slash Menu open in a block that doesn't contain content.");let r;return Array.isArray(n.content)&&(n.content.length===1&&ri(n.content[0])&&n.content[0].type==="text"&&n.content[0].text==="/"||n.content.length===0)?(r=t.updateBlock(n,e),t.setTextCursorPosition(r)):(r=t.insertBlocks([e],n,"after")[0],t.setTextCursorPosition(t.getTextCursorPosition().nextBlock)),BL(t),r}function Qz(t){let e=[];return Ue(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{rt(t,{type:"heading",props:{level:n}})},badge:Qn(`Mod-Alt-${n}`),key:n===1?"heading":`heading_${n}`,...t.dictionary.slash_menu[n===1?"heading":`heading_${n}`]})}),Ue(t,"quote")&&e.push({onItemClick:()=>{rt(t,{type:"quote"})},key:"quote",...t.dictionary.slash_menu.quote}),Ue(t,"toggleListItem")&&e.push({onItemClick:()=>{rt(t,{type:"toggleListItem"})},badge:Qn("Mod-Shift-6"),key:"toggle_list",...t.dictionary.slash_menu.toggle_list}),Ue(t,"numberedListItem")&&e.push({onItemClick:()=>{rt(t,{type:"numberedListItem"})},badge:Qn("Mod-Shift-7"),key:"numbered_list",...t.dictionary.slash_menu.numbered_list}),Ue(t,"bulletListItem")&&e.push({onItemClick:()=>{rt(t,{type:"bulletListItem"})},badge:Qn("Mod-Shift-8"),key:"bullet_list",...t.dictionary.slash_menu.bullet_list}),Ue(t,"checkListItem")&&e.push({onItemClick:()=>{rt(t,{type:"checkListItem"})},badge:Qn("Mod-Shift-9"),key:"check_list",...t.dictionary.slash_menu.check_list}),Ue(t,"paragraph")&&e.push({onItemClick:()=>{rt(t,{type:"paragraph"})},badge:Qn("Mod-Alt-0"),key:"paragraph",...t.dictionary.slash_menu.paragraph}),Ue(t,"codeBlock")&&e.push({onItemClick:()=>{rt(t,{type:"codeBlock"})},badge:Qn("Mod-Alt-c"),key:"code_block",...t.dictionary.slash_menu.code_block}),Ue(t,"divider")&&e.push({onItemClick:()=>{rt(t,{type:"divider"})},key:"divider",...t.dictionary.slash_menu.divider}),Ue(t,"table")&&e.push({onItemClick:()=>{rt(t,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...t.dictionary.slash_menu.table}),Ue(t,"image",{url:"string"})&&e.push({onItemClick:()=>{let n=rt(t,{type:"image"});t.getExtension(dr)?.showMenu(n.id)},key:"image",...t.dictionary.slash_menu.image}),Ue(t,"video",{url:"string"})&&e.push({onItemClick:()=>{let n=rt(t,{type:"video"});t.getExtension(dr)?.showMenu(n.id)},key:"video",...t.dictionary.slash_menu.video}),Ue(t,"audio",{url:"string"})&&e.push({onItemClick:()=>{let n=rt(t,{type:"audio"});t.getExtension(dr)?.showMenu(n.id)},key:"audio",...t.dictionary.slash_menu.audio}),Ue(t,"file",{url:"string"})&&e.push({onItemClick:()=>{let n=rt(t,{type:"file"});t.getExtension(dr)?.showMenu(n.id)},key:"file",...t.dictionary.slash_menu.file}),Ue(t,"heading",{level:"number",isToggleable:"boolean"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{rt(t,{type:"heading",props:{level:n,isToggleable:!0}})},key:n===1?"toggle_heading":`toggle_heading_${n}`,...t.dictionary.slash_menu[n===1?"toggle_heading":`toggle_heading_${n}`]})}),Ue(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n>3).forEach(n=>{e.push({onItemClick:()=>{rt(t,{type:"heading",props:{level:n}})},badge:Qn(`Mod-Alt-${n}`),key:`heading_${n}`,...t.dictionary.slash_menu[`heading_${n}`]})}),e.push({onItemClick:()=>{t.getExtension(Sf)?.openSuggestionMenu(":",{deleteTriggerCharacter:!0,ignoreQueryLength:!0})},key:"emoji",...t.dictionary.slash_menu.emoji}),e}function Xz(t,e){return t.filter(({title:n,aliases:r})=>n.toLowerCase().includes(e.toLowerCase())||r&&r.filter(i=>i.toLowerCase().includes(e.toLowerCase())).length!==0)}var FL={audio:qv(),bulletListItem:cL(),checkListItem:hL(),codeBlock:Yv(),divider:Kv(),file:Jv(),heading:nL(),image:aL(),numberedListItem:gL(),paragraph:kL(),quote:CL(),table:IL(),toggleListItem:yL(),video:DL()},HL=rk({type:"textColor",propSchema:"string"},{render:()=>{let t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{let e=document.createElement("span");return t!==pe.textColor.default&&(e.style.color=t in cr?cr[t].text:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.color)return t.style.color}}),UL=rk({type:"backgroundColor",propSchema:"string"},{render:()=>{let t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{let e=document.createElement("span");return t!==pe.backgroundColor.default&&(e.style.backgroundColor=t in cr?cr[t].background:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.backgroundColor)return t.style.backgroundColor}}),bk={bold:Co(UD,"boolean"),italic:Co(QD,"boolean"),underline:Co(nv,"boolean"),strike:Co(ev,"boolean"),code:Co(qD,"boolean"),textColor:HL,backgroundColor:UL};nk(bk);var yk={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},$L=ek(yk),zL=class Ek extends Sv{static create(e){return new Ek({blockSpecs:e?.blockSpecs??FL,inlineContentSpecs:e?.inlineContentSpecs??yk,styleSpecs:e?.styleSpecs??bk})}},nc,yg;function VL(){return yg||(yg=1,nc=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}),nc}var qL=VL();const jL=sb(qL);var Cl=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length<Cl&&this.leafAppend(e)||this.length<Cl&&e.leafPrepend(this)||this.appendInner(e)):this};je.prototype.prepend=function(e){return e.length?je.from(e).append(this):this};je.prototype.appendInner=function(e){return new WL(this,e)};je.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};je.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};je.from=function(e){return e instanceof je?e:e&&e.length?new kk(e):je.empty};var kk=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Cl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Cl)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(je);je.empty=new kk([]);var WL=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(je);const YL=500;class tn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,c.push(d);return}if(i){c.push(new gn(d.map));let f=d.step.map(i.slice(o)),p;f&&s.maybeStep(f).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],u.push(new gn(p,void 0,void 0,u.length+c.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new tn(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new gn(e.mapping.maps[c],d,n),f;(f=l&&l.merge(h))&&(h=f,c?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(l=h)}let u=s-r.depth;return u>KL&&(a=GL(a,u),s-=u),new tn(a.append(o),s)}remapping(e,n){let r=new zi;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new tn(this.items.append(e.map(n=>new gn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let f=o.getMirror(--l);if(f==null)return;s=Math.min(s,f);let p=o.maps[f];if(h.step){let g=e.steps[f].invert(e.docs[f]),y=h.selection&&h.selection.map(o.slice(l+1,f));y&&a++,r.push(new gn(p,g,y))}else r.push(new gn(p))},i);let u=[];for(let h=n;h<s;h++)u.push(new gn(o.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new tn(c,a);return d.emptyItemCount()>YL&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let d=new gn(u.invert(),l,c),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else s.map&&r--},this.items.length,0),new tn(je.from(i.reverse()),o)}}tn.empty=new tn(je.empty,0);function GL(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class gn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new gn(n.getMap().invert(),n,this.selection)}}}class nr{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const KL=20;function QL(t,e,n,r){let i=n.getMeta(qr),o;if(i)return i.historyState;n.getMeta(Tk)&&(t=new nr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(qr))return s.getMeta(qr).redo?new nr(t.done.addTransform(n,void 0,r,Fa(e)),t.undone,Eg(n.mapping.maps),t.prevTime,t.prevComposition):new nr(t.done,t.undone.addTransform(n,void 0,r,Fa(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!XL(n,t.prevRanges)),u=s?rc(t.prevRanges,n.mapping):Eg(n.mapping.maps);return new nr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Fa(e)),tn.empty,u,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new nr(t.done.rebased(n,o),t.undone.rebased(n,o),rc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new nr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),rc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function XL(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function Eg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function rc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function JL(t,e,n){let r=Fa(e),i=qr.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new nr(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(qr,{redo:n,historyState:l})}let ic=!1,kg=null;function Fa(t){let e=t.plugins;if(kg!=e){ic=!1,kg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ic=!0;break}}return ic}function ZL(t){return t.setMeta(Tk,!0)}const qr=new he("history"),Tk=new he("closeHistory");function e3(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new re({key:qr,state:{init(){return new nr(tn.empty,tn.empty,null,0,-1)},apply(e,n,r){return QL(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Sk:r=="historyRedo"?xk:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Ck(t,e){return(n,r)=>{let i=qr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=JL(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const Sk=Ck(!1,!0),xk=Ck(!0,!0);class zs{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}zs.prototype.normal={};zs.prototype.property={};zs.prototype.space=void 0;function wk(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new zs(n,r,e)}function Ns(t){return t.toLowerCase()}class xt{constructor(e,n){this.attribute=n,this.property=e}}xt.prototype.attribute="";xt.prototype.booleanish=!1;xt.prototype.boolean=!1;xt.prototype.commaOrSpaceSeparated=!1;xt.prototype.commaSeparated=!1;xt.prototype.defined=!1;xt.prototype.mustUseProperty=!1;xt.prototype.number=!1;xt.prototype.overloadedBoolean=!1;xt.prototype.property="";xt.prototype.spaceSeparated=!1;xt.prototype.space=void 0;let t3=0;const J=hi(),Le=hi(),Id=hi(),F=hi(),Te=hi(),Ui=hi(),At=hi();function hi(){return 2**++t3}const Md=Object.freeze(Object.defineProperty({__proto__:null,boolean:J,booleanish:Le,commaOrSpaceSeparated:At,commaSeparated:Ui,number:F,overloadedBoolean:Id,spaceSeparated:Te},Symbol.toStringTag,{value:"Module"})),oc=Object.keys(Md);class xf extends xt{constructor(e,n,r,i){let o=-1;if(super(e,n),Tg(this,"space",i),typeof r=="number")for(;++o<oc.length;){const s=oc[o];Tg(this,oc[o],(r&Md[s])===Md[s])}}}xf.prototype.defined=!0;function Tg(t,e,n){n&&(t[e]=n)}function po(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const o=new xf(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),e[r]=o,n[Ns(r)]=r,n[Ns(o.attribute)]=r}return new zs(e,n,t.space)}const Ak=po({properties:{ariaActiveDescendant:null,ariaAtomic:Le,ariaAutoComplete:null,ariaBusy:Le,ariaChecked:Le,ariaColCount:F,ariaColIndex:F,ariaColSpan:F,ariaControls:Te,ariaCurrent:null,ariaDescribedBy:Te,ariaDetails:null,ariaDisabled:Le,ariaDropEffect:Te,ariaErrorMessage:null,ariaExpanded:Le,ariaFlowTo:Te,ariaGrabbed:Le,ariaHasPopup:null,ariaHidden:Le,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Te,ariaLevel:F,ariaLive:null,ariaModal:Le,ariaMultiLine:Le,ariaMultiSelectable:Le,ariaOrientation:null,ariaOwns:Te,ariaPlaceholder:null,ariaPosInSet:F,ariaPressed:Le,ariaReadOnly:Le,ariaRelevant:null,ariaRequired:Le,ariaRoleDescription:Te,ariaRowCount:F,ariaRowIndex:F,ariaRowSpan:F,ariaSelected:Le,ariaSetSize:F,ariaSort:null,ariaValueMax:F,ariaValueMin:F,ariaValueNow:F,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function _k(t,e){return e in t?t[e]:e}function Nk(t,e){return _k(t,e.toLowerCase())}const n3=po({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ui,acceptCharset:Te,accessKey:Te,action:null,allow:null,allowFullScreen:J,allowPaymentRequest:J,allowUserMedia:J,alt:null,as:null,async:J,autoCapitalize:null,autoComplete:Te,autoFocus:J,autoPlay:J,blocking:Te,capture:null,charSet:null,checked:J,cite:null,className:Te,cols:F,colSpan:null,content:null,contentEditable:Le,controls:J,controlsList:Te,coords:F|Ui,crossOrigin:null,data:null,dateTime:null,decoding:null,default:J,defer:J,dir:null,dirName:null,disabled:J,download:Id,draggable:Le,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:J,formTarget:null,headers:Te,height:F,hidden:Id,high:F,href:null,hrefLang:null,htmlFor:Te,httpEquiv:Te,id:null,imageSizes:null,imageSrcSet:null,inert:J,inputMode:null,integrity:null,is:null,isMap:J,itemId:null,itemProp:Te,itemRef:Te,itemScope:J,itemType:Te,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:J,low:F,manifest:null,max:null,maxLength:F,media:null,method:null,min:null,minLength:F,multiple:J,muted:J,name:null,nonce:null,noModule:J,noValidate:J,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:J,optimum:F,pattern:null,ping:Te,placeholder:null,playsInline:J,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:J,referrerPolicy:null,rel:Te,required:J,reversed:J,rows:F,rowSpan:F,sandbox:Te,scope:null,scoped:J,seamless:J,selected:J,shadowRootClonable:J,shadowRootDelegatesFocus:J,shadowRootMode:null,shape:null,size:F,sizes:null,slot:null,span:F,spellCheck:Le,src:null,srcDoc:null,srcLang:null,srcSet:null,start:F,step:null,style:null,tabIndex:F,target:null,title:null,translate:null,type:null,typeMustMatch:J,useMap:null,value:Le,width:F,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Te,axis:null,background:null,bgColor:null,border:F,borderColor:null,bottomMargin:F,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:J,declare:J,event:null,face:null,frame:null,frameBorder:null,hSpace:F,leftMargin:F,link:null,longDesc:null,lowSrc:null,marginHeight:F,marginWidth:F,noResize:J,noHref:J,noShade:J,noWrap:J,object:null,profile:null,prompt:null,rev:null,rightMargin:F,rules:null,scheme:null,scrolling:Le,standby:null,summary:null,text:null,topMargin:F,valueType:null,version:null,vAlign:null,vLink:null,vSpace:F,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:J,disableRemotePlayback:J,prefix:null,property:null,results:F,security:null,unselectable:null},space:"html",transform:Nk}),r3=po({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:At,accentHeight:F,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:F,amplitude:F,arabicForm:null,ascent:F,attributeName:null,attributeType:null,azimuth:F,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:F,by:null,calcMode:null,capHeight:F,className:Te,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:F,diffuseConstant:F,direction:null,display:null,dur:null,divisor:F,dominantBaseline:null,download:J,dx:null,dy:null,edgeMode:null,editable:null,elevation:F,enableBackground:null,end:null,event:null,exponent:F,externalResourcesRequired:null,fill:null,fillOpacity:F,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:Ui,g2:Ui,glyphName:Ui,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:F,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:F,horizOriginX:F,horizOriginY:F,id:null,ideographic:F,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:F,k:F,k1:F,k2:F,k3:F,k4:F,kernelMatrix:At,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:F,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:F,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:F,overlineThickness:F,paintOrder:null,panose1:null,path:null,pathLength:F,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Te,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:F,pointsAtY:F,pointsAtZ:F,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:At,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:At,rev:At,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:At,requiredFeatures:At,requiredFonts:At,requiredFormats:At,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:F,specularExponent:F,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:F,strikethroughThickness:F,string:null,stroke:null,strokeDashArray:At,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:F,strokeOpacity:F,strokeWidth:null,style:null,surfaceScale:F,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:At,tabIndex:F,tableValues:null,target:null,targetX:F,targetY:F,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:At,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:F,underlineThickness:F,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:F,values:null,vAlphabetic:F,vMathematical:F,vectorEffect:null,vHanging:F,vIdeographic:F,version:null,vertAdvY:F,vertOriginX:F,vertOriginY:F,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:F,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_k}),Ik=po({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),Mk=po({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Nk}),Ok=po({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),i3=/[A-Z]/g,Cg=/-[a-z]/g,o3=/^data[-\w.:]+$/i;function wf(t,e){const n=Ns(e);let r=e,i=xt;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&o3.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Cg,a3);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Cg.test(o)){let s=o.replace(i3,s3);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=xf}return new i(r,e)}function s3(t){return"-"+t.toLowerCase()}function a3(t){return t.charAt(1).toUpperCase()}const du=wk([Ak,n3,Ik,Mk,Ok],"html"),Vs=wk([Ak,r3,Ik,Mk,Ok],"svg");function Sg(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,o=!1;for(;!o;){r===-1&&(r=n.length,o=!0);const s=n.slice(i,r).trim();(s||!o)&&e.push(s),i=r+1,r=n.indexOf(",",i)}return e}function l3(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const xg=/[#.]/g;function u3(t,e){const n=t||"",r={};let i=0,o,s;for(;i<n.length;){xg.lastIndex=i;const a=xg.exec(n),l=n.slice(i,a?a.index:n.length);l&&(o?o==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:s=l,i+=l.length),a&&(o=a[0],i++)}return{type:"element",tagName:s||e||"div",properties:r,children:[]}}function wg(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function c3(t){return t.join(" ").trim()}function Dk(t,e,n){const r=n?p3(n):void 0;function i(o,s,...a){let l;if(o==null){l={type:"root",children:[]};const u=s;a.unshift(u)}else{l=u3(o,e);const u=l.tagName.toLowerCase(),c=r?r.get(u):void 0;if(l.tagName=c||u,d3(s))a.unshift(s);else for(const[d,h]of Object.entries(s))h3(t,l.properties,d,h)}for(const u of a)Od(l.children,u);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function d3(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const o=i;for(const s of o)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function h3(t,e,n,r){const i=wf(t,n);let o;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;o=r}else typeof r=="boolean"?o=r:typeof r=="string"?i.spaceSeparated?o=wg(r):i.commaSeparated?o=Sg(r):i.commaOrSpaceSeparated?o=wg(Sg(r).join(" ")):o=Ag(i,i.property,r):Array.isArray(r)?o=[...r]:o=i.property==="style"?f3(r):String(r);if(Array.isArray(o)){const s=[];for(const a of o)s.push(Ag(i,i.property,a));o=s}i.property==="className"&&Array.isArray(e.className)&&(o=e.className.concat(o)),e[i.property]=o}}function Od(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Od(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Od(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function Ag(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Ns(n)===Ns(e)))return!0}return n}function f3(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function p3(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const m3=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],vk=Dk(du,"div"),Lk=Dk(Vs,"g",m3);function g3(t){const e=String(t),n=[];return{toOffset:i,toPoint:r};function r(o){if(typeof o=="number"&&o>-1&&o<=e.length){let s=0;for(;;){let a=n[s];if(a===void 0){const l=_g(e,n[s-1]);a=l===-1?e.length+1:l+1,n[s]=a}if(a>o)return{line:s+1,column:o-(s>0?n[s-1]:0)+1,offset:o};s++}}}function i(o){if(o&&typeof o.line=="number"&&typeof o.column=="number"&&!Number.isNaN(o.line)&&!Number.isNaN(o.column)){for(;n.length<o.line;){const a=n[n.length-1],l=_g(e,a),u=l===-1?e.length+1:l+1;if(a===u)break;n.push(u)}const s=(o.line>1?n[o.line-2]:0)+o.column-1;if(s<n[o.line-1])return s}}}function _g(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
116
+ `,e);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Ha={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"},Rk={}.hasOwnProperty,b3=Object.prototype;function y3(t,e){const n=e||{};return Af({file:n.file||void 0,location:!1,schema:n.space==="svg"?Vs:du,verbose:n.verbose||!1},t)}function Af(t,e){let n;switch(e.nodeName){case"#comment":{const r=e;return n={type:"comment",value:r.data},Ua(t,r,n),n}case"#document":case"#document-fragment":{const r=e,i="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:Pk(t,e.childNodes),data:{quirksMode:i}},t.file&&t.location){const o=String(t.file),s=g3(o),a=s.toPoint(0),l=s.toPoint(o.length);n.position={start:a,end:l}}return n}case"#documentType":{const r=e;return n={type:"doctype"},Ua(t,r,n),n}case"#text":{const r=e;return n={type:"text",value:r.value},Ua(t,r,n),n}default:return n=E3(t,e),n}}function Pk(t,e){let n=-1;const r=[];for(;++n<e.length;){const i=Af(t,e[n]);r.push(i)}return r}function E3(t,e){const n=t.schema;t.schema=e.namespaceURI===Ha.svg?Vs:du;let r=-1;const i={};for(;++r<e.attrs.length;){const a=e.attrs[r],l=(a.prefix?a.prefix+":":"")+a.name;Rk.call(b3,l)||(i[l]=a.value)}const s=(t.schema.space==="svg"?Lk:vk)(e.tagName,i,Pk(t,e.childNodes));if(Ua(t,e,s),s.tagName==="template"){const a=e,l=a.sourceCodeLocation,u=l&&l.startTag&&Ii(l.startTag),c=l&&l.endTag&&Ii(l.endTag),d=Af(t,a.content);u&&c&&t.file&&(d.position={start:u.end,end:c.start}),s.content=d}return t.schema=n,s}function Ua(t,e,n){if("sourceCodeLocation"in e&&e.sourceCodeLocation&&t.file){const r=k3(t,n,e.sourceCodeLocation);r&&(t.location=!0,n.position=r)}}function k3(t,e,n){const r=Ii(n);if(e.type==="element"){const i=e.children[e.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),t.verbose){const o={};let s;if(n.attrs)for(s in n.attrs)Rk.call(n.attrs,s)&&(o[wf(t.schema,s).property]=Ii(n.attrs[s]));n.startTag;const a=Ii(n.startTag),l=n.endTag?Ii(n.endTag):void 0,u={opening:a};l&&(u.closing=l),u.properties=o,e.data={position:u}}}return r}function Ii(t){const e=Ng({line:t.startLine,column:t.startCol,offset:t.startOffset}),n=Ng({line:t.endLine,column:t.endCol,offset:t.endOffset});return e||n?{start:e,end:n}:void 0}function Ng(t){return t.line&&t.column?t:void 0}const T3=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),we="�";var E;(function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(E||(E={}));const yt={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function Bk(t){return t>=55296&&t<=57343}function C3(t){return t>=56320&&t<=57343}function S3(t,e){return(t-55296)*1024+9216+e}function Fk(t){return t!==32&&t!==10&&t!==13&&t!==9&&t!==12&&t>=1&&t<=31||t>=127&&t<=159}function Hk(t){return t>=64976&&t<=65007||T3.has(t)}var I;(function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(I||(I={}));const x3=65536;class w3{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=x3,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,n){const{line:r,col:i,offset:o}=this,s=i+n,a=o+n;return{code:e,startLine:r,endLine:r,startCol:s,endCol:s,startOffset:a,endOffset:a}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(C3(n))return this.pos++,this._addGap(),S3(e,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,E.EOF;return this._err(I.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,n){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,n){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const n=this.pos+e;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,E.EOF;const r=this.html.charCodeAt(n);return r===E.CARRIAGE_RETURN?E.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,E.EOF;let e=this.html.charCodeAt(this.pos);return e===E.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,E.LINE_FEED):e===E.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Bk(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===E.LINE_FEED||e===E.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){Fk(e)?this._err(I.controlCharacterInInputStream):Hk(e)&&this._err(I.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var ce;(function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"})(ce||(ce={}));function Uk(t,e){for(let n=t.attrs.length-1;n>=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}const A3=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),_3=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function N3(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=_3.get(t))!==null&&e!==void 0?e:t}var Ve;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Ve||(Ve={}));const I3=32;var hr;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(hr||(hr={}));function Dd(t){return t>=Ve.ZERO&&t<=Ve.NINE}function M3(t){return t>=Ve.UPPER_A&&t<=Ve.UPPER_F||t>=Ve.LOWER_A&&t<=Ve.LOWER_F}function O3(t){return t>=Ve.UPPER_A&&t<=Ve.UPPER_Z||t>=Ve.LOWER_A&&t<=Ve.LOWER_Z||Dd(t)}function D3(t){return t===Ve.EQUALS||O3(t)}var $e;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})($e||($e={}));var Bn;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Bn||(Bn={}));class v3{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=$e.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Bn.Strict}startEntity(e){this.decodeMode=e,this.state=$e.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case $e.EntityStart:return e.charCodeAt(n)===Ve.NUM?(this.state=$e.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=$e.NamedEntity,this.stateNamedEntity(e,n));case $e.NumericStart:return this.stateNumericStart(e,n);case $e.NumericDecimal:return this.stateNumericDecimal(e,n);case $e.NumericHex:return this.stateNumericHex(e,n);case $e.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|I3)===Ve.LOWER_X?(this.state=$e.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=$e.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const o=r-n;this.result=this.result*Math.pow(i,o)+Number.parseInt(e.substr(n,o),i),this.consumed+=o}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Dd(i)||M3(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Dd(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Ve.SEMI)this.consumed+=1;else if(this.decodeMode===Bn.Strict)return 0;return this.emitCodePoint(N3(this.result),this.consumed),this.errors&&(e!==Ve.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],o=(i&hr.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const s=e.charCodeAt(n);if(this.treeIndex=L3(r,i,this.treeIndex+Math.max(1,o),s),this.treeIndex<0)return this.result===0||this.decodeMode===Bn.Attribute&&(o===0||D3(s))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],o=(i&hr.VALUE_LENGTH)>>14,o!==0){if(s===Ve.SEMI)return this.emitNamedEntityData(this.treeIndex,o,this.consumed+this.excess);this.decodeMode!==Bn.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&hr.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~hr.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case $e.NamedEntity:return this.result!==0&&(this.decodeMode!==Bn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case $e.NumericDecimal:return this.emitNumericEntity(0,2);case $e.NumericHex:return this.emitNumericEntity(0,3);case $e.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case $e.EntityStart:return 0}}}function L3(t,e,n,r){const i=(e&hr.BRANCH_LENGTH)>>7,o=e&hr.JUMP_TABLE;if(i===0)return o!==0&&r===o?n:-1;if(o){const l=r-o;return l<0||l>=i?-1:t[n+l]-1}let s=n,a=s+i-1;for(;s<=a;){const l=s+a>>>1,u=t[l];if(u<r)s=l+1;else if(u>r)a=l-1;else return t[l+i]}return-1}var L;(function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"})(L||(L={}));var jr;(function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"})(jr||(jr={}));var Ft;(function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"})(Ft||(Ft={}));var A;(function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"})(A||(A={}));var m;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"})(m||(m={}));const R3=new Map([[A.A,m.A],[A.ADDRESS,m.ADDRESS],[A.ANNOTATION_XML,m.ANNOTATION_XML],[A.APPLET,m.APPLET],[A.AREA,m.AREA],[A.ARTICLE,m.ARTICLE],[A.ASIDE,m.ASIDE],[A.B,m.B],[A.BASE,m.BASE],[A.BASEFONT,m.BASEFONT],[A.BGSOUND,m.BGSOUND],[A.BIG,m.BIG],[A.BLOCKQUOTE,m.BLOCKQUOTE],[A.BODY,m.BODY],[A.BR,m.BR],[A.BUTTON,m.BUTTON],[A.CAPTION,m.CAPTION],[A.CENTER,m.CENTER],[A.CODE,m.CODE],[A.COL,m.COL],[A.COLGROUP,m.COLGROUP],[A.DD,m.DD],[A.DESC,m.DESC],[A.DETAILS,m.DETAILS],[A.DIALOG,m.DIALOG],[A.DIR,m.DIR],[A.DIV,m.DIV],[A.DL,m.DL],[A.DT,m.DT],[A.EM,m.EM],[A.EMBED,m.EMBED],[A.FIELDSET,m.FIELDSET],[A.FIGCAPTION,m.FIGCAPTION],[A.FIGURE,m.FIGURE],[A.FONT,m.FONT],[A.FOOTER,m.FOOTER],[A.FOREIGN_OBJECT,m.FOREIGN_OBJECT],[A.FORM,m.FORM],[A.FRAME,m.FRAME],[A.FRAMESET,m.FRAMESET],[A.H1,m.H1],[A.H2,m.H2],[A.H3,m.H3],[A.H4,m.H4],[A.H5,m.H5],[A.H6,m.H6],[A.HEAD,m.HEAD],[A.HEADER,m.HEADER],[A.HGROUP,m.HGROUP],[A.HR,m.HR],[A.HTML,m.HTML],[A.I,m.I],[A.IMG,m.IMG],[A.IMAGE,m.IMAGE],[A.INPUT,m.INPUT],[A.IFRAME,m.IFRAME],[A.KEYGEN,m.KEYGEN],[A.LABEL,m.LABEL],[A.LI,m.LI],[A.LINK,m.LINK],[A.LISTING,m.LISTING],[A.MAIN,m.MAIN],[A.MALIGNMARK,m.MALIGNMARK],[A.MARQUEE,m.MARQUEE],[A.MATH,m.MATH],[A.MENU,m.MENU],[A.META,m.META],[A.MGLYPH,m.MGLYPH],[A.MI,m.MI],[A.MO,m.MO],[A.MN,m.MN],[A.MS,m.MS],[A.MTEXT,m.MTEXT],[A.NAV,m.NAV],[A.NOBR,m.NOBR],[A.NOFRAMES,m.NOFRAMES],[A.NOEMBED,m.NOEMBED],[A.NOSCRIPT,m.NOSCRIPT],[A.OBJECT,m.OBJECT],[A.OL,m.OL],[A.OPTGROUP,m.OPTGROUP],[A.OPTION,m.OPTION],[A.P,m.P],[A.PARAM,m.PARAM],[A.PLAINTEXT,m.PLAINTEXT],[A.PRE,m.PRE],[A.RB,m.RB],[A.RP,m.RP],[A.RT,m.RT],[A.RTC,m.RTC],[A.RUBY,m.RUBY],[A.S,m.S],[A.SCRIPT,m.SCRIPT],[A.SEARCH,m.SEARCH],[A.SECTION,m.SECTION],[A.SELECT,m.SELECT],[A.SOURCE,m.SOURCE],[A.SMALL,m.SMALL],[A.SPAN,m.SPAN],[A.STRIKE,m.STRIKE],[A.STRONG,m.STRONG],[A.STYLE,m.STYLE],[A.SUB,m.SUB],[A.SUMMARY,m.SUMMARY],[A.SUP,m.SUP],[A.TABLE,m.TABLE],[A.TBODY,m.TBODY],[A.TEMPLATE,m.TEMPLATE],[A.TEXTAREA,m.TEXTAREA],[A.TFOOT,m.TFOOT],[A.TD,m.TD],[A.TH,m.TH],[A.THEAD,m.THEAD],[A.TITLE,m.TITLE],[A.TR,m.TR],[A.TRACK,m.TRACK],[A.TT,m.TT],[A.U,m.U],[A.UL,m.UL],[A.SVG,m.SVG],[A.VAR,m.VAR],[A.WBR,m.WBR],[A.XMP,m.XMP]]);function hu(t){var e;return(e=R3.get(t))!==null&&e!==void 0?e:m.UNKNOWN}const P=m,P3={[L.HTML]:new Set([P.ADDRESS,P.APPLET,P.AREA,P.ARTICLE,P.ASIDE,P.BASE,P.BASEFONT,P.BGSOUND,P.BLOCKQUOTE,P.BODY,P.BR,P.BUTTON,P.CAPTION,P.CENTER,P.COL,P.COLGROUP,P.DD,P.DETAILS,P.DIR,P.DIV,P.DL,P.DT,P.EMBED,P.FIELDSET,P.FIGCAPTION,P.FIGURE,P.FOOTER,P.FORM,P.FRAME,P.FRAMESET,P.H1,P.H2,P.H3,P.H4,P.H5,P.H6,P.HEAD,P.HEADER,P.HGROUP,P.HR,P.HTML,P.IFRAME,P.IMG,P.INPUT,P.LI,P.LINK,P.LISTING,P.MAIN,P.MARQUEE,P.MENU,P.META,P.NAV,P.NOEMBED,P.NOFRAMES,P.NOSCRIPT,P.OBJECT,P.OL,P.P,P.PARAM,P.PLAINTEXT,P.PRE,P.SCRIPT,P.SECTION,P.SELECT,P.SOURCE,P.STYLE,P.SUMMARY,P.TABLE,P.TBODY,P.TD,P.TEMPLATE,P.TEXTAREA,P.TFOOT,P.TH,P.THEAD,P.TITLE,P.TR,P.TRACK,P.UL,P.WBR,P.XMP]),[L.MATHML]:new Set([P.MI,P.MO,P.MN,P.MS,P.MTEXT,P.ANNOTATION_XML]),[L.SVG]:new Set([P.TITLE,P.FOREIGN_OBJECT,P.DESC]),[L.XLINK]:new Set,[L.XML]:new Set,[L.XMLNS]:new Set},vd=new Set([P.H1,P.H2,P.H3,P.H4,P.H5,P.H6]);A.STYLE,A.SCRIPT,A.XMP,A.IFRAME,A.NOEMBED,A.NOFRAMES,A.PLAINTEXT;var k;(function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(k||(k={}));const Tt={DATA:k.DATA,RCDATA:k.RCDATA,RAWTEXT:k.RAWTEXT,SCRIPT_DATA:k.SCRIPT_DATA,PLAINTEXT:k.PLAINTEXT,CDATA_SECTION:k.CDATA_SECTION};function B3(t){return t>=E.DIGIT_0&&t<=E.DIGIT_9}function Lo(t){return t>=E.LATIN_CAPITAL_A&&t<=E.LATIN_CAPITAL_Z}function F3(t){return t>=E.LATIN_SMALL_A&&t<=E.LATIN_SMALL_Z}function Zn(t){return F3(t)||Lo(t)}function Ig(t){return Zn(t)||B3(t)}function pa(t){return t+32}function $k(t){return t===E.SPACE||t===E.LINE_FEED||t===E.TABULATION||t===E.FORM_FEED}function Mg(t){return $k(t)||t===E.SOLIDUS||t===E.GREATER_THAN_SIGN}function H3(t){return t===E.NULL?I.nullCharacterReference:t>1114111?I.characterReferenceOutsideUnicodeRange:Bk(t)?I.surrogateCharacterReference:Hk(t)?I.noncharacterCharacterReference:Fk(t)||t===E.CARRIAGE_RETURN?I.controlCharacterReference:null}class U3{constructor(e,n){this.options=e,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=k.DATA,this.returnState=k.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new w3(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new v3(A3,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(I.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(I.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=H3(r);i&&this._err(i,1)}}:void 0)}_err(e,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(e,n))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,n,r){this.active=!0,this.preprocessor.write(e,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let n=0;n<e;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,n){return this.preprocessor.startsWith(e,n)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:ce.START_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:ce.END_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:ce.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:ce.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,n){this.currentCharacterToken={type:e,chars:n,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,n;const r=this.currentToken;if(Uk(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const i=(e=(n=r.location).attrs)!==null&&e!==void 0?e:n.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(I.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=hu(e.tagName),e.type===ce.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(I.endTagWithAttributes),e.selfClosing&&this._err(I.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case ce.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case ce.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case ce.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:ce.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,n)}_emitCodePoint(e){const n=$k(e)?ce.WHITESPACE_CHARACTER:e===E.NULL?ce.NULL_CHARACTER:ce.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(ce.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=k.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Bn.Attribute:Bn.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===k.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case k.DATA:{this._stateData(e);break}case k.RCDATA:{this._stateRcdata(e);break}case k.RAWTEXT:{this._stateRawtext(e);break}case k.SCRIPT_DATA:{this._stateScriptData(e);break}case k.PLAINTEXT:{this._statePlaintext(e);break}case k.TAG_OPEN:{this._stateTagOpen(e);break}case k.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case k.TAG_NAME:{this._stateTagName(e);break}case k.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case k.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case k.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case k.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case k.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case k.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case k.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case k.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case k.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case k.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case k.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case k.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case k.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case k.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case k.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case k.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case k.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case k.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case k.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case k.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case k.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case k.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case k.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case k.BOGUS_COMMENT:{this._stateBogusComment(e);break}case k.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case k.COMMENT_START:{this._stateCommentStart(e);break}case k.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case k.COMMENT:{this._stateComment(e);break}case k.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case k.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case k.COMMENT_END:{this._stateCommentEnd(e);break}case k.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case k.DOCTYPE:{this._stateDoctype(e);break}case k.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case k.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case k.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case k.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case k.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case k.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case k.CDATA_SECTION:{this._stateCdataSection(e);break}case k.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case k.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case k.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case k.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.TAG_OPEN;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(I.unexpectedNullCharacter),this._emitCodePoint(e);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case E.AMPERSAND:{this._startCharacterReference();break}case E.LESS_THAN_SIGN:{this.state=k.RCDATA_LESS_THAN_SIGN;break}case E.NULL:{this._err(I.unexpectedNullCharacter),this._emitChars(we);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.RAWTEXT_LESS_THAN_SIGN;break}case E.NULL:{this._err(I.unexpectedNullCharacter),this._emitChars(we);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_LESS_THAN_SIGN;break}case E.NULL:{this._err(I.unexpectedNullCharacter),this._emitChars(we);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case E.NULL:{this._err(I.unexpectedNullCharacter),this._emitChars(we);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Zn(e))this._createStartTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case E.EXCLAMATION_MARK:{this.state=k.MARKUP_DECLARATION_OPEN;break}case E.SOLIDUS:{this.state=k.END_TAG_OPEN;break}case E.QUESTION_MARK:{this._err(I.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e);break}case E.EOF:{this._err(I.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(I.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=k.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Zn(e))this._createEndTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case E.GREATER_THAN_SIGN:{this._err(I.missingEndTagName),this.state=k.DATA;break}case E.EOF:{this._err(I.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(I.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.tagName+=we;break}case E.EOF:{this._err(I.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(Lo(e)?pa(e):e)}}_stateRcdataLessThanSign(e){e===E.SOLIDUS?this.state=k.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Zn(e)?(this.state=k.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=k.BEFORE_ATTRIBUTE_NAME,!1;case E.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=k.SELF_CLOSING_START_TAG,!1;case E.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=k.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===E.SOLIDUS?this.state=k.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Zn(e)?(this.state=k.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case E.SOLIDUS:{this.state=k.SCRIPT_DATA_END_TAG_OPEN;break}case E.EXCLAMATION_MARK:{this.state=k.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=k.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Zn(e)?(this.state=k.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===E.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===E.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.NULL:{this._err(I.unexpectedNullCharacter),this._emitChars(we);break}case E.EOF:{this._err(I.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(we);break}case E.EOF:{this._err(I.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case E.HYPHEN_MINUS:{this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(we);break}case E.EOF:{this._err(I.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===E.SOLIDUS?this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Zn(e)?(this._emitChars("<"),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Zn(e)?(this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(yt.SCRIPT,!1)&&Mg(this.preprocessor.peek(yt.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<yt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.NULL:{this._err(I.unexpectedNullCharacter),this._emitChars(we);break}case E.EOF:{this._err(I.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(we);break}case E.EOF:{this._err(I.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case E.HYPHEN_MINUS:{this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(we);break}case E.EOF:{this._err(I.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===E.SOLIDUS?(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(yt.SCRIPT,!1)&&Mg(this.preprocessor.peek(yt.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<yt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.SOLIDUS:case E.GREATER_THAN_SIGN:case E.EOF:{this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case E.EQUALS_SIGN:{this._err(I.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=k.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:case E.SOLIDUS:case E.GREATER_THAN_SIGN:case E.EOF:{this._leaveAttrName(),this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case E.EQUALS_SIGN:{this._leaveAttrName(),this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case E.QUOTATION_MARK:case E.APOSTROPHE:case E.LESS_THAN_SIGN:{this._err(I.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.currentAttr.name+=we;break}default:this.currentAttr.name+=String.fromCodePoint(Lo(e)?pa(e):e)}}_stateAfterAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case E.EQUALS_SIGN:{this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(I.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{this.state=k.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this.state=k.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(I.missingAttributeValue),this.state=k.DATA,this.emitCurrentTagToken();break}default:this.state=k.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.currentAttr.value+=we;break}case E.EOF:{this._err(I.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case E.APOSTROPHE:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.currentAttr.value+=we;break}case E.EOF:{this._err(I.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case E.NULL:{this._err(I.unexpectedNullCharacter),this.currentAttr.value+=we;break}case E.QUOTATION_MARK:case E.APOSTROPHE:case E.LESS_THAN_SIGN:case E.EQUALS_SIGN:case E.GRAVE_ACCENT:{this._err(I.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case E.EOF:{this._err(I.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.SOLIDUS:{this._leaveAttrValue(),this.state=k.SELF_CLOSING_START_TAG;break}case E.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(I.eofInTag),this._emitEOFToken();break}default:this._err(I.missingWhitespaceBetweenAttributes),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case E.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(I.eofInTag),this._emitEOFToken();break}default:this._err(I.unexpectedSolidusInTag),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.data+=we;break}default:n.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(yt.DASH_DASH,!0)?(this._createCommentToken(yt.DASH_DASH.length+1),this.state=k.COMMENT_START):this._consumeSequenceIfMatch(yt.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(yt.DOCTYPE.length+1),this.state=k.DOCTYPE):this._consumeSequenceIfMatch(yt.CDATA_START,!0)?this.inForeignNode?this.state=k.CDATA_SECTION:(this._err(I.cdataInHtmlContent),this._createCommentToken(yt.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=k.BOGUS_COMMENT):this._ensureHibernation()||(this._err(I.incorrectlyOpenedComment),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_START_DASH;break}case E.GREATER_THAN_SIGN:{this._err(I.abruptClosingOfEmptyComment),this.state=k.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case E.GREATER_THAN_SIGN:{this._err(I.abruptClosingOfEmptyComment),this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this._err(I.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateComment(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END_DASH;break}case E.LESS_THAN_SIGN:{n.data+="<",this.state=k.COMMENT_LESS_THAN_SIGN;break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.data+=we;break}case E.EOF:{this._err(I.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const n=this.currentToken;switch(e){case E.EXCLAMATION_MARK:{n.data+="!",this.state=k.COMMENT_LESS_THAN_SIGN_BANG;break}case E.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===E.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=k.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===E.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=k.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==E.GREATER_THAN_SIGN&&e!==E.EOF&&this._err(I.nestedComment),this.state=k.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case E.EOF:{this._err(I.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case E.EXCLAMATION_MARK:{this.state=k.COMMENT_END_BANG;break}case E.HYPHEN_MINUS:{n.data+="-";break}case E.EOF:{this._err(I.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{n.data+="--!",this.state=k.COMMENT_END_DASH;break}case E.GREATER_THAN_SIGN:{this._err(I.incorrectlyClosedComment),this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this._err(I.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=k.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case E.EOF:{this._err(I.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.missingWhitespaceBeforeDoctypeName),this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Lo(e))this._createDoctypeToken(String.fromCharCode(pa(e))),this.state=k.DOCTYPE_NAME;else switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.NULL:{this._err(I.unexpectedNullCharacter),this._createDoctypeToken(we),this.state=k.DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this._err(I.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(I.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=k.DOCTYPE_NAME}}_stateDoctypeName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.AFTER_DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.name+=we;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(Lo(e)?pa(e):e)}}_stateAfterDoctypeName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(yt.PUBLIC,!1)?this.state=k.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(yt.SYSTEM,!1)?this.state=k.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(I.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.QUOTATION_MARK:{this._err(I.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(I.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(I.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(I.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.publicId+=we;break}case E.GREATER_THAN_SIGN:{this._err(I.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case E.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.publicId+=we;break}case E.GREATER_THAN_SIGN:{this._err(I.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.QUOTATION_MARK:{this._err(I.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(I.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.QUOTATION_MARK:{this._err(I.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(I.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(I.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(I.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.systemId+=we;break}case E.GREATER_THAN_SIGN:{this._err(I.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case E.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.NULL:{this._err(I.unexpectedNullCharacter),n.systemId+=we;break}case E.GREATER_THAN_SIGN:{this._err(I.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(I.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(I.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.NULL:{this._err(I.unexpectedNullCharacter);break}case E.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case E.RIGHT_SQUARE_BRACKET:{this.state=k.CDATA_SECTION_BRACKET;break}case E.EOF:{this._err(I.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===E.RIGHT_SQUARE_BRACKET?this.state=k.CDATA_SECTION_END:(this._emitChars("]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA;break}case E.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(E.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Ig(this.preprocessor.peek(1))?k.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Ig(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===E.SEMICOLON&&this._err(I.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}const zk=new Set([m.DD,m.DT,m.LI,m.OPTGROUP,m.OPTION,m.P,m.RB,m.RP,m.RT,m.RTC]),Og=new Set([...zk,m.CAPTION,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]),Sl=new Set([m.APPLET,m.CAPTION,m.HTML,m.MARQUEE,m.OBJECT,m.TABLE,m.TD,m.TEMPLATE,m.TH]),$3=new Set([...Sl,m.OL,m.UL]),z3=new Set([...Sl,m.BUTTON]),Dg=new Set([m.ANNOTATION_XML,m.MI,m.MN,m.MO,m.MS,m.MTEXT]),vg=new Set([m.DESC,m.FOREIGN_OBJECT,m.TITLE]),V3=new Set([m.TR,m.TEMPLATE,m.HTML]),q3=new Set([m.TBODY,m.TFOOT,m.THEAD,m.TEMPLATE,m.HTML]),j3=new Set([m.TABLE,m.TEMPLATE,m.HTML]),W3=new Set([m.TD,m.TH]);class Y3{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=m.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===m.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===L.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,n){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,n,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,n){const r=this._indexOf(e);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(e,n,r){const i=this._indexOf(e)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(e){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(e,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==L.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(e){for(;this.stackTop>=e;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<e)}}popUntilElementPopped(e){const n=this._indexOf(e);this.shortenToLength(Math.max(n,0))}popUntilPopped(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(vd,L.HTML)}popUntilTableCellPopped(){this.popUntilPopped(W3,L.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,n){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(j3,L.HTML)}clearBackToTableBodyContext(){this.clearBackTo(q3,L.HTML)}clearBackToTableRowContext(){this.clearBackTo(V3,L.HTML)}remove(e){const n=this._indexOf(e);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===m.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const n=this._indexOf(e)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===m.HTML}hasInDynamicScope(e,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case L.HTML:{if(i===e)return!0;if(n.has(i))return!1;break}case L.SVG:{if(vg.has(i))return!1;break}case L.MATHML:{if(Dg.has(i))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Sl)}hasInListItemScope(e){return this.hasInDynamicScope(e,$3)}hasInButtonScope(e){return this.hasInDynamicScope(e,z3)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const n=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case L.HTML:{if(vd.has(n))return!0;if(Sl.has(n))return!1;break}case L.SVG:{if(vg.has(n))return!1;break}case L.MATHML:{if(Dg.has(n))return!1;break}}}return!0}hasInTableScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===L.HTML)switch(this.tagIDs[n]){case e:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===L.HTML)switch(this.tagIDs[e]){case m.TBODY:case m.THEAD:case m.TFOOT:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasInSelectScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===L.HTML)switch(this.tagIDs[n]){case e:return!0;case m.OPTION:case m.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&zk.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Og.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Og.has(this.currentTagId);)this.pop()}}const sc=3;var yn;(function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"})(yn||(yn={}));const Lg={type:yn.Marker};class G3{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,n){const r=[],i=n.length,o=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e);for(let a=0;a<this.entries.length;a++){const l=this.entries[a];if(l.type===yn.Marker)break;const{element:u}=l;if(this.treeAdapter.getTagName(u)===o&&this.treeAdapter.getNamespaceURI(u)===s){const c=this.treeAdapter.getAttrList(u);c.length===i&&r.push({idx:a,attrs:c})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<sc)return;const n=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,n);if(r.length<sc)return;const i=new Map(n.map(s=>[s.name,s.value]));let o=0;for(let s=0;s<r.length;s++){const a=r[s];a.attrs.every(l=>i.get(l.name)===l.value)&&(o+=1,o>=sc&&this.entries.splice(a.idx,1))}}insertMarker(){this.entries.unshift(Lg)}pushElement(e,n){this._ensureNoahArkCondition(e),this.entries.unshift({type:yn.Element,element:e,token:n})}insertElementAfterBookmark(e,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:yn.Element,element:e,token:n})}removeEntry(e){const n=this.entries.indexOf(e);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const e=this.entries.indexOf(Lg);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const n=this.entries.find(r=>r.type===yn.Marker||this.treeAdapter.getTagName(r.element)===e);return n&&n.type===yn.Element?n:null}getElementEntry(e){return this.entries.find(n=>n.type===yn.Element&&n.element===e)}}const er={createDocument(){return{nodeName:"#document",mode:Ft.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(t,e,n){return{nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(t){return{nodeName:"#comment",data:t,parentNode:null}},createTextNode(t){return{nodeName:"#text",value:t,parentNode:null}},appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){const r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent(t){return t.content},setDocumentType(t,e,n,r){const i=t.childNodes.find(o=>o.nodeName==="#documentType");if(i)i.name=e,i.publicId=n,i.systemId=r;else{const o={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};er.appendChild(t,o)}},setDocumentMode(t,e){t.mode=e},getDocumentMode(t){return t.mode},detachNode(t){if(t.parentNode){const e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){const n=t.childNodes[t.childNodes.length-1];if(er.isTextNode(n)){n.value+=e;return}}er.appendChild(t,er.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&er.isTextNode(r)?r.value+=e:er.insertBefore(t,er.createTextNode(e),n)},adoptAttributes(t,e){const n=new Set(t.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)n.has(e[r].name)||t.attrs.push(e[r])},getFirstChild(t){return t.childNodes[0]},getChildNodes(t){return t.childNodes},getParentNode(t){return t.parentNode},getAttrList(t){return t.attrs},getTagName(t){return t.tagName},getNamespaceURI(t){return t.namespaceURI},getTextNodeContent(t){return t.value},getCommentNodeContent(t){return t.data},getDocumentTypeNodeName(t){return t.name},getDocumentTypeNodePublicId(t){return t.publicId},getDocumentTypeNodeSystemId(t){return t.systemId},isTextNode(t){return t.nodeName==="#text"},isCommentNode(t){return t.nodeName==="#comment"},isDocumentTypeNode(t){return t.nodeName==="#documentType"},isElementNode(t){return Object.prototype.hasOwnProperty.call(t,"tagName")},setNodeSourceCodeLocation(t,e){t.sourceCodeLocation=e},getNodeSourceCodeLocation(t){return t.sourceCodeLocation},updateNodeSourceCodeLocation(t,e){t.sourceCodeLocation={...t.sourceCodeLocation,...e}}},Vk="html",K3="about:legacy-compat",Q3="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",qk=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],X3=[...qk,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],J3=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),jk=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],Z3=[...jk,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Rg(t,e){return e.some(n=>t.startsWith(n))}function eR(t){return t.name===Vk&&t.publicId===null&&(t.systemId===null||t.systemId===K3)}function tR(t){if(t.name!==Vk)return Ft.QUIRKS;const{systemId:e}=t;if(e&&e.toLowerCase()===Q3)return Ft.QUIRKS;let{publicId:n}=t;if(n!==null){if(n=n.toLowerCase(),J3.has(n))return Ft.QUIRKS;let r=e===null?X3:qk;if(Rg(n,r))return Ft.QUIRKS;if(r=e===null?jk:Z3,Rg(n,r))return Ft.LIMITED_QUIRKS}return Ft.NO_QUIRKS}const Pg={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},nR="definitionurl",rR="definitionURL",iR=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),oR=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:L.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:L.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:L.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:L.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:L.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:L.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:L.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:L.XML}],["xml:space",{prefix:"xml",name:"space",namespace:L.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:L.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:L.XMLNS}]]),sR=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),aR=new Set([m.B,m.BIG,m.BLOCKQUOTE,m.BODY,m.BR,m.CENTER,m.CODE,m.DD,m.DIV,m.DL,m.DT,m.EM,m.EMBED,m.H1,m.H2,m.H3,m.H4,m.H5,m.H6,m.HEAD,m.HR,m.I,m.IMG,m.LI,m.LISTING,m.MENU,m.META,m.NOBR,m.OL,m.P,m.PRE,m.RUBY,m.S,m.SMALL,m.SPAN,m.STRONG,m.STRIKE,m.SUB,m.SUP,m.TABLE,m.TT,m.U,m.UL,m.VAR]);function lR(t){const e=t.tagID;return e===m.FONT&&t.attrs.some(({name:r})=>r===jr.COLOR||r===jr.SIZE||r===jr.FACE)||aR.has(e)}function Wk(t){for(let e=0;e<t.attrs.length;e++)if(t.attrs[e].name===nR){t.attrs[e].name=rR;break}}function Yk(t){for(let e=0;e<t.attrs.length;e++){const n=iR.get(t.attrs[e].name);n!=null&&(t.attrs[e].name=n)}}function _f(t){for(let e=0;e<t.attrs.length;e++){const n=oR.get(t.attrs[e].name);n&&(t.attrs[e].prefix=n.prefix,t.attrs[e].name=n.name,t.attrs[e].namespace=n.namespace)}}function uR(t){const e=sR.get(t.tagName);e!=null&&(t.tagName=e,t.tagID=hu(t.tagName))}function cR(t,e){return e===L.MATHML&&(t===m.MI||t===m.MO||t===m.MN||t===m.MS||t===m.MTEXT)}function dR(t,e,n){if(e===L.MATHML&&t===m.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===jr.ENCODING){const i=n[r].value.toLowerCase();return i===Pg.TEXT_HTML||i===Pg.APPLICATION_XML}}return e===L.SVG&&(t===m.FOREIGN_OBJECT||t===m.DESC||t===m.TITLE)}function hR(t,e,n,r){return(!r||r===L.HTML)&&dR(t,e,n)||(!r||r===L.MATHML)&&cR(t,e)}const fR="hidden",pR=8,mR=3;var T;(function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(T||(T={}));const gR={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Gk=new Set([m.TABLE,m.TBODY,m.TFOOT,m.THEAD,m.TR]),Bg={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:er,onParseError:null};class Kk{constructor(e,n,r=null,i=null){this.fragmentContext=r,this.scriptHandler=i,this.currentToken=null,this.stopped=!1,this.insertionMode=T.INITIAL,this.originalInsertionMode=T.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Bg,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new U3(this.options,this),this.activeFormattingElements=new G3(this.treeAdapter),this.fragmentContextID=r?hu(this.treeAdapter.getTagName(r)):m.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new Y3(this.document,this.treeAdapter,this)}static parse(e,n){const r=new this(n);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,n){const r={...Bg,...n};e??(e=r.treeAdapter.createElement(A.TEMPLATE,L.HTML,[]));const i=r.treeAdapter.createElement("documentmock",L.HTML,[]),o=new this(r,i,e);return o.fragmentContextID===m.TEMPLATE&&o.tmplInsertionModeStack.unshift(T.IN_TEMPLATE),o._initTokenizerForFragmentParsing(),o._insertFakeRootElement(),o._resetInsertionMode(),o._findFormInFragmentContext(),o}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,n),n}_err(e,n,r){var i;if(!this.onParseError)return;const o=(i=e.location)!==null&&i!==void 0?i:gR,s={code:n,startLine:o.startLine,startCol:o.startCol,startOffset:o.startOffset,endLine:r?o.startLine:o.endLine,endCol:r?o.startCol:o.endCol,endOffset:r?o.startOffset:o.endOffset};this.onParseError(s)}onItemPush(e,n,r){var i,o;(o=(i=this.treeAdapter).onItemPush)===null||o===void 0||o.call(i,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,n)}onItemPop(e,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,e,this.openElements.current),n){let o,s;this.openElements.stackTop===0&&this.fragmentContext?(o=this.fragmentContext,s=this.fragmentContextID):{current:o,currentTagId:s}=this.openElements,this._setContextModes(o,s)}}_setContextModes(e,n){const r=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===L.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&e!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,e)}_switchToTextParsing(e,n){this._insertElement(e,L.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=T.TEXT}switchToPlaintextParsing(){this.insertionMode=T.TEXT,this.originalInsertionMode=T.IN_BODY,this.tokenizer.state=Tt.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===A.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==L.HTML))switch(this.fragmentContextID){case m.TITLE:case m.TEXTAREA:{this.tokenizer.state=Tt.RCDATA;break}case m.STYLE:case m.XMP:case m.IFRAME:case m.NOEMBED:case m.NOFRAMES:case m.NOSCRIPT:{this.tokenizer.state=Tt.RAWTEXT;break}case m.SCRIPT:{this.tokenizer.state=Tt.SCRIPT_DATA;break}case m.PLAINTEXT:{this.tokenizer.state=Tt.PLAINTEXT;break}}}_setDocumentType(e){const n=e.name||"",r=e.publicId||"",i=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),e.location){const s=this.treeAdapter.getChildNodes(this.document).find(a=>this.treeAdapter.isDocumentTypeNode(a));s&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}}_attachElementToTree(e,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,e)}}_appendElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,n){const r=this.treeAdapter.createElement(e,L.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(e){const n=this.treeAdapter.createElement(e.tagName,L.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(A.HTML,L.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,m.HTML)}_appendCommentNode(e,n){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,e.chars,r):this.treeAdapter.insertText(n,e.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,e.chars)),!e.location)return;const i=this.treeAdapter.getChildNodes(n),o=r?i.lastIndexOf(r):i.length,s=i[o-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:l,endCol:u,endOffset:c}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:l,endCol:u,endOffset:c})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,e.location)}_adoptNodes(e,n){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(e,n){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&n.location){const r=n.location,i=this.treeAdapter.getTagName(e),o=n.type===ce.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,o)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,e.tagID===m.SVG&&this.treeAdapter.getTagName(n)===A.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===L.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===m.MGLYPH||e.tagID===m.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,L.HTML)}_processToken(e){switch(e.type){case ce.CHARACTER:{this.onCharacter(e);break}case ce.NULL_CHARACTER:{this.onNullCharacter(e);break}case ce.COMMENT:{this.onComment(e);break}case ce.DOCTYPE:{this.onDoctype(e);break}case ce.START_TAG:{this._processStartTag(e);break}case ce.END_TAG:{this.onEndTag(e);break}case ce.EOF:{this.onEof(e);break}case ce.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,n,r){const i=this.treeAdapter.getNamespaceURI(n),o=this.treeAdapter.getAttrList(n);return hR(e,i,o,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===yn.Marker||this.openElements.contains(i.element)),r=n===-1?e-1:n-1;for(let i=r;i>=0;i--){const o=this.activeFormattingElements.entries[i];this._insertElement(o.token,this.treeAdapter.getNamespaceURI(o.element)),o.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=T.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(m.P),this.openElements.popUntilTagNamePopped(m.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case m.TR:{this.insertionMode=T.IN_ROW;return}case m.TBODY:case m.THEAD:case m.TFOOT:{this.insertionMode=T.IN_TABLE_BODY;return}case m.CAPTION:{this.insertionMode=T.IN_CAPTION;return}case m.COLGROUP:{this.insertionMode=T.IN_COLUMN_GROUP;return}case m.TABLE:{this.insertionMode=T.IN_TABLE;return}case m.BODY:{this.insertionMode=T.IN_BODY;return}case m.FRAMESET:{this.insertionMode=T.IN_FRAMESET;return}case m.SELECT:{this._resetInsertionModeForSelect(e);return}case m.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case m.HTML:{this.insertionMode=this.headElement?T.AFTER_HEAD:T.BEFORE_HEAD;return}case m.TD:case m.TH:{if(e>0){this.insertionMode=T.IN_CELL;return}break}case m.HEAD:{if(e>0){this.insertionMode=T.IN_HEAD;return}break}}this.insertionMode=T.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let n=e-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===m.TEMPLATE)break;if(r===m.TABLE){this.insertionMode=T.IN_SELECT_IN_TABLE;return}}this.insertionMode=T.IN_SELECT}_isElementCausesFosterParenting(e){return Gk.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const n=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case m.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===L.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case m.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,e,n.beforeElement):this.treeAdapter.appendChild(n.parent,e)}_isSpecialElement(e,n){const r=this.treeAdapter.getNamespaceURI(e);return P3[r].has(n)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){W6(this,e);return}switch(this.insertionMode){case T.INITIAL:{So(this,e);break}case T.BEFORE_HTML:{jo(this,e);break}case T.BEFORE_HEAD:{Wo(this,e);break}case T.IN_HEAD:{Yo(this,e);break}case T.IN_HEAD_NO_SCRIPT:{Go(this,e);break}case T.AFTER_HEAD:{Ko(this,e);break}case T.IN_BODY:case T.IN_CAPTION:case T.IN_CELL:case T.IN_TEMPLATE:{Xk(this,e);break}case T.TEXT:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case T.IN_TABLE:case T.IN_TABLE_BODY:case T.IN_ROW:{ac(this,e);break}case T.IN_TABLE_TEXT:{rT(this,e);break}case T.IN_COLUMN_GROUP:{xl(this,e);break}case T.AFTER_BODY:{wl(this,e);break}case T.AFTER_AFTER_BODY:{$a(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){j6(this,e);return}switch(this.insertionMode){case T.INITIAL:{So(this,e);break}case T.BEFORE_HTML:{jo(this,e);break}case T.BEFORE_HEAD:{Wo(this,e);break}case T.IN_HEAD:{Yo(this,e);break}case T.IN_HEAD_NO_SCRIPT:{Go(this,e);break}case T.AFTER_HEAD:{Ko(this,e);break}case T.TEXT:{this._insertCharacters(e);break}case T.IN_TABLE:case T.IN_TABLE_BODY:case T.IN_ROW:{ac(this,e);break}case T.IN_COLUMN_GROUP:{xl(this,e);break}case T.AFTER_BODY:{wl(this,e);break}case T.AFTER_AFTER_BODY:{$a(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Ld(this,e);return}switch(this.insertionMode){case T.INITIAL:case T.BEFORE_HTML:case T.BEFORE_HEAD:case T.IN_HEAD:case T.IN_HEAD_NO_SCRIPT:case T.AFTER_HEAD:case T.IN_BODY:case T.IN_TABLE:case T.IN_CAPTION:case T.IN_COLUMN_GROUP:case T.IN_TABLE_BODY:case T.IN_ROW:case T.IN_CELL:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:case T.IN_TEMPLATE:case T.IN_FRAMESET:case T.AFTER_FRAMESET:{Ld(this,e);break}case T.IN_TABLE_TEXT:{xo(this,e);break}case T.AFTER_BODY:{SR(this,e);break}case T.AFTER_AFTER_BODY:case T.AFTER_AFTER_FRAMESET:{xR(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case T.INITIAL:{wR(this,e);break}case T.BEFORE_HEAD:case T.IN_HEAD:case T.IN_HEAD_NO_SCRIPT:case T.AFTER_HEAD:{this._err(e,I.misplacedDoctype);break}case T.IN_TABLE_TEXT:{xo(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,I.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?Y6(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case T.INITIAL:{So(this,e);break}case T.BEFORE_HTML:{AR(this,e);break}case T.BEFORE_HEAD:{NR(this,e);break}case T.IN_HEAD:{fn(this,e);break}case T.IN_HEAD_NO_SCRIPT:{OR(this,e);break}case T.AFTER_HEAD:{vR(this,e);break}case T.IN_BODY:{ct(this,e);break}case T.IN_TABLE:{no(this,e);break}case T.IN_TABLE_TEXT:{xo(this,e);break}case T.IN_CAPTION:{I6(this,e);break}case T.IN_COLUMN_GROUP:{Mf(this,e);break}case T.IN_TABLE_BODY:{mu(this,e);break}case T.IN_ROW:{gu(this,e);break}case T.IN_CELL:{D6(this,e);break}case T.IN_SELECT:{sT(this,e);break}case T.IN_SELECT_IN_TABLE:{L6(this,e);break}case T.IN_TEMPLATE:{P6(this,e);break}case T.AFTER_BODY:{F6(this,e);break}case T.IN_FRAMESET:{H6(this,e);break}case T.AFTER_FRAMESET:{$6(this,e);break}case T.AFTER_AFTER_BODY:{V6(this,e);break}case T.AFTER_AFTER_FRAMESET:{q6(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?G6(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case T.INITIAL:{So(this,e);break}case T.BEFORE_HTML:{_R(this,e);break}case T.BEFORE_HEAD:{IR(this,e);break}case T.IN_HEAD:{MR(this,e);break}case T.IN_HEAD_NO_SCRIPT:{DR(this,e);break}case T.AFTER_HEAD:{LR(this,e);break}case T.IN_BODY:{pu(this,e);break}case T.TEXT:{E6(this,e);break}case T.IN_TABLE:{Is(this,e);break}case T.IN_TABLE_TEXT:{xo(this,e);break}case T.IN_CAPTION:{M6(this,e);break}case T.IN_COLUMN_GROUP:{O6(this,e);break}case T.IN_TABLE_BODY:{Rd(this,e);break}case T.IN_ROW:{oT(this,e);break}case T.IN_CELL:{v6(this,e);break}case T.IN_SELECT:{aT(this,e);break}case T.IN_SELECT_IN_TABLE:{R6(this,e);break}case T.IN_TEMPLATE:{B6(this,e);break}case T.AFTER_BODY:{uT(this,e);break}case T.IN_FRAMESET:{U6(this,e);break}case T.AFTER_FRAMESET:{z6(this,e);break}case T.AFTER_AFTER_BODY:{$a(this,e);break}}}onEof(e){switch(this.insertionMode){case T.INITIAL:{So(this,e);break}case T.BEFORE_HTML:{jo(this,e);break}case T.BEFORE_HEAD:{Wo(this,e);break}case T.IN_HEAD:{Yo(this,e);break}case T.IN_HEAD_NO_SCRIPT:{Go(this,e);break}case T.AFTER_HEAD:{Ko(this,e);break}case T.IN_BODY:case T.IN_TABLE:case T.IN_CAPTION:case T.IN_COLUMN_GROUP:case T.IN_TABLE_BODY:case T.IN_ROW:case T.IN_CELL:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:{tT(this,e);break}case T.TEXT:{k6(this,e);break}case T.IN_TABLE_TEXT:{xo(this,e);break}case T.IN_TEMPLATE:{lT(this,e);break}case T.AFTER_BODY:case T.IN_FRAMESET:case T.AFTER_FRAMESET:case T.AFTER_AFTER_BODY:case T.AFTER_AFTER_FRAMESET:{If(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===E.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case T.IN_HEAD:case T.IN_HEAD_NO_SCRIPT:case T.AFTER_HEAD:case T.TEXT:case T.IN_COLUMN_GROUP:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:case T.IN_FRAMESET:case T.AFTER_FRAMESET:{this._insertCharacters(e);break}case T.IN_BODY:case T.IN_CAPTION:case T.IN_CELL:case T.IN_TEMPLATE:case T.AFTER_BODY:case T.AFTER_AFTER_BODY:case T.AFTER_AFTER_FRAMESET:{Qk(this,e);break}case T.IN_TABLE:case T.IN_TABLE_BODY:case T.IN_ROW:{ac(this,e);break}case T.IN_TABLE_TEXT:{nT(this,e);break}}}}function bR(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):eT(t,e),n}function yR(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const i=t.openElements.items[r];if(i===e.element)break;t._isSpecialElement(i,t.openElements.tagIDs[r])&&(n=i)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function ER(t,e,n){let r=e,i=t.openElements.getCommonAncestor(e);for(let o=0,s=i;s!==n;o++,s=i){i=t.openElements.getCommonAncestor(s);const a=t.activeFormattingElements.getElementEntry(s),l=a&&o>=mR;!a||l?(l&&t.activeFormattingElements.removeEntry(a),t.openElements.remove(s)):(s=kR(t,a),r===e&&(t.activeFormattingElements.bookmark=a),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(s,r),r=s)}return r}function kR(t,e){const n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function TR(t,e,n){const r=t.treeAdapter.getTagName(e),i=hu(r);if(t._isElementCausesFosterParenting(i))t._fosterParentElement(n);else{const o=t.treeAdapter.getNamespaceURI(e);i===m.TEMPLATE&&o===L.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function CR(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:i}=n,o=t.treeAdapter.createElement(i.tagName,r,i.attrs);t._adoptNodes(e,o),t.treeAdapter.appendChild(e,o),t.activeFormattingElements.insertElementAfterBookmark(o,i),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,o,i.tagID)}function Nf(t,e){for(let n=0;n<pR;n++){const r=bR(t,e);if(!r)break;const i=yR(t,r);if(!i)break;t.activeFormattingElements.bookmark=r;const o=ER(t,i,r.element),s=t.openElements.getCommonAncestor(r.element);t.treeAdapter.detachNode(o),s&&TR(t,s,o),CR(t,i,r)}}function Ld(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function SR(t,e){t._appendCommentNode(e,t.openElements.items[0])}function xR(t,e){t._appendCommentNode(e,t.document)}function If(t,e){if(t.stopped=!0,e.location){const n=t.fragmentContext?0:2;for(let r=t.openElements.stackTop;r>=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){const r=t.openElements.items[0],i=t.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(t._setEndLocation(r,e),t.openElements.stackTop>=1)){const o=t.openElements.items[1],s=t.treeAdapter.getNodeSourceCodeLocation(o);s&&!s.endTag&&t._setEndLocation(o,e)}}}}function wR(t,e){t._setDocumentType(e);const n=e.forceQuirks?Ft.QUIRKS:tR(e);eR(e)||t._err(e,I.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=T.BEFORE_HTML}function So(t,e){t._err(e,I.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,Ft.QUIRKS),t.insertionMode=T.BEFORE_HTML,t._processToken(e)}function AR(t,e){e.tagID===m.HTML?(t._insertElement(e,L.HTML),t.insertionMode=T.BEFORE_HEAD):jo(t,e)}function _R(t,e){const n=e.tagID;(n===m.HTML||n===m.HEAD||n===m.BODY||n===m.BR)&&jo(t,e)}function jo(t,e){t._insertFakeRootElement(),t.insertionMode=T.BEFORE_HEAD,t._processToken(e)}function NR(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.HEAD:{t._insertElement(e,L.HTML),t.headElement=t.openElements.current,t.insertionMode=T.IN_HEAD;break}default:Wo(t,e)}}function IR(t,e){const n=e.tagID;n===m.HEAD||n===m.BODY||n===m.HTML||n===m.BR?Wo(t,e):t._err(e,I.endTagWithoutMatchingOpenElement)}function Wo(t,e){t._insertFakeElement(A.HEAD,m.HEAD),t.headElement=t.openElements.current,t.insertionMode=T.IN_HEAD,t._processToken(e)}function fn(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:{t._appendElement(e,L.HTML),e.ackSelfClosing=!0;break}case m.TITLE:{t._switchToTextParsing(e,Tt.RCDATA);break}case m.NOSCRIPT:{t.options.scriptingEnabled?t._switchToTextParsing(e,Tt.RAWTEXT):(t._insertElement(e,L.HTML),t.insertionMode=T.IN_HEAD_NO_SCRIPT);break}case m.NOFRAMES:case m.STYLE:{t._switchToTextParsing(e,Tt.RAWTEXT);break}case m.SCRIPT:{t._switchToTextParsing(e,Tt.SCRIPT_DATA);break}case m.TEMPLATE:{t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=T.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(T.IN_TEMPLATE);break}case m.HEAD:{t._err(e,I.misplacedStartTagForHeadElement);break}default:Yo(t,e)}}function MR(t,e){switch(e.tagID){case m.HEAD:{t.openElements.pop(),t.insertionMode=T.AFTER_HEAD;break}case m.BODY:case m.BR:case m.HTML:{Yo(t,e);break}case m.TEMPLATE:{fi(t,e);break}default:t._err(e,I.endTagWithoutMatchingOpenElement)}}function fi(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==m.TEMPLATE&&t._err(e,I.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,I.endTagWithoutMatchingOpenElement)}function Yo(t,e){t.openElements.pop(),t.insertionMode=T.AFTER_HEAD,t._processToken(e)}function OR(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.BASEFONT:case m.BGSOUND:case m.HEAD:case m.LINK:case m.META:case m.NOFRAMES:case m.STYLE:{fn(t,e);break}case m.NOSCRIPT:{t._err(e,I.nestedNoscriptInHead);break}default:Go(t,e)}}function DR(t,e){switch(e.tagID){case m.NOSCRIPT:{t.openElements.pop(),t.insertionMode=T.IN_HEAD;break}case m.BR:{Go(t,e);break}default:t._err(e,I.endTagWithoutMatchingOpenElement)}}function Go(t,e){const n=e.type===ce.EOF?I.openElementsLeftAfterEof:I.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=T.IN_HEAD,t._processToken(e)}function vR(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.BODY:{t._insertElement(e,L.HTML),t.framesetOk=!1,t.insertionMode=T.IN_BODY;break}case m.FRAMESET:{t._insertElement(e,L.HTML),t.insertionMode=T.IN_FRAMESET;break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{t._err(e,I.abandonedHeadElementChild),t.openElements.push(t.headElement,m.HEAD),fn(t,e),t.openElements.remove(t.headElement);break}case m.HEAD:{t._err(e,I.misplacedStartTagForHeadElement);break}default:Ko(t,e)}}function LR(t,e){switch(e.tagID){case m.BODY:case m.HTML:case m.BR:{Ko(t,e);break}case m.TEMPLATE:{fi(t,e);break}default:t._err(e,I.endTagWithoutMatchingOpenElement)}}function Ko(t,e){t._insertFakeElement(A.BODY,m.BODY),t.insertionMode=T.IN_BODY,fu(t,e)}function fu(t,e){switch(e.type){case ce.CHARACTER:{Xk(t,e);break}case ce.WHITESPACE_CHARACTER:{Qk(t,e);break}case ce.COMMENT:{Ld(t,e);break}case ce.START_TAG:{ct(t,e);break}case ce.END_TAG:{pu(t,e);break}case ce.EOF:{tT(t,e);break}}}function Qk(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function Xk(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function RR(t,e){t.openElements.tmplCount===0&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}function PR(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t.openElements.tmplCount===0&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}function BR(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,L.HTML),t.insertionMode=T.IN_FRAMESET)}function FR(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,L.HTML)}function HR(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t.openElements.currentTagId!==void 0&&vd.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,L.HTML)}function UR(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,L.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}function $R(t,e){const n=t.openElements.tmplCount>0;(!t.formElement||n)&&(t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,L.HTML),n||(t.formElement=t.openElements.current))}function zR(t,e){t.framesetOk=!1;const n=e.tagID;for(let r=t.openElements.stackTop;r>=0;r--){const i=t.openElements.tagIDs[r];if(n===m.LI&&i===m.LI||(n===m.DD||n===m.DT)&&(i===m.DD||i===m.DT)){t.openElements.generateImpliedEndTagsWithExclusion(i),t.openElements.popUntilTagNamePopped(i);break}if(i!==m.ADDRESS&&i!==m.DIV&&i!==m.P&&t._isSpecialElement(t.openElements.items[r],i))break}t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,L.HTML)}function VR(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,L.HTML),t.tokenizer.state=Tt.PLAINTEXT}function qR(t,e){t.openElements.hasInScope(m.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,L.HTML),t.framesetOk=!1}function jR(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(A.A);n&&(Nf(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,L.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function WR(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,L.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function YR(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(m.NOBR)&&(Nf(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,L.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function GR(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,L.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}function KR(t,e){t.treeAdapter.getDocumentMode(t.document)!==Ft.QUIRKS&&t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,L.HTML),t.framesetOk=!1,t.insertionMode=T.IN_TABLE}function Jk(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,L.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function Zk(t){const e=Uk(t,jr.TYPE);return e!=null&&e.toLowerCase()===fR}function QR(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,L.HTML),Zk(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}function XR(t,e){t._appendElement(e,L.HTML),e.ackSelfClosing=!0}function JR(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._appendElement(e,L.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function ZR(t,e){e.tagName=A.IMG,e.tagID=m.IMG,Jk(t,e)}function e6(t,e){t._insertElement(e,L.HTML),t.skipNextNewLine=!0,t.tokenizer.state=Tt.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=T.TEXT}function t6(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,Tt.RAWTEXT)}function n6(t,e){t.framesetOk=!1,t._switchToTextParsing(e,Tt.RAWTEXT)}function Fg(t,e){t._switchToTextParsing(e,Tt.RAWTEXT)}function r6(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,L.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===T.IN_TABLE||t.insertionMode===T.IN_CAPTION||t.insertionMode===T.IN_TABLE_BODY||t.insertionMode===T.IN_ROW||t.insertionMode===T.IN_CELL?T.IN_SELECT_IN_TABLE:T.IN_SELECT}function i6(t,e){t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,L.HTML)}function o6(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,L.HTML)}function s6(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(m.RTC),t._insertElement(e,L.HTML)}function a6(t,e){t._reconstructActiveFormattingElements(),Wk(e),_f(e),e.selfClosing?t._appendElement(e,L.MATHML):t._insertElement(e,L.MATHML),e.ackSelfClosing=!0}function l6(t,e){t._reconstructActiveFormattingElements(),Yk(e),_f(e),e.selfClosing?t._appendElement(e,L.SVG):t._insertElement(e,L.SVG),e.ackSelfClosing=!0}function Hg(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,L.HTML)}function ct(t,e){switch(e.tagID){case m.I:case m.S:case m.B:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.SMALL:case m.STRIKE:case m.STRONG:{WR(t,e);break}case m.A:{jR(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{HR(t,e);break}case m.P:case m.DL:case m.OL:case m.UL:case m.DIV:case m.DIR:case m.NAV:case m.MAIN:case m.MENU:case m.ASIDE:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.DETAILS:case m.ADDRESS:case m.ARTICLE:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{FR(t,e);break}case m.LI:case m.DD:case m.DT:{zR(t,e);break}case m.BR:case m.IMG:case m.WBR:case m.AREA:case m.EMBED:case m.KEYGEN:{Jk(t,e);break}case m.HR:{JR(t,e);break}case m.RB:case m.RTC:{o6(t,e);break}case m.RT:case m.RP:{s6(t,e);break}case m.PRE:case m.LISTING:{UR(t,e);break}case m.XMP:{t6(t,e);break}case m.SVG:{l6(t,e);break}case m.HTML:{RR(t,e);break}case m.BASE:case m.LINK:case m.META:case m.STYLE:case m.TITLE:case m.SCRIPT:case m.BGSOUND:case m.BASEFONT:case m.TEMPLATE:{fn(t,e);break}case m.BODY:{PR(t,e);break}case m.FORM:{$R(t,e);break}case m.NOBR:{YR(t,e);break}case m.MATH:{a6(t,e);break}case m.TABLE:{KR(t,e);break}case m.INPUT:{QR(t,e);break}case m.PARAM:case m.TRACK:case m.SOURCE:{XR(t,e);break}case m.IMAGE:{ZR(t,e);break}case m.BUTTON:{qR(t,e);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{GR(t,e);break}case m.IFRAME:{n6(t,e);break}case m.SELECT:{r6(t,e);break}case m.OPTION:case m.OPTGROUP:{i6(t,e);break}case m.NOEMBED:case m.NOFRAMES:{Fg(t,e);break}case m.FRAMESET:{BR(t,e);break}case m.TEXTAREA:{e6(t,e);break}case m.NOSCRIPT:{t.options.scriptingEnabled?Fg(t,e):Hg(t,e);break}case m.PLAINTEXT:{VR(t,e);break}case m.COL:case m.TH:case m.TD:case m.TR:case m.HEAD:case m.FRAME:case m.TBODY:case m.TFOOT:case m.THEAD:case m.CAPTION:case m.COLGROUP:break;default:Hg(t,e)}}function u6(t,e){if(t.openElements.hasInScope(m.BODY)&&(t.insertionMode=T.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}function c6(t,e){t.openElements.hasInScope(m.BODY)&&(t.insertionMode=T.AFTER_BODY,uT(t,e))}function d6(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}function h6(t){const e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(m.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(m.FORM):n&&t.openElements.remove(n))}function f6(t){t.openElements.hasInButtonScope(m.P)||t._insertFakeElement(A.P,m.P),t._closePElement()}function p6(t){t.openElements.hasInListItemScope(m.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(m.LI),t.openElements.popUntilTagNamePopped(m.LI))}function m6(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}function g6(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}function b6(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}function y6(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(A.BR,m.BR),t.openElements.pop(),t.framesetOk=!1}function eT(t,e){const n=e.tagName,r=e.tagID;for(let i=t.openElements.stackTop;i>0;i--){const o=t.openElements.items[i],s=t.openElements.tagIDs[i];if(r===s&&(r!==m.UNKNOWN||t.treeAdapter.getTagName(o)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=i&&t.openElements.shortenToLength(i);break}if(t._isSpecialElement(o,s))break}}function pu(t,e){switch(e.tagID){case m.A:case m.B:case m.I:case m.S:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.NOBR:case m.SMALL:case m.STRIKE:case m.STRONG:{Nf(t,e);break}case m.P:{f6(t);break}case m.DL:case m.UL:case m.OL:case m.DIR:case m.DIV:case m.NAV:case m.PRE:case m.MAIN:case m.MENU:case m.ASIDE:case m.BUTTON:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.ADDRESS:case m.ARTICLE:case m.DETAILS:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.LISTING:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{d6(t,e);break}case m.LI:{p6(t);break}case m.DD:case m.DT:{m6(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{g6(t);break}case m.BR:{y6(t);break}case m.BODY:{u6(t,e);break}case m.HTML:{c6(t,e);break}case m.FORM:{h6(t);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{b6(t,e);break}case m.TEMPLATE:{fi(t,e);break}default:eT(t,e)}}function tT(t,e){t.tmplInsertionModeStack.length>0?lT(t,e):If(t,e)}function E6(t,e){var n;e.tagID===m.SCRIPT&&((n=t.scriptHandler)===null||n===void 0||n.call(t,t.openElements.current)),t.openElements.pop(),t.insertionMode=t.originalInsertionMode}function k6(t,e){t._err(e,I.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}function ac(t,e){if(t.openElements.currentTagId!==void 0&&Gk.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=T.IN_TABLE_TEXT,e.type){case ce.CHARACTER:{rT(t,e);break}case ce.WHITESPACE_CHARACTER:{nT(t,e);break}}else qs(t,e)}function T6(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,L.HTML),t.insertionMode=T.IN_CAPTION}function C6(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,L.HTML),t.insertionMode=T.IN_COLUMN_GROUP}function S6(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(A.COLGROUP,m.COLGROUP),t.insertionMode=T.IN_COLUMN_GROUP,Mf(t,e)}function x6(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,L.HTML),t.insertionMode=T.IN_TABLE_BODY}function w6(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(A.TBODY,m.TBODY),t.insertionMode=T.IN_TABLE_BODY,mu(t,e)}function A6(t,e){t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode(),t._processStartTag(e))}function _6(t,e){Zk(e)?t._appendElement(e,L.HTML):qs(t,e),e.ackSelfClosing=!0}function N6(t,e){!t.formElement&&t.openElements.tmplCount===0&&(t._insertElement(e,L.HTML),t.formElement=t.openElements.current,t.openElements.pop())}function no(t,e){switch(e.tagID){case m.TD:case m.TH:case m.TR:{w6(t,e);break}case m.STYLE:case m.SCRIPT:case m.TEMPLATE:{fn(t,e);break}case m.COL:{S6(t,e);break}case m.FORM:{N6(t,e);break}case m.TABLE:{A6(t,e);break}case m.TBODY:case m.TFOOT:case m.THEAD:{x6(t,e);break}case m.INPUT:{_6(t,e);break}case m.CAPTION:{T6(t,e);break}case m.COLGROUP:{C6(t,e);break}default:qs(t,e)}}function Is(t,e){switch(e.tagID){case m.TABLE:{t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode());break}case m.TEMPLATE:{fi(t,e);break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:qs(t,e)}}function qs(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,fu(t,e),t.fosterParentingEnabled=n}function nT(t,e){t.pendingCharacterTokens.push(e)}function rT(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function xo(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)qs(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const iT=new Set([m.CAPTION,m.COL,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]);function I6(t,e){const n=e.tagID;iT.has(n)?t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=T.IN_TABLE,no(t,e)):ct(t,e)}function M6(t,e){const n=e.tagID;switch(n){case m.CAPTION:case m.TABLE:{t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=T.IN_TABLE,n===m.TABLE&&Is(t,e));break}case m.BODY:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:pu(t,e)}}function Mf(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.COL:{t._appendElement(e,L.HTML),e.ackSelfClosing=!0;break}case m.TEMPLATE:{fn(t,e);break}default:xl(t,e)}}function O6(t,e){switch(e.tagID){case m.COLGROUP:{t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=T.IN_TABLE);break}case m.TEMPLATE:{fi(t,e);break}case m.COL:break;default:xl(t,e)}}function xl(t,e){t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=T.IN_TABLE,t._processToken(e))}function mu(t,e){switch(e.tagID){case m.TR:{t.openElements.clearBackToTableBodyContext(),t._insertElement(e,L.HTML),t.insertionMode=T.IN_ROW;break}case m.TH:case m.TD:{t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(A.TR,m.TR),t.insertionMode=T.IN_ROW,gu(t,e);break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE,no(t,e));break}default:no(t,e)}}function Rd(t,e){const n=e.tagID;switch(e.tagID){case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasInTableScope(n)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE);break}case m.TABLE:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE,Is(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:case m.TR:break;default:Is(t,e)}}function gu(t,e){switch(e.tagID){case m.TH:case m.TD:{t.openElements.clearBackToTableRowContext(),t._insertElement(e,L.HTML),t.insertionMode=T.IN_CELL,t.activeFormattingElements.insertMarker();break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY,mu(t,e));break}default:no(t,e)}}function oT(t,e){switch(e.tagID){case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY);break}case m.TABLE:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY,Rd(t,e));break}case m.TBODY:case m.TFOOT:case m.THEAD:{(t.openElements.hasInTableScope(e.tagID)||t.openElements.hasInTableScope(m.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY,Rd(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:break;default:Is(t,e)}}function D6(t,e){const n=e.tagID;iT.has(n)?(t.openElements.hasInTableScope(m.TD)||t.openElements.hasInTableScope(m.TH))&&(t._closeTableCell(),gu(t,e)):ct(t,e)}function v6(t,e){const n=e.tagID;switch(n){case m.TD:case m.TH:{t.openElements.hasInTableScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=T.IN_ROW);break}case m.TABLE:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(n)&&(t._closeTableCell(),oT(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:break;default:pu(t,e)}}function sT(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._insertElement(e,L.HTML);break}case m.OPTGROUP:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._insertElement(e,L.HTML);break}case m.HR:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._appendElement(e,L.HTML),e.ackSelfClosing=!0;break}case m.INPUT:case m.KEYGEN:case m.TEXTAREA:case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),e.tagID!==m.SELECT&&t._processStartTag(e));break}case m.SCRIPT:case m.TEMPLATE:{fn(t,e);break}}}function aT(t,e){switch(e.tagID){case m.OPTGROUP:{t.openElements.stackTop>0&&t.openElements.currentTagId===m.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===m.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop();break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop();break}case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode());break}case m.TEMPLATE:{fi(t,e);break}}}function L6(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t._processStartTag(e)):sT(t,e)}function R6(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t.onEndTag(e)):aT(t,e)}function P6(t,e){switch(e.tagID){case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{fn(t,e);break}case m.CAPTION:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.tmplInsertionModeStack[0]=T.IN_TABLE,t.insertionMode=T.IN_TABLE,no(t,e);break}case m.COL:{t.tmplInsertionModeStack[0]=T.IN_COLUMN_GROUP,t.insertionMode=T.IN_COLUMN_GROUP,Mf(t,e);break}case m.TR:{t.tmplInsertionModeStack[0]=T.IN_TABLE_BODY,t.insertionMode=T.IN_TABLE_BODY,mu(t,e);break}case m.TD:case m.TH:{t.tmplInsertionModeStack[0]=T.IN_ROW,t.insertionMode=T.IN_ROW,gu(t,e);break}default:t.tmplInsertionModeStack[0]=T.IN_BODY,t.insertionMode=T.IN_BODY,ct(t,e)}}function B6(t,e){e.tagID===m.TEMPLATE&&fi(t,e)}function lT(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):If(t,e)}function F6(t,e){e.tagID===m.HTML?ct(t,e):wl(t,e)}function uT(t,e){var n;if(e.tagID===m.HTML){if(t.fragmentContext||(t.insertionMode=T.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===m.HTML){t._setEndLocation(t.openElements.items[0],e);const r=t.openElements.items[1];r&&!(!((n=t.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&t._setEndLocation(r,e)}}else wl(t,e)}function wl(t,e){t.insertionMode=T.IN_BODY,fu(t,e)}function H6(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.FRAMESET:{t._insertElement(e,L.HTML);break}case m.FRAME:{t._appendElement(e,L.HTML),e.ackSelfClosing=!0;break}case m.NOFRAMES:{fn(t,e);break}}}function U6(t,e){e.tagID===m.FRAMESET&&!t.openElements.isRootHtmlElementCurrent()&&(t.openElements.pop(),!t.fragmentContext&&t.openElements.currentTagId!==m.FRAMESET&&(t.insertionMode=T.AFTER_FRAMESET))}function $6(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.NOFRAMES:{fn(t,e);break}}}function z6(t,e){e.tagID===m.HTML&&(t.insertionMode=T.AFTER_AFTER_FRAMESET)}function V6(t,e){e.tagID===m.HTML?ct(t,e):$a(t,e)}function $a(t,e){t.insertionMode=T.IN_BODY,fu(t,e)}function q6(t,e){switch(e.tagID){case m.HTML:{ct(t,e);break}case m.NOFRAMES:{fn(t,e);break}}}function j6(t,e){e.chars=we,t._insertCharacters(e)}function W6(t,e){t._insertCharacters(e),t.framesetOk=!1}function cT(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==L.HTML&&t.openElements.currentTagId!==void 0&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}function Y6(t,e){if(lR(e))cT(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===L.MATHML?Wk(e):r===L.SVG&&(uR(e),Yk(e)),_f(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}function G6(t,e){if(e.tagID===m.P||e.tagID===m.BR){cT(t),t._endTagOutsideForeignContent(e);return}for(let n=t.openElements.stackTop;n>0;n--){const r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===L.HTML){t._endTagOutsideForeignContent(e);break}const i=t.treeAdapter.getTagName(r);if(i.toLowerCase()===e.tagName){e.tagName=i,t.openElements.shortenToLength(n);break}}}A.AREA,A.BASE,A.BASEFONT,A.BGSOUND,A.BR,A.COL,A.EMBED,A.FRAME,A.HR,A.IMG,A.INPUT,A.KEYGEN,A.LINK,A.META,A.PARAM,A.SOURCE,A.TRACK,A.WBR;function K6(t,e){return Kk.parse(t,e)}function Q6(t,e,n){typeof t=="string"&&(n=e,e=t,t=null);const r=Kk.getFragmentParser(t,n);return r.tokenizer.write(e,!0),r.getFragment()}function Qo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Ug(t.position):"start"in t||"end"in t?Ug(t):"line"in t||"column"in t?Pd(t):""}function Pd(t){return $g(t&&t.line)+":"+$g(t&&t.column)}function Ug(t){return Pd(t&&t.start)+"-"+Pd(t&&t.end)}function $g(t){return t&&typeof t=="number"?t:1}class bt extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(s=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Qo(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}bt.prototype.file="";bt.prototype.name="";bt.prototype.reason="";bt.prototype.message="";bt.prototype.stack="";bt.prototype.column=void 0;bt.prototype.line=void 0;bt.prototype.ancestors=void 0;bt.prototype.cause=void 0;bt.prototype.fatal=void 0;bt.prototype.place=void 0;bt.prototype.ruleId=void 0;bt.prototype.source=void 0;const bn={basename:X6,dirname:J6,extname:Z6,join:eP,sep:"/"};function X6(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');js(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let s=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return n===r?r=s:r<0&&(r=t.length),t.slice(n,r)}function J6(t){if(js(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Z6(t){js(t);let e=t.length,n=-1,r=0,i=-1,o=0,s;for(;e--;){const a=t.codePointAt(e);if(a===47){if(s){r=e+1;break}continue}n<0&&(s=!0,n=e+1),a===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function eP(...t){let e=-1,n;for(;++e<t.length;)js(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":tP(n)}function tP(t){js(t);const e=t.codePointAt(0)===47;let n=nP(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function nP(t,e){let n="",r=0,i=-1,o=0,s=-1,a,l;for(;++s<=t.length;){if(s<t.length)a=t.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,s):n=t.slice(i+1,s),r=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return n}function js(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const rP={cwd:iP};function iP(){return"/"}function Bd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function oP(t){if(typeof t=="string")t=new URL(t);else if(!Bd(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return sP(t)}function sP(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const lc=["history","path","basename","stem","extname","dirname"];class Fd{constructor(e){let n;e?Bd(e)?n={path:e}:typeof e=="string"||aP(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":rP.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<lc.length;){const o=lc[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)lc.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?bn.basename(this.path):void 0}set basename(e){cc(e,"basename"),uc(e,"basename"),this.path=bn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?bn.dirname(this.path):void 0}set dirname(e){zg(this.basename,"dirname"),this.path=bn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?bn.extname(this.path):void 0}set extname(e){if(uc(e,"extname"),zg(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=bn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Bd(e)&&(e=oP(e)),cc(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?bn.basename(this.path,this.extname):void 0}set stem(e){cc(e,"stem"),uc(e,"stem"),this.path=bn.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new bt(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function uc(t,e){if(t&&t.includes(bn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+bn.sep+"`")}function cc(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function zg(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function aP(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const lP={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},uP="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",cP=/-[a-z]/g,dP=/%c(?:([-+])(\d+))?/g,hP=/%x/g,fP={2:!0,1:!1,0:null},pP={};function mP(t,e){const n=e||pP,r=n.onerror,i=t instanceof Fd?t:new Fd(t),o=n.fragment?Q6:K6,s=String(i),a=o(s,{sourceCodeLocationInfo:!0,onParseError:n.onerror?l:null,scriptingEnabled:!1});return y3(a,{file:i,space:n.space,verbose:n.verbose});function l(u){const c=u.code,d=gP(c),h=n[d],f=h??!0,p=typeof f=="number"?f:f?1:0;if(p){const y=lP[d],b=new bt(g(y.reason),{place:{start:{line:u.startLine,column:u.startCol,offset:u.startOffset},end:{line:u.endLine,column:u.endCol,offset:u.endOffset}},ruleId:c,source:"hast-util-from-html"});i.path&&(b.file=i.path,b.name=i.path+":"+b.name),b.fatal=fP[p],b.note=g(y.description),b.url=y.url===!1?void 0:uP+c,r(b)}function g(y){return y.replace(dP,b).replace(hP,C);function b(w,v,O){const _=(O?Number.parseInt(O,10):0)*(v==="-"?-1:1),R=s.charAt(u.startOffset+_);return yP(R)}function C(){return EP(s.charCodeAt(u.startOffset))}}}}function gP(t){return t.replace(cP,bP)}function bP(t){return t.charAt(1).toUpperCase()}function yP(t){return t==="`"?"` ` `":t}function EP(t){return"0x"+t.toString(16).toUpperCase()}function kP(t){const e=this,{emitParseErrors:n,...r}={...e.data("settings"),...t};e.parser=i;function i(o,s){return mP(o,{...r,onerror:n?function(a){s.path&&(a.name=s.path+":"+a.name,a.file=s.path),s.messages.push(a)}:void 0})}}const dT=-1,bu=0,Xo=1,Al=2,Of=3,Df=4,vf=5,Lf=6,hT=7,fT=8,TP=typeof self=="object"?self:globalThis,Vg=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new TP[t](e)},CP=(t,e)=>{const n=(i,o)=>(t.set(o,i),i),r=i=>{if(t.has(i))return t.get(i);const[o,s]=e[i];switch(o){case bu:case dT:return n(s,i);case Xo:{const a=n([],i);for(const l of s)a.push(r(l));return a}case Al:{const a=n({},i);for(const[l,u]of s)a[r(l)]=r(u);return a}case Of:return n(new Date(s),i);case Df:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case vf:{const a=n(new Map,i);for(const[l,u]of s)a.set(r(l),r(u));return a}case Lf:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case hT:{const{name:a,message:l}=s;return n(Vg(a,l),i)}case fT:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(Vg(o,s),i)};return r},qg=t=>CP(new Map,t)(0),Ti="",{toString:SP}={},{keys:xP}=Object,wo=t=>{const e=typeof t;if(e!=="object"||!t)return[bu,e];const n=SP.call(t).slice(8,-1);switch(n){case"Array":return[Xo,Ti];case"Object":return[Al,Ti];case"Date":return[Of,Ti];case"RegExp":return[Df,Ti];case"Map":return[vf,Ti];case"Set":return[Lf,Ti];case"DataView":return[Xo,n]}return n.includes("Array")?[Xo,n]:n.includes("Error")?[hT,n]:[Al,n]},ma=([t,e])=>t===bu&&(e==="function"||e==="symbol"),wP=(t,e,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=wo(s);switch(a){case bu:{let c=s;switch(l){case"bigint":a=fT,c=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([dT],s)}return i([a,c],s)}case Xo:{if(l){let h=s;return l==="DataView"?h=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(s)),i([l,[...h]],s)}const c=[],d=i([a,c],s);for(const h of s)c.push(o(h));return d}case Al:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(e&&"toJSON"in s)return o(s.toJSON());const c=[],d=i([a,c],s);for(const h of xP(s))(t||!ma(wo(s[h])))&&c.push([o(h),o(s[h])]);return d}case Of:return i([a,s.toISOString()],s);case Df:{const{source:c,flags:d}=s;return i([a,{source:c,flags:d}],s)}case vf:{const c=[],d=i([a,c],s);for(const[h,f]of s)(t||!(ma(wo(h))||ma(wo(f))))&&c.push([o(h),o(f)]);return d}case Lf:{const c=[],d=i([a,c],s);for(const h of s)(t||!ma(wo(h)))&&c.push(o(h));return d}}const{message:u}=s;return i([a,{name:l,message:u}],s)};return o},jg=(t,{json:e,lossy:n}={})=>{const r=[];return wP(!(e||n),!!e,new Map,r)(t),r},ro=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?qg(jg(t,e)):structuredClone(t):(t,e)=>qg(jg(t,e)),Rf=(function(t,e,n,r,i){const o=pn(e);return pT(t)?o.call(i,t,n,r):!1}),pn=(function(t){if(t==null)return NP;if(typeof t=="string")return _P(t);if(typeof t=="object")return AP(t);if(typeof t=="function")return Pf(t);throw new Error("Expected function, string, or array as `test`")});function AP(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=pn(t[n]);return Pf(r);function r(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function _P(t){return Pf(e);function e(n){return n.tagName===t}}function Pf(t){return e;function e(n,r,i){return!!(pT(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function NP(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function pT(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const mT=pn(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"}),IP=/[ \t\n\f\r]/g;function Ws(t){return typeof t=="object"?t.type==="text"?Wg(t.value):!1:Wg(t)}function Wg(t){return t.replace(IP,"")===""}const mo=(function(t){if(t==null)return vP;if(typeof t=="function")return yu(t);if(typeof t=="object")return Array.isArray(t)?MP(t):OP(t);if(typeof t=="string")return DP(t);throw new Error("Expected function, string, or object as test")});function MP(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=mo(t[n]);return yu(r);function r(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function OP(t){const e=t;return yu(n);function n(r){const i=r;let o;for(o in t)if(i[o]!==e[o])return!1;return!0}}function DP(t){return yu(e);function e(n){return n&&n.type===t}}function yu(t){return e;function e(n,r,i){return!!(LP(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function vP(){return!0}function LP(t){return t!==null&&typeof t=="object"&&"type"in t}const RP=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],PP=["button","input","select","textarea"],BP=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],FP={},Bf=mo(["comment","doctype"]);function HP(t,e){gT(t,{collapse:WP((e||FP).newlines?qP:jP),whitespace:"normal"})}function gT(t,e){if("children"in t){const n={...e};return(t.type==="root"||ET(t))&&(n.before=!0,n.after=!0),n.whitespace=YP(t,e),$P(t,n)}if(t.type==="text"){if(e.whitespace==="normal")return UP(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:Bf(t),stripAtStart:!1,remove:!1}}function UP(t,e){const n=e.collapse(t.value),r={ignore:!1,stripAtStart:!1,remove:!1};let i=0,o=n.length;return e.before&&Yg(n.charAt(0))&&i++,i!==o&&Yg(n.charAt(o-1))&&(e.after?o--:r.stripAtStart=!0),i===o?r.remove=!0:t.value=n.slice(i,o),r}function $P(t,e){let n=e.before;const r=e.after,i=t.children;let o=i.length,s=-1;for(;++s<o;){const a=gT(i[s],{...e,after:bT(i,s,r),before:n});a.remove?(i.splice(s,1),s--,o--):a.ignore||(n=a.stripAtStart),yT(i[s])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function bT(t,e,n){for(;++e<t.length;){const r=t[e];let i=zP(r);if(i===void 0&&"children"in r&&!VP(r)&&(i=bT(r.children,-1)),typeof i=="boolean")return i}return n}function zP(t){if(t.type==="element"){if(yT(t))return!1;if(ET(t))return!0}else if(t.type==="text"){if(!Ws(t))return!1}else if(!Bf(t))return!1}function yT(t){return mT(t)||Rf(t,PP)}function ET(t){return Rf(t,RP)}function VP(t){return!!(t.type==="element"&&t.properties.hidden)||Bf(t)||Rf(t,BP)}function Yg(t){return t===" "||t===`
117
+ `}function qP(t){const e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function jP(){return" "}function WP(t){return e;function e(n){return String(n).replace(/[\t\n\v\f\r ]+/g,t)}}function YP(t,e){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}return e.whitespace}function GP(t){return function(e){HP(e,t)}}const kT=[],KP=!0,_l=!1,TT="skip";function CT(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const o=mo(i),s=r?-1:1;a(t,void 0,[])();function a(l,u,c){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=kT,p,g,y;if((!e||o(l,u,c[c.length-1]||void 0))&&(f=QP(n(l,c)),f[0]===_l))return f;if("children"in l&&l.children){const b=l;if(b.children&&f[0]!==TT)for(g=(r?b.children.length:-1)+s,y=c.concat(b);g>-1&&g<b.children.length;){const C=b.children[g];if(p=a(C,g,y)(),p[0]===_l)return p;g=typeof p[1]=="number"?p[1]:g+s}}return f}}}function QP(t){return Array.isArray(t)?t:typeof t=="number"?[KP,t]:t==null?kT:[t]}function oi(t,e,n,r){let i,o,s;typeof e=="function"&&typeof n!="function"?(o=void 0,s=e,i=n):(o=e,s=n,i=r),CT(t,o,a,i);function a(l,u){const c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return s(l,d,c)}}const ST=wT("end"),xT=wT("start");function wT(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function AT(t){const e=xT(t),n=ST(t);if(e&&n)return{start:e,end:n}}function XP(t,e){const n=e.properties||{},r=t.all(e),i={type:"link",url:t.resolve(String(n.href||"")||null),title:n.title?String(n.title):null,children:r};return t.patch(e,i),i}function JP(t,e){t.baseFound||(t.frozenBaseUrl=String(e.properties&&e.properties.href||"")||void 0,t.baseFound=!0)}function ZP(t,e){const n={type:"blockquote",children:t.toFlow(t.all(e))};return t.patch(e,n),n}function eB(t,e){const n={type:"break"};return t.patch(e,n),n}const Gg=(function(t,e,n){const r=mo(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),Kg=/\n/g,Qg=/[\t ]+/g,Hd=pn("br"),Xg=pn(aB),tB=pn("p"),Jg=pn("tr"),nB=pn(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",sB,lB]),_T=pn(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Ys(t,e){const n={},r="children"in t?t.children:[],i=_T(t),o=MT(t,{whitespace:n.whitespace||"normal"}),s=[];(t.type==="text"||t.type==="comment")&&s.push(...IT(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)s.push(...NT(r[a],t,{whitespace:o,breakBefore:a?void 0:i,breakAfter:a<r.length-1?Hd(r[a+1]):i}));const l=[];let u;for(a=-1;++a<s.length;){const c=s[a];typeof c=="number"?u!==void 0&&c>u&&(u=c):c&&(u!==void 0&&u>-1&&l.push(`
118
+ `.repeat(u)||" "),u=-1,l.push(c))}return l.join("")}function NT(t,e,n){return t.type==="element"?rB(t,e,n):t.type==="text"?n.whitespace==="normal"?IT(t,n):iB(t):[]}function rB(t,e,n){const r=MT(t,n),i=t.children||[];let o=-1,s=[];if(nB(t))return s;let a,l;for(Hd(t)||Jg(t)&&Gg(e,t,Jg)?l=`
119
+ `:tB(t)?(a=2,l=2):_T(t)&&(a=1,l=1);++o<i.length;)s=s.concat(NT(i[o],t,{whitespace:r,breakBefore:o?void 0:a,breakAfter:o<i.length-1?Hd(i[o+1]):l}));return Xg(t)&&Gg(e,t,Xg)&&s.push(" "),a&&s.unshift(a),l&&s.push(l),s}function IT(t,e){const n=String(t.value),r=[],i=[];let o=0;for(;o<=n.length;){Kg.lastIndex=o;const l=Kg.exec(n),u=l&&"index"in l?l.index:n.length;r.push(oB(n.slice(o,u).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),o===0?e.breakBefore:!0,u===n.length?e.breakAfter:!0)),o=u+1}let s=-1,a;for(;++s<r.length;)r[s].charCodeAt(r[s].length-1)===8203||s<r.length-1&&r[s+1].charCodeAt(0)===8203?(i.push(r[s]),a=void 0):r[s]?(typeof a=="number"&&i.push(a),i.push(r[s]),a=0):(s===0||s===r.length-1)&&i.push(0);return i}function iB(t){return[String(t.value)]}function oB(t,e,n){const r=[];let i=0,o;for(;i<t.length;){Qg.lastIndex=i;const s=Qg.exec(t);o=s?s.index:t.length,!i&&!o&&s&&!e&&r.push(""),i!==o&&r.push(t.slice(i,o)),i=s?o+s[0].length:o}return i!==o&&!n&&r.push(""),r.join(" ")}function MT(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function sB(t){return!!(t.properties||{}).hidden}function aB(t){return t.tagName==="td"||t.tagName==="th"}function lB(t){return t.tagName==="dialog"&&!(t.properties||{}).open}function uB(t){const e=String(t);let n=e.length;for(;n>0;){const r=e.codePointAt(n-1);if(r!==void 0&&(r===10||r===13))n--;else break}return e.slice(0,n)}const dc="language-";function ga(t,e){const n=e.children;let r=-1,i,o;if(e.tagName==="pre")for(;++r<n.length;){const a=n[r];if(a.type==="element"&&a.tagName==="code"&&a.properties&&a.properties.className&&Array.isArray(a.properties.className)){i=a.properties.className;break}}if(i){for(r=-1;++r<i.length;)if(String(i[r]).slice(0,dc.length)===dc){o=String(i[r]).slice(dc.length);break}}const s={type:"code",lang:o||null,meta:null,value:uB(Ys(e))};return t.patch(e,s),s}function cB(t,e){const n={type:"html",value:"<!--"+e.value+"-->"};return t.patch(e,n),n}function hc(t,e){const r={type:"delete",children:t.all(e)};return t.patch(e,r),r}function Ff(t){let e=-1;if(t.length>1){for(;++e<t.length;)if(t[e].spread)return!0}return!1}function dB(t,e){const n=[],r=[];let i=-1;for(;++i<e.children.length;){const a=e.children[i];a.type==="element"&&a.tagName==="div"?n.push(...a.children):n.push(a)}let o={definitions:[],titles:[]};for(i=-1;++i<n.length;){const a=n[i];if(a.type==="element"&&a.tagName==="dt"){const l=n[i-1];l&&l.type==="element"&&l.tagName==="dd"&&(r.push(o),o={definitions:[],titles:[]}),o.titles.push(a)}else o.definitions.push(a)}r.push(o),i=-1;const s=[];for(;++i<r.length;){const a=[...Zg(t,r[i].titles),...Zg(t,r[i].definitions)];a.length>0&&s.push({type:"listItem",spread:a.length>1,checked:null,children:a})}if(s.length>0){const a={type:"list",ordered:!1,start:null,spread:Ff(s),children:s};return t.patch(e,a),a}}function Zg(t,e){const n=t.all({type:"root",children:e}),r=t.toSpecificContent(n,hB);return r.length===0?[]:r.length===1?r[0].children:[{type:"list",ordered:!1,start:null,spread:Ff(r),children:r}]}function hB(){return{type:"listItem",spread:!1,checked:null,children:[]}}function ba(t,e){const r={type:"emphasis",children:t.all(e)};return t.patch(e,r),r}function Hf(t){let e=0,n=t.length;for(;e<n&&t[e].type==="break";)e++;for(;n>e&&t[n-1].type==="break";)n--;return e===0&&n===t.length?t:t.slice(e,n)}function Ci(t,e){const n=Number(e.tagName.charAt(1))||1,r=Hf(t.all(e)),i={type:"heading",depth:n,children:r};return t.patch(e,i),i}function fB(t,e){const n={type:"thematicBreak"};return t.patch(e,n),n}function pB(t,e){const n=e.properties||{},r=String(n.src||""),i=String(n.title||"");if(r&&i){const o={type:"link",title:null,url:t.resolve(r),children:[{type:"text",value:i}]};return t.patch(e,o),o}}function e0(t,e){const n=e.properties||{},r={type:"image",url:t.resolve(String(n.src||"")||null),title:n.title?String(n.title):null,alt:n.alt?String(n.alt):""};return t.patch(e,r),r}function Ao(t,e){const n={type:"inlineCode",value:Ys(e)};return t.patch(e,n),n}function OT(t,e){const n=[],r=[],i=e||t.properties||{},o=DT(t),s=Math.min(Number.parseInt(String(i.size),10),0)||(i.multiple?4:1);let a=-1;for(;++a<o.length;){const c=o[a];c&&c.properties&&c.properties.selected&&n.push(c)}const l=n.length>0?n:o,u=Math.min(l.length,s);for(a=-1;++a<u;){const c=l[a],d=c.properties||{},h=Ys(c),f=h||String(d.label||""),p=String(d.value||"")||h;r.push([p,f===p?void 0:f])}return r}function DT(t){const e=[];let n=-1;for(;++n<t.children.length;){const r=t.children[n];"children"in r&&Array.isArray(r.children)&&e.push(...DT(r)),r.type==="element"&&r.tagName==="option"&&(!r.properties||!r.properties.disabled)&&e.push(r)}return e}const mB="[x]",gB="[ ]";function bB(t,e){const n=e.properties||{},r=String(n.value||n.placeholder||"");if(n.disabled||n.type==="hidden"||n.type==="file")return;if(n.type==="checkbox"||n.type==="radio"){const l={type:"text",value:n.checked?t.options.checked||mB:t.options.unchecked||gB};return t.patch(e,l),l}if(n.type==="image"){const l=n.alt||r;if(l){const u={type:"image",url:t.resolve(String(n.src||"")||null),title:String(n.title||"")||null,alt:String(l)};return t.patch(e,u),u}return}let i=[];if(r)i=[[r,void 0]];else if(n.type!=="button"&&n.type!=="file"&&n.type!=="password"&&n.type!=="reset"&&n.type!=="submit"&&n.list){const l=String(n.list),u=t.elementById.get(l);u&&u.tagName==="datalist"&&(i=OT(u,n))}if(i.length===0)return;if(n.type==="password"&&(i[0]=["•".repeat(i[0][0].length),void 0]),n.type==="email"||n.type==="url"){const l=[];let u=-1;for(;++u<i.length;){const c=t.resolve(i[u][0]),d={type:"link",title:null,url:n.type==="email"?"mailto:"+c:c,children:[{type:"text",value:i[u][1]||c}]};l.push(d),u!==i.length-1&&l.push({type:"text",value:", "})}return l}const o=[];let s=-1;for(;++s<i.length;)o.push(i[s][1]?i[s][1]+" ("+i[s][0]+")":i[s][0]);const a={type:"text",value:o.join(", ")};return t.patch(e,a),a}const yB={}.hasOwnProperty;function EB(t,e){const n=t.type==="element"&&yB.call(t.properties,e)&&t.properties[e];return n!=null&&n!==!1}const kB=new Set(["pingback","prefetch","stylesheet"]);function TB(t){if(t.type!=="element"||t.tagName!=="link")return!1;if(t.properties.itemProp)return!0;const e=t.properties.rel;let n=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++n<e.length;)if(!kB.has(String(e[n])))return!1;return!0}const CB=pn(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),SB=pn("meta");function vT(t){return!!(t.type==="text"||CB(t)||mT(t)||TB(t)||SB(t)&&EB(t,"itemProp"))}function fc(t,e){const{rest:n,checkbox:r}=RT(e),i=r?!!r.properties.checked:null,o=LT(n),s=t.toFlow(t.all(n)),a={type:"listItem",spread:o,checked:i,children:s};return t.patch(e,a),a}function LT(t){let e=-1,n=!1;for(;++e<t.children.length;){const r=t.children[e];if(r.type==="element"){if(vT(r))continue;if(r.tagName==="p"||n||LT(r))return!0;n=!0}}return!1}function RT(t){const e=t.children[0];if(e&&e.type==="element"&&e.tagName==="input"&&e.properties&&(e.properties.type==="checkbox"||e.properties.type==="radio")){const n={...t,children:t.children.slice(1)};return{checkbox:e,rest:n}}if(e&&e.type==="element"&&e.tagName==="p"){const{checkbox:n,rest:r}=RT(e);if(n){const i={...t,children:[r,...t.children.slice(1)]};return{checkbox:n,rest:i}}}return{checkbox:void 0,rest:t}}function pc(t,e){const n=e.tagName==="ol",r=t.toSpecificContent(t.all(e),xB);let i=null;n&&(i=e.properties&&e.properties.start?Number.parseInt(String(e.properties.start),10):1);const o={type:"list",ordered:n,start:i,spread:Ff(r),children:r};return t.patch(e,o),o}function xB(){return{type:"listItem",spread:!1,checked:null,children:[]}}const wB={};function Eu(t,e){const n=wB,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return PT(t,r,i)}function PT(t,e,n){if(AB(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return t0(t.children,e,n)}return Array.isArray(t)?t0(t,e,n):""}function t0(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=PT(t[i],e,n);return r.join("")}function AB(t){return!!(t&&typeof t=="object")}const BT=mo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ku(t){let e=-1;for(;++e<t.length;){const n=t[e];if(!UT(n)||"children"in n&&ku(n.children))return!0}return!1}function FT(t){return HT(t,e,function(n){return n});function e(n){return n.every(function(r){return r.type==="text"?Ws(r.value):!1})?[]:[{type:"paragraph",children:Hf(n)}]}}function _B(t){return HT(t.children,e,n);function e(r){const i=mc(t);return i.children=r,[i]}function n(r){if("children"in r&&"children"in t){const i=mc(t),o=mc(r);return i.children=r.children,o.children.push(i),o}return{...r}}}function HT(t,e,n){const r=NB(t),i=[];let o=[],s=-1;for(;++s<r.length;){const a=r[s];UT(a)?o.push(a):(o.length>0&&(i.push(...e(o)),o=[]),i.push(n(a)))}return o.length>0&&(i.push(...e(o)),o=[]),i}function NB(t){const e=[];let n=-1;for(;++n<t.length;){const r=t[n];(r.type==="delete"||r.type==="link")&&ku(r.children)?e.push(..._B(r)):e.push(r)}return e}function UT(t){const e=t.data&&t.data.hName;return e?vT({type:"element",tagName:e,properties:{},children:[]}):BT(t)}function mc(t){return ro({...t,children:[]})}function n0(t,e){const n=e.properties||{},r=e.tagName==="video"?String(n.poster||""):"";let i=String(n.src||""),o=-1,s=!1,a=t.all(e);if(oi({type:"root",children:a},function(d){if(d.type==="link")return s=!0,_l}),s||ku(a))return a;for(;!i&&++o<e.children.length;){const d=e.children[o];d.type==="element"&&d.tagName==="source"&&d.properties&&(i=String(d.properties.src||""))}if(r){const d={type:"image",title:null,url:t.resolve(r),alt:Eu(a)};t.patch(e,d),a=[d]}const u=a,c={type:"link",title:n.title?String(n.title):null,url:t.resolve(i),children:u};return t.patch(e,c),c}function r0(t,e){const n=Hf(t.all(e));if(n.length>0){const r={type:"paragraph",children:n};return t.patch(e,r),r}}const IB=['"'];function MB(t,e){const n=t.options.quotes||IB;t.qNesting++;const r=t.all(e);t.qNesting--;const i=n[t.qNesting%n.length],o=r[0],s=r[r.length-1],a=i.charAt(0),l=i.length>1?i.charAt(1):i;return o&&o.type==="text"?o.value=a+o.value:r.unshift({type:"text",value:a}),s&&s.type==="text"?s.value+=l:r.push({type:"text",value:l}),r}function OB(t,e){let n=t.all(e);(t.options.document||ku(n))&&(n=FT(n));const r={type:"root",children:n};return t.patch(e,r),r}function DB(t,e){const n=OT(e);let r=-1;const i=[];for(;++r<n.length;){const o=n[r];i.push(o[1]?o[1]+" ("+o[0]+")":o[0])}if(i.length>0){const o={type:"text",value:i.join(", ")};return t.patch(e,o),o}}function i0(t,e){const r={type:"strong",children:t.all(e)};return t.patch(e,r),r}function o0(t,e){const r={type:"tableCell",children:t.all(e)};if(t.patch(e,r),e.properties){const i=e.properties.rowSpan,o=e.properties.colSpan;if(i||o){const s=r.data||(r.data={});i&&(s.hastUtilToMdastTemporaryRowSpan=i),o&&(s.hastUtilToMdastTemporaryColSpan=o)}}return r}function vB(t,e){const r={type:"tableRow",children:t.toSpecificContent(t.all(e),LB)};return t.patch(e,r),r}function LB(){return{type:"tableCell",children:[]}}function RB(t,e){if(t.inTable){const u={type:"text",value:Ys(e)};return t.patch(e,u),u}t.inTable=!0;const{align:n,headless:r}=PB(e),i=t.toSpecificContent(t.all(e),s0);r&&i.unshift(s0());let o=-1;for(;++o<i.length;){const u=i[o],c=t.toSpecificContent(u.children,BB);u.children=c}let s=1;for(o=-1;++o<i.length;){const u=i[o].children;let c=-1;for(;++c<u.length;){const d=u[c];if(d.data){const h=d.data,f=Number.parseInt(String(h.hastUtilToMdastTemporaryColSpan),10)||1,p=Number.parseInt(String(h.hastUtilToMdastTemporaryRowSpan),10)||1;if(f>1||p>1){let g=o-1;for(;++g<o+p;){let y=c-1;for(;++y<c+f&&i[g];){const b=[];(g!==o||y!==c)&&b.push({type:"tableCell",children:[]}),i[g].children.splice(y,0,...b)}}}"hastUtilToMdastTemporaryColSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryColSpan,"hastUtilToMdastTemporaryRowSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryRowSpan,Object.keys(d.data).length===0&&delete d.data}}u.length>s&&(s=u.length)}for(o=-1;++o<i.length;){const u=i[o].children;let c=u.length-1;for(;++c<s;)u.push({type:"tableCell",children:[]})}let a=n.length-1;for(;++a<s;)n.push(null);t.inTable=!1;const l={type:"table",align:n,children:i};return t.patch(e,l),l}function PB(t){const e={align:[null],headless:!0};let n=0,r=0;return oi(t,function(i){if(i.type==="element"){if(i.tagName==="table"&&t!==i)return TT;if((i.tagName==="th"||i.tagName==="td")&&i.properties){if(!e.align[r]){const o=String(i.properties.align||"")||null;(o==="center"||o==="left"||o==="right"||o===null)&&(e.align[r]=o)}e.headless&&n<2&&i.tagName==="th"&&(e.headless=!1),r++}else i.tagName==="thead"?e.headless=!1:i.tagName==="tr"&&(n++,r=0)}}),e}function BB(){return{type:"tableCell",children:[]}}function s0(){return{type:"tableRow",children:[]}}function FB(t,e){const n={type:"text",value:e.value};return t.patch(e,n),n}function HB(t,e){const n={type:"text",value:Ys(e)};return t.patch(e,n),n}function UB(t,e){const n={type:"text",value:"​"};return t.patch(e,n),n}const $B={comment:cB,doctype:te,root:OB,text:FB},zB={applet:te,area:te,basefont:te,bgsound:te,caption:te,col:te,colgroup:te,command:te,content:te,datalist:te,dialog:te,element:te,embed:te,frame:te,frameset:te,isindex:te,keygen:te,link:te,math:te,menu:te,menuitem:te,meta:te,nextid:te,noembed:te,noframes:te,optgroup:te,option:te,param:te,script:te,shadow:te,source:te,spacer:te,style:te,svg:te,template:te,title:te,track:te,abbr:ee,acronym:ee,bdi:ee,bdo:ee,big:ee,blink:ee,button:ee,canvas:ee,cite:ee,data:ee,details:ee,dfn:ee,font:ee,ins:ee,label:ee,map:ee,marquee:ee,meter:ee,nobr:ee,noscript:ee,object:ee,output:ee,progress:ee,rb:ee,rbc:ee,rp:ee,rt:ee,rtc:ee,ruby:ee,slot:ee,small:ee,span:ee,sup:ee,sub:ee,tbody:ee,tfoot:ee,thead:ee,time:ee,address:ve,article:ve,aside:ve,body:ve,center:ve,div:ve,fieldset:ve,figcaption:ve,figure:ve,form:ve,footer:ve,header:ve,hgroup:ve,html:ve,legend:ve,main:ve,multicol:ve,nav:ve,picture:ve,section:ve,a:XP,audio:n0,b:i0,base:JP,blockquote:ZP,br:eB,code:Ao,dir:pc,dl:dB,dt:fc,dd:fc,del:hc,em:ba,h1:Ci,h2:Ci,h3:Ci,h4:Ci,h5:Ci,h6:Ci,hr:fB,i:ba,iframe:pB,img:e0,image:e0,input:bB,kbd:Ao,li:fc,listing:ga,mark:ba,ol:pc,p:r0,plaintext:ga,pre:ga,q:MB,s:hc,samp:Ao,select:DB,strike:hc,strong:i0,summary:r0,table:RB,td:o0,textarea:HB,th:o0,tr:vB,tt:Ao,u:ba,ul:pc,var:Ao,video:n0,wbr:UB,xmp:ga};function ee(t,e){return t.all(e)}function ve(t,e){return t.toFlow(t.all(e))}function te(){}const a0={}.hasOwnProperty;function VB(t){return{all:qB,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...zB,...t.handlers},inTable:!1,nodeHandlers:{...$B,...t.nodeHandlers},one:jB,options:t,patch:WB,qNesting:0,resolve:YB,toFlow:GB,toSpecificContent:KB}}function qB(t){const e=t.children||[],n=[];let r=-1;for(;++r<e.length;){const i=e[r],o=this.one(i,t);Array.isArray(o)?n.push(...o):o&&n.push(o)}return n}function jB(t,e){if(t.type==="element"){if(t.properties&&t.properties.dataMdast==="ignore")return;if(a0.call(this.handlers,t.tagName))return this.handlers[t.tagName](this,t,e)||void 0}else if(a0.call(this.nodeHandlers,t.type))return this.nodeHandlers[t.type](this,t,e)||void 0;if("value"in t&&typeof t.value=="string"){const n={type:"text",value:t.value};return this.patch(t,n),n}if("children"in t)return this.all(t)}function WB(t,e){t.position&&(e.position=AT(t))}function YB(t){const e=this.frozenBaseUrl;return t==null?"":e?String(new URL(t,e)):t}function GB(t){return FT(t)}function KB(t,e){const n=e(),r=[];let i=[],o=-1;for(;++o<t.length;){const a=t[o];if(s(a))i.length>0&&(a.children.unshift(...i),i=[]),r.push(a);else{const l=a;i.push(l)}}if(i.length>0){let a=r[r.length-1];a||(a=e(),r.push(a)),a.children.push(...i),i=[]}return r;function s(a){return a.type===n.type}}const QB={};function l0(t,e){const n=ro(t),r=e||QB,i=GP({newlines:r.newlines===!0}),o=VB(r);let s;i(n),oi(n,function(l){if(l&&l.type==="element"&&l.properties){const u=String(l.properties.id||"")||void 0;u&&!o.elementById.has(u)&&o.elementById.set(u,l)}});const a=o.one(n,void 0);return a?Array.isArray(a)?s={type:"root",children:a}:s=a:s={type:"root",children:[]},oi(s,function(l,u,c){if(l.type==="text"&&u!==void 0&&c){const d=c.children[u-1];if(d&&d.type===l.type)return d.value+=l.value,c.children.splice(u,1),d.position&&l.position&&(d.position.end=l.position.end),u-1;if(l.value=l.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),c&&(c.type==="heading"||c.type==="paragraph"||c.type==="root")&&(u||(l.value=l.value.replace(/^[\t ]+/,"")),u===c.children.length-1&&(l.value=l.value.replace(/[\t ]+$/,""))),!l.value)return c.children.splice(u,1),u}}),s}const u0={document:!0};function XB(t,e){return t&&"run"in t?async function(n,r){const i=l0(n,{...u0,...e});await t.run(i,r)}:function(n){return l0(n,{...u0,...t})}}function Nl(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}const dt=Nr(/[A-Za-z]/),ot=Nr(/[\dA-Za-z]/),JB=Nr(/[#-'*+\--9=?A-Z^-~]/);function Il(t){return t!==null&&(t<32||t===127)}const Ud=Nr(/\d/),ZB=Nr(/[\dA-Fa-f]/),e4=Nr(/[!-/:-@[-`{-~]/);function Y(t){return t!==null&&t<-2}function ke(t){return t!==null&&(t<0||t===32)}function oe(t){return t===-2||t===-1||t===32}const Tu=Nr(new RegExp("\\p{P}|\\p{S}","u")),si=Nr(/\s/);function Nr(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function t4(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function n4(t,e,n){const i=mo((n||{}).ignore||[]),o=r4(e);let s=-1;for(;++s<o.length;)CT(t,"text",a);function a(u,c){let d=-1,h;for(;++d<c.length;){const f=c[d],p=h?h.children:void 0;if(i(f,p?p.indexOf(f):void 0,h))return;h=f}if(h)return l(u,c)}function l(u,c){const d=c[c.length-1],h=o[s][0],f=o[s][1];let p=0;const y=d.children.indexOf(u);let b=!1,C=[];h.lastIndex=0;let w=h.exec(u.value);for(;w;){const v=w.index,O={index:w.index,input:w.input,stack:[...c,u]};let _=f(...w,O);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?h.lastIndex=v+1:(p!==v&&C.push({type:"text",value:u.value.slice(p,v)}),Array.isArray(_)?C.push(..._):_&&C.push(_),p=v+w[0].length,b=!0),!h.global)break;w=h.exec(u.value)}return b?(p<u.value.length&&C.push({type:"text",value:u.value.slice(p)}),d.children.splice(y,1,...C)):C=[u],y+C.length}}function r4(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const i=n[r];e.push([i4(i[0]),o4(i[1])])}return e}function i4(t){return typeof t=="string"?new RegExp(t4(t),"g"):t}function o4(t){return typeof t=="function"?t:function(){return t}}const gc="phrasing",bc=["autolink","link","image","label"];function s4(){return{transforms:[f4],enter:{literalAutolink:l4,literalAutolinkEmail:yc,literalAutolinkHttp:yc,literalAutolinkWww:yc},exit:{literalAutolink:h4,literalAutolinkEmail:d4,literalAutolinkHttp:u4,literalAutolinkWww:c4}}}function a4(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gc,notInConstruct:bc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gc,notInConstruct:bc},{character:":",before:"[ps]",after:"\\/",inConstruct:gc,notInConstruct:bc}]}}function l4(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function yc(t){this.config.enter.autolinkProtocol.call(this,t)}function u4(t){this.config.exit.autolinkProtocol.call(this,t)}function c4(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function d4(t){this.config.exit.autolinkEmail.call(this,t)}function h4(t){this.exit(t)}function f4(t){n4(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,p4],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),m4]],{ignore:["link","linkReference"]})}function p4(t,e,n,r,i){let o="";if(!$T(i)||(/^w/i.test(e)&&(n=e+n,e="",o="http://"),!g4(n)))return!1;const s=b4(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:o+e+s[0],children:[{type:"text",value:e+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function m4(t,e,n,r){return!$T(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function g4(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function b4(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=Nl(t,"(");let o=Nl(t,")");for(;r!==-1&&i>o;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[t,n]}function $T(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||si(n)||Tu(n))&&(!e||n!==47)}function on(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}zT.peek=A4;function y4(){this.buffer()}function E4(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function k4(){this.buffer()}function T4(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function C4(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=on(this.sliceSerialize(t)).toLowerCase(),n.label=e}function S4(t){this.exit(t)}function x4(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=on(this.sliceSerialize(t)).toLowerCase(),n.label=e}function w4(t){this.exit(t)}function A4(){return"["}function zT(t,e,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(t),{after:"]",before:o})),a(),s(),o+=i.move("]"),o}function _4(){return{enter:{gfmFootnoteCallString:y4,gfmFootnoteCall:E4,gfmFootnoteDefinitionLabelString:k4,gfmFootnoteDefinition:T4},exit:{gfmFootnoteCallString:C4,gfmFootnoteCall:S4,gfmFootnoteDefinitionLabelString:x4,gfmFootnoteDefinition:w4}}}function N4(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:zT},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,s){const a=o.createTracker(s);let l=a.move("[^");const u=o.enter("footnoteDefinition"),c=o.enter("label");return l+=a.move(o.safe(o.associationId(r),{before:l,after:"]"})),c(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
120
+ `:" ")+o.indentLines(o.containerFlow(r,a.current()),e?VT:I4))),u(),l}}function I4(t,e,n){return e===0?t:VT(t,e,n)}function VT(t,e,n){return(n?"":" ")+t}const M4=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qT.peek=R4;function O4(){return{canContainEols:["delete"],enter:{strikethrough:v4},exit:{strikethrough:L4}}}function D4(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:M4}],handlers:{delete:qT}}}function v4(t){this.enter({type:"delete",children:[]},t)}function L4(t){this.exit(t)}function qT(t,e,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(t,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function R4(){return"~"}function P4(t){return t.length}function B4(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||P4,o=[],s=[],a=[],l=[];let u=0,c=-1;for(;++c<t.length;){const g=[],y=[];let b=-1;for(t[c].length>u&&(u=t[c].length);++b<t[c].length;){const C=F4(t[c][b]);if(n.alignDelimiters!==!1){const w=i(C);y[b]=w,(l[b]===void 0||w>l[b])&&(l[b]=w)}g.push(C)}s[c]=g,a[c]=y}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<u;)o[d]=c0(r[d]);else{const g=c0(r);for(;++d<u;)o[d]=g}d=-1;const h=[],f=[];for(;++d<u;){const g=o[d];let y="",b="";g===99?(y=":",b=":"):g===108?y=":":g===114&&(b=":");let C=n.alignDelimiters===!1?1:Math.max(1,l[d]-y.length-b.length);const w=y+"-".repeat(C)+b;n.alignDelimiters!==!1&&(C=y.length+C+b.length,C>l[d]&&(l[d]=C),f[d]=C),h[d]=w}s.splice(1,0,h),a.splice(1,0,f),c=-1;const p=[];for(;++c<s.length;){const g=s[c],y=a[c];d=-1;const b=[];for(;++d<u;){const C=g[d]||"";let w="",v="";if(n.alignDelimiters!==!1){const O=l[d]-(y[d]||0),_=o[d];_===114?w=" ".repeat(O):_===99?O%2?(w=" ".repeat(O/2+.5),v=" ".repeat(O/2-.5)):(w=" ".repeat(O/2),v=w):v=" ".repeat(O)}n.delimiterStart!==!1&&!d&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||d)&&b.push(" "),n.alignDelimiters!==!1&&b.push(w),b.push(C),n.alignDelimiters!==!1&&b.push(v),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||d!==u-1)&&b.push("|")}p.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
121
+ `)}function F4(t){return t==null?"":String(t)}function c0(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}const d0={}.hasOwnProperty;function jT(t,e){const n=e||{};function r(i,...o){let s=r.invalid;const a=r.handlers;if(i&&d0.call(i,t)){const l=String(i[t]);s=d0.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const H4={}.hasOwnProperty;function WT(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)WT(t,e.extensions[n]);for(r in e)if(H4.call(e,r))switch(r){case"extensions":break;case"unsafe":{h0(t[r],e[r]);break}case"join":{h0(t[r],e[r]);break}case"handlers":{U4(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function h0(t,e){e&&t.push(...e)}function U4(t,e){e&&Object.assign(t,e)}function $4(t,e,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const s=n.indentLines(n.containerFlow(t,o.current()),z4);return i(),s}function z4(t,e,n){return">"+(n?"":" ")+t}function YT(t,e){return f0(t,e.inConstruct,!0)&&!f0(t,e.notInConstruct,!1)}function f0(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function p0(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
122
+ `&&YT(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
123
+ `}function V4(t,e){const n=String(t);let r=n.indexOf(e),i=r,o=0,s=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>s&&(s=o):o=1,i=r+e.length,r=n.indexOf(e,i);return s}function $d(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function q4(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function j4(t,e,n,r){const i=q4(n),o=t.value||"",s=i==="`"?"GraveAccent":"Tilde";if($d(t,n)){const d=n.enter("codeIndented"),h=n.indentLines(o,W4);return d(),h}const a=n.createTracker(r),l=i.repeat(Math.max(V4(o,i)+1,3)),u=n.enter("codeFenced");let c=a.move(l);if(t.lang){const d=n.enter(`codeFencedLang${s}`);c+=a.move(n.safe(t.lang,{before:c,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${s}`);c+=a.move(" "),c+=a.move(n.safe(t.meta,{before:c,after:`
124
+ `,encode:["`"],...a.current()})),d()}return c+=a.move(`
125
+ `),o&&(c+=a.move(o+`
126
+ `)),c+=a.move(l),u(),c}function W4(t,e,n){return(n?"":" ")+t}function Uf(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function Y4(t,e,n,r){const i=Uf(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(t),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(t.url,{before:u,after:t.title?" ":`
127
+ `,...l.current()}))),a(),t.title&&(a=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),s(),u}function G4(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Sr(t){return"&#x"+t.toString(16).toUpperCase()+";"}function io(t){if(t===null||ke(t)||si(t))return 1;if(Tu(t))return 2}function Ml(t,e,n){const r=io(t),i=io(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}GT.peek=K4;function GT(t,e,n,r){const i=G4(n),o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);let l=s.move(n.containerPhrasing(t,{after:i,before:a,...s.current()}));const u=l.charCodeAt(0),c=Ml(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Sr(u)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Ml(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Sr(d));const f=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+f}function K4(t,e,n){return n.options.emphasis||"*"}function KT(t,e){let n=!1;return oi(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,_l}),!!((!t.depth||t.depth<3)&&Eu(t)&&(e.options.setext||n))}function Q4(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),o=n.createTracker(r);if(KT(t,n)){const c=n.enter("headingSetext"),d=n.enter("phrasing"),h=n.containerPhrasing(t,{...o.current(),before:`
128
+ `,after:`
129
+ `});return d(),c(),h+`
130
+ `+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
131
+ `))+1))}const s="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let u=n.containerPhrasing(t,{before:"# ",after:`
132
+ `,...o.current()});return/^[\t ]/.test(u)&&(u=Sr(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),l(),a(),u}QT.peek=X4;function QT(t){return t.value||""}function X4(){return"<"}XT.peek=J4;function XT(t,e,n,r){const i=Uf(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(t.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(t.url,{before:u,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),s(),u}function J4(){return"!"}JT.peek=Z4;function JT(t,e,n,r){const i=t.referenceType,o=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),s();const c=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return s(),n.stack=c,o(),i==="full"||!u||u!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Z4(){return"!"}ZT.peek=e5;function ZT(t,e,n){let r=t.value||"",i="`",o=-1;for(;new 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;){const s=n.unsafe[o],a=n.compilePattern(s);let l;if(s.atBreak)for(;l=a.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return i+r+i}function e5(){return"`"}function eC(t,e){const n=Eu(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}tC.peek=t5;function tC(t,e,n,r){const i=Uf(n),o=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(eC(t,n)){const c=n.stack;n.stack=[],a=n.enter("autolink");let d=s.move("<");return d+=s.move(n.containerPhrasing(t,{before:d,after:">",...s.current()})),d+=s.move(">"),a(),n.stack=c,d}a=n.enter("link"),l=n.enter("label");let u=s.move("[");return u+=s.move(n.containerPhrasing(t,{before:u,after:"](",...s.current()})),u+=s.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(t.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=n.enter("destinationRaw"),u+=s.move(n.safe(t.url,{before:u,after:t.title?" ":")",...s.current()}))),l(),t.title&&(l=n.enter(`title${o}`),u+=s.move(" "+i),u+=s.move(n.safe(t.title,{before:u,after:i,...s.current()})),u+=s.move(i),l()),u+=s.move(")"),a(),u}function t5(t,e,n){return eC(t,n)?"<":"["}nC.peek=n5;function nC(t,e,n,r){const i=t.referenceType,o=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),s();const c=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return s(),n.stack=c,o(),i==="full"||!u||u!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function n5(){return"["}function $f(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function r5(t){const e=$f(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function i5(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function rC(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function o5(t,e,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=t.ordered?i5(n):$f(n);const a=t.ordered?s==="."?")":".":r5(n);let l=e&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!t.ordered){const c=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),rC(n)===s&&c){let d=-1;for(;++d<t.children.length;){const h=t.children[d];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(s=a),n.bulletCurrent=s;const u=n.containerFlow(t,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),u}function s5(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function a5(t,e,n,r){const i=s5(n);let o=n.bulletCurrent||$f(n);e&&e.type==="list"&&e.ordered&&(o=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+o);let s=o.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(s=Math.ceil(s/4)*4);const a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(t,a.current()),c);return l(),u;function c(d,h,f){return h?(f?"":" ".repeat(s))+d:(f?o:o+" ".repeat(s-o.length))+d}}function l5(t,e,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(t,r);return o(),i(),s}function u5(t,e,n,r){return(t.children.some(function(s){return BT(s)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function c5(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}iC.peek=d5;function iC(t,e,n,r){const i=c5(n),o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);let l=s.move(n.containerPhrasing(t,{after:i,before:a,...s.current()}));const u=l.charCodeAt(0),c=Ml(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Sr(u)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Ml(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Sr(d));const f=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+f}function d5(t,e,n){return n.options.strong||"*"}function h5(t,e,n,r){return n.safe(t.value,r)}function f5(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function p5(t,e,n){const r=(rC(n)+(n.options.ruleSpaces?" ":"")).repeat(f5(n));return n.options.ruleSpaces?r.slice(0,-1):r}const zf={blockquote:$4,break:p0,code:j4,definition:Y4,emphasis:GT,hardBreak:p0,heading:Q4,html:QT,image:XT,imageReference:JT,inlineCode:ZT,link:tC,linkReference:nC,list:o5,listItem:a5,paragraph:l5,root:u5,strong:iC,text:h5,thematicBreak:p5},m5=[g5];function g5(t,e,n,r){if(e.type==="code"&&$d(e,r)&&(t.type==="list"||t.type===e.type&&$d(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&KT(e,r))?void 0:n.spread?1:0}const Or=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],b5=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
133
+ `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:Or},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
134
+ ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:Or},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
135
+ *])`},{character:"*",inConstruct:"phrasing",notInConstruct:Or},{atBreak:!0,character:"+",after:`(?:[ \r
136
+ ])`},{atBreak:!0,character:"-",after:`(?:[ \r
137
+ -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
138
+ ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:Or},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:Or},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:Or},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:Or},{atBreak:!0,character:"~"}],m0=document.createElement("i");function Vf(t){const e="&"+t+";";m0.innerHTML=e;const n=m0.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function oC(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const y5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sC(t){return t.replace(y5,E5)}function E5(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return oC(n.slice(o?2:1),o?16:10)}return Vf(n)||t}function k5(t){return t.label||!t.identifier?t.label||"":sC(t.identifier)}function T5(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function C5(t,e,n){const r=e.indexStack,i=t.children||[],o=[];let s=-1,a=n.before,l;r.push(-1);let u=e.createTracker(n);for(;++s<i.length;){const c=i[s];let d;if(r[r.length-1]=s,s+1<i.length){let p=e.handle.handlers[i[s+1].type];p&&p.peek&&(p=p.peek),d=p?p(i[s+1],t,e,{before:"",after:"",...u.current()}).charAt(0):""}else d=n.after;o.length>0&&(a==="\r"||a===`
139
+ `)&&c.type==="html"&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),a=" ",u=e.createTracker(n),u.move(o.join("")));let h=e.handle(c,t,e,{...u.current(),after:d,before:a});l&&l===h.slice(0,1)&&(h=Sr(l.charCodeAt(0))+h.slice(1));const f=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,l=void 0,f&&(o.length>0&&f.before&&a===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+Sr(a.charCodeAt(0))),f.after&&(l=d)),u.move(h),o.push(h),a=h.slice(-1)}return r.pop(),o.join("")}function S5(t,e,n){const r=e.indexStack,i=t.children||[],o=e.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<i.length;){const l=i[a];r[r.length-1]=a,s.push(o.move(e.handle(l,t,e,{before:`
140
+ `,after:`
141
+ `,...o.current()}))),l.type!=="list"&&(e.bulletLastUsed=void 0),a<i.length-1&&s.push(o.move(x5(l,i[a+1],t,e)))}return r.pop(),s.join("")}function x5(t,e,n,r){let i=r.join.length;for(;i--;){const o=r.join[i](t,e,n,r);if(o===!0||o===1)break;if(typeof o=="number")return`
142
+ `.repeat(1+o);if(o===!1)return`
143
+
144
+ <!---->
145
+
146
+ `}return`
147
+
148
+ `}const w5=/\r?\n|\r/g;function A5(t,e){const n=[];let r=0,i=0,o;for(;o=w5.exec(t);)s(t.slice(r,o.index)),n.push(o[0]),r=o.index+o[0].length,i++;return s(t.slice(r)),n.join("");function s(a){n.push(e(a,i,!a))}}function _5(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),i=[],o=[],s={};let a=-1;for(;++a<t.unsafe.length;){const c=t.unsafe[a];if(!YT(t.stack,c))continue;const d=t.compilePattern(c);let h;for(;h=d.exec(r);){const f="before"in c||!!c.atBreak,p="after"in c,g=h.index+(f?h[1].length:0);i.includes(g)?(s[g].before&&!f&&(s[g].before=!1),s[g].after&&!p&&(s[g].after=!1)):(i.push(g),s[g]={before:f,after:p})}}i.sort(N5);let l=n.before?n.before.length:0;const u=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){const c=i[a];c<l||c>=u||c+1<u&&i[a+1]===c+1&&s[c].after&&!s[c+1].before&&!s[c+1].after||i[a-1]===c-1&&s[c].before&&!s[c-1].before&&!s[c-1].after||(l!==c&&o.push(g0(r.slice(l,c),"\\")),l=c,/[!-/:-@[-`{-~]/.test(r.charAt(c))&&(!n.encode||!n.encode.includes(r.charAt(c)))?o.push("\\"):(o.push(Sr(r.charCodeAt(c))),l++))}return o.push(g0(r.slice(l,u),n.after)),o.join("")}function N5(t,e){return t-e}function g0(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],o=t+e;let s=-1,a=0,l;for(;l=n.exec(o);)r.push(l.index);for(;++s<r.length;)a!==r[s]&&i.push(t.slice(a,r[s])),i.push("\\"),a=r[s];return i.push(t.slice(a)),i.join("")}function I5(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,i=n.line||1,o=n.column||1;return{move:l,current:s,shift:a};function s(){return{now:{line:i,column:o},lineShift:r}}function a(u){r+=u}function l(u){const c=u||"",d=c.split(/\r?\n|\r/g),h=d[d.length-1];return i+=d.length-1,o=d.length===1?o+h.length:1+h.length+r,c}}function M5(t,e){const n=e||{},r={associationId:k5,containerPhrasing:L5,containerFlow:R5,createTracker:I5,compilePattern:T5,enter:o,handlers:{...zf},handle:void 0,indentLines:A5,indexStack:[],join:[...m5],options:{},safe:P5,stack:[],unsafe:[...b5]};WT(r,n),r.options.tightDefinitions&&r.join.push(v5),r.handle=jT("type",{invalid:O5,unknown:D5,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
149
+ `,after:`
150
+ `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
151
+ `),i;function o(s){return r.stack.push(s),a;function a(){r.stack.pop()}}}function O5(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function D5(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function v5(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function L5(t,e){return C5(t,this,e)}function R5(t,e){return S5(t,this,e)}function P5(t,e){return _5(this,t,e)}function B5(){return{enter:{table:F5,tableData:b0,tableHeader:b0,tableRow:U5},exit:{codeText:$5,table:H5,tableData:Ec,tableHeader:Ec,tableRow:Ec}}}function F5(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function H5(t){this.exit(t),this.data.inTable=void 0}function U5(t){this.enter({type:"tableRow",children:[]},t)}function Ec(t){this.exit(t)}function b0(t){this.enter({type:"tableCell",children:[]},t)}function $5(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,z5));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function z5(t,e){return e==="|"?e:t}function V5(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
152
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:s,tableCell:l,tableRow:a}};function s(f,p,g,y){return u(c(f,g,y),f.align)}function a(f,p,g,y){const b=d(f,g,y),C=u([b]);return C.slice(0,C.indexOf(`
153
+ `))}function l(f,p,g,y){const b=g.enter("tableCell"),C=g.enter("phrasing"),w=g.containerPhrasing(f,{...y,before:o,after:o});return C(),b(),w}function u(f,p){return B4(f,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function c(f,p,g){const y=f.children;let b=-1;const C=[],w=p.enter("table");for(;++b<y.length;)C[b]=d(y[b],p,g);return w(),C}function d(f,p,g){const y=f.children;let b=-1;const C=[],w=p.enter("tableRow");for(;++b<y.length;)C[b]=l(y[b],f,p,g);return w(),C}function h(f,p,g){let y=zf.inlineCode(f,p,g);return g.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function q5(){return{exit:{taskListCheckValueChecked:y0,taskListCheckValueUnchecked:y0,paragraph:W5}}}function j5(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y5}}}function y0(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function W5(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let o=-1,s;for(;++o<i.length;){const a=i[o];if(a.type==="paragraph"){s=a;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Y5(t,e,n,r){const i=t.children[0],o=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);o&&a.move(s);let l=zf.listItem(t,e,n,{...r,...a.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+s}}function G5(){return[s4(),_4(),O4(),B5(),q5()]}function K5(t){return{extensions:[a4(),N4(t),D4(),V5(t),j5()]}}function vt(t,e,n,r){const i=t.length;let o=0,s;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(e,0),t.splice(...s),o+=1e4,e+=1e4}function Ht(t,e){return t.length>0?(vt(t,t.length,0,e),t):e}const E0={}.hasOwnProperty;function aC(t){const e={};let n=-1;for(;++n<t.length;)Q5(e,t[n]);return e}function Q5(t,e){let n;for(n in e){const i=(E0.call(t,n)?t[n]:void 0)||(t[n]={}),o=e[n];let s;if(o)for(s in o){E0.call(i,s)||(i[s]=[]);const a=o[s];X5(i[s],Array.isArray(a)?a:a?[a]:[])}}}function X5(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);vt(t,0,0,r)}const J5={tokenize:i8,partial:!0},lC={tokenize:o8,partial:!0},uC={tokenize:s8,partial:!0},cC={tokenize:a8,partial:!0},Z5={tokenize:l8,partial:!0},dC={name:"wwwAutolink",tokenize:n8,previous:fC},hC={name:"protocolAutolink",tokenize:r8,previous:pC},Gn={name:"emailAutolink",tokenize:t8,previous:mC},Nn={};function e8(){return{text:Nn}}let Dr=48;for(;Dr<123;)Nn[Dr]=Gn,Dr++,Dr===58?Dr=65:Dr===91&&(Dr=97);Nn[43]=Gn;Nn[45]=Gn;Nn[46]=Gn;Nn[95]=Gn;Nn[72]=[Gn,hC];Nn[104]=[Gn,hC];Nn[87]=[Gn,dC];Nn[119]=[Gn,dC];function t8(t,e,n){const r=this;let i,o;return s;function s(d){return!zd(d)||!mC.call(r,r.previous)||qf(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return zd(d)?(t.consume(d),a):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(Z5,c,u)(d):d===45||d===95||ot(d)?(o=!0,t.consume(d),l):c(d)}function u(d){return t.consume(d),i=!0,l}function c(d){return o&&i&&dt(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function n8(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!fC.call(r,r.previous)||qf(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(J5,t.attempt(lC,t.attempt(uC,o),n),n)(s))}function o(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function r8(t,e,n){const r=this;let i="",o=!1;return s;function s(d){return(d===72||d===104)&&pC.call(r,r.previous)&&!qf(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):n(d)}function a(d){if(dt(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const h=i.toLowerCase();if(h==="http"||h==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),o?u:(o=!0,l)):n(d)}function u(d){return d===null||Il(d)||ke(d)||si(d)||Tu(d)?n(d):t.attempt(lC,t.attempt(uC,c),n)(d)}function c(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function i8(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),o):n(s)}function o(s){return s===null?n(s):e(s)}}function o8(t,e,n){let r,i,o;return s;function s(u){return u===46||u===95?t.check(cC,l,a)(u):u===null||ke(u)||si(u)||u!==45&&Tu(u)?l(u):(o=!0,t.consume(u),s)}function a(u){return u===95?r=!0:(i=r,r=void 0),t.consume(u),s}function l(u){return i||r||!o?n(u):e(u)}}function s8(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?o(s):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?t.check(cC,e,o)(s):s===null||ke(s)||si(s)?e(s):(t.consume(s),i)}function o(s){return s===41&&r++,t.consume(s),i}}function a8(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),o):a===93?(t.consume(a),i):a===60||a===null||ke(a)||si(a)?e(a):n(a)}function i(a){return a===null||a===40||a===91||ke(a)||si(a)?e(a):r(a)}function o(a){return dt(a)?s(a):n(a)}function s(a){return a===59?(t.consume(a),r):dt(a)?(t.consume(a),s):n(a)}}function l8(t,e,n){return r;function r(o){return t.consume(o),i}function i(o){return ot(o)?n(o):e(o)}}function fC(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ke(t)}function pC(t){return!dt(t)}function mC(t){return!(t===47||zd(t))}function zd(t){return t===43||t===45||t===46||t===95||ot(t)}function qf(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function go(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const o=t.charCodeAt(n);let s="";if(o===37&&ot(t.charCodeAt(n+1))&&ot(t.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){const a=t.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Cu(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const o=t[i].resolveAll;o&&!r.includes(o)&&(e=o(e,n),r.push(o))}return e}const Vd={name:"attention",resolveAll:u8,tokenize:c8};function u8(t,e){let n=-1,r,i,o,s,a,l,u,c;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const d={...t[r][1].end},h={...t[n][1].start};k0(d,-l),k0(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:h},o={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},t[r][1].end={...s.start},t[n][1].start={...a.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=Ht(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=Ht(u,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",o,e]]),u=Ht(u,Cu(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=Ht(u,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=Ht(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,vt(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function c8(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=io(r);let o;return s;function s(l){return o=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===o)return t.consume(l),a;const u=t.exit("attentionSequence"),c=io(l),d=!c||c===2&&i||n.includes(l),h=!i||i===2&&c||n.includes(r);return u._open=!!(o===42?d:d&&(i||!h)),u._close=!!(o===42?h:h&&(c||!d)),e(l)}}function k0(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const d8={name:"autolink",tokenize:h8};function h8(t,e,n){let r=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),o}function o(f){return dt(f)?(t.consume(f),s):f===64?n(f):u(f)}function s(f){return f===43||f===45||f===46||ot(f)?(r=1,a(f)):u(f)}function a(f){return f===58?(t.consume(f),r=0,l):(f===43||f===45||f===46||ot(f))&&r++<32?(t.consume(f),a):(r=0,u(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Il(f)?n(f):(t.consume(f),l)}function u(f){return f===64?(t.consume(f),c):JB(f)?(t.consume(f),u):n(f)}function c(f){return ot(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),r=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||ot(f))&&r++<63){const p=f===45?h:d;return t.consume(f),p}return n(f)}}function ue(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return oe(l)?(t.enter(n),a(l)):e(l)}function a(l){return oe(l)&&o++<i?(t.consume(l),a):(t.exit(n),e(l))}}const Gs={partial:!0,tokenize:f8};function f8(t,e,n){return r;function r(o){return oe(o)?ue(t,i,"linePrefix")(o):i(o)}function i(o){return o===null||Y(o)?e(o):n(o)}}const gC={continuation:{tokenize:m8},exit:g8,name:"blockQuote",tokenize:p8};function p8(t,e,n){const r=this;return i;function i(s){if(s===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),o}return n(s)}function o(s){return oe(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}function m8(t,e,n){const r=this;return i;function i(s){return oe(s)?ue(t,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return t.attempt(gC,e,n)(s)}}function g8(t){t.exit("blockQuote")}const bC={name:"characterEscape",tokenize:b8};function b8(t,e,n){return r;function r(o){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(o),t.exit("escapeMarker"),i}function i(o){return e4(o)?(t.enter("characterEscapeValue"),t.consume(o),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(o)}}const yC={name:"characterReference",tokenize:y8};function y8(t,e,n){const r=this;let i=0,o,s;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),o=31,s=ot,c(d))}function u(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),o=6,s=ZB,c):(t.enter("characterReferenceValue"),o=7,s=Ud,c(d))}function c(d){if(d===59&&i){const h=t.exit("characterReferenceValue");return s===ot&&!Vf(r.sliceSerialize(h))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return s(d)&&i++<o?(t.consume(d),c):n(d)}}const T0={partial:!0,tokenize:k8},C0={concrete:!0,name:"codeFenced",tokenize:E8};function E8(t,e,n){const r=this,i={partial:!0,tokenize:O};let o=0,s=0,a;return l;function l(_){return u(_)}function u(_){const R=r.events[r.events.length-1];return o=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,a=_,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),c(_)}function c(_){return _===a?(s++,t.consume(_),c):s<3?n(_):(t.exit("codeFencedFenceSequence"),oe(_)?ue(t,d,"whitespace")(_):d(_))}function d(_){return _===null||Y(_)?(t.exit("codeFencedFence"),r.interrupt?e(_):t.check(T0,g,v)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||Y(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(_)):oe(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ue(t,f,"whitespace")(_)):_===96&&_===a?n(_):(t.consume(_),h)}function f(_){return _===null||Y(_)?d(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===null||Y(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(_)):_===96&&_===a?n(_):(t.consume(_),p)}function g(_){return t.attempt(i,v,y)(_)}function y(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),b}function b(_){return o>0&&oe(_)?ue(t,C,"linePrefix",o+1)(_):C(_)}function C(_){return _===null||Y(_)?t.check(T0,g,v)(_):(t.enter("codeFlowValue"),w(_))}function w(_){return _===null||Y(_)?(t.exit("codeFlowValue"),C(_)):(t.consume(_),w)}function v(_){return t.exit("codeFenced"),e(_)}function O(_,R,U){let z=0;return N;function N(K){return _.enter("lineEnding"),_.consume(K),_.exit("lineEnding"),j}function j(K){return _.enter("codeFencedFence"),oe(K)?ue(_,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):V(K)}function V(K){return K===a?(_.enter("codeFencedFenceSequence"),Z(K)):U(K)}function Z(K){return K===a?(z++,_.consume(K),Z):z>=s?(_.exit("codeFencedFenceSequence"),oe(K)?ue(_,ie,"whitespace")(K):ie(K)):U(K)}function ie(K){return K===null||Y(K)?(_.exit("codeFencedFence"),R(K)):U(K)}}}function k8(t,e,n){const r=this;return i;function i(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}const kc={name:"codeIndented",tokenize:C8},T8={partial:!0,tokenize:S8};function C8(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),ue(t,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):Y(u)?t.attempt(T8,s,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||Y(u)?(t.exit("codeFlowValue"),s(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function S8(t,e,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):Y(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):ue(t,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):Y(s)?i(s):n(s)}}const x8={name:"codeText",previous:A8,resolve:w8,tokenize:_8};function w8(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function A8(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _8(t,e,n){let r=0,i,o;return s;function s(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),r++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(o=t.enter("codeTextSequence"),i=0,c(d)):Y(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||Y(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),u)}function c(d){return d===96?(t.consume(d),i++,c):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(o.type="codeTextData",u(d))}}class N8{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new 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,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&_o(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),_o(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),_o(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);_o(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);_o(this.left,n.reverse())}}}function _o(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function EC(t){const e={};let n=-1,r,i,o,s,a,l,u;const c=new N8(t);for(;++n<c.length;){for(;n in e;)n=e[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,I8(c,n)),n=e[n],u=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(s=c.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(c.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...c.get(i)[1].start},a=c.slice(i,n),a.unshift(r),c.splice(i,n-i+1,a))}}return vt(t,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function I8(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const o=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],u={};let c,d,h=-1,f=n,p=0,g=0;const y=[g];for(;f;){for(;t.get(++i)[1]!==f;);o.push(i),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),d&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(g=h+1,y.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):y.pop(),h=y.length;h--;){const b=a.slice(y[h],y[h+1]),C=o.pop();l.push([C,C+b.length-1]),t.splice(C,2,b)}for(l.reverse(),h=-1;++h<l.length;)u[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return u}const M8={resolve:D8,tokenize:v8},O8={partial:!0,tokenize:L8};function D8(t){return EC(t),t}function v8(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):Y(a)?t.check(O8,s,o)(a):(t.consume(a),i)}function o(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function s(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function L8(t,e,n){const r=this;return i;function i(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),ue(t,o,"linePrefix")}function o(s){if(s===null||Y(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function kC(t,e,n,r,i,o,s,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return d;function d(b){return b===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(b),t.exit(o),h):b===null||b===32||b===41||Il(b)?n(b):(t.enter(r),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(b))}function h(b){return b===62?(t.enter(o),t.consume(b),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(t.exit("chunkString"),t.exit(a),h(b)):b===null||b===60||Y(b)?n(b):(t.consume(b),b===92?p:f)}function p(b){return b===60||b===62||b===92?(t.consume(b),f):f(b)}function g(b){return!c&&(b===null||b===41||ke(b))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(r),e(b)):c<u&&b===40?(t.consume(b),c++,g):b===41?(t.consume(b),c--,g):b===null||b===32||b===40||Il(b)?n(b):(t.consume(b),b===92?y:g)}function y(b){return b===40||b===41||b===92?(t.consume(b),g):g(b)}}function TC(t,e,n,r,i,o){const s=this;let a=0,l;return u;function u(f){return t.enter(r),t.enter(i),t.consume(f),t.exit(i),t.enter(o),c}function c(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):f===93?(t.exit(o),t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):Y(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Y(f)||a++>999?(t.exit("chunkString"),c(f)):(t.consume(f),l||(l=!oe(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function CC(t,e,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(o),u(h))}function u(h){return h===s?(t.exit(o),l(s)):h===null?n(h):Y(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),ue(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===s||h===null||Y(h)?(t.exit("chunkString"),u(h)):(t.consume(h),h===92?d:c)}function d(h){return h===s||h===92?(t.consume(h),c):c(h)}}function Jo(t,e){let n;return r;function r(i){return Y(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):oe(i)?ue(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const R8={name:"definition",tokenize:B8},P8={partial:!0,tokenize:F8};function B8(t,e,n){const r=this;let i;return o;function o(f){return t.enter("definition"),s(f)}function s(f){return TC.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=on(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):n(f)}function l(f){return ke(f)?Jo(t,u)(f):u(f)}function u(f){return kC(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return t.attempt(P8,d,d)(f)}function d(f){return oe(f)?ue(t,h,"whitespace")(f):h(f)}function h(f){return f===null||Y(f)?(t.exit("definition"),r.parser.defined.push(i),e(f)):n(f)}}function F8(t,e,n){return r;function r(a){return ke(a)?Jo(t,i)(a):n(a)}function i(a){return CC(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return oe(a)?ue(t,s,"whitespace")(a):s(a)}function s(a){return a===null||Y(a)?e(a):n(a)}}const H8={name:"hardBreakEscape",tokenize:U8};function U8(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return Y(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const $8={name:"headingAtx",resolve:z8,tokenize:V8};function z8(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},vt(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function V8(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),o(c)}function o(c){return t.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(t.consume(c),s):c===null||ke(c)?(t.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||Y(c)?(t.exit("atxHeading"),e(c)):oe(c)?ue(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||ke(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}const q8=["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"],S0=["pre","script","style","textarea"],j8={concrete:!0,name:"htmlFlow",resolveTo:G8,tokenize:K8},W8={partial:!0,tokenize:X8},Y8={partial:!0,tokenize:Q8};function G8(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function K8(t,e,n){const r=this;let i,o,s,a,l;return u;function u(x){return c(x)}function c(x){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(x),d}function d(x){return x===33?(t.consume(x),h):x===47?(t.consume(x),o=!0,g):x===63?(t.consume(x),i=3,r.interrupt?e:S):dt(x)?(t.consume(x),s=String.fromCharCode(x),y):n(x)}function h(x){return x===45?(t.consume(x),i=2,f):x===91?(t.consume(x),i=5,a=0,p):dt(x)?(t.consume(x),i=4,r.interrupt?e:S):n(x)}function f(x){return x===45?(t.consume(x),r.interrupt?e:S):n(x)}function p(x){const Jt="CDATA[";return x===Jt.charCodeAt(a++)?(t.consume(x),a===Jt.length?r.interrupt?e:V:p):n(x)}function g(x){return dt(x)?(t.consume(x),s=String.fromCharCode(x),y):n(x)}function y(x){if(x===null||x===47||x===62||ke(x)){const Jt=x===47,Ir=s.toLowerCase();return!Jt&&!o&&S0.includes(Ir)?(i=1,r.interrupt?e(x):V(x)):q8.includes(s.toLowerCase())?(i=6,Jt?(t.consume(x),b):r.interrupt?e(x):V(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):o?C(x):w(x))}return x===45||ot(x)?(t.consume(x),s+=String.fromCharCode(x),y):n(x)}function b(x){return x===62?(t.consume(x),r.interrupt?e:V):n(x)}function C(x){return oe(x)?(t.consume(x),C):N(x)}function w(x){return x===47?(t.consume(x),N):x===58||x===95||dt(x)?(t.consume(x),v):oe(x)?(t.consume(x),w):N(x)}function v(x){return x===45||x===46||x===58||x===95||ot(x)?(t.consume(x),v):O(x)}function O(x){return x===61?(t.consume(x),_):oe(x)?(t.consume(x),O):w(x)}function _(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(t.consume(x),l=x,R):oe(x)?(t.consume(x),_):U(x)}function R(x){return x===l?(t.consume(x),l=null,z):x===null||Y(x)?n(x):(t.consume(x),R)}function U(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||ke(x)?O(x):(t.consume(x),U)}function z(x){return x===47||x===62||oe(x)?w(x):n(x)}function N(x){return x===62?(t.consume(x),j):n(x)}function j(x){return x===null||Y(x)?V(x):oe(x)?(t.consume(x),j):n(x)}function V(x){return x===45&&i===2?(t.consume(x),nt):x===60&&i===1?(t.consume(x),Ge):x===62&&i===4?(t.consume(x),Xt):x===63&&i===3?(t.consume(x),S):x===93&&i===5?(t.consume(x),In):Y(x)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(W8,Mn,Z)(x)):x===null||Y(x)?(t.exit("htmlFlowData"),Z(x)):(t.consume(x),V)}function Z(x){return t.check(Y8,ie,Mn)(x)}function ie(x){return t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),K}function K(x){return x===null||Y(x)?Z(x):(t.enter("htmlFlowData"),V(x))}function nt(x){return x===45?(t.consume(x),S):V(x)}function Ge(x){return x===47?(t.consume(x),s="",Qt):V(x)}function Qt(x){if(x===62){const Jt=s.toLowerCase();return S0.includes(Jt)?(t.consume(x),Xt):V(x)}return dt(x)&&s.length<8?(t.consume(x),s+=String.fromCharCode(x),Qt):V(x)}function In(x){return x===93?(t.consume(x),S):V(x)}function S(x){return x===62?(t.consume(x),Xt):x===45&&i===2?(t.consume(x),S):V(x)}function Xt(x){return x===null||Y(x)?(t.exit("htmlFlowData"),Mn(x)):(t.consume(x),Xt)}function Mn(x){return t.exit("htmlFlow"),e(x)}}function Q8(t,e,n){const r=this;return i;function i(s){return Y(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function X8(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Gs,e,n)}}const J8={name:"htmlText",tokenize:Z8};function Z8(t,e,n){const r=this;let i,o,s;return a;function a(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),u):S===47?(t.consume(S),O):S===63?(t.consume(S),w):dt(S)?(t.consume(S),U):n(S)}function u(S){return S===45?(t.consume(S),c):S===91?(t.consume(S),o=0,p):dt(S)?(t.consume(S),C):n(S)}function c(S){return S===45?(t.consume(S),f):n(S)}function d(S){return S===null?n(S):S===45?(t.consume(S),h):Y(S)?(s=d,Ge(S)):(t.consume(S),d)}function h(S){return S===45?(t.consume(S),f):d(S)}function f(S){return S===62?nt(S):S===45?h(S):d(S)}function p(S){const Xt="CDATA[";return S===Xt.charCodeAt(o++)?(t.consume(S),o===Xt.length?g:p):n(S)}function g(S){return S===null?n(S):S===93?(t.consume(S),y):Y(S)?(s=g,Ge(S)):(t.consume(S),g)}function y(S){return S===93?(t.consume(S),b):g(S)}function b(S){return S===62?nt(S):S===93?(t.consume(S),b):g(S)}function C(S){return S===null||S===62?nt(S):Y(S)?(s=C,Ge(S)):(t.consume(S),C)}function w(S){return S===null?n(S):S===63?(t.consume(S),v):Y(S)?(s=w,Ge(S)):(t.consume(S),w)}function v(S){return S===62?nt(S):w(S)}function O(S){return dt(S)?(t.consume(S),_):n(S)}function _(S){return S===45||ot(S)?(t.consume(S),_):R(S)}function R(S){return Y(S)?(s=R,Ge(S)):oe(S)?(t.consume(S),R):nt(S)}function U(S){return S===45||ot(S)?(t.consume(S),U):S===47||S===62||ke(S)?z(S):n(S)}function z(S){return S===47?(t.consume(S),nt):S===58||S===95||dt(S)?(t.consume(S),N):Y(S)?(s=z,Ge(S)):oe(S)?(t.consume(S),z):nt(S)}function N(S){return S===45||S===46||S===58||S===95||ot(S)?(t.consume(S),N):j(S)}function j(S){return S===61?(t.consume(S),V):Y(S)?(s=j,Ge(S)):oe(S)?(t.consume(S),j):z(S)}function V(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(t.consume(S),i=S,Z):Y(S)?(s=V,Ge(S)):oe(S)?(t.consume(S),V):(t.consume(S),ie)}function Z(S){return S===i?(t.consume(S),i=void 0,K):S===null?n(S):Y(S)?(s=Z,Ge(S)):(t.consume(S),Z)}function ie(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||ke(S)?z(S):(t.consume(S),ie)}function K(S){return S===47||S===62||ke(S)?z(S):n(S)}function nt(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):n(S)}function Ge(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),Qt}function Qt(S){return oe(S)?ue(t,In,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):In(S)}function In(S){return t.enter("htmlTextData"),s(S)}}const jf={name:"labelEnd",resolveAll:rF,resolveTo:iF,tokenize:oF},eF={tokenize:sF},tF={tokenize:aF},nF={tokenize:lF};function rF(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&vt(t,0,t.length,n),t}function iF(t,e){let n=t.length,r=0,i,o,s,a;for(;n--;)if(i=t[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[o][1].start},end:{...t[s][1].end}},c={type:"labelText",start:{...t[o+r+2][1].end},end:{...t[s-2][1].start}};return a=[["enter",l,e],["enter",u,e]],a=Ht(a,t.slice(o+1,o+r+3)),a=Ht(a,[["enter",c,e]]),a=Ht(a,Cu(e.parser.constructs.insideSpan.null,t.slice(o+r+4,s-3),e)),a=Ht(a,[["exit",c,e],t[s-2],t[s-1],["exit",u,e]]),a=Ht(a,t.slice(s+1)),a=Ht(a,[["exit",l,e]]),vt(t,o,t.length,a),t}function oF(t,e,n){const r=this;let i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(h){return o?o._inactive?d(h):(s=r.parser.defined.includes(on(r.sliceSerialize({start:o.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),l):n(h)}function l(h){return h===40?t.attempt(eF,c,s?c:d)(h):h===91?t.attempt(tF,c,s?u:d)(h):s?c(h):d(h)}function u(h){return t.attempt(nF,c,d)(h)}function c(h){return e(h)}function d(h){return o._balanced=!0,n(h)}}function sF(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return ke(d)?Jo(t,o)(d):o(d)}function o(d){return d===41?c(d):kC(t,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return ke(d)?Jo(t,l)(d):c(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?CC(t,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return ke(d)?Jo(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function aF(t,e,n){const r=this;return i;function i(a){return TC.call(r,t,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(on(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function s(a){return n(a)}}function lF(t,e,n){return r;function r(o){return t.enter("reference"),t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),i}function i(o){return o===93?(t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),t.exit("reference"),e):n(o)}}const uF={name:"labelStartImage",resolveAll:jf.resolveAll,tokenize:cF};function cF(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),o}function o(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const dF={name:"labelStartLink",resolveAll:jf.resolveAll,tokenize:hF};function hF(t,e,n){const r=this;return i;function i(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):e(s)}}const Tc={name:"lineEnding",tokenize:fF};function fF(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),ue(t,e,"linePrefix")}}const za={name:"thematicBreak",tokenize:pF};function pF(t,e,n){let r=0,i;return o;function o(u){return t.enter("thematicBreak"),s(u)}function s(u){return i=u,a(u)}function a(u){return u===i?(t.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||Y(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),oe(u)?ue(t,a,"whitespace")(u):a(u))}}const Et={continuation:{tokenize:yF},exit:kF,name:"list",tokenize:bF},mF={partial:!0,tokenize:TF},gF={partial:!0,tokenize:EF};function bF(t,e,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(f){const p=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Ud(f)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(za,n,u)(f):u(f);if(!r.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return n(f)}function l(f){return Ud(f)&&++s<10?(t.consume(f),l):(!r.interrupt||s<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),u(f)):n(f)}function u(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,t.check(Gs,r.interrupt?n:c,t.attempt(mF,h,d))}function c(f){return r.containerState.initialBlankLine=!0,o++,h(f)}function d(f){return oe(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function yF(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Gs,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ue(t,e,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!oe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(gF,e,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ue(t,t.attempt(Et,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function EF(t,e,n){const r=this;return ue(t,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(o):n(o)}}function kF(t){t.exit(this.containerState.type)}function TF(t,e,n){const r=this;return ue(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!oe(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const x0={name:"setextUnderline",resolveTo:CF,tokenize:SF};function CF(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",s,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=s,t.push(["exit",s,e]),t}function SF(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,d;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){d=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),i=u,s(u)):n(u)}function s(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),oe(u)?ue(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Y(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const xF={tokenize:DF,partial:!0};function wF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:IF,continuation:{tokenize:MF},exit:OF}},text:{91:{name:"gfmFootnoteCall",tokenize:NF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:AF,resolveTo:_F}}}}function AF(t,e,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!s||!s._balanced)return n(l);const u=on(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function _F(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",o,e],["enter",s,e],["exit",s,e],["exit",o,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function NF(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,s;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(d){if(o>999||d===93&&!s||d===null||d===91||ke(d))return n(d);if(d===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return i.includes(on(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return ke(d)||(s=!0),o++,t.consume(d),d===92?c:u}function c(d){return d===91||d===92||d===93?(t.consume(d),o++,u):u(d)}}function IF(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0,a;return l;function l(p){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(p){return p===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):n(p)}function c(p){if(s>999||p===93&&!a||p===null||p===91||ke(p))return n(p);if(p===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return o=on(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return ke(p)||(a=!0),s++,t.consume(p),p===92?d:c}function d(p){return p===91||p===92||p===93?(t.consume(p),s++,c):c(p)}function h(p){return p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),i.includes(o)||i.push(o),ue(t,f,"gfmFootnoteDefinitionWhitespace")):n(p)}function f(p){return e(p)}}function MF(t,e,n){return t.check(Gs,e,t.attempt(xF,e,n))}function OF(t){t.exit("gfmFootnoteDefinition")}function DF(t,e,n){const r=this;return ue(t,i,"gfmFootnoteDefinitionIndent",5);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(o):n(o)}}function vF(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,a){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let u=l;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[l][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[l][1].end)},d={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[l][1].start)},h=[["enter",c,a],["enter",s[u][1],a],["exit",s[u][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&vt(h,h.length,0,Cu(f,s.slice(u+1,l),a)),vt(h,h.length,0,[["exit",d,a],["enter",s[l][1],a],["exit",s[l][1],a],["exit",c,a]]),vt(s,u-1,l-u+3,h),l=u+h.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function o(s,a,l){const u=this.previous,c=this.events;let d=0;return h;function h(p){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(p):(s.enter("strikethroughSequenceTemporary"),f(p))}function f(p){const g=io(u);if(p===126)return d>1?l(p):(s.consume(p),d++,f);if(d<2&&!n)return l(p);const y=s.exit("strikethroughSequenceTemporary"),b=io(p);return y._open=!b||b===2&&!!g,y._close=!g||g===2&&!!b,a(p)}}}class LF{constructor(){this.map=[]}add(e,n,r){RF(this,e,n,r)}consume(e){if(this.map.sort(function(o,s){return o[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const o of i)e.push(o);i=r.pop()}this.map.length=0}}function RF(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function PF(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function BF(){return{flow:{null:{name:"table",tokenize:FF,resolveAll:HF}}}}function FF(t,e,n){const r=this;let i=0,o=0,s;return a;function a(N){let j=r.events.length-1;for(;j>-1;){const ie=r.events[j][1].type;if(ie==="lineEnding"||ie==="linePrefix")j--;else break}const V=j>-1?r.events[j][1].type:null,Z=V==="tableHead"||V==="tableRow"?_:l;return Z===_&&r.parser.lazy[r.now().line]?n(N):Z(N)}function l(N){return t.enter("tableHead"),t.enter("tableRow"),u(N)}function u(N){return N===124||(s=!0,o+=1),c(N)}function c(N){return N===null?n(N):Y(N)?o>1?(o=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),f):n(N):oe(N)?ue(t,c,"whitespace")(N):(o+=1,s&&(s=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),s=!0,c):(t.enter("data"),d(N)))}function d(N){return N===null||N===124||ke(N)?(t.exit("data"),c(N)):(t.consume(N),N===92?h:d)}function h(N){return N===92||N===124?(t.consume(N),d):d(N)}function f(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(t.enter("tableDelimiterRow"),s=!1,oe(N)?ue(t,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):p(N))}function p(N){return N===45||N===58?y(N):N===124?(s=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),g):O(N)}function g(N){return oe(N)?ue(t,y,"whitespace")(N):y(N)}function y(N){return N===58?(o+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),b):N===45?(o+=1,b(N)):N===null||Y(N)?v(N):O(N)}function b(N){return N===45?(t.enter("tableDelimiterFiller"),C(N)):O(N)}function C(N){return N===45?(t.consume(N),C):N===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),w):(t.exit("tableDelimiterFiller"),w(N))}function w(N){return oe(N)?ue(t,v,"whitespace")(N):v(N)}function v(N){return N===124?p(N):N===null||Y(N)?!s||i!==o?O(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):O(N)}function O(N){return n(N)}function _(N){return t.enter("tableRow"),R(N)}function R(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),R):N===null||Y(N)?(t.exit("tableRow"),e(N)):oe(N)?ue(t,R,"whitespace")(N):(t.enter("data"),U(N))}function U(N){return N===null||N===124||ke(N)?(t.exit("data"),R(N)):(t.consume(N),N===92?z:U)}function z(N){return N===92||N===124?(t.consume(N),U):U(N)}}function HF(t,e){let n=-1,r=!0,i=0,o=[0,0,0,0],s=[0,0,0,0],a=!1,l=0,u,c,d;const h=new LF;for(;++n<t.length;){const f=t[n],p=f[1];f[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(w0(h,e,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",u,e]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,o=[0,0,0,0],s=[0,n+1,0,0],a&&(a=!1,c={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",c,e]])),i=p.type==="tableDelimiterRow"?2:c?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(o[1]!==0&&(s[0]=s[1],d=ya(h,e,o,i,void 0,d),o=[0,0,0,0]),s[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(s[0]=s[1],d=ya(h,e,o,i,void 0,d)),o=s,s=[o[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,o[1]!==0?(s[0]=s[1],d=ya(h,e,o,i,n,d)):s[1]!==0&&(d=ya(h,e,s,i,n,d)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(s[3]=n)}for(l!==0&&w0(h,e,l,u,c),h.consume(e.events),n=-1;++n<e.events.length;){const f=e.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=PF(e.events,n))}return t}function ya(t,e,n,r,i,o){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(o.end=Object.assign({},Ai(e.events,n[0])),t.add(n[0],0,[["exit",o,e]]));const l=Ai(e.events,n[1]);if(o={type:s,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",o,e]]),n[2]!==0){const u=Ai(e.events,n[2]),c=Ai(e.events,n[3]),d={type:a,start:Object.assign({},u),end:Object.assign({},c)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const h=e.events[n[2]],f=e.events[n[3]];if(h[1].end=Object.assign({},f[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;t.add(p,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(o.end=Object.assign({},Ai(e.events,i)),t.add(i,0,[["exit",o,e]]),o=void 0),o}function w0(t,e,n,r,i){const o=[],s=Ai(e.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,e])),r.end=Object.assign({},s),o.push(["exit",r,e]),t.add(n+1,0,o)}function Ai(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const UF={name:"tasklistCheck",tokenize:zF};function $F(){return{text:{91:UF}}}function zF(t,e,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),o)}function o(l){return ke(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),s):n(l)}function s(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return Y(l)?e(l):oe(l)?t.check({tokenize:VF},e,n)(l):n(l)}}function VF(t,e,n){return ue(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function qF(t){return aC([e8(),wF(),vF(t),BF(),$F()])}const jF={};function SC(t){const e=this,n=t||jF,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(qF(n)),o.push(G5()),s.push(K5(n))}function WF(t){const e=this;e.compiler=n;function n(r){return M5(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function A0(t){if(t)throw t}var Cc,_0;function YF(){if(_0)return Cc;_0=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},o=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),d=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!d)return!1;var h;for(h in u);return typeof h>"u"||t.call(u,h)},s=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},a=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return Cc=function l(){var u,c,d,h,f,p,g=arguments[0],y=1,b=arguments.length,C=!1;for(typeof g=="boolean"&&(C=g,g=arguments[1]||{},y=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});y<b;++y)if(u=arguments[y],u!=null)for(c in u)d=a(g,c),h=a(u,c),g!==h&&(C&&h&&(o(h)||(f=i(h)))?(f?(f=!1,p=d&&i(d)?d:[]):p=d&&o(d)?d:{},s(g,{name:c,newValue:l(C,p,h)})):typeof h<"u"&&s(g,{name:c,newValue:h}));return g},Cc}var GF=YF();const Sc=sb(GF);function qd(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function KF(){const t=[],e={run:n,use:r};return e;function n(...i){let o=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...i);function a(l,...u){const c=t[++o];let d=-1;if(l){s(l);return}for(;++d<i.length;)(u[d]===null||u[d]===void 0)&&(u[d]=i[d]);i=u,c?QF(c,a)(...u):s(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function QF(t,e){let n;return r;function r(...s){const a=t.length>s.length;let l;a&&s.push(i);try{l=t.apply(this,s)}catch(u){const c=u;if(a&&n)throw c;return i(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){n||(n=!0,e(s,...a))}function o(s){i(null,s)}}const XF=(function(t){const r=this.constructor.prototype,i=r[t],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),JF={}.hasOwnProperty;class Wf extends XF{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=KF()}copy(){const e=new Wf;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Sc(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Ac("data",this.frozen),this.namespace[e]=n,this):JF.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ac("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Ea(e),r=this.parser||this.Parser;return xc("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),xc("process",this.parser||this.Parser),wc("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const a=Ea(e),l=r.parse(a);r.run(l,a,function(c,d,h){if(c||!d||!h)return u(c);const f=d,p=r.stringify(f,h);e9(p)?h.value=p:h.result=p,u(c,h)});function u(c,d){c||!d?s(c):o?o(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),xc("processSync",this.parser||this.Parser),wc("processSync",this.compiler||this.Compiler),this.process(e,i),I0("processSync","process",n),r;function i(o,s){n=!0,A0(o),r=s}}run(e,n,r){N0(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(s,a){const l=Ea(n);i.run(e,l,u);function u(c,d,h){const f=d||e;c?a(c):s?s(f):r(void 0,f,h)}}}runSync(e,n){let r=!1,i;return this.run(e,n,o),I0("runSync","run",r),i;function o(s,a){A0(s),i=a,r=!0}}stringify(e,n){this.freeze();const r=Ea(n),i=this.compiler||this.Compiler;return wc("stringify",i),N0(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(Ac("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function o(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...d]=u;l(c,d)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new 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");a(u.plugins),u.settings&&(i.settings=Sc(!0,i.settings,u.settings))}function a(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const d=u[c];o(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===u){h=d;break}if(h===-1)r.push([u,...c]);else if(c.length>0){let[f,...p]=c;const g=r[h][1];qd(g)&&qd(f)&&(f=Sc(!0,g,f)),r[h]=[u,f,...p]}}}}const xC=new Wf().freeze();function xc(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function wc(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Ac(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function N0(t){if(!qd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function I0(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ea(t){return ZF(t)?t:new Fd(t)}function ZF(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function e9(t){return typeof t=="string"||t9(t)}function t9(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function n9(t,e){return wC(t,{})||{type:"root",children:[]}}function wC(t,e){const n=r9(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function r9(t,e){switch(t.nodeType){case 1:return a9(t,e);case 3:return o9(t);case 8:return s9(t);case 9:return M0(t,e);case 10:return i9();case 11:return M0(t,e);default:return}}function M0(t,e){return{type:"root",children:AC(t,e)}}function i9(){return{type:"doctype"}}function o9(t){return{type:"text",value:t.nodeValue||""}}function s9(t){return{type:"comment",value:t.nodeValue||""}}function a9(t,e){const n=t.namespaceURI,r=n===Ha.svg?Lk:vk,i=n===Ha.html?t.tagName.toLowerCase():t.tagName,o=n===Ha.html&&i==="template"?t.content:t,s=t.getAttributeNames(),a={};let l=-1;for(;++l<s.length;)a[s[l]]=t.getAttribute(s[l])||"";return r(i,a,AC(o,e))}function AC(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const o=wC(n[i],e);o!==void 0&&r.push(o)}return r}function _C(t){let e=Array.from(t.classList).filter(n=>!n.startsWith("bn-"))||[];e.length>0?t.className=e.join(" "):t.removeAttribute("class")}function NC(t,e,n,r){let i;if(!e)throw Error("blockContent is required");if(typeof e=="string")i=un([e],t.pmSchema);else if(Array.isArray(e))i=un(e,t.pmSchema);else if(e.type==="tableContent")i=su(e,t.pmSchema);else throw new xn(e.type);let o=(r?.document??document).createDocumentFragment();for(let s of i)if(s.type.name!=="text"&&t.schema.inlineContentSchema[s.type.name]){let a=t.schema.inlineContentSpecs[s.type.name].implementation;if(a){let l=bf(s,t.schema.inlineContentSchema,t.schema.styleSchema),u=a.toExternalHTML?a.toExternalHTML(l,t):a.render.call({renderType:"dom",props:void 0},l,()=>{},t);if(u){if(o.appendChild(u.dom),u.contentDOM){let c=n.serializeFragment(s.content,r);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(c)}continue}}}else if(s.type.name==="text"){let a=document.createTextNode(s.textContent);for(let l of s.marks.toReversed())if(l.type.name in t.schema.styleSpecs){let u=(t.schema.styleSpecs[l.type.name].implementation.toExternalHTML??t.schema.styleSpecs[l.type.name].implementation.render)(l.attrs.stringValue,t);u.contentDOM.appendChild(a),a=u.dom}else{let u=l.type.spec.toDOM(l,!0),c=Lt.renderSpec(document,u);c.contentDOM.appendChild(a),a=c.dom}o.appendChild(a)}else{let a=n.serializeFragment(M.from([s]),r);o.appendChild(a)}return o.childNodes.length===1&&o.firstChild?.nodeType===1&&_C(o.firstChild),o}function l9(t,e,n,r,i,o,s,a){let l=a?.document??document,u=e.pmSchema.nodes.blockContainer,c=n.props||{};for(let[b,C]of Object.entries(e.schema.blockSchema[n.type].propSchema))!(b in c)&&C.default!==void 0&&(c[b]=C.default);let d=u.spec?.toDOM?.(u.create({id:n.id,...c})),h=Array.from(d.dom.attributes),f=e.blockImplementations[n.type].implementation,p=f.toExternalHTML?.call({},{...n,props:c},e,{nestingLevel:s})||f.render.call({},{...n,props:c},e),g=l.createDocumentFragment();if(p.dom.classList.contains("bn-block-content")){let b=[...h,...Array.from(p.dom.attributes)].filter(C=>C.name.startsWith("data")&&C.name!=="data-content-type"&&C.name!=="data-file-block"&&C.name!=="data-node-view-wrapper"&&C.name!=="data-node-type"&&C.name!=="data-id"&&C.name!=="data-editable");for(let C of b)p.dom.firstChild.setAttribute(C.name,C.value);_C(p.dom.firstChild),s>0&&p.dom.firstChild.setAttribute("data-nesting-level",s.toString()),g.append(...Array.from(p.dom.childNodes))}else g.append(p.dom),s>0&&p.dom.setAttribute("data-nesting-level",s.toString());if(p.contentDOM&&n.content){let b=NC(e,n.content,r,a);p.contentDOM.appendChild(b)}let y;if(i.has(n.type)?y="OL":o.has(n.type)&&(y="UL"),y){if(t.lastChild?.nodeName!==y){let b=l.createElement(y);y==="OL"&&"start"in c&&c.start&&c?.start!==1&&b.setAttribute("start",c.start+""),t.append(b)}t.lastChild.appendChild(g)}else t.append(g);if(n.children&&n.children.length>0){let b=l.createDocumentFragment();if(IC(b,e,n.children,r,i,o,s+1,a),t.lastChild?.nodeName==="UL"||t.lastChild?.nodeName==="OL")for(;b.firstChild?.nodeName==="UL"||b.firstChild?.nodeName==="OL";)t.lastChild.lastChild.appendChild(b.firstChild);"childrenDOM"in p&&p.childrenDOM?p.childrenDOM.append(b):e.pmSchema.nodes[n.type].isInGroup("blockContent")?t.append(b):p.contentDOM?.append(b)}}var IC=(t,e,n,r,i,o,s=0,a)=>{for(let l of n)l9(t,e,l,r,i,o,s,a)},u9=(t,e,n,r,i,o)=>{let s=(o?.document??document).createDocumentFragment();return IC(s,t,e,n,r,i,0,o),s},Su=(t,e)=>{let n=Lt.fromSchema(t);return{exportBlocks:(r,i)=>{let o=u9(e,r,n,new Set(["numberedListItem"]),new Set(["bulletListItem","checkListItem","toggleListItem"]),i),s=document.createElement("div");return s.append(o),s.innerHTML},exportInlineContent:(r,i)=>{let o=NC(e,r,n,i),s=document.createElement("div");return s.append(o.cloneNode(!0)),s.innerHTML}}};function c9(t,e){if(e===0)return;let n=t.resolve(e);for(let r=n.depth;r>0;r--){let i=n.node(r);if(Ef(i))return i.attrs.id}}function d9(t){return t.getMeta("paste")?{type:"paste"}:t.getMeta("uiEvent")==="drop"?{type:"drop"}:t.getMeta("history$")?{type:t.getMeta("history$").redo?"redo":"undo"}:t.getMeta("y-sync$")?t.getMeta("y-sync$").isUndoRedoOperation?{type:"undo-redo"}:{type:"yjs-remote"}:{type:"local"}}function O0(t){let e={},n={},r=Fe(t);return t.descendants((i,o)=>{if(!Ef(i))return!0;let s=c9(t,o),a=s??"__root__";n[a]||(n[a]=[]);let l=Ae(i,r);return e[i.attrs.id]={block:l,parentId:s},n[a].push(i.attrs.id),!0}),{byId:e,childrenByParent:n}}function h9(t,e){let n=new Set;if(!t||!e)return n;let r=new Set(t),i=e.filter(g=>r.has(g)),o=t.filter(g=>i.includes(g));if(o.length<=1||i.length<=1)return n;let s={};for(let g=0;g<o.length;g++)s[o[g]]=g;let a=i.map(g=>s[g]),l=a.length,u=[],c=[],d=Array(l).fill(-1),h=(g,y)=>{let b=0,C=g.length;for(;b<C;){let w=b+C>>>1;g[w]<y?b=w+1:C=w}return b};for(let g=0;g<l;g++){let y=a[g],b=h(u,y);b>0&&(d[g]=c[b-1]),b===u.length?(u.push(y),c.push(g)):(u[b]=y,c[b]=g)}let f=new Set,p=c[c.length-1]??-1;for(;p!==-1;)f.add(p),p=d[p];for(let g=0;g<i.length;g++)f.has(g)||n.add(i[g]);return n}function MC(t,e=[]){let n=d9(t),r=zl(t.before,[t,...e]),i=O0(r.before),o=O0(r.doc),s=[],a=new Set;Object.keys(o.byId).filter(h=>!(h in i.byId)).forEach(h=>{s.push({type:"insert",block:o.byId[h].block,source:n,prevBlock:void 0}),a.add(h)}),Object.keys(i.byId).filter(h=>!(h in o.byId)).forEach(h=>{s.push({type:"delete",block:i.byId[h].block,source:n,prevBlock:void 0}),a.add(h)}),Object.keys(o.byId).filter(h=>h in i.byId).forEach(h=>{let f=i.byId[h],p=o.byId[h];f.parentId===p.parentId?jL({...f.block,children:void 0},{...p.block,children:void 0})||(s.push({type:"update",block:p.block,prevBlock:f.block,source:n}),a.add(h)):(s.push({type:"move",block:p.block,prevBlock:f.block,source:n,prevParent:f.parentId?i.byId[f.parentId]?.block:void 0,currentParent:p.parentId?o.byId[p.parentId]?.block:void 0}),a.add(h))});let l=i.childrenByParent,u=o.childrenByParent,c=new Set([...Object.keys(l),...Object.keys(u)]),d=new Set;return c.forEach(h=>{let f=h9(l[h],u[h]);f.size!==0&&f.forEach(p=>{let g=i.byId[p],y=o.byId[p];!g||!y||g.parentId===y.parentId&&(a.has(p)||(g.parentId??"__root__")===h&&(d.has(p)||(d.add(p),s.push({type:"move",block:y.block,prevBlock:g.block,source:n,prevParent:g.parentId?i.byId[g.parentId]?.block:void 0,currentParent:y.parentId?o.byId[y.parentId]?.block:void 0}),a.add(p))))})}),s}var OC=de(()=>{let t=[];return{key:"blockChange",prosemirrorPlugins:[new re({key:new he("blockChange"),filterTransaction:e=>{let n;return t.reduce((r,i)=>r===!1?r:i({getChanges(){return n||(n=MC(e),n)},tr:e})!==!1,!0)}})],subscribe(e){return t.push(e),()=>{t.splice(t.indexOf(e),1)}}}});function D0(t){let e=t.charAt(0)==="#"?t.substring(1,7):t,n=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16),o=[n/255,r/255,i/255].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*o[0]+.7152*o[1]+.0722*o[2]<=.179}function f9(t){let e=document.createElement("span");e.classList.add("bn-collaboration-cursor__base");let n=document.createElement("span");n.setAttribute("contentedEditable","false"),n.classList.add("bn-collaboration-cursor__caret"),n.setAttribute("style",`background-color: ${t.color}; color: ${D0(t.color)?"white":"black"}`);let r=document.createElement("span");return r.classList.add("bn-collaboration-cursor__label"),r.setAttribute("style",`background-color: ${t.color}; color: ${D0(t.color)?"white":"black"}`),r.insertBefore(document.createTextNode(t.name),null),n.insertBefore(r,null),e.insertBefore(document.createTextNode("⁠"),null),e.insertBefore(n,null),e.insertBefore(document.createTextNode("⁠"),null),e}var jd=de(({options:t})=>{let e=new Map,n=t.provider&&"awareness"in t.provider&&typeof t.provider.awareness=="object"?t.provider.awareness:void 0;return n&&("setLocalStateField"in n&&typeof n.setLocalStateField=="function"&&n.setLocalStateField("user",t.user),"on"in n&&typeof n.on=="function"&&t.showCursorLabels!=="always"&&n.on("change",({updated:r})=>{for(let i of r){let o=e.get(i);o&&(setTimeout(()=>{o.element.setAttribute("data-active","")},10),o.hideTimeout&&clearTimeout(o.hideTimeout),e.set(i,{element:o.element,hideTimeout:setTimeout(()=>{o.element.removeAttribute("data-active")},2e3)}))}})),{key:"yCursor",prosemirrorPlugins:[n?_D(n,{selectionBuilder:KE,cursorBuilder(r,i){let o=e.get(i);if(!o){let s=(t.renderCursor??f9)(r);t.showCursorLabels!=="always"&&(s.addEventListener("mouseenter",()=>{let a=e.get(i);a.element.setAttribute("data-active",""),a.hideTimeout&&(clearTimeout(a.hideTimeout),e.set(i,{element:a.element,hideTimeout:void 0}))}),s.addEventListener("mouseleave",()=>{let a=e.get(i);e.set(i,{element:a.element,hideTimeout:setTimeout(()=>{a.element.removeAttribute("data-active")},2e3)})})),o={element:s,hideTimeout:void 0},e.set(i,o)}return o.element}}):void 0].filter(Boolean),dependsOn:["ySync"],updateUser(r){n?.setLocalStateField("user",r)}}}),Va=de(({options:t})=>({key:"ySync",prosemirrorPlugins:[dD(t.fragment)],runsBefore:["default"]})),qa=de(()=>({key:"yUndo",prosemirrorPlugins:[LD()],dependsOn:["yCursor","ySync"],undoCommand:MD,redoCommand:OD}));function p9(t,e){let n=t.doc;if(t._item===null){let r=Array.from(n.share.keys()).find(i=>n.share.get(i)===t);if(r==null)throw Error("type does not exist in other ydoc");return e.get(r,t.constructor)}else{let r=t._item,i=e.store.clients.get(r.id.client)??[];return i[Kt(i,r.id.clock)].content.type}}var m9=de(({editor:t,options:e})=>{let n,r=ai({isForked:!1});return{key:"yForkDoc",store:r,fork(){if(n)return;let i=e.fragment;if(!i)throw Error("No fragment to fork from");let o=new Ar;Fm(o,Hm(i.doc));let s=p9(i,o);n={undoStack:En.getState(t.prosemirrorState).undoManager.undoStack,originalFragment:i,forkedFragment:s},t.unregisterExtension([qa,jd,Va]);let a={...e,fragment:s};t.registerExtension([Va(a),qa()]),r.setState({isForked:!0})},merge({keepChanges:i}){if(!n)return;t.unregisterExtension(["ySync","yCursor","yUndo"]);let{originalFragment:o,forkedFragment:s,undoStack:a}=n;if(t.registerExtension([Va(e),jd(e),qa()]),En.getState(t.prosemirrorState).undoManager.undoStack=a,i){let l=Hm(s.doc,zM(o.doc));Fm(o.doc,l,t)}n=void 0,r.setState({isForked:!1})}}}),DC=(t,e)=>{e(t),t.forEach(n=>{n instanceof et&&DC(n,e)})},g9=[(t,e)=>{let n=new Map;return t.forEach(r=>{r instanceof et&&DC(r,i=>{if(i.nodeName==="blockContainer"&&i.hasAttribute("id")){let o=i.getAttribute("textColor"),s=i.getAttribute("backgroundColor"),a={textColor:o===pe.textColor.default?void 0:o,backgroundColor:s===pe.backgroundColor.default?void 0:s};(a.textColor||a.backgroundColor)&&n.set(i.getAttribute("id"),a)}})}),n.size===0?!1:(e.doc.descendants((r,i)=>{if(r.type.name==="blockContainer"&&n.has(r.attrs.id)){let o=e.doc.nodeAt(i+1);if(!o)throw Error("No element found");e.setNodeMarkup(i+1,void 0,{...o.attrs,...n.get(r.attrs.id)})}}),!0)}],b9=de(({options:t})=>{let e=!1;return{key:"schemaMigration",prosemirrorPlugins:[new re({key:new he("schemaMigration"),appendTransaction:(n,r,i)=>{if(e||!n.some(s=>s.getMeta("y-sync$"))||n.every(s=>!s.docChanged)||!t.fragment.firstChild)return;let o=i.tr;for(let s of g9)s(t.fragment,o);if(e=!0,o.docChanged)return o}})]}});function v0(t,e){return!t||!e?!1:!!t.closest(`.${e}`)}function y9(t,e,n,r,i){let o=t.state.doc.resolve(e.pos);if(o.parent.inlineContent||e.orientation==="inline")return null;let s=o.nodeBefore,a=o.nodeAfter;if(!s&&!a)return null;let l=e.orientation==="block-vertical-left"||e.orientation==="block-vertical-right",u=l?e.pos:e.pos-(s?s.nodeSize:0),c=t.nodeDOM(u);if(!c)return null;let d=c.getBoundingClientRect();if(l){let p=n/2*r,g=e.orientation==="block-vertical-left"?d.left:d.right;return{left:g-p,right:g+p,top:d.top,bottom:d.bottom}}let h=s?d.bottom:d.top;s&&a&&(h=(h+t.nodeDOM(e.pos).getBoundingClientRect().top)/2);let f=n/2*i;return{left:d.left,right:d.right,top:h-f,bottom:h+f}}function E9(t,e,n,r){let i=t.coordsAtPos(e.pos),o=n/2*r;return{left:i.left-o,right:i.left+o,top:i.top,bottom:i.bottom}}function k9(t,e){t.classList.toggle("prosemirror-dropcursor-inline",e==="inline"),t.classList.toggle("prosemirror-dropcursor-block-horizontal",e==="block-horizontal"),t.classList.toggle("prosemirror-dropcursor-block-vertical-left",e==="block-vertical-left"),t.classList.toggle("prosemirror-dropcursor-block-vertical-right",e==="block-vertical-right"),t.classList.toggle("prosemirror-dropcursor-block",e==="block-horizontal"),t.classList.toggle("prosemirror-dropcursor-vertical",e==="block-vertical-left"||e==="block-vertical-right")}function T9(t){if(!t||t===document.body&&getComputedStyle(t).position==="static")return{parentLeft:-window.pageXOffset,parentTop:-window.pageYOffset};let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return{parentLeft:e.left-t.scrollLeft*n,parentTop:e.top-t.scrollTop*r}}var C9=de(({editor:t,options:e})=>{let n=null,r=null,i=-1,o=null,s={width:e.dropCursor?.width??5,color:e.dropCursor?.color??"#ddeeff",exclude:e.dropCursor?.exclude??"bn-drag-exclude",hooks:e.dropCursor?.hooks},a=g=>{g?.pos===n?.pos&&g?.orientation===n?.orientation||(n=g,g==null?(r&&r.parentNode&&r.parentNode.removeChild(r),r=null):l())},l=()=>{if(!n)return;let g=t.prosemirrorView,y=g.dom,b=y.getBoundingClientRect(),C=b.width/y.offsetWidth,w=b.height/y.offsetHeight,v=y9(g,n,s.width,C,w)??E9(g,n,s.width,C),O=g.dom.offsetParent;r||(r=O.appendChild(document.createElement("div")),r.style.cssText="position: absolute; z-index: 50; pointer-events: none;",s.color&&(r.style.backgroundColor=s.color)),k9(r,n.orientation);let{parentLeft:_,parentTop:R}=T9(O);r.style.left=(v.left-_)/C+"px",r.style.top=(v.top-R)/w+"px",r.style.width=(v.right-v.left)/C+"px",r.style.height=(v.bottom-v.top)/w+"px"},u=g=>{clearTimeout(i),i=window.setTimeout(()=>a(null),g)},c=g=>{let y=g;o=y.target instanceof Element?y.target:null},d=g=>{let y=g;if(o&&v0(o,s.exclude)||y.target instanceof Element&&v0(y.target,s.exclude))return;let b=t.prosemirrorView;if(!b.editable)return;let C=b.posAtCoords({left:y.clientX,top:y.clientY}),w=C&&C.inside>=0&&b.state.doc.nodeAt(C.inside),v=w&&w.type.spec.disableDropCursor,O=typeof v=="function"?v(b,C,y):v;if(C&&!O){let _=C.pos;if(b.dragging&&b.dragging.slice){let N=Rb(b.state.doc,_,b.dragging.slice);N!=null&&(_=N)}let R=!b.state.doc.resolve(_).parent.inlineContent,U={pos:_,orientation:R?"block-horizontal":"inline"},z=U;if(s.hooks?.computeDropPosition){let N=s.hooks.computeDropPosition({editor:t,event:y,view:b,defaultPosition:U});if(N===null){a(null);return}z=N}a(z),u(5e3)}},h=g=>{let y=g;(!(y.relatedTarget instanceof Node)||!t.prosemirrorView.dom.contains(y.relatedTarget))&&a(null)},f=()=>{u(20)},p=()=>{u(20),o=null};return{key:"dropCursor",mount({signal:g,dom:y,root:b}){b.addEventListener("dragstart",c,{capture:!0,signal:g}),y.addEventListener("dragover",d,{signal:g}),y.addEventListener("dragleave",h,{signal:g}),y.addEventListener("drop",f,{signal:g}),y.addEventListener("dragend",p,{signal:g}),g.addEventListener("abort",()=>{clearTimeout(i),a(null)})}}}),Wd=de(({editor:t})=>{let e=ai(!1),n=()=>t.transact(r=>{if(r.selection.empty||r.selection instanceof $&&r.doc.textBetween(r.selection.from,r.selection.to).length===0)return!1;let i=!1;return r.selection.content().content.descendants(o=>(o.type.spec.code&&(i=!0),!i)),!i});return{key:"formattingToolbar",store:e,mount({dom:r,signal:i}){let o=!1,s=!1,a=t.onChange(()=>{o||s||e.setState(n())}),l=t.onSelectionChange(()=>{o||s||e.setState(n())});r.addEventListener("pointerdown",()=>{o=!0,e.setState(!1)},{signal:i}),t.prosemirrorView.root.addEventListener("pointerup",()=>{o=!1,t.isFocused()&&e.setState(n())},{signal:i,capture:!0}),r.addEventListener("pointercancel",()=>{o=!0},{signal:i,capture:!0}),t.prosemirrorView.root.addEventListener("dragstart",()=>{s=!0,e.setState(!1)},{signal:i}),t.prosemirrorView.root.addEventListener("dragend",()=>{s=!1},{signal:i}),i.addEventListener("abort",()=>{a(),l()})}}}),S9=de(()=>({key:"history",prosemirrorPlugins:[e3()],undoCommand:Sk,redoCommand:xk})),x9=de(({editor:t})=>{function e(i){let o=t.prosemirrorView.nodeDOM(i);for(;o&&o.parentElement;){if(o.nodeName==="A")return o;o=o.parentElement}return null}function n(i){let o=t.getLinkMarkAtPos(i);if(o)return{range:{from:o.from,to:o.to},mark:{attrs:{href:o.href}},get text(){return o.text},get position(){return Z1(t.prosemirrorView,o.from,o.to).toJSON()}}}function r(){return t.transact(i=>{if(i.selection.empty)return n(i.selection.anchor)})}return{key:"linkToolbar",getLinkAtSelection:r,getLinkElementAtPos:e,getMarkAtPos(i,o){return n(i)},getLinkAtElement(i){return t.transact(()=>n(t.prosemirrorView.posAtDOM(i,0)+1))},editLink(i,o,s=t.transact(a=>a.selection.anchor)){t.editLink(i,o,s)},deleteLink(i=t.transact(o=>o.selection.anchor)){t.deleteLink(i)}}}),Jz=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"],Zz="https",w9=new he("node-selection-keyboard"),A9=de(()=>({key:"nodeSelectionKeyboard",prosemirrorPlugins:[new re({key:w9,props:{handleKeyDown:(t,e)=>{if("node"in t.state.selection){if(e.ctrlKey||e.metaKey)return!1;if(e.key.length===1)return e.preventDefault(),!0;if(e.key==="Enter"&&!e.isComposing&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey){let n=t.state.tr;return t.dispatch(n.insert(t.state.tr.selection.$to.after(),t.state.schema.nodes.paragraph.createChecked()).setSelection(new $(n.doc.resolve(t.state.tr.selection.$to.after()+1)))),!0}}return!1}}})]})),_9=new he("blocknote-placeholder"),N9=de(({editor:t,options:e})=>{let n=e.placeholders;return{key:"placeholder",prosemirrorPlugins:[new re({key:_9,view:r=>{let i=`placeholder-selector-${vh()}`;r.dom.classList.add(i);let o=document.createElement("style"),s=t._tiptapEditor.options.injectNonce;s&&o.setAttribute("nonce",s),r.root instanceof window.ShadowRoot?r.root.append(o):r.root.head.appendChild(o);let a=o.sheet,l=(u="")=>`.${i} .bn-block-content${u}:has(.ProseMirror-trailingBreak:only-child):after`;try{let{default:u,emptyDocument:c,...d}=n||{};for(let[h,f]of Object.entries(d)){let p=`[data-content-type="${h}"]`;a.insertRule(`${l(p)} { content: ${JSON.stringify(f)}; }`)}a.insertRule(`${l("[data-is-only-empty-block]")} { content: ${JSON.stringify(c)}; }`),a.insertRule(`${l("[data-is-empty-and-focused]")} { content: ${JSON.stringify(u)}; }`)}catch(u){console.warn("Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)",u)}return{destroy:()=>{r.root instanceof window.ShadowRoot?r.root.removeChild(o):r.root.head.removeChild(o)}}},props:{decorations:r=>{let{doc:i,selection:o}=r;if(!t.isEditable||!o.empty||o.$from.parent.type.spec.code)return;let s=[];r.doc.content.size===6&&s.push(me.node(2,4,{"data-is-only-empty-block":"true"}));let a=o.$anchor,l=a.parent;if(l.content.size===0){let u=a.before();s.push(me.node(u,u+l.nodeSize,{"data-is-empty-and-focused":"true"}))}return le.create(i,s)}}})]}}),L0=new he("previous-blocks"),I9={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"},M9=de(()=>{let t;return{key:"previousBlockType",prosemirrorPlugins:[new re({key:L0,view(e){return{update:async(n,r)=>{this.key?.getState(n.state).updatedBlocks.size>0&&(t=setTimeout(()=>{n.dispatch(n.state.tr.setMeta(L0,{clearUpdate:!0}))},0))},destroy:()=>{t&&clearTimeout(t)}}},state:{init(){return{prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}},apply(e,n,r,i){if(n.currentTransactionOldBlockAttrs={},n.updatedBlocks.clear(),!e.docChanged)return n;let o=e.changedRange();if(!o)return n;let s=e.mapping.invert(),a={from:s.map(o.from,-1),to:s.map(o.to,1)},l={},u=sl(r.doc,a,h=>h.attrs.id),c=new Map(u.map(h=>[h.node.attrs.id,h])),d=sl(i.doc,o,h=>h.attrs.id);for(let h of d){let f=c.get(h.node.attrs.id),p=f?.node.firstChild,g=h.node.firstChild;if(f&&p&&g){let y={index:g.attrs.index,level:g.attrs.level,type:g.type.name,depth:i.doc.resolve(h.pos).depth},b={index:p.attrs.index,level:p.attrs.level,type:p.type.name,depth:r.doc.resolve(f.pos).depth};l[h.node.attrs.id]=b,n.currentTransactionOldBlockAttrs[h.node.attrs.id]=b,(b.index!==y.index||b.level!==y.level||b.type!==y.type||b.depth!==y.depth)&&(b["depth-change"]=b.depth-y.depth,n.updatedBlocks.add(h.node.attrs.id))}}return n.prevTransactionOldBlockAttrs=l,n}},props:{decorations(e){let n=this.getState(e);if(n.updatedBlocks.size===0)return;let r=[];return e.doc.descendants((i,o)=>{if(!i.attrs.id||!n.updatedBlocks.has(i.attrs.id))return;let s=n.currentTransactionOldBlockAttrs[i.attrs.id],a={};for(let[l,u]of Object.entries(s))a["data-prev-"+I9[l]]=u||"none";r.push(me.node(o,o+i.nodeSize,{...a}))}),le.create(e.doc,r)}}})]}});function vC(t,e){for(;t&&t.parentElement&&t.parentElement!==e.dom&&t.getAttribute?.("data-node-type")!=="blockContainer";)t=t.parentElement;if(t.getAttribute?.("data-node-type")==="blockContainer")return{node:t,id:t.getAttribute("data-id")}}function O9(){let t=e=>{let n=e.children.length;for(let r=0;r<n;r++){let i=e.children[r];if(i.type==="element"&&(t(i),i.tagName==="u"))if(i.children.length>0){e.children.splice(r,1,...i.children);let o=i.children.length-1;n+=o,r+=o}else e.children.splice(r,1),n--,r--}};return t}function D9(){let t=e=>{if(e.children&&"length"in e.children&&e.children.length)for(let n=e.children.length-1;n>=0;n--){let r=e.children[n],i=n+1<e.children.length?e.children[n+1]:void 0;r.type==="element"&&r.tagName==="input"&&r.properties?.type==="checkbox"&&i?.type==="element"&&i.tagName==="p"?(i.tagName="span",i.children.splice(0,0,n9(document.createTextNode(" ")))):t(r)}};return t}function v9(){return t=>{oi(t,"element",(e,n,r)=>{if(r&&e.tagName==="video"){let i=e.properties?.src||e.properties?.["data-url"]||"",o=e.properties?.title||e.properties?.["data-name"]||"";r.children[n]={type:"text",value:`![${o}](${i})`}}})}}function Yf(t){return xC().use(kP,{fragment:!0}).use(v9).use(O9).use(D9).use(XB).use(SC).use(WF,{handlers:{text:e=>e.value}}).processSync(t).value}function L9(t,e,n,r){return Yf(Su(e,n).exportBlocks(t,r))}function LC(t){let e=[];return t.descendants(n=>{let r=Fe(n);return n.type.name==="blockContainer"&&n.firstChild?.type.name==="blockGroup"?!0:n.type.name==="columnList"&&n.childCount===1?(n.firstChild?.forEach(i=>{e.push(Ae(i,r))}),!1):n.type.isInGroup("bnBlock")?(e.push(Ae(n,r)),!1):!0}),e}var Yd=class ja extends G{nodes;constructor(e,n){super(e,n);let r=e.node();this.nodes=[],e.doc.nodesBetween(e.pos,n.pos,(i,o,s)=>{if(s!==null&&s.eq(r))return this.nodes.push(i),!1})}static create(e,n,r=n){return new ja(e.resolve(n),e.resolve(r))}content(){return new B(M.from(this.nodes),0,0)}eq(e){if(!(e instanceof ja)||this.nodes.length!==e.nodes.length||this.from!==e.from||this.to!==e.to)return!1;for(let n=0;n<this.nodes.length;n++)if(!this.nodes[n].eq(e.nodes[n]))return!1;return!0}map(e,n){let r=n.mapResult(this.from),i=n.mapResult(this.to);return i.deleted?G.near(e.resolve(r.pos)):r.deleted?G.near(e.resolve(i.pos)):new ja(e.resolve(r.pos),e.resolve(i.pos))}toJSON(){return{type:"multiple-node",anchor:this.anchor,head:this.head}}};G.jsonID("multiple-node",Yd);var en;function R9(t,e){let n,r,i=e.resolve(t.from).node().type.spec.group==="blockContent",o=e.resolve(t.to).node().type.spec.group==="blockContent",s=Math.min(t.$anchor.depth,t.$head.depth);if(i&&o){let a=t.$from.start(s-1),l=t.$to.end(s-1);n=e.resolve(a-1).pos,r=e.resolve(l+1).pos}else n=t.from,r=t.to;return{from:n,to:r}}function R0(t,e,n=e){e===n&&(n+=t.state.doc.resolve(e+1).node().nodeSize);let r=t.domAtPos(e).node.cloneNode(!0),i=t.domAtPos(e).node,o=(c,d)=>Array.prototype.indexOf.call(c.children,d),s=o(i,t.domAtPos(e+1).node.parentElement),a=o(i,t.domAtPos(n-1).node.parentElement);for(let c=i.childElementCount-1;c>=0;c--)(c>a||c<s)&&r.removeChild(r.children[c]);RC(t.root),en=r;let l=en.getElementsByTagName("iframe");for(let c=0;c<l.length;c++){let d=l[c],h=d.parentElement;h&&h.removeChild(d)}let u=t.dom.className.split(" ").filter(c=>c!=="ProseMirror"&&c!=="bn-root"&&c!=="bn-editor").join(" ");en.className=en.className+" bn-drag-preview "+u,t.root instanceof ShadowRoot?t.root.appendChild(en):t.root.body.appendChild(en)}function RC(t){en!==void 0&&(t instanceof ShadowRoot?t.removeChild(en):t.body.removeChild(en),en=void 0)}function P9(t,e,n){if(!t.dataTransfer||n.headless)return;let r=n.prosemirrorView,i=Rt(e.id,r.state.doc);if(!i)throw Error(`Block with ID ${e.id} not found`);let o=i.posBeforeNode;if(o!=null){let s=r.state.selection,a=r.state.doc,{from:l,to:u}=R9(s,a),c=l<=o&&o<u,d=s.$anchor.node()!==s.$head.node()||s instanceof Yd;c&&d?(r.dispatch(r.state.tr.setSelection(Yd.create(a,l,u))),R0(r,l,u)):(r.dispatch(r.state.tr.setSelection(q.create(r.state.doc,o))),R0(r,o));let h=r.state.selection.content(),f=n.pmSchema,p=r.serializeForClipboard(h).dom.innerHTML,g=Su(f,n),y=LC(h.content),b=g.exportBlocks(y,{}),C=Yf(b);t.dataTransfer.clearData(),t.dataTransfer.setData("blocknote/html",p),t.dataTransfer.setData("text/html",b),t.dataTransfer.setData("text/plain",C),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(en,0,0)}}var P0=250;function Gd(t,e,n=!0){let r=t.root.elementsFromPoint(e.left,e.top);for(let i of r)if(t.dom.contains(i))return n&&i.closest("[data-node-type=columnList]")?Gd(t,{left:e.left+50,top:e.top},!1):vC(i,t)}function B9(t,e){if(!e.dom.firstChild)return;let n=e.dom.firstChild.getBoundingClientRect(),r=Gd(e,{left:Math.min(Math.max(n.left+10,t.x),n.right-10),top:t.y});if(r)return Gd(e,{left:r.node.getBoundingClientRect().right-10,top:t.y},!1)}var F9=class{state;emitUpdate;mousePos;hoveredBlock;menuFrozen=!1;isDragOrigin=!1;constructor(e,n,r){this.editor=e,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized side menu");r(this.state)},this.pmView.root.addEventListener("dragstart",this.onDragStart),this.pmView.root.addEventListener("dragover",this.onDragOver),this.pmView.root.addEventListener("drop",this.onDrop,!0),this.pmView.root.addEventListener("dragend",this.onDragEnd,!0),this.pmView.root.addEventListener("mousemove",this.onMouseMove,!0),this.pmView.root.addEventListener("keydown",this.onKeyDown,!0)}updateState=e=>{this.state=e,this.emitUpdate(this.state)};updateStateFromMousePos=()=>{if(this.menuFrozen||!this.mousePos)return;let e=this.findClosestEditorElement({clientX:this.mousePos.x,clientY:this.mousePos.y});if(e?.element!==this.pmView.dom||e.distance>P0){this.state?.show&&(this.state.show=!1,this.updateState(this.state));return}let n=B9(this.mousePos,this.pmView);if(!n||!this.editor.isEditable){this.state?.show&&(this.state.show=!1,this.updateState(this.state));return}if(!(this.state?.show&&this.hoveredBlock?.hasAttribute("data-id")&&this.hoveredBlock?.getAttribute("data-id")===n.id)&&(this.hoveredBlock=n.node,this.editor.isEditable)){let r=n.node.getBoundingClientRect(),i=n.node.closest("[data-node-type=column]");this.state={show:!0,referencePos:new DOMRect(i?i.firstElementChild.getBoundingClientRect().x:this.pmView.dom.firstChild.getBoundingClientRect().x,r.y,r.width,r.height),block:this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))},this.updateState(this.state)}};onDragStart=e=>{let n=e.dataTransfer?.getData("blocknote/html");if(!n||this.pmView.dragging)return;let r=document.createElement("div");r.innerHTML=n;let i=Vt.fromSchema(this.pmView.state.schema).parse(r,{topNode:this.pmView.state.schema.nodes.blockGroup.create()});this.pmView.dragging={slice:new B(i.content,0,0),move:!0}};findClosestEditorElement=e=>{let n=Array.from(this.pmView.root.querySelectorAll(".bn-editor"));if(n.length===0)return null;let r=n[0],i=Number.MAX_VALUE;return n.forEach(o=>{let s=o.querySelector(".bn-block-group").getBoundingClientRect(),a=e.clientX<s.left?s.left-e.clientX:e.clientX>s.right?e.clientX-s.right:0,l=e.clientY<s.top?s.top-e.clientY:e.clientY>s.bottom?e.clientY-s.bottom:0,u=Math.sqrt(a**2+l**2);u<i&&(i=u,r=o)}),{element:r,distance:i}};onDragOver=e=>{if(e.synthetic||!(this.pmView.dragging!==null||this.isDragOrigin||e.dataTransfer?.types.includes("blocknote/html")||e.target instanceof Node&&this.pmView.dom.contains(e.target)))return;let n=this.getDragEventContext(e);if(!n||!n.isDropPoint){this.closeDropCursor();return}n.isDropPoint&&!n.isDropWithinEditorBounds&&this.dispatchSyntheticEvent(e)};closeDropCursor=()=>{let e=new Event("dragleave",{bubbles:!1});e.synthetic=!0,this.pmView.dom.dispatchEvent(e)};getDragEventContext=e=>{if(!(this.pmView.dragging!==null||this.isDragOrigin||e.dataTransfer?.types.includes("blocknote/html")||e.target instanceof Node&&this.pmView.dom.contains(e.target)))return;let n=!e.dataTransfer?.types.includes("blocknote/html")&&!!this.pmView.dragging,r=!!this.isDragOrigin,i=n||r,o=this.findClosestEditorElement(e);if(!o||o.distance>P0)return;let s=o.element===this.pmView.dom,a=s&&o.distance===0;if(!(!s&&!i))return{isDropPoint:s,isDropWithinEditorBounds:a,isDragOrigin:i}};onDrop=e=>{if(e.synthetic||!(this.pmView.dragging!==null||this.isDragOrigin||e.dataTransfer?.types.includes("blocknote/html")||e.target instanceof Node&&this.pmView.dom.contains(e.target)))return;let n=this.getDragEventContext(e);if(!n){this.closeDropCursor();return}let{isDropPoint:r,isDropWithinEditorBounds:i,isDragOrigin:o}=n;if(!i&&r&&this.dispatchSyntheticEvent(e),r){if(this.pmView.dragging)return;this.pmView.dispatch(this.pmView.state.tr.setSelection($.create(this.pmView.state.tr.doc,this.pmView.state.tr.selection.anchor)));return}else if(o){setTimeout(()=>this.pmView.dispatch(this.pmView.state.tr.deleteSelection()),0);return}};onDragEnd=e=>{e.synthetic||(this.pmView.dragging=null)};onKeyDown=e=>{this.state?.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state))};onMouseMove=e=>{if(this.menuFrozen)return;this.mousePos={x:e.clientX,y:e.clientY};let n=this.pmView.dom.getBoundingClientRect();if(this.mousePos.x>n.left&&this.mousePos.x<n.right&&this.mousePos.y>n.top&&this.mousePos.y<n.bottom&&e&&e.target&&!this.editor.isWithinEditor(e.target)){this.state?.show&&(this.state.show=!1,this.emitUpdate(this.state));return}this.updateStateFromMousePos()};dispatchSyntheticEvent(e){let n=new Event(e.type,e),r=this.pmView.dom.firstChild.getBoundingClientRect();n.clientX=e.clientX,n.clientY=e.clientY,n.clientX=Math.min(Math.max(e.clientX,r.left),r.left+r.width),n.clientY=Math.min(Math.max(e.clientY,r.top),r.top+r.height),n.dataTransfer=e.dataTransfer,n.preventDefault=()=>e.preventDefault(),n.synthetic=!0,this.pmView.dom.dispatchEvent(n)}update(e,n){!n.doc.eq(this.pmView.state.doc)&&this.state?.show&&this.updateStateFromMousePos()}destroy(){this.state?.show&&(this.state.show=!1,this.emitUpdate(this.state)),this.pmView.root.removeEventListener("mousemove",this.onMouseMove,!0),this.pmView.root.removeEventListener("dragstart",this.onDragStart),this.pmView.root.removeEventListener("dragover",this.onDragOver),this.pmView.root.removeEventListener("drop",this.onDrop,!0),this.pmView.root.removeEventListener("dragend",this.onDragEnd,!0),this.pmView.root.removeEventListener("keydown",this.onKeyDown,!0)}},H9=new he("SideMenuPlugin"),U9=de(({editor:t})=>{let e,n=ai(void 0);return{key:"sideMenu",store:n,prosemirrorPlugins:[new re({key:H9,view:r=>(e=new F9(t,r,i=>{n.setState({...i})}),e)})],blockDragStart(r,i){e&&(e.isDragOrigin=!0),P9(r,i,t)},blockDragEnd(){RC(t.prosemirrorView.root),e&&(e.isDragOrigin=!1),t.blur()},freezeMenu(){e.menuFrozen=!0,e.state.show=!0,e.emitUpdate(e.state)},unfreezeMenu(){e.menuFrozen=!1,e.state.show=!1,e.emitUpdate(e.state)},hideMenuIfNotFrozen(){!e.menuFrozen&&e.state.show&&(e.state.show=!1,e.emitUpdate(e.state))}}}),_c;async function $9(){return _c||(_c=(async()=>{let[t,e]=await Promise.all([ip(()=>import("./module-RjUF93sV.js"),[]),ip(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in t?t.default:t,r="default"in e?e.default:e;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),_c)}async function tV(t,e){if(!("text"in t.schema.inlineContentSchema)||t.schema.inlineContentSchema.text!==$L.text)return[];let{emojiData:n,emojiMart:r}=await $9();return(e.trim()===""?Object.values(n.emojis):await r.SearchIndex.search(e)).map(i=>({id:i.skins[0].native,onItemClick:()=>t.insertInlineContent(i.skins[0].native+" ")}))}var It;function B0(t){It||(It=document.createElement("div"),It.innerHTML="_",It.style.opacity="0",It.style.height="1px",It.style.width="1px",t instanceof Document?t.body.appendChild(It):t.appendChild(It))}function z9(t){It&&=(t instanceof Document?t.body.removeChild(It):t.removeChild(It),void 0)}function ka(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function V9(t){let e=t;for(;e&&e.nodeName!=="TD"&&e.nodeName!=="TH"&&!e.classList.contains("tableWrapper");){if(e.classList.contains("ProseMirror"))return;let n=e.parentNode;if(!n||!(n instanceof Element))return;e=n}return e.nodeName==="TD"||e.nodeName==="TH"?{type:"cell",domNode:e,tbodyNode:e.closest("tbody")}:{type:"wrapper",domNode:e,tbodyNode:e.querySelector("tbody")}}function q9(t,e){let n=e.querySelectorAll(t);for(let r=0;r<n.length;r++)n[r].style.visibility="hidden"}var j9=class{state;emitUpdate;tableId;tablePos;tableElement;menuFrozen=!1;mouseState="up";prevWasEditable=null;constructor(e,n,r){this.editor=e,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized image toolbar");r(this.state)},n.dom.addEventListener("mousemove",this.mouseMoveHandler),n.dom.addEventListener("mousedown",this.viewMousedownHandler),window.addEventListener("mouseup",this.mouseUpHandler),n.root.addEventListener("dragover",this.dragOverHandler),n.root.addEventListener("drop",this.dropHandler)}viewMousedownHandler=()=>{this.mouseState="down"};mouseUpHandler=e=>{this.mouseState="up",this.mouseMoveHandler(e)};mouseMoveHandler=e=>{if(this.menuFrozen||this.mouseState==="selecting"||!(e.target instanceof Element)||!this.pmView.dom.contains(e.target))return;let n=V9(e.target);if(n?.type==="cell"&&this.mouseState==="down"&&!this.state?.draggingState){this.mouseState="selecting",this.state?.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!n||!this.editor.isEditable){this.state?.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!n.tbodyNode)return;let r=n.tbodyNode.getBoundingClientRect(),i=vC(n.domNode,this.pmView);if(!i)return;this.tableElement=i.node;let o,s=this.editor.transact(u=>Rt(i.id,u.doc));if(!s)throw Error(`Block with ID ${i.id} not found`);let a=Ae(s.node,this.editor.pmSchema,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema);if(Ue(this.editor,"table")&&(this.tablePos=s.posBeforeNode+1,o=a),!o)return;this.tableId=i.id;let l=n.domNode.closest(".tableWrapper")?.querySelector(".table-widgets-container");if(n?.type==="wrapper"){let u=e.clientY>=r.bottom-1&&e.clientY<r.bottom+20,c=e.clientX>=r.right-1&&e.clientX<r.right+20,d=this.state?.block.id!==o.id||e.clientX>r.right||e.clientY>r.bottom;this.state={...this.state,show:!0,showAddOrRemoveRowsButton:u,showAddOrRemoveColumnsButton:c,referencePosTable:r,block:o,widgetContainer:l,colIndex:d?void 0:this.state?.colIndex,rowIndex:d?void 0:this.state?.rowIndex,referencePosCell:d?void 0:this.state?.referencePosCell}}else{let u=ka(n.domNode),c=ka(n.domNode.parentElement),d=n.domNode.getBoundingClientRect();if(this.state!==void 0&&this.state.show&&this.tableId===i.id&&this.state.rowIndex===c&&this.state.colIndex===u)return;this.state={show:!0,showAddOrRemoveColumnsButton:u===o.content.rows[0].cells.length-1,showAddOrRemoveRowsButton:c===o.content.rows.length-1,referencePosTable:r,block:o,draggingState:void 0,referencePosCell:d,colIndex:u,rowIndex:c,widgetContainer:l}}return this.emitUpdate(),!1};dragOverHandler=e=>{if(this.state?.draggingState===void 0)return;e.preventDefault(),e.dataTransfer.dropEffect="move",q9(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",this.pmView.root);let n={left:Math.min(Math.max(e.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(e.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},r=this.pmView.root.elementsFromPoint(n.left,n.top).filter(d=>d.tagName==="TD"||d.tagName==="TH");if(r.length===0)return;let i=r[0],o=!1,s=ka(i.parentElement),a=ka(i),l=this.state.draggingState.draggedCellOrientation==="row"?this.state.rowIndex:this.state.colIndex,u=(this.state.draggingState.draggedCellOrientation==="row"?s:a)!==l;(this.state.rowIndex!==s||this.state.colIndex!==a)&&(this.state.rowIndex=s,this.state.colIndex=a,this.state.referencePosCell=i.getBoundingClientRect(),o=!0);let c=this.state.draggingState.draggedCellOrientation==="row"?n.top:n.left;this.state.draggingState.mousePos!==c&&(this.state.draggingState.mousePos=c,o=!0),o&&this.emitUpdate(),u&&this.editor.transact(d=>d.setMeta(Ro,!0))};dropHandler=e=>{if(this.mouseState="up",this.state===void 0||this.state.draggingState===void 0)return!1;if(this.state.rowIndex===void 0||this.state.colIndex===void 0)throw Error("Attempted to drop table row or column, but no table block was hovered prior.");e.preventDefault();let{draggingState:n,colIndex:r,rowIndex:i}=this.state,o=this.state.block.content.columnWidths;if(n.draggedCellOrientation==="row"){if(!sk(this.state.block,n.originalIndex,i))return!1;let s=wv(this.state.block,n.originalIndex,i);this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,rows:s}})}else{if(!ak(this.state.block,n.originalIndex,r))return!1;let s=xv(this.state.block,n.originalIndex,r),[a]=o.splice(n.originalIndex,1);o.splice(r,0,a),this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,columnWidths:o,rows:s}})}return this.editor.setTextCursorPosition(this.state.block.id),!0};update(){if(!this.state||!this.state.show)return;if(this.state.block=this.editor.getBlock(this.state.block.id),!this.state.block||this.state.block.type!=="table"||!this.tableElement?.isConnected){this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate();return}let{height:e,width:n}=yf(this.state.block);this.state.rowIndex!==void 0&&this.state.colIndex!==void 0&&(this.state.rowIndex>=e&&(this.state.rowIndex=e-1),this.state.colIndex>=n&&(this.state.colIndex=n-1));let r=this.tableElement.querySelector("tbody");if(!r)throw Error("Table block does not contain a 'tbody' HTML element. This should never happen.");if(this.state.rowIndex!==void 0&&this.state.colIndex!==void 0){let i=r.children[this.state.rowIndex].children[this.state.colIndex];i?this.state.referencePosCell=i.getBoundingClientRect():(this.state.rowIndex=void 0,this.state.colIndex=void 0)}this.state.referencePosTable=r.getBoundingClientRect(),this.emitUpdate()}destroy(){this.pmView.dom.removeEventListener("mousemove",this.mouseMoveHandler),window.removeEventListener("mouseup",this.mouseUpHandler),this.pmView.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.pmView.root.removeEventListener("dragover",this.dragOverHandler),this.pmView.root.removeEventListener("drop",this.dropHandler)}},Ro=new he("TableHandlesPlugin"),W9=de(({editor:t})=>{let e,n=ai(void 0);return{key:"tableHandles",store:n,prosemirrorPlugins:[new re({key:Ro,view:r=>(e=new j9(t,r,i=>{n.setState(i.block?{...i,draggingState:i.draggingState?{...i.draggingState}:void 0}:void 0)}),e),props:{decorations:r=>{if(e===void 0||e.state===void 0||e.state.draggingState===void 0||e.tablePos===void 0)return;let i=e.state.draggingState.draggedCellOrientation==="row"?e.state.rowIndex:e.state.colIndex;if(i===void 0)return;let o=[],{block:s,draggingState:a}=e.state,{originalIndex:l,draggedCellOrientation:u}=a;if(i===l||!s||u==="row"&&!sk(s,l,i)||u==="col"&&!ak(s,l,i))return le.create(r.doc,o);let c=r.doc.resolve(e.tablePos+1);return e.state.draggingState.draggedCellOrientation==="row"?wd(e.state.block,i).forEach(({row:d,col:h})=>{let f=r.doc.resolve(c.posAtIndex(d)+1),p=r.doc.resolve(f.posAtIndex(h)+1),g=p.node(),y=p.pos+(i>l?g.nodeSize-2:0);o.push(me.widget(y,()=>{let b=document.createElement("div");return b.className="bn-table-drop-cursor",b.style.left="0",b.style.right="0",i>l?b.style.bottom="-2px":b.style.top="-3px",b.style.height="4px",b}))}):Ad(e.state.block,i).forEach(({row:d,col:h})=>{let f=r.doc.resolve(c.posAtIndex(d)+1),p=r.doc.resolve(f.posAtIndex(h)+1),g=p.node(),y=p.pos+(i>l?g.nodeSize-2:0);o.push(me.widget(y,()=>{let b=document.createElement("div");return b.className="bn-table-drop-cursor",b.style.top="0",b.style.bottom="0",i>l?b.style.right="-2px":b.style.left="-3px",b.style.width="4px",b}))}),le.create(r.doc,o)}}})],colDragStart(r){if(e===void 0||e.state===void 0||e.state.colIndex===void 0)throw Error("Attempted to drag table column, but no table block was hovered prior.");e.state.draggingState={draggedCellOrientation:"col",originalIndex:e.state.colIndex,mousePos:r.clientX},e.emitUpdate(),t.transact(i=>i.setMeta(Ro,{draggedCellOrientation:e.state.draggingState.draggedCellOrientation,originalIndex:e.state.colIndex,newIndex:e.state.colIndex,tablePos:e.tablePos})),!t.headless&&(B0(t.prosemirrorView.root),r.dataTransfer.setDragImage(It,0,0),r.dataTransfer.effectAllowed="move")},rowDragStart(r){if(e.state===void 0||e.state.rowIndex===void 0)throw Error("Attempted to drag table row, but no table block was hovered prior.");e.state.draggingState={draggedCellOrientation:"row",originalIndex:e.state.rowIndex,mousePos:r.clientY},e.emitUpdate(),t.transact(i=>i.setMeta(Ro,{draggedCellOrientation:e.state.draggingState.draggedCellOrientation,originalIndex:e.state.rowIndex,newIndex:e.state.rowIndex,tablePos:e.tablePos})),!t.headless&&(B0(t.prosemirrorView.root),r.dataTransfer.setDragImage(It,0,0),r.dataTransfer.effectAllowed="copyMove")},dragEnd(){if(e.state===void 0)throw Error("Attempted to drag table row, but no table block was hovered prior.");e.state.draggingState=void 0,e.emitUpdate(),t.transact(r=>r.setMeta(Ro,null)),!t.headless&&z9(t.prosemirrorView.root)},freezeHandles(){e.menuFrozen=!0},unfreezeHandles(){e.menuFrozen=!1},hideHandlesIfNotFrozen(){!e.menuFrozen&&e.state?.show&&(e.state.show=!1,e.state.showAddOrRemoveRowsButton=!1,e.state.showAddOrRemoveColumnsButton=!1,e.emitUpdate())},getCellsAtRowHandle(r,i){return wd(r,i)},getCellsAtColumnHandle(r,i){return Ad(r,i)},setCellSelection(r,i,o=i){if(!e)throw Error("Table handles view not initialized");let s=r.doc.resolve(e.tablePos+1),a=r.doc.resolve(s.posAtIndex(i.row)+1),l=r.doc.resolve(a.posAtIndex(i.col)),u=r.doc.resolve(s.posAtIndex(o.row)+1),c=r.doc.resolve(u.posAtIndex(o.col)),d=r.tr;return d.setSelection(new fe(l,c)),r.apply(d)},addRowOrColumn(r,i){t.exec((o,s)=>{let a=this.setCellSelection(o,i.orientation==="row"?{row:r,col:0}:{row:0,col:r});return i.orientation==="row"?i.side==="above"?nN(a,s):rN(a,s):i.side==="left"?X_(a,s):J_(a,s)})},removeRowOrColumn(r,i){return i==="row"?t.exec((o,s)=>oN(this.setCellSelection(o,{row:r,col:0}),s)):t.exec((o,s)=>eN(this.setCellSelection(o,{row:0,col:r}),s))},mergeCells(r){return t.exec((i,o)=>aN(r?this.setCellSelection(i,r.relativeStartCell,r.relativeEndCell):i,o))},splitCell(r){return t.exec((i,o)=>lN(r?this.setCellSelection(i,r):i,o))},getCellSelection(){return t.transact(r=>{let i=r.selection,o=i.$from,s=i.$to;if(bg(i)){let{ranges:g}=i;g.forEach(y=>{o=y.$from.min(o??y.$from),s=y.$to.max(s??y.$to)})}else if(o=r.doc.resolve(i.$from.pos-i.$from.parentOffset-1),s=r.doc.resolve(i.$to.pos-i.$to.parentOffset-1),o.pos===0||s.pos===0)return;let a=r.doc.resolve(o.pos-o.parentOffset-1),l=r.doc.resolve(s.pos-s.parentOffset-1),u=r.doc.resolve(a.pos-a.parentOffset-1),c=o.index(a.depth),d=a.index(u.depth),h=s.index(l.depth),f=l.index(u.depth),p=[];for(let g=d;g<=f;g++)for(let y=c;y<=h;y++)p.push({row:g,col:y});return{from:{row:d,col:c},to:{row:f,col:h},cells:p}})},getMergeDirection(r){return t.transact(i=>{let o=bg(i.selection)?i.selection:void 0;if(!o||!r||o.ranges.length<=1)return;let s=this.getCellSelection();if(s)return Nv(s.from,s.to,r)?"vertical":"horizontal"})},cropEmptyRowsOrColumns(r,i){return Av(r,i)},addRowsOrColumns(r,i,o){return _v(r,i,o)}}}),F0=new he("trailingNode"),Y9=de(()=>({key:"trailingNode",prosemirrorPlugins:[new re({key:F0,appendTransaction:(t,e,n)=>{let{doc:r,tr:i,schema:o}=n,s=F0.getState(n),a=r.content.size-2,l=o.nodes.blockContainer,u=o.nodes.paragraph;if(s)return i.insert(a,l.create(void 0,u.create()))},state:{init:(t,e)=>{},apply:(t,e)=>{if(!t.docChanged)return e;let n=t.doc.lastChild;if(!n||n.type.name!=="blockGroup")throw Error("Expected blockGroup");if(n=n.lastChild,!n||n.type.name!=="blockContainer")return!0;let r=n.firstChild;if(!r)throw Error("Expected blockContent");return n.nodeSize>4||r.type.spec.content!=="inline*"}}})]})),H0=new he("blocknote-show-selection"),G9=de(({editor:t})=>{let e=ai({enabledSet:new Set},{onUpdate(){t.transact(n=>n.setMeta(H0,{}))}});return{key:"showSelection",store:e,prosemirrorPlugins:[new re({key:H0,props:{decorations:n=>{let{doc:r,selection:i}=n;if(e.state.enabledSet.size===0)return le.empty;let o=me.inline(i.from,i.to,{"data-show-selection":"true"});return le.create(r,[o])}}})],showSelection(n,r){e.setState({enabledSet:n?new Set([...e.state.enabledSet,r]):new Set([...e.state.enabledSet].filter(i=>i!==r))})}}}),K9={slash_menu:{heading:{title:"Heading 1",subtext:"Top-level heading",aliases:["h","heading1","h1"],group:"Headings"},heading_2:{title:"Heading 2",subtext:"Key section heading",aliases:["h2","heading2","subheading"],group:"Headings"},heading_3:{title:"Heading 3",subtext:"Subsection and group heading",aliases:["h3","heading3","subheading"],group:"Headings"},heading_4:{title:"Heading 4",subtext:"Minor subsection heading",aliases:["h4","heading4","subheading4"],group:"Subheadings"},heading_5:{title:"Heading 5",subtext:"Small subsection heading",aliases:["h5","heading5","subheading5"],group:"Subheadings"},heading_6:{title:"Heading 6",subtext:"Lowest-level heading",aliases:["h6","heading6","subheading6"],group:"Subheadings"},toggle_heading:{title:"Toggle Heading 1",subtext:"Toggleable top-level heading",aliases:["h","heading1","h1","collapsable"],group:"Subheadings"},toggle_heading_2:{title:"Toggle Heading 2",subtext:"Toggleable key section heading",aliases:["h2","heading2","subheading","collapsable"],group:"Subheadings"},toggle_heading_3:{title:"Toggle Heading 3",subtext:"Toggleable subsection and group heading",aliases:["h3","heading3","subheading","collapsable"],group:"Subheadings"},quote:{title:"Quote",subtext:"Quote or excerpt",aliases:["quotation","blockquote","bq"],group:"Basic blocks"},toggle_list:{title:"Toggle List",subtext:"List with hideable sub-items",aliases:["li","list","toggleList","toggle list","collapsable list"],group:"Basic blocks"},numbered_list:{title:"Numbered List",subtext:"List with ordered items",aliases:["ol","li","list","numberedlist","numbered list"],group:"Basic blocks"},bullet_list:{title:"Bullet List",subtext:"List with unordered items",aliases:["ul","li","list","bulletlist","bullet list"],group:"Basic blocks"},check_list:{title:"Check List",subtext:"List with checkboxes",aliases:["ul","li","list","checklist","check list","checked list","checkbox"],group:"Basic blocks"},paragraph:{title:"Paragraph",subtext:"The body of your document",aliases:["p","paragraph"],group:"Basic blocks"},code_block:{title:"Code Block",subtext:"Code block with syntax highlighting",aliases:["code","pre"],group:"Basic blocks"},page_break:{title:"Page Break",subtext:"Page separator",aliases:["page","break","separator"],group:"Basic blocks"},table:{title:"Table",subtext:"Table with editable cells",aliases:["table"],group:"Advanced"},image:{title:"Image",subtext:"Resizable image with caption",aliases:["image","imageUpload","upload","img","picture","media","url"],group:"Media"},video:{title:"Video",subtext:"Resizable video with caption",aliases:["video","videoUpload","upload","mp4","film","media","url"],group:"Media"},audio:{title:"Audio",subtext:"Embedded audio with caption",aliases:["audio","audioUpload","upload","mp3","sound","media","url"],group:"Media"},file:{title:"File",subtext:"Embedded file",aliases:["file","upload","embed","media","url"],group:"Media"},emoji:{title:"Emoji",subtext:"Search for and insert an emoji",aliases:["emoji","emote","emotion","face"],group:"Others"},divider:{title:"Divider",subtext:"Visually divide blocks",aliases:["divider","hr","line","horizontal rule"],group:"Basic blocks"}},placeholders:{default:"Enter text or type '/' for commands",heading:"Heading",toggleListItem:"Toggle",bulletListItem:"List",numberedListItem:"List",checkListItem:"List",emptyDocument:void 0,new_comment:"Write a comment...",edit_comment:"Edit comment...",comment_reply:"Add comment..."},file_blocks:{add_button_text:{image:"Add image",video:"Add video",audio:"Add audio",file:"Add file"}},toggle_blocks:{add_block_button:"Empty toggle. Click to add a block."},side_menu:{add_block_label:"Add block",drag_handle_label:"Open block menu"},drag_handle:{delete_menuitem:"Delete",colors_menuitem:"Colors",header_row_menuitem:"Header row",header_column_menuitem:"Header column"},table_handle:{delete_column_menuitem:"Delete column",delete_row_menuitem:"Delete row",add_left_menuitem:"Add column left",add_right_menuitem:"Add column right",add_above_menuitem:"Add row above",add_below_menuitem:"Add row below",split_cell_menuitem:"Split cell",merge_cells_menuitem:"Merge cells",background_color_menuitem:"Background color"},suggestion_menu:{no_items_title:"No items found"},color_picker:{text_title:"Text",background_title:"Background",colors:{default:"Default",gray:"Gray",brown:"Brown",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",pink:"Pink"}},formatting_toolbar:{bold:{tooltip:"Bold",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italic",secondary_tooltip:"Mod+I"},underline:{tooltip:"Underline",secondary_tooltip:"Mod+U"},strike:{tooltip:"Strike",secondary_tooltip:"Mod+Shift+S"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Colors"},link:{tooltip:"Create link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Edit caption",input_placeholder:"Edit caption"},file_replace:{tooltip:{image:"Replace image",video:"Replace video",audio:"Replace audio",file:"Replace file"}},file_rename:{tooltip:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"},input_placeholder:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"}},file_download:{tooltip:{image:"Download image",video:"Download video",audio:"Download audio",file:"Download file"}},file_delete:{tooltip:{image:"Delete image",video:"Delete video",audio:"Delete audio",file:"Delete file"}},file_preview_toggle:{tooltip:"Toggle preview"},nest:{tooltip:"Nest block",secondary_tooltip:"Tab"},unnest:{tooltip:"Unnest block",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Align text left"},align_center:{tooltip:"Align text center"},align_right:{tooltip:"Align text right"},align_justify:{tooltip:"Justify text"},table_cell_merge:{tooltip:"Merge cells"},comment:{tooltip:"Add comment"}},file_panel:{upload:{title:"Upload",file_placeholder:{image:"Upload image",video:"Upload video",audio:"Upload audio",file:"Upload file"},upload_error:"Error: Upload failed"},embed:{title:"Embed",embed_button:{image:"Embed image",video:"Embed video",audio:"Embed audio",file:"Embed file"},url_placeholder:"Enter URL"}},link_toolbar:{delete:{tooltip:"Remove link"},edit:{text:"Edit link",tooltip:"Edit"},open:{tooltip:"Open in new tab"},form:{title_placeholder:"Edit title",url_placeholder:"Edit URL"}},comments:{edited:"edited",save_button_text:"Save",cancel_button_text:"Cancel",actions:{add_reaction:"Add reaction",resolve:"Resolve",edit_comment:"Edit comment",delete_comment:"Delete comment",more_actions:"More actions"},reactions:{reacted_by:"Reacted by"},sidebar:{marked_as_resolved:"Marked as resolved",more_replies:t=>`${t} more replies`}},generic:{ctrl_shortcut:"Ctrl"}},PC=class{callbacks={};on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),()=>this.off(t,e)}emit(t,...e){let n=this.callbacks[t];n&&n.forEach(r=>r.apply(this,e))}off(t,e){let n=this.callbacks[t];n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t])}removeAllListeners(){this.callbacks={}}};const Q9={tokenize:X9};function X9(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),ue(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),o(a)}function o(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return Y(a)?(t.consume(a),t.exit("chunkText"),o):(t.consume(a),s)}}const J9={tokenize:Z9},U0={tokenize:eH};function Z9(t){const e=this,n=[];let r=0,i,o,s;return a;function a(w){if(r<n.length){const v=n[r];return e.containerState=v[1],t.attempt(v[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&C();const v=e.events.length;let O=v,_;for(;O--;)if(e.events[O][0]==="exit"&&e.events[O][1].type==="chunkFlow"){_=e.events[O][1].end;break}b(r);let R=v;for(;R<e.events.length;)e.events[R][1].end={..._},R++;return vt(e.events,O+1,0,e.events.slice(v)),e.events.length=R,u(w)}return a(w)}function u(w){if(r===n.length){if(!i)return h(w);if(i.currentConstruct&&i.currentConstruct.concrete)return p(w);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(U0,c,d)(w)}function c(w){return i&&C(),b(r),h(w)}function d(w){return e.parser.lazy[e.now().line]=r!==n.length,s=e.now().offset,p(w)}function h(w){return e.containerState={},t.attempt(U0,f,p)(w)}function f(w){return r++,n.push([e.currentConstruct,e.containerState]),h(w)}function p(w){if(w===null){i&&C(),b(0),t.consume(w);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),g(w)}function g(w){if(w===null){y(t.exit("chunkFlow"),!0),b(0),t.consume(w);return}return Y(w)?(t.consume(w),y(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(w),g)}function y(w,v){const O=e.sliceStream(w);if(v&&O.push(null),w.previous=o,o&&(o.next=w),o=w,i.defineSkip(w.start),i.write(O),e.parser.lazy[w.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<s&&(!i.events[_][1].end||i.events[_][1].end.offset>s))return;const R=e.events.length;let U=R,z,N;for(;U--;)if(e.events[U][0]==="exit"&&e.events[U][1].type==="chunkFlow"){if(z){N=e.events[U][1].end;break}z=!0}for(b(r),_=R;_<e.events.length;)e.events[_][1].end={...N},_++;vt(e.events,U+1,0,e.events.slice(R)),e.events.length=_}}function b(w){let v=n.length;for(;v-- >w;){const O=n[v];e.containerState=O[1],O[0].exit.call(e,t)}n.length=w}function C(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function eH(t,e,n){return ue(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}const tH={tokenize:nH};function nH(t){const e=this,n=t.attempt(Gs,r,t.attempt(this.parser.constructs.flowInitial,i,ue(t,t.attempt(this.parser.constructs.flow,i,t.attempt(M8,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const rH={resolveAll:FC()},iH=BC("string"),oH=BC("text");function BC(t){return{resolveAll:FC(t==="text"?sH:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,s,a);return s;function s(c){return u(c)?o(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const d=i[c];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function FC(t){return e;function e(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return t?t(n,r):n}}function sH(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let o=i.length,s=-1,a=0,l;for(;o--;){const u=i[o];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(u===-2)l=!0,a++;else if(u!==-1){o++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const u={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:r.start._bufferIndex+s,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(t.splice(n,0,["enter",u,e],["exit",u,e]),n+=2)}n++}return t}const aH={42:Et,43:Et,45:Et,48:Et,49:Et,50:Et,51:Et,52:Et,53:Et,54:Et,55:Et,56:Et,57:Et,62:gC},lH={91:R8},uH={[-2]:kc,[-1]:kc,32:kc},cH={35:$8,42:za,45:[x0,za],60:j8,61:x0,95:za,96:C0,126:C0},dH={38:yC,92:bC},hH={[-5]:Tc,[-4]:Tc,[-3]:Tc,33:uF,38:yC,42:Vd,60:[d8,J8],91:dF,92:[H8,bC],93:jf,95:Vd,96:x8},fH={null:[Vd,rH]},pH={null:[42,95]},mH={null:[]},gH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:pH,contentInitial:lH,disable:mH,document:aH,flow:cH,flowInitial:uH,insideSpan:fH,string:dH,text:hH},Symbol.toStringTag,{value:"Module"}));function bH(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let s=[],a=[];const l={attempt:R(O),check:R(_),consume:C,enter:w,exit:v,interrupt:R(_,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:t,previous:null,sliceSerialize:h,sliceStream:f,write:d};let c=e.tokenize.call(u,l);return e.resolveAll&&o.push(e),u;function d(j){return s=Ht(s,j),y(),s[s.length-1]!==null?[]:(U(e,0),u.events=Cu(o,u.events,u),u.events)}function h(j,V){return EH(f(j),V)}function f(j){return yH(s,j)}function p(){const{_bufferIndex:j,_index:V,line:Z,column:ie,offset:K}=r;return{_bufferIndex:j,_index:V,line:Z,column:ie,offset:K}}function g(j){i[j.line]=j.column,N()}function y(){let j;for(;r._index<s.length;){const V=s[r._index];if(typeof V=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<V.length;)b(V.charCodeAt(r._bufferIndex));else b(V)}}function b(j){c=c(j)}function C(j){Y(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,N()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=j}function w(j,V){const Z=V||{};return Z.type=j,Z.start=p(),u.events.push(["enter",Z,u]),a.push(Z),Z}function v(j){const V=a.pop();return V.end=p(),u.events.push(["exit",V,u]),V}function O(j,V){U(j,V.from)}function _(j,V){V.restore()}function R(j,V){return Z;function Z(ie,K,nt){let Ge,Qt,In,S;return Array.isArray(ie)?Mn(ie):"tokenize"in ie?Mn([ie]):Xt(ie);function Xt(Ke){return bo;function bo(Kn){const mi=Kn!==null&&Ke[Kn],gi=Kn!==null&&Ke.null,Ks=[...Array.isArray(mi)?mi:mi?[mi]:[],...Array.isArray(gi)?gi:gi?[gi]:[]];return Mn(Ks)(Kn)}}function Mn(Ke){return Ge=Ke,Qt=0,Ke.length===0?nt:x(Ke[Qt])}function x(Ke){return bo;function bo(Kn){return S=z(),In=Ke,Ke.partial||(u.currentConstruct=Ke),Ke.name&&u.parser.constructs.disable.null.includes(Ke.name)?Ir():Ke.tokenize.call(V?Object.assign(Object.create(u),V):u,l,Jt,Ir)(Kn)}}function Jt(Ke){return j(In,S),K}function Ir(Ke){return S.restore(),++Qt<Ge.length?x(Ge[Qt]):nt}}}function U(j,V){j.resolveAll&&!o.includes(j)&&o.push(j),j.resolve&&vt(u.events,V,u.events.length-V,j.resolve(u.events.slice(V),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function z(){const j=p(),V=u.previous,Z=u.currentConstruct,ie=u.events.length,K=Array.from(a);return{from:ie,restore:nt};function nt(){r=j,u.previous=V,u.currentConstruct=Z,u.events.length=ie,a=K,N()}}function N(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function yH(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,o=e.end._bufferIndex;let s;if(n===i)s=[t[n].slice(r,o)];else{if(s=t.slice(n,i),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(t[i].slice(0,o))}return s}function EH(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const o=t[n];let s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
154
+ `;break}case-3:{s=`\r
155
+ `;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}function kH(t){const r={constructs:aC([gH,...(t||{}).extensions||[]]),content:i(Q9),defined:[],document:i(J9),flow:i(tH),lazy:{},string:i(iH),text:i(oH)};return r;function i(o){return s;function s(a){return bH(r,o,a)}}}function TH(t){for(;!EC(t););return t}const $0=/[\0\t\n\r]/g;function CH(){let t=1,e="",n=!0,r;return i;function i(o,s,a){const l=[];let u,c,d,h,f;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),d=0,e="",n&&(o.charCodeAt(0)===65279&&d++,n=void 0);d<o.length;){if($0.lastIndex=d,u=$0.exec(o),h=u&&u.index!==void 0?u.index:o.length,f=o.charCodeAt(h),!u){e=o.slice(d);break}if(f===10&&d===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<h&&(l.push(o.slice(d,h)),t+=h-d),f){case 0:{l.push(65533),t++;break}case 9:{for(c=Math.ceil(t/4)*4,l.push(-2);t++<c;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}d=h+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const HC={}.hasOwnProperty;function SH(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),xH(n)(TH(kH(n).document().write(CH()(t,e,!0))))}function xH(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(tp),autolinkProtocol:z,autolinkEmail:z,atxHeading:o(Jf),blockQuote:o(gi),characterEscape:z,characterReference:z,codeFenced:o(Ks),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(Ks,s),codeText:o(pS,s),codeTextData:z,data:z,codeFlowValue:z,definition:o(mS),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(gS),hardBreakEscape:o(Zf),hardBreakTrailing:o(Zf),htmlFlow:o(ep,s),htmlFlowData:z,htmlText:o(ep,s),htmlTextData:z,image:o(bS),label:s,link:o(tp),listItem:o(yS),listItemValue:h,listOrdered:o(np,d),listUnordered:o(np),paragraph:o(ES),reference:x,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(Jf),strong:o(kS),thematicBreak:o(CS)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:mi,autolinkProtocol:Kn,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:Ir,characterReferenceMarkerNumeric:Ir,characterReferenceValue:Ke,characterReference:bo,codeFenced:l(y),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:N,codeIndented:l(b),codeText:l(K),codeTextData:N,data:N,definition:l(),definitionDestinationString:v,definitionLabelString:C,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(V),hardBreakTrailing:l(V),htmlFlow:l(Z),htmlFlowData:N,htmlText:l(ie),htmlTextData:N,image:l(Ge),label:In,labelText:Qt,lineEnding:j,link:l(nt),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Jt,resourceDestinationString:S,resourceTitleString:Xt,resource:Mn,setextHeading:l(U),setextHeadingLineSequence:R,setextHeadingText:_,strong:l(),thematicBreak:l()}};UC(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(D){let H={type:"root",children:[]};const Q={stack:[H],tokenStack:[],config:e,enter:a,exit:u,buffer:s,resume:c,data:n},ae=[];let ge=-1;for(;++ge<D.length;)if(D[ge][1].type==="listOrdered"||D[ge][1].type==="listUnordered")if(D[ge][0]==="enter")ae.push(ge);else{const Zt=ae.pop();ge=i(D,Zt,ge)}for(ge=-1;++ge<D.length;){const Zt=e[D[ge][0]];HC.call(Zt,D[ge][1].type)&&Zt[D[ge][1].type].call(Object.assign({sliceSerialize:D[ge][2].sliceSerialize},Q),D[ge][1])}if(Q.tokenStack.length>0){const Zt=Q.tokenStack[Q.tokenStack.length-1];(Zt[1]||z0).call(Q,void 0,Zt[0])}for(H.position={start:Xn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Xn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<e.transforms.length;)H=e.transforms[ge](H)||H;return H}function i(D,H,Q){let ae=H-1,ge=-1,Zt=!1,Mr,On,yo,Eo;for(;++ae<=Q;){const wt=D[ae];switch(wt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{wt[0]==="enter"?ge++:ge--,Eo=void 0;break}case"lineEndingBlank":{wt[0]==="enter"&&(Mr&&!Eo&&!ge&&!yo&&(yo=ae),Eo=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Eo=void 0}if(!ge&&wt[0]==="enter"&&wt[1].type==="listItemPrefix"||ge===-1&&wt[0]==="exit"&&(wt[1].type==="listUnordered"||wt[1].type==="listOrdered")){if(Mr){let bi=ae;for(On=void 0;bi--;){const Dn=D[bi];if(Dn[1].type==="lineEnding"||Dn[1].type==="lineEndingBlank"){if(Dn[0]==="exit")continue;On&&(D[On][1].type="lineEndingBlank",Zt=!0),Dn[1].type="lineEnding",On=bi}else if(!(Dn[1].type==="linePrefix"||Dn[1].type==="blockQuotePrefix"||Dn[1].type==="blockQuotePrefixWhitespace"||Dn[1].type==="blockQuoteMarker"||Dn[1].type==="listItemIndent"))break}yo&&(!On||yo<On)&&(Mr._spread=!0),Mr.end=Object.assign({},On?D[On][1].start:wt[1].end),D.splice(On||ae,0,["exit",Mr,wt[2]]),ae++,Q++}if(wt[1].type==="listItemPrefix"){const bi={type:"listItem",_spread:!1,start:Object.assign({},wt[1].start),end:void 0};Mr=bi,D.splice(ae,0,["enter",bi,wt[2]]),ae++,Q++,yo=void 0,Eo=!0}}}return D[H][1]._spread=Zt,Q}function o(D,H){return Q;function Q(ae){a.call(this,D(ae),ae),H&&H.call(this,ae)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(D,H,Q){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([H,Q||void 0]),D.position={start:Xn(H.start),end:void 0}}function l(D){return H;function H(Q){D&&D.call(this,Q),u.call(this,Q)}}function u(D,H){const Q=this.stack.pop(),ae=this.tokenStack.pop();if(ae)ae[0].type!==D.type&&(H?H.call(this,D,ae[0]):(ae[1]||z0).call(this,D,ae[0]));else throw new Error("Cannot close `"+D.type+"` ("+Qo({start:D.start,end:D.end})+"): it’s not open");Q.position.end=Xn(D.end)}function c(){return Eu(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(D){if(this.data.expectingFirstListItemValue){const H=this.stack[this.stack.length-2];H.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){const D=this.resume(),H=this.stack[this.stack.length-1];H.lang=D}function p(){const D=this.resume(),H=this.stack[this.stack.length-1];H.meta=D}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const D=this.resume(),H=this.stack[this.stack.length-1];H.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const D=this.resume(),H=this.stack[this.stack.length-1];H.value=D.replace(/(\r?\n|\r)$/g,"")}function C(D){const H=this.resume(),Q=this.stack[this.stack.length-1];Q.label=H,Q.identifier=on(this.sliceSerialize(D)).toLowerCase()}function w(){const D=this.resume(),H=this.stack[this.stack.length-1];H.title=D}function v(){const D=this.resume(),H=this.stack[this.stack.length-1];H.url=D}function O(D){const H=this.stack[this.stack.length-1];if(!H.depth){const Q=this.sliceSerialize(D).length;H.depth=Q}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function R(D){const H=this.stack[this.stack.length-1];H.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function z(D){const Q=this.stack[this.stack.length-1].children;let ae=Q[Q.length-1];(!ae||ae.type!=="text")&&(ae=TS(),ae.position={start:Xn(D.start),end:void 0},Q.push(ae)),this.stack.push(ae)}function N(D){const H=this.stack.pop();H.value+=this.sliceSerialize(D),H.position.end=Xn(D.end)}function j(D){const H=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=H.children[H.children.length-1];Q.position.end=Xn(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(H.type)&&(z.call(this,D),N.call(this,D))}function V(){this.data.atHardBreak=!0}function Z(){const D=this.resume(),H=this.stack[this.stack.length-1];H.value=D}function ie(){const D=this.resume(),H=this.stack[this.stack.length-1];H.value=D}function K(){const D=this.resume(),H=this.stack[this.stack.length-1];H.value=D}function nt(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=H,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function Ge(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=H,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function Qt(D){const H=this.sliceSerialize(D),Q=this.stack[this.stack.length-2];Q.label=sC(H),Q.identifier=on(H).toLowerCase()}function In(){const D=this.stack[this.stack.length-1],H=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const ae=D.children;Q.children=ae}else Q.alt=H}function S(){const D=this.resume(),H=this.stack[this.stack.length-1];H.url=D}function Xt(){const D=this.resume(),H=this.stack[this.stack.length-1];H.title=D}function Mn(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function Jt(D){const H=this.resume(),Q=this.stack[this.stack.length-1];Q.label=H,Q.identifier=on(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function Ir(D){this.data.characterReferenceType=D.type}function Ke(D){const H=this.sliceSerialize(D),Q=this.data.characterReferenceType;let ae;Q?(ae=oC(H,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ae=Vf(H);const ge=this.stack[this.stack.length-1];ge.value+=ae}function bo(D){const H=this.stack.pop();H.position.end=Xn(D.end)}function Kn(D){N.call(this,D);const H=this.stack[this.stack.length-1];H.url=this.sliceSerialize(D)}function mi(D){N.call(this,D);const H=this.stack[this.stack.length-1];H.url="mailto:"+this.sliceSerialize(D)}function gi(){return{type:"blockquote",children:[]}}function Ks(){return{type:"code",lang:null,meta:null,value:""}}function pS(){return{type:"inlineCode",value:""}}function mS(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function gS(){return{type:"emphasis",children:[]}}function Jf(){return{type:"heading",depth:0,children:[]}}function Zf(){return{type:"break"}}function ep(){return{type:"html",value:""}}function bS(){return{type:"image",title:null,url:"",alt:null}}function tp(){return{type:"link",title:null,url:"",children:[]}}function np(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function yS(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function ES(){return{type:"paragraph",children:[]}}function kS(){return{type:"strong",children:[]}}function TS(){return{type:"text",value:""}}function CS(){return{type:"thematicBreak"}}}function Xn(t){return{line:t.line,column:t.column,offset:t.offset}}function UC(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?UC(t,r):wH(t,r)}}function wH(t,e){let n;for(n in e)if(HC.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function z0(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Qo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Qo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Qo({start:e.start,end:e.end})+") is still open")}function AH(t){const e=this;e.parser=n;function n(r){return SH(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function _H(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function NH(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
156
+ `}]}function IH(t,e){const n=e.value?e.value+`
157
+ `:"",r={},i=e.lang?e.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 e.meta&&(o.data={meta:e.meta}),t.patch(e,o),o=t.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},t.patch(e,o),o}function MH(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function OH(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function DH(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=go(r.toLowerCase()),o=t.footnoteOrder.indexOf(r);let s,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),s=t.footnoteOrder.length):s=o+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function vH(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function LH(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function $C(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function RH(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return $C(t,e);const i={src:go(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function PH(t,e){const n={src:go(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function BH(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function FH(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return $C(t,e);const i={href:go(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function HH(t,e){const n={href:go(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function UH(t,e,n){const r=t.all(e),i=n?$H(n):zC(e),o={},s=[];if(typeof e.checked=="boolean"){const c=r[0];let d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const c=r[a];(i||a!==0||c.type!=="element"||c.tagName!=="p")&&s.push({type:"text",value:`
158
+ `}),c.type==="element"&&c.tagName==="p"&&!i?s.push(...c.children):s.push(c)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
159
+ `});const u={type:"element",tagName:"li",properties:o,children:s};return t.patch(e,u),t.applyData(e,u)}function $H(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=zC(n[r])}return e}function zC(t){const e=t.spread;return e??t.children.length>1}function zH(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const s=r[i];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,o),t.applyData(e,o)}function VH(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function qH(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function jH(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function WH(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],s),i.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=xT(e.children[1]),l=ST(e.children[e.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function YH(t,e,n){const r=n?n.children:void 0,o=(r?r.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length;let l=-1;const u=[];for(;++l<a;){const d=e.children[l],h={},f=s?s[l]:void 0;f&&(h.align=f);let p={type:"element",tagName:o,properties:h,children:[]};d&&(p.children=t.all(d),t.patch(d,p),p=t.applyData(d,p)),u.push(p)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,c),t.applyData(e,c)}function GH(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const V0=9,q0=32;function KH(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const o=[];for(;r;)o.push(j0(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return o.push(j0(e.slice(i),i>0,!1)),o.join("")}function j0(t,e,n){let r=0,i=t.length;if(e){let o=t.codePointAt(r);for(;o===V0||o===q0;)r++,o=t.codePointAt(r)}if(n){let o=t.codePointAt(i-1);for(;o===V0||o===q0;)i--,o=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function QH(t,e){const n={type:"text",value:KH(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function XH(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Kd={blockquote:_H,break:NH,code:IH,delete:MH,emphasis:OH,footnoteReference:DH,heading:vH,html:LH,imageReference:RH,image:PH,inlineCode:BH,linkReference:FH,link:HH,listItem:UH,list:zH,paragraph:VH,root:qH,strong:jH,table:WH,tableCell:GH,tableRow:YH,text:QH,thematicBreak:XH,toml:Ta,yaml:Ta,definition:Ta,footnoteDefinition:Ta};function Ta(){}function JH(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function ZH(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function eU(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||JH,r=t.options.footnoteBackLabel||ZH,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",s=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[l]);if(!u)continue;const c=t.all(u),d=String(u.identifier).toUpperCase(),h=go(d.toLowerCase());let f=0;const p=[],g=t.footnoteCounts.get(d);for(;g!==void 0&&++f<=g;){p.length>0&&p.push({type:"text",value:" "});let C=typeof n=="string"?n:n(l,f);typeof C=="string"&&(C={type:"text",value:C}),p.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+h+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const y=c[c.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const C=y.children[y.children.length-1];C&&C.type==="text"?C.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...p)}else c.push(...p);const b={type:"element",tagName:"li",properties:{id:e+"fn-"+h},children:t.wrap(c,!0)};t.patch(u,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ro(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
160
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
161
+ `}]}}const Qd={}.hasOwnProperty,tU={};function nU(t,e){const n=e||tU,r=new Map,i=new Map,o=new Map,s={...Kd,...n.handlers},a={all:u,applyData:iU,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:s,one:l,options:n,patch:rU,wrap:sU};return oi(t,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const d=c.type==="definition"?r:i,h=String(c.identifier).toUpperCase();d.has(h)||d.set(h,c)}}),a;function l(c,d){const h=c.type,f=a.handlers[h];if(Qd.call(a.handlers,h)&&f)return f(a,c,d);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in c){const{children:g,...y}=c,b=ro(y);return b.children=a.all(c),b}return ro(c)}return(a.options.unknownHandler||oU)(a,c,d)}function u(c){const d=[];if("children"in c){const h=c.children;let f=-1;for(;++f<h.length;){const p=a.one(h[f],c);if(p){if(f&&h[f-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=W0(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=W0(g.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function rU(t,e){t.position&&(e.position=AT(t))}function iU(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,o=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&o&&Object.assign(n.properties,ro(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function oU(t,e){const n=e.data||{},r="value"in e&&!(Qd.call(n,"hProperties")||Qd.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function sU(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
162
+ `});++r<t.length;)r&&n.push({type:"text",value:`
163
+ `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
164
+ `}),n}function W0(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Y0(t,e){const n=nU(t,e),r=n.one(t,void 0),i=eU(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
165
+ `},i),o}function aU(t,e){return t&&"run"in t?async function(n,r){const i=Y0(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Y0(n,{file:r,...t||e})}}const lU=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],uU=/["&'<>`]/g,cU=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,dU=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,hU=/[|\\{}()[\]^$+*?.]/g,G0=new WeakMap;function fU(t,e){if(t=t.replace(e.subset?pU(e.subset):uU,r),e.subset||e.escapeOnly)return t;return t.replace(cU,n).replace(dU,r);function n(i,o,s){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),e)}function r(i,o,s){return e.format(i.charCodeAt(0),s.charCodeAt(o+1),e)}}function pU(t){let e=G0.get(t);return e||(e=mU(t),G0.set(t,e)),e}function mU(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(hU,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const gU=/[\dA-Fa-f]/;function bU(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!gU.test(String.fromCharCode(e))?r:r+";"}const yU=/\d/;function EU(t,e,n){const r="&#"+String(t);return n&&e&&!yU.test(String.fromCharCode(e))?r:r+";"}const kU=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Nc={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},TU=["cent","copy","divide","gt","lt","not","para","times"],VC={}.hasOwnProperty,Xd={};let Ca;for(Ca in Nc)VC.call(Nc,Ca)&&(Xd[Nc[Ca]]=Ca);const CU=/[^\dA-Za-z]/;function SU(t,e,n,r){const i=String.fromCharCode(t);if(VC.call(Xd,i)){const o=Xd[i],s="&"+o;return n&&kU.includes(o)&&!TU.includes(o)&&(!r||e&&e!==61&&CU.test(String.fromCharCode(e)))?s:s+";"}return""}function xU(t,e,n){let r=bU(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=SU(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const o=EU(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function $i(t,e){return fU(t,Object.assign({format:xU},e))}const wU=/^>|^->|<!--|-->|--!>|<!-$/g,AU=[">"],_U=["<",">"];function NU(t,e,n,r){return r.settings.bogusComments?"<?"+$i(t.value,Object.assign({},r.settings.characterReferences,{subset:AU}))+">":"<!--"+t.value.replace(wU,i)+"-->";function i(o){return $i(o,Object.assign({},r.settings.characterReferences,{subset:_U}))}}function IU(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const He=jC(1),qC=jC(-1),MU=[];function jC(t){return e;function e(n,r,i){const o=n?n.children:MU;let s=(r||0)+t,a=o[s];if(!i)for(;a&&Ws(a);)s+=t,a=o[s];return a}}const OU={}.hasOwnProperty;function WC(t){return e;function e(n,r,i){return OU.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const Gf=WC({body:vU,caption:Ic,colgroup:Ic,dd:BU,dt:PU,head:Ic,html:DU,li:RU,optgroup:FU,option:HU,p:LU,rp:K0,rt:K0,tbody:$U,td:Q0,tfoot:zU,th:Q0,thead:UU,tr:VU});function Ic(t,e,n){const r=He(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Ws(r.value.charAt(0)))}function DU(t,e,n){const r=He(n,e);return!r||r.type!=="comment"}function vU(t,e,n){const r=He(n,e);return!r||r.type!=="comment"}function LU(t,e,n){const r=He(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function RU(t,e,n){const r=He(n,e);return!r||r.type==="element"&&r.tagName==="li"}function PU(t,e,n){const r=He(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function BU(t,e,n){const r=He(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function K0(t,e,n){const r=He(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function FU(t,e,n){const r=He(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function HU(t,e,n){const r=He(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function UU(t,e,n){const r=He(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function $U(t,e,n){const r=He(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function zU(t,e,n){return!He(n,e)}function VU(t,e,n){const r=He(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Q0(t,e,n){const r=He(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const qU=WC({body:YU,colgroup:GU,head:WU,html:jU,tbody:KU});function jU(t){const e=He(t,-1);return!e||e.type!=="comment"}function WU(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function YU(t){const e=He(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Ws(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function GU(t,e,n){const r=qC(n,e),i=He(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Gf(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function KU(t,e,n){const r=qC(n,e),i=He(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Gf(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const Sa={name:[[`
166
+ \f\r &/=>`.split(""),`
167
+ \f\r "&'/=>\``.split("")],[`\0
168
+ \f\r "&'/<=>`.split(""),`\0
169
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
170
+ \f\r &>`.split(""),`\0
171
+ \f\r "&'<=>\``.split("")],[`\0
172
+ \f\r "&'<=>\``.split(""),`\0
173
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function QU(t,e,n,r){const i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags;let s=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Vs);const u=XU(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(s=!1),(u||!o||!qU(t,e,n))&&(a.push("<",t.tagName,u?" "+u:""),s&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(c),!s&&(!o||!Gf(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function XU(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=JU(t,i,e[i]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function JU(t,e,n){const r=wf(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let s=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=$i(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Sa.name[i][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?l3:c3)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=$i(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Sa.unquoted[i][o]}))),a!==n&&(t.settings.quoteSmart&&Nl(n,s)>Nl(n,t.alternative)&&(s=t.alternative),a=s+$i(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?Sa.single:Sa.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}const ZU=["<","&"];function YC(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:$i(t.value,Object.assign({},r.settings.characterReferences,{subset:ZU}))}function e7(t,e,n,r){return r.settings.allowDangerousHtml?t.value:YC(t,e,n,r)}function t7(t,e,n,r){return r.all(t)}const n7=jT("type",{invalid:r7,unknown:i7,handlers:{comment:NU,doctype:IU,element:QU,raw:e7,root:t7,text:YC}});function r7(t){throw new Error("Expected node, not `"+t+"`")}function i7(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const o7={},s7={},a7=[];function l7(t,e){const n=e||o7,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:u7,all:c7,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||lU,characterReferences:n.characterReferences||s7,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Vs:du,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function u7(t,e,n){return n7(t,e,n,this)}function c7(t){const e=[],n=t&&t.children||a7;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function d7(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(i){return l7(i,n)}}class pi{match;handler;undoable;inCode;inCodeMark;constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?h7(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function h7(t){return function(e,n,r,i){let o=t;if(n[1]){let s=n[0].lastIndexOf(n[1]);o+=n[0].slice(s+n[1].length),r+=s;let a=r-i;a>0&&(o=n[0].slice(s-a,s)+o,r=i)}return e.tr.insertText(o,r,i)}}const f7=500;function p7({rules:t}){let e=new re({state:{init(){return null},apply(n,r){let i=n.getMeta(this);return i||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,i,o){return X0(n,r,i,o,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&X0(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function X0(t,e,n,r,i,o){if(t.composing)return!1;const s=t.state.tr.insertText(r,e,n),a=s.mapping.map(e),l=s.mapping.map(n);let u=null,c=s.doc.resolve(a),d=c.parent.textBetween(Math.max(0,c.parentOffset-f7),c.parentOffset,null,"");for(let h=0;h<i.length;h++){let f=i[h];if(!f.inCodeMark&&c.marks().some(y=>y.type.spec.code))continue;if(c.parent.type.spec.code){if(!f.inCode)continue}else if(f.inCode==="only")continue;let p=f.match.exec(d);if(!p||p[0].length<r.length)continue;u??=t.state.apply(s);let g=f.handler(u,p,a-p[0].length,l);if(g)return t.dispatch(s),t.dispatch(ZL(t.state.tr)),f.undoable&&g.setMeta(o,{transform:g,from:a,to:l,text:r}),t.dispatch(g),!0}return!1}new pi(/--$/,"—",{inCodeMark:!1});new pi(/\.\.\.$/,"…",{inCodeMark:!1});new pi(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new pi(/"$/,"”",{inCodeMark:!1});new pi(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new pi(/'$/,"’",{inCodeMark:!1});class Ie extends G{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ie.valid(r)?new Ie(r):G.near(r)}content(){return B.empty}eq(e){return e instanceof Ie&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ie(e.resolve(n.pos))}getBookmark(){return new Kf(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!m7(e)||!g7(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Ie.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(Ie.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!q.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(Ie.valid(a))return a}return null}}}Ie.prototype.visible=!1;Ie.findFrom=Ie.findGapCursorFrom;G.jsonID("gapcursor",Ie);class Kf{constructor(e){this.pos=e}map(e){return new Kf(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ie.valid(n)?new Ie(n):G.near(n)}}function GC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function m7(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||GC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function g7(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||GC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function b7(){return new re({props:{decorations:T7,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ie.valid(n)?new Ie(n):null},handleClick:E7,handleKeyDown:y7,handleDOMEvents:{beforeinput:k7}}})}const y7=kh({ArrowLeft:xa("horiz",-1),ArrowRight:xa("horiz",1),ArrowUp:xa("vert",-1),ArrowDown:xa("vert",1)});function xa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof $){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=Ie.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new Ie(u))),!0):!1}}function E7(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ie.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&q.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ie(r))),!0)}function k7(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ie))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=M.empty;for(let s=r.length-1;s>=0;s--)i=M.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new B(i,0,0));return o.setSelection($.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function T7(t){if(!(t.selection instanceof Ie))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",le.create(t.doc,[me.widget(t.selection.head,e,{key:"gapcursor"})])}var C7=_e.create({name:"gapCursor",addProseMirrorPlugins(){return[b7()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=be(W(t,"allowGapCursor",n)))!=null?e:null}}}),S7=dn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});function rV(t,e){let n=[{tag:`[data-inline-content-type="${t.type}"]`,contentElement:r=>{let i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",getAttrs(r){if(typeof r=="string")return!1;let i=e?.(r);return i===void 0?!1:i}}),n}function x7(t,e,n,r="before"){let i=typeof n=="string"?n:n.id,o=Fe(t),s=e.map(u=>ci(u,o)),a=Rt(i,t.doc);if(!a)throw Error(`Block with ID ${i} not found`);let l=a.posBeforeNode;return r==="after"&&(l+=a.node.nodeSize),t.step(new Ne(l,l,new B(M.from(s),0,0))),s.map(u=>Ae(u,o))}function Jd(t){if(!t||t.type.name!=="column")throw Error("Invalid columnPos: does not point to column node.");let e=t.firstChild;if(!e)throw Error("Invalid column: does not have child node.");let n=e.firstChild;if(!n)throw Error("Invalid blockContainer: does not have child node.");return t.childCount===1&&e.childCount===1&&n.type.name==="paragraph"&&n.content.content.length===0}function w7(t,e){let n=t.doc.resolve(e),r=n.nodeAfter;if(!r||r.type.name!=="columnList")throw Error("Invalid columnListPos: does not point to columnList node.");for(let i=r.childCount-1;i>=0;i--){let o=t.doc.resolve(n.pos+1).posAtIndex(i),s=t.doc.resolve(o).nodeAfter;if(!s||s.type.name!=="column")throw Error("Invalid columnPos: does not point to column node.");Jd(s)&&t.delete(o,o+s.nodeSize)}}function Wa(t,e){w7(t,e);let n=t.doc.resolve(e).nodeAfter;if(!n||n.type.name!=="columnList")throw Error("Invalid columnListPos: does not point to columnList node.");if(n.childCount>2)return;if(n.childCount<2)throw Error("Invalid columnList: contains fewer than two children.");let r=e+1,i=t.doc.resolve(r).nodeAfter,o=e+n.nodeSize-1,s=t.doc.resolve(o).nodeBefore;if(!i||!s)throw Error("Invalid columnList: does not contain children.");let a=Jd(i),l=Jd(s);if(a&&l){t.delete(e,e+n.nodeSize);return}if(a){t.step(new Me(e,e+n.nodeSize,o-s.nodeSize+1,o-1,B.empty,0,!1));return}if(l){t.step(new Me(e,e+n.nodeSize,r+1,r+i.nodeSize-1,B.empty,0,!1));return}}function J0(t,e,n){let r=Fe(t),i=n.map(c=>ci(c,r)),o=new Set(e.map(c=>typeof c=="string"?c:c.id)),s=[],a=new Set,l=typeof e[0]=="string"?e[0]:e[0].id,u=0;if(t.doc.descendants((c,d)=>{if(o.size===0)return!1;if(!c.type.isInGroup("bnBlock")||!o.has(c.attrs.id))return!0;if(s.push(Ae(c,r)),o.delete(c.attrs.id),n.length>0&&c.attrs.id===l){let g=t.doc.nodeSize;t.insert(d,i);let y=t.doc.nodeSize;u+=g-y}let h=t.doc.nodeSize,f=t.doc.resolve(d-u);f.node().type.name==="column"?a.add(f.before(-1)):f.node().type.name==="columnList"&&a.add(f.before()),f.node().type.name==="blockGroup"&&f.node(f.depth-1).type.name!=="doc"&&f.node().childCount===1?t.delete(f.before(),f.after()):t.delete(d-u,d-u+c.nodeSize);let p=t.doc.nodeSize;return u+=h-p,!1}),o.size>0){let c=[...o].join(`
174
+ `);throw Error("Blocks with the following IDs could not be found in the editor: "+c)}return a.forEach(c=>Wa(t,c)),{insertedBlocks:i.map(c=>Ae(c,r)),removedBlocks:s}}function A7(t,e,n,r,i){let o;if(!e)throw Error("blockContent is required");if(typeof e=="string")o=un([e],t.pmSchema,r);else if(Array.isArray(e))o=un(e,t.pmSchema,r);else if(e.type==="tableContent")o=su(e,t.pmSchema);else throw new xn(e.type);let s=(i?.document??document).createDocumentFragment();for(let a of o)if(a.type.name!=="text"&&t.schema.inlineContentSchema[a.type.name]){let l=t.schema.inlineContentSpecs[a.type.name].implementation;if(l){let u=bf(a,t.schema.inlineContentSchema,t.schema.styleSchema),c=l.render.call({renderType:"dom",props:void 0},u,()=>{},t);if(c){if(s.appendChild(c.dom),c.contentDOM){let d=n.serializeFragment(a.content,i);c.contentDOM.dataset.editable="",c.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(let u of a.marks.toReversed())if(u.type.name in t.schema.styleSpecs){let c=t.schema.styleSpecs[u.type.name].implementation.render(u.attrs.stringValue,t);c.contentDOM.appendChild(l),l=c.dom}else{let c=u.type.spec.toDOM(u,!0),d=Lt.renderSpec(document,c);d.contentDOM.appendChild(l),l=d.dom}s.appendChild(l)}else{let l=n.serializeFragment(M.from([a]),i);s.appendChild(l)}return s}function _7(t,e,n,r){let i=t.pmSchema.nodes.blockContainer,o=e.props||{};for(let[u,c]of Object.entries(t.schema.blockSchema[e.type].propSchema))!(u in o)&&c.default!==void 0&&(o[u]=c.default);let s=e.children||[],a=t.blockImplementations[e.type].implementation.render.call({renderType:"dom",props:void 0},{...e,props:o,children:s},t);if(a.contentDOM&&e.content){let u=A7(t,e.content,n,e.type,r);a.contentDOM.appendChild(u)}if(t.pmSchema.nodes[e.type].isInGroup("bnBlock")){if(e.children&&e.children.length>0){let u=KC(t,e.children,n,r);a.contentDOM?.append(u)}return a.dom}let l=i.spec?.toDOM?.(i.create({id:e.id,...o}));return l.contentDOM?.appendChild(a.dom),e.children&&e.children.length>0&&l.contentDOM?.appendChild(QC(t,e.children,n,r)),l.dom}function KC(t,e,n,r){let i=(r?.document??document).createDocumentFragment();for(let o of e){let s=_7(t,o,n,r);i.appendChild(s)}return i}var QC=(t,e,n,r)=>{let i=t.pmSchema.nodes.blockGroup,o=i.spec.toDOM(i.create({})),s=KC(t,e,n,r);return o.contentDOM?.appendChild(s),o.dom},N7=t=>(t.querySelectorAll('[data-content-type="numberedListItem"]').forEach(e=>{let n=e.closest(".bn-block-outer")?.previousElementSibling?.querySelector('[data-content-type="numberedListItem"]');if(!n)e.setAttribute("data-index",e.getAttribute("data-start")||"1");else{let r=n.getAttribute("data-index");e.setAttribute("data-index",(parseInt(r||"0")+1).toString())}}),t),I7=t=>(t.querySelectorAll('[data-content-type="checkListItem"] input').forEach(e=>{e.disabled=!0}),t),M7=t=>(t.querySelectorAll('.bn-toggle-wrapper[data-show-children="false"]').forEach(e=>{e.setAttribute("data-show-children","true")}),t),O7=t=>(t.querySelectorAll('[data-content-type="table"] table').forEach(e=>{e.setAttribute("style","--default-cell-min-width: 120px;"),e.setAttribute("data-show-children","true")}),t),D7=t=>(t.querySelectorAll('[data-content-type="table"] table').forEach(e=>{let n=document.createElement("div");n.className="tableWrapper";let r=document.createElement("div");r.className="tableWrapper-inner",n.appendChild(r),e.parentElement?.appendChild(n),n.appendChild(e)}),t),v7=t=>(t.querySelectorAll(".bn-inline-content:empty").forEach(e=>{let n=document.createElement("span");n.className="ProseMirror-trailingBreak",n.setAttribute("style","display: inline-block;"),e.appendChild(n)}),t),L7=(t,e)=>{let n=Lt.fromSchema(t),r=[N7,I7,M7,O7,D7,v7];return{serializeBlocks:(i,o)=>{let s=QC(e,i,n,o);for(let a of r)s=a(s);return s.outerHTML}}};function R7(t){return t.transact(e=>{let n=Tr(e.doc,e.selection.anchor);if(e.selection instanceof fe)return{type:"cell",anchorBlockId:n.node.attrs.id,anchorCellOffset:e.selection.$anchorCell.pos-n.posBeforeNode,headCellOffset:e.selection.$headCell.pos-n.posBeforeNode};if(e.selection instanceof q)return{type:"node",anchorBlockId:n.node.attrs.id};{let r=Tr(e.doc,e.selection.head);return{type:"text",anchorBlockId:n.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:e.selection.anchor-n.posBeforeNode,headOffset:e.selection.head-r.posBeforeNode}}})}function P7(t,e){let n=Rt(e.anchorBlockId,t.doc)?.posBeforeNode;if(n===void 0)throw Error(`Could not find block with ID ${e.anchorBlockId} to update selection`);let r;if(e.type==="cell")r=fe.create(t.doc,n+e.anchorCellOffset,n+e.headCellOffset);else if(e.type==="node")r=q.create(t.doc,n+1);else{let i=Rt(e.headBlockId,t.doc)?.posBeforeNode;if(i===void 0)throw Error(`Could not find block with ID ${e.headBlockId} to update selection`);r=$.create(t.doc,n+e.anchorOffset,i+e.headOffset)}t.setSelection(r)}function Zd(t){return t.map(e=>e.type==="columnList"?e.children.map(n=>Zd(n.children)).flat():{...e,children:Zd(e.children)}).flat()}function XC(t,e,n){t.transact(r=>{let i=t.getSelection()?.blocks||[t.getTextCursorPosition().block],o=R7(t);t.removeBlocks(i),t.insertBlocks(Zd(i),e,n),P7(r,o)})}function JC(t){return!t||t.type!=="columnList"}function ZC(t,e,n){let r,i;if(e?e.children.length>0?(r=e.children[e.children.length-1],i="after"):(r=e,i="before"):n&&(r=n,i="before"),!r||!i)return;let o=t.getParentBlock(r);return JC(o)?{referenceBlock:r,placement:i}:ZC(t,i==="after"?r:t.getPrevBlock(r),o)}function eS(t,e,n){let r,i;if(e?e.children.length>0?(r=e.children[0],i="before"):(r=e,i="after"):n&&(r=n,i="after"),!r||!i)return;let o=t.getParentBlock(r);return JC(o)?{referenceBlock:r,placement:i}:eS(t,i==="before"?r:t.getNextBlock(r),o)}function B7(t){t.transact(()=>{let e=t.getSelection()?.blocks[0]||t.getTextCursorPosition().block,n=ZC(t,t.getPrevBlock(e),t.getParentBlock(e));n&&XC(t,n.referenceBlock,n.placement)})}function F7(t){t.transact(()=>{let e=t.getSelection(),n=e?.blocks[e?.blocks.length-1]||t.getTextCursorPosition().block,r=eS(t,t.getNextBlock(n),t.getParentBlock(n));r&&XC(t,r.referenceBlock,r.placement)})}function H7(t,e,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,f=>f.childCount>0&&(f.type.name==="blockGroup"||f.type.name==="column"));if(!o)return!1;let s=o.startIndex;if(s===0)return!1;let a=o.parent.child(s-1);if(a.type!==e)return!1;let l=a.lastChild&&a.lastChild.type===n,u=M.from(l?e.create():null),c=new B(M.from(e.create(null,M.from(n.create(null,u)))),l?3:1,0),d=o.start,h=o.end;return t.step(new Me(d-(l?3:1),h,d,h,c,1,!0)).scrollIntoView(),!0}function tS(t){return t.transact(e=>H7(e,t.pmSchema.nodes.blockContainer,t.pmSchema.nodes.blockGroup))}function U7(t,e,n,r){let i=r.end,o=r.$to.end(r.depth);if(i<o){let l=r.parent.child(r.endIndex-1),u=l.lastChild&&l.lastChild.type===n;t.step(new Me(i-(u?2:1),o,i,o,new B(M.from(e.create(null,n.create())),u?2:1,0),+!u,!0)),r=new es(t.doc.resolve(r.$from.pos),t.doc.resolve(o),r.depth)}let s=li(r);if(s==null)return!1;t.lift(r,s);let a=t.doc.resolve(t.mapping.map(i,-1)-1);return xr(t.doc,a.pos)&&a.nodeBefore.type===a.nodeAfter.type&&t.join(a.pos),t.scrollIntoView(),!0}function eh(t,e,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,s=>s.childCount>0&&(s.type.name==="blockGroup"||s.type.name==="column"));return o&&r.node(o.depth-1).type===e?U7(t,e,n,o):!1}function nS(t){return t.transact(e=>eh(e,t.pmSchema.nodes.blockContainer,t.pmSchema.nodes.blockGroup))}function $7(t){return t.transact(e=>{let{bnBlock:n}=Us(e);return e.doc.resolve(n.beforePos).nodeBefore!==null})}function z7(t){return t.transact(e=>{let{bnBlock:n}=Us(e);return e.doc.resolve(n.beforePos).depth>1})}function V7(t,e){let n=typeof e=="string"?e:e.id,r=Fe(t),i=Rt(n,t);if(i)return Ae(i.node,r)}function q7(t,e){let n=Rt(typeof e=="string"?e:e.id,t),r=Fe(t);if(!n)return;let i=t.resolve(n.posBeforeNode).nodeBefore;if(i)return Ae(i,r)}function j7(t,e){let n=Rt(typeof e=="string"?e:e.id,t),r=Fe(t);if(!n)return;let i=t.resolve(n.posBeforeNode+n.node.nodeSize).nodeAfter;if(i)return Ae(i,r)}function W7(t,e){let n=typeof e=="string"?e:e.id,r=Fe(t),i=Rt(n,t);if(!i)return;let o=t.resolve(i.posBeforeNode),s=o.node(),a=o.node(-1),l=a.type.name==="doc"?void 0:s.type.name==="blockGroup"?a:s;if(l)return Ae(l,r)}var Y7=class{constructor(t){this.editor=t}get document(){return this.editor.transact(t=>pv(t.doc,this.editor.pmSchema))}getBlock(t){return this.editor.transact(e=>V7(e.doc,t))}getPrevBlock(t){return this.editor.transact(e=>q7(e.doc,t))}getNextBlock(t){return this.editor.transact(e=>j7(e.doc,t))}getParentBlock(t){return this.editor.transact(e=>W7(e.doc,t))}forEachBlock(t,e=!1){let n=this.document.slice();e&&n.reverse();function r(i){for(let o of i)if(t(o)===!1||!r(e?o.children.slice().reverse():o.children))return!1;return!0}r(n)}insertBlocks(t,e,n="before"){return this.editor.transact(r=>x7(r,t,e,n))}updateBlock(t,e){return this.editor.transact(n=>Dv(n,t,e))}removeBlocks(t){return this.editor.transact(e=>J0(e,t,[]).removedBlocks)}replaceBlocks(t,e){return this.editor.transact(n=>J0(n,t,e))}canNestBlock(){return $7(this.editor)}nestBlock(){tS(this.editor)}canUnnestBlock(){return z7(this.editor)}unnestBlock(){nS(this.editor)}moveBlocksUp(){return B7(this.editor)}moveBlocksDown(){return F7(this.editor)}},G7=class extends PC{constructor(t){super(),this.editor=t,t.on("create",()=>{t._tiptapEditor.on("update",({transaction:e,appendedTransactions:n})=>{this.emit("onChange",{editor:t,transaction:e,appendedTransactions:n})}),t._tiptapEditor.on("selectionUpdate",({transaction:e})=>{this.emit("onSelectionChange",{editor:t,transaction:e})}),t._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:t})}),t._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:t})})})}onChange(t,e=!0){let n=({transaction:r,appendedTransactions:i})=>{!e&&Z0(r)||t(this.editor,{getChanges(){return MC(r,i)}})};return this.on("onChange",n),()=>{this.off("onChange",n)}}onSelectionChange(t,e=!1){let n=r=>{!e&&Z0(r.transaction)||t(this.editor)};return this.on("onSelectionChange",n),()=>{this.off("onSelectionChange",n)}}onMount(t){return this.on("onMount",t),()=>{this.off("onMount",t)}}onUnmount(t){return this.on("onUnmount",t),()=>{this.off("onUnmount",t)}}};function Z0(t){return!!t.getMeta("y-sync$")}function K7(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function Q7(t){return t.nodeType===3&&!/\S/.test(t.nodeValue||"")}function X7(t){t.querySelectorAll("li > ul, li > ol").forEach(e=>{let n=K7(e),r=e.parentElement,i=Array.from(r.childNodes).slice(n+1);e.remove(),i.forEach(o=>{o.remove()}),r.insertAdjacentElement("afterend",e),i.reverse().forEach(o=>{if(Q7(o))return;let s=document.createElement("li");s.append(o),e.insertAdjacentElement("afterend",s)}),r.childNodes.length===0&&r.remove()})}function J7(t){t.querySelectorAll("li + ul, li + ol").forEach(e=>{let n=e.previousElementSibling,r=document.createElement("div");n.insertAdjacentElement("afterend",r),r.append(n);let i=document.createElement("div");for(i.setAttribute("data-node-type","blockGroup"),r.append(i);r.nextElementSibling?.nodeName==="UL"||r.nextElementSibling?.nodeName==="OL";)i.append(r.nextElementSibling)})}var Z7=null;function e$(){return Z7||=document.implementation.createHTMLDocument("title")}function t$(t){if(typeof t=="string"){let e=e$().createElement("div");e.innerHTML=t,t=e}return X7(t),J7(t),t}function n$(t){let e=t.ownerDocument.createTreeWalker(t,128),n;for(;n=e.nextNode();)if(/^\s*notionvc:/.test(n.nodeValue||""))return!0;return!1}function r$(t){let e=new Set(["PRE","CODE"]),n=t.ownerDocument.createTreeWalker(t,4,{acceptNode(o){let s=o.parentElement;for(;s&&s!==t;){if(e.has(s.tagName))return 2;s=s.parentElement}return 1}}),r=[],i;for(;i=n.nextNode();)r.push(i);for(let o of r)o.nodeValue&&/[\r\n]/.test(o.nodeValue)&&(o.nodeValue=o.nodeValue.replace(/[ \t\r\n\f]+/g," "))}function i$(t){n$(t)||r$(t)}function rS(t,e){let n=t$(t);i$(n);let r=Vt.fromSchema(e).parse(n,{topNode:e.nodes.blockGroup.create()}),i=[];for(let o=0;o<r.childCount;o++)i.push(Ae(r.child(o),e));return i}function o$(t,e){let n=e.value?e.value:"",r={};e.lang&&(r["data-language"]=e.lang);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function s$(t,e){let n=String(e?.url||""),r={type:"element",tagName:"video",properties:{src:n,"data-name":e?.title?String(e.title):void 0,"data-url":n,controls:!0},children:[]};return t.patch?.(e,r),r=t.applyData?t.applyData(e,r):r,r}function iS(t){return xC().use(AH).use(SC).use(aU,{handlers:{...Kd,image:(e,n)=>av(String(n?.url||""))?s$(e,n):Kd.image(e,n),code:o$,blockquote:(e,n)=>{let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!1)};return e.patch(n,r),e.applyData(n,r)}}}).use(d7).processSync(t).value}function a$(t,e){return rS(iS(t),e)}var l$=class{constructor(t){this.editor=t}blocksToHTMLLossy(t=this.editor.document){return Su(this.editor.pmSchema,this.editor).exportBlocks(t,{})}blocksToFullHTML(t=this.editor.document){return L7(this.editor.pmSchema,this.editor).serializeBlocks(t,{})}tryParseHTMLToBlocks(t){return rS(t,this.editor.pmSchema)}blocksToMarkdownLossy(t=this.editor.document){return L9(t,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(t){return a$(t,this.editor.pmSchema)}pasteHTML(t,e=!1){let n=t;if(!e){let r=this.tryParseHTMLToBlocks(t);n=this.blocksToFullHTML(r)}n&&this.editor.prosemirrorView?.pasteHTML(n)}pasteText(t){return this.editor.prosemirrorView?.pasteText(t)}pasteMarkdown(t){let e=iS(t);return this.pasteHTML(e)}},u$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";function c$(t){let e=[],n=[],r=0;for(;r<t.length;){let i=0;for(;r+i<t.length&&t.charCodeAt(r+i)>=48&&t.charCodeAt(r+i)<=57;)i++;if(i>0){e.push(n.join(""));let o=parseInt(t.substring(r,r+i),10);for(;o-- >0;)n.pop();r+=i}else n.push(t[r]),r++}return e}var oS=new Set(c$(u$)),d$=new Set(["localhost"]),h$=/[.,;:!?"']+$/,f$=/(?:https?|ftp|ftps):\/\/[^\s]+/g,p$=/mailto:[^\s]+/g,m$=/[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/g,g$=/(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:[/?#][^\s]*)?/g;function b$(t){let e=t,n=!0;for(;n;){n=!1;let r=e;e=e.replace(h$,""),e!==r&&(n=!0);for(let[i,o]of[["(",")"],["[","]"]])for(;e.endsWith(o);){let s=eb(e,i);if(eb(e,o)>s)e=e.slice(0,-1),n=!0;else break}}return e}function eb(t,e){let n=0;for(let r=0;r<t.length;r++)t[r]===e&&n++;return n}function y$(t){let e=t.split(".");return e[e.length-1].toLowerCase()}function tb(t){let e=y$(t);return oS.has(e)}function sS(t,e,n){return e==="email"?"mailto:"+t:/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(t)||/^mailto:/i.test(t)?t:n+"://"+t}function aS(t,e){if(!t)return[];let n=e?.defaultProtocol||"http",r=[];for(let a of t.matchAll(f$))r.push({type:"url",value:a[0],start:a.index,end:a.index+a[0].length});for(let a of t.matchAll(p$))r.push({type:"url",value:a[0],start:a.index,end:a.index+a[0].length});for(let a of t.matchAll(m$))r.push({type:"email",value:a[0],start:a.index,end:a.index+a[0].length});for(let a of t.matchAll(g$))r.push({type:"url",value:a[0],start:a.index,end:a.index+a[0].length});r.sort((a,l)=>a.start-l.start||l.end-a.end);let i=[],o=-1;for(let a of r)a.start>=o&&(i.push(a),o=a.end);let s=[];for(let a of i){let l=b$(a.value);if(!l)continue;let u=a.start,c=u+l.length;if(a.type==="url"&&!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(l)){let h=new URL("http://"+l).hostname;if(!tb(h))continue}if(a.type==="email"){let h=l.split("@")[1];if(!tb(h))continue}let d=sS(l,a.type,n);s.push({type:a.type,value:l,isLink:!0,href:d,start:u,end:c})}return s}function E$(t,e="http"){if(!t)return[No(t,0,0)];for(let[n,r]of[["(",")"],["[","]"],["{","}"]])if(t.startsWith(n)&&t.endsWith(r)&&t.length>2){let i=t.slice(1,-1);if(Mc(i))return[No(n,0,1),Oc(i,1,1+i.length,e),No(r,1+i.length,t.length)]}if(t.endsWith(".")&&t.length>1){let n=t.slice(0,-1);if(Mc(n))return[Oc(n,0,n.length,e),No(".",n.length,t.length)]}return Mc(t)?[Oc(t,0,t.length,e)]:[No(t,0,t.length)]}function Mc(t){if(/^(?:https?|ftp|ftps):\/\/[^\s]+$/.test(t)||/^mailto:[^\s]+$/.test(t)||d$.has(t.toLowerCase()))return!0;let e=t.match(/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+([a-zA-Z]{2,})(?::\d{1,5})?(?:[/?#][^\s]*)?$/);if(e){let n=e[1].toLowerCase();if(oS.has(n))return!0}return!1}function Oc(t,e,n,r){let i=t.includes("@")&&!t.includes("://")&&!t.startsWith("mailto:")?"email":"url";return{type:i,value:t,isLink:!0,href:sS(t,i,r),start:e,end:n}}function No(t,e,n){return{type:"text",value:t,isLink:!1,href:t,start:e,end:n}}var Qf="[\0-   ᠎ -\u2029  ]",k$=new RegExp(Qf),T$=RegExp(`${Qf}$`),C$=new RegExp(Qf,"g");function S$(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function x$(t){return new re({key:new he("autolink"),appendTransaction:(e,n,r)=>{let i=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),o=e.some(a=>a.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r;if(_h(zl(n.doc,[...e])).forEach(({newRange:a})=>{let l=sl(r.doc,a,d=>d.isTextblock),u,c;if(l.length>1)u=l[0],c=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(l.length){let d=r.doc.textBetween(a.from,a.to," "," ");if(!T$.test(d))return;u=l[0],c=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&c){let d=c.split(k$).filter(Boolean);if(d.length<=0)return;let h=d[d.length-1],f=u.pos+c.lastIndexOf(h);if(!h)return;let p=E$(h,t.defaultProtocol);if(!S$(p))return;p.filter(g=>g.isLink).map(g=>({...g,from:f+g.start+1,to:f+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{Nh(g.from,g.to,r.doc).some(y=>y.mark.type===t.type)||s.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),s.steps.length)return s}})}function w$(t){return new re({key:new he("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement&&r.target.getAttribute("data-inline-content-type")==="link")i=r.target;else{let l=r.target;if(!l)return!1;let u=t.tiptapEditor.view.dom;i=l.closest('a[data-inline-content-type="link"]'),i&&!u.contains(i)&&(i=null)}if(!i)return!1;if(t.onClick){if(!t.editor)throw Error("BlockNoteEditor not found in Link click handler");return t.onClick(r,t.editor)??!0}let o=Q1(e.state,t.type.name),s=i.href??o.href,a=i.target??o.target;return s?(window.open(s,a),!0):!1}}})}function A$(t){return new re({key:new he("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{shouldAutoLink:i,isValidLink:o}=t,{state:s}=e,{selection:a}=s,{empty:l}=a;if(l)return!1;let u="";r.content.forEach(d=>{u+=d.textContent});let c=aS(u,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===u);return!u||!c||!o(c.value)||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}var Dc="https",wa={target:"_blank",rel:"noopener noreferrer nofollow",className:"bn-inline-content-section","data-inline-content-type":"link"},_$=/^(?:(?:http|https|ftp|ftps|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))/i;function N$(t){if(!t)return!0;let e=t.replace(C$,"");return _$.test(e)}function vc(t){let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;let r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}var I$=cn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,inclusive:!1,addOptions(){return{HTMLAttributes:{},editor:void 0,onClick:void 0,isValidLink:N$}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:wa.target},rel:{default:wa.rel}}},parseHTML(){let t=this.options.isValidLink;return[{tag:"a[href]",getAttrs:e=>{let n=e.getAttribute("href");return!n||!t(n)?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isValidLink(t.href)?["a",Gt(wa,t),0]:["a",Gt(wa,{...t,href:""}),0]},addPasteRules(){let t=this.options.isValidLink;return[Qr({find:e=>{let n=[];if(e){let r=aS(e,{defaultProtocol:Dc}).filter(i=>i.isLink&&t(i.value));for(let i of r)vc(i.value)&&n.push({text:i.value,data:{href:i.href},index:i.start})}return n},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let t=[];return t.push(x$({type:this.type,defaultProtocol:Dc,validate:this.options.isValidLink,shouldAutoLink:vc})),t.push(w$({type:this.type,tiptapEditor:this.editor,editor:this.options.editor,onClick:this.options.onClick})),t.push(A$({editor:this.editor,defaultProtocol:Dc,type:this.type,shouldAutoLink:vc,isValidLink:this.options.isValidLink})),t}}),Xf=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function M$(t,e){if(!t.startsWith(".")||!e.startsWith("."))throw Error("The strings provided are not valid file extensions.");return t===e}function O$(t,e){let n=t.split("/"),r=e.split("/");if(n.length!==2)throw Error(`The string ${t} is not a valid MIME type.`);if(r.length!==2)throw Error(`The string ${e} is not a valid MIME type.`);return n[1]==="*"||r[1]==="*"?n[0]===r[0]:(n[0]==="*"||r[0]==="*"||n[0]===r[0])&&n[1]===r[1]}function nb(t,e,n,r="after"){let i;return i=Array.isArray(e.content)&&e.content.length===0?t.updateBlock(e,n).id:t.insertBlocks([n],e,r)[0].id,i}async function lS(t,e){if(!e.uploadFile){console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");return}let n="dataTransfer"in t?t.dataTransfer:t.clipboardData;if(n===null)return;let r=null;for(let o of Xf)if(n.types.includes(o)){r=o;break}if(r!=="Files")return;let i=n.items;if(i){t.preventDefault();for(let o=0;o<i.length;o++){let s="file";for(let l of Object.values(e.schema.blockSpecs))for(let u of l.implementation.meta?.fileBlockAccept||[]){let c=u.startsWith("."),d=i[o].getAsFile();if(d&&(!c&&d.type&&O$(i[o].type,u)||c&&M$("."+d.name.split(".").pop(),u))){s=l.config.type;break}}let a=i[o].getAsFile();if(a){let l={type:s,props:{name:a.name}},u;if(t.type==="paste"){let h=e.getTextCursorPosition().block;u=nb(e,h,l)}else if(t.type==="drop"){let h={left:t.clientX,top:t.clientY},f=e.prosemirrorView.posAtCoords(h);if(!f)return;u=e.transact(p=>{let g=Tr(p.doc,f.pos),y=e.domElement?.querySelector(`[data-id="${g.node.attrs.id}"]`)?.getBoundingClientRect();return nb(e,e.getBlock(g.node.attrs.id),l,y&&(y.top+y.bottom)/2>h.top?"before":"after")})}else return;let c=await e.uploadFile(a,u),d=typeof c=="string"?{props:{url:c}}:{...c};e.updateBlock(u,d)}}}}var D$=t=>_e.create({name:"dropFile",addProseMirrorPlugins(){return[new re({props:{handleDOMEvents:{drop(e,n){if(!t.isEditable)return;let r=null;for(let i of Xf)if(n.dataTransfer.types.includes(i)){r=i;break}return r===null?!0:r==="Files"?(lS(n,t),!0):!1}}}})]}}),v$=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,L$=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,R$=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,P$=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,B$=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,F$=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,H$=/\n{2} {0,3}-{2,48}\n{2}/,U$=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,$$=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,z$=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,V$=/^\s*\|(.+\|)+\s*$/m,q$=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,j$=/^\s*\|(.+\|)+\s*$/m,W$=t=>v$.test(t)||L$.test(t)||R$.test(t)||P$.test(t)||B$.test(t)||F$.test(t)||H$.test(t)||U$.test(t)||$$.test(t)||z$.test(t)||V$.test(t)||q$.test(t)||j$.test(t);async function Y$(t,e){let{schema:n}=e.state;if(!t.clipboardData)return!1;let r=t.clipboardData.getData("text/plain");if(!r)return!1;if(!n.nodes.codeBlock)return e.pasteText(r),!0;let i=t.clipboardData.getData("vscode-editor-data"),o=(i?JSON.parse(i):void 0)?.mode;return o?(e.pasteHTML(`<pre><code class="language-${o}">${r.replace(/\r\n?/g,`
175
+ `)}</code></pre>`),!0):!1}function G$({event:t,editor:e,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){if(e.transact(s=>s.selection.$from.parent.type.spec.code&&s.selection.$to.parent.type.spec.code)){let s=t.clipboardData?.getData("text/plain");if(s)return e.pasteText(s),!0}let i;for(let s of Xf)if(t.clipboardData.types.includes(s)){i=s;break}if(!i)return!0;if(i==="vscode-editor-data")return Y$(t,e.prosemirrorView),!0;if(i==="Files")return lS(t,e),!0;let o=t.clipboardData.getData(i);if(i==="blocknote/html")return e.pasteHTML(o,!0),!0;if(i==="text/markdown")return e.pasteMarkdown(o),!0;if(n){let s=t.clipboardData.getData("text/plain");if(W$(s))return e.pasteMarkdown(s),!0}return i==="text/html"?(e.pasteHTML(o),!0):r?(e.pasteMarkdown(o),!0):(e.pasteText(o),!0)}var K$=(t,e)=>_e.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new re({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),t.isEditable)return e({event:r,editor:t,defaultPasteHandler:({prioritizeMarkdownOverHTML:i=!0,plainTextAsMarkdown:o=!0}={})=>G$({event:r,editor:t,prioritizeMarkdownOverHTML:i,plainTextAsMarkdown:o})})}}}})]}});function Q$(t,e,n){let r=!1,i=t.state.selection instanceof fe;if(!i){let a=t.state.doc.slice(t.state.selection.from,t.state.selection.to,!1).content,l=[];for(let u=0;u<a.childCount;u++)l.push(a.child(u));r=l.find(u=>u.type.isInGroup("bnBlock")||u.type.name==="blockGroup"||u.type.spec.group==="blockContent")===void 0,r&&(e=a)}let o,s=Su(t.state.schema,n);if(i){e.firstChild?.type.name==="table"&&(e=e.firstChild.content);let a=ZE(e,n.schema.inlineContentSchema,n.schema.styleSchema);o=`<table>${s.exportInlineContent(a,{})}</table>`}else if(r){let a=ou(e,n.schema.inlineContentSchema,n.schema.styleSchema);o=s.exportInlineContent(a,{})}else{let a=LC(e);o=s.exportBlocks(a,{})}return o}function uS(t,e){"node"in t.state.selection&&t.state.selection.node.type.spec.group==="blockContent"&&e.transact(o=>o.setSelection(new q(o.doc.resolve(t.state.selection.from-1))));let n=t.serializeForClipboard(t.state.selection.content()).dom.innerHTML,r=t.state.selection.content().content,i=Q$(t,r,e);return{clipboardHTML:n,externalHTML:i,markdown:Yf(i)}}var rb=()=>{let t=window.getSelection();if(!t||t.isCollapsed)return!0;let e=t.focusNode;for(;e;){if(e instanceof HTMLElement&&e.getAttribute("contenteditable")==="false")return!0;e=e.parentElement}return!1},ib=(t,e,n)=>{n.preventDefault(),n.clipboardData.clearData();let{clipboardHTML:r,externalHTML:i,markdown:o}=uS(e,t);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",i),n.clipboardData.setData("text/plain",o)},X$=t=>_e.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new re({props:{handleDOMEvents:{copy(e,n){return rb()||ib(t,e,n),!0},cut(e,n){return rb()||(ib(t,e,n),e.editable&&e.dispatch(e.state.tr.deleteSelection())),!0},dragstart(e,n){if(!("node"in e.state.selection)||e.state.selection.node.type.spec.group!=="blockContent")return;t.transact(s=>s.setSelection(new q(s.doc.resolve(e.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();let{clipboardHTML:r,externalHTML:i,markdown:o}=uS(e,t);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",i),n.dataTransfer.setData("text/plain",o),!0}}}})]}}),J$=_e.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:Rv()}}]}}),Z$=dn.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Gt(this.options.HTMLAttributes,t)]},renderText(){return`
176
+ `}}),cS=(t,e)=>{let n=t.resolve(e),r=n.depth-1;if(r<1)return;let i=n.before(r),o=t.resolve(i).nodeAfter;if(o)return o.type.spec.group?.includes("bnBlock")?Cr(t.resolve(i)):cS(t,i)},Po=(t,e)=>{let n=t.resolve(e),r=n.index();if(r===0)return;let i=n.posAtIndex(r-1);return Cr(t.resolve(i))},Io=(t,e)=>{let n=t.resolve(e),r=n.index();if(r===n.node().childCount-1)return;let i=n.posAtIndex(r+1);return Cr(t.resolve(i))},th=(t,e)=>{for(;e.childContainer;){let n=e.childContainer.node,r=t.resolve(e.childContainer.beforePos+1).posAtIndex(n.childCount-1);e=Cr(t.resolve(r))}return e},ez=(t,e)=>t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*"&&t.blockContent.node.childCount>0&&e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*",tz=(t,e,n,r)=>{if(!r.isBlockContainer)throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){let i=t.doc.resolve(r.childContainer.beforePos+1),o=t.doc.resolve(r.childContainer.afterPos-1),s=i.blockRange(o);if(e){let a=t.doc.resolve(r.bnBlock.beforePos);t.tr.lift(s,a.depth)}}if(e){if(!n.isBlockContainer)throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);e(t.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},ob=t=>({state:e,dispatch:n})=>{let r=Cr(e.doc.resolve(t)),i=Po(e.doc,r.bnBlock.beforePos);if(!i)return!1;let o=th(e.doc,i);return ez(o,r)?tz(e,n,o,r):!1},nz=_e.create({priority:50,addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({chain:r,commands:i})=>[()=>i.deleteSelection(),()=>i.undoInputRule(),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;let a=o.selection.from===s.blockContent.beforePos+1,l=s.blockContent.node.type.name==="paragraph";return a&&!l?i.command(Mv(s.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>i.command(({state:o,tr:s})=>{let a=Oe(o);if(!a.isBlockContainer)return!1;let{blockContent:l}=a;return o.selection.from===l.beforePos+1?eh(s,s.doc.type.schema.nodes.blockContainer,s.doc.type.schema.nodes.blockGroup):!1}),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;let{bnBlock:a,blockContent:l}=s,u=Po(o.doc,s.bnBlock.beforePos);if(!u||!u.isBlockContainer||u.blockContent.node.type.spec.content!=="inline*")return!1;let c=o.selection.from===l.beforePos+1,d=o.selection.empty,h=a.beforePos;return c&&d?r().command(ob(h)).scrollIntoView().run():!1}),()=>i.command(({state:o,tr:s,dispatch:a})=>{let l=Oe(o);if(!l.isBlockContainer||o.selection.from!==l.blockContent.beforePos+1)return!1;let u=Po(o.doc,l.bnBlock.beforePos);if(!u||u.isBlockContainer)return!1;if(a){let c=u.bnBlock.afterPos-1,d=s.doc.resolve(c-1);return s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),s.insert(d.pos,l.bnBlock.node),s.setSelection($.near(s.doc.resolve(d.pos+1))),!0}return!1}),()=>i.command(({state:o,tr:s,dispatch:a})=>{let l=Oe(o);if(!l.isBlockContainer||s.selection.from!==l.blockContent.beforePos+1)return!1;let u=s.doc.resolve(l.bnBlock.beforePos);if(u.nodeBefore||u.node().type.name!=="column")return!1;let c=s.doc.resolve(l.bnBlock.beforePos),d=s.doc.resolve(c.before()),h=d.before();return a&&(s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),Wa(s,h),d.pos===h+1?(s.insert(h,l.bnBlock.node),s.setSelection($.near(s.doc.resolve(h)))):(s.insert(d.pos-1,l.bnBlock.node),s.setSelection($.near(s.doc.resolve(d.pos))))),!0}),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){let a=Po(o.doc,s.bnBlock.beforePos);if(!a)return!1;let l=th(o.doc,a);if(!l.isBlockContainer||!l||!l.isBlockContainer)return!1;let u=r();if(s.childContainer&&u.insertContentAt(s.bnBlock.afterPos,s.childContainer?.node.content),l.blockContent.node.type.spec.content==="tableRow+"){let c=s.bnBlock.beforePos-1-1-1-1-1;u=u.setTextSelection(c)}else if(l.blockContent.node.type.spec.content==="")u=u.setNodeSelection(l.blockContent.beforePos);else{let c=l.blockContent.afterPos-1;u=u.setTextSelection(c)}return u.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;let a=o.selection.from===s.blockContent.beforePos+1,l=o.selection.empty,u=Po(o.doc,s.bnBlock.beforePos);if(u&&a&&l){let c=th(o.doc,u);if(!c.isBlockContainer)return!1;if(c.blockContent.node.type.spec.content===""||c.blockContent.node.type.spec.content==="inline*"&&c.blockContent.node.childCount===0)return r().cut({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos},c.bnBlock.afterPos).deleteRange({from:c.bnBlock.beforePos,to:c.bnBlock.afterPos}).run()}return!1})]),e=()=>this.editor.commands.first(({chain:r,commands:i})=>[()=>i.deleteSelection(),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer||!s.childContainer)return!1;let{blockContent:a,childContainer:l}=s,u=o.selection.from===a.afterPos-1,c=o.selection.empty,d=Cr(o.doc.resolve(l.beforePos+1));if(!d.isBlockContainer)return!1;if(u&&c){let h=d.blockContent.node,f=h.type.spec.content==="inline*",p=a.node.type.spec.content==="inline*";return r().insertContentAt(d.bnBlock.afterPos,d.childContainer?.node.content||M.empty).deleteRange(l.node.childCount===1?{from:l.beforePos,to:l.afterPos}:{from:d.bnBlock.beforePos,to:d.bnBlock.afterPos}).insertContentAt(o.selection.from,f&&p?h.content:null).setTextSelection(o.selection.from).scrollIntoView().run()}return!1}),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;let{bnBlock:a,blockContent:l}=s,u=Io(o.doc,s.bnBlock.beforePos);if(!u||!u.isBlockContainer)return!1;let c=o.selection.from===l.afterPos-1,d=o.selection.empty,h=a.afterPos;return c&&d?r().command(ob(h)).scrollIntoView().run():!1}),()=>i.command(({state:o,tr:s,dispatch:a})=>{let l=Oe(o);if(!l.isBlockContainer||o.selection.from!==l.blockContent.afterPos-1)return!1;let u=Io(o.doc,l.bnBlock.beforePos);if(!u||u.isBlockContainer)return!1;if(a){let c=u.bnBlock.beforePos+1,d=s.doc.resolve(c+1);return s.delete(d.pos,d.pos+d.nodeAfter.nodeSize),Wa(s,u.bnBlock.beforePos),s.insert(l.bnBlock.afterPos,d.nodeAfter),s.setSelection($.near(s.doc.resolve(d.pos))),!0}return!1}),()=>i.command(({state:o,tr:s,dispatch:a})=>{let l=Oe(o);if(!l.isBlockContainer||s.selection.from!==l.blockContent.afterPos-1)return!1;let u=s.doc.resolve(l.bnBlock.afterPos);if(u.nodeAfter||u.node().type.name!=="column")return!1;let c=s.doc.resolve(l.bnBlock.afterPos),d=s.doc.resolve(c.after()),h=d.after();if(a){let f=d.pos===h-1?h:d.pos+1,p=Cr(s.doc.resolve(f));s.delete(p.bnBlock.beforePos,p.bnBlock.afterPos),Wa(s,h-d.node().nodeSize),s.insert(c.pos,p.bnBlock.node),s.setSelection($.near(s.doc.resolve(f)))}return!0}),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;let{blockContent:a}=s,l=o.selection.from===a.afterPos-1,u=o.selection.empty;if(l&&u){let c=(g,y)=>{let b=Io(g,y);if(b)return b;let C=cS(g,y);if(C)return c(g,C.bnBlock.beforePos)},d=c(o.doc,s.bnBlock.beforePos);if(!d||!d.isBlockContainer)return!1;let h=d.blockContent.node,f=h.type.spec.content==="inline*",p=a.node.type.spec.content==="inline*";return r().insertContentAt(d.bnBlock.afterPos,d.childContainer?.node.content||M.empty).deleteRange({from:d.bnBlock.beforePos,to:d.bnBlock.afterPos}).insertContentAt(o.selection.from,f&&p?h.content:null).setTextSelection(o.selection.from).scrollIntoView().run()}return!1}),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){let a=Io(o.doc,s.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){let u=s.bnBlock.afterPos+1+1+1+1+1;l=l.setTextSelection(u)}else l=a.blockContent.node.type.spec.content===""?l.setNodeSelection(a.blockContent.beforePos):l.setTextSelection(a.blockContent.beforePos+1);return l.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>i.command(({state:o})=>{let s=Oe(o);if(!s.isBlockContainer)return!1;let a=o.selection.from===s.blockContent.afterPos-1,l=o.selection.empty,u=Io(o.doc,s.bnBlock.beforePos);if(!u||!u.isBlockContainer)return!1;if(u&&a&&l&&(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)){let c=u.bnBlock.node.lastChild.content;return r().deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).insertContentAt(s.bnBlock.afterPos,u.bnBlock.node.childCount===2?c:null).run()}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:i,tr:o})=>[()=>i.command(({state:s,tr:a})=>{let l=Oe(s);if(!l.isBlockContainer)return!1;let{bnBlock:u,blockContent:c}=l,{depth:d}=s.doc.resolve(u.beforePos),h=s.selection.$anchor.parentOffset===0,f=s.selection.anchor===s.selection.head,p=c.node.childCount===0;return h&&f&&p&&d>1?eh(a,a.doc.type.schema.nodes.blockContainer,a.doc.type.schema.nodes.blockGroup):!1}),()=>i.command(({state:s})=>{let a=Oe(s),l=this.options.editor.schema.blockSchema[a.blockNoteType].meta?.hardBreakShortcut??"shift+enter";if(l==="none")return!1;if(l==="shift+enter"&&r||l==="enter"){let u=o.storedMarks||o.selection.$head.marks().filter(c=>this.editor.extensionManager.splittableMarks.includes(c.type.name));return o.insert(o.selection.head,o.doc.type.schema.nodes.hardBreak.create()).ensureMarks(u),!0}return!1}),()=>i.command(({state:s,dispatch:a,tr:l})=>{let u=Oe(s);if(!u.isBlockContainer)return!1;let{bnBlock:c,blockContent:d}=u,h=s.selection.$anchor.parentOffset===0,f=s.selection.anchor===s.selection.head,p=d.node.childCount===0;if(h&&f&&p){let g=c.afterPos,y=g+2;if(a){let b=s.schema.nodes.blockContainer.createAndFill(void 0,[s.schema.nodes.paragraph.createAndFill()||void 0,u.childContainer?.node].filter(C=>C!==void 0));l.insert(g,b).setSelection(new $(l.doc.resolve(y))).scrollIntoView(),u.childContainer&&l.delete(u.childContainer.beforePos,u.childContainer.afterPos)}return!0}return!1}),()=>i.command(({state:s,chain:a})=>{let l=Oe(s);if(!l.isBlockContainer)return!1;let{blockContent:u}=l,c=s.selection.$anchor.parentOffset===0;return u.node.childCount===0?!1:(a().deleteSelection().command(lL(s.selection.from,c,c)).run(),!0)})]);return{Backspace:t,Delete:e,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>this.options.tabBehavior!=="prefer-indent"&&(this.options.editor.getExtension(Wd)?.store.state||this.options.editor.getExtension(dr)?.store.state!==void 0)?!1:tS(this.options.editor),"Shift-Tab":()=>this.options.tabBehavior!=="prefer-indent"&&(this.options.editor.getExtension(Wd)?.store.state||this.options.editor.getExtension(dr)?.store.state!==void 0)?!1:nS(this.options.editor),"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),rz=cn.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name==="insertion"?{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["ins",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}:{}}}),iz=cn.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name==="deletion"?{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["del",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}:{}}}),oz=cn.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(t){return t.name==="modification"?{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return[n?"span":"div",{"data-type":"modification","data-id":String(e.attrs.id),"data-mod-type":e.attrs.type,"data-mod-prev-val":JSON.stringify(e.attrs.previousValue),"data-mod-new-val":JSON.stringify(e.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal,newValue:e.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal}:!1}}]}:{}}}),sz=_e.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:t=>t.getAttribute("data-text-alignment"),renderHTML:t=>t.textAlignment==="left"?{}:{"data-text-alignment":t.textAlignment}}}}]}}),az=_e.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:Pv()}}]}}),lz={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},uz=dn.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:t=>{if(typeof t=="string")return!1;let e={};for(let[n,r]of Object.entries(lz))t.getAttribute(r)&&(e[n]=t.getAttribute(r));return e}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:t}){let e=document.createElement("div");e.className="bn-block-outer",e.setAttribute("data-node-type","blockOuter");for(let[i,o]of Object.entries(t))i!=="class"&&e.setAttribute(i,o);let n={...this.options.domAttributes?.block||{},...t},r=document.createElement("div");r.className=kr("bn-block",n.class),r.setAttribute("data-node-type",this.name);for(let[i,o]of Object.entries(n))i!=="class"&&r.setAttribute(i,o);return e.appendChild(r),{dom:e,contentDOM:r}}}),cz=dn.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:t=>typeof t=="string"?!1:t.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:t}){let e={...this.options.domAttributes?.blockGroup||{},...t},n=document.createElement("div");n.className=kr("bn-block-group",e.class),n.setAttribute("data-node-type","blockGroup");for(let[r,i]of Object.entries(e))r!=="class"&&n.setAttribute(r,i);return{dom:n,contentDOM:n}}}),dz=dn.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),hz=de(({options:t})=>({key:"collaboration",blockNoteExtensions:[m9(t),jd(t),Va(t),qa(),b9(t)]}));function fz(t,e){return[wi.ClipboardTextSerializer,wi.Commands,wi.Editable,wi.FocusEvents,wi.Tabindex,C7,iu.configure({types:["blockContainer","columnList","column"],setIdAttribute:e.setIdAttribute,isWithinEditor:t.isWithinEditor}),Z$,S7,rz,iz,oz,I$.configure({HTMLAttributes:e.links?.HTMLAttributes??{},editor:t,onClick:e.links?.onClick,...e.links?.isValidLink?{isValidLink:e.links.isValidLink}:{}}),...Object.values(t.schema.styleSpecs).map(n=>n.implementation.mark.configure({editor:t})),az,J$,sz,_e.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>t.getExtension(Sf)?.shown()?!1:(t.blur(),!0)})}),dz,uz.configure({editor:t,domAttributes:e.domAttributes}),nz.configure({editor:t,tabBehavior:e.tabBehavior}),cz.configure({domAttributes:e.domAttributes}),...Object.values(t.schema.inlineContentSpecs).filter(n=>n.config!=="link"&&n.config!=="text").map(n=>n.implementation.node.configure({editor:t})),...Object.values(t.schema.blockSpecs).flatMap(n=>[..."node"in n.implementation?[n.implementation.node.configure({editor:t,domAttributes:e.domAttributes})]:[]]),X$(t),K$(t,e.pasteHandler||(n=>n.defaultPasteHandler())),D$(t)]}function pz(t,e){let n=[OC(),C9(e),dr(e),Wd(e),x9(e),A9(),N9(e),G9(e),U9(e),Sf(e),...e.trailingBlock===!1?[]:[Y9()]];return e.collaboration?n.push(hz(e.collaboration)):n.push(S9()),"table"in t.schema.blockSpecs&&n.push(W9(e)),e.animations!==!1&&n.push(M9()),n}var mz=class{disabledExtensions=new Set;extensions=[];abortMap=new Map;extensionFactories=new Map;extensionPlugins=new Map;constructor(t,e){this.editor=t,this.options=e,t.onMount(()=>{for(let n of this.extensions)if(n.mount){let r=new window.AbortController,i=n.mount({dom:t.prosemirrorView.dom,root:t.prosemirrorView.root,signal:r.signal});i&&r.signal.addEventListener("abort",()=>{i()}),this.abortMap.set(n,r)}}),t.onUnmount(()=>{for(let[n,r]of this.abortMap.entries())this.abortMap.delete(n),r.abort()}),this.disabledExtensions=new Set(e.disableExtensions||[]);for(let n of pz(this.editor,this.options))this.addExtension(n);for(let n of this.options.extensions??[])this.addExtension(n);for(let n of Object.values(this.editor.schema.blockSpecs))for(let r of n.extensions??[])this.addExtension(r)}registerExtension(t){let e=[].concat(t).filter(Boolean);if(!e.length){console.warn("No extensions found to register",t);return}let n=e.map(i=>this.addExtension(i)).filter(Boolean),r=new Set;for(let i of n)i?.tiptapExtensions&&console.warn(`Extension ${i.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,i),i?.inputRules?.length&&console.warn(`Extension ${i.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,i),this.getProsemirrorPluginsFromExtension(i).plugins.forEach(o=>{r.add(o)});this.updatePlugins(i=>[...i,...r])}addExtension(t){let e;if(e=typeof t=="function"?t({editor:this.editor}):t,!(!e||this.disabledExtensions.has(e.key))){if(typeof t=="function"){let n=e[Rc];typeof n=="function"&&this.extensionFactories.set(n,e)}if(this.extensions.push(e),e.blockNoteExtensions)for(let n of e.blockNoteExtensions)this.addExtension(n);return e}}resolveExtensions(t){let e=[];if(typeof t=="function"){let n=this.extensionFactories.get(t);n&&e.push(n)}else if(Array.isArray(t))for(let n of t)e.push(...this.resolveExtensions(n));else if(typeof t=="object"&&"key"in t)e.push(t);else if(typeof t=="string"){let n=this.extensions.find(r=>r.key===t);n&&e.push(n)}return e}unregisterExtension(t){let e=this.resolveExtensions(t);if(!e.length){console.warn("No extensions found to unregister",t);return}let n=!1,r=new Set;for(let i of e)this.extensions=this.extensions.filter(o=>o!==i),this.extensionFactories.forEach((o,s)=>{o===i&&this.extensionFactories.delete(s)}),this.abortMap.get(i)?.abort(),this.abortMap.delete(i),this.extensionPlugins.get(i)?.forEach(o=>{r.add(o)}),this.extensionPlugins.delete(i),i.tiptapExtensions&&!n&&(n=!0,console.warn(`Extension ${i.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,t));this.updatePlugins(i=>i.filter(o=>!r.has(o)))}updatePlugins(t){let e=this.editor.prosemirrorState,n=e.reconfigure({plugins:t(e.plugins.slice())});this.editor.prosemirrorView.updateState(n)}getTiptapExtensions(){let t=fz(this.editor,this.options).filter(r=>!this.disabledExtensions.has(r.name)),e=ik(this.extensions),n=new Map;for(let r of this.extensions){r.tiptapExtensions&&t.push(...r.tiptapExtensions);let i=e(r.key),{plugins:o,inputRules:s}=this.getProsemirrorPluginsFromExtension(r);o.length&&t.push(_e.create({name:r.key,priority:i,addProseMirrorPlugins:()=>o})),s.length&&(n.has(i)||n.set(i,[]),n.get(i).push(...s))}t.push(_e.create({name:"blocknote-input-rules",addProseMirrorPlugins(){let r=[];return Array.from(n.keys()).sort().reverse().forEach(i=>{r.push(...n.get(i))}),[p7({rules:r})]}}));for(let r of this.options._tiptapOptions?.extensions??[])t.push(r);return t}getProsemirrorPluginsFromExtension(t){let e=[...t.prosemirrorPlugins??[]],n=[];return!t.prosemirrorPlugins?.length&&!Object.keys(t.keyboardShortcuts||{}).length&&!t.inputRules?.length?{plugins:e,inputRules:n}:(this.extensionPlugins.set(t,e),t.inputRules?.length&&n.push(...t.inputRules.map(r=>new pi(r.find,(i,o,s,a)=>{let l=r.replace({match:o,range:{from:s,to:a},editor:this.editor});if(l){let u=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[u.block.type].content!=="inline")return null;let c=Us(i.tr),d=i.tr.deleteRange(s,a);return au(d,c.bnBlock.beforePos,l),d}return null}))),Object.keys(t.keyboardShortcuts||{}).length&&e.push(P1(Object.fromEntries(Object.entries(t.keyboardShortcuts).map(([r,i])=>[r,()=>i({editor:this.editor})])))),{plugins:e,inputRules:n})}getExtensions(){return new Map(this.extensions.map(t=>[t.key,t]))}getExtension(t){if(typeof t=="string")return this.extensions.find(e=>e.key===t)||void 0;if(typeof t=="function")return this.extensionFactories.get(t)||void 0;throw Error(`Invalid extension type: ${typeof t}`)}hasExtension(t){return typeof t=="string"?this.extensions.some(e=>e.key===t):typeof t=="object"&&"key"in t?this.extensions.some(e=>e.key===t.key):typeof t=="function"?this.extensionFactories.has(t):!1}};function gz(t,e){let{$from:n,$to:r}=e;if(n.pos>n.start()&&n.pos<t.content.size){let i=t.textBetween(n.pos,n.pos+1);if(/^[\w\p{P}]$/u.test(i)){let o=t.textBetween(n.start(),n.pos).match(/[\w\p{P}]+$/u);o&&(n=t.resolve(n.pos-o[0].length))}}if(r.pos<r.end()&&r.pos>0){let i=t.textBetween(r.pos-1,r.pos);if(/^[\w\p{P}]$/u.test(i)){let o=t.textBetween(r.pos,r.end()).match(/^[\w\p{P}]+/u);o&&(r=t.resolve(r.pos+o[0].length))}}return{$from:n,$to:r,from:n.pos,to:r.pos}}function bz(t){let e=Fe(t);if(t.selection.empty||"node"in t.selection)return;let n=t.doc.resolve(Tr(t.doc,t.selection.from).posBeforeNode),r=t.doc.resolve(Tr(t.doc,t.selection.to).posBeforeNode),i=(u,c)=>{let d=n.posAtIndex(u,c),h=t.doc.resolve(d).nodeAfter;if(!h)throw Error(`Error getting selection - node not found at position ${d}`);return Ae(h,e)},o=[],s=n.sharedDepth(r.pos),a=n.index(s),l=r.index(s);if(n.depth>s){o.push(Ae(n.nodeAfter,e));for(let u=n.depth;u>s;u--)if(n.node(u).type.isInGroup("childContainer")){let c=n.index(u)+1,d=n.node(u).childCount;for(let h=c;h<d;h++)o.push(i(h,u))}}else o.push(i(a,s));for(let u=a+1;u<=l;u++)o.push(i(u,s));if(o.length===0)throw Error(`Error getting selection - selection doesn't span any blocks (${t.selection})`);return{blocks:o}}function yz(t,e,n){let r=typeof e=="string"?e:e.id,i=typeof n=="string"?n:n.id,o=$s(Fe(t));if(r===i)throw Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);let s=Rt(r,t.doc);if(!s)throw Error(`Block with ID ${r} not found`);let a=Rt(i,t.doc);if(!a)throw Error(`Block with ID ${i} not found`);let l=jn(s),u=jn(a),c=o.blockSchema[l.blockNoteType],d=o.blockSchema[u.blockNoteType];if(!l.isBlockContainer||c.content==="none")throw Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!u.isBlockContainer||d.content==="none")throw Error(`Attempting to set selection anchor in block without content (id ${i})`);let h,f;if(c.content==="table"){let p=Ce.get(l.blockContent.node);h=l.blockContent.beforePos+p.positionAt(0,0,l.blockContent.node)+1+2}else h=l.blockContent.beforePos+1;if(d.content==="table"){let p=Ce.get(u.blockContent.node),g=u.blockContent.beforePos+p.positionAt(p.height-1,p.width-1,u.blockContent.node)+1;f=g+t.doc.resolve(g).nodeAfter.nodeSize-2}else f=u.blockContent.afterPos-1;t.setSelection($.create(t.doc,h,f))}function Ez(t,e=!1){let n=Fe(t),r=e?gz(t.doc,t.selection):t.selection,i=r.$from,o=r.$to;for(;o.parentOffset>=o.parent.nodeSize-2&&o.depth>0;)o=t.doc.resolve(o.pos+1);for(;o.parentOffset===0&&o.depth>0;)o=t.doc.resolve(o.pos-1);for(;i.parentOffset===0&&i.depth>0;)i=t.doc.resolve(i.pos-1);for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=t.doc.resolve(i.pos+1);let s=mv(t.doc.slice(i.pos,o.pos,!0),n);return{_meta:{startPos:i.pos,endPos:o.pos},...s}}function kz(t){let{bnBlock:e}=Us(t),n=Fe(t.doc),r=t.doc.resolve(e.beforePos),i=r.nodeBefore,o=t.doc.resolve(e.afterPos).nodeAfter,s;return r.depth>1&&(s=r.node(),s.type.isInGroup("bnBlock")||(s=r.node(r.depth-1))),{block:Ae(e.node,n),prevBlock:i===null?void 0:Ae(i,n),nextBlock:o===null?void 0:Ae(o,n),parentBlock:s===void 0?void 0:Ae(s,n)}}function dS(t,e,n="start"){let r=typeof e=="string"?e:e.id,i=$s(Fe(t.doc)),o=Rt(r,t.doc);if(!o)throw Error(`Block with ID ${r} not found`);let s=jn(o),a=i.blockSchema[s.blockNoteType].content;if(s.isBlockContainer){let l=s.blockContent;if(a==="none"){t.setSelection(q.create(t.doc,l.beforePos));return}if(a==="inline")n==="start"?t.setSelection($.create(t.doc,l.beforePos+1)):t.setSelection($.create(t.doc,l.afterPos-1));else if(a==="table")n==="start"?t.setSelection($.create(t.doc,l.beforePos+4)):t.setSelection($.create(t.doc,l.afterPos-4));else throw new xn(a)}else dS(t,(n==="start"?s.childContainer.node.firstChild:s.childContainer.node.lastChild).attrs.id,n)}var Tz=class{constructor(t){this.editor=t}getSelection(){return this.editor.transact(t=>bz(t))}getSelectionCutBlocks(t=!1){return this.editor.transact(e=>Ez(e,t))}setSelection(t,e){return this.editor.transact(n=>yz(n,t,e))}getTextCursorPosition(){return this.editor.transact(t=>kz(t))}setTextCursorPosition(t,e="start"){return this.editor.transact(n=>dS(n,t,e))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;let{selection:t}=this.editor.prosemirrorState,{ranges:e}=t,n=Math.min(...e.map(i=>i.$from.pos)),r=Math.max(...e.map(i=>i.$to.pos));if(L2(t)){let i=this.editor.prosemirrorView.nodeDOM(n);if(i)return i.getBoundingClientRect()}return Z1(this.editor.prosemirrorView,n,r).toJSON()}},Cz=class{constructor(t){this.editor=t}activeTransaction=null;can(t){try{return this.isInCan=!0,t()}finally{this.isInCan=!1}}isInCan=!1;exec(t){if(this.activeTransaction)throw Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(t);let e=this.prosemirrorState,n=this.prosemirrorView;return t(e,r=>this.prosemirrorView.dispatch(r),n)}canExec(t){if(this.activeTransaction)throw Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");let e=this.prosemirrorState,n=this.prosemirrorView;return t(e,void 0,n)}transact(t){if(this.activeTransaction)return t(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;let e=t(this.activeTransaction),n=this.activeTransaction;return this.activeTransaction=null,n&&(n.docChanged||n.selectionSet||n.scrolledIntoView||n.storedMarksSet||!n.isGeneric)&&this.prosemirrorView.dispatch(n),e}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){return this.prosemirrorView?.hasFocus()||!1}focus(){this.prosemirrorView?.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(t){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==t&&this.editor._tiptapEditor.setEditable(t)}undo(){let t=this.editor.getExtension("yUndo");if(t)return this.exec(t.undoCommand);let e=this.editor.getExtension("history");if(e)return this.exec(e.undoCommand);throw Error("No undo plugin found")}redo(){let t=this.editor.getExtension("yUndo");if(t)return this.exec(t.redoCommand);let e=this.editor.getExtension("history");if(e)return this.exec(e.redoCommand);throw Error("No redo plugin found")}};function Sz(t,e,n,r={updateSelection:!0}){let{from:i,to:o}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},s=!0,a=!0,l="";if(n.forEach(u=>{u.check(),s&&u.isText&&u.marks.length===0?l+=u.text:s=!1,a=a?u.isBlock:!1}),i===o&&a){let{parent:u}=t.doc.resolve(i);u.isTextblock&&!u.type.spec.code&&!u.childCount&&(--i,o+=1)}return s?t.insertText(l,i,o):t.replaceWith(i,o,n),r.updateSelection&&$1(t,t.steps.length-1,-1),!0}var xz=class{constructor(t){this.editor=t}insertInlineContent(t,{updateSelection:e=!1}={}){let n=un(t,this.editor.pmSchema);this.editor.transact(r=>{Sz(r,{from:r.selection.from,to:r.selection.to},n,{updateSelection:e})})}getActiveStyles(){return this.editor.transact(t=>{let e={},n=t.selection.$to.marks();for(let r of n){let i=this.editor.schema.styleSchema[r.type.name];if(!i){r.type.name!=="link"&&!r.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",r.type.name);continue}i.propSchema==="boolean"?e[i.type]=!0:e[i.type]=r.attrs.stringValue}return e})}addStyles(t){for(let[e,n]of Object.entries(t)){let r=this.editor.schema.styleSchema[e];if(!r)throw Error(`style ${e} not found in styleSchema`);if(r.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(e);else if(r.propSchema==="string")this.editor._tiptapEditor.commands.setMark(e,{stringValue:n});else throw new xn(r.propSchema)}}removeStyles(t){for(let e of Object.keys(t))this.editor._tiptapEditor.commands.unsetMark(e)}toggleStyles(t){for(let[e,n]of Object.entries(t)){let r=this.editor.schema.styleSchema[e];if(!r)throw Error(`style ${e} not found in styleSchema`);if(r.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(e);else if(r.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(e,{stringValue:n});else throw new xn(r.propSchema)}}getSelectedText(){return this.editor.transact(t=>t.doc.textBetween(t.selection.from,t.selection.to))}getLinkMarkAtPos(t){return this.editor.transact(e=>{let n=e.doc.resolve(t),r=n.marks().find(o=>o.type.name==="link");if(!r)return;let i=Ul(n,r.type);if(i)return{href:r.attrs.href,from:i.from,to:i.to,text:e.doc.textBetween(i.from,i.to)}})}getSelectedLinkUrl(){return this.editor.transact(t=>this.getLinkMarkAtPos(t.selection.from)?.href)}createLink(t,e){t!==""&&this.editor.transact(n=>{let{from:r,to:i}=n.selection,o=this.editor.pmSchema.mark("link",{href:t});e?n.insertText(e,r,i).addMark(r,r+e.length,o):n.addMark(r,i,o)})}editLink(t,e,n=this.editor.transact(r=>r.selection.anchor)){this.editor.transact(r=>{let{from:i,to:o}=this.getLinkMarkAtPos(n+1)||{from:r.selection.from,to:r.selection.to},s=this.editor.pmSchema.mark("link",{href:t});e!==r.doc.textBetween(i,o)&&r.insertText(e,i,o),r.addMark(i,i+e.length,s)}),this.editor.prosemirrorView.focus()}deleteLink(t=this.editor.transact(e=>e.selection.anchor)){this.editor.transact(e=>{let{from:n,to:r}=this.getLinkMarkAtPos(t+1)||{from:e.selection.from,to:e.selection.to};e.removeMark(n,r,this.editor.pmSchema.marks.link).setMeta("preventAutolink",!0)}),this.editor.prosemirrorView.focus()}};function wz(t){return q1(t.state.selection.$from,e=>e.type.name==="tableCell"||e.type.name==="tableHeader")!==void 0}function hS(t,e){let n=e.nodes.hardBreak,r=M.empty;return t.forEach(i=>{i.isTextblock&&i.childCount>0?(r=r.append(i.content),r=r.addToEnd(n.create())):i.isText?r=r.addToEnd(i):i.isBlock&&i.childCount>0&&(r=r.append(hS(i.content,e)),r=r.addToEnd(n.create()))}),r.lastChild?.type===n&&(r=r.cut(0,r.size-1)),r}function Az(t,e){let n=[];return t.forEach((r,i,o)=>{o!==e&&n.push(r)}),M.from(n)}function _z(t,e){let n=[];for(let r=0;r<t.childCount;r++)if(t.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){let i=n[n.length-1],o=i.copy(i.content.addToEnd(t.child(r)));n[n.length-1]=o}else{let i=e.nodes.table.createChecked(void 0,t.child(r));n.push(i)}else n.push(t.child(r));return t=M.from(n),t}function Nz(t,e){let n=M.from(t.content);if(n=_z(n,e.state.schema),wz(e)){let r=!1;if(n.descendants(i=>{i.type.isInGroup("tableContent")&&(r=!0)}),!r&&!e.state.schema.nodes.tableParagraph.validContent(n))return new B(hS(n,e.state.schema),0,0)}if(!Iz(n,e))return new B(n,t.openStart,t.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){let i=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){let s=n.child(r+1).child(0).child(0);(s.type.name==="bulletListItem"||s.type.name==="numberedListItem"||s.type.name==="checkListItem")&&(i.push(n.child(r+1)),n=Az(n,r+1))}let o=e.state.schema.nodes.blockContainer.createChecked(void 0,i);n=n.replaceChild(r,o)}return new B(n,t.openStart,t.openEnd)}function Iz(t,e){let n=t.childCount===1,r=t.firstChild?.type.spec.content==="inline*",i=t.firstChild?.type.spec.content==="tableRow+";if(n){if(r)return!1;if(i){let o=Oe(e.state);if(o.isBlockContainer)return o.blockContent.node.type.spec.content!=="tableRow+"}}return!0}var Mz={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1},iV=class fS extends PC{pmSchema;_tiptapEditor;elementRenderer=null;blockCache=new WeakMap;dictionary;schema;blockImplementations;inlineContentImplementations;styleImplementations;uploadFile;onUploadStartCallbacks=[];onUploadEndCallbacks=[];resolveFileUrl;settings;static create(e){return new fS(e??{})}constructor(e){super(),this.options=e,this.dictionary=e.dictionary||K9,this.settings={tables:{splitCells:e?.tables?.splitCells??!1,cellBackgroundColor:e?.tables?.cellBackgroundColor??!1,cellTextColor:e?.tables?.cellTextColor??!1,headers:e?.tables?.headers??!1}};let n={defaultStyles:!0,schema:e.schema||zL.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};if(this.schema=n.schema,this.blockImplementations=n.schema.blockSpecs,this.inlineContentImplementations=n.schema.inlineContentSpecs,this.styleImplementations=n.schema.styleSpecs,n.uploadFile){let l=n.uploadFile;this.uploadFile=async(u,c)=>{this.onUploadStartCallbacks.forEach(d=>d.apply(this,[c]));try{return await l(u,c)}finally{this.onUploadEndCallbacks.forEach(d=>d.apply(this,[c]))}}}this.resolveFileUrl=n.resolveFileUrl,this._eventManager=new G7(this),this._extensionManager=new mz(this,n);let r=this._extensionManager.getTiptapExtensions(),i=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");i&&n.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");let o={...Mz,...n._tiptapOptions,element:null,autofocus:n.autofocus??!1,extensions:r,editorProps:{...n._tiptapOptions?.editorProps,attributes:{tabIndex:"0",...n._tiptapOptions?.editorProps?.attributes,...n.domAttributes?.editor,class:kr("bn-editor",n.defaultStyles?"bn-default-styles":"",n.domAttributes?.editor?.class||"")},transformPasted:Nz}};try{let l=n.initialContent||(i?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:iu.options.generateID()}]);if(!Array.isArray(l)||l.length===0)throw Error("initialContent must be a non-empty array of blocks, received: "+l);let u=_2(o.extensions),c=ol({type:"doc",content:[{type:"blockGroup",content:l.map(d=>ci(d,u,this.schema.styleSchema).toJSON())}]},u,o.parseOptions);this._tiptapEditor=new E_({...o,content:c.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(l){throw Error("Error creating document from blocks passed as `initialContent`",{cause:l})}let s,a=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...l)=>{if(s)return s;let u=a.apply(this.pmSchema.nodes.doc,l),c=JSON.parse(JSON.stringify(u.toJSON()));return c.content[0].content[0].attrs.id="initialBlockId",s=Un.fromJSON(this.pmSchema,c),s},this.pmSchema.cached.blockNoteEditor=this,this._tiptapEditor.on("mount",()=>{this.headless=!1}),this._tiptapEditor.on("unmount",()=>{this.headless=!0}),this._blockManager=new Y7(this),this._exportManager=new l$(this),this._selectionManager=new Tz(this),this._stateManager=new Cz(this),this._styleManager=new xz(this),this.emit("create")}_blockManager;_eventManager;_exportManager;_extensionManager;_selectionManager;_stateManager;_styleManager;get extensions(){return this._extensionManager.getExtensions()}exec(e){return this._stateManager.exec(e)}canExec(e){return this._stateManager.canExec(e)}transact(e){return this._stateManager.transact(e)}unregisterExtension=(...e)=>this._extensionManager.unregisterExtension(...e);registerExtension=(...e)=>this._extensionManager.registerExtension(...e);getExtension=((...e)=>this._extensionManager.getExtension(...e));mount=e=>{let n=e.getRootNode();typeof ShadowRoot<"u"&&n instanceof ShadowRoot?n.appendChild(this.portalElement):document.body.appendChild(this.portalElement),this._tiptapEditor.mount({mount:e})};unmount=()=>{this.portalElement?.remove(),this._tiptapEditor.unmount()};get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){if(!this.headless)return this.prosemirrorView?.dom}_portalElement;get portalElement(){if(typeof document>"u")throw Error("Portal element accessed, but not available in headless mode");return this._portalElement||=document.createElement("div"),this._portalElement}isWithinEditor=e=>!!(this.domElement?.parentElement?.contains(e)||this.portalElement?.contains(e));isFocused(){return this.headless?!1:this.prosemirrorView?.hasFocus()||!1}headless=!0;focus(){this.headless||this.prosemirrorView.focus()}blur(){this.headless||this.domElement?.blur()}onUploadStart(e){return this.onUploadStartCallbacks.push(e),()=>{let n=this.onUploadStartCallbacks.indexOf(e);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(e){return this.onUploadEndCallbacks.push(e),()=>{let n=this.onUploadEndCallbacks.indexOf(e);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(e){return this._blockManager.getBlock(e)}getPrevBlock(e){return this._blockManager.getPrevBlock(e)}getNextBlock(e){return this._blockManager.getNextBlock(e)}getParentBlock(e){return this._blockManager.getParentBlock(e)}forEachBlock(e,n=!1){this._blockManager.forEachBlock(e,n)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}onBeforeChange(e){return this._extensionManager.getExtension(OC).subscribe(e)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(e,n="start"){return this._selectionManager.setTextCursorPosition(e,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(e=!1){return this._selectionManager.getSelectionCutBlocks(e)}setSelection(e,n){return this._selectionManager.setSelection(e,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(e){this._stateManager.isEditable=e}insertBlocks(e,n,r="before"){return this._blockManager.insertBlocks(e,n,r)}updateBlock(e,n){return this._blockManager.updateBlock(e,n)}removeBlocks(e){return this._blockManager.removeBlocks(e)}replaceBlocks(e,n){return this._blockManager.replaceBlocks(e,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(e,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(e,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(e){this._styleManager.addStyles(e)}removeStyles(e){this._styleManager.removeStyles(e)}toggleStyles(e){this._styleManager.toggleStyles(e)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(e,n){this._styleManager.createLink(e,n)}getLinkMarkAtPos(e){return this._styleManager.getLinkMarkAtPos(e)}editLink(e,n,r){this._styleManager.editLink(e,n,r)}deleteLink(e){this._styleManager.deleteLink(e)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(e=this.document){return this._exportManager.blocksToHTMLLossy(e)}blocksToFullHTML(e=this.document){return this._exportManager.blocksToFullHTML(e)}tryParseHTMLToBlocks(e){return this._exportManager.tryParseHTMLToBlocks(e)}blocksToMarkdownLossy(e=this.document){return this._exportManager.blocksToMarkdownLossy(e)}tryParseMarkdownToBlocks(e){return this._exportManager.tryParseMarkdownToBlocks(e)}onChange(e,n){return this._eventManager.onChange(e,n)}onSelectionChange(e,n){return this._eventManager.onSelectionChange(e,n)}onMount(e){return this._eventManager.onMount(e)}onUnmount(e){return this._eventManager.onUnmount(e)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){let e=this.document;return e.length===0||e.length===1&&e[0].type==="paragraph"&&e[0].content.length===0}pasteHTML(e,n=!1){this._exportManager.pasteHTML(e,n)}pasteText(e){return this._exportManager.pasteText(e)}pasteMarkdown(e){return this._exportManager.pasteMarkdown(e)}};export{iV as $,tV as A,Sd as B,Qn as C,le as D,Wz as E,Yz as F,hf as G,As as H,Qz as I,dn as J,pe as K,Xz as L,cn as M,Pz as N,bg as O,he as P,un as Q,bf as R,zz as S,$ as T,bk as U,$z as V,uv as W,rV as X,dr as Y,Ue as Z,ip as _,re as a,Vz as a0,lv as a1,qz as a2,Hz as a3,Uz as a4,FL as a5,yk as a6,G9 as b,me as c,al as d,PC as e,Sf as f,yd as g,Gz as h,Lz as i,Wd as j,W9 as k,Cd as l,Gt as m,de as n,x9 as o,Z1 as p,zL as q,ai as r,kL as s,U9 as t,Jz as u,Zz as v,kr as w,Rt as x,xe as y,ws as z};